purescript 0.6.9.5 → 0.15.15
raw patch · 2185 files changed
Files
- .hspec +1/−0
- CONTRIBUTING.md +177/−0
- CONTRIBUTORS.md +197/−0
- INSTALL.md +73/−0
- LICENSE +5012/−684
- README.md +33/−0
- VERSIONING_POLICY.md +9/−0
- app/Command/Bundle.hs +23/−0
- app/Command/Compile.hs +155/−0
- app/Command/Docs.hs +168/−0
- app/Command/Docs/Html.hs +167/−0
- app/Command/Docs/Markdown.hs +24/−0
- app/Command/Graph.hs +85/−0
- app/Command/Hierarchy.hs +80/−0
- app/Command/Ide.hs +259/−0
- app/Command/Publish.hs +80/−0
- app/Command/REPL.hs +209/−0
- app/Main.hs +85/−0
- app/SharedCLI.hs +24/−0
- app/Version.hs +33/−0
- app/static/normalize.css +427/−0
- app/static/pursuit.css +927/−0
- app/static/pursuit.less +1070/−0
- bundle/README +13/−0
- bundle/build.sh +62/−0
- examples/failing/ArrayType.purs +0/−11
- examples/failing/Arrays.purs +0/−5
- examples/failing/Do.purs +0/−8
- examples/failing/DuplicateDeclarationsInLet.purs +0/−9
- examples/failing/DuplicateProperties1.purs +0/−9
- examples/failing/DuplicateProperties2.purs +0/−9
- examples/failing/DuplicateTypeVars.purs +0/−3
- examples/failing/Eff.purs +0/−12
- examples/failing/Foldable.purs +0/−12
- examples/failing/InstanceExport.purs +0/−15
- examples/failing/KindError.purs +0/−3
- examples/failing/Let.purs +0/−3
- examples/failing/MPTCs.purs +0/−7
- examples/failing/MissingClassExport.purs +0/−4
- examples/failing/MissingClassMemberExport.purs +0/−4
- examples/failing/MultipleErrors.purs +0/−9
- examples/failing/MultipleErrors2.purs +0/−5
- examples/failing/MutRec.purs +0/−5
- examples/failing/MutRec2.purs +0/−3
- examples/failing/NewtypeMultiArgs.purs +0/−3
- examples/failing/NewtypeMultiCtor.purs +0/−3
- examples/failing/NoOverlap.purs +0/−11
- examples/failing/NullaryAbs.purs +0/−3
- examples/failing/Object.purs +0/−5
- examples/failing/OverlappingArguments.purs +0/−3
- examples/failing/OverlappingBinders.purs +0/−4
- examples/failing/OverlappingInstances.purs +0/−11
- examples/failing/OverlappingInstances2.purs +0/−23
- examples/failing/OverlappingVars.purs +0/−12
- examples/failing/Rank2Types.purs +0/−7
- examples/failing/Reserved.purs +0/−4
- examples/failing/SkolemEscape.purs +0/−5
- examples/failing/SkolemEscape2.purs +0/−9
- examples/failing/Superclasses1.purs +0/−11
- examples/failing/Superclasses2.purs +0/−9
- examples/failing/Superclasses3.purs +0/−5
- examples/failing/Superclasses4.purs +0/−12
- examples/failing/TopLevelCaseNoArgs.purs +0/−4
- examples/failing/TypeClassInstances.purs +0/−8
- examples/failing/TypeClasses2.purs +0/−8
- examples/failing/TypeError.purs +0/−5
- examples/failing/TypeSynonyms.purs +0/−5
- examples/failing/TypeSynonyms2.purs +0/−9
- examples/failing/TypeSynonyms3.purs +0/−9
- examples/failing/TypeSynonyms4.purs +0/−8
- examples/failing/TypeWildcards1.purs +0/−4
- examples/failing/TypeWildcards2.purs +0/−4
- examples/failing/TypeWildcards3.purs +0/−7
- examples/failing/UnderscoreModuleName.purs +0/−3
- examples/failing/UnifyInTypeInstanceLookup.purs +0/−17
- examples/failing/UnknownType.purs +0/−4
- examples/passing/652.purs +0/−15
- examples/passing/810.purs +0/−11
- examples/passing/Applicative.purs +0/−16
- examples/passing/ArrayType.purs +0/−9
- examples/passing/Arrays.purs +0/−24
- examples/passing/Auto.purs +0/−13
- examples/passing/AutoPrelude.purs +0/−8
- examples/passing/AutoPrelude2.purs +0/−9
- examples/passing/BindersInFunctions.purs +0/−18
- examples/passing/BindingGroups.purs +0/−8
- examples/passing/BlockString.purs +0/−12
- examples/passing/CaseInDo.purs +0/−20
- examples/passing/CaseStatement.purs +0/−19
- examples/passing/CheckFunction.purs +0/−5
- examples/passing/CheckSynonymBug.purs +0/−16
- examples/passing/CheckTypeClass.purs +0/−16
- examples/passing/Church.purs +0/−18
- examples/passing/Collatz.purs +0/−18
- examples/passing/Comparisons.purs +0/−25
- examples/passing/Conditional.purs +0/−9
- examples/passing/Console.purs +0/−13
- examples/passing/DataAndType.purs +0/−7
- examples/passing/DeepArrayBinder.purs +0/−18
- examples/passing/DeepCase.purs +0/−14
- examples/passing/Do.purs +0/−67
- examples/passing/Dollar.purs +0/−16
- examples/passing/Eff.purs +0/−25
- examples/passing/EmptyDataDecls.purs +0/−34
- examples/passing/EmptyRow.purs +0/−8
- examples/passing/EmptyTypeClass.purs +0/−12
- examples/passing/EqOrd.purs +0/−14
- examples/passing/ExtendedInfixOperators.purs +0/−20
- examples/passing/ExternData.purs +0/−13
- examples/passing/ExternRaw.purs +0/−26
- examples/passing/FFI.purs +0/−13
- examples/passing/Fib.purs +0/−15
- examples/passing/FinalTagless.purs +0/−22
- examples/passing/ForeignInstance.purs +0/−20
- examples/passing/FunctionScope.purs +0/−19
- examples/passing/Functions.purs +0/−15
- examples/passing/Functions2.purs +0/−19
- examples/passing/Guards.purs +0/−29
- examples/passing/HoistError.purs +0/−19
- examples/passing/IfThenElseMaybe.purs +0/−9
- examples/passing/ImplicitEmptyImport.purs +0/−6
- examples/passing/ImportHiding.purs +0/−18
- examples/passing/InferRecFunWithConstrainedArgument.purs +0/−8
- examples/passing/InstanceBeforeClass.purs +0/−9
- examples/passing/JSReserved.purs +0/−12
- examples/passing/KindedType.purs +0/−31
- examples/passing/Let.purs +0/−64
- examples/passing/LetInInstance.purs +0/−12
- examples/passing/LiberalTypeSynonyms.purs +0/−19
- examples/passing/MPTCs.purs +0/−20
- examples/passing/Match.purs +0/−7
- examples/passing/Monad.purs +0/−32
- examples/passing/MonadState.purs +0/−48
- examples/passing/MultiArgFunctions.purs +0/−26
- examples/passing/MultipleConstructorArgs.purs +0/−21
- examples/passing/MutRec.purs +0/−19
- examples/passing/MutRec2.purs +0/−17
- examples/passing/MutRec3.purs +0/−17
- examples/passing/NamedPatterns.purs +0/−7
- examples/passing/NegativeBinder.purs +0/−7
- examples/passing/Nested.purs +0/−7
- examples/passing/NestedTypeSynonyms.purs +0/−11
- examples/passing/NestedWhere.purs +0/−10
- examples/passing/Newtype.purs +0/−22
- examples/passing/NewtypeEff.purs +0/−28
- examples/passing/NewtypeWithRecordUpdate.purs +0/−15
- examples/passing/ObjectGetter.purs +0/−11
- examples/passing/ObjectSynonym.purs +0/−13
- examples/passing/ObjectUpdate.purs +0/−18
- examples/passing/ObjectUpdate2.purs +0/−14
- examples/passing/ObjectUpdater.purs +0/−35
- examples/passing/ObjectWildcards.purs +0/−31
- examples/passing/Objects.purs +0/−35
- examples/passing/OneConstructor.purs +0/−7
- examples/passing/OperatorAssociativity.purs +0/−58
- examples/passing/OperatorSections.purs +0/−21
- examples/passing/Operators.purs +0/−102
- examples/passing/OptimizerBug.purs +0/−9
- examples/passing/PartialFunction.purs +0/−19
- examples/passing/Patterns.purs +0/−28
- examples/passing/Person.purs +0/−18
- examples/passing/Rank2Data.purs +0/−29
- examples/passing/Rank2Object.purs +0/−10
- examples/passing/Rank2TypeSynonym.purs +0/−15
- examples/passing/Rank2Types.purs +0/−11
- examples/passing/Recursion.purs +0/−10
- examples/passing/ReservedWords.purs +0/−13
- examples/passing/RowPolyInstanceContext.purs +0/−20
- examples/passing/RowSynonyms.purs +0/−46
- examples/passing/RuntimeScopeIssue.purs +0/−19
- examples/passing/ScopedTypeVariables.purs +0/−34
- examples/passing/Sequence.purs +0/−12
- examples/passing/SequenceDesugared.purs +0/−34
- examples/passing/ShadowedRename.purs +0/−21
- examples/passing/ShadowedTCO.purs +0/−16
- examples/passing/ShadowedTCOLet.purs +0/−7
- examples/passing/SignedNumericLiterals.purs +0/−15
- examples/passing/Superclasses1.purs +0/−18
- examples/passing/Superclasses2.purs +0/−23
- examples/passing/Superclasses3.purs +0/−41
- examples/passing/TCOCase.purs +0/−10
- examples/passing/TailCall.purs +0/−15
- examples/passing/Tick.purs +0/−5
- examples/passing/TopLevelCase.purs +0/−18
- examples/passing/TypeClassImport.purs +0/−18
- examples/passing/TypeClassMemberOrderChange.purs +0/−11
- examples/passing/TypeClasses.purs +0/−69
- examples/passing/TypeClassesInOrder.purs +0/−11
- examples/passing/TypeClassesWithOverlappingTypeVariables.purs +0/−11
- examples/passing/TypeDecl.purs +0/−12
- examples/passing/TypeSynonymInData.purs +0/−9
- examples/passing/TypeSynonyms.purs +0/−25
- examples/passing/TypeWildcards.purs +0/−13
- examples/passing/TypeWildcardsRecordExtension.purs +0/−6
- examples/passing/TypedWhere.purs +0/−13
- examples/passing/UnderscoreIdent.purs +0/−9
- examples/passing/Unit.purs +0/−6
- examples/passing/UnknownInTypeClassLookup.purs +0/−12
- examples/passing/Where.purs +0/−49
- examples/passing/iota.purs +0/−9
- examples/passing/s.purs +0/−5
- hierarchy/Main.hs +0/−113
- prelude/prelude.purs +0/−1478
- psc-docs/Ctags.hs +0/−13
- psc-docs/Etags.hs +0/−15
- psc-docs/Main.hs +0/−265
- psc-docs/Tags.hs +0/−18
- psc-make/Main.hs +0/−177
- psc/Main.hs +0/−209
- psci/Commands.hs +0/−78
- psci/Directive.hs +0/−79
- psci/Main.hs +0/−702
- psci/Parser.hs +0/−125
- purescript.cabal +547/−169
- src/Control/Monad/Logger.hs +56/−0
- src/Control/Monad/Supply.hs +10/−25
- src/Control/Monad/Supply/Class.hs +22/−23
- src/Control/Monad/Unify.hs +0/−159
- src/Data/Text/PureScript.hs +23/−0
- src/Language/PureScript.hs +10/−250
- src/Language/PureScript/AST.hs +4/−13
- src/Language/PureScript/AST/Binders.hs +121/−46
- src/Language/PureScript/AST/Declarations.hs +607/−193
- src/Language/PureScript/AST/Declarations/ChainId.hs +20/−0
- src/Language/PureScript/AST/Exported.hs +173/−0
- src/Language/PureScript/AST/Literals.hs +41/−0
- src/Language/PureScript/AST/Operators.hs +42/−21
- src/Language/PureScript/AST/SourcePos.hs +105/−40
- src/Language/PureScript/AST/Traversals.hs +579/−265
- src/Language/PureScript/AST/Utils.hs +59/−0
- src/Language/PureScript/Bundle.hs +449/−0
- src/Language/PureScript/CST.hs +105/−0
- src/Language/PureScript/CST/Convert.hs +709/−0
- src/Language/PureScript/CST/Errors.hs +201/−0
- src/Language/PureScript/CST/Flatten.hs +315/−0
- src/Language/PureScript/CST/Layout.hs +552/−0
- src/Language/PureScript/CST/Lexer.hs +780/−0
- src/Language/PureScript/CST/Monad.hs +185/−0
- src/Language/PureScript/CST/Parser.y +818/−0
- src/Language/PureScript/CST/Positions.hs +338/−0
- src/Language/PureScript/CST/Print.hs +96/−0
- src/Language/PureScript/CST/Traversals.hs +11/−0
- src/Language/PureScript/CST/Traversals/Type.hs +41/−0
- src/Language/PureScript/CST/Types.hs +440/−0
- src/Language/PureScript/CST/Utils.hs +355/−0
- src/Language/PureScript/CodeGen.hs +8/−25
- src/Language/PureScript/CodeGen/Externs.hs +0/−121
- src/Language/PureScript/CodeGen/JS.hs +415/−255
- src/Language/PureScript/CodeGen/JS/AST.hs +0/−337
- src/Language/PureScript/CodeGen/JS/Common.hs +232/−164
- src/Language/PureScript/CodeGen/JS/Optimizer.hs +0/−86
- src/Language/PureScript/CodeGen/JS/Optimizer/Blocks.hs +0/−42
- src/Language/PureScript/CodeGen/JS/Optimizer/Common.hs +0/−77
- src/Language/PureScript/CodeGen/JS/Optimizer/Inliner.hs +0/−201
- src/Language/PureScript/CodeGen/JS/Optimizer/MagicDo.hs +0/−165
- src/Language/PureScript/CodeGen/JS/Optimizer/TCO.hs +0/−103
- src/Language/PureScript/CodeGen/JS/Optimizer/Unused.hs +0/−46
- src/Language/PureScript/CodeGen/JS/Printer.hs +310/−0
- src/Language/PureScript/Comments.hs +17/−18
- src/Language/PureScript/Constants.hs +0/−239
- src/Language/PureScript/Constants/Libs.hs +264/−0
- src/Language/PureScript/Constants/Prim.hs +57/−0
- src/Language/PureScript/Constants/TH.hs +224/−0
- src/Language/PureScript/CoreFn.hs +4/−14
- src/Language/PureScript/CoreFn/Ann.hs +10/−23
- src/Language/PureScript/CoreFn/Binders.hs +16/−22
- src/Language/PureScript/CoreFn/CSE.hs +442/−0
- src/Language/PureScript/CoreFn/Desugar.hs +215/−197
- src/Language/PureScript/CoreFn/Expr.hs +28/−40
- src/Language/PureScript/CoreFn/FromJSON.hs +319/−0
- src/Language/PureScript/CoreFn/Laziness.hs +568/−0
- src/Language/PureScript/CoreFn/Literals.hs +0/−46
- src/Language/PureScript/CoreFn/Meta.hs +21/−21
- src/Language/PureScript/CoreFn/Module.hs +18/−25
- src/Language/PureScript/CoreFn/Optimizer.hs +31/−0
- src/Language/PureScript/CoreFn/ToJSON.hs +249/−0
- src/Language/PureScript/CoreFn/Traversals.hs +45/−44
- src/Language/PureScript/CoreImp.hs +13/−0
- src/Language/PureScript/CoreImp/AST.hs +242/−0
- src/Language/PureScript/CoreImp/Module.hs +19/−0
- src/Language/PureScript/CoreImp/Optimizer.hs +85/−0
- src/Language/PureScript/CoreImp/Optimizer/Blocks.hs +28/−0
- src/Language/PureScript/CoreImp/Optimizer/Common.hs +72/−0
- src/Language/PureScript/CoreImp/Optimizer/Inliner.hs +294/−0
- src/Language/PureScript/CoreImp/Optimizer/MagicDo.hs +136/−0
- src/Language/PureScript/CoreImp/Optimizer/TCO.hs +191/−0
- src/Language/PureScript/CoreImp/Optimizer/Unused.hs +55/−0
- src/Language/PureScript/Crash.hs +12/−0
- src/Language/PureScript/DeadCodeElimination.hs +0/−102
- src/Language/PureScript/Docs.hs +16/−0
- src/Language/PureScript/Docs/AsHtml.hs +355/−0
- src/Language/PureScript/Docs/AsMarkdown.hs +122/−0
- src/Language/PureScript/Docs/Collect.hs +225/−0
- src/Language/PureScript/Docs/Convert.hs +273/−0
- src/Language/PureScript/Docs/Convert/ReExports.hs +518/−0
- src/Language/PureScript/Docs/Convert/Single.hs +235/−0
- src/Language/PureScript/Docs/Css.hs +31/−0
- src/Language/PureScript/Docs/Prim.hs +666/−0
- src/Language/PureScript/Docs/Render.hs +142/−0
- src/Language/PureScript/Docs/RenderedCode.hs +8/−0
- src/Language/PureScript/Docs/RenderedCode/RenderType.hs +255/−0
- src/Language/PureScript/Docs/RenderedCode/Types.hs +315/−0
- src/Language/PureScript/Docs/Tags.hs +53/−0
- src/Language/PureScript/Docs/Types.hs +882/−0
- src/Language/PureScript/Docs/Utils/MonoidExtras.hs +8/−0
- src/Language/PureScript/Environment.hs +649/−203
- src/Language/PureScript/Errors.hs +2077/−524
- src/Language/PureScript/Errors/JSON.hs +75/−0
- src/Language/PureScript/Externs.hs +280/−0
- src/Language/PureScript/Glob.hs +44/−0
- src/Language/PureScript/Graph.hs +58/−0
- src/Language/PureScript/Hierarchy.hs +85/−0
- src/Language/PureScript/Ide.hs +234/−0
- src/Language/PureScript/Ide/CaseSplit.hs +155/−0
- src/Language/PureScript/Ide/Command.hs +189/−0
- src/Language/PureScript/Ide/Completion.hs +141/−0
- src/Language/PureScript/Ide/Error.hs +97/−0
- src/Language/PureScript/Ide/Externs.hs +142/−0
- src/Language/PureScript/Ide/Filter.hs +168/−0
- src/Language/PureScript/Ide/Filter/Declaration.hs +42/−0
- src/Language/PureScript/Ide/Filter/Imports.hs +31/−0
- src/Language/PureScript/Ide/Imports.hs +154/−0
- src/Language/PureScript/Ide/Imports/Actions.hs +251/−0
- src/Language/PureScript/Ide/Logging.hs +41/−0
- src/Language/PureScript/Ide/Matcher.hs +121/−0
- src/Language/PureScript/Ide/Prim.hs +69/−0
- src/Language/PureScript/Ide/Rebuild.hs +233/−0
- src/Language/PureScript/Ide/Reexports.hs +129/−0
- src/Language/PureScript/Ide/SourceFile.hs +102/−0
- src/Language/PureScript/Ide/State.hs +452/−0
- src/Language/PureScript/Ide/Types.hs +327/−0
- src/Language/PureScript/Ide/Usage.hs +161/−0
- src/Language/PureScript/Ide/Util.hs +125/−0
- src/Language/PureScript/Interactive.hs +363/−0
- src/Language/PureScript/Interactive/Completion.hs +193/−0
- src/Language/PureScript/Interactive/Directive.hs +87/−0
- src/Language/PureScript/Interactive/IO.hs +86/−0
- src/Language/PureScript/Interactive/Message.hs +59/−0
- src/Language/PureScript/Interactive/Module.hs +95/−0
- src/Language/PureScript/Interactive/Parser.hs +147/−0
- src/Language/PureScript/Interactive/Printer.hs +132/−0
- src/Language/PureScript/Interactive/Types.hs +242/−0
- src/Language/PureScript/Kinds.hs +0/−60
- src/Language/PureScript/Label.hs +21/−0
- src/Language/PureScript/Linter.hs +299/−0
- src/Language/PureScript/Linter/Exhaustive.hs +309/−0
- src/Language/PureScript/Linter/Imports.hs +388/−0
- src/Language/PureScript/Linter/Wildcards.hs +47/−0
- src/Language/PureScript/Make.hs +302/−0
- src/Language/PureScript/Make/Actions.hs +455/−0
- src/Language/PureScript/Make/BuildPlan.hs +216/−0
- src/Language/PureScript/Make/Cache.hs +149/−0
- src/Language/PureScript/Make/Monad.hs +187/−0
- src/Language/PureScript/ModuleDependencies.hs +76/−63
- src/Language/PureScript/Names.hs +281/−44
- src/Language/PureScript/Options.hs +25/−85
- src/Language/PureScript/PSString.hs +240/−0
- src/Language/PureScript/Parser.hs +0/−35
- src/Language/PureScript/Parser/Common.hs +0/−134
- src/Language/PureScript/Parser/Declarations.hs +0/−526
- src/Language/PureScript/Parser/Kinds.hs +0/−45
- src/Language/PureScript/Parser/Lexer.hs +0/−499
- src/Language/PureScript/Parser/State.hs +0/−30
- src/Language/PureScript/Parser/Types.hs +0/−134
- src/Language/PureScript/Pretty.hs +6/−26
- src/Language/PureScript/Pretty/Common.hs +107/−38
- src/Language/PureScript/Pretty/JS.hs +0/−301
- src/Language/PureScript/Pretty/Kinds.hs +0/−59
- src/Language/PureScript/Pretty/Types.hs +269/−88
- src/Language/PureScript/Pretty/Values.hs +197/−217
- src/Language/PureScript/Publish.hs +390/−0
- src/Language/PureScript/Publish/BoxesHelpers.hs +46/−0
- src/Language/PureScript/Publish/ErrorsWarnings.hs +412/−0
- src/Language/PureScript/Publish/Registry/Compat.hs +98/−0
- src/Language/PureScript/Publish/Utils.hs +14/−0
- src/Language/PureScript/Renamer.hs +111/−90
- src/Language/PureScript/Roles.hs +43/−0
- src/Language/PureScript/Sugar.hs +38/−34
- src/Language/PureScript/Sugar/AdoNotation.hs +66/−0
- src/Language/PureScript/Sugar/BindingGroups.hs +225/−127
- src/Language/PureScript/Sugar/CaseDeclarations.hs +367/−109
- src/Language/PureScript/Sugar/DoNotation.hs +73/−67
- src/Language/PureScript/Sugar/LetPattern.hs +54/−0
- src/Language/PureScript/Sugar/Names.hs +385/−483
- src/Language/PureScript/Sugar/Names/Common.hs +68/−0
- src/Language/PureScript/Sugar/Names/Env.hs +501/−0
- src/Language/PureScript/Sugar/Names/Exports.hs +304/−0
- src/Language/PureScript/Sugar/Names/Imports.hs +229/−0
- src/Language/PureScript/Sugar/ObjectWildcards.hs +90/−54
- src/Language/PureScript/Sugar/Operators.hs +444/−117
- src/Language/PureScript/Sugar/Operators/Binders.hs +33/−0
- src/Language/PureScript/Sugar/Operators/Common.hs +144/−0
- src/Language/PureScript/Sugar/Operators/Expr.hs +52/−0
- src/Language/PureScript/Sugar/Operators/Types.hs +34/−0
- src/Language/PureScript/Sugar/TypeClasses.hs +267/−173
- src/Language/PureScript/Sugar/TypeClasses/Deriving.hs +207/−0
- src/Language/PureScript/Sugar/TypeDeclarations.hs +87/−60
- src/Language/PureScript/Traversals.hs +6/−24
- src/Language/PureScript/TypeChecker.hs +690/−244
- src/Language/PureScript/TypeChecker/Deriving.hs +836/−0
- src/Language/PureScript/TypeChecker/Entailment.hs +921/−195
- src/Language/PureScript/TypeChecker/Entailment/Coercible.hs +946/−0
- src/Language/PureScript/TypeChecker/Entailment/IntCompare.hs +102/−0
- src/Language/PureScript/TypeChecker/Kinds.hs +1020/−217
- src/Language/PureScript/TypeChecker/Monad.hs +419/−176
- src/Language/PureScript/TypeChecker/Roles.hs +263/−0
- src/Language/PureScript/TypeChecker/Rows.hs +0/−66
- src/Language/PureScript/TypeChecker/Skolems.hs +114/−97
- src/Language/PureScript/TypeChecker/Subsumption.hs +117/−82
- src/Language/PureScript/TypeChecker/Synonyms.hs +48/−97
- src/Language/PureScript/TypeChecker/TypeSearch.hs +133/−0
- src/Language/PureScript/TypeChecker/Types.hs +1040/−667
- src/Language/PureScript/TypeChecker/Unify.hs +183/−163
- src/Language/PureScript/TypeClassDictionaries.hs +39/−86
- src/Language/PureScript/Types.hs +874/−314
- src/System/IO/UTF8.hs +32/−0
- stack.yaml +44/−0
- tests/Language/PureScript/Ide/CompletionSpec.hs +145/−0
- tests/Language/PureScript/Ide/FilterSpec.hs +193/−0
- tests/Language/PureScript/Ide/ImportsSpec.hs +398/−0
- tests/Language/PureScript/Ide/MatcherSpec.hs +33/−0
- tests/Language/PureScript/Ide/RebuildSpec.hs +89/−0
- tests/Language/PureScript/Ide/ReexportsSpec.hs +63/−0
- tests/Language/PureScript/Ide/SourceFileSpec.hs +114/−0
- tests/Language/PureScript/Ide/StateSpec.hs +105/−0
- tests/Language/PureScript/Ide/Test.hs +152/−0
- tests/Language/PureScript/Ide/UsageSpec.hs +78/−0
- tests/Main.hs +38/−98
- tests/PscIdeSpec.hs +1/−0
- tests/TestAst.hs +98/−0
- tests/TestCompiler.hs +263/−0
- tests/TestCoreFn.hs +267/−0
- tests/TestCst.hs +222/−0
- tests/TestDocs.hs +989/−0
- tests/TestGraph.hs +28/−0
- tests/TestHierarchy.hs +67/−0
- tests/TestIde.hs +18/−0
- tests/TestMake.hs +276/−0
- tests/TestPrimDocs.hs +37/−0
- tests/TestPscPublish.hs +120/−0
- tests/TestPsci.hs +14/−0
- tests/TestPsci/CommandTest.hs +79/−0
- tests/TestPsci/CompletionTest.hs +135/−0
- tests/TestPsci/EvalTest.hs +65/−0
- tests/TestPsci/TestEnv.hs +125/−0
- tests/TestSourceMaps.hs +77/−0
- tests/TestUtils.hs +318/−0
- tests/json-compat/v0.11.3/generics-4.0.0.json +1/−0
- tests/json-compat/v0.11.3/symbols-3.0.0.json +1/−0
- tests/json-compat/v0.12.1/typelevel-prelude-3.0.0.json +1/−0
- tests/json-compat/v0.14.0/prelude-5.0.1.json +1/−0
- tests/purs/docs/bower.json +21/−0
- tests/purs/docs/bower_components/purescript-newtype/src/Data/Newtype.purs +6/−0
- tests/purs/docs/bower_components/purescript-prelude/src/Prelude.purs +8/−0
- tests/purs/docs/output/Ado/docs.json +1/−0
- tests/purs/docs/output/ChildDeclOrder/docs.json +1/−0
- tests/purs/docs/output/Clash/docs.json +1/−0
- tests/purs/docs/output/Clash1/docs.json +1/−0
- tests/purs/docs/output/Clash1a/docs.json +1/−0
- tests/purs/docs/output/Clash2/docs.json +1/−0
- tests/purs/docs/output/Clash2a/docs.json +1/−0
- tests/purs/docs/output/ConstrainedArgument/docs.json +1/−0
- tests/purs/docs/output/Data.Newtype/docs.json +1/−0
- tests/purs/docs/output/DeclOrder/docs.json +1/−0
- tests/purs/docs/output/DeclOrderNoExportList/docs.json +1/−0
- tests/purs/docs/output/Desugar/docs.json +1/−0
- tests/purs/docs/output/DocComments/docs.json +1/−0
- tests/purs/docs/output/DocCommentsClassMethod/docs.json +1/−0
- tests/purs/docs/output/DocCommentsDataConstructor/docs.json +1/−0
- tests/purs/docs/output/DocCommentsMerge/docs.json +1/−0
- tests/purs/docs/output/DuplicateNames/docs.json +1/−0
- tests/purs/docs/output/Example/docs.json +1/−0
- tests/purs/docs/output/Example2/docs.json +1/−0
- tests/purs/docs/output/ExplicitExport/docs.json +1/−0
- tests/purs/docs/output/ExplicitTypeSignatures/docs.json +1/−0
- tests/purs/docs/output/ImportedTwice/docs.json +1/−0
- tests/purs/docs/output/ImportedTwiceA/docs.json +1/−0
- tests/purs/docs/output/ImportedTwiceB/docs.json +1/−0
- tests/purs/docs/output/KindSignatureDocs/docs.json +1/−0
- tests/purs/docs/output/MultiVirtual/docs.json +1/−0
- tests/purs/docs/output/MultiVirtual1/docs.json +1/−0
- tests/purs/docs/output/MultiVirtual2/docs.json +1/−0
- tests/purs/docs/output/MultiVirtual3/docs.json +1/−0
- tests/purs/docs/output/NewOperators/docs.json +1/−0
- tests/purs/docs/output/NewOperators2/docs.json +1/−0
- tests/purs/docs/output/NotAllCtors/docs.json +1/−0
- tests/purs/docs/output/OperatorSection/docs.json +1/−0
- tests/purs/docs/output/Prelude/docs.json +1/−0
- tests/purs/docs/output/Prim.Boolean/docs.json +1/−0
- tests/purs/docs/output/Prim.Coerce/docs.json +1/−0
- tests/purs/docs/output/Prim.Int/docs.json +1/−0
- tests/purs/docs/output/Prim.Ordering/docs.json +1/−0
- tests/purs/docs/output/Prim.Row/docs.json +1/−0
- tests/purs/docs/output/Prim.RowList/docs.json +1/−0
- tests/purs/docs/output/Prim.Symbol/docs.json +1/−0
- tests/purs/docs/output/Prim.TypeError/docs.json +1/−0
- tests/purs/docs/output/Prim/docs.json +1/−0
- tests/purs/docs/output/PrimSubmodules/docs.json +1/−0
- tests/purs/docs/output/ReExportedTypeClass/docs.json +1/−0
- tests/purs/docs/output/RoleAnnotationDocs/docs.json +1/−0
- tests/purs/docs/output/Shebang1Undocumented/docs.json +1/−0
- tests/purs/docs/output/Shebang2Undocumented/docs.json +1/−0
- tests/purs/docs/output/Shebang3Undocumented/docs.json +1/−0
- tests/purs/docs/output/Shebang4Undocumented/docs.json +1/−0
- tests/purs/docs/output/SolitaryTypeClassMember/docs.json +1/−0
- tests/purs/docs/output/SomeTypeClass/docs.json +1/−0
- tests/purs/docs/output/Transitive1/docs.json +1/−0
- tests/purs/docs/output/Transitive2/docs.json +1/−0
- tests/purs/docs/output/Transitive3/docs.json +1/−0
- tests/purs/docs/output/TypeClassWithFunDeps/docs.json +1/−0
- tests/purs/docs/output/TypeClassWithoutMembers/docs.json +1/−0
- tests/purs/docs/output/TypeClassWithoutMembersIntermediate/docs.json +1/−0
- tests/purs/docs/output/TypeLevelString/docs.json +1/−0
- tests/purs/docs/output/TypeOpAliases/docs.json +1/−0
- tests/purs/docs/output/TypeSynonym/docs.json +1/−0
- tests/purs/docs/output/TypeSynonymInstance/docs.json +1/−0
- tests/purs/docs/output/UTF8/docs.json +1/−0
- tests/purs/docs/output/Virtual/docs.json +1/−0
- tests/purs/docs/output/cache-db.json +1/−0
- tests/purs/docs/output/package.json +1/−0
- tests/purs/docs/purs.json +11/−0
- tests/purs/docs/resolutions.json +10/−0
- tests/purs/docs/src/Ado.purs +9/−0
- tests/purs/docs/src/ChildDeclOrder.purs +27/−0
- tests/purs/docs/src/Clash.purs +4/−0
- tests/purs/docs/src/Clash1.purs +3/−0
- tests/purs/docs/src/Clash1a.purs +9/−0
- tests/purs/docs/src/Clash2.purs +3/−0
- tests/purs/docs/src/Clash2a.purs +9/−0
- tests/purs/docs/src/ConstrainedArgument.purs +8/−0
- tests/purs/docs/src/DeclOrder.purs +17/−0
- tests/purs/docs/src/DeclOrderNoExportList.purs +10/−0
- tests/purs/docs/src/Desugar.purs +8/−0
- tests/purs/docs/src/DocComments.purs +11/−0
- tests/purs/docs/src/DocCommentsClassMethod.purs +6/−0
- tests/purs/docs/src/DocCommentsDataConstructor.purs +15/−0
- tests/purs/docs/src/DocCommentsMerge.purs +118/−0
- tests/purs/docs/src/DuplicateNames.purs +9/−0
- tests/purs/docs/src/Example.purs +7/−0
- tests/purs/docs/src/Example2.purs +7/−0
- tests/purs/docs/src/ExplicitExport.purs +7/−0
- tests/purs/docs/src/ExplicitTypeSignatures.purs +16/−0
- tests/purs/docs/src/ImportedTwice.purs +13/−0
- tests/purs/docs/src/ImportedTwiceA.purs +8/−0
- tests/purs/docs/src/ImportedTwiceB.purs +4/−0
- tests/purs/docs/src/KindSignatureDocs.purs +123/−0
- tests/purs/docs/src/MultiVirtual.purs +6/−0
- tests/purs/docs/src/MultiVirtual1.purs +4/−0
- tests/purs/docs/src/MultiVirtual2.purs +9/−0
- tests/purs/docs/src/MultiVirtual3.purs +4/−0
- tests/purs/docs/src/NewOperators.purs +5/−0
- tests/purs/docs/src/NewOperators2.purs +6/−0
- tests/purs/docs/src/NotAllCtors.purs +5/−0
- tests/purs/docs/src/OperatorSection.purs +16/−0
- tests/purs/docs/src/PrimSubmodules.purs +11/−0
- tests/purs/docs/src/ReExportedTypeClass.purs +5/−0
- tests/purs/docs/src/RoleAnnotationDocs.purs +36/−0
- tests/purs/docs/src/Shebang1Undocumented.purs +4/−0
- tests/purs/docs/src/Shebang2Undocumented.purs +8/−0
- tests/purs/docs/src/Shebang3Undocumented.purs +9/−0
- tests/purs/docs/src/Shebang4Undocumented.purs +10/−0
- tests/purs/docs/src/SolitaryTypeClassMember.purs +6/−0
- tests/purs/docs/src/SomeTypeClass.purs +5/−0
- tests/purs/docs/src/Transitive1.purs +5/−0
- tests/purs/docs/src/Transitive2.purs +5/−0
- tests/purs/docs/src/Transitive3.purs +4/−0
- tests/purs/docs/src/TypeClassWithFunDeps.purs +5/−0
- tests/purs/docs/src/TypeClassWithoutMembers.purs +5/−0
- tests/purs/docs/src/TypeClassWithoutMembersIntermediate.purs +5/−0
- tests/purs/docs/src/TypeLevelString.purs +9/−0
- tests/purs/docs/src/TypeOpAliases.purs +44/−0
- tests/purs/docs/src/TypeSynonym.purs +3/−0
- tests/purs/docs/src/TypeSynonymInstance.purs +11/−0
- tests/purs/docs/src/UTF8.purs +7/−0
- tests/purs/docs/src/Virtual.purs +5/−0
- tests/purs/failing/1071.out +22/−0
- tests/purs/failing/1071.purs +8/−0
- tests/purs/failing/1169.out +15/−0
- tests/purs/failing/1169.purs +12/−0
- tests/purs/failing/1175.out +22/−0
- tests/purs/failing/1175.purs +11/−0
- tests/purs/failing/1310.out +25/−0
- tests/purs/failing/1310.purs +18/−0
- tests/purs/failing/1570.out +23/−0
- tests/purs/failing/1570.purs +6/−0
- tests/purs/failing/1733.out +10/−0
- tests/purs/failing/1733.purs +6/−0
- tests/purs/failing/1733/Thingy.purs +4/−0
- tests/purs/failing/1825.out +10/−0
- tests/purs/failing/1825.purs +9/−0
- tests/purs/failing/1881.out +10/−0
- tests/purs/failing/1881.purs +6/−0
- tests/purs/failing/2109-bind.out +10/−0
- tests/purs/failing/2109-bind.purs +9/−0
- tests/purs/failing/2109-discard.out +10/−0
- tests/purs/failing/2109-discard.purs +8/−0
- tests/purs/failing/2109-negate.out +10/−0
- tests/purs/failing/2109-negate.purs +4/−0
- tests/purs/failing/2128-class.out +10/−0
- tests/purs/failing/2128-class.purs +5/−0
- tests/purs/failing/2128-instance.out +10/−0
- tests/purs/failing/2128-instance.purs +8/−0
- tests/purs/failing/2197-shouldFail.out +14/−0
- tests/purs/failing/2197-shouldFail.purs +10/−0
- tests/purs/failing/2197-shouldFail2.out +10/−0
- tests/purs/failing/2197-shouldFail2.purs +7/−0
- tests/purs/failing/2378.out +18/−0
- tests/purs/failing/2378.purs +6/−0
- tests/purs/failing/2378/Lib.purs +3/−0
- tests/purs/failing/2379.out +31/−0
- tests/purs/failing/2379.purs +6/−0
- tests/purs/failing/2379/Lib.purs +9/−0
- tests/purs/failing/2434.out +10/−0
- tests/purs/failing/2434.purs +5/−0
- tests/purs/failing/2534.out +21/−0
- tests/purs/failing/2534.purs +8/−0
- tests/purs/failing/2542.out +22/−0
- tests/purs/failing/2542.purs +9/−0
- tests/purs/failing/2567.out +18/−0
- tests/purs/failing/2567.purs +7/−0
- tests/purs/failing/2601.out +21/−0
- tests/purs/failing/2601.purs +7/−0
- tests/purs/failing/2616.out +28/−0
- tests/purs/failing/2616.purs +9/−0
- tests/purs/failing/2806.out +25/−0
- tests/purs/failing/2806.purs +7/−0
- tests/purs/failing/2874-forall.out +10/−0
- tests/purs/failing/2874-forall.purs +8/−0
- tests/purs/failing/2874-forall2.out +10/−0
- tests/purs/failing/2874-forall2.purs +10/−0
- tests/purs/failing/2874-wildcard.out +10/−0
- tests/purs/failing/2874-wildcard.purs +11/−0
- tests/purs/failing/2947.out +10/−0
- tests/purs/failing/2947.purs +10/−0
- tests/purs/failing/3077.out +25/−0
- tests/purs/failing/3077.purs +11/−0
- tests/purs/failing/3132.out +14/−0
- tests/purs/failing/3132.purs +18/−0
- tests/purs/failing/3275-BindingGroupErrorPos.out +24/−0
- tests/purs/failing/3275-BindingGroupErrorPos.purs +12/−0
- tests/purs/failing/3275-DataBindingGroupErrorPos.out +24/−0
- tests/purs/failing/3275-DataBindingGroupErrorPos.purs +8/−0
- tests/purs/failing/3329.out +28/−0
- tests/purs/failing/3329.purs +24/−0
- tests/purs/failing/3335-TypeOpAssociativityError.out +10/−0
- tests/purs/failing/3335-TypeOpAssociativityError.purs +7/−0
- tests/purs/failing/3405.out +18/−0
- tests/purs/failing/3405.purs +8/−0
- tests/purs/failing/3453.out +11/−0
- tests/purs/failing/3453.purs +8/−0
- tests/purs/failing/3510.out +18/−0
- tests/purs/failing/3510.purs +7/−0
- tests/purs/failing/3531-2.out +27/−0
- tests/purs/failing/3531-2.purs +23/−0
- tests/purs/failing/3531-3.out +32/−0
- tests/purs/failing/3531-3.purs +23/−0
- tests/purs/failing/3531-4.out +33/−0
- tests/purs/failing/3531-4.purs +21/−0
- tests/purs/failing/3531-5.out +32/−0
- tests/purs/failing/3531-5.purs +16/−0
- tests/purs/failing/3531-6.out +33/−0
- tests/purs/failing/3531-6.purs +21/−0
- tests/purs/failing/3531.out +27/−0
- tests/purs/failing/3531.purs +16/−0
- tests/purs/failing/3549-a.out +10/−0
- tests/purs/failing/3549-a.purs +10/−0
- tests/purs/failing/3549.out +25/−0
- tests/purs/failing/3549.purs +11/−0
- tests/purs/failing/365.out +9/−0
- tests/purs/failing/365.purs +14/−0
- tests/purs/failing/3689.out +10/−0
- tests/purs/failing/3689.purs +6/−0
- tests/purs/failing/3701.out +64/−0
- tests/purs/failing/3701.purs +39/−0
- tests/purs/failing/3765-kinds.out +29/−0
- tests/purs/failing/3765-kinds.purs +7/−0
- tests/purs/failing/3765.out +35/−0
- tests/purs/failing/3765.purs +6/−0
- tests/purs/failing/3891.out +24/−0
- tests/purs/failing/3891.purs +4/−0
- tests/purs/failing/4019-1.out +27/−0
- tests/purs/failing/4019-1.purs +26/−0
- tests/purs/failing/4019-2.out +28/−0
- tests/purs/failing/4019-2.purs +26/−0
- tests/purs/failing/4024-2.out +27/−0
- tests/purs/failing/4024-2.purs +11/−0
- tests/purs/failing/4024.out +26/−0
- tests/purs/failing/4024.purs +10/−0
- tests/purs/failing/4028.out +27/−0
- tests/purs/failing/4028.purs +29/−0
- tests/purs/failing/4158.out +34/−0
- tests/purs/failing/4158.purs +9/−0
- tests/purs/failing/438.out +25/−0
- tests/purs/failing/438.purs +15/−0
- tests/purs/failing/4382.out +55/−0
- tests/purs/failing/4382.purs +20/−0
- tests/purs/failing/4408Acyclic.out +22/−0
- tests/purs/failing/4408Acyclic.purs +22/−0
- tests/purs/failing/4408AcyclicRecursive.out +23/−0
- tests/purs/failing/4408AcyclicRecursive.purs +23/−0
- tests/purs/failing/4408Cyclic.out +31/−0
- tests/purs/failing/4408Cyclic.purs +29/−0
- tests/purs/failing/4408CyclicTail.out +26/−0
- tests/purs/failing/4408CyclicTail.purs +28/−0
- tests/purs/failing/4408CyclicTriple.out +32/−0
- tests/purs/failing/4408CyclicTriple.purs +25/−0
- tests/purs/failing/4466.out +24/−0
- tests/purs/failing/4466.purs +16/−0
- tests/purs/failing/4483.out +14/−0
- tests/purs/failing/4483.purs +13/−0
- tests/purs/failing/4522.out +10/−0
- tests/purs/failing/4522.purs +4/−0
- tests/purs/failing/881.out +14/−0
- tests/purs/failing/881.purs +13/−0
- tests/purs/failing/AnonArgument1.out +9/−0
- tests/purs/failing/AnonArgument1.purs +5/−0
- tests/purs/failing/AnonArgument2.out +9/−0
- tests/purs/failing/AnonArgument2.purs +7/−0
- tests/purs/failing/AnonArgument3.out +9/−0
- tests/purs/failing/AnonArgument3.purs +7/−0
- tests/purs/failing/ApostropheModuleName.out +10/−0
- tests/purs/failing/ApostropheModuleName.purs +7/−0
- tests/purs/failing/ArgLengthMismatch.out +10/−0
- tests/purs/failing/ArgLengthMismatch.purs +7/−0
- tests/purs/failing/ArrayType.out +22/−0
- tests/purs/failing/ArrayType.purs +13/−0
- tests/purs/failing/Arrays.out +24/−0
- tests/purs/failing/Arrays.purs +6/−0
- tests/purs/failing/AtPatternPrecedence.out +10/−0
- tests/purs/failing/AtPatternPrecedence.purs +14/−0
- tests/purs/failing/BifunctorInstance1.out +16/−0
- tests/purs/failing/BifunctorInstance1.purs +10/−0
- tests/purs/failing/BindInDo-2.out +9/−0
- tests/purs/failing/BindInDo-2.purs +9/−0
- tests/purs/failing/BindInDo.out +9/−0
- tests/purs/failing/BindInDo.purs +9/−0
- tests/purs/failing/CannotDeriveNewtypeForData.out +9/−0
- tests/purs/failing/CannotDeriveNewtypeForData.purs +8/−0
- tests/purs/failing/CaseBinderLengthsDiffer.out +14/−0
- tests/purs/failing/CaseBinderLengthsDiffer.purs +6/−0
- tests/purs/failing/CaseDoesNotMatchAllConstructorArgs.out +16/−0
- tests/purs/failing/CaseDoesNotMatchAllConstructorArgs.purs +15/−0
- tests/purs/failing/ClassHeadNoVTA1.out +25/−0
- tests/purs/failing/ClassHeadNoVTA1.purs +8/−0
- tests/purs/failing/ClassHeadNoVTA2.out +27/−0
- tests/purs/failing/ClassHeadNoVTA2.purs +11/−0
- tests/purs/failing/ClassHeadNoVTA3.out +28/−0
- tests/purs/failing/ClassHeadNoVTA3.purs +9/−0
- tests/purs/failing/ClassHeadNoVTA4.out +27/−0
- tests/purs/failing/ClassHeadNoVTA4.purs +8/−0
- tests/purs/failing/ClassHeadNoVTA5.out +29/−0
- tests/purs/failing/ClassHeadNoVTA5.purs +10/−0
- tests/purs/failing/ClassHeadNoVTA6a.out +37/−0
- tests/purs/failing/ClassHeadNoVTA6a.purs +12/−0
- tests/purs/failing/ClassHeadNoVTA6b.out +50/−0
- tests/purs/failing/ClassHeadNoVTA6b.purs +16/−0
- tests/purs/failing/ClassHeadNoVTA6c.out +50/−0
- tests/purs/failing/ClassHeadNoVTA6c.purs +16/−0
- tests/purs/failing/ClassHeadNoVTA7.out +25/−0
- tests/purs/failing/ClassHeadNoVTA7.purs +12/−0
- tests/purs/failing/CoercibleClosedRowsDoNotUnify.out +39/−0
- tests/purs/failing/CoercibleClosedRowsDoNotUnify.purs +7/−0
- tests/purs/failing/CoercibleConstrained1.out +29/−0
- tests/purs/failing/CoercibleConstrained1.purs +11/−0
- tests/purs/failing/CoercibleConstrained2.out +32/−0
- tests/purs/failing/CoercibleConstrained2.purs +11/−0
- tests/purs/failing/CoercibleConstrained3.out +30/−0
- tests/purs/failing/CoercibleConstrained3.purs +13/−0
- tests/purs/failing/CoercibleForeign.out +32/−0
- tests/purs/failing/CoercibleForeign.purs +11/−0
- tests/purs/failing/CoercibleForeign2.out +36/−0
- tests/purs/failing/CoercibleForeign2.purs +9/−0
- tests/purs/failing/CoercibleForeign3.out +36/−0
- tests/purs/failing/CoercibleForeign3.purs +9/−0
- tests/purs/failing/CoercibleHigherKindedData.out +33/−0
- tests/purs/failing/CoercibleHigherKindedData.purs +13/−0
- tests/purs/failing/CoercibleHigherKindedNewtypes.out +24/−0
- tests/purs/failing/CoercibleHigherKindedNewtypes.purs +13/−0
- tests/purs/failing/CoercibleKindMismatch.out +31/−0
- tests/purs/failing/CoercibleKindMismatch.purs +15/−0
- tests/purs/failing/CoercibleNominal.out +34/−0
- tests/purs/failing/CoercibleNominal.purs +11/−0
- tests/purs/failing/CoercibleNominalTypeApp.out +27/−0
- tests/purs/failing/CoercibleNominalTypeApp.purs +13/−0
- tests/purs/failing/CoercibleNominalWrapped.out +32/−0
- tests/purs/failing/CoercibleNominalWrapped.purs +15/−0
- tests/purs/failing/CoercibleNonCanonical1.out +27/−0
- tests/purs/failing/CoercibleNonCanonical1.purs +11/−0
- tests/purs/failing/CoercibleNonCanonical2.out +24/−0
- tests/purs/failing/CoercibleNonCanonical2.purs +10/−0
- tests/purs/failing/CoercibleOpenRowsDoNotUnify.out +43/−0
- tests/purs/failing/CoercibleOpenRowsDoNotUnify.purs +7/−0
- tests/purs/failing/CoercibleRepresentational.out +31/−0
- tests/purs/failing/CoercibleRepresentational.purs +11/−0
- tests/purs/failing/CoercibleRepresentational2.out +24/−0
- tests/purs/failing/CoercibleRepresentational2.purs +9/−0
- tests/purs/failing/CoercibleRepresentational3.out +24/−0
- tests/purs/failing/CoercibleRepresentational3.purs +9/−0
- tests/purs/failing/CoercibleRepresentational4.out +24/−0
- tests/purs/failing/CoercibleRepresentational4.purs +11/−0
- tests/purs/failing/CoercibleRepresentational5.out +24/−0
- tests/purs/failing/CoercibleRepresentational5.purs +15/−0
- tests/purs/failing/CoercibleRepresentational6.out +24/−0
- tests/purs/failing/CoercibleRepresentational6.purs +8/−0
- tests/purs/failing/CoercibleRepresentational6/N.purs +3/−0
- tests/purs/failing/CoercibleRepresentational7.out +24/−0
- tests/purs/failing/CoercibleRepresentational7.purs +8/−0
- tests/purs/failing/CoercibleRepresentational7/N.purs +3/−0
- tests/purs/failing/CoercibleRepresentational8.out +24/−0
- tests/purs/failing/CoercibleRepresentational8.purs +9/−0
- tests/purs/failing/CoercibleRepresentational8/UnsafeCoerce.purs +7/−0
- tests/purs/failing/CoercibleRoleMismatch1.out +14/−0
- tests/purs/failing/CoercibleRoleMismatch1.purs +6/−0
- tests/purs/failing/CoercibleRoleMismatch2.out +14/−0
- tests/purs/failing/CoercibleRoleMismatch2.purs +10/−0
- tests/purs/failing/CoercibleRoleMismatch3.out +14/−0
- tests/purs/failing/CoercibleRoleMismatch3.purs +10/−0
- tests/purs/failing/CoercibleRoleMismatch4.out +14/−0
- tests/purs/failing/CoercibleRoleMismatch4.purs +8/−0
- tests/purs/failing/CoercibleRoleMismatch5.out +14/−0
- tests/purs/failing/CoercibleRoleMismatch5.purs +7/−0
- tests/purs/failing/CoercibleUnknownRowTail1.out +41/−0
- tests/purs/failing/CoercibleUnknownRowTail1.purs +7/−0
- tests/purs/failing/CoercibleUnknownRowTail2.out +46/−0
- tests/purs/failing/CoercibleUnknownRowTail2.purs +7/−0
- tests/purs/failing/CompareInt1.out +43/−0
- tests/purs/failing/CompareInt1.purs +14/−0
- tests/purs/failing/CompareInt10.out +43/−0
- tests/purs/failing/CompareInt10.purs +14/−0
- tests/purs/failing/CompareInt11.out +33/−0
- tests/purs/failing/CompareInt11.purs +14/−0
- tests/purs/failing/CompareInt12.out +33/−0
- tests/purs/failing/CompareInt12.purs +14/−0
- tests/purs/failing/CompareInt2.out +43/−0
- tests/purs/failing/CompareInt2.purs +14/−0
- tests/purs/failing/CompareInt3.out +43/−0
- tests/purs/failing/CompareInt3.purs +14/−0
- tests/purs/failing/CompareInt4.out +43/−0
- tests/purs/failing/CompareInt4.purs +14/−0
- tests/purs/failing/CompareInt5.out +43/−0
- tests/purs/failing/CompareInt5.purs +14/−0
- tests/purs/failing/CompareInt6.out +43/−0
- tests/purs/failing/CompareInt6.purs +14/−0
- tests/purs/failing/CompareInt7.out +43/−0
- tests/purs/failing/CompareInt7.purs +14/−0
- tests/purs/failing/CompareInt8.out +43/−0
- tests/purs/failing/CompareInt8.purs +14/−0
- tests/purs/failing/CompareInt9.out +43/−0
- tests/purs/failing/CompareInt9.purs +14/−0
- tests/purs/failing/ConflictingExports.out +14/−0
- tests/purs/failing/ConflictingExports.purs +6/−0
- tests/purs/failing/ConflictingExports/A.purs +4/−0
- tests/purs/failing/ConflictingExports/B.purs +4/−0
- tests/purs/failing/ConflictingImports.out +14/−0
- tests/purs/failing/ConflictingImports.purs +9/−0
- tests/purs/failing/ConflictingImports/A.purs +4/−0
- tests/purs/failing/ConflictingImports/B.out +14/−0
- tests/purs/failing/ConflictingImports/B.purs +4/−0
- tests/purs/failing/ConflictingImports2.out +14/−0
- tests/purs/failing/ConflictingImports2.purs +10/−0
- tests/purs/failing/ConflictingImports2/A.purs +4/−0
- tests/purs/failing/ConflictingImports2/B.out +14/−0
- tests/purs/failing/ConflictingImports2/B.purs +4/−0
- tests/purs/failing/ConflictingQualifiedImports.out +14/−0
- tests/purs/failing/ConflictingQualifiedImports.purs +7/−0
- tests/purs/failing/ConflictingQualifiedImports/A.purs +4/−0
- tests/purs/failing/ConflictingQualifiedImports/B.purs +4/−0
- tests/purs/failing/ConflictingQualifiedImports2.out +14/−0
- tests/purs/failing/ConflictingQualifiedImports2.purs +5/−0
- tests/purs/failing/ConflictingQualifiedImports2/A.purs +4/−0
- tests/purs/failing/ConflictingQualifiedImports2/B.out +14/−0
- tests/purs/failing/ConflictingQualifiedImports2/B.purs +4/−0
- tests/purs/failing/ConstraintFailure.out +22/−0
- tests/purs/failing/ConstraintFailure.purs +13/−0
- tests/purs/failing/ConstraintInForeignImport.js +5/−0
- tests/purs/failing/ConstraintInForeignImport.out +10/−0
- tests/purs/failing/ConstraintInForeignImport.purs +6/−0
- tests/purs/failing/ConstraintInference.out +19/−0
- tests/purs/failing/ConstraintInference.purs +10/−0
- tests/purs/failing/ContravariantInstance1.out +16/−0
- tests/purs/failing/ContravariantInstance1.purs +9/−0
- tests/purs/failing/CycleInForeignDataKinds.out +13/−0
- tests/purs/failing/CycleInForeignDataKinds.purs +5/−0
- tests/purs/failing/CycleInKindDeclaration.out +13/−0
- tests/purs/failing/CycleInKindDeclaration.purs +8/−0
- tests/purs/failing/DctorOperatorAliasExport.out +13/−0
- tests/purs/failing/DctorOperatorAliasExport.purs +6/−0
- tests/purs/failing/DeclConflictClassCtor.out +10/−0
- tests/purs/failing/DeclConflictClassCtor.purs +6/−0
- tests/purs/failing/DeclConflictClassSynonym.out +10/−0
- tests/purs/failing/DeclConflictClassSynonym.purs +8/−0
- tests/purs/failing/DeclConflictClassType.out +10/−0
- tests/purs/failing/DeclConflictClassType.purs +6/−0
- tests/purs/failing/DeclConflictCtorClass.out +10/−0
- tests/purs/failing/DeclConflictCtorClass.purs +6/−0
- tests/purs/failing/DeclConflictCtorCtor.out +10/−0
- tests/purs/failing/DeclConflictCtorCtor.purs +6/−0
- tests/purs/failing/DeclConflictDuplicateCtor.out +10/−0
- tests/purs/failing/DeclConflictDuplicateCtor.purs +5/−0
- tests/purs/failing/DeclConflictSynonymClass.out +10/−0
- tests/purs/failing/DeclConflictSynonymClass.purs +8/−0
- tests/purs/failing/DeclConflictSynonymType.out +10/−0
- tests/purs/failing/DeclConflictSynonymType.purs +8/−0
- tests/purs/failing/DeclConflictTypeClass.out +10/−0
- tests/purs/failing/DeclConflictTypeClass.purs +6/−0
- tests/purs/failing/DeclConflictTypeSynonym.out +10/−0
- tests/purs/failing/DeclConflictTypeSynonym.purs +8/−0
- tests/purs/failing/DeclConflictTypeType.out +10/−0
- tests/purs/failing/DeclConflictTypeType.purs +6/−0
- tests/purs/failing/DeprecatedFFICommonJSModule.js +4/−0
- tests/purs/failing/DeprecatedFFICommonJSModule.out +13/−0
- tests/purs/failing/DeprecatedFFICommonJSModule.purs +5/−0
- tests/purs/failing/DeprecatedFFIPrime.js +5/−0
- tests/purs/failing/DeprecatedFFIPrime.out +56/−0
- tests/purs/failing/DeprecatedFFIPrime.purs +10/−0
- tests/purs/failing/DiffKindsSameName.out +21/−0
- tests/purs/failing/DiffKindsSameName.purs +15/−0
- tests/purs/failing/DiffKindsSameName/LibA.out +19/−0
- tests/purs/failing/DiffKindsSameName/LibA.purs +4/−0
- tests/purs/failing/DiffKindsSameName/LibB.purs +6/−0
- tests/purs/failing/Do.out +20/−0
- tests/purs/failing/Do.purs +12/−0
- tests/purs/failing/DoNotSuggestComposition.out +24/−0
- tests/purs/failing/DoNotSuggestComposition.purs +13/−0
- tests/purs/failing/DoNotSuggestComposition2.out +24/−0
- tests/purs/failing/DoNotSuggestComposition2.purs +7/−0
- tests/purs/failing/DuplicateDeclarationsInLet.out +10/−0
- tests/purs/failing/DuplicateDeclarationsInLet.purs +10/−0
- tests/purs/failing/DuplicateDeclarationsInLet2.out +10/−0
- tests/purs/failing/DuplicateDeclarationsInLet2.purs +10/−0
- tests/purs/failing/DuplicateDeclarationsInLet3.out +22/−0
- tests/purs/failing/DuplicateDeclarationsInLet3.purs +16/−0
- tests/purs/failing/DuplicateInstance.out +17/−0
- tests/purs/failing/DuplicateInstance.purs +6/−0
- tests/purs/failing/DuplicateModule.out +9/−0
- tests/purs/failing/DuplicateModule.purs +2/−0
- tests/purs/failing/DuplicateModule/M1.purs +1/−0
- tests/purs/failing/DuplicateProperties.out +36/−0
- tests/purs/failing/DuplicateProperties.purs +12/−0
- tests/purs/failing/DuplicateRoleDeclaration.out +10/−0
- tests/purs/failing/DuplicateRoleDeclaration.purs +6/−0
- tests/purs/failing/DuplicateTypeClass.out +14/−0
- tests/purs/failing/DuplicateTypeClass.purs +4/−0
- tests/purs/failing/DuplicateTypeVars.out +11/−0
- tests/purs/failing/DuplicateTypeVars.purs +6/−0
- tests/purs/failing/EmptyCase.out +10/−0
- tests/purs/failing/EmptyCase.purs +4/−0
- tests/purs/failing/EmptyClass.out +10/−0
- tests/purs/failing/EmptyClass.purs +7/−0
- tests/purs/failing/EmptyDo.out +10/−0
- tests/purs/failing/EmptyDo.purs +6/−0
- tests/purs/failing/ExpectedWildcard.out +9/−0
- tests/purs/failing/ExpectedWildcard.purs +8/−0
- tests/purs/failing/ExportConflictClass.out +10/−0
- tests/purs/failing/ExportConflictClass.purs +5/−0
- tests/purs/failing/ExportConflictClass/A.purs +3/−0
- tests/purs/failing/ExportConflictClass/B.out +10/−0
- tests/purs/failing/ExportConflictClass/B.purs +3/−0
- tests/purs/failing/ExportConflictClassAndType.out +10/−0
- tests/purs/failing/ExportConflictClassAndType.purs +5/−0
- tests/purs/failing/ExportConflictClassAndType/A.purs +3/−0
- tests/purs/failing/ExportConflictClassAndType/B.out +10/−0
- tests/purs/failing/ExportConflictClassAndType/B.purs +3/−0
- tests/purs/failing/ExportConflictCtor.out +10/−0
- tests/purs/failing/ExportConflictCtor.purs +5/−0
- tests/purs/failing/ExportConflictCtor/A.purs +3/−0
- tests/purs/failing/ExportConflictCtor/B.purs +3/−0
- tests/purs/failing/ExportConflictType.out +10/−0
- tests/purs/failing/ExportConflictType.purs +5/−0
- tests/purs/failing/ExportConflictType/A.purs +3/−0
- tests/purs/failing/ExportConflictType/B.out +10/−0
- tests/purs/failing/ExportConflictType/B.purs +3/−0
- tests/purs/failing/ExportConflictTypeOp.out +10/−0
- tests/purs/failing/ExportConflictTypeOp.purs +5/−0
- tests/purs/failing/ExportConflictTypeOp/A.purs +5/−0
- tests/purs/failing/ExportConflictTypeOp/B.purs +5/−0
- tests/purs/failing/ExportConflictValue.out +10/−0
- tests/purs/failing/ExportConflictValue.purs +5/−0
- tests/purs/failing/ExportConflictValue/A.purs +4/−0
- tests/purs/failing/ExportConflictValue/B.purs +4/−0
- tests/purs/failing/ExportConflictValueOp.out +10/−0
- tests/purs/failing/ExportConflictValueOp.purs +5/−0
- tests/purs/failing/ExportConflictValueOp/A.purs +6/−0
- tests/purs/failing/ExportConflictValueOp/B.out +10/−0
- tests/purs/failing/ExportConflictValueOp/B.purs +6/−0
- tests/purs/failing/ExportExplicit.out +10/−0
- tests/purs/failing/ExportExplicit.purs +8/−0
- tests/purs/failing/ExportExplicit1.out +22/−0
- tests/purs/failing/ExportExplicit1.purs +12/−0
- tests/purs/failing/ExportExplicit1/M1.purs +3/−0
- tests/purs/failing/ExportExplicit2.out +10/−0
- tests/purs/failing/ExportExplicit2.purs +8/−0
- tests/purs/failing/ExportExplicit3.out +10/−0
- tests/purs/failing/ExportExplicit3.purs +10/−0
- tests/purs/failing/ExportExplicit3/M1.purs +4/−0
- tests/purs/failing/ExtraRecordField.out +27/−0
- tests/purs/failing/ExtraRecordField.purs +9/−0
- tests/purs/failing/ExtraneousClassMember.out +13/−0
- tests/purs/failing/ExtraneousClassMember.purs +11/−0
- tests/purs/failing/FFIDefaultCJSExport.js +1/−0
- tests/purs/failing/FFIDefaultCJSExport.out +13/−0
- tests/purs/failing/FFIDefaultCJSExport.purs +8/−0
- tests/purs/failing/Foldable.out +9/−0
- tests/purs/failing/Foldable.purs +17/−0
- tests/purs/failing/FoldableInstance1.out +24/−0
- tests/purs/failing/FoldableInstance1.purs +9/−0
- tests/purs/failing/FoldableInstance10.out +16/−0
- tests/purs/failing/FoldableInstance10.purs +11/−0
- tests/purs/failing/FoldableInstance2.out +24/−0
- tests/purs/failing/FoldableInstance2.purs +10/−0
- tests/purs/failing/FoldableInstance3.out +24/−0
- tests/purs/failing/FoldableInstance3.purs +9/−0
- tests/purs/failing/FoldableInstance4.out +16/−0
- tests/purs/failing/FoldableInstance4.purs +8/−0
- tests/purs/failing/FoldableInstance6.out +16/−0
- tests/purs/failing/FoldableInstance6.purs +8/−0
- tests/purs/failing/FoldableInstance8.out +16/−0
- tests/purs/failing/FoldableInstance8.purs +8/−0
- tests/purs/failing/FoldableInstance9.out +51/−0
- tests/purs/failing/FoldableInstance9.purs +53/−0
- tests/purs/failing/FunctorInstance1.out +16/−0
- tests/purs/failing/FunctorInstance1.purs +8/−0
- tests/purs/failing/Generalization1.out +16/−0
- tests/purs/failing/Generalization1.purs +11/−0
- tests/purs/failing/Generalization2.out +16/−0
- tests/purs/failing/Generalization2.purs +8/−0
- tests/purs/failing/ImportExplicit.out +11/−0
- tests/purs/failing/ImportExplicit.purs +4/−0
- tests/purs/failing/ImportExplicit/M1.out +11/−0
- tests/purs/failing/ImportExplicit/M1.purs +3/−0
- tests/purs/failing/ImportExplicit2.out +10/−0
- tests/purs/failing/ImportExplicit2.purs +4/−0
- tests/purs/failing/ImportExplicit2/M1.purs +3/−0
- tests/purs/failing/ImportHidingModule.out +10/−0
- tests/purs/failing/ImportHidingModule.purs +4/−0
- tests/purs/failing/ImportHidingModule/A.purs +2/−0
- tests/purs/failing/ImportHidingModule/B.purs +3/−0
- tests/purs/failing/ImportModule.out +11/−0
- tests/purs/failing/ImportModule.purs +4/−0
- tests/purs/failing/ImportModule/M2.purs +3/−0
- tests/purs/failing/InfiniteKind.out +19/−0
- tests/purs/failing/InfiniteKind.purs +5/−0
- tests/purs/failing/InfiniteKind2.out +19/−0
- tests/purs/failing/InfiniteKind2.purs +5/−0
- tests/purs/failing/InfiniteType.out +21/−0
- tests/purs/failing/InfiniteType.purs +5/−0
- tests/purs/failing/InstanceChainBothUnknownAndMatch.out +39/−0
- tests/purs/failing/InstanceChainBothUnknownAndMatch.purs +16/−0
- tests/purs/failing/InstanceChainSkolemUnknownMatch.out +31/−0
- tests/purs/failing/InstanceChainSkolemUnknownMatch.purs +14/−0
- tests/purs/failing/InstanceExport.out +13/−0
- tests/purs/failing/InstanceExport.purs +7/−0
- tests/purs/failing/InstanceExport/InstanceExport.purs +11/−0
- tests/purs/failing/InstanceNamedWithoutSeparator.out +10/−0
- tests/purs/failing/InstanceNamedWithoutSeparator.purs +12/−0
- tests/purs/failing/InstanceSigsBodyIncorrect.out +22/−0
- tests/purs/failing/InstanceSigsBodyIncorrect.purs +10/−0
- tests/purs/failing/InstanceSigsDifferentTypes.out +22/−0
- tests/purs/failing/InstanceSigsDifferentTypes.purs +10/−0
- tests/purs/failing/InstanceSigsIncorrectType.out +25/−0
- tests/purs/failing/InstanceSigsIncorrectType.purs +10/−0
- tests/purs/failing/InstanceSigsOrphanTypeDeclaration.out +10/−0
- tests/purs/failing/InstanceSigsOrphanTypeDeclaration.purs +10/−0
- tests/purs/failing/IntAsRecordLabel.out +10/−0
- tests/purs/failing/IntAsRecordLabel.purs +4/−0
- tests/purs/failing/IntOutOfRange.out +11/−0
- tests/purs/failing/IntOutOfRange.purs +6/−0
- tests/purs/failing/IntToString1.out +31/−0
- tests/purs/failing/IntToString1.purs +14/−0
- tests/purs/failing/IntToString2.out +31/−0
- tests/purs/failing/IntToString2.purs +14/−0
- tests/purs/failing/IntToString3.out +31/−0
- tests/purs/failing/IntToString3.purs +14/−0
- tests/purs/failing/InvalidCoercibleInstanceDeclaration.out +14/−0
- tests/purs/failing/InvalidCoercibleInstanceDeclaration.purs +8/−0
- tests/purs/failing/InvalidDerivedInstance.out +16/−0
- tests/purs/failing/InvalidDerivedInstance.purs +8/−0
- tests/purs/failing/InvalidDerivedInstance2.out +18/−0
- tests/purs/failing/InvalidDerivedInstance2.purs +6/−0
- tests/purs/failing/InvalidDerivedInstance3.out +14/−0
- tests/purs/failing/InvalidDerivedInstance3.purs +10/−0
- tests/purs/failing/InvalidOperatorInBinder.out +10/−0
- tests/purs/failing/InvalidOperatorInBinder.purs +12/−0
- tests/purs/failing/KindError.out +24/−0
- tests/purs/failing/KindError.purs +6/−0
- tests/purs/failing/KindStar.out +20/−0
- tests/purs/failing/KindStar.purs +8/−0
- tests/purs/failing/LacksWithSubGoal.out +35/−0
- tests/purs/failing/LacksWithSubGoal.purs +16/−0
- tests/purs/failing/LeadingZeros1.out +10/−0
- tests/purs/failing/LeadingZeros1.purs +6/−0
- tests/purs/failing/LeadingZeros2.out +10/−0
- tests/purs/failing/LeadingZeros2.purs +6/−0
- tests/purs/failing/Let.out +9/−0
- tests/purs/failing/Let.purs +6/−0
- tests/purs/failing/LetPatterns1.out +10/−0
- tests/purs/failing/LetPatterns1.purs +10/−0
- tests/purs/failing/LetPatterns2.out +10/−0
- tests/purs/failing/LetPatterns2.purs +14/−0
- tests/purs/failing/LetPatterns3.out +16/−0
- tests/purs/failing/LetPatterns3.purs +13/−0
- tests/purs/failing/LetPatterns4.out +10/−0
- tests/purs/failing/LetPatterns4.purs +6/−0
- tests/purs/failing/MPTCs.out +16/−0
- tests/purs/failing/MPTCs.purs +10/−0
- tests/purs/failing/MissingClassExport.out +13/−0
- tests/purs/failing/MissingClassExport.purs +7/−0
- tests/purs/failing/MissingClassMember.out +15/−0
- tests/purs/failing/MissingClassMember.purs +10/−0
- tests/purs/failing/MissingClassMemberExport.out +13/−0
- tests/purs/failing/MissingClassMemberExport.purs +7/−0
- tests/purs/failing/MissingFFIImplementations.js +1/−0
- tests/purs/failing/MissingFFIImplementations.out +12/−0
- tests/purs/failing/MissingFFIImplementations.purs +5/−0
- tests/purs/failing/MissingRecordField.out +23/−0
- tests/purs/failing/MissingRecordField.purs +10/−0
- tests/purs/failing/MixedAssociativityError.out +14/−0
- tests/purs/failing/MixedAssociativityError.purs +6/−0
- tests/purs/failing/MonoKindDataBindingGroup.out +21/−0
- tests/purs/failing/MonoKindDataBindingGroup.purs +8/−0
- tests/purs/failing/MultipleErrors.out +46/−0
- tests/purs/failing/MultipleErrors.purs +13/−0
- tests/purs/failing/MultipleErrors2.out +22/−0
- tests/purs/failing/MultipleErrors2.purs +9/−0
- tests/purs/failing/MultipleTypeOpFixities.out +10/−0
- tests/purs/failing/MultipleTypeOpFixities.purs +9/−0
- tests/purs/failing/MultipleValueOpFixities.out +10/−0
- tests/purs/failing/MultipleValueOpFixities.purs +9/−0
- tests/purs/failing/MutRec.out +20/−0
- tests/purs/failing/MutRec.purs +9/−0
- tests/purs/failing/MutRec2.out +9/−0
- tests/purs/failing/MutRec2.purs +6/−0
- tests/purs/failing/NestedRecordLabelOnTypeError.out +34/−0
- tests/purs/failing/NestedRecordLabelOnTypeError.purs +8/−0
- tests/purs/failing/NewtypeInstance.out +15/−0
- tests/purs/failing/NewtypeInstance.purs +8/−0
- tests/purs/failing/NewtypeInstance2.out +18/−0
- tests/purs/failing/NewtypeInstance2.purs +8/−0
- tests/purs/failing/NewtypeInstance3.out +15/−0
- tests/purs/failing/NewtypeInstance3.purs +8/−0
- tests/purs/failing/NewtypeInstance4.out +15/−0
- tests/purs/failing/NewtypeInstance4.purs +8/−0
- tests/purs/failing/NewtypeInstance5.out +15/−0
- tests/purs/failing/NewtypeInstance5.purs +8/−0
- tests/purs/failing/NewtypeInstance6.out +24/−0
- tests/purs/failing/NewtypeInstance6.purs +8/−0
- tests/purs/failing/NewtypeMultiArgs.out +10/−0
- tests/purs/failing/NewtypeMultiArgs.purs +6/−0
- tests/purs/failing/NewtypeMultiCtor.out +10/−0
- tests/purs/failing/NewtypeMultiCtor.purs +6/−0
- tests/purs/failing/NewtypeUnnamedInstance.out +14/−0
- tests/purs/failing/NewtypeUnnamedInstance.purs +8/−0
- tests/purs/failing/NonAssociativeError.out +26/−0
- tests/purs/failing/NonAssociativeError.purs +8/−0
- tests/purs/failing/NonExhaustivePatGuard.out +23/−0
- tests/purs/failing/NonExhaustivePatGuard.purs +5/−0
- tests/purs/failing/NullaryAbs.out +10/−0
- tests/purs/failing/NullaryAbs.purs +6/−0
- tests/purs/failing/Object.out +24/−0
- tests/purs/failing/Object.purs +8/−0
- tests/purs/failing/OperatorAliasNoExport.out +13/−0
- tests/purs/failing/OperatorAliasNoExport.purs +7/−0
- tests/purs/failing/OperatorAt.out +10/−0
- tests/purs/failing/OperatorAt.purs +8/−0
- tests/purs/failing/OperatorBackslash.out +10/−0
- tests/purs/failing/OperatorBackslash.purs +8/−0
- tests/purs/failing/OperatorSections.out +27/−0
- tests/purs/failing/OperatorSections.purs +7/−0
- tests/purs/failing/OperatorSections2.out +9/−0
- tests/purs/failing/OperatorSections2.purs +6/−0
- tests/purs/failing/OrphanInstance.out +18/−0
- tests/purs/failing/OrphanInstance.purs +7/−0
- tests/purs/failing/OrphanInstance/Class.purs +4/−0
- tests/purs/failing/OrphanInstanceFunDepCycle.out +20/−0
- tests/purs/failing/OrphanInstanceFunDepCycle.purs +5/−0
- tests/purs/failing/OrphanInstanceFunDepCycle/Lib.out +20/−0
- tests/purs/failing/OrphanInstanceFunDepCycle/Lib.purs +4/−0
- tests/purs/failing/OrphanInstanceNullary.out +18/−0
- tests/purs/failing/OrphanInstanceNullary.purs +4/−0
- tests/purs/failing/OrphanInstanceNullary/Lib.out +18/−0
- tests/purs/failing/OrphanInstanceNullary/Lib.purs +2/−0
- tests/purs/failing/OrphanInstanceWithDetermined.out +22/−0
- tests/purs/failing/OrphanInstanceWithDetermined.purs +5/−0
- tests/purs/failing/OrphanInstanceWithDetermined/Lib.out +22/−0
- tests/purs/failing/OrphanInstanceWithDetermined/Lib.purs +5/−0
- tests/purs/failing/OrphanKindDeclaration1.out +10/−0
- tests/purs/failing/OrphanKindDeclaration1.purs +4/−0
- tests/purs/failing/OrphanKindDeclaration2.out +10/−0
- tests/purs/failing/OrphanKindDeclaration2.purs +5/−0
- tests/purs/failing/OrphanRoleDeclaration1.out +10/−0
- tests/purs/failing/OrphanRoleDeclaration1.purs +4/−0
- tests/purs/failing/OrphanRoleDeclaration2.out +10/−0
- tests/purs/failing/OrphanRoleDeclaration2.purs +5/−0
- tests/purs/failing/OrphanRoleDeclaration3.out +10/−0
- tests/purs/failing/OrphanRoleDeclaration3.purs +8/−0
- tests/purs/failing/OrphanTypeDecl.out +10/−0
- tests/purs/failing/OrphanTypeDecl.purs +4/−0
- tests/purs/failing/OrphanUnnamedInstance.out +18/−0
- tests/purs/failing/OrphanUnnamedInstance.purs +7/−0
- tests/purs/failing/OrphanUnnamedInstance/Class.purs +4/−0
- tests/purs/failing/OverlapAcrossModules.out +24/−0
- tests/purs/failing/OverlapAcrossModules.purs +7/−0
- tests/purs/failing/OverlapAcrossModules/Class.out +24/−0
- tests/purs/failing/OverlapAcrossModules/Class.purs +2/−0
- tests/purs/failing/OverlapAcrossModules/X.purs +4/−0
- tests/purs/failing/OverlapAcrossModulesUnnamedInstance.out +24/−0
- tests/purs/failing/OverlapAcrossModulesUnnamedInstance.purs +7/−0
- tests/purs/failing/OverlapAcrossModulesUnnamedInstance/Class.out +24/−0
- tests/purs/failing/OverlapAcrossModulesUnnamedInstance/Class.purs +2/−0
- tests/purs/failing/OverlapAcrossModulesUnnamedInstance/X.purs +4/−0
- tests/purs/failing/OverlappingArguments.out +10/−0
- tests/purs/failing/OverlappingArguments.purs +6/−0
- tests/purs/failing/OverlappingBinders.out +14/−0
- tests/purs/failing/OverlappingBinders.purs +9/−0
- tests/purs/failing/OverlappingInstances.out +22/−0
- tests/purs/failing/OverlappingInstances.purs +17/−0
- tests/purs/failing/OverlappingUnnamedInstances.out +22/−0
- tests/purs/failing/OverlappingUnnamedInstances.purs +17/−0
- tests/purs/failing/OverlappingVars.out +20/−0
- tests/purs/failing/OverlappingVars.purs +14/−0
- tests/purs/failing/PASTrumpsKDNU1.out +17/−0
- tests/purs/failing/PASTrumpsKDNU1.purs +15/−0
- tests/purs/failing/PASTrumpsKDNU2.out +15/−0
- tests/purs/failing/PASTrumpsKDNU2.purs +10/−0
- tests/purs/failing/PASTrumpsKDNU3.out +16/−0
- tests/purs/failing/PASTrumpsKDNU3.purs +10/−0
- tests/purs/failing/PASTrumpsKDNU4.out +14/−0
- tests/purs/failing/PASTrumpsKDNU4.purs +6/−0
- tests/purs/failing/PASTrumpsKDNU5.out +14/−0
- tests/purs/failing/PASTrumpsKDNU5.purs +6/−0
- tests/purs/failing/PASTrumpsKDNU6.out +14/−0
- tests/purs/failing/PASTrumpsKDNU6.purs +6/−0
- tests/purs/failing/PASTrumpsKDNU7.out +14/−0
- tests/purs/failing/PASTrumpsKDNU7.purs +6/−0
- tests/purs/failing/PolykindGeneralizationLet.out +24/−0
- tests/purs/failing/PolykindGeneralizationLet.purs +14/−0
- tests/purs/failing/PolykindInstanceOverlapping.out +22/−0
- tests/purs/failing/PolykindInstanceOverlapping.purs +13/−0
- tests/purs/failing/PolykindInstantiatedInstance.out +25/−0
- tests/purs/failing/PolykindInstantiatedInstance.purs +12/−0
- tests/purs/failing/PolykindInstantiation.out +22/−0
- tests/purs/failing/PolykindInstantiation.purs +8/−0
- tests/purs/failing/PolykindUnnamedInstanceOverlapping.out +22/−0
- tests/purs/failing/PolykindUnnamedInstanceOverlapping.purs +13/−0
- tests/purs/failing/PossiblyInfiniteCoercibleInstance.out +25/−0
- tests/purs/failing/PossiblyInfiniteCoercibleInstance.purs +9/−0
- tests/purs/failing/PrimModuleReserved.out +10/−0
- tests/purs/failing/PrimModuleReserved.purs +4/−0
- tests/purs/failing/PrimModuleReserved/Prim.purs +1/−0
- tests/purs/failing/PrimRow.out +10/−0
- tests/purs/failing/PrimRow.purs +11/−0
- tests/purs/failing/PrimSubModuleReserved.out +10/−0
- tests/purs/failing/PrimSubModuleReserved.purs +4/−0
- tests/purs/failing/PrimSubModuleReserved/Prim_Foobar.out +10/−0
- tests/purs/failing/PrimSubModuleReserved/Prim_Foobar.purs +1/−0
- tests/purs/failing/ProgrammablePolykindedTypeErrorsTypeString.out +18/−0
- tests/purs/failing/ProgrammablePolykindedTypeErrorsTypeString.purs +23/−0
- tests/purs/failing/ProgrammableTypeErrors.out +28/−0
- tests/purs/failing/ProgrammableTypeErrors.purs +17/−0
- tests/purs/failing/ProgrammableTypeErrorsTypeString.out +25/−0
- tests/purs/failing/ProgrammableTypeErrorsTypeString.purs +24/−0
- tests/purs/failing/QualifiedOperators.out +10/−0
- tests/purs/failing/QualifiedOperators.purs +4/−0
- tests/purs/failing/QualifiedOperators2.out +10/−0
- tests/purs/failing/QualifiedOperators2.purs +4/−0
- tests/purs/failing/QuantificationCheckFailure.out +12/−0
- tests/purs/failing/QuantificationCheckFailure.purs +14/−0
- tests/purs/failing/QuantificationCheckFailure2.out +16/−0
- tests/purs/failing/QuantificationCheckFailure2.purs +6/−0
- tests/purs/failing/QuantificationCheckFailure3.out +12/−0
- tests/purs/failing/QuantificationCheckFailure3.purs +7/−0
- tests/purs/failing/QuantifiedKind.out +15/−0
- tests/purs/failing/QuantifiedKind.purs +7/−0
- tests/purs/failing/Rank2Types.out +25/−0
- tests/purs/failing/Rank2Types.purs +8/−0
- tests/purs/failing/RecordLabelOnTypeError.out +26/−0
- tests/purs/failing/RecordLabelOnTypeError.purs +8/−0
- tests/purs/failing/RecordLabelOnTypeErrorImmediate.out +22/−0
- tests/purs/failing/RecordLabelOnTypeErrorImmediate.purs +5/−0
- tests/purs/failing/RequiredHiddenType.out +13/−0
- tests/purs/failing/RequiredHiddenType.purs +9/−0
- tests/purs/failing/Reserved.out +10/−0
- tests/purs/failing/Reserved.purs +7/−0
- tests/purs/failing/RoleDeclarationArityMismatch.out +11/−0
- tests/purs/failing/RoleDeclarationArityMismatch.purs +5/−0
- tests/purs/failing/RoleDeclarationArityMismatchForeign.out +11/−0
- tests/purs/failing/RoleDeclarationArityMismatchForeign.purs +5/−0
- tests/purs/failing/RoleDeclarationArityMismatchForeign2.out +11/−0
- tests/purs/failing/RoleDeclarationArityMismatchForeign2.purs +5/−0
- tests/purs/failing/RoleDeclarationArityMismatchForeign3.out +11/−0
- tests/purs/failing/RoleDeclarationArityMismatchForeign3.purs +5/−0
- tests/purs/failing/RoleDeclarationArityMismatchForeign4.out +11/−0
- tests/purs/failing/RoleDeclarationArityMismatchForeign4.purs +7/−0
- tests/purs/failing/RowConstructors1.out +21/−0
- tests/purs/failing/RowConstructors1.purs +9/−0
- tests/purs/failing/RowConstructors2.out +15/−0
- tests/purs/failing/RowConstructors2.purs +9/−0
- tests/purs/failing/RowConstructors3.out +21/−0
- tests/purs/failing/RowConstructors3.purs +9/−0
- tests/purs/failing/RowInInstanceNotDetermined0.out +19/−0
- tests/purs/failing/RowInInstanceNotDetermined0.purs +9/−0
- tests/purs/failing/RowInInstanceNotDetermined1.out +20/−0
- tests/purs/failing/RowInInstanceNotDetermined1.purs +9/−0
- tests/purs/failing/RowInInstanceNotDetermined2.out +19/−0
- tests/purs/failing/RowInInstanceNotDetermined2.purs +9/−0
- tests/purs/failing/RowLacks.out +28/−0
- tests/purs/failing/RowLacks.purs +18/−0
- tests/purs/failing/RowsInKinds.out +28/−0
- tests/purs/failing/RowsInKinds.purs +15/−0
- tests/purs/failing/ScopedKindVariableSynonym.out +12/−0
- tests/purs/failing/ScopedKindVariableSynonym.purs +7/−0
- tests/purs/failing/SelfCycleInForeignDataKinds.out +9/−0
- tests/purs/failing/SelfCycleInForeignDataKinds.purs +4/−0
- tests/purs/failing/SelfCycleInKindDeclaration.out +9/−0
- tests/purs/failing/SelfCycleInKindDeclaration.purs +5/−0
- tests/purs/failing/SelfCycleInTypeClassDeclaration.out +9/−0
- tests/purs/failing/SelfCycleInTypeClassDeclaration.purs +4/−0
- tests/purs/failing/SelfImport.out +9/−0
- tests/purs/failing/SelfImport.purs +9/−0
- tests/purs/failing/SelfImport/Dummy.out +9/−0
- tests/purs/failing/SelfImport/Dummy.purs +5/−0
- tests/purs/failing/SkolemEscape.out +20/−0
- tests/purs/failing/SkolemEscape.purs +8/−0
- tests/purs/failing/SkolemEscape2.out +22/−0
- tests/purs/failing/SkolemEscape2.purs +11/−0
- tests/purs/failing/SkolemEscapeKinds.out +18/−0
- tests/purs/failing/SkolemEscapeKinds.purs +8/−0
- tests/purs/failing/StandaloneKindSignatures1.out +21/−0
- tests/purs/failing/StandaloneKindSignatures1.purs +7/−0
- tests/purs/failing/StandaloneKindSignatures2.out +21/−0
- tests/purs/failing/StandaloneKindSignatures2.purs +8/−0
- tests/purs/failing/StandaloneKindSignatures3.out +21/−0
- tests/purs/failing/StandaloneKindSignatures3.purs +7/−0
- tests/purs/failing/StandaloneKindSignatures4.out +25/−0
- tests/purs/failing/StandaloneKindSignatures4.purs +7/−0
- tests/purs/failing/SuggestComposition.out +32/−0
- tests/purs/failing/SuggestComposition.purs +7/−0
- tests/purs/failing/Superclasses1.out +18/−0
- tests/purs/failing/Superclasses1.purs +14/−0
- tests/purs/failing/Superclasses2.out +13/−0
- tests/purs/failing/Superclasses2.purs +12/−0
- tests/purs/failing/Superclasses3.out +22/−0
- tests/purs/failing/Superclasses3.purs +8/−0
- tests/purs/failing/Superclasses5.out +22/−0
- tests/purs/failing/Superclasses5.purs +26/−0
- tests/purs/failing/TooFewClassInstanceArgs.out +15/−0
- tests/purs/failing/TooFewClassInstanceArgs.purs +8/−0
- tests/purs/failing/TooFewUnnamedClassInstanceArgs.out +15/−0
- tests/purs/failing/TooFewUnnamedClassInstanceArgs.purs +8/−0
- tests/purs/failing/TopLevelCaseNoArgs.out +10/−0
- tests/purs/failing/TopLevelCaseNoArgs.purs +8/−0
- tests/purs/failing/TransitiveDctorExport.out +13/−0
- tests/purs/failing/TransitiveDctorExport.purs +5/−0
- tests/purs/failing/TransitiveDctorExportError.out +13/−0
- tests/purs/failing/TransitiveDctorExportError.purs +4/−0
- tests/purs/failing/TransitiveKindExport.out +13/−0
- tests/purs/failing/TransitiveKindExport.purs +6/−0
- tests/purs/failing/TransitiveSynonymExport.out +13/−0
- tests/purs/failing/TransitiveSynonymExport.purs +5/−0
- tests/purs/failing/TypeClasses2.out +20/−0
- tests/purs/failing/TypeClasses2.purs +7/−0
- tests/purs/failing/TypeError.out +22/−0
- tests/purs/failing/TypeError.purs +6/−0
- tests/purs/failing/TypeOperatorAliasNoExport.out +13/−0
- tests/purs/failing/TypeOperatorAliasNoExport.purs +6/−0
- tests/purs/failing/TypeSynonymCycle.out +14/−0
- tests/purs/failing/TypeSynonymCycle.purs +6/−0
- tests/purs/failing/TypeSynonyms.out +14/−0
- tests/purs/failing/TypeSynonyms.purs +8/−0
- tests/purs/failing/TypeSynonyms10.out +21/−0
- tests/purs/failing/TypeSynonyms10.purs +8/−0
- tests/purs/failing/TypeSynonyms4.out +12/−0
- tests/purs/failing/TypeSynonyms4.purs +11/−0
- tests/purs/failing/TypeSynonyms5.out +11/−0
- tests/purs/failing/TypeSynonyms5.purs +6/−0
- tests/purs/failing/TypeSynonyms7.out +20/−0
- tests/purs/failing/TypeSynonyms7.purs +9/−0
- tests/purs/failing/TypeSynonyms8.out +14/−0
- tests/purs/failing/TypeSynonyms8.purs +6/−0
- tests/purs/failing/TypeSynonyms9.out +15/−0
- tests/purs/failing/TypeSynonyms9.purs +7/−0
- tests/purs/failing/TypeSynonymsOverlappingInstance.out +24/−0
- tests/purs/failing/TypeSynonymsOverlappingInstance.purs +15/−0
- tests/purs/failing/TypeSynonymsOverlappingUnnamedInstance.out +24/−0
- tests/purs/failing/TypeSynonymsOverlappingUnnamedInstance.purs +15/−0
- tests/purs/failing/TypeWildcards1.out +10/−0
- tests/purs/failing/TypeWildcards1.purs +7/−0
- tests/purs/failing/TypeWildcards2.out +10/−0
- tests/purs/failing/TypeWildcards2.purs +7/−0
- tests/purs/failing/TypeWildcards3.out +18/−0
- tests/purs/failing/TypeWildcards3.purs +9/−0
- tests/purs/failing/TypeWildcards4.out +10/−0
- tests/purs/failing/TypeWildcards4.purs +4/−0
- tests/purs/failing/TypedBinders.out +10/−0
- tests/purs/failing/TypedBinders.purs +10/−0
- tests/purs/failing/TypedBinders2.out +30/−0
- tests/purs/failing/TypedBinders2.purs +9/−0
- tests/purs/failing/TypedBinders3.out +21/−0
- tests/purs/failing/TypedBinders3.purs +13/−0
- tests/purs/failing/TypedHole.out +23/−0
- tests/purs/failing/TypedHole.purs +8/−0
- tests/purs/failing/TypedHole2.out +14/−0
- tests/purs/failing/TypedHole2.purs +8/−0
- tests/purs/failing/TypedHole3.out +34/−0
- tests/purs/failing/TypedHole3.purs +4/−0
- tests/purs/failing/TypedHole4.out +52/−0
- tests/purs/failing/TypedHole4.purs +9/−0
- tests/purs/failing/UnderscoreModuleName.out +10/−0
- tests/purs/failing/UnderscoreModuleName.purs +6/−0
- tests/purs/failing/UnknownType.out +10/−0
- tests/purs/failing/UnknownType.purs +7/−0
- tests/purs/failing/UnsupportedFFICommonJSExports1.js +2/−0
- tests/purs/failing/UnsupportedFFICommonJSExports1.out +12/−0
- tests/purs/failing/UnsupportedFFICommonJSExports1.purs +5/−0
- tests/purs/failing/UnsupportedFFICommonJSExports2.js +4/−0
- tests/purs/failing/UnsupportedFFICommonJSExports2.out +13/−0
- tests/purs/failing/UnsupportedFFICommonJSExports2.purs +5/−0
- tests/purs/failing/UnsupportedFFICommonJSImports1.js +4/−0
- tests/purs/failing/UnsupportedFFICommonJSImports1.out +12/−0
- tests/purs/failing/UnsupportedFFICommonJSImports1.purs +5/−0
- tests/purs/failing/UnsupportedFFICommonJSImports2.js +5/−0
- tests/purs/failing/UnsupportedFFICommonJSImports2.out +12/−0
- tests/purs/failing/UnsupportedFFICommonJSImports2.purs +5/−0
- tests/purs/failing/UnsupportedRoleDeclarationTypeClass.out +10/−0
- tests/purs/failing/UnsupportedRoleDeclarationTypeClass.purs +5/−0
- tests/purs/failing/UnsupportedRoleDeclarationTypeSynonym.out +10/−0
- tests/purs/failing/UnsupportedRoleDeclarationTypeSynonym.purs +7/−0
- tests/purs/failing/UnsupportedTypeInKind.out +15/−0
- tests/purs/failing/UnsupportedTypeInKind.purs +7/−0
- tests/purs/failing/VisibleTypeApplications1.out +20/−0
- tests/purs/failing/VisibleTypeApplications1.purs +7/−0
- tests/purs/failing/VisibleTypeApplications2.out +19/−0
- tests/purs/failing/VisibleTypeApplications2.purs +7/−0
- tests/purs/failing/Whitespace1.out +10/−0
- tests/purs/failing/Whitespace1.purs +5/−0
- tests/purs/graph/graph.json +1/−0
- tests/purs/graph/src/Module.purs +9/−0
- tests/purs/graph/src/Module2.purs +6/−0
- tests/purs/graph/src/Module3.purs +4/−0
- tests/purs/graph/src/ModuleFailing.purs +5/−0
- tests/purs/layout/AdoIn.out +20/−0
- tests/purs/layout/AdoIn.purs +19/−0
- tests/purs/layout/BacktickOperator.out +22/−0
- tests/purs/layout/BacktickOperator.purs +21/−0
- tests/purs/layout/CaseGuards.out +54/−0
- tests/purs/layout/CaseGuards.purs +53/−0
- tests/purs/layout/CaseWhere.out +13/−0
- tests/purs/layout/CaseWhere.purs +12/−0
- tests/purs/layout/ClassHead.out +11/−0
- tests/purs/layout/ClassHead.purs +10/−0
- tests/purs/layout/Commas.out +23/−0
- tests/purs/layout/Commas.purs +22/−0
- tests/purs/layout/Delimiter.out +14/−0
- tests/purs/layout/Delimiter.purs +13/−0
- tests/purs/layout/DoLet.out +16/−0
- tests/purs/layout/DoLet.purs +15/−0
- tests/purs/layout/DoOperator.out +9/−0
- tests/purs/layout/DoOperator.purs +8/−0
- tests/purs/layout/DoWhere.out +7/−0
- tests/purs/layout/DoWhere.purs +6/−0
- tests/purs/layout/IfThenElseDo.out +11/−0
- tests/purs/layout/IfThenElseDo.purs +10/−0
- tests/purs/layout/InstanceChainElse.out +5/−0
- tests/purs/layout/InstanceChainElse.purs +4/−0
- tests/purs/layout/IntType.out +8/−0
- tests/purs/layout/IntType.purs +7/−0
- tests/purs/layout/LetGuards.out +30/−0
- tests/purs/layout/LetGuards.purs +29/−0
- tests/purs/layout/Shebang.out +7/−0
- tests/purs/layout/Shebang.purs +6/−0
- tests/purs/make/Module.purs +5/−0
- tests/purs/optimize/2866.out.js +13/−0
- tests/purs/optimize/2866.purs +12/−0
- tests/purs/optimize/4179.out.js +101/−0
- tests/purs/optimize/4179.purs +45/−0
- tests/purs/optimize/4229.out.js +17/−0
- tests/purs/optimize/4229.purs +13/−0
- tests/purs/optimize/4386.out.js +26/−0
- tests/purs/optimize/4386.purs +25/−0
- tests/purs/optimize/Foreign.js +1/−0
- tests/purs/optimize/Foreign.out.js +5/−0
- tests/purs/optimize/Foreign.purs +5/−0
- tests/purs/optimize/Monad.out.js +30/−0
- tests/purs/optimize/Monad.purs +17/−0
- tests/purs/optimize/ObjectUpdate.out.js +27/−0
- tests/purs/optimize/ObjectUpdate.purs +10/−0
- tests/purs/optimize/Primitives.out.js +10/−0
- tests/purs/optimize/Primitives.purs +9/−0
- tests/purs/optimize/RecursiveInstances.out.js +107/−0
- tests/purs/optimize/RecursiveInstances.purs +31/−0
- tests/purs/optimize/Symbols.out.js +68/−0
- tests/purs/optimize/Symbols.purs +40/−0
- tests/purs/passing/1110.purs +26/−0
- tests/purs/passing/1185.purs +15/−0
- tests/purs/passing/1335.purs +14/−0
- tests/purs/passing/1570.purs +8/−0
- tests/purs/passing/1664.purs +16/−0
- tests/purs/passing/1697.purs +25/−0
- tests/purs/passing/1807.purs +14/−0
- tests/purs/passing/1881.purs +19/−0
- tests/purs/passing/1991.purs +22/−0
- tests/purs/passing/2018.purs +12/−0
- tests/purs/passing/2018/A.purs +7/−0
- tests/purs/passing/2018/B.purs +3/−0
- tests/purs/passing/2049.purs +14/−0
- tests/purs/passing/2136.purs +9/−0
- tests/purs/passing/2138.purs +7/−0
- tests/purs/passing/2138/Lib.purs +3/−0
- tests/purs/passing/2197-1.purs +12/−0
- tests/purs/passing/2197-2.purs +11/−0
- tests/purs/passing/2252.purs +15/−0
- tests/purs/passing/2288.purs +19/−0
- tests/purs/passing/2378.purs +9/−0
- tests/purs/passing/2438.purs +8/−0
- tests/purs/passing/2609.purs +12/−0
- tests/purs/passing/2609/Eg.purs +6/−0
- tests/purs/passing/2616.purs +13/−0
- tests/purs/passing/2626.purs +13/−0
- tests/purs/passing/2663.purs +10/−0
- tests/purs/passing/2689.purs +36/−0
- tests/purs/passing/2756.purs +20/−0
- tests/purs/passing/2787.purs +8/−0
- tests/purs/passing/2795.purs +14/−0
- tests/purs/passing/2803.purs +17/−0
- tests/purs/passing/2806.purs +14/−0
- tests/purs/passing/2941.purs +18/−0
- tests/purs/passing/2947.purs +11/−0
- tests/purs/passing/2958.purs +14/−0
- tests/purs/passing/2972.purs +13/−0
- tests/purs/passing/3114.purs +54/−0
- tests/purs/passing/3114/VendoredVariant.purs +42/−0
- tests/purs/passing/3125.purs +16/−0
- tests/purs/passing/3187-UnusedNameClash.purs +12/−0
- tests/purs/passing/3238.purs +14/−0
- tests/purs/passing/3329.purs +34/−0
- tests/purs/passing/3388.purs +10/−0
- tests/purs/passing/3410.purs +11/−0
- tests/purs/passing/3481.purs +7/−0
- tests/purs/passing/3510.purs +11/−0
- tests/purs/passing/3549.purs +13/−0
- tests/purs/passing/3558-UpToDateDictsForHigherOrderFns.purs +34/−0
- tests/purs/passing/3595.purs +14/−0
- tests/purs/passing/3830.purs +16/−0
- tests/purs/passing/3941.purs +25/−0
- tests/purs/passing/3957.purs +39/−0
- tests/purs/passing/4035.purs +14/−0
- tests/purs/passing/4035/Other.purs +4/−0
- tests/purs/passing/4038.purs +11/−0
- tests/purs/passing/4101.purs +20/−0
- tests/purs/passing/4101/Lib.purs +9/−0
- tests/purs/passing/4105.purs +12/−0
- tests/purs/passing/4105/Lib.purs +5/−0
- tests/purs/passing/4174.purs +16/−0
- tests/purs/passing/4179.js +2/−0
- tests/purs/passing/4179.purs +73/−0
- tests/purs/passing/4179/CustomAssert.js +12/−0
- tests/purs/passing/4179/CustomAssert.purs +10/−0
- tests/purs/passing/4179/InitializationError.purs +14/−0
- tests/purs/passing/4180.purs +14/−0
- tests/purs/passing/4194.purs +14/−0
- tests/purs/passing/4200.purs +11/−0
- tests/purs/passing/4200/Lib.purs +7/−0
- tests/purs/passing/4229.purs +13/−0
- tests/purs/passing/4310.purs +8/−0
- tests/purs/passing/4310/Lib.purs +17/−0
- tests/purs/passing/4357.purs +29/−0
- tests/purs/passing/4376.purs +29/−0
- tests/purs/passing/4431-2.purs +12/−0
- tests/purs/passing/4431.purs +11/−0
- tests/purs/passing/4483.purs +12/−0
- tests/purs/passing/4500.purs +15/−0
- tests/purs/passing/652.purs +18/−0
- tests/purs/passing/810.purs +14/−0
- tests/purs/passing/862.purs +8/−0
- tests/purs/passing/922.purs +20/−0
- tests/purs/passing/Ado.purs +77/−0
- tests/purs/passing/AppendInReverse.purs +38/−0
- tests/purs/passing/Applicative.purs +16/−0
- tests/purs/passing/ArrayType.purs +12/−0
- tests/purs/passing/Auto.purs +16/−0
- tests/purs/passing/AutoPrelude.purs +11/−0
- tests/purs/passing/AutoPrelude2.purs +10/−0
- tests/purs/passing/BigFunction.purs +140/−0
- tests/purs/passing/BindersInFunctions.purs +16/−0
- tests/purs/passing/BindingGroups.purs +11/−0
- tests/purs/passing/BlockString.purs +9/−0
- tests/purs/passing/BlockStringEdgeCases.purs +30/−0
- tests/purs/passing/CSEInitialDigitSymbols.purs +16/−0
- tests/purs/passing/CaseInDo.purs +21/−0
- tests/purs/passing/CaseInputWildcard.purs +18/−0
- tests/purs/passing/CaseMultipleExpressions.purs +21/−0
- tests/purs/passing/CaseStatement.purs +22/−0
- tests/purs/passing/CheckFunction.purs +8/−0
- tests/purs/passing/CheckSynonymBug.purs +13/−0
- tests/purs/passing/CheckTypeClass.purs +18/−0
- tests/purs/passing/Church.purs +18/−0
- tests/purs/passing/ClassRefSyntax.purs +9/−0
- tests/purs/passing/ClassRefSyntax/Lib.purs +4/−0
- tests/purs/passing/Coercible.purs +290/−0
- tests/purs/passing/Coercible/Lib.purs +12/−0
- tests/purs/passing/Coercible/Lib2.purs +3/−0
- tests/purs/passing/Collatz.purs +21/−0
- tests/purs/passing/Comparisons.purs +15/−0
- tests/purs/passing/Conditional.purs +9/−0
- tests/purs/passing/Console.purs +15/−0
- tests/purs/passing/ConstraintInference.purs +10/−0
- tests/purs/passing/ConstraintOutsideForall.purs +12/−0
- tests/purs/passing/ConstraintParens.purs +12/−0
- tests/purs/passing/ConstraintParsingIssue.purs +9/−0
- tests/purs/passing/ContextSimplification.purs +15/−0
- tests/purs/passing/CyclicInstances.purs +29/−0
- tests/purs/passing/DataAndType.purs +10/−0
- tests/purs/passing/DataConsClassConsOverlapOk.purs +8/−0
- tests/purs/passing/DctorName.purs +33/−0
- tests/purs/passing/DctorOperatorAlias.purs +34/−0
- tests/purs/passing/DctorOperatorAlias/List.purs +5/−0
- tests/purs/passing/DeepArrayBinder.purs +17/−0
- tests/purs/passing/DeepCase.purs +15/−0
- tests/purs/passing/DeriveNewtype.purs +29/−0
- tests/purs/passing/DeriveWithNestedSynonyms.purs +29/−0
- tests/purs/passing/Deriving.purs +36/−0
- tests/purs/passing/DerivingBifunctor.purs +26/−0
- tests/purs/passing/DerivingContravariant.purs +20/−0
- tests/purs/passing/DerivingFoldable.purs +89/−0
- tests/purs/passing/DerivingFunctor.purs +124/−0
- tests/purs/passing/DerivingFunctorFromBi.purs +18/−0
- tests/purs/passing/DerivingFunctorFromContra.purs +13/−0
- tests/purs/passing/DerivingFunctorFromPro.purs +16/−0
- tests/purs/passing/DerivingFunctorPrefersSimplerClasses.purs +46/−0
- tests/purs/passing/DerivingProfunctor.purs +19/−0
- tests/purs/passing/DerivingTraversable.purs +110/−0
- tests/purs/passing/Do.purs +68/−0
- tests/purs/passing/Dollar.purs +16/−0
- tests/purs/passing/DuplicateProperties.purs +24/−0
- tests/purs/passing/ESFFIFunctionConst.js +3/−0
- tests/purs/passing/ESFFIFunctionConst.purs +8/−0
- tests/purs/passing/ESFFIFunctionFunction.js +3/−0
- tests/purs/passing/ESFFIFunctionFunction.purs +8/−0
- tests/purs/passing/ESFFIFunctionVar.js +3/−0
- tests/purs/passing/ESFFIFunctionVar.purs +8/−0
- tests/purs/passing/ESFFIValueConst1.js +1/−0
- tests/purs/passing/ESFFIValueConst1.purs +8/−0
- tests/purs/passing/ESFFIValueVar.js +1/−0
- tests/purs/passing/ESFFIValueVar.purs +8/−0
- tests/purs/passing/EffFn.js +1/−0
- tests/purs/passing/EffFn.purs +22/−0
- tests/purs/passing/EmptyDataDecls.purs +20/−0
- tests/purs/passing/EmptyDicts.purs +77/−0
- tests/purs/passing/EmptyRow.purs +11/−0
- tests/purs/passing/EmptyTypeClass.purs +11/−0
- tests/purs/passing/EntailsKindedType.purs +11/−0
- tests/purs/passing/Eq1Deriving.purs +12/−0
- tests/purs/passing/Eq1InEqDeriving.purs +11/−0
- tests/purs/passing/EqOrd.purs +18/−0
- tests/purs/passing/ExplicitImportReExport.purs +11/−0
- tests/purs/passing/ExplicitImportReExport/Bar.purs +3/−0
- tests/purs/passing/ExplicitImportReExport/Foo.purs +4/−0
- tests/purs/passing/ExplicitOperatorSections.purs +15/−0
- tests/purs/passing/ExportExplicit.purs +10/−0
- tests/purs/passing/ExportExplicit/M1.purs +10/−0
- tests/purs/passing/ExportExplicit2.purs +8/−0
- tests/purs/passing/ExportExplicit2/M1.purs +7/−0
- tests/purs/passing/ExportedInstanceDeclarations.purs +45/−0
- tests/purs/passing/ExtendedInfixOperators.purs +17/−0
- tests/purs/passing/FFIConstraintWorkaround.js +5/−0
- tests/purs/passing/FFIConstraintWorkaround.purs +22/−0
- tests/purs/passing/FFIDefaultESExport.js +3/−0
- tests/purs/passing/FFIDefaultESExport.purs +7/−0
- tests/purs/passing/Fib.purs +20/−0
- tests/purs/passing/FieldConsPuns.purs +13/−0
- tests/purs/passing/FieldPuns.purs +10/−0
- tests/purs/passing/FinalTagless.purs +25/−0
- tests/purs/passing/ForeignDataInKind.purs +9/−0
- tests/purs/passing/ForeignKind.purs +10/−0
- tests/purs/passing/ForeignKind/Lib.purs +60/−0
- tests/purs/passing/FunWithFunDeps.js +28/−0
- tests/purs/passing/FunWithFunDeps.purs +45/−0
- tests/purs/passing/FunctionAndCaseGuards.purs +21/−0
- tests/purs/passing/FunctionScope.purs +13/−0
- tests/purs/passing/FunctionalDependencies.purs +21/−0
- tests/purs/passing/Functions.purs +12/−0
- tests/purs/passing/Functions2.purs +13/−0
- tests/purs/passing/Generalization1.purs +11/−0
- tests/purs/passing/GenericsRep.purs +43/−0
- tests/purs/passing/Guards.purs +70/−0
- tests/purs/passing/HasOwnProperty.purs +5/−0
- tests/purs/passing/HoistError.purs +12/−0
- tests/purs/passing/IfThenElseMaybe.purs +12/−0
- tests/purs/passing/IfWildcard.purs +19/−0
- tests/purs/passing/ImplicitEmptyImport.purs +9/−0
- tests/purs/passing/Import.purs +6/−0
- tests/purs/passing/Import/M1.purs +6/−0
- tests/purs/passing/Import/M2.purs +5/−0
- tests/purs/passing/ImportExplicit.purs +10/−0
- tests/purs/passing/ImportExplicit/M1.purs +4/−0
- tests/purs/passing/ImportHiding.purs +19/−0
- tests/purs/passing/ImportQualified.purs +8/−0
- tests/purs/passing/ImportQualified/M1.purs +3/−0
- tests/purs/passing/InferRecFunWithConstrainedArgument.purs +11/−0
- tests/purs/passing/InheritMultipleSuperClasses.purs +25/−0
- tests/purs/passing/InstanceBeforeClass.purs +12/−0
- tests/purs/passing/InstanceChain.purs +71/−0
- tests/purs/passing/InstanceNamesGenerated.purs +98/−0
- tests/purs/passing/InstanceNamesGenerated/Lib.purs +20/−0
- tests/purs/passing/InstanceSigs.purs +12/−0
- tests/purs/passing/InstanceSigsGeneral.purs +12/−0
- tests/purs/passing/InstanceUnnamedSimilarClassName.purs +16/−0
- tests/purs/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs +4/−0
- tests/purs/passing/IntAndChar.purs +19/−0
- tests/purs/passing/IntToString.purs +71/−0
- tests/purs/passing/JSReserved.purs +13/−0
- tests/purs/passing/KindUnificationInSolver.purs +21/−0
- tests/purs/passing/KindedType.purs +41/−0
- tests/purs/passing/LargeSumType.purs +35/−0
- tests/purs/passing/Let.purs +58/−0
- tests/purs/passing/Let2.purs +20/−0
- tests/purs/passing/LetInInstance.purs +15/−0
- tests/purs/passing/LetPattern.purs +196/−0
- tests/purs/passing/LiberalTypeSynonyms.purs +22/−0
- tests/purs/passing/MPTCs.purs +21/−0
- tests/purs/passing/Match.purs +10/−0
- tests/purs/passing/MinusConstructor.purs +38/−0
- tests/purs/passing/Module.purs +7/−0
- tests/purs/passing/Module/M1.purs +14/−0
- tests/purs/passing/Module/M2.purs +10/−0
- tests/purs/passing/ModuleDeps.purs +6/−0
- tests/purs/passing/ModuleDeps/M1.purs +5/−0
- tests/purs/passing/ModuleDeps/M2.purs +5/−0
- tests/purs/passing/ModuleDeps/M3.purs +3/−0
- tests/purs/passing/ModuleExport.purs +8/−0
- tests/purs/passing/ModuleExport/A.purs +3/−0
- tests/purs/passing/ModuleExportDupes.purs +11/−0
- tests/purs/passing/ModuleExportDupes/A.purs +3/−0
- tests/purs/passing/ModuleExportDupes/B.purs +3/−0
- tests/purs/passing/ModuleExportDupes/C.purs +4/−0
- tests/purs/passing/ModuleExportExcluded.purs +11/−0
- tests/purs/passing/ModuleExportExcluded/A.purs +6/−0
- tests/purs/passing/ModuleExportQualified.purs +9/−0
- tests/purs/passing/ModuleExportQualified/A.purs +3/−0
- tests/purs/passing/ModuleExportSelf.purs +11/−0
- tests/purs/passing/ModuleExportSelf/A.purs +5/−0
- tests/purs/passing/Monad.purs +32/−0
- tests/purs/passing/MonadState.purs +63/−0
- tests/purs/passing/MultiArgFunctions.purs +27/−0
- tests/purs/passing/MutRec.purs +20/−0
- tests/purs/passing/MutRec2.purs +20/−0
- tests/purs/passing/MutRec3.purs +20/−0
- tests/purs/passing/NakedConstraint.purs +10/−0
- tests/purs/passing/NamedPatterns.purs +10/−0
- tests/purs/passing/NegativeBinder.purs +15/−0
- tests/purs/passing/NegativeIntInRange.purs +9/−0
- tests/purs/passing/Nested.purs +10/−0
- tests/purs/passing/NestedRecordUpdate.purs +24/−0
- tests/purs/passing/NestedRecordUpdateWildcards.purs +20/−0
- tests/purs/passing/NestedTypeSynonyms.purs +12/−0
- tests/purs/passing/NestedWhere.purs +13/−0
- tests/purs/passing/NewConsClass.purs +12/−0
- tests/purs/passing/Newtype.purs +23/−0
- tests/purs/passing/NewtypeClass.purs +44/−0
- tests/purs/passing/NewtypeEff.purs +29/−0
- tests/purs/passing/NewtypeInstance.purs +68/−0
- tests/purs/passing/NewtypeWithRecordUpdate.purs +16/−0
- tests/purs/passing/NonConflictingExports.purs +10/−0
- tests/purs/passing/NonConflictingExports/A.purs +4/−0
- tests/purs/passing/NonOrphanInstanceFunDepExtra.purs +8/−0
- tests/purs/passing/NonOrphanInstanceFunDepExtra/Lib.purs +4/−0
- tests/purs/passing/NonOrphanInstanceMulti.purs +7/−0
- tests/purs/passing/NonOrphanInstanceMulti/Lib.purs +4/−0
- tests/purs/passing/NumberLiterals.purs +39/−0
- tests/purs/passing/ObjectGetter.purs +14/−0
- tests/purs/passing/ObjectSynonym.purs +16/−0
- tests/purs/passing/ObjectUpdate.purs +23/−0
- tests/purs/passing/ObjectUpdate2.purs +18/−0
- tests/purs/passing/ObjectUpdater.purs +26/−0
- tests/purs/passing/ObjectWildcards.purs +20/−0
- tests/purs/passing/Objects.purs +36/−0
- tests/purs/passing/OneConstructor.purs +10/−0
- tests/purs/passing/OperatorAlias.purs +11/−0
- tests/purs/passing/OperatorAliasElsewhere.purs +9/−0
- tests/purs/passing/OperatorAliasElsewhere/Def.purs +4/−0
- tests/purs/passing/OperatorAssociativity.purs +25/−0
- tests/purs/passing/OperatorInlining.purs +48/−0
- tests/purs/passing/OperatorSections.purs +20/−0
- tests/purs/passing/Operators.purs +91/−0
- tests/purs/passing/Operators/Other.purs +7/−0
- tests/purs/passing/OptimizerBug.purs +10/−0
- tests/purs/passing/OptionalQualified.purs +12/−0
- tests/purs/passing/Ord1Deriving.purs +16/−0
- tests/purs/passing/Ord1InOrdDeriving.purs +13/−0
- tests/purs/passing/ParensInType.purs +14/−0
- tests/purs/passing/ParensInTypedBinder.purs +14/−0
- tests/purs/passing/ParseTypeInt.purs +28/−0
- tests/purs/passing/PartialFunction.purs +11/−0
- tests/purs/passing/PartialTCO.purs +13/−0
- tests/purs/passing/Patterns.purs +23/−0
- tests/purs/passing/PendingConflictingImports.purs +8/−0
- tests/purs/passing/PendingConflictingImports/A.purs +4/−0
- tests/purs/passing/PendingConflictingImports/B.purs +4/−0
- tests/purs/passing/PendingConflictingImports2.purs +10/−0
- tests/purs/passing/PendingConflictingImports2/A.purs +4/−0
- tests/purs/passing/Person.purs +12/−0
- tests/purs/passing/PolyLabels.js +15/−0
- tests/purs/passing/PolyLabels.purs +67/−0
- tests/purs/passing/PolykindBindingGroup1.purs +13/−0
- tests/purs/passing/PolykindBindingGroup2.purs +16/−0
- tests/purs/passing/PolykindGeneralization.purs +15/−0
- tests/purs/passing/PolykindGeneralizationHygiene.purs +11/−0
- tests/purs/passing/PolykindGeneralizedTypeSynonym.purs +12/−0
- tests/purs/passing/PolykindInstanceDispatch.purs +21/−0
- tests/purs/passing/PolykindInstantiatedInstance.purs +22/−0
- tests/purs/passing/PolykindInstantiation.purs +17/−0
- tests/purs/passing/PolykindRowCons.purs +51/−0
- tests/purs/passing/PrimedTypeName.purs +20/−0
- tests/purs/passing/QualifiedAdo.purs +19/−0
- tests/purs/passing/QualifiedAdo/IxApplicative.purs +8/−0
- tests/purs/passing/QualifiedDo.purs +19/−0
- tests/purs/passing/QualifiedDo/IxMonad.purs +5/−0
- tests/purs/passing/QualifiedNames.purs +11/−0
- tests/purs/passing/QualifiedNames/Either.purs +5/−0
- tests/purs/passing/QualifiedOperators.purs +13/−0
- tests/purs/passing/QualifiedOperators/Foo.purs +8/−0
- tests/purs/passing/QualifiedQualifiedImports.purs +6/−0
- tests/purs/passing/QuantifiedKind.purs +10/−0
- tests/purs/passing/Rank2Data.purs +30/−0
- tests/purs/passing/Rank2Kinds.purs +21/−0
- tests/purs/passing/Rank2Object.purs +11/−0
- tests/purs/passing/Rank2TypeSynonym.purs +17/−0
- tests/purs/passing/Rank2Types.purs +12/−0
- tests/purs/passing/ReExportQualified.purs +7/−0
- tests/purs/passing/ReExportQualified/A.purs +3/−0
- tests/purs/passing/ReExportQualified/B.purs +3/−0
- tests/purs/passing/ReExportQualified/C.purs +4/−0
- tests/purs/passing/ReExportsExported.js +2/−0
- tests/purs/passing/ReExportsExported.purs +7/−0
- tests/purs/passing/ReExportsExported/A.purs +4/−0
- tests/purs/passing/ReExportsExported/B.purs +7/−0
- tests/purs/passing/ReExportsExported/C.purs +4/−0
- tests/purs/passing/RebindableSyntax.purs +43/−0
- tests/purs/passing/Recursion.purs +11/−0
- tests/purs/passing/RedefinedFixity.purs +6/−0
- tests/purs/passing/RedefinedFixity/M1.purs +6/−0
- tests/purs/passing/RedefinedFixity/M2.purs +3/−0
- tests/purs/passing/RedefinedFixity/M3.purs +4/−0
- tests/purs/passing/ReservedWords.purs +19/−0
- tests/purs/passing/ResolvableScopeConflict.purs +13/−0
- tests/purs/passing/ResolvableScopeConflict/A.purs +4/−0
- tests/purs/passing/ResolvableScopeConflict/B.purs +7/−0
- tests/purs/passing/ResolvableScopeConflict2.purs +15/−0
- tests/purs/passing/ResolvableScopeConflict2/A.purs +7/−0
- tests/purs/passing/ResolvableScopeConflict3.purs +9/−0
- tests/purs/passing/ResolvableScopeConflict3/A.purs +4/−0
- tests/purs/passing/RowConstructors.purs +43/−0
- tests/purs/passing/RowInInstanceHeadDetermined.purs +40/−0
- tests/purs/passing/RowLacks.purs +33/−0
- tests/purs/passing/RowNub.purs +23/−0
- tests/purs/passing/RowPolyInstanceContext.purs +23/−0
- tests/purs/passing/RowUnion.js +6/−0
- tests/purs/passing/RowUnion.purs +90/−0
- tests/purs/passing/RowsInInstanceContext.purs +28/−0
- tests/purs/passing/RowsInKinds.purs +15/−0
- tests/purs/passing/RowsInKinds2.purs +11/−0
- tests/purs/passing/RunFnInline.purs +11/−0
- tests/purs/passing/RuntimeScopeIssue.purs +22/−0
- tests/purs/passing/ScopedTypeVariables.purs +37/−0
- tests/purs/passing/Sequence.purs +16/−0
- tests/purs/passing/SequenceDesugared.purs +38/−0
- tests/purs/passing/ShadowedModuleName.purs +8/−0
- tests/purs/passing/ShadowedModuleName/Test.purs +6/−0
- tests/purs/passing/ShadowedName.purs +11/−0
- tests/purs/passing/ShadowedRename.purs +14/−0
- tests/purs/passing/ShadowedTCO.purs +21/−0
- tests/purs/passing/ShadowedTCOLet.purs +15/−0
- tests/purs/passing/SignedNumericLiterals.purs +18/−0
- tests/purs/passing/SingleInstanceFundep.purs +21/−0
- tests/purs/passing/SolvingAddInt.purs +26/−0
- tests/purs/passing/SolvingAppendSymbol.purs +34/−0
- tests/purs/passing/SolvingCompareInt.purs +106/−0
- tests/purs/passing/SolvingCompareSymbol.purs +33/−0
- tests/purs/passing/SolvingIsSymbol.purs +13/−0
- tests/purs/passing/SolvingIsSymbol/Lib.purs +11/−0
- tests/purs/passing/SolvingMulInt.purs +14/−0
- tests/purs/passing/SolvingReflectable.purs +50/−0
- tests/purs/passing/StandaloneKindSignatures.purs +27/−0
- tests/purs/passing/Stream.purs +26/−0
- tests/purs/passing/StringEdgeCases.purs +9/−0
- tests/purs/passing/StringEdgeCases/Records.purs +39/−0
- tests/purs/passing/StringEdgeCases/Symbols.purs +33/−0
- tests/purs/passing/StringEscapes.purs +24/−0
- tests/purs/passing/Superclasses1.purs +23/−0
- tests/purs/passing/Superclasses3.purs +41/−0
- tests/purs/passing/TCO.purs +28/−0
- tests/purs/passing/TCOCase.purs +13/−0
- tests/purs/passing/TCOFloated.purs +11/−0
- tests/purs/passing/TCOMutRec.purs +95/−0
- tests/purs/passing/TailCall.purs +20/−0
- tests/purs/passing/Tick.purs +8/−0
- tests/purs/passing/TopLevelCase.purs +19/−0
- tests/purs/passing/TransitiveImport.purs +9/−0
- tests/purs/passing/TransitiveImport/Middle.purs +5/−0
- tests/purs/passing/TransitiveImport/Test.purs +9/−0
- tests/purs/passing/TransitiveImportUnnamedInstance.purs +9/−0
- tests/purs/passing/TransitiveImportUnnamedInstance/Middle.purs +5/−0
- tests/purs/passing/TransitiveImportUnnamedInstance/Test.purs +9/−0
- tests/purs/passing/TypeAnnotationPrecedence.purs +11/−0
- tests/purs/passing/TypeClassMemberOrderChange.purs +16/−0
- tests/purs/passing/TypeClasses.purs +71/−0
- tests/purs/passing/TypeClassesInOrder.purs +12/−0
- tests/purs/passing/TypeClassesWithOverlappingTypeVariables.purs +12/−0
- tests/purs/passing/TypeDecl.purs +13/−0
- tests/purs/passing/TypeOperators.purs +34/−0
- tests/purs/passing/TypeOperators/A.purs +22/−0
- tests/purs/passing/TypeSynonymInData.purs +12/−0
- tests/purs/passing/TypeSynonymInSuperClass.purs +18/−0
- tests/purs/passing/TypeSynonymInstance.purs +16/−0
- tests/purs/passing/TypeSynonymInstance2.purs +14/−0
- tests/purs/passing/TypeSynonymInstance3.purs +23/−0
- tests/purs/passing/TypeSynonymInstance4.purs +13/−0
- tests/purs/passing/TypeSynonymInstance5.purs +13/−0
- tests/purs/passing/TypeSynonyms.purs +30/−0
- tests/purs/passing/TypeSynonymsInKinds.purs +25/−0
- tests/purs/passing/TypeWildcards.purs +16/−0
- tests/purs/passing/TypeWildcardsRecordExtension.purs +9/−0
- tests/purs/passing/TypeWithoutParens.purs +12/−0
- tests/purs/passing/TypeWithoutParens/Lib.purs +4/−0
- tests/purs/passing/TypedBinders.purs +68/−0
- tests/purs/passing/TypedWhere.purs +18/−0
- tests/purs/passing/UTF8Sourcefile.purs +8/−0
- tests/purs/passing/UnderscoreIdent.purs +13/−0
- tests/purs/passing/UnicodeIdentifier.purs +7/−0
- tests/purs/passing/UnicodeOperators.purs +22/−0
- tests/purs/passing/UnicodeType.purs +22/−0
- tests/purs/passing/UnifyInTypeInstanceLookup.purs +25/−0
- tests/purs/passing/Unit.purs +8/−0
- tests/purs/passing/UnknownInTypeClassLookup.purs +15/−0
- tests/purs/passing/UnsafeCoerce.purs +16/−0
- tests/purs/passing/UntupledConstraints.purs +17/−0
- tests/purs/passing/UsableTypeClassMethods.purs +35/−0
- tests/purs/passing/VTAsClassHeads.purs +196/−0
- tests/purs/passing/VisibleTypeApplications.purs +40/−0
- tests/purs/passing/Where.purs +49/−0
- tests/purs/passing/WildcardInInstance.purs +21/−0
- tests/purs/passing/WildcardType.purs +12/−0
- tests/purs/passing/iota.purs +11/−0
- tests/purs/passing/s.purs +8/−0
- tests/purs/psci/BasicEval.purs +19/−0
- tests/purs/psci/Multiline.purs +17/−0
- tests/purs/publish/basic-example/bower.json +13/−0
- tests/purs/publish/basic-example/output/Control.Applicative/docs.json +1/−0
- tests/purs/publish/basic-example/output/Control.Apply/docs.json +1/−0
- tests/purs/publish/basic-example/output/Control.Bind/docs.json +1/−0
- tests/purs/publish/basic-example/output/Control.Category/docs.json +1/−0
- tests/purs/publish/basic-example/output/Control.Monad/docs.json +1/−0
- tests/purs/publish/basic-example/output/Control.Semigroupoid/docs.json +1/−0
- tests/purs/publish/basic-example/output/Data.Boolean/docs.json +1/−0
- tests/purs/publish/basic-example/output/Data.BooleanAlgebra/docs.json +1/−0
- tests/purs/publish/basic-example/output/Data.Bounded.Generic/docs.json +1/−0
- tests/purs/publish/basic-example/output/Data.Bounded/docs.json +1/−0
- tests/purs/publish/basic-example/output/Data.CommutativeRing/docs.json +1/−0
- tests/purs/publish/basic-example/output/Data.DivisionRing/docs.json +1/−0
- tests/purs/publish/basic-example/output/Data.Eq.Generic/docs.json +1/−0
- tests/purs/publish/basic-example/output/Data.Eq/docs.json +1/−0
- tests/purs/publish/basic-example/output/Data.EuclideanRing/docs.json +1/−0
- tests/purs/publish/basic-example/output/Data.Field/docs.json +1/−0
- tests/purs/publish/basic-example/output/Data.Function/docs.json +1/−0
- tests/purs/publish/basic-example/output/Data.Functor/docs.json +1/−0
- tests/purs/publish/basic-example/output/Data.Generic.Rep/docs.json +1/−0
- tests/purs/publish/basic-example/output/Data.HeytingAlgebra.Generic/docs.json +1/−0
- tests/purs/publish/basic-example/output/Data.HeytingAlgebra/docs.json +1/−0
- tests/purs/publish/basic-example/output/Data.Monoid.Additive/docs.json +1/−0
- tests/purs/publish/basic-example/output/Data.Monoid.Conj/docs.json +1/−0
- tests/purs/publish/basic-example/output/Data.Monoid.Disj/docs.json +1/−0
- tests/purs/publish/basic-example/output/Data.Monoid.Dual/docs.json +1/−0
- tests/purs/publish/basic-example/output/Data.Monoid.Endo/docs.json +1/−0
- tests/purs/publish/basic-example/output/Data.Monoid.Generic/docs.json +1/−0
- tests/purs/publish/basic-example/output/Data.Monoid.Multiplicative/docs.json +1/−0
- tests/purs/publish/basic-example/output/Data.Monoid/docs.json +1/−0
- tests/purs/publish/basic-example/output/Data.NaturalTransformation/docs.json +1/−0
- tests/purs/publish/basic-example/output/Data.Newtype/docs.json +1/−0
- tests/purs/publish/basic-example/output/Data.Ord.Generic/docs.json +1/−0
- tests/purs/publish/basic-example/output/Data.Ord/docs.json +1/−0
- tests/purs/publish/basic-example/output/Data.Ordering/docs.json +1/−0
- tests/purs/publish/basic-example/output/Data.Reflectable/docs.json +1/−0
- tests/purs/publish/basic-example/output/Data.Ring.Generic/docs.json +1/−0
- tests/purs/publish/basic-example/output/Data.Ring/docs.json +1/−0
- tests/purs/publish/basic-example/output/Data.Semigroup.First/docs.json +1/−0
- tests/purs/publish/basic-example/output/Data.Semigroup.Generic/docs.json +1/−0
- tests/purs/publish/basic-example/output/Data.Semigroup.Last/docs.json +1/−0
- tests/purs/publish/basic-example/output/Data.Semigroup/docs.json +1/−0
- tests/purs/publish/basic-example/output/Data.Semiring.Generic/docs.json +1/−0
- tests/purs/publish/basic-example/output/Data.Semiring/docs.json +1/−0
- tests/purs/publish/basic-example/output/Data.Show.Generic/docs.json +1/−0
- tests/purs/publish/basic-example/output/Data.Show/docs.json +1/−0
- tests/purs/publish/basic-example/output/Data.Symbol/docs.json +1/−0
- tests/purs/publish/basic-example/output/Data.Unit/docs.json +1/−0
- tests/purs/publish/basic-example/output/Data.Void/docs.json +1/−0
- tests/purs/publish/basic-example/output/Effect.Class.Console/docs.json +1/−0
- tests/purs/publish/basic-example/output/Effect.Class/docs.json +1/−0
- tests/purs/publish/basic-example/output/Effect.Console/docs.json +1/−0
- tests/purs/publish/basic-example/output/Effect.Uncurried/docs.json +1/−0
- tests/purs/publish/basic-example/output/Effect.Unsafe/docs.json +1/−0
- tests/purs/publish/basic-example/output/Effect/docs.json +1/−0
- tests/purs/publish/basic-example/output/Main/docs.json +1/−0
- tests/purs/publish/basic-example/output/Prelude/docs.json +1/−0
- tests/purs/publish/basic-example/output/Prim.Boolean/docs.json +1/−0
- tests/purs/publish/basic-example/output/Prim.Coerce/docs.json +1/−0
- tests/purs/publish/basic-example/output/Prim.Int/docs.json +1/−0
- tests/purs/publish/basic-example/output/Prim.Ordering/docs.json +1/−0
- tests/purs/publish/basic-example/output/Prim.Row/docs.json +1/−0
- tests/purs/publish/basic-example/output/Prim.RowList/docs.json +1/−0
- tests/purs/publish/basic-example/output/Prim.Symbol/docs.json +1/−0
- tests/purs/publish/basic-example/output/Prim.TypeError/docs.json +1/−0
- tests/purs/publish/basic-example/output/Prim/docs.json +1/−0
- tests/purs/publish/basic-example/output/Record.Unsafe/docs.json +1/−0
- tests/purs/publish/basic-example/output/Safe.Coerce/docs.json +1/−0
- tests/purs/publish/basic-example/output/Type.Proxy/docs.json +1/−0
- tests/purs/publish/basic-example/output/Unsafe.Coerce/docs.json +1/−0
- tests/purs/publish/basic-example/output/cache-db.json +1/−0
- tests/purs/publish/basic-example/output/package.json +1/−0
- tests/purs/publish/basic-example/purs.json +14/−0
- tests/purs/publish/basic-example/resolutions.json +23/−0
- tests/purs/publish/basic-example/src/Main.purs +16/−0
- tests/purs/sourcemaps/Bug4034.js +51/−0
- tests/purs/sourcemaps/Bug4034.out.js.map +1/−0
- tests/purs/sourcemaps/Bug4034.purs +71/−0
- tests/purs/sourcemaps/Recipe.out.js.map +1/−0
- tests/purs/sourcemaps/Recipe.purs +3/−0
- tests/purs/warning/2140.out +11/−0
- tests/purs/warning/2140.purs +5/−0
- tests/purs/warning/2383.out +0/−0
- tests/purs/warning/2383.purs +13/−0
- tests/purs/warning/2411.out +11/−0
- tests/purs/warning/2411.purs +16/−0
- tests/purs/warning/2542.out +16/−0
- tests/purs/warning/2542.purs +16/−0
- tests/purs/warning/4183.out +15/−0
- tests/purs/warning/4183.purs +4/−0
- tests/purs/warning/4256.out +34/−0
- tests/purs/warning/4256.purs +16/−0
- tests/purs/warning/4268.out +0/−0
- tests/purs/warning/4268.purs +4/−0
- tests/purs/warning/4308.out +49/−0
- tests/purs/warning/4308.purs +14/−0
- tests/purs/warning/4376.out +16/−0
- tests/purs/warning/4376.purs +6/−0
- tests/purs/warning/4414.out +0/−0
- tests/purs/warning/4414.purs +21/−0
- tests/purs/warning/CoercibleUnusedImport.out +0/−0
- tests/purs/warning/CoercibleUnusedImport.purs +8/−0
- tests/purs/warning/CoercibleUnusedImport/N1.purs +3/−0
- tests/purs/warning/CoercibleUnusedImport/N2.purs +5/−0
- tests/purs/warning/CoercibleUnusedNewtypeCtorExplicitImport.out +0/−0
- tests/purs/warning/CoercibleUnusedNewtypeCtorExplicitImport.purs +7/−0
- tests/purs/warning/CoercibleUnusedNewtypeCtorExplicitImport/N.purs +3/−0
- tests/purs/warning/CoercibleUnusedNewtypeCtorImplicitImport.out +0/−0
- tests/purs/warning/CoercibleUnusedNewtypeCtorImplicitImport.purs +7/−0
- tests/purs/warning/CoercibleUnusedNewtypeCtorImplicitImport/N.purs +3/−0
- tests/purs/warning/CustomWarning.out +14/−0
- tests/purs/warning/CustomWarning.purs +11/−0
- tests/purs/warning/CustomWarning2.out +14/−0
- tests/purs/warning/CustomWarning2.purs +13/−0
- tests/purs/warning/CustomWarning3.out +30/−0
- tests/purs/warning/CustomWarning3.purs +15/−0
- tests/purs/warning/CustomWarning4.out +60/−0
- tests/purs/warning/CustomWarning4.purs +31/−0
- tests/purs/warning/DeprecatedCaseOfOffsideSyntax1.out +9/−0
- tests/purs/warning/DeprecatedCaseOfOffsideSyntax1.purs +9/−0
- tests/purs/warning/DeprecatedCaseOfOffsideSyntax2.out +9/−0
- tests/purs/warning/DeprecatedCaseOfOffsideSyntax2.purs +8/−0
- tests/purs/warning/DuplicateExportRef.out +77/−0
- tests/purs/warning/DuplicateExportRef.purs +30/−0
- tests/purs/warning/DuplicateImport.out +10/−0
- tests/purs/warning/DuplicateImport.purs +10/−0
- tests/purs/warning/DuplicateImportRef.out +44/−0
- tests/purs/warning/DuplicateImportRef.purs +18/−0
- tests/purs/warning/DuplicateSelectiveImport.out +10/−0
- tests/purs/warning/DuplicateSelectiveImport.purs +10/−0
- tests/purs/warning/HiddenConstructorsGeneric.out +11/−0
- tests/purs/warning/HiddenConstructorsGeneric.purs +8/−0
- tests/purs/warning/HiddenConstructorsNewtype.out +11/−0
- tests/purs/warning/HiddenConstructorsNewtype.purs +8/−0
- tests/purs/warning/HidingImport.out +28/−0
- tests/purs/warning/HidingImport.purs +9/−0
- tests/purs/warning/ImplicitImport.out +28/−0
- tests/purs/warning/ImplicitImport.purs +9/−0
- tests/purs/warning/ImplicitQualifiedImport.out +30/−0
- tests/purs/warning/ImplicitQualifiedImport.purs +11/−0
- tests/purs/warning/ImplicitQualifiedImportReExport.out +30/−0
- tests/purs/warning/ImplicitQualifiedImportReExport.purs +13/−0
- tests/purs/warning/Kind-UnusedExplicitImport-1.out +17/−0
- tests/purs/warning/Kind-UnusedExplicitImport-1.purs +11/−0
- tests/purs/warning/Kind-UnusedExplicitImport-2.out +17/−0
- tests/purs/warning/Kind-UnusedExplicitImport-2.purs +13/−0
- tests/purs/warning/Kind-UnusedImport.out +10/−0
- tests/purs/warning/Kind-UnusedImport.purs +9/−0
- tests/purs/warning/KindReExport.out +0/−0
- tests/purs/warning/KindReExport.purs +11/−0
- tests/purs/warning/MissingKindDeclaration.out +64/−0
- tests/purs/warning/MissingKindDeclaration.purs +13/−0
- tests/purs/warning/MissingTypeDeclaration.out +16/−0
- tests/purs/warning/MissingTypeDeclaration.purs +4/−0
- tests/purs/warning/NewtypeInstance.out +15/−0
- tests/purs/warning/NewtypeInstance.purs +8/−0
- tests/purs/warning/NewtypeInstance2.out +19/−0
- tests/purs/warning/NewtypeInstance2.purs +15/−0
- tests/purs/warning/NewtypeInstance3.out +19/−0
- tests/purs/warning/NewtypeInstance3.purs +21/−0
- tests/purs/warning/NewtypeInstance4.out +19/−0
- tests/purs/warning/NewtypeInstance4.purs +23/−0
- tests/purs/warning/OverlappingPattern.out +28/−0
- tests/purs/warning/OverlappingPattern.purs +15/−0
- tests/purs/warning/ScopeShadowing.out +14/−0
- tests/purs/warning/ScopeShadowing.purs +13/−0
- tests/purs/warning/ScopeShadowing2.out +14/−0
- tests/purs/warning/ScopeShadowing2.purs +10/−0
- tests/purs/warning/ShadowedBinderPatternGuard.out +11/−0
- tests/purs/warning/ShadowedBinderPatternGuard.purs +7/−0
- tests/purs/warning/ShadowedNameParens.out +11/−0
- tests/purs/warning/ShadowedNameParens.purs +7/−0
- tests/purs/warning/ShadowedTypeVar.out +11/−0
- tests/purs/warning/ShadowedTypeVar.purs +5/−0
- tests/purs/warning/TypeClassMethodSynonym.out +11/−0
- tests/purs/warning/TypeClassMethodSynonym.purs +8/−0
- tests/purs/warning/UnambiguousQuantifiedKind.out +16/−0
- tests/purs/warning/UnambiguousQuantifiedKind.purs +12/−0
- tests/purs/warning/UnnecessaryFFIModule.js +1/−0
- tests/purs/warning/UnnecessaryFFIModule.out +13/−0
- tests/purs/warning/UnnecessaryFFIModule.purs +5/−0
- tests/purs/warning/UnusedDctorExplicitImport.out +17/−0
- tests/purs/warning/UnusedDctorExplicitImport.purs +8/−0
- tests/purs/warning/UnusedDctorImportAll.out +14/−0
- tests/purs/warning/UnusedDctorImportAll.purs +7/−0
- tests/purs/warning/UnusedDctorImportExplicit.out +14/−0
- tests/purs/warning/UnusedDctorImportExplicit.purs +7/−0
- tests/purs/warning/UnusedExplicitImport.out +17/−0
- tests/purs/warning/UnusedExplicitImport.purs +8/−0
- tests/purs/warning/UnusedExplicitImportTypeOp.out +17/−0
- tests/purs/warning/UnusedExplicitImportTypeOp.purs +9/−0
- tests/purs/warning/UnusedExplicitImportTypeOp/Lib.purs +9/−0
- tests/purs/warning/UnusedExplicitImportValOp.out +17/−0
- tests/purs/warning/UnusedExplicitImportValOp.purs +8/−0
- tests/purs/warning/UnusedFFIImplementations.js +2/−0
- tests/purs/warning/UnusedFFIImplementations.out +12/−0
- tests/purs/warning/UnusedFFIImplementations.purs +4/−0
- tests/purs/warning/UnusedImport.out +22/−0
- tests/purs/warning/UnusedImport.purs +12/−0
- tests/purs/warning/UnusedTypeVar.out +11/−0
- tests/purs/warning/UnusedTypeVar.purs +5/−0
- tests/purs/warning/UnusedVar.out +108/−0
- tests/purs/warning/UnusedVar.purs +104/−0
- tests/purs/warning/UnusedVarDecls.out +23/−0
- tests/purs/warning/UnusedVarDecls.purs +17/−0
- tests/purs/warning/UnusedVarDo.out +48/−0
- tests/purs/warning/UnusedVarDo.purs +48/−0
- tests/purs/warning/VTAsWildcardInferred.out +0/−0
- tests/purs/warning/VTAsWildcardInferred.purs +28/−0
- tests/purs/warning/WildcardInferredType.out +30/−0
- tests/purs/warning/WildcardInferredType.purs +14/−0
- tests/purs/warning/WildcardInferredType2.out +83/−0
- tests/purs/warning/WildcardInferredType2.purs +60/−0
- tests/support/bower.json +39/−0
- tests/support/checkSourceMapValidity.js +33/−0
- tests/support/package-lock.json +260/−0
- tests/support/package.json +9/−0
- tests/support/prelude-resolutions.json +1/−0
- tests/support/psci/InteractivePrint.purs +11/−0
- tests/support/psci/Reload.edit +4/−0
- tests/support/psci/Reload.purs +4/−0
- tests/support/pscide/src/CompletionSpec.purs +18/−0
- tests/support/pscide/src/CompletionSpecDocs.purs +19/−0
- tests/support/pscide/src/FindUsage.purs +12/−0
- tests/support/pscide/src/FindUsage/Definition.purs +13/−0
- tests/support/pscide/src/FindUsage/Recursive.purs +8/−0
- tests/support/pscide/src/FindUsage/RecursiveShadowed.purs +10/−0
- tests/support/pscide/src/FindUsage/Reexport.purs +3/−0
- tests/support/pscide/src/ImportsSpec.purs +3/−0
- tests/support/pscide/src/ImportsSpec1.purs +32/−0
- tests/support/pscide/src/MatcherSpec.purs +7/−0
- tests/support/pscide/src/RebuildSpecDep.purs +3/−0
- tests/support/pscide/src/RebuildSpecSingleModule.fail +3/−0
- tests/support/pscide/src/RebuildSpecSingleModule.purs +4/−0
- tests/support/pscide/src/RebuildSpecWithDeps.purs +5/−0
- tests/support/pscide/src/RebuildSpecWithForeign.js +1/−0
- tests/support/pscide/src/RebuildSpecWithForeign.purs +3/−0
- tests/support/pscide/src/RebuildSpecWithHiddenIdent.purs +6/−0
- tests/support/pscide/src/RebuildSpecWithMissingForeign.fail +3/−0
+ .hspec view
@@ -0,0 +1,1 @@+--times
+ CONTRIBUTING.md view
@@ -0,0 +1,177 @@+# Contributing to the PureScript Compiler++## Reporting Issues++When reporting issues, please be aware of the following:++* Please use the appropriate issue template if there is one: filling out all of the sections in the template makes it much easier for us to understand what the problem is and how we might want to address it.+* We prefer to reserve the issue tracker in this repository for tasks which involve work on the compiler. If your report or proposal doesn't involve work on the compiler, please open it on the repository where the work would be done. If you're unsure, you can always ask on [Discord](https://purescript.org/chat) or [Discourse](https://discourse.purescript.org).+* If you have a question or need help, please ask on [Discord](https://purescript.org/chat) or [Discourse](https://discourse.purescript.org) instead.+* When submitting feature proposals, please be aware that we prefer to be conservative about adding things to the language/compiler. A feature proposal is much more likely to be accepted if it includes a clear description of the problem it intends to solve, as well as not only a strong justification for why adding the feature will solve that problem, but also for why any existing features or techniques that could be used to solve that problem are insufficient.++We have defined some [Project Values](https://github.com/purescript/governance#project-values) in our organization's governance document; referring to these may help you get a better idea of what is likely to be accepted and what isn't.++## Sending Pull Requests++Pull requests are encouraged, but please open issues before starting to work on something that you intend to make into a PR, so that we can decide if it is a good fit or not.++### Finding Issues to Work On++If you would like to contribute, please consider the issues in the current milestone first. If you are a new contributor, you may want to have a go at the ["new contributor" issues](https://github.com/purescript/purescript/labels/new%20contributor) to get started.++### Submitting Your Code++When submitting a pull request, please follow the following guidelines:++- Add tests according to the next section+- Build the binaries and libraries with `stack build --fast`. The `--fast` flag is recommended but not required; it disables optimizations, which can speed things up quite a bit.+- Make sure that all test suites are passing. Run the test suites with `stack test --fast`.+- Please try to keep changes small and isolated: smaller pull requests which only address one issue are much easier to review.+- For any code change, please append a copyright and licensing notice to the [CONTRIBUTORS.md](CONTRIBUTORS.md) file if your name is not in there already.++### Writing Tests++When writing tests, try to have at least one passing test and one failing test, if applicable.++- Passing tests go in `tests/purs/passing/`+- Failing tests go in `tests/purs/failing/`+- Tests that check warnings go in `tests/purs/warning/`++Passing tests may produce warnings. Tests in `tests/purs/warning/` can ensure no warning is emitted by having no annotations and an empty `.out` file. ++### Running Tests++Run all test suites with `stack test`. You will need `npm`, `bower` and `node` on your PATH to run the tests.++You can run individual test suites using `stack test --test-arguments="--match PATTERN"` where `PATTERN` is one of `compiler`, `repl`, `ide`, `docs`, `corefn`, or `hierarchy`. You can also build and run a specific test in `tests/purs/passing/` or `tests/purs/failing/` by using the test's filename as the pattern, e.g.:++```+stack test --fast --test-arguments="--match 1110.purs"+```++This will run whatever test uses the example file `1110.purs`.++The golden files (e.g. `*.out` files) are generated automatically when missing, and can be updated by setting the "HSPEC_ACCEPT" environment variable, e.g. by running `HSPEC_ACCEPT=true stack test`.++The source map tests' output can be visualized using the [Source Map Visualization](https://sokra.github.io/source-map-visualization/) website. The site requires uploading three files in the following order: the `.js` file, the `.js.map` file, and the `.purs` file.++To produce these files, run `stack test --fast --ta "--match sourcemaps" && ./get-source-maps.sh`. Each test's 3 files will be stored in `.source-maps/<test file name>/` folder. The `get-source-maps.sh` script only works if the test files abide by the requirements described in [TestSourceMaps.hs](.tests/TestSourceMaps.hs).++### Adding Dependencies++Because the PureScript compiler is distributed in binary form, we include the licenses of all dependencies, including transitive ones, in the LICENSE file. Therefore, whenever the dependencies change, the LICENSE file should be updated.++This process can be performed automatically by running `make license-generator`.++### Getting Pull Requests Merged++Sometimes pull requests take a little while to be merged. This is partially because they often have knock-on effects for the rest of the ecosystem, and partially because we want to give core team members time to review and consider changes thoroughly. Please see the organization's [governance document](https://github.com/purescript/governance) for information about when a pull request may be merged.++## Developer Guide++The following instructions are intended to help PureScript users more easily contribute to the compiler, even if this is your first Haskell project.++### Prerequisites++Install `stack`. [Instructions](https://docs.haskellstack.org/en/stable/README/).++Update stack's package index before proceeding:+```+stack update+```++### Clone++```+git clone https://github.com/purescript/purescript.git purescript_compiler+cd purescript_compiler+```++### Build++```+stack build+```++This will take a while the first time it is run.++### Running a locally-compiled version of PureScript++Run `stack exec bash` to launch a subshell (substitute `bash` with your preferred shell) where your locally-compiled version of `purs` is available at the front of your `PATH`. Other tools (such as `spago`) will also grab this latest `purs` version if executed in this shell. You can use `purs --version` and `which purs` to confirm you're executing your locally-compiled version.++```+> purs --version+0.14.2+> which purs+~/.nvm/versions/node/v14.9.0/bin/purs++> stack exec bash++> purs --version+0.14.2 [development build; commit: f1953214775945b65ba53ae903b4238c352dcd29 DIRTY]+> which purs+~/projects/purescript/complier/.stack-work/install/x86_64-linux-tinfo6/1a835accec0abb5a1f7364196133985d18f8c46ee8c7424ce43cf68bab56e5b1/8.10.4/bin/purs+```++If you plan on using your patched version of `purs` for a while (for example, while waiting on your changes to be incorporated into the next official release), it may be more convenient to install it globally with:++```+stack install+```++Note that other installed version (e.g. what npm installs) may still have priority depending on how your `PATH` is configured. `stack install` should warn about other higher-priority versions, and you can always use `which purs` as a sanity check. Uninstall by simply deleting the `purs` binary (location can be found with `which purs`).++### Profiling++A profiling build is used to help diagnose performance issues with the compiler.++Create a profiling build with:+```+stack build --profile+```+This will also take a while the first time it is run.++Setting-up a local shell for your profiling build is similar to the steps for the standard build, just add the `--profile` flag:+```+stack exec --profile bash+```+Note that the bin directory prepended to `$PATH` is different than the standard build, so you can let this be a third "profiling" shell that you leave open between rebuilds.++The `purs` compiler is often wrapped by `spago`. Here's how to pass the "time profiling" flag `-p` via spago:+```+spago build --purs-args "+RTS -p -RTS"+```++Note: There are other profiling flags (such as `-hc` for heap size). You can read more about these flags [here](http://book.realworldhaskell.org/read/profiling-and-optimization.html).++This creates a `purs.prof` file. You can view the contents of this file directly, but it is often more convenient to use a visualizer.++### Profile Visualizers++Each of these produces a clickable visual display of profiling info. Feel free to open the output files in the web browser of your choice. These examples use `firefox`.++#### [ghc-prof-flamegraph](https://github.com/fpco/ghc-prof-flamegraph)+```+stack build --copy-compiler-tool ghc-prof-flamegraph+stack exec -- ghc-prof-flamegraph purs.prof+firefox purs.svg+```++For more flamegraph customizations, you can also try [`stackcollapse-ghc`](https://github.com/marcin-rzeznicki/stackcollapse-ghc)++#### [profiteur](https://github.com/jaspervdj/profiteur)+```+stack build --copy-compiler-tool profiteur+stack exec -- profiteur purs.prof+firefox purs.prof.html+```++### Additional Resources++* [Haskell Language Server](https://github.com/haskell/haskell-language-server#installation) installation guide.++* PureScript-compiler-focused [guide](https://discourse.purescript.org/t/haskell-tooling-guide-vscode-hie/1505) covering VSCode + HIE setup.++* Beginner-friendly [guide](https://www.vacationlabs.com/haskell/environment-setup.html) covering VSCode + HIE setup, although the steps needed some tweaking for compatibility with the PureScript compiler project.++* An [outdated table](https://github.com/rainbyte/haskell-ide-chart#the-chart-with-a-link-to-each-plug-in) of IDE recommendations. Note that the [`intero`](https://github.com/chrisdone/intero/blob/master/README.md) backend (listed for four entries) is no longer supported.
+ CONTRIBUTORS.md view
@@ -0,0 +1,197 @@+## Contributors++This file lists the contributors to the PureScript compiler project, and the terms under which their code is licensed.++### Contributors using Standard Terms++Contributors listed here agree to license their contributions under the following terms:++> My existing contributions and all future contributions until further notice are Copyright {Name}, and are licensed to the owners and users of the PureScript compiler project under the terms of the {License}.++By adding your name to the list below, you agree to license your contributions under these following terms.++If you would prefer to use different terms, please use the section below instead.++| Username | Name | License |+| :------- | :--- | :------ |+| [@5outh](https://github.com/5outh) | Benjamin Kovach | [MIT license] |+| [@actionshrimp](https://github.com/actionshrimp) | David Aitken | [MIT license] |+| [@adnelson](https://github.com/adnelson) | Allen Nelson | [MIT license] |+| [@alexbiehl](https://github.com/alexbiehl) | Alexander Biehl | [MIT license] |+| [@andreypopp](https://github.com/andreypopp) | Andrey Popp | [MIT license] |+| [@andyarvanitis](https://github.com/andyarvanitis) | Andy Arvanitis | [MIT license] |+| [@andys8](https://github.com/andys8) | andys8 | [MIT license] |+| [@anthok88](https://github.com/anthok88) | anthoq88 | [MIT license] |+| [@ardumont](https://github.com/ardumont) | Antoine R. Dumont | [MIT license] |+| [@arrowd](https://github.com/arrowd) | Gleb Popov | [MIT license] |+| [@aspidites](https://github.com/aspidites) | Edwin Marshall | [MIT license] |+| [@b123400](https://github.com/b123400) | b123400 | [MIT license] |+| [@bagl](https://github.com/bagl) | Petr Vapenka | [MIT license] |+| [@balajirrao](https://github.com/balajirrao) | Balaji Rao | [MIT license] |+| [@bbqbaron](https://github.com/bbqbaron) | Eric Loren | [MIT license] |+| [@bergmark](https://github.com/bergmark) | Adam Bergmark | [MIT license] |+| [@bitemyapp](https://github.com/bitemyapp) | Chris Allen | [MIT license] |+| [@bjornmelgaaard](https://github.com/BjornMelgaard) | Sergey Homa | [MIT license] |+| [@bmjames](https://github.com/bmjames) | Ben James | [MIT license] |+| [@Bogdanp](https://github.com/Bogdanp) | Bogdan Paul Popa | [MIT license] |+| [@brandonhamilton](https://github.com/brandonhamilton) | Brandon Hamilton | [MIT license] |+| [@bsermons](https://github.com/bsermons) | Brian Sermons | [MIT license] |+| [@cdepillabout](https://github.com/cdepillabout) | Dennis Gosnell | [MIT license] |+| [@chexxor](https://github.com/chexxor) | Alex Berg | [MIT license] |+| [@chrisdone](https://github.com/chrisdone) | Chris Done | [MIT license] |+| [@cmdv](https://github.com/cmdv) | Vincent Orr | [MIT license] |+| [@codedmart](https://github.com/codedmart) | Brandon Martin | [MIT license] |+| [@coot](https://github.com/coot) | Marcin Szamotulski | [MIT license] |+| [@dariooddenino](https://github.com/dariooddenino) | Dario Oddenino | [MIT license] |+| [@davidchambers](https://github.com/davidchambers) | David Chambers | [MIT license] |+| [@DavidLindbom](https://github.com/DavidLindbom) | David Lindbom | [MIT license] |+| [@dckc](https://github.com/dckc) | Dan Connolly | [MIT license] |+| [@Deltaspace0](https://github.com/Deltaspace0) | Ruslan Gadeev | [MIT license] |+| [@drets](https://github.com/drets) | Dmytro Rets | [MIT license] |+| [@dyerw](https://github.com/dyerw) | Liam Dyer | [MIT license] |+| [@ealmansi](https://github.com/ealmansi) | Emilio Almansi | [MIT license] |+| [@eamelink](https://github.com/eamelink) | Erik Bakker | [MIT license] |+| [@EMattfolk](https://github.com/EMattfolk) | Erik Mattfolk | [MIT license] |+| [@epost](https://github.com/epost) | Erik Post | [MIT license] |+| [@erdeszt](https://github.com/erdeszt) | Tibor Erdesz | [MIT license] |+| [@etrepum](https://github.com/etrepum) | Bob Ippolito | [MIT license] |+| [@f-f](https://github.com/f-f) | Fabrizio Ferrai | [MIT license] |+| [@faineance](https://github.com/faineance) | faineance | [MIT license] |+| [@fehrenbach](https://github.com/fehrenbach) | Stefan Fehrenbach | [MIT license] |+| [@felixSchl](https://github.com/felixSchl) | Felix Schlitter | [MIT license] |+| [@FredTheDino](https://github.com/FredTheDino) | Edvard Thörnros | [MIT license] |+| [@FrigoEU](https://github.com/FrigoEU) | Simon Van Casteren | [MIT license] |+| [@fsoikin](https://github.com/fsoikin) | Fyodor Soikin | [MIT license] |+| [@gabejohnson](https://github.com/gabejohnson) | Gabe Johnson | [MIT license] |+| [@garyb](https://github.com/garyb) | Gary Burgess | [MIT license] |+| [@hdgarrood](https://github.com/hdgarrood) | Harry Garrood | [MIT license] |+| [@houli](https://github.com/houli) | Eoin Houlihan | [MIT license] |+| [@i-am-the-slime](https://github.com/i-am-the-slime) | Mark Eibes | [MIT license] |+| [@i-am-tom](https://github.com/i-am-tom) | i-am-tom | [MIT license] |+| [@ianbollinger](https://github.com/ianbollinger) | Ian D. Bollinger | [MIT license] |+| [@ilovezfs](https://github.com/ilovezfs) | ilovezfs | [MIT license] |+| [@imcotton](https://github.com/imcotton) | Cotton Hou | [MIT license] |+| [@izgzhen](https://github.com/izgzhen) | Zhen Zhang | [MIT license] |+| [@j-nava](https://github.com/j-nava) | Jesse Nava | [MIT license] |+| [@jacereda](https://github.com/jacereda) | Jorge Acereda | [MIT license] |+| [@japesinator](https://github.com/japesinator) | JP Smith | [MIT license] |+| [@jkachmar](https://github.com/jkachmar) | Joe Kachmar | [MIT license] |+| [@joneshf](https://github.com/joneshf) | Hardy Jones | [MIT license] |+| [@jordanmartinez](https://github.com/jordanmartinez) | Jordan Martinez | [MIT license] |+| [@jy14898](https://github.com/jy14898) | Joseph Young | [MIT license] |+| [@kcsongor](https://github.com/kcsongor) | Csongor Kiss | [MIT license] |+| [@kika](https://github.com/kika) | Kirill Pertsev | [MIT license] |+| [@kl0tl](https://github.com/kl0tl) | Cyril Sobierajewicz | [MIT license] |+| [@kleeneplus](https://github.com/dgendill) | Dominick Gendill | [MIT license] |+| [@kRITZCREEK](https://github.com/kRITZCREEK) | Christoph Hegemann | [MIT license] |+| [@L8D](https://github.com/L8D) | Tenor Biel | [MIT license] |+| [@legrostdg](https://github.com/legrostdg) | Félix Sipma | [MIT license] |+| [@LiamGoodacre](https://github.com/LiamGoodacre) | Liam Goodacre | [MIT license] |+| [@lukerandall](https://github.com/lukerandall) | Luke Randall | [MIT license] |+| [@lunaris](https://github.com/lunaris) | Will Jones | [MIT license] |+| [@marcosh](https://github.com/marcosh) | Marco Perone | [MIT license] |+| [@matthew-hilty](https://github.com/matthew-hilty) | Matthew Hilty | [MIT license] |+| [@matthewleon](https://github.com/matthewleon) | Matthew Leon | [MIT license] |+| [@mcoffin](https://github.com/mcoffin) | Matt Coffin | [MIT license] |+| [@mgmeier](https://github.com/mgmeier) | Michael Gilliland | [MIT license] |+| [@mhcurylo](https://github.com/mhcurylo) | Mateusz Curylo | [MIT license] |+| [@mhmdanas](https://github.com/mhmdanas) | Mohammed Anas | [MIT license] |+| [@michaelficarra](https://github.com/michaelficarra) | Michael Ficarra | [MIT license] |+| [@MichaelXavier](https://github.com/MichaelXavier) | Michael Xavier | [MIT license] |+| [@mikesol](https://github.com/mikesol) | Mike Solomon | [MIT license] |+| [@milesfrain](https://github.com/milesfrain) | Miles Frain | [MIT license] |+| [@MiracleBlue](https://github.com/MiracleBlue) | Nicholas Kircher | [MIT license] |+| [@mjgpy3](https://github.com/mjgpy3) | Michael Gilliland | [MIT license] |+| [@mjrussell](https://github.com/mjrussell) | Matthew Russell | [MIT license] |+| [@MonoidMusician](https://github.com/MonoidMusician) | Verity Scheel | [MIT license] |+| [@mpietrzak](https://github.com/mpietrzak) | Maciej Pietrzak | [MIT license] |+| [@mrhania](https://github.com/mrhania) | Łukasz Hanuszczak | [MIT license] |+| [@mrkgnao](https://github.com/mrkgnao) | Soham Chowdhury | [MIT license] |+| [@natefaubion](https://github.com/natefaubion) | Nathan Faubion | [MIT license] |+| [@ncaq](https://github.com/ncaq) | ncaq | [MIT license] |+| [@NickMolloy](https://github.com/NickMolloy) | Nick Molloy | [MIT license] |+| [@nicodelpiano](https://github.com/nicodelpiano) | Nicolas Del Piano | [MIT license] |+| [@noraesae](https://github.com/noraesae) | Hyunje Jun | [MIT license] |+| [@nullobject](https://github.com/nullobject) | Josh Bassett | [MIT license] |+| [@osa1](https://github.com/osa1) | Ömer Sinan Ağacan | [MIT license] |+| [@ozkutuk](https://github.com/ozkutuk) | Berk Özkütük | [MIT license] |+| [@paf31](https://github.com/paf31) | Phil Freeman | [MIT license] |+| [@parsonsmatt](https://github.com/parsonsmatt) | Matt Parsons | [MIT license] |+| [@passy](https://github.com/passy) | Pascal Hartig | [MIT license] |+| [@paulyoung](https://github.com/paulyoung) | Paul Young | [MIT license] |+| [@pelotom](https://github.com/pelotom) | Thomas Crockett | [MIT license] |+| [@peterbecich](https://github.com/peterbecich) | Peter Becich | [MIT license] |+| [@phadej](https://github.com/phadej) | Oleg Grenrus | [MIT license] |+| [@phiggins](https://github.com/phiggins) | Pete Higgins | [MIT license] |+| [@philopon](https://github.com/philopon) | Hirotomo Moriwaki | [MIT license] |+| [@pseudonom](https://github.com/pseudonom) | Eric Easley | [MIT license] |+| [@ptrfrncsmrph](https://github.com/ptrfrncsmrph) | Peter Murphy | [MIT license] |+| [@PureFunctor](https://github.com/PureFunctor), [@sjpgarcia](https://github.com/sjpgarcia) | Justin Garcia | [MIT license] |+| [@quesebifurcan](https://github.com/quesebifurcan) | Fredrik Wallberg | [MIT license] |+| [@radrow](https://github.com/radrow) | Radosław Rowicki | [MIT license] |+| [@rgrinberg](https://github.com/rgrinberg) | Rudi Grinberg | [MIT license] |+| [@rhendric](https://github.com/rhendric) | Ryan Hendrickson | [MIT license] |+| [@rightfold](https://github.com/rightfold) | rightfold | [MIT license] |+| [@rndnoise](https://www.github.com/rndnoise) | rndnoise | [MIT license] |+| [@robdaemon](https://github.com/robdaemon) | Robert Roland | [MIT license] |+| [@RossMeikleham](https://github.com/RossMeikleham) | Ross Meikleham | [MIT license] |+| [@Rufflewind](https://github.com/Rufflewind) | Phil Ruffwind | [MIT license] |+| [@rvion](https://github.com/rvion) | Rémi Vion | [MIT license] |+| [@RyanGlScott](https://github.com/RyanGlScott) | Ryan Scott | [MIT license] |+| [@Saulukass](https://github.com/Saulukass) | Saulius Skliutas | [MIT license] |+| [@sd-yip](https://github.com/sd-yip) | Nicholas Yip | [MIT license] |+| [@sebastiaanvisser](https://github.com/sebastiaanvisser) | Sebastiaan Visser | [MIT license] |+| [@sectore](https://github.com/sectore) | Jens Krause | [MIT license] |+| [@senju](https://github.com/senju) | senju | [MIT license] |+| [@seungha-kim](https://github.com/seungha-kim) | Seungha Kim | [MIT license] |+| [@sharkdp](https://github.com/sharkdp) | David Peter | [MIT license] |+| [@sigma-andex](https://github.com/sigma-andex) | Jan Schulte | [MIT license] |+| [@simonyangme](https://github.com/simonyangme) | Simon Yang | [MIT license] |+| [@sloosch](https://github.com/sloosch) | Simon Looschen | [MIT license] |+| [@sometimes-i-send-pull-requests](https://github.com/sometimes-i-send-pull-requests) | Alexander Kirchhoff | [MIT license] |+| [@soupi](https://github.com/soupi) | Gil Mizrahi | [MIT license] |+| [@stefanholzmueller](https://github.com/stefanholzmueller) | Stefan Holzmüller | [MIT license] |+| [@sztupi](https://github.com/sztupi) | Attila Sztupak | [MIT license] |+| [@taktoa](https://github.com/taktoa) | Remy Goldschmidt | [MIT license] |+| [@taku0](https://github.com/taku0) | taku0 | [MIT license] |+| [@tfausak](https://github.com/tfausak) | Taylor Fausak | [MIT license] |+| [@thimoteus](https://github.com/Thimoteus) | thimoteus | [MIT license] |+| [@thomashoneyman](https://github.com/thomashoneyman) | Thomas Honeyman | [MIT license] |+| [@thoradam](https://github.com/thoradam) | Thor Adam | [MIT license] |+| [@tmcgilchrist](https://github.com/tmcgilchrist) | Tim McGilchrist | [MIT license] |+| [@trofi](https://github.com/trofi) | Sergei Trofimovich | [MIT license] |+| [@utkarshkukreti](https://github.com/utkarshkukreti) | Utkarsh Kukreti | [MIT license] |+| [@vkorablin](https://github.com/vkorablin) | Vladimir Korablin | [MIT license] |+| [@vladciobanu](https://github.com/vladciobanu) | Vladimir Ciobanu | [MIT license] |+| [@wclr](https://github.com/wclr) | Alex Osh | [MIT license] |+| [@woody88](https://github.com/woody88) | Woodson Delhia | [MIT license] |+| [@xgrommx](https://github.com/xgrommx) | Denis Stoyanov | [MIT license] |+| [@zudov](https://github.com/zudov) | Konstantin Zudov | [MIT license] |+++### Contributors using Modified Terms++| Username | Name | Terms |+| :------- | :--- | :------ |+| [@charleso](https://github.com/charleso) | Charles O'Farrell | My existing contributions to the PureScript compiler and all future contributions to the PureScript compiler until further notice, are Copyright Charles O'Farrell, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license]. |+| [@chrissmoak](https://github.com/chrissmoak) | Chris Smoak | My existing contributions to the PureScript compiler and all future contributions to the PureScript compiler until further notice, are Copyright Chris Smoak, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license]. |+| [@citizengabe](https://github.com/citizengabe) | Gabe Johnson | All contributions I have or will make using the @citizengabe GitHub account are during employment at [CitizenNet Inc.](#companies) who owns the copyright. All of my existing or future contributions made using the @gabejohnson GitHub account are personal contributions and subject to the terms specified [above](#contributors-using-standard-terms). |+| [@dylex](https://github.com/dylex) | Dylan Simon | My existing and all future contributions to the PureScript compiler until further notice are Copyright Dylan Simon, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license]. |+| [@leighman](http://github.com/leighman) | Jack Leigh | My existing contributions and all future contributions until further notice are Copyright Jack Leigh, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license]. |+| [@nagisa](https://github.com/nagisa) | nagisa | I hereby release my [only contribution](https://github.com/purescript/purescript/commit/80287a5d0de619862d3b4cda9c1ee276d18fdcd8) into public domain. |+| [@puffnfresh](https://github.com/puffnfresh) | Brian McKenna | All contributions I made during June 2015 were during employment at [SlamData, Inc.](#companies) who owns the copyright. I assign copyright of all my personal contributions before June 2015 to the owners of the PureScript compiler. |+| [@nwolverson](https://github.com/nwolverson) | Nicholas Wolverson | Contributions I made during March 2020 until further notice are in employment of [Id3as Company](#companies), who own the copyright. All other contributions remain Copyright Nicholas Wolverson, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license]. |+++### Companies++| Username | Company | Terms |+| :------- | :--- | :------ |+| [@citizennet](https://github.com/citizennet) | CitizenNet Inc. | Our existing contributions to the PureScript compiler and all future contributions to the PureScript compiler until further notice, are Copyright CitizenNet Inc., and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license]. - [@dbenyamin-cn](https://github.com/dbenyamin-cn) |+| [@slamdata](https://github.com/slamdata) | SlamData, Inc. | Speaking on behalf of SlamData for SlamData employees, our existing contributions and all future contributions to the PureScript compiler are, until further notice, Copyright SlamData Inc., and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license]. - @jdegoes |+| [@qfpl](https://github.com/qfpl) | qfpl @ Data61 / CSIRO | Our existing contributions to the PureScript compiler and all future contributions to the PureScript compiler until further notice, are Copyright Data61 / CSIRO, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license]. - [@lightandlight](https://github.com/lightandlight) |+| [@id3as](https://github.com/id3as) | id3as-company Ltd. | Speaking on behalf of id3as for id3as employees, our existing contributions and all future contributions to the PureScript compiler are, until further notice, Copyright id3as-company Ltd, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license]. - @adrianroe |+| [@aeternity](https://aeternity.com/) | Aeternity Establishment | Our existing contributions to the PureScript compiler and all future contributions to the PureScript compiler until further notice, are Copyright Aeternity Establishment, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license]. |+++[MIT license]: https://opensource.org/licenses/MIT
+ INSTALL.md view
@@ -0,0 +1,73 @@+# Installation information++If you are having difficulty installing the PureScript compiler, feel free to ask for help! The best places are the [PureScript Discord](https://purescript.org/chat) or [PureScript Discourse](https://discourse.purescript.org).++## Requirements++The PureScript compiler is built using GHC 9.2.5, and should be able to run on any operating system supported by GHC 9.2.5. In particular:++* for Windows users, versions predating Vista are not officially supported,+* for macOS / OS X users, versions predating Mac OS X 10.7 (Lion) are not officially supported.++See also <https://www.haskell.org/ghc/download_ghc_9_2_5.html> for more details about the operating systems which GHC 9.2.5 supports.++## Official prebuilt binaries++Each [release](https://github.com/purescript/purescript/releases) comes with prebuilt x86-64 binary bundles for Linux, mac OS, and Windows. Users of other operating systems or architectures will likely need to build the compiler from source; see below.++To install a binary bundle, simply extract it and place the `purs` executable somewhere on your PATH.++## Other distributions++There are several other distributions of the PureScript compiler available, which may be more convenient to use in certain setups. This is by no means an exhaustive list, and is presented in no particular order. Many of these distributions are provided and maintained by the community, and may not be immediately up to date following a new release.++* NPM: `npm install -g purescript`+* Homebrew (for macOS): `brew install purescript`+* FreeBSD binary packages: `pkg install hs-purescript`+* GNU Guix: `guix install purescript`++## Compiling from source++The easiest way is to use stack:++```+$ stack update+$ stack unpack purescript+$ cd purescript-x.y.z # (replace x.y.z with whichever version you just downloaded)+$ stack install --flag purescript:RELEASE+```++This will then copy the compiler executable (`purs`) into `~/.local/bin`.++If you don't have stack installed, please see the [stack install documentation](https://github.com/commercialhaskell/stack/blob/master/doc/install_and_upgrade.md).++## The "curses" library++Prior to version v0.14.2, the PureScript REPL depends on the `curses` library+by default (via the Haskell package `terminfo`). If you are having difficulty+running the compiler, it may be because the `curses` library is missing. This+problem may appear as a `libtinfo` error:+```+error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory+```++On Linux, you will probably need to install `ncurses` manually. On Ubuntu, for+example, this can be done by running:+```+$ sudo apt install libtinfo5 libncurses5-dev+```++As of v0.14.2, this should no longer be necessary if you are using the prebuilt+binaries or building the compiler from source with the default configuration.+However, you can still opt into using `curses` by setting the Haskeline+`terminfo` flag to `true`. This may improve the REPL experience slightly - for+example, by providing better editing of long input lines.++## EACCES error++If you encounter this error while trying to install via `npm`:+```+Error: EACCES: permission denied+```++The best solution is to install [Node.js and npm via a node version manager](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm#using-a-node-version-manager-to-install-nodejs-and-npm). This error is due to permissions issues when installing packages globally. You can read more about this error in npm's guide to [resolving EACCES permissions errors when installing packages globally](https://docs.npmjs.com/getting-started/fixing-npm-permissions).
LICENSE view
@@ -1,684 +1,5012 @@-The MIT License (MIT)--Copyright (c) 2013-14 Phil Freeman, (c) 2014 Gary Burgess, and other contributors--Permission is hereby granted, free of charge, to any person obtaining a copy of-this software and associated documentation files (the "Software"), to deal in-the Software without restriction, including without limitation the rights to-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of-the Software, and to permit persons to whom the Software is furnished to do so,-subject to the following conditions:--The above copyright notice and this permission notice shall be included in all-copies or substantial portions of the Software.--THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS-FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR-COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER-IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.--PureScript uses the following Haskell library packages. Their license files follow.-- base- containers- directory- file-embed- filepath- haskeline- monad-unify- mtl- optparse-applicative- parsec- pattern-arrows- process- time- transformers- unordered-containers- utf8-string- split- boxes--base LICENSE file:-- This library (libraries/base) is derived from code from several- sources:-- * Code from the GHC project which is largely (c) The University of- Glasgow, and distributable under a BSD-style license (see below),-- * Code from the Haskell 98 Report which is (c) Simon Peyton Jones- and freely redistributable (but see the full license for- restrictions).-- * Code from the Haskell Foreign Function Interface specification,- which is (c) Manuel M. T. Chakravarty and freely redistributable- (but see the full license for restrictions).-- The full text of these licenses is reproduced below. All of the- licenses are BSD-style or compatible.-- ------------------------------------------------------------------------------- The Glasgow Haskell Compiler License-- Copyright 2004, The University Court of the University of Glasgow.- All rights reserved.-- Redistribution and use in source and binary forms, with or without- modification, are permitted provided that the following conditions are met:-- - Redistributions of source code must retain the above copyright notice,- this list of conditions and the following disclaimer.-- - Redistributions in binary form must reproduce the above copyright notice,- this list of conditions and the following disclaimer in the documentation- and/or other materials provided with the distribution.-- - Neither name of the University nor the names of its contributors may be- used to endorse or promote products derived from this software without- specific prior written permission.-- THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF- GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE- UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH- DAMAGE.-- ------------------------------------------------------------------------------- Code derived from the document "Report on the Programming Language- Haskell 98", is distributed under the following license:-- Copyright (c) 2002 Simon Peyton Jones-- The authors intend this Report to belong to the entire Haskell- community, and so we grant permission to copy and distribute it for- any purpose, provided that it is reproduced in its entirety,- including this Notice. Modified versions of this Report may also be- copied and distributed for any purpose, provided that the modified- version is clearly presented as such, and that it does not claim to- be a definition of the Haskell 98 Language.-- ------------------------------------------------------------------------------- Code derived from the document "The Haskell 98 Foreign Function- Interface, An Addendum to the Haskell 98 Report" is distributed under- the following license:-- Copyright (c) 2002 Manuel M. T. Chakravarty-- The authors intend this Report to belong to the entire Haskell- community, and so we grant permission to copy and distribute it for- any purpose, provided that it is reproduced in its entirety,- including this Notice. Modified versions of this Report may also be- copied and distributed for any purpose, provided that the modified- version is clearly presented as such, and that it does not claim to- be a definition of the Haskell 98 Foreign Function Interface.-- -------------------------------------------------------------------------------containers LICENSE file:-- The Glasgow Haskell Compiler License-- Copyright 2004, The University Court of the University of Glasgow.- All rights reserved.-- Redistribution and use in source and binary forms, with or without- modification, are permitted provided that the following conditions are met:-- - Redistributions of source code must retain the above copyright notice,- this list of conditions and the following disclaimer.-- - Redistributions in binary form must reproduce the above copyright notice,- this list of conditions and the following disclaimer in the documentation- and/or other materials provided with the distribution.-- - Neither name of the University nor the names of its contributors may be- used to endorse or promote products derived from this software without- specific prior written permission.-- THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF- GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE- UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH- DAMAGE.--directory LICENSE file:-- This library (libraries/base) is derived from code from two- sources:-- * Code from the GHC project which is largely (c) The University of- Glasgow, and distributable under a BSD-style license (see below),-- * Code from the Haskell 98 Report which is (c) Simon Peyton Jones- and freely redistributable (but see the full license for- restrictions).-- The full text of these licenses is reproduced below. Both of the- licenses are BSD-style or compatible.-- ------------------------------------------------------------------------------- The Glasgow Haskell Compiler License-- Copyright 2004, The University Court of the University of Glasgow.- All rights reserved.-- Redistribution and use in source and binary forms, with or without- modification, are permitted provided that the following conditions are met:-- - Redistributions of source code must retain the above copyright notice,- this list of conditions and the following disclaimer.-- - Redistributions in binary form must reproduce the above copyright notice,- this list of conditions and the following disclaimer in the documentation- and/or other materials provided with the distribution.-- - Neither name of the University nor the names of its contributors may be- used to endorse or promote products derived from this software without- specific prior written permission.-- THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF- GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE- UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH- DAMAGE.-- ------------------------------------------------------------------------------- Code derived from the document "Report on the Programming Language- Haskell 98", is distributed under the following license:-- Copyright (c) 2002 Simon Peyton Jones-- The authors intend this Report to belong to the entire Haskell- community, and so we grant permission to copy and distribute it for- any purpose, provided that it is reproduced in its entirety,- including this Notice. Modified versions of this Report may also be- copied and distributed for any purpose, provided that the modified- version is clearly presented as such, and that it does not claim to- be a definition of the Haskell 98 Language.-- -------------------------------------------------------------------------------file-embed LICENSE file:-- The following license covers this documentation, and the source code, except- where otherwise indicated.-- Copyright 2008, Michael Snoyman. All rights reserved.-- Redistribution and use in source and binary forms, with or without- modification, are permitted provided that the following conditions are met:-- * Redistributions of source code must retain the above copyright notice, this- list of conditions and the following disclaimer.-- * Redistributions in binary form must reproduce the above copyright notice,- this list of conditions and the following disclaimer in the documentation- and/or other materials provided with the distribution.-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY EXPRESS OR- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO- EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,- OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE- OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF- ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.--filepath LICENSE file:-- Copyright Neil Mitchell 2005-2007.- All rights reserved.-- Redistribution and use in source and binary forms, with or without- modification, are permitted provided that the following conditions are- met:-- * Redistributions of source code must retain the above copyright- notice, this list of conditions and the following disclaimer.-- * Redistributions in binary form must reproduce the above- copyright notice, this list of conditions and the following- disclaimer in the documentation and/or other materials provided- with the distribution.-- * Neither the name of Neil Mitchell nor the names of other- contributors may be used to endorse or promote products derived- from this software without specific prior written permission.-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.--haskeline LICENSE file:-- Copyright 2007-2009, Judah Jacobson.- All Rights Reserved.-- Redistribution and use in source and binary forms, with or without- modification, are permitted provided that the following conditions are met:-- - Redistribution of source code must retain the above copyright notice,- this list of conditions and the following disclaimer.-- - Redistribution in binary form must reproduce the above copyright notice,- this list of conditions and the following disclaimer in the documentation- and/or other materials provided with the distribution.-- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE- DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE CONTRIBUTORS BE LIABLE- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR- SERVICES; LOSS OF USE, DATA OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE- USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.--monad-unify LICENSE file:-- The MIT License (MIT)-- Copyright (c) 2013 Phil Freeman-- Permission is hereby granted, free of charge, to any person obtaining a copy of- this software and associated documentation files (the "Software"), to deal in- the Software without restriction, including without limitation the rights to- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of- the Software, and to permit persons to whom the Software is furnished to do so,- subject to the following conditions:-- The above copyright notice and this permission notice shall be included in all- copies or substantial portions of the Software.-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.--mtl LICENSE file:-- The Glasgow Haskell Compiler License-- Copyright 2004, The University Court of the University of Glasgow.- All rights reserved.-- Redistribution and use in source and binary forms, with or without- modification, are permitted provided that the following conditions are met:-- - Redistributions of source code must retain the above copyright notice,- this list of conditions and the following disclaimer.-- - Redistributions in binary form must reproduce the above copyright notice,- this list of conditions and the following disclaimer in the documentation- and/or other materials provided with the distribution.-- - Neither name of the University nor the names of its contributors may be- used to endorse or promote products derived from this software without- specific prior written permission.-- THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF- GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE- UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH- DAMAGE.--optparse-applicative LICENSE file:-- Copyright (c) 2012, Paolo Capriotti-- All rights reserved.-- Redistribution and use in source and binary forms, with or without- modification, are permitted provided that the following conditions are met:-- * Redistributions of source code must retain the above copyright- notice, this list of conditions and the following disclaimer.-- * Redistributions in binary form must reproduce the above- copyright notice, this list of conditions and the following- disclaimer in the documentation and/or other materials provided- with the distribution.-- * Neither the name of Paolo Capriotti nor the names of other- contributors may be used to endorse or promote products derived- from this software without specific prior written permission.-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.--parsec LICENSE file:-- Copyright 1999-2000, Daan Leijen; 2007, Paolo Martini. All rights reserved.-- Redistribution and use in source and binary forms, with or without- modification, are permitted provided that the following conditions are met:-- * Redistributions of source code must retain the above copyright notice,- this list of conditions and the following disclaimer.- * Redistributions in binary form must reproduce the above copyright- notice, this list of conditions and the following disclaimer in the- documentation and/or other materials provided with the distribution.-- This software is provided by the copyright holders "as is" and any express or- implied warranties, including, but not limited to, the implied warranties of- merchantability and fitness for a particular purpose are disclaimed. In no- event shall the copyright holders be liable for any direct, indirect,- incidental, special, exemplary, or consequential damages (including, but not- limited to, procurement of substitute goods or services; loss of use, data,- or profits; or business interruption) however caused and on any theory of- liability, whether in contract, strict liability, or tort (including- negligence or otherwise) arising in any way out of the use of this software,- even if advised of the possibility of such damage.--pattern-arrows LICENSE file:-- The MIT License (MIT)-- Copyright (c) 2013 Phil Freeman-- Permission is hereby granted, free of charge, to any person obtaining a copy of- this software and associated documentation files (the "Software"), to deal in- the Software without restriction, including without limitation the rights to- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of- the Software, and to permit persons to whom the Software is furnished to do so,- subject to the following conditions:-- The above copyright notice and this permission notice shall be included in all- copies or substantial portions of the Software.-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.--process LICENSE file:-- This library (libraries/process) is derived from code from two- sources:-- * Code from the GHC project which is largely (c) The University of- Glasgow, and distributable under a BSD-style license (see below),-- * Code from the Haskell 98 Report which is (c) Simon Peyton Jones- and freely redistributable (but see the full license for- restrictions).-- The full text of these licenses is reproduced below. Both of the- licenses are BSD-style or compatible.-- ------------------------------------------------------------------------------- The Glasgow Haskell Compiler License-- Copyright 2004, The University Court of the University of Glasgow.- All rights reserved.-- Redistribution and use in source and binary forms, with or without- modification, are permitted provided that the following conditions are met:-- - Redistributions of source code must retain the above copyright notice,- this list of conditions and the following disclaimer.-- - Redistributions in binary form must reproduce the above copyright notice,- this list of conditions and the following disclaimer in the documentation- and/or other materials provided with the distribution.-- - Neither name of the University nor the names of its contributors may be- used to endorse or promote products derived from this software without- specific prior written permission.-- THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF- GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE- UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH- DAMAGE.-- ------------------------------------------------------------------------------- Code derived from the document "Report on the Programming Language- Haskell 98", is distributed under the following license:-- Copyright (c) 2002 Simon Peyton Jones-- The authors intend this Report to belong to the entire Haskell- community, and so we grant permission to copy and distribute it for- any purpose, provided that it is reproduced in its entirety,- including this Notice. Modified versions of this Report may also be- copied and distributed for any purpose, provided that the modified- version is clearly presented as such, and that it does not claim to- be a definition of the Haskell 98 Language.-- -------------------------------------------------------------------------------time LICENSE file:-- TimeLib is Copyright (c) Ashley Yakeley, 2004-2014. All rights reserved.- Certain sections are Copyright 2004, The University Court of the University of Glasgow. All rights reserved.-- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:-- - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.-- - Neither name of the copyright holders nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.--transformers LICENSE file:-- The Glasgow Haskell Compiler License-- Copyright 2004, The University Court of the University of Glasgow.- All rights reserved.-- Redistribution and use in source and binary forms, with or without- modification, are permitted provided that the following conditions are met:-- - Redistributions of source code must retain the above copyright notice,- this list of conditions and the following disclaimer.-- - Redistributions in binary form must reproduce the above copyright notice,- this list of conditions and the following disclaimer in the documentation- and/or other materials provided with the distribution.-- - Neither name of the University nor the names of its contributors may be- used to endorse or promote products derived from this software without- specific prior written permission.-- THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF- GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE- UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH- DAMAGE.--unordered-containers LICENSE file:-- Copyright (c) 2010, Johan Tibell-- All rights reserved.-- Redistribution and use in source and binary forms, with or without- modification, are permitted provided that the following conditions are met:-- * Redistributions of source code must retain the above copyright- notice, this list of conditions and the following disclaimer.-- * Redistributions in binary form must reproduce the above- copyright notice, this list of conditions and the following- disclaimer in the documentation and/or other materials provided- with the distribution.-- * Neither the name of Johan Tibell nor the names of other- contributors may be used to endorse or promote products derived- from this software without specific prior written permission.-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.--utf8-string LICENSE file:-- * Copyright (c) 2007, Galois Inc.- * All rights reserved.- *- * Redistribution and use in source and binary forms, with or without- * modification, are permitted provided that the following conditions are met:- * * Redistributions of source code must retain the above copyright- * notice, this list of conditions and the following disclaimer.- * * Redistributions in binary form must reproduce the above copyright- * notice, this list of conditions and the following disclaimer in the- * documentation and/or other materials provided with the distribution.- * * Neither the name of Galois Inc. nor the- * names of its contributors may be used to endorse or promote products- * derived from this software without specific prior written permission.- *- * THIS SOFTWARE IS PROVIDED BY Galois Inc. ``AS IS'' AND ANY- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE- * DISCLAIMED. IN NO EVENT SHALL Galois Inc. BE LIABLE FOR ANY- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.--split LICENSE file:-- Copyright (c) 2008 Brent Yorgey, Louis Wasserman-- All rights reserved.-- Redistribution and use in source and binary forms, with or without- modification, are permitted provided that the following conditions- are met:- 1. Redistributions of source code must retain the above copyright- notice, this list of conditions and the following disclaimer.- 2. Redistributions in binary form must reproduce the above copyright- notice, this list of conditions and the following disclaimer in the- documentation and/or other materials provided with the distribution.- 3. Neither the name of the author nor the names of other contributors- may be used to endorse or promote products derived from this software- without specific prior written permission.-- THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF- SUCH DAMAGE.--boxes LICENSE file:-- Copyright (c) Brent Yorgey 2008-- Redistribution and use in source and binary forms, with or without- modification, are permitted provided that the following conditions- are met:- 1. Redistributions of source code must retain the above copyright- notice, this list of conditions and the following disclaimer.- 2. Redistributions in binary form must reproduce the above copyright- notice, this list of conditions and the following disclaimer in the- documentation and/or other materials provided with the distribution.- 3. Neither the name of the author nor the names of other contributors- may be used to endorse or promote products derived from this software- without specific prior written permission.-- All other rights are reserved.-- THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF- SUCH DAMAGE.+Copyright (c) 2013-17 Phil Freeman, (c) 2014-2017 Gary Burgess, and other+contributors+All rights reserved.++Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:++1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.++2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.++3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++PureScript uses the following Haskell library packages. Their license files follow.++ Cabal+ Glob+ OneTuple+ QuickCheck+ StateVar+ adjunctions+ aeson+ aeson-better-errors+ alex+ ansi-terminal+ ansi-wl-pprint+ array+ assoc+ async+ attoparsec+ auto-update+ base+ base-compat+ base-compat-batteries+ base-orphans+ basement+ bifunctors+ binary+ blaze-builder+ blaze-html+ blaze-markup+ bower-json+ boxes+ bytestring+ call-stack+ cborg+ cheapskate+ clock+ colour+ comonad+ conduit+ conduit-extra+ constraints+ containers+ contravariant+ cryptonite+ css-text+ data-array-byte+ data-default+ data-default-class+ data-default-instances-containers+ data-default-instances-dlist+ data-default-instances-old-locale+ data-fix+ data-ordlist+ deepseq+ directory+ distributive+ dlist+ easy-file+ edit-distance+ exceptions+ fast-logger+ file-embed+ filepath+ free+ ghc-bignum+ ghc-prim+ half+ happy+ hashable+ haskeline+ indexed-traversable+ indexed-traversable-instances+ integer-gmp+ integer-logarithms+ invariant+ kan-extensions+ language-javascript+ lens+ lifted-async+ lifted-base+ memory+ monad-control+ monad-logger+ monad-loops+ mono-traversable+ monoidal-containers+ mtl+ mtl-compat+ network+ network-uri+ newtype+ old-locale+ old-time+ optparse-applicative+ parallel+ parsec+ pattern-arrows+ pretty+ primitive+ process+ profunctors+ protolude+ random+ reflection+ regex-base+ regex-tdfa+ resourcet+ safe+ scientific+ semialign+ semigroupoids+ semigroups+ serialise+ sourcemap+ split+ splitmix+ stm+ stm-chans+ streaming-commons+ strict+ stringsearch+ syb+ tagged+ tagsoup+ template-haskell+ text+ text-short+ th-abstraction+ th-compat+ these+ time+ time-compat+ transformers+ transformers-base+ transformers-compat+ type-equality+ typed-process+ uniplate+ unix+ unix-compat+ unix-time+ unliftio-core+ unordered-containers+ utf8-string+ uuid-types+ vector+ vector-algorithms+ void+ witherable+ xss-sanitize+ zlib++Cabal LICENSE file:++ Copyright (c) 2003-2020, Cabal Development Team.+ See the AUTHORS file for the full list of copyright holders.++ See */LICENSE for the copyright holders of the subcomponents.++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are+ met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Isaac Jones nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++Glob LICENSE file:++ The code in Glob is released under the license below. Copyrights to parts of+ the code are held by whoever wrote the code in question: see CREDITS.txt for a+ list of authors.++ Copyright (c) 2008-2018 <authors>+ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:+ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.+ * Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.+ * Neither the name of the project nor the names of its contributors may be+ used to endorse or promote products derived from this software without+ specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO+ EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++OneTuple LICENSE file:+++ Copyright (c) 2008, John A. Dorsey.+ All rights reserved.++ Redistribution and use of this software in source and binary forms,+ with or without modification, are permitted provided that the+ following conditions are met:++ * Redistributions of source code must retain the above+ copyright notice, this list of conditions and the+ following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the+ following disclaimer in the documentation and/or other+ materials provided with the distribution.++ * Neither the name of John Dorsey nor the names of its+ contributors may be used to endorse or promote products+ derived from this software without specific prior+ written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED+ TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,+ OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY+ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+++QuickCheck LICENSE file:++ (The following is the 3-clause BSD license.)++ Copyright (c) 2000-2019, Koen Claessen+ Copyright (c) 2006-2008, Björn Bringert+ Copyright (c) 2009-2019, Nick Smallbone++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ - Redistributions of source code must retain the above copyright notice,+ this list of conditions and the following disclaimer.+ - Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.+ - Neither the names of the copyright owners nor the names of the+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++StateVar LICENSE file:++ Copyright (c) 2014-2015, Edward Kmett+ Copyright (c) 2009-2021, Sven Panne+ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ 1. Redistributions of source code must retain the above copyright notice,+ this list of conditions and the following disclaimer.++ 2. Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.++ 3. Neither the name of the author nor the names of its contributors may be+ used to endorse or promote products derived from this software without+ specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE+ POSSIBILITY OF SUCH DAMAGE.++adjunctions LICENSE file:++ Copyright 2011-2014 Edward Kmett++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions+ are met:++ 1. Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ 2. Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.++ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+ DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE+ POSSIBILITY OF SUCH DAMAGE.++aeson LICENSE file:++ Copyright (c) 2011, MailRank, Inc. 2014-2021 Aeson project contributors++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions+ are met:++ 1. Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ 2. Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.++ 3. Neither the name of the author nor the names of his contributors+ may be used to endorse or promote products derived from this software+ without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+ DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE+ POSSIBILITY OF SUCH DAMAGE.++aeson-better-errors LICENSE file:++ Copyright (c) 2015 Harry Garrood++ Permission is hereby granted, free of charge, to any person obtaining+ a copy of this software and associated documentation files (the+ "Software"), to deal in the Software without restriction, including+ without limitation the rights to use, copy, modify, merge, publish,+ distribute, sublicense, and/or sell copies of the Software, and to+ permit persons to whom the Software is furnished to do so, subject to+ the following conditions:++ The above copyright notice and this permission notice shall be included+ in all copies or substantial portions of the Software.++ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.++alex LICENSE file:++ Copyright (c) 1995-2011, Chris Dornan and Simon Marlow+ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are+ met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of the copyright holders, nor the names of the+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++ansi-terminal LICENSE file:++ Copyright (c) 2008, Maximilian Bolingbroke+ All rights reserved.++ Redistribution and use in source and binary forms, with or without modification, are permitted+ provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright notice, this list of+ conditions and the following disclaimer.+ * Redistributions in binary form must reproduce the above copyright notice, this list of+ conditions and the following disclaimer in the documentation and/or other materials+ provided with the distribution.+ * Neither the name of Maximilian Bolingbroke nor the names of other contributors may be used to+ endorse or promote products derived from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER+ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++ansi-wl-pprint LICENSE file:++ Copyright 2008, Daan Leijen and Max Bolingbroke. All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are+ met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in+ the documentation and/or other materials provided with the+ distribution.++ This software is provided by the copyright holders "as is" and any+ express or implied warranties, including, but not limited to, the+ implied warranties of merchantability and fitness for a particular+ purpose are disclaimed. In no event shall the copyright holders be+ liable for any direct, indirect, incidental, special, exemplary, or+ consequential damages (including, but not limited to, procurement of+ substitute goods or services; loss of use, data, or profits; or+ business interruption) however caused and on any theory of liability,+ whether in contract, strict liability, or tort (including negligence+ or otherwise) arising in any way out of the use of this software, even+ if advised of the possibility of such damage.++array LICENSE file:++ This library (libraries/base) is derived from code from several+ sources:++ * Code from the GHC project which is largely (c) The University of+ Glasgow, and distributable under a BSD-style license (see below),++ * Code from the Haskell 98 Report which is (c) Simon Peyton Jones+ and freely redistributable (but see the full license for+ restrictions).++ * Code from the Haskell Foreign Function Interface specification,+ which is (c) Manuel M. T. Chakravarty and freely redistributable+ (but see the full license for restrictions).++ The full text of these licenses is reproduced below. All of the+ licenses are BSD-style or compatible.++ -----------------------------------------------------------------------------++ The Glasgow Haskell Compiler License++ Copyright 2004, The University Court of the University of Glasgow.+ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ - Redistributions of source code must retain the above copyright notice,+ this list of conditions and the following disclaimer.++ - Redistributions in binary form must reproduce the above copyright notice,+ this list of conditions and the following disclaimer in the documentation+ and/or other materials provided with the distribution.++ - Neither name of the University nor the names of its contributors may be+ used to endorse or promote products derived from this software without+ specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH+ DAMAGE.++ -----------------------------------------------------------------------------++ Code derived from the document "Report on the Programming Language+ Haskell 98", is distributed under the following license:++ Copyright (c) 2002 Simon Peyton Jones++ The authors intend this Report to belong to the entire Haskell+ community, and so we grant permission to copy and distribute it for+ any purpose, provided that it is reproduced in its entirety,+ including this Notice. Modified versions of this Report may also be+ copied and distributed for any purpose, provided that the modified+ version is clearly presented as such, and that it does not claim to+ be a definition of the Haskell 98 Language.++ -----------------------------------------------------------------------------++ Code derived from the document "The Haskell 98 Foreign Function+ Interface, An Addendum to the Haskell 98 Report" is distributed under+ the following license:++ Copyright (c) 2002 Manuel M. T. Chakravarty++ The authors intend this Report to belong to the entire Haskell+ community, and so we grant permission to copy and distribute it for+ any purpose, provided that it is reproduced in its entirety,+ including this Notice. Modified versions of this Report may also be+ copied and distributed for any purpose, provided that the modified+ version is clearly presented as such, and that it does not claim to+ be a definition of the Haskell 98 Foreign Function Interface.++ -----------------------------------------------------------------------------+++assoc LICENSE file:++ Copyright (c) 2017, Oleg Grenrus++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Oleg Grenrus nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++async LICENSE file:++ Copyright (c) 2012, Simon Marlow++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Simon Marlow nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++attoparsec LICENSE file:++ Copyright (c) Lennart Kolmodin++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions+ are met:++ 1. Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ 2. Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.++ 3. Neither the name of the author nor the names of his contributors+ may be used to endorse or promote products derived from this software+ without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+ DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE+ POSSIBILITY OF SUCH DAMAGE.++auto-update LICENSE file:++ Copyright (c) 2014 Michael Snoyman++ Permission is hereby granted, free of charge, to any person obtaining+ a copy of this software and associated documentation files (the+ "Software"), to deal in the Software without restriction, including+ without limitation the rights to use, copy, modify, merge, publish,+ distribute, sublicense, and/or sell copies of the Software, and to+ permit persons to whom the Software is furnished to do so, subject to+ the following conditions:++ The above copyright notice and this permission notice shall be included+ in all copies or substantial portions of the Software.++ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.++base LICENSE file:++ This library (libraries/base) is derived from code from several+ sources:++ * Code from the GHC project which is largely (c) The University of+ Glasgow, and distributable under a BSD-style license (see below),++ * Code from the Haskell 98 Report which is (c) Simon Peyton Jones+ and freely redistributable (but see the full license for+ restrictions).++ * Code from the Haskell Foreign Function Interface specification,+ which is (c) Manuel M. T. Chakravarty and freely redistributable+ (but see the full license for restrictions).++ The full text of these licenses is reproduced below. All of the+ licenses are BSD-style or compatible.++ -----------------------------------------------------------------------------++ The Glasgow Haskell Compiler License++ Copyright 2004, The University Court of the University of Glasgow.+ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ - Redistributions of source code must retain the above copyright notice,+ this list of conditions and the following disclaimer.++ - Redistributions in binary form must reproduce the above copyright notice,+ this list of conditions and the following disclaimer in the documentation+ and/or other materials provided with the distribution.++ - Neither name of the University nor the names of its contributors may be+ used to endorse or promote products derived from this software without+ specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH+ DAMAGE.++ -----------------------------------------------------------------------------++ Code derived from the document "Report on the Programming Language+ Haskell 98", is distributed under the following license:++ Copyright (c) 2002 Simon Peyton Jones++ The authors intend this Report to belong to the entire Haskell+ community, and so we grant permission to copy and distribute it for+ any purpose, provided that it is reproduced in its entirety,+ including this Notice. Modified versions of this Report may also be+ copied and distributed for any purpose, provided that the modified+ version is clearly presented as such, and that it does not claim to+ be a definition of the Haskell 98 Language.++ -----------------------------------------------------------------------------++ Code derived from the document "The Haskell 98 Foreign Function+ Interface, An Addendum to the Haskell 98 Report" is distributed under+ the following license:++ Copyright (c) 2002 Manuel M. T. Chakravarty++ The authors intend this Report to belong to the entire Haskell+ community, and so we grant permission to copy and distribute it for+ any purpose, provided that it is reproduced in its entirety,+ including this Notice. Modified versions of this Report may also be+ copied and distributed for any purpose, provided that the modified+ version is clearly presented as such, and that it does not claim to+ be a definition of the Haskell 98 Foreign Function Interface.++ -----------------------------------------------------------------------------++base-compat LICENSE file:++ Copyright (c) 2012-2018 Simon Hengel <sol@typeful.net> and Ryan Scott <ryan.gl.scott@gmail.com>++ Permission is hereby granted, free of charge, to any person obtaining a copy+ of this software and associated documentation files (the "Software"), to deal+ in the Software without restriction, including without limitation the rights+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+ copies of the Software, and to permit persons to whom the Software is+ furnished to do so, subject to the following conditions:++ The above copyright notice and this permission notice shall be included in+ all copies or substantial portions of the Software.++ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN+ THE SOFTWARE.++base-compat-batteries LICENSE file:++ Copyright (c) 2012-2018 Simon Hengel <sol@typeful.net> and Ryan Scott <ryan.gl.scott@gmail.com>++ Permission is hereby granted, free of charge, to any person obtaining a copy+ of this software and associated documentation files (the "Software"), to deal+ in the Software without restriction, including without limitation the rights+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+ copies of the Software, and to permit persons to whom the Software is+ furnished to do so, subject to the following conditions:++ The above copyright notice and this permission notice shall be included in+ all copies or substantial portions of the Software.++ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN+ THE SOFTWARE.++base-orphans LICENSE file:++ Copyright (c) 2015-2017 Simon Hengel <sol@typeful.net>, João Cristóvão <jmacristovao@gmail.com>, Ryan Scott <ryan.gl.scott@gmail.com>++ Permission is hereby granted, free of charge, to any person obtaining+ a copy of this software and associated documentation files (the+ "Software"), to deal in the Software without restriction, including+ without limitation the rights to use, copy, modify, merge, publish,+ distribute, sublicense, and/or sell copies of the Software, and to+ permit persons to whom the Software is furnished to do so, subject to+ the following conditions:++ The above copyright notice and this permission notice shall be included+ in all copies or substantial portions of the Software.++ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.++basement LICENSE file:++ Copyright (c) 2015-2017 Vincent Hanquez <vincent@snarc.org>+ Copyright (c) 2017-2019 Foundation Maintainers++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions+ are met:+ 1. Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.+ 2. Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.+ 3. Neither the name of the author nor the names of his contributors+ may be used to endorse or promote products derived from this software+ without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS AS IS'' AND+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF+ SUCH DAMAGE.++bifunctors LICENSE file:++ Copyright 2008-2016 Edward Kmett++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions+ are met:++ 1. Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ 2. Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.++ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+ DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE+ POSSIBILITY OF SUCH DAMAGE.++binary LICENSE file:++ Copyright (c) Lennart Kolmodin++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions+ are met:++ 1. Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ 2. Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.++ 3. Neither the name of the author nor the names of his contributors+ may be used to endorse or promote products derived from this software+ without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+ DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE+ POSSIBILITY OF SUCH DAMAGE.++blaze-builder LICENSE file:++ Copyright Jasper Van der Jeugt 2010, Simon Meier 2010 & 2011++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Jasper Van der Jeugt nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++blaze-html LICENSE file:++ Copyright Jasper Van der Jeugt 2010++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Jasper Van der Jeugt nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++blaze-markup LICENSE file:++ Copyright Jasper Van der Jeugt 2010++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Jasper Van der Jeugt nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++bower-json LICENSE file:++ Copyright (c) 2015 Harry Garrood++ Permission is hereby granted, free of charge, to any person obtaining+ a copy of this software and associated documentation files (the+ "Software"), to deal in the Software without restriction, including+ without limitation the rights to use, copy, modify, merge, publish,+ distribute, sublicense, and/or sell copies of the Software, and to+ permit persons to whom the Software is furnished to do so, subject to+ the following conditions:++ The above copyright notice and this permission notice shall be included+ in all copies or substantial portions of the Software.++ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.++boxes LICENSE file:++ Copyright (c) Brent Yorgey 2008++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions+ are met:+ 1. Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.+ 2. Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.+ 3. Neither the name of the author nor the names of other contributors+ may be used to endorse or promote products derived from this software+ without specific prior written permission.++ All other rights are reserved.++ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF+ SUCH DAMAGE.++bytestring LICENSE file:++ Copyright (c) Don Stewart 2005-2009+ (c) Duncan Coutts 2006-2015+ (c) David Roundy 2003-2005+ (c) Simon Meier 2010-2011+ (c) Koz Ross 2021++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions+ are met:+ 1. Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.+ 2. Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.+ 3. Neither the name of the author nor the names of his contributors+ may be used to endorse or promote products derived from this software+ without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF+ SUCH DAMAGE.++call-stack LICENSE file:++ Copyright (c) 2016-2021 Simon Hengel <sol@typeful.net>++ Permission is hereby granted, free of charge, to any person obtaining a copy+ of this software and associated documentation files (the "Software"), to deal+ in the Software without restriction, including without limitation the rights+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+ copies of the Software, and to permit persons to whom the Software is+ furnished to do so, subject to the following conditions:++ The above copyright notice and this permission notice shall be included in+ all copies or substantial portions of the Software.++ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN+ THE SOFTWARE.++cborg LICENSE file:++ Copyright (c) 2015-2017 Duncan Coutts,+ 2015-2017 Well-Typed LLP,+ 2015 IRIS Connect Ltd.++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are+ met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Duncan Coutts nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++cheapskate LICENSE file:++ Copyright (c) 2013, John MacFarlane++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of John MacFarlane nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++clock LICENSE file:++ Copyright (c) 2009-2012, Cetin Sert+ Copyright (c) 2010, Eugene Kirpichov++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are+ met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * The names of contributors may not be used to endorse or promote+ products derived from this software without specific prior+ written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++colour LICENSE file:++ Copyright (c) 2008, 2009+ Russell O'Connor++ Permission is hereby granted, free of charge, to any person obtaining a copy+ of this software and associated documentation files (the "Software"), to deal+ in the Software without restriction, including without limitation the rights+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+ copies of the Software, and to permit persons to whom the Software is+ furnished to do so, subject to the following conditions:++ The above copyright notice and this permission notice shall be included in+ all copies or substantial portions of the Software.++ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN+ THE SOFTWARE.++comonad LICENSE file:++ Copyright 2008-2014 Edward Kmett+ Copyright 2004-2008 Dave Menendez++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions+ are met:++ 1. Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ 2. Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.++ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+ DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE+ POSSIBILITY OF SUCH DAMAGE.++conduit LICENSE file:++ Copyright (c) 2012 Michael Snoyman, http://www.yesodweb.com/++ Permission is hereby granted, free of charge, to any person obtaining+ a copy of this software and associated documentation files (the+ "Software"), to deal in the Software without restriction, including+ without limitation the rights to use, copy, modify, merge, publish,+ distribute, sublicense, and/or sell copies of the Software, and to+ permit persons to whom the Software is furnished to do so, subject to+ the following conditions:++ The above copyright notice and this permission notice shall be+ included in all copies or substantial portions of the Software.++ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.++conduit-extra LICENSE file:++ Copyright (c) 2012 Michael Snoyman, http://www.yesodweb.com/++ Permission is hereby granted, free of charge, to any person obtaining+ a copy of this software and associated documentation files (the+ "Software"), to deal in the Software without restriction, including+ without limitation the rights to use, copy, modify, merge, publish,+ distribute, sublicense, and/or sell copies of the Software, and to+ permit persons to whom the Software is furnished to do so, subject to+ the following conditions:++ The above copyright notice and this permission notice shall be+ included in all copies or substantial portions of the Software.++ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.++constraints LICENSE file:++ Copyright 2011-2015 Edward Kmett++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions+ are met:++ 1. Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ 2. Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.++ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+ DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE+ POSSIBILITY OF SUCH DAMAGE.++containers LICENSE file:++ The Glasgow Haskell Compiler License++ Copyright 2004, The University Court of the University of Glasgow.+ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ - Redistributions of source code must retain the above copyright notice,+ this list of conditions and the following disclaimer.++ - Redistributions in binary form must reproduce the above copyright notice,+ this list of conditions and the following disclaimer in the documentation+ and/or other materials provided with the distribution.++ - Neither name of the University nor the names of its contributors may be+ used to endorse or promote products derived from this software without+ specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH+ DAMAGE.++contravariant LICENSE file:++ Copyright 2007-2015 Edward Kmett++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions+ are met:++ 1. Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ 2. Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.++ 3. Neither the name of the author nor the names of his contributors+ may be used to endorse or promote products derived from this software+ without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+ DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE+ POSSIBILITY OF SUCH DAMAGE.++cryptonite LICENSE file:++ Copyright (c) 2006-2015 Vincent Hanquez <vincent@snarc.org>++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions+ are met:++ 1. Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.+ 2. Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.+ 3. Neither the name of the author nor the names of his contributors+ may be used to endorse or promote products derived from this software+ without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS AS IS'' AND+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF+ SUCH DAMAGE.++css-text LICENSE file:++ Copyright (c) 2010 Michael Snoyman, http://www.yesodweb.com/++ Permission is hereby granted, free of charge, to any person obtaining+ a copy of this software and associated documentation files (the+ "Software"), to deal in the Software without restriction, including+ without limitation the rights to use, copy, modify, merge, publish,+ distribute, sublicense, and/or sell copies of the Software, and to+ permit persons to whom the Software is furnished to do so, subject to+ the following conditions:++ The above copyright notice and this permission notice shall be+ included in all copies or substantial portions of the Software.++ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.++data-array-byte LICENSE file:++ Copyright (c) 2008-2009, Roman Leshchinskiy+ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ - Redistributions of source code must retain the above copyright notice,+ this list of conditions and the following disclaimer.++ - Redistributions in binary form must reproduce the above copyright notice,+ this list of conditions and the following disclaimer in the documentation+ and/or other materials provided with the distribution.++ - Neither name of the University nor the names of its contributors may be+ used to endorse or promote products derived from this software without+ specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH+ DAMAGE.+++data-default LICENSE file:++ Copyright (c) 2013 Lukas Mai++ All rights reserved.++ Redistribution and use in source and binary forms, with or without modification,+ are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright notice, this+ list of conditions and the following disclaimer.+ * Redistributions in binary form must reproduce the above copyright notice,+ this list of conditions and the following disclaimer in the documentation+ and/or other materials provided with the distribution.+ * Neither the name of the author nor the names of his contributors+ may be used to endorse or promote products derived from this software+ without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++data-default-class LICENSE file:++ Copyright (c) 2013 Lukas Mai++ All rights reserved.++ Redistribution and use in source and binary forms, with or without modification,+ are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright notice, this+ list of conditions and the following disclaimer.+ * Redistributions in binary form must reproduce the above copyright notice,+ this list of conditions and the following disclaimer in the documentation+ and/or other materials provided with the distribution.+ * Neither the name of the author nor the names of his contributors+ may be used to endorse or promote products derived from this software+ without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++data-default-instances-containers LICENSE file:++ Copyright (c) 2013 Lukas Mai++ All rights reserved.++ Redistribution and use in source and binary forms, with or without modification,+ are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright notice, this+ list of conditions and the following disclaimer.+ * Redistributions in binary form must reproduce the above copyright notice,+ this list of conditions and the following disclaimer in the documentation+ and/or other materials provided with the distribution.+ * Neither the name of the author nor the names of his contributors+ may be used to endorse or promote products derived from this software+ without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY LUKAS MAI AND CONTRIBUTORS "AS IS" AND ANY+ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+ DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++data-default-instances-dlist LICENSE file:++ Copyright (c) 2013 Lukas Mai++ All rights reserved.++ Redistribution and use in source and binary forms, with or without modification,+ are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright notice, this+ list of conditions and the following disclaimer.+ * Redistributions in binary form must reproduce the above copyright notice,+ this list of conditions and the following disclaimer in the documentation+ and/or other materials provided with the distribution.+ * Neither the name of the author nor the names of his contributors+ may be used to endorse or promote products derived from this software+ without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY LUKAS MAI AND CONTRIBUTORS "AS IS" AND ANY+ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+ DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++data-default-instances-old-locale LICENSE file:++ Copyright (c) 2013 Lukas Mai++ All rights reserved.++ Redistribution and use in source and binary forms, with or without modification,+ are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright notice, this+ list of conditions and the following disclaimer.+ * Redistributions in binary form must reproduce the above copyright notice,+ this list of conditions and the following disclaimer in the documentation+ and/or other materials provided with the distribution.+ * Neither the name of the author nor the names of his contributors+ may be used to endorse or promote products derived from this software+ without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY LUKAS MAI AND CONTRIBUTORS "AS IS" AND ANY+ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+ DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++data-fix LICENSE file:++ Copyright Anton Kholomiov 2010++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Anton Kholomiov nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++data-ordlist LICENSE file:++ Copyright (c) 2009-2010, Melding Monads+ All rights reserved.++ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.+ * Neither the name of Melding Monads nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++deepseq LICENSE file:++ This library (deepseq) is derived from code from the GHC project which+ is largely (c) The University of Glasgow, and distributable under a+ BSD-style license (see below).++ -----------------------------------------------------------------------------++ The Glasgow Haskell Compiler License++ Copyright 2001-2009, The University Court of the University of Glasgow.+ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ - Redistributions of source code must retain the above copyright notice,+ this list of conditions and the following disclaimer.++ - Redistributions in binary form must reproduce the above copyright notice,+ this list of conditions and the following disclaimer in the documentation+ and/or other materials provided with the distribution.++ - Neither name of the University nor the names of its contributors may be+ used to endorse or promote products derived from this software without+ specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH+ DAMAGE.++ -----------------------------------------------------------------------------++directory LICENSE file:++ This library (libraries/base) is derived from code from two+ sources:++ * Code from the GHC project which is largely (c) The University of+ Glasgow, and distributable under a BSD-style license (see below),++ * Code from the Haskell 98 Report which is (c) Simon Peyton Jones+ and freely redistributable (but see the full license for+ restrictions).++ The full text of these licenses is reproduced below. Both of the+ licenses are BSD-style or compatible.++ -----------------------------------------------------------------------------++ The Glasgow Haskell Compiler License++ Copyright 2004, The University Court of the University of Glasgow.+ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ - Redistributions of source code must retain the above copyright notice,+ this list of conditions and the following disclaimer.++ - Redistributions in binary form must reproduce the above copyright notice,+ this list of conditions and the following disclaimer in the documentation+ and/or other materials provided with the distribution.++ - Neither name of the University nor the names of its contributors may be+ used to endorse or promote products derived from this software without+ specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH+ DAMAGE.++ -----------------------------------------------------------------------------++ Code derived from the document "Report on the Programming Language+ Haskell 98", is distributed under the following license:++ Copyright (c) 2002 Simon Peyton Jones++ The authors intend this Report to belong to the entire Haskell+ community, and so we grant permission to copy and distribute it for+ any purpose, provided that it is reproduced in its entirety,+ including this Notice. Modified versions of this Report may also be+ copied and distributed for any purpose, provided that the modified+ version is clearly presented as such, and that it does not claim to+ be a definition of the Haskell 98 Language.++ -----------------------------------------------------------------------------++distributive LICENSE file:++ Copyright 2011-2016 Edward Kmett++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions+ are met:++ 1. Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ 2. Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.++ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+ DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE+ POSSIBILITY OF SUCH DAMAGE.++dlist LICENSE file:++ Copyright © 2006-2009 Don Stewart, 2013-2020 Sean Leather, contributors++ All rights reserved.++ Redistribution and use in source and binary forms, with or without modification,+ are permitted provided that the following conditions are met:++ 1. Redistributions of source code must retain the above copyright notice, this+ list of conditions and the following disclaimer.++ 2. Redistributions in binary form must reproduce the above copyright notice,+ this list of conditions and the following disclaimer in the documentation+ and/or other materials provided with the distribution.++ 3. Neither the name of the copyright holders nor the names of other contributors+ may be used to endorse or promote products derived from this software without+ specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR+ TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++easy-file LICENSE file:++ Copyright (c) 2009, IIJ Innovation Institute Inc.+ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions+ are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.+ * Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in+ the documentation and/or other materials provided with the+ distribution.+ * Neither the name of the copyright holders nor the names of its+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS+ FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE+ COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE+ POSSIBILITY OF SUCH DAMAGE.++edit-distance LICENSE file:++ Copyright (c) 2008-2013 Maximilian Bolingbroke+ All rights reserved.++ Redistribution and use in source and binary forms, with or without modification, are permitted+ provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright notice, this list of+ conditions and the following disclaimer.+ * Redistributions in binary form must reproduce the above copyright notice, this list of+ conditions and the following disclaimer in the documentation and/or other materials+ provided with the distribution.+ * Neither the name of Maximilian Bolingbroke nor the names of other contributors may be used to+ endorse or promote products derived from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER+ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++exceptions LICENSE file:++ Copyright 2013-2015 Edward Kmett+ Copyright 2012 Google Inc.++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions+ are met:++ 1. Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ 2. Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.++ 3. Neither the name of the author nor the names of his contributors+ may be used to endorse or promote products derived from this software+ without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+ DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE+ POSSIBILITY OF SUCH DAMAGE.++fast-logger LICENSE file:++ Copyright (c) 2009, IIJ Innovation Institute Inc.+ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions+ are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.+ * Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in+ the documentation and/or other materials provided with the+ distribution.+ * Neither the name of the copyright holders nor the names of its+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS+ FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE+ COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE+ POSSIBILITY OF SUCH DAMAGE.++file-embed LICENSE file:++ The following license covers this documentation, and the source code, except+ where otherwise indicated.++ Copyright 2008, Michael Snoyman. All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright notice, this+ list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above copyright notice,+ this list of conditions and the following disclaimer in the documentation+ and/or other materials provided with the distribution.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY EXPRESS OR+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO+ EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT+ NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,+ OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++filepath LICENSE file:++ Copyright Neil Mitchell 2005-2020.+ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are+ met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Neil Mitchell nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++free LICENSE file:++ Copyright 2008-2013 Edward Kmett++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions+ are met:++ 1. Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ 2. Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.++ 3. Neither the name of the author nor the names of his contributors+ may be used to endorse or promote products derived from this software+ without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+ DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE+ POSSIBILITY OF SUCH DAMAGE.++ghc-bignum LICENSE file:++ The Glasgow Haskell Compiler License++ Copyright 2020, The University Court of the University of Glasgow.+ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ - Redistributions of source code must retain the above copyright notice,+ this list of conditions and the following disclaimer.++ - Redistributions in binary form must reproduce the above copyright notice,+ this list of conditions and the following disclaimer in the documentation+ and/or other materials provided with the distribution.++ - Neither name of the University nor the names of its contributors may be+ used to endorse or promote products derived from this software without+ specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH+ DAMAGE.++ghc-prim LICENSE file:++ This library (libraries/ghc-prim) is derived from code from several+ sources:++ * Code from the GHC project which is largely (c) The University of+ Glasgow, and distributable under a BSD-style license (see below),++ * Code from the Haskell 98 Report which is (c) Simon Peyton Jones+ and freely redistributable (but see the full license for+ restrictions).++ The full text of these licenses is reproduced below. All of the+ licenses are BSD-style or compatible.++ -----------------------------------------------------------------------------++ The Glasgow Haskell Compiler License++ Copyright 2004, The University Court of the University of Glasgow.+ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ - Redistributions of source code must retain the above copyright notice,+ this list of conditions and the following disclaimer.++ - Redistributions in binary form must reproduce the above copyright notice,+ this list of conditions and the following disclaimer in the documentation+ and/or other materials provided with the distribution.++ - Neither name of the University nor the names of its contributors may be+ used to endorse or promote products derived from this software without+ specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH+ DAMAGE.++ -----------------------------------------------------------------------------++ Code derived from the document "Report on the Programming Language+ Haskell 98", is distributed under the following license:++ Copyright (c) 2002 Simon Peyton Jones++ The authors intend this Report to belong to the entire Haskell+ community, and so we grant permission to copy and distribute it for+ any purpose, provided that it is reproduced in its entirety,+ including this Notice. Modified versions of this Report may also be+ copied and distributed for any purpose, provided that the modified+ version is clearly presented as such, and that it does not claim to+ be a definition of the Haskell 98 Language.+++half LICENSE file:++ Copyright 2014 Edward Kmett++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions+ are met:++ 1. Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ 2. Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.++ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+ DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE+ POSSIBILITY OF SUCH DAMAGE.++happy LICENSE file:++ The Happy License+ -----------------++ Copyright 2001, Simon Marlow and Andy Gill. All rights reserved.++ Extensions to implement Tomita's Generalized LR parsing:+ Copyright 2004, University of Durham, Paul Callaghan and Ben Medlock.+ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ - Redistributions of source code must retain the above copyright notice,+ this list of conditions and the following disclaimer.++ - Redistributions in binary form must reproduce the above copyright notice,+ this list of conditions and the following disclaimer in the documentation+ and/or other materials provided with the distribution.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY+ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR+ BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++hashable LICENSE file:++ Copyright Milan Straka 2010++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Milan Straka nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++haskeline LICENSE file:++ Copyright 2007 Judah Jacobson++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ 1. Redistributions of source code must retain the above copyright notice, this+ list of conditions and the following disclaimer.++ 2. Redistributions in binary form must reproduce the above copyright notice,+ this list of conditions and the following disclaimer in the documentation+ and/or other materials provided with the distribution.++ 3. Neither the name of the copyright holder nor the names of its contributors+ may be used to endorse or promote products derived from this software without+ specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++indexed-traversable LICENSE file:++ Copyright 2012-2016 Edward Kmett++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions+ are met:++ 1. Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ 2. Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.++ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+ DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE+ POSSIBILITY OF SUCH DAMAGE.++indexed-traversable-instances LICENSE file:++ Copyright 2012-2016 Edward Kmett++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions+ are met:++ 1. Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ 2. Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.++ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+ DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE+ POSSIBILITY OF SUCH DAMAGE.++integer-gmp LICENSE file:++ Copyright (c) 2014, Herbert Valerio Riedel++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Herbert Valerio Riedel nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++integer-logarithms LICENSE file:++ Copyright (c) 2011 Daniel Fischer, 2017 Oleg Grenrus++ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and+ associated documentation files (the "Software"), to deal in the Software without restriction,+ including without limitation the rights to use, copy, modify, merge, publish, distribute,+ sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is+ furnished to do so, subject to the following conditions:++ The above copyright notice and this permission notice shall be included in all copies or+ substantial portions of the Software.++ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT+ LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.++invariant LICENSE file:++ Copyright (c) 2012-2017, University of Kansas+ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright notice, this+ list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above copyright notice,+ this list of conditions and the following disclaimer in the documentation+ and/or other materials provided with the distribution.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++kan-extensions LICENSE file:++ Copyright 2008-2016 Edward Kmett++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions+ are met:++ 1. Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ 2. Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.++ 3. Neither the name of the author nor the names of his contributors+ may be used to endorse or promote products derived from this software+ without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+ DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE+ POSSIBILITY OF SUCH DAMAGE.++language-javascript LICENSE file:++ Copyright (c)2010, Alan Zimmerman++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Alan Zimmerman nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++lens LICENSE file:++ Copyright 2012-2016 Edward Kmett++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions+ are met:++ 1. Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ 2. Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.++ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+ DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE+ POSSIBILITY OF SUCH DAMAGE.++lifted-async LICENSE file:++ Copyright (c) 2012-2017, Mitsutoshi Aoe++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Mitsutoshi Aoe nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++lifted-base LICENSE file:++ Copyright © 2010-2012, Bas van Dijk, Anders Kaseorg+ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are+ met:++ • Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ • Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.++ • Neither the name of the author nor the names of other contributors+ may be used to endorse or promote products derived from this+ software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++memory LICENSE file:++ Copyright (c) 2015-2018 Vincent Hanquez <vincent@snarc.org>+ Copyright (c) 2017-2018 Nicolas Di Prima <nicolas@primetype.co.uk>++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions+ are met:++ 1. Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.+ 2. Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.+ 3. Neither the name of the author nor the names of his contributors+ may be used to endorse or promote products derived from this software+ without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS AS IS'' AND+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF+ SUCH DAMAGE.++monad-control LICENSE file:++ Copyright © 2010, Bas van Dijk, Anders Kaseorg+ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are+ met:++ • Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ • Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.++ • Neither the name of the author nor the names of other contributors+ may be used to endorse or promote products derived from this+ software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++monad-logger LICENSE file:++ Copyright (c) 2012 Michael Snoyman, http://www.yesodweb.com/++ Permission is hereby granted, free of charge, to any person obtaining+ a copy of this software and associated documentation files (the+ "Software"), to deal in the Software without restriction, including+ without limitation the rights to use, copy, modify, merge, publish,+ distribute, sublicense, and/or sell copies of the Software, and to+ permit persons to whom the Software is furnished to do so, subject to+ the following conditions:++ The above copyright notice and this permission notice shall be+ included in all copies or substantial portions of the Software.++ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.++mono-traversable LICENSE file:++ Copyright (c) 2013 Michael Snoyman, http://www.fpcomplete.com/++ Permission is hereby granted, free of charge, to any person obtaining+ a copy of this software and associated documentation files (the+ "Software"), to deal in the Software without restriction, including+ without limitation the rights to use, copy, modify, merge, publish,+ distribute, sublicense, and/or sell copies of the Software, and to+ permit persons to whom the Software is furnished to do so, subject to+ the following conditions:++ The above copyright notice and this permission notice shall be+ included in all copies or substantial portions of the Software.++ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.++monoidal-containers LICENSE file:++ Copyright (c) 2015, Ben Gamari++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Ben Gamari nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++mtl LICENSE file:++ The Glasgow Haskell Compiler License++ Copyright 2004, The University Court of the University of Glasgow.+ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ - Redistributions of source code must retain the above copyright notice,+ this list of conditions and the following disclaimer.++ - Redistributions in binary form must reproduce the above copyright notice,+ this list of conditions and the following disclaimer in the documentation+ and/or other materials provided with the distribution.++ - Neither name of the University nor the names of its contributors may be+ used to endorse or promote products derived from this software without+ specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH+ DAMAGE.++mtl-compat LICENSE file:++ Copyright (c) 2015-2017, Ryan Scott++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Ryan Scott nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++network LICENSE file:++ Copyright (c) 2002-2010, The University Court of the University of Glasgow.+ Copyright (c) 2007-2010, Johan Tibell++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ - Redistributions of source code must retain the above copyright notice,+ this list of conditions and the following disclaimer.++ - Redistributions in binary form must reproduce the above copyright notice,+ this list of conditions and the following disclaimer in the documentation+ and/or other materials provided with the distribution.++ - Neither name of the University nor the names of its contributors may be+ used to endorse or promote products derived from this software without+ specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH+ DAMAGE.++network-uri LICENSE file:++ Copyright (c) 2002-2010, The University Court of the University of Glasgow.+ Copyright (c) 2007-2010, Johan Tibell++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ - Redistributions of source code must retain the above copyright notice,+ this list of conditions and the following disclaimer.++ - Redistributions in binary form must reproduce the above copyright notice,+ this list of conditions and the following disclaimer in the documentation+ and/or other materials provided with the distribution.++ - Neither name of the University nor the names of its contributors may be+ used to endorse or promote products derived from this software without+ specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH+ DAMAGE.++newtype LICENSE file:++ Copyright (c) 2011, Darius Jahandarie+ 2019, Herbert Valerio Riedel++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Darius Jahandarie nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++old-locale LICENSE file:++ This library (libraries/base) is derived from code from two+ sources:++ * Code from the GHC project which is largely (c) The University of+ Glasgow, and distributable under a BSD-style license (see below),++ * Code from the Haskell 98 Report which is (c) Simon Peyton Jones+ and freely redistributable (but see the full license for+ restrictions).++ The full text of these licenses is reproduced below. Both of the+ licenses are BSD-style or compatible.++ -----------------------------------------------------------------------------++ The Glasgow Haskell Compiler License++ Copyright 2004, The University Court of the University of Glasgow.+ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ - Redistributions of source code must retain the above copyright notice,+ this list of conditions and the following disclaimer.++ - Redistributions in binary form must reproduce the above copyright notice,+ this list of conditions and the following disclaimer in the documentation+ and/or other materials provided with the distribution.++ - Neither name of the University nor the names of its contributors may be+ used to endorse or promote products derived from this software without+ specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH+ DAMAGE.++ -----------------------------------------------------------------------------++ Code derived from the document "Report on the Programming Language+ Haskell 98", is distributed under the following license:++ Copyright (c) 2002 Simon Peyton Jones++ The authors intend this Report to belong to the entire Haskell+ community, and so we grant permission to copy and distribute it for+ any purpose, provided that it is reproduced in its entirety,+ including this Notice. Modified versions of this Report may also be+ copied and distributed for any purpose, provided that the modified+ version is clearly presented as such, and that it does not claim to+ be a definition of the Haskell 98 Language.++ -----------------------------------------------------------------------------++old-time LICENSE file:++ This library (libraries/base) is derived from code from two+ sources:++ * Code from the GHC project which is largely (c) The University of+ Glasgow, and distributable under a BSD-style license (see below),++ * Code from the Haskell 98 Report which is (c) Simon Peyton Jones+ and freely redistributable (but see the full license for+ restrictions).++ The full text of these licenses is reproduced below. Both of the+ licenses are BSD-style or compatible.++ -----------------------------------------------------------------------------++ The Glasgow Haskell Compiler License++ Copyright 2004, The University Court of the University of Glasgow.+ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ - Redistributions of source code must retain the above copyright notice,+ this list of conditions and the following disclaimer.++ - Redistributions in binary form must reproduce the above copyright notice,+ this list of conditions and the following disclaimer in the documentation+ and/or other materials provided with the distribution.++ - Neither name of the University nor the names of its contributors may be+ used to endorse or promote products derived from this software without+ specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH+ DAMAGE.++ -----------------------------------------------------------------------------++ Code derived from the document "Report on the Programming Language+ Haskell 98", is distributed under the following license:++ Copyright (c) 2002 Simon Peyton Jones++ The authors intend this Report to belong to the entire Haskell+ community, and so we grant permission to copy and distribute it for+ any purpose, provided that it is reproduced in its entirety,+ including this Notice. Modified versions of this Report may also be+ copied and distributed for any purpose, provided that the modified+ version is clearly presented as such, and that it does not claim to+ be a definition of the Haskell 98 Language.++ -----------------------------------------------------------------------------++optparse-applicative LICENSE file:++ Copyright (c) 2012, Paolo Capriotti++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Paolo Capriotti nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++parallel LICENSE file:++ This library (libraries/parallel) is derived from code from+ the GHC project which is largely (c) The University of+ Glasgow, and distributable under a BSD-style license (see below).++ -----------------------------------------------------------------------------++ The Glasgow Haskell Compiler License++ Copyright 2004, The University Court of the University of Glasgow.+ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ - Redistributions of source code must retain the above copyright notice,+ this list of conditions and the following disclaimer.++ - Redistributions in binary form must reproduce the above copyright notice,+ this list of conditions and the following disclaimer in the documentation+ and/or other materials provided with the distribution.++ - Neither name of the University nor the names of its contributors may be+ used to endorse or promote products derived from this software without+ specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH+ DAMAGE.++ -----------------------------------------------------------------------------++parsec LICENSE file:++ Copyright 1999-2000, Daan Leijen; 2007, Paolo Martini. All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright notice,+ this list of conditions and the following disclaimer.+ * Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.++ This software is provided by the copyright holders "as is" and any express or+ implied warranties, including, but not limited to, the implied warranties of+ merchantability and fitness for a particular purpose are disclaimed. In no+ event shall the copyright holders be liable for any direct, indirect,+ incidental, special, exemplary, or consequential damages (including, but not+ limited to, procurement of substitute goods or services; loss of use, data,+ or profits; or business interruption) however caused and on any theory of+ liability, whether in contract, strict liability, or tort (including+ negligence or otherwise) arising in any way out of the use of this software,+ even if advised of the possibility of such damage.++pattern-arrows LICENSE file:++ The MIT License (MIT)++ Copyright (c) 2013 Phil Freeman++ Permission is hereby granted, free of charge, to any person obtaining a copy of+ this software and associated documentation files (the "Software"), to deal in+ the Software without restriction, including without limitation the rights to+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of+ the Software, and to permit persons to whom the Software is furnished to do so,+ subject to the following conditions:++ The above copyright notice and this permission notice shall be included in all+ copies or substantial portions of the Software.++ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.++pretty LICENSE file:++ This library (libraries/pretty) is derived from code from+ the GHC project which is largely (c) The University of+ Glasgow, and distributable under a BSD-style license (see below).++ -----------------------------------------------------------------------------++ The Glasgow Haskell Compiler License++ Copyright 2004, The University Court of the University of Glasgow.+ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ - Redistributions of source code must retain the above copyright notice,+ this list of conditions and the following disclaimer.++ - Redistributions in binary form must reproduce the above copyright notice,+ this list of conditions and the following disclaimer in the documentation+ and/or other materials provided with the distribution.++ - Neither name of the University nor the names of its contributors may be+ used to endorse or promote products derived from this software without+ specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH+ DAMAGE.++ -----------------------------------------------------------------------------++primitive LICENSE file:++ Copyright (c) 2008-2009, Roman Leshchinskiy+ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ - Redistributions of source code must retain the above copyright notice,+ this list of conditions and the following disclaimer.++ - Redistributions in binary form must reproduce the above copyright notice,+ this list of conditions and the following disclaimer in the documentation+ and/or other materials provided with the distribution.++ - Neither name of the University nor the names of its contributors may be+ used to endorse or promote products derived from this software without+ specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH+ DAMAGE.+++process LICENSE file:++ This library (libraries/process) is derived from code from two+ sources:++ * Code from the GHC project which is largely (c) The University of+ Glasgow, and distributable under a BSD-style license (see below),++ * Code from the Haskell 98 Report which is (c) Simon Peyton Jones+ and freely redistributable (but see the full license for+ restrictions).++ The full text of these licenses is reproduced below. Both of the+ licenses are BSD-style or compatible.++ -----------------------------------------------------------------------------++ The Glasgow Haskell Compiler License++ Copyright 2004, The University Court of the University of Glasgow.+ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ - Redistributions of source code must retain the above copyright notice,+ this list of conditions and the following disclaimer.++ - Redistributions in binary form must reproduce the above copyright notice,+ this list of conditions and the following disclaimer in the documentation+ and/or other materials provided with the distribution.++ - Neither name of the University nor the names of its contributors may be+ used to endorse or promote products derived from this software without+ specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH+ DAMAGE.++ -----------------------------------------------------------------------------++ Code derived from the document "Report on the Programming Language+ Haskell 98", is distributed under the following license:++ Copyright (c) 2002 Simon Peyton Jones++ The authors intend this Report to belong to the entire Haskell+ community, and so we grant permission to copy and distribute it for+ any purpose, provided that it is reproduced in its entirety,+ including this Notice. Modified versions of this Report may also be+ copied and distributed for any purpose, provided that the modified+ version is clearly presented as such, and that it does not claim to+ be a definition of the Haskell 98 Language.++ -----------------------------------------------------------------------------++profunctors LICENSE file:++ Copyright 2011-2015 Edward Kmett++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions+ are met:++ 1. Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ 2. Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.++ 3. Neither the name of the author nor the names of his contributors+ may be used to endorse or promote products derived from this software+ without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+ DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE+ POSSIBILITY OF SUCH DAMAGE.++protolude LICENSE file:++ Copyright (c) 2016-2020, Stephen Diehl++ Permission is hereby granted, free of charge, to any person obtaining a copy+ of this software and associated documentation files (the "Software"), to+ deal in the Software without restriction, including without limitation the+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or+ sell copies of the Software, and to permit persons to whom the Software is+ furnished to do so, subject to the following conditions:++ The above copyright notice and this permission notice shall be included in+ all copies or substantial portions of the Software.++ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS+ IN THE SOFTWARE.++random LICENSE file:++ This library (libraries/base) is derived from code from two+ sources:++ * Code from the GHC project which is largely (c) The University of+ Glasgow, and distributable under a BSD-style license (see below),++ * Code from the Haskell 98 Report which is (c) Simon Peyton Jones+ and freely redistributable (but see the full license for+ restrictions).++ The full text of these licenses is reproduced below. Both of the+ licenses are BSD-style or compatible.++ -----------------------------------------------------------------------------++ The Glasgow Haskell Compiler License++ Copyright 2004, The University Court of the University of Glasgow.+ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ - Redistributions of source code must retain the above copyright notice,+ this list of conditions and the following disclaimer.++ - Redistributions in binary form must reproduce the above copyright notice,+ this list of conditions and the following disclaimer in the documentation+ and/or other materials provided with the distribution.++ - Neither name of the University nor the names of its contributors may be+ used to endorse or promote products derived from this software without+ specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH+ DAMAGE.++ -----------------------------------------------------------------------------++ Code derived from the document "Report on the Programming Language+ Haskell 98", is distributed under the following license:++ Copyright (c) 2002 Simon Peyton Jones++ The authors intend this Report to belong to the entire Haskell+ community, and so we grant permission to copy and distribute it for+ any purpose, provided that it is reproduced in its entirety,+ including this Notice. Modified versions of this Report may also be+ copied and distributed for any purpose, provided that the modified+ version is clearly presented as such, and that it does not claim to+ be a definition of the Haskell 98 Language.++ -----------------------------------------------------------------------------++reflection LICENSE file:++ Copyright (c) 2009-2013 Edward Kmett+ Copyright (c) 2004 Oleg Kiselyov and Chung-chieh Shan+ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are+ met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Edward Kmett nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++regex-base LICENSE file:++ Copyright (c) 2007, Christopher Kuklewicz+ All rights reserved.++ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.++ * The names of the contributors may not be used to endorse or promote products derived from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++regex-tdfa LICENSE file:++ This modile is under this "3 clause" BSD license:++ Copyright (c) 2007-2009, Christopher Kuklewicz+ All rights reserved.++ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.+ * The names of the contributors may not be used to endorse or promote products derived from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++resourcet LICENSE file:++ Copyright (c)2011, Michael Snoyman++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Michael Snoyman nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++safe LICENSE file:++ Copyright Neil Mitchell 2007-2020.+ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are+ met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Neil Mitchell nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++scientific LICENSE file:++ Copyright (c) 2013, Bas van Dijk++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Bas van Dijk nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++semialign LICENSE file:++ Copyright (c) 2012, C. McCann, 2015-2019 Oleg Grenrus++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of C. McCann nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++semigroupoids LICENSE file:++ Copyright 2011-2015 Edward Kmett++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions+ are met:++ 1. Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ 2. Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.++ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+ DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE+ POSSIBILITY OF SUCH DAMAGE.++semigroups LICENSE file:++ Copyright 2011-2015 Edward Kmett++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions+ are met:++ 1. Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ 2. Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.++ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+ DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE+ POSSIBILITY OF SUCH DAMAGE.++serialise LICENSE file:++ Copyright (c) 2017, Duncan Coutts++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Duncan Coutts nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++sourcemap LICENSE file:++ Copyright (c) 2012, Chris Done++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Chris Done nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++split LICENSE file:++ Copyright (c) 2008 Brent Yorgey, Louis Wasserman++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions+ are met:+ 1. Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.+ 2. Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.+ 3. Neither the name of the author nor the names of other contributors+ may be used to endorse or promote products derived from this software+ without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF+ SUCH DAMAGE.++splitmix LICENSE file:++ Copyright (c) 2017, Oleg Grenrus++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Oleg Grenrus nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++stm LICENSE file:++ The Glasgow Haskell Compiler License++ Copyright 2004, The University Court of the University of Glasgow.+ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ - Redistributions of source code must retain the above copyright notice,+ this list of conditions and the following disclaimer.++ - Redistributions in binary form must reproduce the above copyright notice,+ this list of conditions and the following disclaimer in the documentation+ and/or other materials provided with the distribution.++ - Neither name of the University nor the names of its contributors may be+ used to endorse or promote products derived from this software without+ specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH+ DAMAGE.++stm-chans LICENSE file:++ === stm-chans license ===++ Copyright (c) 2011--2013, wren gayle romano.+ ALL RIGHTS RESERVED.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions+ are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of the copyright holders nor the names of+ other contributors may be used to endorse or promote products+ derived from this software without specific prior written+ permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS+ FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE+ COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE+ POSSIBILITY OF SUCH DAMAGE.+++streaming-commons LICENSE file:++ The MIT License (MIT)++ Copyright (c) 2014 FP Complete++ Permission is hereby granted, free of charge, to any person obtaining a copy+ of this software and associated documentation files (the "Software"), to deal+ in the Software without restriction, including without limitation the rights+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+ copies of the Software, and to permit persons to whom the Software is+ furnished to do so, subject to the following conditions:++ The above copyright notice and this permission notice shall be included in all+ copies or substantial portions of the Software.++ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+ SOFTWARE.++strict LICENSE file:++ Copyright (c) Roman Leshchinskiy 2006-2007++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions+ are met:++ 1. Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.+ 2. Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.+ 3. Neither the name of the author nor the names of his contributors+ may be used to endorse or promote products derived from this software+ without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF+ SUCH DAMAGE.++stringsearch LICENSE file:++ Copyright (c)2010, Daniel Fischer++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Daniel Fischer nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++syb LICENSE file:++ This library (libraries/syb) is derived from code from several+ sources:++ * Code from the GHC project which is largely (c) The University of+ Glasgow, and distributable under a BSD-style license (see below),++ * Code from the Haskell 98 Report which is (c) Simon Peyton Jones+ and freely redistributable (but see the full license for+ restrictions).++ * Code from the Haskell Foreign Function Interface specification,+ which is (c) Manuel M. T. Chakravarty and freely redistributable+ (but see the full license for restrictions).++ The full text of these licenses is reproduced below. All of the+ licenses are BSD-style or compatible.++ -----------------------------------------------------------------------------++ The Glasgow Haskell Compiler License++ Copyright 2004, The University Court of the University of Glasgow.+ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ - Redistributions of source code must retain the above copyright notice,+ this list of conditions and the following disclaimer.++ - Redistributions in binary form must reproduce the above copyright notice,+ this list of conditions and the following disclaimer in the documentation+ and/or other materials provided with the distribution.++ - Neither name of the University nor the names of its contributors may be+ used to endorse or promote products derived from this software without+ specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH+ DAMAGE.++ -----------------------------------------------------------------------------++ Code derived from the document "Report on the Programming Language+ Haskell 98", is distributed under the following license:++ Copyright (c) 2002 Simon Peyton Jones++ The authors intend this Report to belong to the entire Haskell+ community, and so we grant permission to copy and distribute it for+ any purpose, provided that it is reproduced in its entirety,+ including this Notice. Modified versions of this Report may also be+ copied and distributed for any purpose, provided that the modified+ version is clearly presented as such, and that it does not claim to+ be a definition of the Haskell 98 Language.++ -----------------------------------------------------------------------------++ Code derived from the document "The Haskell 98 Foreign Function+ Interface, An Addendum to the Haskell 98 Report" is distributed under+ the following license:++ Copyright (c) 2002 Manuel M. T. Chakravarty++ The authors intend this Report to belong to the entire Haskell+ community, and so we grant permission to copy and distribute it for+ any purpose, provided that it is reproduced in its entirety,+ including this Notice. Modified versions of this Report may also be+ copied and distributed for any purpose, provided that the modified+ version is clearly presented as such, and that it does not claim to+ be a definition of the Haskell 98 Foreign Function Interface.++ -----------------------------------------------------------------------------++tagged LICENSE file:++ Copyright (c) 2009-2015 Edward Kmett+ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are+ met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Edward Kmett nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++tagsoup LICENSE file:++ Copyright Neil Mitchell 2006-2019.+ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are+ met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Neil Mitchell nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++template-haskell LICENSE file:+++ The Glasgow Haskell Compiler License++ Copyright 2002-2007, The University Court of the University of Glasgow.+ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ - Redistributions of source code must retain the above copyright notice,+ this list of conditions and the following disclaimer.++ - Redistributions in binary form must reproduce the above copyright notice,+ this list of conditions and the following disclaimer in the documentation+ and/or other materials provided with the distribution.++ - Neither name of the University nor the names of its contributors may be+ used to endorse or promote products derived from this software without+ specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH+ DAMAGE.+++text LICENSE file:++ Copyright (c) 2008-2009, Tom Harper+ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions+ are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++text-short LICENSE file:++ Copyright (c) 2017, Herbert Valerio Riedel++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Herbert Valerio Riedel nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++th-abstraction LICENSE file:++ Copyright (c) 2017-2020 Eric Mertens++ Permission to use, copy, modify, and/or distribute this software for any purpose+ with or without fee is hereby granted, provided that the above copyright notice+ and this permission notice appear in all copies.++ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND+ FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS+ OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER+ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF+ THIS SOFTWARE.++th-compat LICENSE file:++ Copyright (c) 2020, Ryan Scott++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Ryan Scott nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++these LICENSE file:++ Copyright (c) 2012, C. McCann, 2015-2019 Oleg Grenrus++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of C. McCann nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++time LICENSE file:++ TimeLib is Copyright (c) Ashley Yakeley and contributors, 2004-2020. All rights reserved.+ Certain sections are Copyright 2004, The University Court of the University of Glasgow. All rights reserved.++ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:++ - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.++ - Neither name of the copyright holders nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++time-compat LICENSE file:++ Copyright (c) 2019 time contibutors, Oleg Grenrus++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Oleg Grenrus nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++transformers LICENSE file:++ The Glasgow Haskell Compiler License++ Copyright 2004, The University Court of the University of Glasgow.+ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ - Redistributions of source code must retain the above copyright notice,+ this list of conditions and the following disclaimer.++ - Redistributions in binary form must reproduce the above copyright notice,+ this list of conditions and the following disclaimer in the documentation+ and/or other materials provided with the distribution.++ - Neither name of the University nor the names of its contributors may be+ used to endorse or promote products derived from this software without+ specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH+ DAMAGE.++transformers-base LICENSE file:++ Copyright (c) 2011, Mikhail Vorozhtsov, Bas van Dijk+ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ - Redistributions of source code must retain the above copyright notice,+ this list of conditions and the following disclaimer.+ - Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.+ - Neither the names of the copyright owners nor the names of the+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+++transformers-compat LICENSE file:++ Copyright 2012-2015 Edward Kmett++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions+ are met:++ 1. Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ 2. Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.++ 3. Neither the name of the author nor the names of his contributors+ may be used to endorse or promote products derived from this software+ without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+ DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE+ POSSIBILITY OF SUCH DAMAGE.++type-equality LICENSE file:++ Copyright (c) 2009 Erik Hesselink, 2019 Oleg Grenrus, Ryan Scott++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of authors nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++typed-process LICENSE file:++ Copyright (c) 2016 FP Complete, https://www.fpcomplete.com/++ Permission is hereby granted, free of charge, to any person obtaining+ a copy of this software and associated documentation files (the+ "Software"), to deal in the Software without restriction, including+ without limitation the rights to use, copy, modify, merge, publish,+ distribute, sublicense, and/or sell copies of the Software, and to+ permit persons to whom the Software is furnished to do so, subject to+ the following conditions:++ The above copyright notice and this permission notice shall be+ included in all copies or substantial portions of the Software.++ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.++uniplate LICENSE file:++ Copyright Neil Mitchell 2006-2020.+ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are+ met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Neil Mitchell nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++unix LICENSE file:++ The Glasgow Haskell Compiler License++ Copyright 2004, The University Court of the University of Glasgow.+ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ - Redistributions of source code must retain the above copyright notice,+ this list of conditions and the following disclaimer.++ - Redistributions in binary form must reproduce the above copyright notice,+ this list of conditions and the following disclaimer in the documentation+ and/or other materials provided with the distribution.++ - Neither name of the University nor the names of its contributors may be+ used to endorse or promote products derived from this software without+ specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH+ DAMAGE.++unix-compat LICENSE file:++ Copyright (c) 2007-2008, Björn Bringert+ Copyright (c) 2007-2009, Duncan Coutts+ Copyright (c) 2010-2011, Jacob Stanley+ Copyright (c) 2011, Bryan O'Sullivan+ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ - Redistributions of source code must retain the above copyright notice,+ this list of conditions and the following disclaimer.+ - Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.+ - Neither the names of the copyright owners nor the names of the+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++unix-time LICENSE file:++ Copyright (c) 2009, IIJ Innovation Institute Inc.+ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions+ are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.+ * Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in+ the documentation and/or other materials provided with the+ distribution.+ * Neither the name of the copyright holders nor the names of its+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS+ FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE+ COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE+ POSSIBILITY OF SUCH DAMAGE.++unliftio-core LICENSE file:++ Copyright (c) 2017 FP Complete++ Permission is hereby granted, free of charge, to any person obtaining+ a copy of this software and associated documentation files (the+ "Software"), to deal in the Software without restriction, including+ without limitation the rights to use, copy, modify, merge, publish,+ distribute, sublicense, and/or sell copies of the Software, and to+ permit persons to whom the Software is furnished to do so, subject to+ the following conditions:++ The above copyright notice and this permission notice shall be included+ in all copies or substantial portions of the Software.++ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.++unordered-containers LICENSE file:++ Copyright (c) 2010, Johan Tibell++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Johan Tibell nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++utf8-string LICENSE file:++ * Copyright (c) 2007, Galois Inc.+ * All rights reserved.+ *+ * Redistribution and use in source and binary forms, with or without+ * modification, are permitted provided that the following conditions are met:+ * * Redistributions of source code must retain the above copyright+ * notice, this list of conditions and the following disclaimer.+ * * Redistributions in binary form must reproduce the above copyright+ * notice, this list of conditions and the following disclaimer in the+ * documentation and/or other materials provided with the distribution.+ * * Neither the name of Galois Inc. nor the+ * names of its contributors may be used to endorse or promote products+ * derived from this software without specific prior written permission.+ *+ * THIS SOFTWARE IS PROVIDED BY Galois Inc. ``AS IS'' AND ANY+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+ * DISCLAIMED. IN NO EVENT SHALL Galois Inc. BE LIABLE FOR ANY+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++uuid-types LICENSE file:++ Copyright (c) 2008, Antoine Latter++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are+ met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.+ * Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.+ * The names of the authors may not be used to endorse or promote+ products derived from this software without specific prior written+ permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED+ TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++vector LICENSE file:++ Copyright (c) 2008-2012, Roman Leshchinskiy+ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ - Redistributions of source code must retain the above copyright notice,+ this list of conditions and the following disclaimer.++ - Redistributions in binary form must reproduce the above copyright notice,+ this list of conditions and the following disclaimer in the documentation+ and/or other materials provided with the distribution.++ - Neither name of the University nor the names of its contributors may be+ used to endorse or promote products derived from this software without+ specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH+ DAMAGE.+++vector-algorithms LICENSE file:++ Copyright (c) 2015 Dan Doel+ Copyright (c) 2015 Tim Baumann++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions+ are met:++ 1. Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ 2. Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.++ 3. Neither the name of the author nor the names of his contributors+ may be used to endorse or promote products derived from this software+ without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+ DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE+ POSSIBILITY OF SUCH DAMAGE.++ ------------------------------------------------------------------------------++ The code in Data.Array.Vector.Algorithms.Mutable.Optimal is adapted from a C+ algorithm for the same purpose. The folowing is the copyright notice for said+ C code:++ Copyright (c) 2004 Paul Hsieh+ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ Redistributions of source code must retain the above copyright notice,+ this list of conditions and the following disclaimer.++ Redistributions in binary form must reproduce the above copyright notice,+ this list of conditions and the following disclaimer in the documentation+ and/or other materials provided with the distribution.++ Neither the name of sorttest nor the names of its contributors may be+ used to endorse or promote products derived from this software without+ specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE+ POSSIBILITY OF SUCH DAMAGE.++void LICENSE file:++ Copyright 2015 Edward Kmett++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions+ are met:++ 1. Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ 2. Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.++ 3. Neither the name of the author nor the names of his contributors+ may be used to endorse or promote products derived from this software+ without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+ DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE+ POSSIBILITY OF SUCH DAMAGE.++witherable LICENSE file:++ Copyright (c) 2014, Fumiaki Kinoshita++ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Fumiaki Kinoshita nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++xss-sanitize LICENSE file:++ The following license covers this documentation, and the source code, except+ where otherwise indicated.++ Copyright 2010, Greg Weber. All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright notice, this+ list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above copyright notice,+ this list of conditions and the following disclaimer in the documentation+ and/or other materials provided with the distribution.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY EXPRESS OR+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO+ EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT+ NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,+ OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++zlib LICENSE file:++ Copyright (c) 2006-2016, Duncan Coutts+ All rights reserved.++ Redistribution and use in source and binary forms, with or without+ modification, are permitted provided that the following conditions are met:++ 1. Redistributions of source code must retain the above copyright notice,+ this list of conditions and the following disclaimer.+ 2. Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.+ 3. This clause is intentionally left blank.++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE+ POSSIBILITY OF SUCH DAMAGE.+
+ README.md view
@@ -0,0 +1,33 @@+<img src="logo.png" alt="PureScript" width="392">++A small strongly typed programming language with expressive types that compiles to JavaScript, written in and inspired by Haskell.++[](http://hackage.haskell.org/package/purescript) [](https://github.com/purescript/purescript/actions/workflows/ci.yml)++## Language info++- [PureScript home](http://purescript.org)+- [Releases & changelog](https://github.com/purescript/purescript/releases)+- [Contributing to PureScript](https://github.com/purescript/purescript/blob/master/CONTRIBUTING.md)++## Resources++- [PureScript book](https://book.purescript.org/)+- [Documentation](https://github.com/purescript/documentation)+- [Try PureScript](http://try.purescript.org)+- [Pursuit Package Index](http://pursuit.purescript.org/)++## Help!++### Community Spaces++The following spaces are governed by the [PureScript Community Code of Conduct](https://github.com/purescript/governance/blob/master/CODE_OF_CONDUCT.md). The majority of PureScript users use these spaces to discuss and collaborate on PureScript-related topics:+- [PureScript Discord](https://purescript.org/chat)+- [PureScript Discourse](https://discourse.purescript.org/)++### Unaffiliated Spaces++Some PureScript users also collaborate in the below spaces. These do not fall under the code of conduct linked above. They may have no code of conduct or one very different than the one linked above.+- [PureScript Matrix](https://matrix.to/#/#purescript:matrix.org)+- [PureScript on StackOverflow](http://stackoverflow.com/questions/tagged/purescript)+- [The `#purescript` channel on Libera.Chat](https://libera.chat/)
+ VERSIONING_POLICY.md view
@@ -0,0 +1,9 @@+# Versioning Policy++PureScript can be perceived from two different perspectives:+1. PureScript-the-application (e.g. using `purs` to compile code)+1. PureScript-the-library (e.g. building a tool that depends on the [`purescript` package](https://hackage.haskell.org/package/purescript))++This project is versioned using [SemVer 2.0.0](https://semver.org/), not [PVP](https://pvp.haskell.org/) because users of PureScript-the-application are the intended audience. Thus, breaking changes to PureScript-the-application are reflected in this project's version. Since `CoreFn` is considered part of PureScript-the-application, a breaking change to that format is reflected in the project version.++Since PureScript-the-library is used by internal tools like [Try PureScript](https://github.com/purescript/trypurescript) and [Pursuit](https://github.com/purescript/pursuit), it must be published to Hackage as a library. However, PureScript-the-library is considered unstable and can make breaking changes to library users without reflecting that in the version.
+ app/Command/Bundle.hs view
@@ -0,0 +1,23 @@+-- | Bundles compiled PureScript modules for the browser.+module Command.Bundle (command) where++import Prelude++import System.Exit (exitFailure)+import System.IO (stderr, hPutStrLn)+import Options.Applicative qualified as Opts++app :: IO ()+app = do+ hPutStrLn stderr $ unlines+ [ "'purs bundle' was removed in the v0.15.0 release."+ , "See https://github.com/purescript/documentation/blob/master/migration-guides/0.15-Migration-Guide.md"+ , "for more information and bundler alternatives."+ ]+ exitFailure++-- | Make it go.+command :: Opts.Parser (IO ())+command = run <$> (Opts.helper <*> pure ()) where+ run :: () -> IO ()+ run _ = app
+ app/Command/Compile.hs view
@@ -0,0 +1,155 @@+module Command.Compile (command) where++import Prelude++import Control.Applicative (Alternative(..))+import Control.Monad (when)+import Data.Aeson qualified as A+import Data.Bool (bool)+import Data.ByteString.Lazy.UTF8 qualified as LBU8+import Data.List (intercalate)+import Data.Map qualified as M+import Data.Set qualified as S+import Data.Text qualified as T+import Data.Traversable (for)+import Language.PureScript qualified as P+import Language.PureScript.CST qualified as CST+import Language.PureScript.Errors.JSON (JSONResult(..), toJSONErrors)+import Language.PureScript.Glob (toInputGlobs, PSCGlobs(..), warnFileTypeNotFound)+import Language.PureScript.Make (buildMakeActions, inferForeignModules, runMake)+import Options.Applicative qualified as Opts+import SharedCLI qualified+import System.Console.ANSI qualified as ANSI+import System.Exit (exitSuccess, exitFailure)+import System.Directory (getCurrentDirectory)+import System.IO (hPutStr, stderr, stdout)+import System.IO.UTF8 (readUTF8FilesT)++data PSCMakeOptions = PSCMakeOptions+ { pscmInput :: [FilePath]+ , pscmInputFromFile :: Maybe FilePath+ , pscmExclude :: [FilePath]+ , pscmOutputDir :: FilePath+ , pscmOpts :: P.Options+ , pscmUsePrefix :: Bool+ , pscmJSONErrors :: Bool+ }++-- | Arguments: verbose, use JSON, warnings, errors+printWarningsAndErrors :: Bool -> Bool -> [(FilePath, T.Text)] -> P.MultipleErrors -> Either P.MultipleErrors a -> IO ()+printWarningsAndErrors verbose False files warnings errors = do+ pwd <- getCurrentDirectory+ cc <- bool Nothing (Just P.defaultCodeColor) <$> ANSI.hSupportsANSI stdout+ let ppeOpts = P.defaultPPEOptions { P.ppeCodeColor = cc, P.ppeFull = verbose, P.ppeRelativeDirectory = pwd, P.ppeFileContents = files }+ when (P.nonEmpty warnings) $+ putStrLn (P.prettyPrintMultipleWarnings ppeOpts warnings)+ case errors of+ Left errs -> do+ putStrLn (P.prettyPrintMultipleErrors ppeOpts errs)+ exitFailure+ Right _ -> return ()+printWarningsAndErrors verbose True files warnings errors = do+ putStrLn . LBU8.toString . A.encode $+ JSONResult (toJSONErrors verbose P.Warning files warnings)+ (either (toJSONErrors verbose P.Error files) (const []) errors)+ either (const exitFailure) (const (return ())) errors++compile :: PSCMakeOptions -> IO ()+compile PSCMakeOptions{..} = do+ input <- toInputGlobs $ PSCGlobs+ { pscInputGlobs = pscmInput+ , pscInputGlobsFromFile = pscmInputFromFile+ , pscExcludeGlobs = pscmExclude+ , pscWarnFileTypeNotFound = warnFileTypeNotFound "compile"+ }+ when (null input) $ do+ hPutStr stderr $ unlines [ "purs compile: No input files."+ , "Usage: For basic information, try the `--help' option."+ ]+ exitFailure+ moduleFiles <- readUTF8FilesT input+ (makeErrors, makeWarnings) <- runMake pscmOpts $ do+ ms <- CST.parseModulesFromFiles id moduleFiles+ let filePathMap = M.fromList $ map (\(fp, pm) -> (P.getModuleName $ CST.resPartial pm, Right fp)) ms+ foreigns <- inferForeignModules filePathMap+ let makeActions = buildMakeActions pscmOutputDir filePathMap foreigns pscmUsePrefix+ P.make makeActions (map snd ms)+ printWarningsAndErrors (P.optionsVerboseErrors pscmOpts) pscmJSONErrors moduleFiles makeWarnings makeErrors+ exitSuccess++outputDirectory :: Opts.Parser FilePath+outputDirectory = Opts.strOption $+ Opts.short 'o'+ <> Opts.long "output"+ <> Opts.value "output"+ <> Opts.showDefault+ <> Opts.help "The output directory"++comments :: Opts.Parser Bool+comments = Opts.switch $+ Opts.short 'c'+ <> Opts.long "comments"+ <> Opts.help "Include comments in the generated code"++verboseErrors :: Opts.Parser Bool+verboseErrors = Opts.switch $+ Opts.short 'v'+ <> Opts.long "verbose-errors"+ <> Opts.help "Display verbose error messages"++noPrefix :: Opts.Parser Bool+noPrefix = Opts.switch $+ Opts.short 'p'+ <> Opts.long "no-prefix"+ <> Opts.help "Do not include comment header"++jsonErrors :: Opts.Parser Bool+jsonErrors = Opts.switch $+ Opts.long "json-errors"+ <> Opts.help "Print errors to stderr as JSON"++codegenTargets :: Opts.Parser [P.CodegenTarget]+codegenTargets = Opts.option targetParser $+ Opts.short 'g'+ <> Opts.long "codegen"+ <> Opts.value [P.JS]+ <> Opts.help+ ( "Specifies comma-separated codegen targets to include. "+ <> targetsMessage+ <> " The default target is 'js', but if this option is used only the targets specified will be used."+ )++targetsMessage :: String+targetsMessage = "Accepted codegen targets are '" <> intercalate "', '" (M.keys P.codegenTargets) <> "'."++targetParser :: Opts.ReadM [P.CodegenTarget]+targetParser =+ Opts.str >>= \s ->+ for (T.split (== ',') s)+ $ maybe (Opts.readerError targetsMessage) pure+ . flip M.lookup P.codegenTargets+ . T.unpack+ . T.strip++options :: Opts.Parser P.Options+options =+ P.Options+ <$> verboseErrors+ <*> (not <$> comments)+ <*> (handleTargets <$> codegenTargets)+ where+ -- Ensure that the JS target is included if sourcemaps are+ handleTargets :: [P.CodegenTarget] -> S.Set P.CodegenTarget+ handleTargets ts = S.fromList (if P.JSSourceMap `elem` ts then P.JS : ts else ts)++pscMakeOptions :: Opts.Parser PSCMakeOptions+pscMakeOptions = PSCMakeOptions <$> many SharedCLI.inputFile+ <*> SharedCLI.globInputFile+ <*> many SharedCLI.excludeFiles+ <*> outputDirectory+ <*> options+ <*> (not <$> noPrefix)+ <*> jsonErrors++command :: Opts.Parser (IO ())+command = compile <$> (Opts.helper <*> pscMakeOptions)
+ app/Command/Docs.hs view
@@ -0,0 +1,168 @@++module Command.Docs (command, infoModList) where++import Prelude++import Command.Docs.Html (asHtml, writeHtmlModules)+import Command.Docs.Markdown (asMarkdown, writeMarkdownModules)+import Control.Applicative (Alternative(..), optional)+import Control.Monad.Writer (when)+import Control.Monad.Trans.Except (runExceptT)+import Data.Maybe (fromMaybe)+import Data.Text qualified as T+import Language.PureScript qualified as P+import Language.PureScript.Docs qualified as D+import Language.PureScript.Docs.Tags (dumpCtags, dumpEtags)+import Language.PureScript.Glob (PSCGlobs(..), toInputGlobs, warnFileTypeNotFound)+import Options.Applicative qualified as Opts+import Text.PrettyPrint.ANSI.Leijen qualified as PP+import SharedCLI qualified+import System.Directory (getCurrentDirectory, createDirectoryIfMissing, removeFile)+import System.Exit (exitFailure)+import System.FilePath ((</>))+import System.FilePath.Glob (compile, globDir1)+import System.IO (hPutStrLn, stderr)+import System.IO.UTF8 (writeUTF8FileT)++-- | Available output formats+data Format+ = Markdown+ | Html+ | Ctags -- Output ctags symbol index suitable for use with vi+ | Etags -- Output etags symbol index suitable for use with emacs+ deriving (Show, Eq, Ord)++data PSCDocsOptions = PSCDocsOptions+ { _pscdFormat :: Format+ , _pscdOutput :: Maybe FilePath+ , _pscdCompileOutputDir :: FilePath+ , _pscdInputFiles :: [FilePath]+ , _pscdInputFromFile :: Maybe FilePath+ , _pscdExcludeFiles :: [FilePath]+ }+ deriving (Show)++docgen :: PSCDocsOptions -> IO ()+docgen (PSCDocsOptions fmt moutput compileOutput inputGlob inputGlobFromFile excludeGlob) = do+ input <- toInputGlobs $ PSCGlobs+ { pscInputGlobs = inputGlob+ , pscInputGlobsFromFile = inputGlobFromFile+ , pscExcludeGlobs = excludeGlob+ , pscWarnFileTypeNotFound = warnFileTypeNotFound "docs"+ }+ when (null input) $ do+ hPutStrLn stderr "purs docs: no input files."+ exitFailure++ let output = fromMaybe (defaultOutputForFormat fmt) moutput++ fileMs <- parseAndConvert input+ let ms = D.primModules ++ map snd fileMs+ case fmt of+ Etags -> writeTagsToFile output $ dumpEtags fileMs+ Ctags -> writeTagsToFile output $ dumpCtags fileMs+ Html -> do+ let ext = compile "*.html"+ let msHtml = map asHtml ms+ createDirectoryIfMissing True output+ globDir1 ext output >>= mapM_ removeFile+ writeHtmlModules output msHtml+ Markdown -> do+ let ext = compile "*.md"+ let msMarkdown = map asMarkdown ms+ createDirectoryIfMissing True output+ globDir1 ext output >>= mapM_ removeFile+ writeMarkdownModules output msMarkdown++ putStrLn $ "Documentation written to: " ++ output++ where+ successOrExit :: Either P.MultipleErrors a -> IO a+ successOrExit act =+ case act of+ Right x ->+ return x+ Left err -> do+ hPutStrLn stderr $ P.prettyPrintMultipleErrors P.defaultPPEOptions err+ exitFailure++ parseAndConvert input =+ runExceptT (fmap fst (D.collectDocs compileOutput input []))+ >>= successOrExit++ writeTagsToFile :: String -> [String] -> IO ()+ writeTagsToFile outputFilename tags = do+ currentDir <- getCurrentDirectory+ let outputFile = currentDir </> outputFilename+ let text = T.pack . unlines $ tags+ writeUTF8FileT outputFile text++instance Read Format where+ readsPrec _ "etags" = [(Etags, "")]+ readsPrec _ "ctags" = [(Ctags, "")]+ readsPrec _ "markdown" = [(Markdown, "")]+ readsPrec _ "html" = [(Html, "")]+ readsPrec _ _ = []++defaultOutputForFormat :: Format -> FilePath+defaultOutputForFormat fmt =+ case fmt of+ Markdown -> "generated-docs/md"+ Html -> "generated-docs/html"+ Etags -> "TAGS"+ Ctags -> "tags"++pscDocsOptions :: Opts.Parser PSCDocsOptions+pscDocsOptions = + PSCDocsOptions <$> format + <*> output + <*> compileOutputDir + <*> many SharedCLI.inputFile+ <*> SharedCLI.globInputFile+ <*> many SharedCLI.excludeFiles+ where+ format :: Opts.Parser Format+ format = Opts.option Opts.auto $+ Opts.value Html+ <> Opts.long "format"+ <> Opts.metavar "FORMAT"+ <> Opts.help "Set output FORMAT (markdown | html | etags | ctags)"++ output :: Opts.Parser (Maybe FilePath)+ output = optional $ Opts.strOption $+ Opts.long "output"+ <> Opts.short 'o'+ <> Opts.metavar "DEST"+ <> Opts.help "File/directory path for docs to be written to"++ compileOutputDir :: Opts.Parser FilePath+ compileOutputDir = Opts.strOption $+ Opts.value "output"+ <> Opts.showDefault+ <> Opts.long "compile-output"+ <> Opts.metavar "DIR"+ <> Opts.help "Compiler output directory"++command :: Opts.Parser (IO ())+command = docgen <$> (Opts.helper <*> pscDocsOptions)++infoModList :: Opts.InfoMod a+infoModList = Opts.fullDesc <> footerInfo where+ footerInfo = Opts.footerDoc $ Just examples++examples :: PP.Doc+examples =+ PP.vcat $ map PP.text+ [ "Examples:"+ , " write documentation for all modules to ./generated-docs:"+ , " purs docs \"src/**/*.purs\" \".psc-package/*/*/*/src/**/*.purs\""+ , ""+ , " write documentation in Markdown format for all modules to ./generated-docs:"+ , " purs docs --format markdown \"src/**/*.purs\" \".psc-package/*/*/*/src/**/*.purs\""+ , ""+ , " write CTags to ./tags:"+ , " purs docs --format ctags \"src/**/*.purs\" \".psc-package/*/*/*/src/**/*.purs\""+ , ""+ , " write ETags to ./TAGS:"+ , " purs docs --format etags \"src/**/*.purs\" \".psc-package/*/*/*/src/**/*.purs\""+ ]
+ app/Command/Docs/Html.hs view
@@ -0,0 +1,167 @@+module Command.Docs.Html+ ( asHtml+ , layout+ , writeHtmlModule+ , writeHtmlModules+ ) where++import Prelude++import Control.Applicative (Alternative(..))+import Control.Arrow ((&&&))+import Control.Monad.Writer (guard)+import Data.List (sort)+import Data.Text (Text)+import Data.Text.Lazy (toStrict)+import Data.Text qualified as T+import Language.PureScript qualified as P+import Language.PureScript.Docs qualified as D+import Language.PureScript.Docs.AsHtml qualified as D+import Text.Blaze.Html5 (Html, (!), toMarkup)+import Text.Blaze.Html5 qualified as H+import Text.Blaze.Html5.Attributes qualified as A+import Text.Blaze.Html.Renderer.Text qualified as Blaze+import System.IO.UTF8 (writeUTF8FileT)+import Version (versionString)++writeHtmlModules :: FilePath -> [(P.ModuleName, D.HtmlOutputModule Html)] -> IO ()+writeHtmlModules outputDir modules = do+ let moduleList = sort $ map fst modules+ writeHtmlFile (outputDir ++ "/index.html") (renderIndexModule moduleList)+ mapM_ (writeHtmlModule outputDir . (fst &&& layout moduleList)) modules++asHtml :: D.Module -> (P.ModuleName, D.HtmlOutputModule Html)+asHtml m = D.moduleAsHtml (const $ Just $ getHtmlRenderContext (D.modName m)) m++writeHtmlModule :: FilePath -> (P.ModuleName, Html) -> IO ()+writeHtmlModule outputDir (mn, html) = do+ let filepath = outputDir ++ "/" ++ T.unpack (P.runModuleName mn) ++ ".html"+ writeHtmlFile filepath html++writeHtmlFile :: FilePath -> Html -> IO ()+writeHtmlFile filepath =+ writeUTF8FileT filepath . toStrict . Blaze.renderHtml++getHtmlRenderContext :: P.ModuleName -> D.HtmlRenderContext+getHtmlRenderContext mn = D.HtmlRenderContext+ { D.buildDocLink = getLink mn+ , D.renderDocLink = renderLink+ , D.renderSourceLink = const Nothing+ }++-- TODO: try to combine this with the one in Docs.Types?+getLink :: P.ModuleName -> D.Namespace -> Text -> D.ContainingModule -> Maybe D.DocLink+getLink curMn namespace target containingMod = do+ location <- getLinkLocation+ return D.DocLink+ { D.linkLocation = location+ , D.linkTitle = target+ , D.linkNamespace = namespace+ }++ where+ getLinkLocation = builtinLinkLocation <|> normalLinkLocation++ normalLinkLocation = do+ case containingMod of+ D.ThisModule ->+ return $ D.LocalModule curMn+ D.OtherModule destMn ->+ -- This is OK because all modules count as 'local' for purs docs in+ -- html mode+ return $ D.LocalModule destMn++ builtinLinkLocation = do+ let primMn = P.moduleNameFromString "Prim"+ guard $ containingMod == D.OtherModule primMn+ return $ D.BuiltinModule primMn++renderLink :: D.DocLink -> Text+renderLink l =+ case D.linkLocation l of+ D.LocalModule dest ->+ P.runModuleName dest <> ".html"+ D.DepsModule{} ->+ P.internalError "DepsModule: not implemented"+ D.BuiltinModule dest ->+ P.runModuleName dest <> ".html"++layout :: [P.ModuleName] -> (P.ModuleName, D.HtmlOutputModule Html) -> Html+layout moduleList (mn, htmlDocs) =+ basicLayout ("PureScript: " <> modName) $ do+ H.div ! A.class_ "page-title clearfix" $ do+ H.div ! A.class_ "page-title__label" $ "Module"+ H.h1 ! A.class_ "page-title__title" $ toMarkup modName++ H.div ! A.class_ "col col--main" $ do+ D.htmlOutputModuleLocals htmlDocs+ mapM_ renderReExports (D.htmlOutputModuleReExports htmlDocs)++ H.div ! A.class_ "col col--aside" $ do+ H.h3 "Modules"+ renderModuleList moduleList+ where+ modName = P.runModuleName mn++ renderReExports :: (D.InPackage P.ModuleName, Html) -> Html+ renderReExports (reExpFrom, html) = do+ H.h2 ! A.class_ "re-exports" $ do+ toMarkup ("Re-exports from " :: Text)+ H.a ! A.href (H.toValue (toText reExpFrom <> ".html")) $+ toMarkup (toText reExpFrom)+ html++ toText = P.runModuleName . D.ignorePackage++basicLayout :: Text -> Html -> Html+basicLayout title inner =+ H.docTypeHtml $ do+ H.head $ do+ H.meta ! A.charset "utf-8"+ H.meta ! A.httpEquiv "X-UA-Compatible" ! A.content "IE=edge"+ H.meta ! A.name "viewport" ! A.content "width=device-width, initial-scale=1"+ H.title (toMarkup title)++ H.link ! A.href "https://fonts.googleapis.com/css?family=Roboto+Mono|Roboto:300,400,400i,700,700i"+ ! A.type_ "text/css" ! A.rel "stylesheet"+ H.style ! A.type_ "text/css" $+ toMarkup D.normalizeCssT+ H.style ! A.type_ "text/css" $+ toMarkup D.pursuitCssT+ H.body $ do+ H.div ! A.class_ "everything-except-footer" $ do+ H.div ! A.class_ "top-banner clearfix" $ do+ H.div ! A.class_ "container clearfix" $ do+ H.div ! A.style inlineHeaderStyles $ do+ "PureScript API documentation"++ H.div ! A.class_ "top-banner__actions" $ do+ H.div ! A.class_ "top-banner__actions__item" $ do+ H.a ! A.href "index.html" $ "Index"++ H.main ! A.class_ "container clearfix" ! H.customAttribute "role" "main" $ do+ inner++ H.div ! A.class_ "footer clearfix" $+ H.p $ toMarkup $ "Generated by purs " <> versionString++ where+ -- Like Pursuit's .top-banner__logo except without the 'hover' styles+ inlineHeaderStyles = "float: left; font-size: 2.44em; font-weight: 300; line-height: 90px; margin: 0"++renderIndexModule :: [P.ModuleName] -> Html+renderIndexModule moduleList =+ basicLayout "PureScript API documentation" $ do+ H.div ! A.class_ "page-title clearfix" $ do+ H.h1 ! A.class_ "page-title__title" $ "Index"+ H.div ! A.class_ "col col--main" $ do+ renderModuleList moduleList++renderModuleList :: [P.ModuleName] -> Html+renderModuleList moduleList =+ H.ul $ mapM_ listItem moduleList++ where+ listItem mn = H.li $+ H.a ! A.href (H.toValue (P.runModuleName mn <> ".html")) $+ toMarkup (P.runModuleName mn)
+ app/Command/Docs/Markdown.hs view
@@ -0,0 +1,24 @@+module Command.Docs.Markdown+ ( asMarkdown+ , writeMarkdownModules+ ) where++import Prelude++import Data.Text (Text)+import Data.Text qualified as T+import Language.PureScript qualified as P+import Language.PureScript.Docs qualified as D+import Language.PureScript.Docs.AsMarkdown qualified as D+import System.IO.UTF8 (writeUTF8FileT)++asMarkdown :: D.Module -> (P.ModuleName, Text)+asMarkdown m = (D.modName m, D.runDocs . D.moduleAsMarkdown $ m)++writeMarkdownModules :: FilePath -> [(P.ModuleName, Text)] -> IO ()+writeMarkdownModules outputDir = mapM_ $ writeMarkdownModule outputDir++writeMarkdownModule :: FilePath -> (P.ModuleName, Text) -> IO ()+writeMarkdownModule outputDir (mn, text) = do+ let filepath = outputDir ++ "/" ++ T.unpack (P.runModuleName mn) ++ ".md"+ writeUTF8FileT filepath text
+ app/Command/Graph.hs view
@@ -0,0 +1,85 @@+module Command.Graph (command) where++import Prelude++import Control.Applicative (many)+import Control.Monad (unless, when)+import Data.Aeson qualified as Json+import Data.Bool (bool)+import Data.ByteString.Lazy qualified as LB+import Data.ByteString.Lazy.UTF8 qualified as LBU8+import Language.PureScript qualified as P+import Language.PureScript.Errors.JSON (JSONResult(..), toJSONErrors)+import Language.PureScript.Glob (PSCGlobs(..), toInputGlobs, warnFileTypeNotFound)+import Options.Applicative qualified as Opts+import SharedCLI qualified+import System.Console.ANSI qualified as ANSI+import System.Exit (exitFailure)+import System.Directory (getCurrentDirectory)+import System.IO (hPutStr, hPutStrLn, stderr)++data GraphOptions = GraphOptions+ { graphInput :: [FilePath]+ , graphInputFromFile :: Maybe FilePath+ , graphExclude :: [FilePath]+ , graphJSONErrors :: Bool+ }++graph :: GraphOptions -> IO ()+graph GraphOptions{..} = do+ input <- toInputGlobs $ PSCGlobs+ { pscInputGlobs = graphInput+ , pscInputGlobsFromFile = graphInputFromFile+ , pscExcludeGlobs = graphExclude+ , pscWarnFileTypeNotFound = unless graphJSONErrors . warnFileTypeNotFound "graph"+ }++ when (null input && not graphJSONErrors) $ do+ hPutStr stderr $ unlines+ [ "purs graph: No input files."+ , "Usage: For basic information, try the `--help' option."+ ]+ exitFailure++ (makeResult, makeWarnings) <- P.graph input++ printWarningsAndErrors graphJSONErrors makeWarnings makeResult+ >>= (LB.putStr . Json.encode)++command :: Opts.Parser (IO ())+command = graph <$> (Opts.helper <*> graphOptions)+ where+ graphOptions :: Opts.Parser GraphOptions+ graphOptions =+ GraphOptions <$> many SharedCLI.inputFile+ <*> SharedCLI.globInputFile+ <*> many SharedCLI.excludeFiles+ <*> jsonErrors++ jsonErrors :: Opts.Parser Bool+ jsonErrors =+ Opts.switch $+ Opts.long "json-errors" <>+ Opts.help "Print errors to stderr as JSON"++-- | Arguments: use JSON, warnings, errors+printWarningsAndErrors :: Bool -> P.MultipleErrors -> Either P.MultipleErrors a -> IO a+printWarningsAndErrors False warnings errors = do+ pwd <- getCurrentDirectory+ cc <- bool Nothing (Just P.defaultCodeColor) <$> ANSI.hSupportsANSI stderr+ let ppeOpts = P.defaultPPEOptions { P.ppeCodeColor = cc, P.ppeFull = True, P.ppeRelativeDirectory = pwd }+ when (P.nonEmpty warnings) $+ hPutStrLn stderr (P.prettyPrintMultipleWarnings ppeOpts warnings)+ case errors of+ Left errs -> do+ hPutStrLn stderr (P.prettyPrintMultipleErrors ppeOpts errs)+ exitFailure+ Right res -> pure res+printWarningsAndErrors True warnings errors = do+ let verbose = True+ hPutStrLn stderr . LBU8.toString . Json.encode $+ JSONResult (toJSONErrors verbose P.Warning [] warnings)+ (either (toJSONErrors verbose P.Error []) (const []) errors)+ case errors of+ Left _errs -> exitFailure+ Right res -> pure res
+ app/Command/Hierarchy.hs view
@@ -0,0 +1,80 @@+-----------------------------------------------------------------------------+--+-- Module : Main+-- Copyright : (c) Hardy Jones 2014+-- License : MIT (http://opensource.org/licenses/MIT)+--+-- Maintainer : Hardy Jones <jones3.hardy@gmail.com>+-- Stability : experimental+-- Portability :+--+-- |+-- Generate Directed Graphs of PureScript TypeClasses+--+-----------------------------------------------------------------------------++module Command.Hierarchy (command) where++import Prelude+import Protolude (catMaybes)++import Control.Applicative (optional)+import Data.Foldable (for_)+import Data.Text qualified as T+import Data.Text.IO qualified as T+import Options.Applicative (Parser)+import Options.Applicative qualified as Opts+import System.Directory (createDirectoryIfMissing)+import System.FilePath ((</>))+import System.FilePath.Glob (glob)+import System.Exit (exitFailure, exitSuccess)+import System.IO (hPutStr, stderr)+import System.IO.UTF8 (readUTF8FilesT)+import Language.PureScript qualified as P+import Language.PureScript.CST qualified as CST+import Language.PureScript.Hierarchy (Graph(..), _unDigraph, _unGraphName, typeClasses)++data HierarchyOptions = HierarchyOptions+ { _hierarchyInput :: FilePath+ , _hierarchyOutput :: Maybe FilePath+ }++parseInput :: [FilePath] -> IO (Either P.MultipleErrors [P.Module])+parseInput paths = do+ content <- readUTF8FilesT paths+ return $ map (snd . snd) <$> CST.parseFromFiles id content++compile :: HierarchyOptions -> IO ()+compile (HierarchyOptions inputGlob mOutput) = do+ input <- glob inputGlob+ modules <- parseInput input+ case modules of+ Left errs -> hPutStr stderr (P.prettyPrintMultipleErrors P.defaultPPEOptions errs) >> exitFailure+ Right ms -> do+ for_ (catMaybes $ typeClasses ms) $ \(Graph name graph) ->+ case mOutput of+ Just output -> do+ createDirectoryIfMissing True output+ T.writeFile (output </> T.unpack (_unGraphName name)) (_unDigraph graph)+ Nothing -> T.putStrLn (_unDigraph graph)+ exitSuccess++inputFile :: Parser FilePath+inputFile = Opts.strArgument $+ Opts.metavar "FILE"+ <> Opts.value "main.purs"+ <> Opts.showDefault+ <> Opts.help "The input file to generate a hierarchy from"++outputFile :: Parser (Maybe FilePath)+outputFile = optional . Opts.strOption $+ Opts.short 'o'+ <> Opts.long "output"+ <> Opts.help "The output directory"++pscOptions :: Parser HierarchyOptions+pscOptions = HierarchyOptions <$> inputFile+ <*> outputFile++command :: Opts.Parser (IO ())+command = compile <$> (Opts.helper <*> pscOptions)
+ app/Command/Ide.hs view
@@ -0,0 +1,259 @@+-----------------------------------------------------------------------------+--+-- Module : Main+-- Description : The server accepting commands for psc-ide+-- Copyright : Christoph Hegemann 2016+-- License : MIT (http://opensource.org/licenses/MIT)+--+-- Maintainer : Christoph Hegemann <christoph.hegemann1337@gmail.com>+-- Stability : experimental+--+-- |+-- The server accepting commands for psc-ide+-----------------------------------------------------------------------------++{-# LANGUAGE PackageImports #-}+{-# LANGUAGE TemplateHaskell #-}++module Command.Ide (command) where++import Protolude++import Data.Aeson qualified as Aeson+import Control.Concurrent.STM (newTVarIO)+import "monad-logger" Control.Monad.Logger (MonadLogger, logDebug, logError, logInfo)+import Data.IORef (newIORef)+import Data.Text.IO qualified as T+import Data.ByteString.Char8 qualified as BS8+import Data.ByteString.Lazy.Char8 qualified as BSL8+import GHC.IO.Exception (IOErrorType(..), IOException(..))+import Language.PureScript.Ide (handleCommand)+import Language.PureScript.Ide.Command (Command(..), commandName)+import Language.PureScript.Ide.Util (decodeT, displayTimeSpec, encodeT, logPerf, runLogger)+import Language.PureScript.Ide.Error (IdeError(..))+import Language.PureScript.Ide.State (updateCacheTimestamp)+import Language.PureScript.Ide.Types (Ide, IdeConfiguration(..), IdeEnvironment(..), IdeLogLevel(..), emptyIdeState)+import Network.Socket qualified as Network+import Options.Applicative qualified as Opts+import SharedCLI qualified+import System.Directory (doesDirectoryExist, getCurrentDirectory, setCurrentDirectory)+import System.FilePath ((</>))+import System.IO (BufferMode(..), hClose, hFlush, hSetBuffering, hSetEncoding, utf8)+import System.IO.Error (isEOFError)++listenOnLocalhost :: Network.PortNumber -> IO Network.Socket+listenOnLocalhost port = do+ let hints = Network.defaultHints+ { Network.addrFamily = Network.AF_INET+ , Network.addrSocketType = Network.Stream+ }+ addr:_ <- Network.getAddrInfo (Just hints) (Just "127.0.0.1") (Just (show port))+ bracketOnError+ (Network.socket (Network.addrFamily addr) (Network.addrSocketType addr) (Network.addrProtocol addr))+ Network.close+ (\sock -> do+ Network.setSocketOption sock Network.ReuseAddr 1+ Network.bind sock (Network.addrAddress addr)+ Network.listen sock Network.maxListenQueue+ pure sock)++data ServerOptions = ServerOptions+ { _serverDirectory :: Maybe FilePath+ , _serverGlobs :: [FilePath]+ , _serverGlobsFromFile :: Maybe FilePath+ , _serverGlobsExcluded :: [FilePath]+ , _serverOutputPath :: FilePath+ , _serverPort :: Network.PortNumber+ , _serverLoglevel :: IdeLogLevel+ -- TODO(Christoph) Deprecated+ , _serverEditorMode :: Bool+ , _serverPolling :: Bool+ , _serverNoWatch :: Bool+ } deriving (Show)++data ClientOptions = ClientOptions+ { clientPort :: Network.PortNumber+ }++command :: Opts.Parser (IO ())+command = Opts.helper <*> subcommands where+ subcommands :: Opts.Parser (IO ())+ subcommands = (Opts.subparser . fold)+ [ Opts.command "server"+ (Opts.info (fmap server serverOptions <**> Opts.helper)+ (Opts.progDesc "Start a server process"))+ , Opts.command "client"+ (Opts.info (fmap client clientOptions <**> Opts.helper)+ (Opts.progDesc "Connect to a running server"))+ ]++ client :: ClientOptions -> IO ()+ client ClientOptions{..} = do+ hSetEncoding stdin utf8+ hSetEncoding stdout utf8+ let handler (SomeException e) = do+ T.putStrLn ("Couldn't connect to purs ide server on port " <> show clientPort <> ":")+ print e+ exitFailure+ let hints = Network.defaultHints+ { Network.addrFamily = Network.AF_INET+ , Network.addrSocketType = Network.Stream+ }+ addr:_ <- Network.getAddrInfo (Just hints) (Just "127.0.0.1") (Just (show clientPort))+ sock <- Network.socket (Network.addrFamily addr) (Network.addrSocketType addr) (Network.addrProtocol addr)+ Network.connect sock (Network.addrAddress addr) `catch` handler+ h <- Network.socketToHandle sock ReadWriteMode+ T.hPutStrLn h =<< T.getLine+ BS8.putStrLn =<< BS8.hGetLine h+ hFlush stdout+ hClose h++ clientOptions :: Opts.Parser ClientOptions+ clientOptions = ClientOptions . fromIntegral <$>+ Opts.option Opts.auto (Opts.long "port" `mappend` Opts.short 'p' `mappend` Opts.value (4242 :: Integer))++ server :: ServerOptions -> IO ()+ server opts'@(ServerOptions dir globs globsFromFile globsExcluded outputPath port logLevel editorMode polling noWatch) = do+ when (logLevel == LogDebug || logLevel == LogAll)+ (putText "Parsed Options:" *> print opts')+ maybe (pure ()) setCurrentDirectory dir+ ideState <- newTVarIO emptyIdeState+ cwd <- getCurrentDirectory+ let fullOutputPath = cwd </> outputPath++ when editorMode+ (putText "The --editor-mode flag is deprecated and ignored. It's now the default behaviour and the flag will be removed in a future version")++ when polling+ (putText "The --polling flag is deprecated and ignored. purs ide no longer uses a file system watcher, instead it relies on its clients to notify it about updates and checks timestamps to invalidate itself")++ when noWatch+ (putText "The --no-watch flag is deprecated and ignored. purs ide no longer uses a file system watcher, instead it relies on its clients to notify it about updates and checks timestamps to invalidate itself")++ unlessM (doesDirectoryExist fullOutputPath) $ do+ putText "Your output directory didn't exist. This usually means you didn't compile your project yet."+ putText "psc-ide needs you to compile your project (for example by running pulp build)"++ let+ conf = IdeConfiguration+ { confLogLevel = logLevel+ , confOutputPath = outputPath+ , confGlobs = globs+ , confGlobsFromFile = globsFromFile+ , confGlobsExclude = globsExcluded+ }+ ts <- newIORef Nothing+ let+ env = IdeEnvironment+ { ideStateVar = ideState+ , ideConfiguration = conf+ , ideCacheDbTimestamp = ts+ }+ startServer port env++ serverOptions :: Opts.Parser ServerOptions+ serverOptions =+ ServerOptions+ <$> optional (Opts.strOption (Opts.long "directory" `mappend` Opts.short 'd'))+ <*> many SharedCLI.inputFile+ <*> SharedCLI.globInputFile+ <*> many SharedCLI.excludeFiles+ <*> Opts.strOption (Opts.long "output-directory" `mappend` Opts.value "output/")+ <*> (fromIntegral <$>+ Opts.option Opts.auto (Opts.long "port" `mappend` Opts.short 'p' `mappend` Opts.value (4242 :: Integer)))+ <*> (parseLogLevel <$> Opts.strOption+ (Opts.long "log-level"+ `mappend` Opts.value ""+ `mappend` Opts.help "One of \"debug\", \"perf\", \"all\" or \"none\""))+ -- TODO(Christoph): Deprecated+ <*> Opts.switch (Opts.long "editor-mode")+ <*> Opts.switch (Opts.long "no-watch")+ <*> Opts.switch (Opts.long "polling")++ parseLogLevel :: Text -> IdeLogLevel+ parseLogLevel s = case s of+ "debug" -> LogDebug+ "perf" -> LogPerf+ "all" -> LogAll+ "none" -> LogNone+ _ -> LogDefault++startServer :: Network.PortNumber -> IdeEnvironment -> IO ()+startServer port env = Network.withSocketsDo $ do+ sock <- listenOnLocalhost port+ runLogger (confLogLevel (ideConfiguration env)) (runReaderT (forever (loop sock)) env)+ where+ loop :: (Ide m, MonadLogger m) => Network.Socket -> m ()+ loop sock = do+ accepted <- runExceptT (acceptCommand sock)+ case accepted of+ Left err -> $(logError) err+ Right (cmd, h) -> do+ case decodeT cmd of+ Right cmd' -> do+ let message duration =+ "Command "+ <> commandName cmd'+ <> " took "+ <> displayTimeSpec duration+ logPerf message $ do+ result <- runExceptT $ do+ updateCacheTimestamp >>= \case+ Nothing -> pure ()+ Just (before, after) -> do+ -- If the cache db file was changed outside of the IDE+ -- we trigger a reset before processing the command+ $(logInfo) ("cachedb was changed from: " <> show before <> ", to: " <> show after)+ unless (isLoadAll cmd') $+ void (handleCommand Reset *> handleCommand (LoadSync []))+ handleCommand cmd'+ liftIO $ catchGoneHandle $ BSL8.hPutStrLn h $ case result of+ Right r -> Aeson.encode r+ Left err -> Aeson.encode err+ liftIO (hFlush stdout)+ Left err -> do+ let errMsg = "Parsing the command failed with:\n" <> err <> "\nCommand: " <> cmd+ $(logError) errMsg+ liftIO $ do+ catchGoneHandle (T.hPutStrLn h (encodeT (GeneralError errMsg)))+ hFlush stdout+ liftIO $ catchGoneHandle (hClose h)++isLoadAll :: Command -> Bool+isLoadAll = \case+ Load [] -> True+ _ -> False++catchGoneHandle :: IO () -> IO ()+catchGoneHandle =+ handle (\e -> case e of+ IOError { ioe_type = ResourceVanished } ->+ putText "[Error] psc-ide-server tried to interact with the handle, but the connection was already gone."+ _ -> throwIO e)++acceptCommand+ :: (MonadIO m, MonadLogger m, MonadError Text m)+ => Network.Socket+ -> m (Text, Handle)+acceptCommand sock = do+ h <- acceptConnection+ $(logDebug) "Accepted a connection"+ cmd' <- liftIO (catchJust+ -- this means that the connection was+ -- terminated without receiving any input+ (\e -> if isEOFError e then Just () else Nothing)+ (Just <$> T.hGetLine h)+ (const (pure Nothing)))+ case cmd' of+ Nothing -> throwError "Connection was closed before any input arrived"+ Just cmd -> do+ $(logDebug) ("Received command: " <> cmd)+ pure (cmd, h)+ where+ acceptConnection = liftIO $ do+ -- Use low level accept to prevent accidental reverse name resolution+ (s,_) <- Network.accept sock+ h <- Network.socketToHandle s ReadWriteMode+ hSetEncoding h utf8+ hSetBuffering h LineBuffering+ pure h
+ app/Command/Publish.hs view
@@ -0,0 +1,80 @@+module Command.Publish (command) where++import Prelude++import Control.Monad.IO.Class (liftIO)+import Data.Aeson qualified as A+import Data.ByteString.Lazy.Char8 qualified as BL+import Data.Time.Clock (getCurrentTime)+import Data.Version (Version(..))+import Language.PureScript.Publish (PublishOptions(..), defaultPublishOptions, unsafePreparePackage, warn)+import Language.PureScript.Publish.ErrorsWarnings (PackageWarning(..))+import Options.Applicative (Parser)+import Options.Applicative qualified as Opts++data PublishOptionsCLI = PublishOptionsCLI+ { cliManifestPath :: FilePath+ , cliResolutionsPath :: FilePath+ , cliCompileOutputDir :: FilePath+ , cliDryRun :: Bool+ }++manifestPath :: Parser FilePath+manifestPath = Opts.strOption $+ Opts.long "manifest"+ <> Opts.metavar "FILE"+ <> Opts.help "The package manifest file"++resolutionsPath :: Parser FilePath+resolutionsPath = Opts.strOption $+ Opts.long "resolutions"+ <> Opts.metavar "FILE"+ <> Opts.help "The resolutions file"++dryRun :: Parser Bool+dryRun = Opts.switch $+ Opts.long "dry-run"+ <> Opts.help "Produce no output, and don't require a tagged version to be checked out."++compileOutputDir :: Opts.Parser FilePath+compileOutputDir = Opts.option Opts.auto $+ Opts.value "output"+ <> Opts.showDefault+ <> Opts.long "compile-output"+ <> Opts.metavar "DIR"+ <> Opts.help "Compiler output directory"++cliOptions :: Opts.Parser PublishOptionsCLI+cliOptions =+ PublishOptionsCLI <$> manifestPath <*> resolutionsPath <*> compileOutputDir <*> dryRun++mkPublishOptions :: PublishOptionsCLI -> PublishOptions+mkPublishOptions cliOpts =+ let+ opts =+ defaultPublishOptions+ { publishManifestFile = cliManifestPath cliOpts+ , publishResolutionsFile = cliResolutionsPath cliOpts+ , publishCompileOutputDir = cliCompileOutputDir cliOpts+ }+ in+ if cliDryRun cliOpts+ then+ opts+ { publishGetVersion = return ("0.0.0", Version [0,0,0] [])+ , publishGetTagTime = const (liftIO getCurrentTime)+ , publishWorkingTreeDirty = warn DirtyWorkingTreeWarn+ }+ else+ opts++command :: Opts.Parser (IO ())+command = publish <$> (Opts.helper <*> cliOptions)++publish :: PublishOptionsCLI -> IO ()+publish cliOpts = do+ let opts = mkPublishOptions cliOpts+ pkg <- unsafePreparePackage opts+ if cliDryRun cliOpts+ then putStrLn "Dry run completed, no errors."+ else BL.putStrLn (A.encode pkg)
+ app/Command/REPL.hs view
@@ -0,0 +1,209 @@+{-# LANGUAGE DoAndIfThenElse #-}+{-# LANGUAGE GADTs #-}++module Command.REPL (command) where++import Prelude+import Control.Applicative (many, (<|>))+import Control.Monad (unless, when)+import Control.Monad.Catch (MonadMask)+import Control.Monad.IO.Class (liftIO, MonadIO)+import Control.Monad.Trans.Class (MonadTrans(..))+import Control.Monad.Trans.Except (ExceptT(..), runExceptT)+import Control.Monad.Trans.State.Strict (StateT, evalStateT)+import Control.Monad.Trans.Reader (ReaderT, runReaderT)+import Data.Foldable (for_)+import Language.PureScript qualified as P+import Language.PureScript.CST qualified as CST+import Language.PureScript.Glob (PSCGlobs(..), toInputGlobs, warnFileTypeNotFound)+import Language.PureScript.Interactive+import Options.Applicative qualified as Opts+import SharedCLI qualified+import System.Console.Haskeline (InputT, Settings(..), defaultSettings, getInputLine, handleInterrupt, outputStrLn, runInputT, setComplete, withInterrupt)+import System.IO.UTF8 (readUTF8File)+import System.Exit (ExitCode(..), exitFailure)+import System.Directory (doesFileExist, getCurrentDirectory)+import System.FilePath ((</>))+import System.IO (hPutStrLn, stderr)++-- | Command line options+data PSCiOptions = PSCiOptions+ { psciInputGlob :: [String]+ , psciInputFromFile :: Maybe String+ , psciExclude :: [String]+ , psciBackend :: Backend+ }++nodePathOption :: Opts.Parser (Maybe FilePath)+nodePathOption = Opts.optional . Opts.strOption $+ Opts.metavar "FILE"+ <> Opts.long "node-path"+ <> Opts.help "Path to the Node executable"++nodeFlagsOption :: Opts.Parser [String]+nodeFlagsOption = Opts.option parser $+ Opts.long "node-opts"+ <> Opts.metavar "OPTS"+ <> Opts.value []+ <> Opts.help "Flags to pass to node, separated by spaces"+ where+ parser = words <$> Opts.str++port :: Opts.Parser Int+port = Opts.option Opts.auto $+ Opts.long "port"+ <> Opts.short 'p'+ <> Opts.help "The browser REPL backend was removed in v0.15.0. Use https://try.purescript.org instead."++backend :: Opts.Parser Backend+backend =+ (browserBackend <$> port)+ <|> (nodeBackend <$> nodePathOption <*> nodeFlagsOption)++psciOptions :: Opts.Parser PSCiOptions+psciOptions = PSCiOptions <$> many SharedCLI.inputFile+ <*> SharedCLI.globInputFile+ <*> many SharedCLI.excludeFiles+ <*> backend++-- | Parses the input and returns either a command, or an error as a 'String'.+getCommand :: forall m. (MonadIO m, MonadMask m) => InputT m (Either String [Command])+getCommand = handleInterrupt (return (Right [])) $ do+ line <- withInterrupt $ getInputLine "> "+ case line of+ Nothing -> return (Right [QuitPSCi]) -- Ctrl-D when input is empty+ Just "" -> return (Right [])+ Just s -> return (parseCommand s)++pasteMode :: forall m. (MonadIO m, MonadMask m) => InputT m (Either String [Command])+pasteMode =+ parseCommand <$> go []+ where+ go :: [String] -> InputT m String+ go ls = maybe (return . unlines $ reverse ls) (go . (:ls)) =<< getInputLine "… "++-- | All of the functions required to implement a PSCi backend+data Backend = forall state. Backend+ { _backendSetup :: IO state+ -- ^ Initialize, and call the continuation when the backend is ready+ , _backendEval :: state -> String -> IO ()+ -- ^ Evaluate JavaScript code+ , _backendReload :: state -> IO ()+ -- ^ Reload the compiled code+ , _backendShutdown :: state -> IO ()+ -- ^ Shut down the backend+ }++browserBackend :: Int -> Backend+browserBackend _ = Backend setup mempty mempty mempty+ where+ setup :: IO ()+ setup = do+ hPutStrLn stderr "The browser REPL backend was removed in v0.15.0. Use TryPureScript instead: https://try.purescript.org"+ exitFailure++nodeBackend :: Maybe FilePath -> [String] -> Backend+nodeBackend nodePath nodeArgs = Backend setup eval reload shutdown+ where+ setup :: IO ()+ setup = return ()++ eval :: () -> String -> IO ()+ eval _ _ = do+ writeFile indexFile "import('./$PSCI/index.js').then(({ $main }) => $main());"+ result <- readNodeProcessWithExitCode nodePath (nodeArgs ++ [indexFile]) ""+ case result of+ Right (ExitSuccess, out, _) -> putStrLn out+ Right (ExitFailure _, _, err) -> putStrLn err+ Left err -> putStrLn err++ reload :: () -> IO ()+ reload _ = return ()++ shutdown :: () -> IO ()+ shutdown _ = return ()++options :: Opts.Parser PSCiOptions+options = Opts.helper <*> psciOptions++-- | Get command line options and drop into the REPL+command :: Opts.Parser (IO ())+command = loop <$> options+ where+ loop :: PSCiOptions -> IO ()+ loop PSCiOptions{..} = do+ inputFiles <- toInputGlobs $ PSCGlobs+ { pscInputGlobs = psciInputGlob+ , pscInputGlobsFromFile = psciInputFromFile+ , pscExcludeGlobs = psciExclude+ , pscWarnFileTypeNotFound = warnFileTypeNotFound "repl"+ }+ e <- runExceptT $ do+ modules <- ExceptT (loadAllModules inputFiles)+ when (null modules) . liftIO $ do+ putStr noInputMessage+ exitFailure+ unless (supportModuleIsDefined (map (P.getModuleName . snd) modules)) . liftIO $ do+ putStr supportModuleMessage+ exitFailure+ (externs, _) <- ExceptT . runMake . make $ fmap CST.pureResult <$> modules+ return (modules, externs)+ case psciBackend of+ Backend setup eval reload (shutdown :: state -> IO ()) ->+ case e of+ Left errs -> do+ pwd <- getCurrentDirectory+ putStrLn (P.prettyPrintMultipleErrors P.defaultPPEOptions {P.ppeRelativeDirectory = pwd} errs) >> exitFailure+ Right (modules, externs) -> do+ historyFilename <- getHistoryFilename+ let settings = defaultSettings { historyFile = Just historyFilename }+ initialState = updateLoadedExterns (const (zip (map snd modules) externs)) initialPSCiState+ config = PSCiConfig psciInputGlob+ runner = flip runReaderT config+ . flip evalStateT initialState+ . runInputT (setComplete completion settings)++ handleCommand' :: state -> Command -> StateT PSCiState (ReaderT PSCiConfig IO) ()+ handleCommand' state = handleCommand (liftIO . eval state) (liftIO (reload state)) (liftIO . putStrLn)++ go :: state -> InputT (StateT PSCiState (ReaderT PSCiConfig IO)) ()+ go state = do+ c <- getCommand+ case c of+ Left err -> outputStrLn err >> go state+ Right xs -> goExec xs+ where+ goExec :: [Command] -> InputT (StateT PSCiState (ReaderT PSCiConfig IO)) ()+ goExec xs = case xs of+ [] -> go state+ (PasteLines : rest) -> do+ c' <- pasteMode+ case c' of+ Left err -> outputStrLn err >> goExec rest+ Right c'' -> handleCommandWithInterrupts state c'' >> goExec rest+ (QuitPSCi : _) -> do+ outputStrLn quitMessage+ liftIO $ shutdown state+ (c' : rest) -> handleCommandWithInterrupts state [c'] >> goExec rest++ loadUserConfig :: state -> StateT PSCiState (ReaderT PSCiConfig IO) ()+ loadUserConfig state = do+ configFile <- (</> ".purs-repl") <$> liftIO getCurrentDirectory+ exists <- liftIO $ doesFileExist configFile+ when exists $ do+ cf <- liftIO (readUTF8File configFile)+ case parseDotFile configFile cf of+ Left err -> liftIO (putStrLn err >> exitFailure)+ Right cmds -> liftIO (putStrLn cf) >> for_ cmds (handleCommand' state)++ handleCommandWithInterrupts+ :: state+ -> [Command]+ -> InputT (StateT PSCiState (ReaderT PSCiConfig IO)) ()+ handleCommandWithInterrupts state cmds = do+ handleInterrupt (outputStrLn "Interrupted.")+ (withInterrupt (lift (for_ cmds (handleCommand' state))))++ putStrLn prologueMessage+ backendState <- setup+ runner (lift (loadUserConfig backendState) >> go backendState)
+ app/Main.hs view
@@ -0,0 +1,85 @@+module Main where++import Prelude++import Command.Bundle qualified as Bundle+import Command.Compile qualified as Compile+import Command.Docs qualified as Docs+import Command.Graph qualified as Graph+import Command.Hierarchy qualified as Hierarchy+import Command.Ide qualified as Ide+import Command.Publish qualified as Publish+import Command.REPL qualified as REPL+import Control.Monad (join)+import Data.Foldable (fold)+import Options.Applicative qualified as Opts+import System.Environment (getArgs)+import System.IO qualified as IO+import Text.PrettyPrint.ANSI.Leijen qualified as Doc+import Version (versionString)+++main :: IO ()+main = do+ IO.hSetEncoding IO.stdout IO.utf8+ IO.hSetEncoding IO.stderr IO.utf8+ IO.hSetBuffering IO.stdout IO.LineBuffering+ IO.hSetBuffering IO.stderr IO.LineBuffering+ join $ Opts.handleParseResult . execParserPure opts =<< getArgs+ where+ opts = Opts.info (versionInfo <*> Opts.helper <*> commands) infoModList+ infoModList = Opts.fullDesc <> headerInfo <> footerInfo+ headerInfo = Opts.progDesc "The PureScript compiler and tools"+ footerInfo = Opts.footerDoc (Just footer)++ footer =+ mconcat+ [ para $+ "For help using each individual command, run `purs COMMAND --help`. " +++ "For example, `purs compile --help` displays options specific to the `compile` command."+ , Doc.hardline+ , Doc.hardline+ , Doc.text $ "purs " ++ versionString+ ]++ para :: String -> Doc.Doc+ para = foldr (Doc.</>) Doc.empty . map Doc.text . words++ -- | Displays full command help when invoked with no arguments.+ execParserPure :: Opts.ParserInfo a -> [String] -> Opts.ParserResult a+ execParserPure pinfo [] = Opts.Failure $+ Opts.parserFailure Opts.defaultPrefs pinfo (Opts.ShowHelpText Nothing) mempty+ execParserPure pinfo args = Opts.execParserPure Opts.defaultPrefs pinfo args++ versionInfo :: Opts.Parser (a -> a)+ versionInfo = Opts.abortOption (Opts.InfoMsg versionString) $+ Opts.long "version" <> Opts.help "Show the version number" <> Opts.hidden++ commands :: Opts.Parser (IO ())+ commands =+ (Opts.subparser . fold)+ [ Opts.command "bundle"+ (Opts.info Bundle.command+ (Opts.progDesc "This command was removed in v0.15.0. Run this command for migration information."))+ , Opts.command "compile"+ (Opts.info Compile.command+ (Opts.progDesc "Compile PureScript source files"))+ , Opts.command "docs"+ (Opts.info Docs.command+ (Opts.progDesc "Generate documentation from PureScript source files in a variety of formats, including Markdown and HTML" <> Docs.infoModList))+ , Opts.command "graph"+ (Opts.info Graph.command+ (Opts.progDesc "Module dependency graph"))+ , Opts.command "hierarchy"+ (Opts.info Hierarchy.command+ (Opts.progDesc "Generate a GraphViz directed graph of PureScript type classes"))+ , Opts.command "ide"+ (Opts.info Ide.command+ (Opts.progDesc "Start or query an IDE server process"))+ , Opts.command "publish"+ (Opts.info Publish.command+ (Opts.progDesc "Generates documentation packages for upload to Pursuit"))+ , Opts.command "repl"+ (Opts.info REPL.command+ (Opts.progDesc "Enter the interactive mode (PSCi)"))+ ]
@@ -0,0 +1,24 @@+module SharedCLI where++import Prelude++import Options.Applicative qualified as Opts++inputFile :: Opts.Parser FilePath+inputFile = Opts.strArgument $+ Opts.metavar "GLOB"+ <> Opts.help "A glob for input .purs file(s)."++globInputFile :: Opts.Parser (Maybe FilePath)+globInputFile = Opts.optional $ Opts.strOption $+ Opts.long "source-globs-file"+ <> Opts.metavar "FILE"+ <> Opts.help "A file containing a line-separated list of input .purs globs."++excludeFiles :: Opts.Parser FilePath+excludeFiles = Opts.strOption $+ Opts.short 'x'+ <> Opts.long "exclude-files"+ <> Opts.metavar "GLOB"+ <> Opts.help "A glob of .purs files to exclude from the input .purs files."+
+ app/Version.hs view
@@ -0,0 +1,33 @@+{-# LANGUAGE CPP #-}+{-# LANGUAGE TemplateHaskell #-}++module Version where++import Prelude++import Data.Version (showVersion)+import Paths_purescript as Paths++#ifndef RELEASE+import Development.GitRev qualified as GitRev+#endif++-- Unfortunately, Cabal doesn't support prerelease identifiers on versions. To+-- avoid misleading users who run `purs --version`, we manually add the+-- prerelease identifier here (if any). When releasing a proper version, simply+-- set this to an empty string.+prerelease :: String+prerelease = ""++versionString :: String+versionString = showVersion Paths.version ++ prerelease ++ extra+ where+#ifdef RELEASE+ extra = ""+#else+ extra = " [development build; commit: " ++ $(GitRev.gitHash) ++ dirty ++ "]"+ dirty =+ if $(GitRev.gitDirty)+ then " DIRTY"+ else ""+#endif
+ app/static/normalize.css view
@@ -0,0 +1,427 @@+/*! normalize.css v3.0.2 | MIT License | git.io/normalize */++/**+ * 1. Set default font family to sans-serif.+ * 2. Prevent iOS text size adjust after orientation change, without disabling+ * user zoom.+ */++html {+ font-family: sans-serif; /* 1 */+ -ms-text-size-adjust: 100%; /* 2 */+ -webkit-text-size-adjust: 100%; /* 2 */+}++/**+ * Remove default margin.+ */++body {+ margin: 0;+}++/* HTML5 display definitions+ ========================================================================== */++/**+ * Correct `block` display not defined for any HTML5 element in IE 8/9.+ * Correct `block` display not defined for `details` or `summary` in IE 10/11+ * and Firefox.+ * Correct `block` display not defined for `main` in IE 11.+ */++article,+aside,+details,+figcaption,+figure,+footer,+header,+hgroup,+main,+menu,+nav,+section,+summary {+ display: block;+}++/**+ * 1. Correct `inline-block` display not defined in IE 8/9.+ * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera.+ */++audio,+canvas,+progress,+video {+ display: inline-block; /* 1 */+ vertical-align: baseline; /* 2 */+}++/**+ * Prevent modern browsers from displaying `audio` without controls.+ * Remove excess height in iOS 5 devices.+ */++audio:not([controls]) {+ display: none;+ height: 0;+}++/**+ * Address `[hidden]` styling not present in IE 8/9/10.+ * Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22.+ */++[hidden],+template {+ display: none;+}++/* Links+ ========================================================================== */++/**+ * Remove the gray background color from active links in IE 10.+ */++a {+ background-color: transparent;+}++/**+ * Improve readability when focused and also mouse hovered in all browsers.+ */++a:active,+a:hover {+ outline: 0;+}++/* Text-level semantics+ ========================================================================== */++/**+ * Address styling not present in IE 8/9/10/11, Safari, and Chrome.+ */++abbr[title] {+ border-bottom: 1px dotted;+}++/**+ * Address style set to `bolder` in Firefox 4+, Safari, and Chrome.+ */++b,+strong {+ font-weight: bold;+}++/**+ * Address styling not present in Safari and Chrome.+ */++dfn {+ font-style: italic;+}++/**+ * Address variable `h1` font-size and margin within `section` and `article`+ * contexts in Firefox 4+, Safari, and Chrome.+ */++h1 {+ font-size: 2em;+ margin: 0.67em 0;+}++/**+ * Address styling not present in IE 8/9.+ */++mark {+ background: #ff0;+ color: #000;+}++/**+ * Address inconsistent and variable font size in all browsers.+ */++small {+ font-size: 80%;+}++/**+ * Prevent `sub` and `sup` affecting `line-height` in all browsers.+ */++sub,+sup {+ font-size: 75%;+ line-height: 0;+ position: relative;+ vertical-align: baseline;+}++sup {+ top: -0.5em;+}++sub {+ bottom: -0.25em;+}++/* Embedded content+ ========================================================================== */++/**+ * Remove border when inside `a` element in IE 8/9/10.+ */++img {+ border: 0;+}++/**+ * Correct overflow not hidden in IE 9/10/11.+ */++svg:not(:root) {+ overflow: hidden;+}++/* Grouping content+ ========================================================================== */++/**+ * Address margin not present in IE 8/9 and Safari.+ */++figure {+ margin: 1em 40px;+}++/**+ * Address differences between Firefox and other browsers.+ */++hr {+ -moz-box-sizing: content-box;+ box-sizing: content-box;+ height: 0;+}++/**+ * Contain overflow in all browsers.+ */++pre {+ overflow: auto;+}++/**+ * Address odd `em`-unit font size rendering in all browsers.+ */++code,+kbd,+pre,+samp {+ font-family: monospace, monospace;+ font-size: 1em;+}++/* Forms+ ========================================================================== */++/**+ * Known limitation: by default, Chrome and Safari on OS X allow very limited+ * styling of `select`, unless a `border` property is set.+ */++/**+ * 1. Correct color not being inherited.+ * Known issue: affects color of disabled elements.+ * 2. Correct font properties not being inherited.+ * 3. Address margins set differently in Firefox 4+, Safari, and Chrome.+ */++button,+input,+optgroup,+select,+textarea {+ color: inherit; /* 1 */+ font: inherit; /* 2 */+ margin: 0; /* 3 */+}++/**+ * Address `overflow` set to `hidden` in IE 8/9/10/11.+ */++button {+ overflow: visible;+}++/**+ * Address inconsistent `text-transform` inheritance for `button` and `select`.+ * All other form control elements do not inherit `text-transform` values.+ * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera.+ * Correct `select` style inheritance in Firefox.+ */++button,+select {+ text-transform: none;+}++/**+ * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`+ * and `video` controls.+ * 2. Correct inability to style clickable `input` types in iOS.+ * 3. Improve usability and consistency of cursor style between image-type+ * `input` and others.+ */++button,+html input[type="button"], /* 1 */+input[type="reset"],+input[type="submit"] {+ -webkit-appearance: button; /* 2 */+ cursor: pointer; /* 3 */+}++/**+ * Re-set default cursor for disabled elements.+ */++button[disabled],+html input[disabled] {+ cursor: default;+}++/**+ * Remove inner padding and border in Firefox 4+.+ */++button::-moz-focus-inner,+input::-moz-focus-inner {+ border: 0;+ padding: 0;+}++/**+ * Address Firefox 4+ setting `line-height` on `input` using `!important` in+ * the UA stylesheet.+ */++input {+ line-height: normal;+}++/**+ * It's recommended that you don't attempt to style these elements.+ * Firefox's implementation doesn't respect box-sizing, padding, or width.+ *+ * 1. Address box sizing set to `content-box` in IE 8/9/10.+ * 2. Remove excess padding in IE 8/9/10.+ */++input[type="checkbox"],+input[type="radio"] {+ box-sizing: border-box; /* 1 */+ padding: 0; /* 2 */+}++/**+ * Fix the cursor style for Chrome's increment/decrement buttons. For certain+ * `font-size` values of the `input`, it causes the cursor style of the+ * decrement button to change from `default` to `text`.+ */++input[type="number"]::-webkit-inner-spin-button,+input[type="number"]::-webkit-outer-spin-button {+ height: auto;+}++/**+ * 1. Address `appearance` set to `searchfield` in Safari and Chrome.+ * 2. Address `box-sizing` set to `border-box` in Safari and Chrome+ * (include `-moz` to future-proof).+ */++input[type="search"] {+ -webkit-appearance: textfield; /* 1 */+ -moz-box-sizing: content-box;+ -webkit-box-sizing: content-box; /* 2 */+ box-sizing: content-box;+}++/**+ * Remove inner padding and search cancel button in Safari and Chrome on OS X.+ * Safari (but not Chrome) clips the cancel button when the search input has+ * padding (and `textfield` appearance).+ */++input[type="search"]::-webkit-search-cancel-button,+input[type="search"]::-webkit-search-decoration {+ -webkit-appearance: none;+}++/**+ * Define consistent border, margin, and padding.+ */++fieldset {+ border: 1px solid #c0c0c0;+ margin: 0 2px;+ padding: 0.35em 0.625em 0.75em;+}++/**+ * 1. Correct `color` not being inherited in IE 8/9/10/11.+ * 2. Remove padding so people aren't caught out if they zero out fieldsets.+ */++legend {+ border: 0; /* 1 */+ padding: 0; /* 2 */+}++/**+ * Remove default vertical scrollbar in IE 8/9/10/11.+ */++textarea {+ overflow: auto;+}++/**+ * Don't inherit the `font-weight` (applied by a rule above).+ * NOTE: the default cannot safely be changed in Chrome and Safari on OS X.+ */++optgroup {+ font-weight: bold;+}++/* Tables+ ========================================================================== */++/**+ * Remove most spacing between table cells.+ */++table {+ border-collapse: collapse;+ border-spacing: 0;+}++td,+th {+ padding: 0;+}
+ app/static/pursuit.css view
@@ -0,0 +1,927 @@+/** ************************************************************************* *+ ** CSS for HTML docs (e.g. Pursuit)+ **+ ** STRUCTURE+ **+ ** This CSS file is structured into several sections, from general to+ ** specific, and (mostly) alphabetically within the sections.+ **+ ** Several global element styles are used. This is not encouraged and should+ ** be kept to a minimum. If you want to add new styles you'll most likely+ ** want to add a new CSS component. See the Components section for examples.+ **+ ** CSS components use three simple naming ideas from the BEM system:+ ** - Block: `.my-component`+ ** - Element: `.my-component__item`+ ** - Modifier: `.my-component.my-component--highlighted`+ **+ ** Example:+ ** <div .my-component>+ ** <div .my-component__item>+ ** <div .my-component__item>+ ** ...+ ** <div .my-component.my-component--highlighted>+ ** <div .my-component__item>+ ** <div .my-component__item>+ **+ ** Components can be nested.+ **+ **+ ** TYPOGRAPHY+ **+ ** Typographic choices for sizes, line-heights and margins are based on a+ ** musical major third scale (4:5). This gives us a way to find numbers+ ** and relationships between them that are perceived as harmonic.+ **+ ** To make use of this modular scale, use a ratio of the form+ ** (5/4)^n+ ** where n ∈ ℤ, -6 ≤ n ≤ 8.+ **+ ** LESS+ **+ ** This CSS is generated by less. To compile it:+ **+ ** npm install [-g] less+ ** lessc app/static/pursuit.less > app/static/pursuit.css+ **+ ** ************************************************************************* */+/* Section: Variables+ * ========================================================================== */+/* Section: Document Styles+ * ========================================================================== */+:root {+ color-scheme: light dark;+}+html {+ box-sizing: border-box;+ /* This overflow rule prevents everything from shifting slightly to the side+ when moving from a page which isn't large enough to generate a scrollbar+ to one that is. */+ overflow-y: scroll;+}+*,+*::before,+*::after {+ box-sizing: inherit;+}+body {+ background-color: #ffffff;+ color: #000000;+ font-family: "Roboto", sans-serif;+ font-size: 87.5%;+ line-height: 1.563;+}+@media (prefers-color-scheme: dark) {+ body {+ background-color: #141417;+ color: #dedede;+ }+}+@media (min-width: 38em) {+ body {+ font-size: 100%;+ }+}+/* Section: Utility Classes+ * ========================================================================== */+.clear-floats {+ clear: both;+}+.clearfix::before,+.clearfix::after {+ content: " ";+ display: table;+}+.clearfix::after {+ clear: both;+}+/* Content hidden like this will still be read by a screen reader */+.hide-visually {+ position: absolute;+ left: -10000px;+ top: auto;+ width: 1px;+ height: 1px;+ overflow: hidden;+}+/* Section: Layout+ * ========================================================================== */+.container {+ display: block;+ max-width: 66em;+ margin-left: auto;+ margin-right: auto;+ padding-left: 20px;+ padding-right: 20px;+}+.col {+ display: block;+ position: relative;+ width: 100%;+}+.col.col--main {+ margin-bottom: 3.08em;+}+.col.col--aside {+ margin-bottom: 2.44em;+}+@media (min-width: 52em) {+ .container {+ padding-left: 30px;+ padding-right: 30px;+ }+ .col.col--main {+ float: left;+ width: 63.655%;+ /* 66.6…% - 30px */+ }+ .col.col--aside {+ float: right;+ font-size: 87.5%;+ width: 33.333333%;+ }+}+@media (min-width: 66em) {+ .col.col--aside {+ font-size: inherit;+ }+}+/* Footer+ * Based on http://www.lwis.net/journal/2008/02/08/pure-css-sticky-footer/+ * Except we don't support IE6+ * -------------------------------------------------------------------------- */+html,+body {+ height: 100%;+}+.everything-except-footer {+ min-height: 100%;+ padding-bottom: 3em;+}+.footer {+ position: relative;+ height: 3em;+ margin-top: -3em;+ width: 100%;+ text-align: center;+ background-color: #1d222d;+ color: #f0f0f0;+}+@media (prefers-color-scheme: dark) {+ .footer {+ background-color: #1d222d;+ color: #f0f0f0;+ }+}+.footer * {+ margin-bottom: 0;+}+/* Section: Element Styles+ *+ * Have as few of these as possible and keep them general, because they will+ * influence every component hereafter.+ * ========================================================================== */+:target {+ background-color: #f1f5f9;+}+@media (prefers-color-scheme: dark) {+ :target {+ background-color: #232327;+ }+}+a,+a:visited {+ color: #c4953a;+ text-decoration: none;+ font-weight: bold;+}+@media (prefers-color-scheme: dark) {+ a,+ a:visited {+ color: #d8ac55;+ }+}+a:hover {+ color: #7b5904;+ text-decoration: none;+}+@media (prefers-color-scheme: dark) {+ a:hover {+ color: #f0dcab;+ }+}+code,+pre {+ background-color: #f1f5f9;+ border-radius: 3px;+ color: #194a5b;+ font-family: "Roboto Mono", monospace;+ font-size: 87.5%;+}+@media (prefers-color-scheme: dark) {+ code,+ pre {+ background-color: #232327;+ color: #c1d3da;+ }+}+:target code,+:target pre {+ background-color: #dfe8f1;+}+@media (prefers-color-scheme: dark) {+ :target code,+ :target pre {+ background-color: #2f2f34;+ }+}+code {+ padding: 0.2em 0;+ margin: 0;+ white-space: pre-wrap;+ word-wrap: break-word;+}+code::before,+code::after {+ letter-spacing: -0.2em;+ content: "\00a0";+}+a > code {+ font-weight: normal;+}+a > code::before {+ content: "🡒";+ letter-spacing: 0.33em;+}+a:hover > code {+ color: #c4953a;+}+@media (prefers-color-scheme: dark) {+ a:hover > code {+ color: #d8ac55;+ }+}+pre {+ margin-top: 0;+ margin-bottom: 0;+ padding: 1em 1.25rem;+ /* Using rem here to align with lists etc. */+ overflow: auto;+ white-space: pre;+ word-wrap: normal;+}+pre code {+ background-color: transparent;+ border: 0;+ font-size: 100%;+ max-width: auto;+ padding: 0;+ margin: 0;+ overflow: visible;+ line-height: inherit;+ white-space: pre;+ word-break: normal;+ word-wrap: normal;+}+pre code::before,+pre code::after {+ content: normal;+}+h1 {+ font-size: 3.052em;+ font-weight: 300;+ letter-spacing: -0.5px;+ line-height: 1.125;+ margin-top: 1.563rem;+ margin-bottom: 1.25rem;+}+@media (min-width: 52em) {+ h1 {+ font-size: 3.814em;+ margin-top: 5.96rem;+ }+}+h2 {+ font-size: 1.953em;+ font-weight: normal;+ line-height: 1.25;+ margin-top: 3.052rem;+ margin-bottom: 1rem;+}+h3 {+ font-size: 1.563em;+ font-weight: normal;+ line-height: 1.25;+ margin-top: 2.441rem;+ margin-bottom: 1rem;+}+h4 {+ font-size: 1.25em;+ font-weight: normal;+ margin-top: 2.441rem;+ margin-bottom: 1rem;+}+h1 + h2,+h1 + h3,+h1 + h4,+h2 + h3,+h2 + h4,+h3 + h4 {+ margin-top: 1rem;+}+hr {+ border: none;+ height: 1px;+ background-color: #cccccc;+}+@media (prefers-color-scheme: dark) {+ hr {+ background-color: #43434e;+ }+}+img {+ border-style: none;+ max-width: 100%;+}+p {+ font-size: 1em;+ margin-top: 1rem;+ margin-bottom: 1rem;+}+table {+ border-bottom: 1px solid #cccccc;+ border-collapse: collapse;+ border-spacing: 0;+ margin-top: 1rem;+ margin-bottom: 1rem;+ width: 100%;+}+@media (prefers-color-scheme: dark) {+ table {+ border-bottom-color: #43434e;+ }+}+td,+th {+ text-align: left;+ padding: 0.41em 0.51em;+}+td {+ border-top: 1px solid #cccccc;+}+@media (prefers-color-scheme: dark) {+ td {+ border-top-color: #43434e;+ }+}+td:first-child,+th:first-child {+ padding-left: 0;+}+td:last-child,+th:last-child {+ padding-right: 0;+}+ul {+ list-style-type: none;+ margin-top: 1rem;+ margin-bottom: 1rem;+ padding-left: 0;+}+ul li {+ position: relative;+ padding-left: 1.25em;+}+ul li::before {+ position: absolute;+ color: #a0a0a0;+ content: "–";+ display: inline-block;+ margin-left: -1.25em;+ width: 1.25em;+}+@media (prefers-color-scheme: dark) {+ ul li::before {+ color: #a0a0a0;+ }+}+/* Tying this tightly to ul at the moment because it's a slight variation thereof */+ul.ul--search li::before {+ content: "⚲";+ top: -0.2em;+ transform: rotate(-45deg);+}+ol {+ margin-top: 1rem;+ margin-bottom: 1rem;+ padding-left: 1.25em;+}+ol li {+ position: relative;+ padding-left: 0;+}+/* Section: Components+ * ========================================================================== */+/* Component: Badge+ * -------------------------------------------------------------------------- */+.badge {+ position: relative;+ top: -0.1em;+ display: inline-block;+ background-color: #000000;+ border-radius: 1.3em;+ color: #ffffff;+ font-size: 77%;+ font-weight: bold;+ line-height: 1.563;+ text-align: center;+ height: 1.5em;+ width: 1.5em;+}+@media (prefers-color-scheme: dark) {+ .badge {+ background-color: #dedede;+ color: #141417;+ }+}+.badge.badge--package {+ background-color: #c4953a;+ letter-spacing: -0.1em;+}+@media (prefers-color-scheme: dark) {+ .badge.badge--package {+ background-color: #d8ac55;+ }+}+.badge.badge--module {+ background-color: #75B134;+}+/* Component: Declarations+ * -------------------------------------------------------------------------- */+.decl__title {+ position: relative;+ padding-bottom: 0.328em;+ margin-bottom: 0.262em;+}+.decl__source {+ display: block;+ float: right;+ font-size: 64%;+ position: relative;+ top: 0.57em;+}+.decl__anchor,+.decl__anchor:visited {+ position: absolute;+ left: -0.8em;+ color: #bababa;+}+@media (prefers-color-scheme: dark) {+ .decl__anchor,+ .decl__anchor:visited {+ color: #878787;+ }+}+.decl__anchor:hover {+ color: #c4953a;+}+@media (prefers-color-scheme: dark) {+ .decl__anchor:hover {+ color: #d8ac55;+ }+}+.decl__signature {+ background-color: transparent;+ border-radius: 0;+ border-top: 1px solid #cccccc;+ border-bottom: 1px solid #cccccc;+ padding: 0;+}+@media (prefers-color-scheme: dark) {+ .decl__signature {+ border-top-color: #43434e;+ border-bottom-color: #43434e;+ }+}+.decl__signature code {+ display: block;+ padding: 0.328em 0;+ padding-left: 2.441em;+ text-indent: -2.441em;+ white-space: normal;+}+.decl__role {+ font-family: "Roboto", sans-serif;+ font-style: italic;+ font-weight: normal;+}+/* See https://stackoverflow.com/a/32162038+ Content licensed under CC BY-SA 3.0+*/+.decl__role_hover[title] {+ /* Remove line that appears under abbr element */+ border-bottom: none;+ text-decoration: none;+ /* Ensure cursor doesn't change to question mark */+ cursor: inherit;+}+.decl__role_nominal::after {+ content: "nominal";+}+.decl__role_phantom::after {+ content: "phantom";+}+.decl__kind {+ border-bottom: 1px solid #cccccc;+}+@media (prefers-color-scheme: dark) {+ .decl__kind {+ border-bottom-color: #43434e;+ }+}+:target .decl__signature,+:target .decl__signature code {+ /* We want the background to be transparent, even when the parent is a target */+ background-color: transparent;+}+.decl__body .keyword,+.decl__body .syntax {+ color: #0b71b4;+}+@media (prefers-color-scheme: dark) {+ .decl__body .keyword,+ .decl__body .syntax {+ color: #3796d5;+ }+}+.decl__child_comments {+ margin-top: 1rem;+ margin-bottom: 1rem;+}+/* Component: Dependency Link+ * -------------------------------------------------------------------------- */+.deplink {+ /* Currently no root styles, but keep the class as a namespace */+}+.deplink__link {+ display: inline-block;+ margin-right: 0.41em;+}+.deplink__version {+ color: #666666;+ display: inline-block;+ font-size: 0.8em;+ line-height: 1;+}+@media (prefers-color-scheme: dark) {+ .deplink__version {+ color: #a0a0a0;+ }+}+/* Component: Grouped List+ * -------------------------------------------------------------------------- */+.grouped-list {+ border-top: 1px solid #cccccc;+ margin: 0 0 2.44em 0;+}+@media (prefers-color-scheme: dark) {+ .grouped-list {+ border-top-color: #43434e;+ }+}+.grouped-list__title {+ color: #666666;+ font-size: 0.8em;+ font-weight: 300;+ letter-spacing: 1px;+ margin: 0.8em 0 -0.1em 0;+ text-transform: uppercase;+}+@media (prefers-color-scheme: dark) {+ .grouped-list__title {+ border-top-color: #a0a0a0;+ }+}+.grouped-list__item {+ margin: 0;+}+/* Component: Message+ * -------------------------------------------------------------------------- */+.message {+ border: 5px solid;+ border-radius: 5px;+ padding: 1em !important;+}+.message.message--error {+ background-color: #fff0f0;+ border-color: #c85050;+}+@media (prefers-color-scheme: dark) {+ .message.message--error {+ background-color: #6b0e0e;+ border-color: #c85050;+ }+}+.message.message--not-available {+ background-color: #f0f096;+ border-color: #e3e33d;+}+@media (prefers-color-scheme: dark) {+ .message.message--not-available {+ background-color: #56560b;+ border-color: #b0b017;+ }+}+/* Component: Multi Col+ * Multiple columns side by side+ * -------------------------------------------------------------------------- */+.multi-col {+ margin-bottom: 2.44em;+}+.multi-col__col {+ display: block;+ padding-right: 1em;+ position: relative;+ width: 100%;+}+@media (min-width: 38em) and (max-width: 51.999999em) {+ .multi-col__col {+ float: left;+ width: 50%;+ }+ .multi-col__col:nth-child(2n+3) {+ clear: both;+ }+}+@media (min-width: 52em) {+ .multi-col__col {+ float: left;+ width: 33.333333%;+ }+ .multi-col__col:nth-child(3n+4) {+ clear: both;+ }+}+/* Component: Page Title+ * -------------------------------------------------------------------------- */+.page-title {+ margin: 4.77em 0 1.56em;+ padding-bottom: 1.25em;+ position: relative;+}+.page-title__title {+ margin: 0 0 0 -0.05em;+ /* Visually align on left edge */+}+.page-title__label {+ position: relative;+ color: #666666;+ font-size: 0.8rem;+ font-weight: 300;+ letter-spacing: 1px;+ margin-bottom: -0.8em;+ text-transform: uppercase;+ z-index: 1;+}+@media (prefers-color-scheme: dark) {+ .page-title__label {+ color: #a0a0a0;+ }+}+/* Component: Top Banner+ * -------------------------------------------------------------------------- */+.top-banner {+ background-color: #1d222d;+ color: #f0f0f0;+ font-weight: normal;+}+@media (prefers-color-scheme: dark) {+ .top-banner {+ background-color: #1d222d;+ color: #f0f0f0;+ }+}+.top-banner__logo,+.top-banner__logo:visited {+ float: left;+ color: #f0f0f0;+ font-size: 2.44em;+ font-weight: 300;+ line-height: 90px;+ margin: 0;+}+@media (prefers-color-scheme: dark) {+ .top-banner__logo,+ .top-banner__logo:visited {+ color: #f0f0f0;+ }+}+.top-banner__logo:hover {+ color: #c4953a;+ text-decoration: none;+}+.top-banner__form {+ margin-bottom: 1.25em;+}+.top-banner__form input {+ border: 1px solid #1d222d;+ border-radius: 3px;+ background-color: #ffffff;+ color: #1d222d;+ font-weight: 300;+ line-height: 2;+ padding: 0.21em 0.512em;+ width: 100%;+}+@media (prefers-color-scheme: dark) {+ .top-banner__form input {+ border-color: #1d222d;+ background-color: #141417;+ color: #dedede;+ }+}+.top-banner__actions {+ float: right;+ text-align: right;+}+.top-banner__actions__item {+ display: inline-block;+ line-height: 90px;+ margin: 0;+ padding-left: 1.25em;+}+.top-banner__actions__item:first-child {+ padding-left: 0;+}+.top-banner__actions__item a,+.top-banner__actions__item a:visited {+ color: #f0f0f0;+}+@media (prefers-color-scheme: dark) {+ .top-banner__actions__item a,+ .top-banner__actions__item a:visited {+ color: #f0f0f0;+ }+}+.top-banner__actions__item a:hover {+ color: #c4953a;+}+@media (prefers-color-scheme: dark) {+ .top-banner__actions__item a:hover {+ color: #d8ac55;+ }+}+@media (min-width: 38em) {+ .top-banner__logo {+ float: left;+ width: 25%;+ }+ .top-banner__form {+ float: left;+ line-height: 90px;+ margin-bottom: 0;+ width: 50%;+ }+ .top-banner__actions {+ float: right;+ width: 25%;+ }+}+/* Component: Search Results+ * -------------------------------------------------------------------------- */+.result.result--empty {+ font-size: 1.25em;+}+.result__title {+ font-size: 1.25em;+ margin-bottom: 0.2rem;+}+.result__badge {+ margin-left: -0.1em;+}+.result__body > *:first-child {+ margin-top: 0!important;+}+.result__body > *:last-child {+ margin-bottom: 0!important;+}+.result__signature {+ background-color: transparent;+ border-radius: 0;+ border-top: 1px solid #cccccc;+ border-bottom: 1px solid #cccccc;+ padding: 0.328em 0;+}+@media (prefers-color-scheme: dark) {+ .result__signature {+ border-top-color: #43434e;+ border-bottom-color: #43434e;+ }+}+.result__signature code {+ display: block;+ padding-left: 2.441em;+ text-indent: -2.441em;+ white-space: normal;+}+.result__actions {+ margin-top: 0.2rem;+}+.result__actions__item {+ font-size: 80%;+}+.result__actions__item + .result__actions__item {+ margin-left: 0.65em;+}+/* Component: Version Selector+ * -------------------------------------------------------------------------- */+.version-selector {+ margin-bottom: 0.8em;+}+@media (min-width: 38em) {+ .version-selector {+ position: absolute;+ top: 0.8em;+ right: 0;+ margin-bottom: 0;+ }+}+/* Section: FIXME+ * These styles should be cleaned up+ * ========================================================================== */+/* Help paragraphs */+.help {+ padding: 5px 0;+}+.help h3 {+ /* FIXME: target with class */+ margin-top: 16px;+}+/* Section: Markdown+ * Github rendered README+ * ========================================================================== */+.markdown-body {+ /*+ Useful for narrow screens, such as mobiles. Documentation often contains URLs+ which would otherwise force the page to become wider, and force creation of+ horizontal scrollbars. Yuck.+ */+ word-wrap: break-word;+}+.markdown-body > *:first-child {+ margin-top: 0 !important;+}+.markdown-body > *:last-child {+ margin-bottom: 0 !important;+}+.markdown-body a:not([href]) {+ color: inherit;+ text-decoration: none;+}+.markdown-body blockquote {+ margin: 0;+ padding: 0 1em;+ color: #777;+ border-left: 0.25em solid #ddd;+}+@media (prefers-color-scheme: dark) {+ .markdown-body blockquote {+ border-left-color: #444;+ }+}+.markdown-body blockquote > :first-child {+ margin-top: 0;+}+.markdown-body blockquote > :last-child {+ margin-bottom: 0;+}+.markdown-body .anchor {+ /* We hide the anchor because the link doesn't point to a valid location */+ display: none;+}+.markdown-body .pl-k {+ /* Keyword */+ color: #a0a0a0;+}+@media (prefers-color-scheme: dark) {+ .markdown-body .pl-k {+ color: #676767;+ }+}+.markdown-body .pl-c1,+.markdown-body .pl-en {+ /* Not really sure what this is */+ color: #39d;+}+.markdown-body .pl-s {+ /* String literals */+ color: #1a1;+}+.markdown-body .pl-cce {+ /* String literal escape sequences */+ color: #921;+}+.markdown-body .pl-smi {+ /* type variables? */+ color: #62b;+}
+ app/static/pursuit.less view
@@ -0,0 +1,1070 @@+/** ************************************************************************* *+ ** CSS for HTML docs (e.g. Pursuit)+ **+ ** STRUCTURE+ **+ ** This CSS file is structured into several sections, from general to+ ** specific, and (mostly) alphabetically within the sections.+ **+ ** Several global element styles are used. This is not encouraged and should+ ** be kept to a minimum. If you want to add new styles you'll most likely+ ** want to add a new CSS component. See the Components section for examples.+ **+ ** CSS components use three simple naming ideas from the BEM system:+ ** - Block: `.my-component`+ ** - Element: `.my-component__item`+ ** - Modifier: `.my-component.my-component--highlighted`+ **+ ** Example:+ ** <div .my-component>+ ** <div .my-component__item>+ ** <div .my-component__item>+ ** ...+ ** <div .my-component.my-component--highlighted>+ ** <div .my-component__item>+ ** <div .my-component__item>+ **+ ** Components can be nested.+ **+ **+ ** TYPOGRAPHY+ **+ ** Typographic choices for sizes, line-heights and margins are based on a+ ** musical major third scale (4:5). This gives us a way to find numbers+ ** and relationships between them that are perceived as harmonic.+ **+ ** To make use of this modular scale, use a ratio of the form+ ** (5/4)^n+ ** where n ∈ ℤ, -6 ≤ n ≤ 8.+ **+ ** LESS+ **+ ** This CSS is generated by less. To compile it:+ **+ ** npm install [-g] less+ ** lessc app/static/pursuit.less > app/static/pursuit.css+ **+ ** ************************************************************************* */++/* Section: Variables+ * ========================================================================== */+@background: rgb(255, 255, 255);+@foreground: rgb(0, 0, 0);+@banner_background: rgb(29, 34, 45);+@dim_foreground: rgb(240, 240, 240);+@link: rgb(196, 149, 58);+@link_active: rgb(123, 89, 4);+@error_background: rgb(255, 240, 240);+@error_border: rgb(200, 80, 80);+@not_available_background: rgb(240, 240, 150);+@code_foreground: rgb(25, 74, 91);+@code_background: rgb(241, 245, 249);+@dim_glyph: rgb(160, 160, 160);+@dim_type: rgb(102, 102, 102);+@keyword: rgb(11, 113, 180);++@dark_background: rgb(20, 20, 23);+@dark_foreground: rgb(222, 222, 222);+@dark_banner_background: rgb(29, 34, 45);+@dark_dim_foreground: rgb(240, 240, 240);+@dark_link: rgb(216, 172, 85);+@dark_link_active: rgb(240, 220, 171);+@dark_error_background: rgb(107, 14, 14);+@dark_error_border: rgb(200, 80, 80);+@dark_not_available_background: rgb(86, 86, 11);+@dark_code_foreground: rgb(193, 211, 218);+@dark_code_background: rgb(35, 35, 39);+@dark_dim_glyph: rgb(160, 160, 160);+@dark_dim_type: rgb(160, 160, 160);+@dark_keyword: rgb(55, 150, 213);++/* Section: Document Styles+ * ========================================================================== */++:root {+ color-scheme: light dark;+}++html {+ box-sizing: border-box;++ /* This overflow rule prevents everything from shifting slightly to the side+ when moving from a page which isn't large enough to generate a scrollbar+ to one that is. */+ overflow-y: scroll;+}++*, *::before, *::after {+ box-sizing: inherit;+}++body {+ background-color: @background;+ color: @foreground;+ font-family: "Roboto", sans-serif;+ font-size: 87.5%;+ line-height: 1.563;++ @media (prefers-color-scheme: dark) {+ background-color: @dark_background;+ color: @dark_foreground;+ }+}++@media (min-width: 38em) {+ body {+ font-size: 100%;+ }+}+++/* Section: Utility Classes+ * ========================================================================== */++.clear-floats {+ clear: both;+}++.clearfix::before,+.clearfix::after {+ content: " ";+ display: table;+}++.clearfix::after {+ clear: both;+}++/* Content hidden like this will still be read by a screen reader */+.hide-visually {+ position: absolute;+ left: -10000px;+ top: auto;+ width: 1px;+ height: 1px;+ overflow: hidden;+}+++/* Section: Layout+ * ========================================================================== */++.container {+ display: block;+ max-width: 66em;+ margin-left: auto;+ margin-right: auto;+ padding-left: 20px;+ padding-right: 20px;+}++.col {+ display: block;+ position: relative;+ width: 100%;+}++.col.col--main {+ margin-bottom: 3.08em;+}++.col.col--aside {+ margin-bottom: 2.44em;+}++@media (min-width: 52em) {+ .container {+ padding-left: 30px;+ padding-right: 30px;+ }++ .col.col--main {+ float: left;+ width: 63.655%; /* 66.6…% - 30px */+ }++ .col.col--aside {+ float: right;+ font-size: 87.5%;+ width: 33.333333%;+ }+}++@media (min-width: 66em) {+ .col.col--aside {+ font-size: inherit;+ }+}+++/* Footer+ * Based on http://www.lwis.net/journal/2008/02/08/pure-css-sticky-footer/+ * Except we don't support IE6+ * -------------------------------------------------------------------------- */++html, body {+ height: 100%;+}++.everything-except-footer {+ min-height: 100%;+ padding-bottom: 3em;+}++.footer {+ position: relative;+ height: 3em;+ margin-top: -3em;+ width: 100%;+ text-align: center;+ background-color: @banner_background;+ color: @dim_foreground;++ @media (prefers-color-scheme: dark) {+ background-color: @dark_banner_background;+ color: @dark_dim_foreground;+ }+}++.footer * {+ margin-bottom: 0;+}+++/* Section: Element Styles+ *+ * Have as few of these as possible and keep them general, because they will+ * influence every component hereafter.+ * ========================================================================== */++:target {+ background-color: @code_background;++ @media (prefers-color-scheme: dark) {+ background-color: @dark_code_background;+ }+}++a, a:visited {+ color: @link;+ text-decoration: none;+ font-weight: bold;++ @media (prefers-color-scheme: dark) {+ color: @dark_link;+ }+}++a:hover {+ color: @link_active;+ text-decoration: none;++ @media (prefers-color-scheme: dark) {+ color: @dark_link_active;+ }+}++code, pre {+ background-color: @code_background;+ border-radius: 3px;+ color: @code_foreground;+ font-family: "Roboto Mono", monospace;+ font-size: 87.5%;++ @media (prefers-color-scheme: dark) {+ background-color: @dark_code_background;+ color: @dark_code_foreground;+ }+}++:target code,+:target pre {+ background-color: darken(@code_background, 5%);++ @media (prefers-color-scheme: dark) {+ background-color: lighten(@dark_code_background, 5%);+ }+}++code {+ padding: 0.2em 0;+ margin: 0;+ white-space: pre-wrap;+ word-wrap: break-word;+}++code::before,+code::after {+ letter-spacing: -0.2em;+ content: "\00a0";+}++a > code {+ font-weight: normal;+}++a > code::before {+ content: "🡒";+ letter-spacing: 0.33em;+}++a:hover > code {+ color: @link;++ @media (prefers-color-scheme: dark) {+ color: @dark_link;+ }+}++pre {+ margin-top: 0;+ margin-bottom: 0;+ padding: 1em 1.25rem; /* Using rem here to align with lists etc. */+ overflow: auto;+ white-space: pre;+ word-wrap: normal;+}++pre code {+ background-color: transparent;+ border: 0;+ font-size: 100%;+ max-width: auto;+ padding: 0;+ margin: 0;+ overflow: visible;+ line-height: inherit;+ white-space: pre;+ word-break: normal;+ word-wrap: normal;+}++pre code::before,+pre code::after {+ content: normal;+}++h1 {+ font-size: 3.052em;+ font-weight: 300;+ letter-spacing: -0.5px;+ line-height: 1.125;+ margin-top: 1.563rem;+ margin-bottom: 1.25rem;+}++@media (min-width: 52em) {+ h1 {+ font-size: 3.814em;+ margin-top: 5.96rem;+ }+}++h2 {+ font-size: 1.953em;+ font-weight: normal;+ line-height: 1.250;+ margin-top: 3.052rem;+ margin-bottom: 1rem;+}++h3 {+ font-size: 1.563em;+ font-weight: normal;+ line-height: 1.250;+ margin-top: 2.441rem;+ margin-bottom: 1rem;+}++h4 {+ font-size: 1.25em;+ font-weight: normal;+ margin-top: 2.441rem;+ margin-bottom: 1rem;+}++h1 + h2,+h1 + h3,+h1 + h4,+h2 + h3,+h2 + h4,+h3 + h4 {+ margin-top: 1rem;+}++hr {+ border: none;+ height: 1px;+ background-color: darken(@background, 20%);++ @media (prefers-color-scheme: dark) {+ background-color: lighten(@dark_background, 20%);+ }+}++img {+ border-style: none;+ max-width: 100%;+}++p {+ font-size: 1em;+ margin-top: 1rem;+ margin-bottom: 1rem;+}++table {+ border-bottom: 1px solid darken(@background, 20%);+ border-collapse: collapse;+ border-spacing: 0;+ margin-top: 1rem;+ margin-bottom: 1rem;+ width: 100%;++ @media (prefers-color-scheme: dark) {+ border-bottom-color: lighten(@dark_background, 20%);+ }+}++td, th {+ text-align: left;+ padding: 0.41em 0.51em;+}++td {+ border-top: 1px solid darken(@background, 20%);++ @media (prefers-color-scheme: dark) {+ border-top-color: lighten(@dark_background, 20%);+ }+}++td:first-child, th:first-child {+ padding-left: 0;+}++td:last-child, th:last-child {+ padding-right: 0;+}++ul {+ list-style-type: none;+ margin-top: 1rem;+ margin-bottom: 1rem;+ padding-left: 0;+}++ul li {+ position: relative;+ padding-left: 1.250em;+}++ul li::before {+ position: absolute;+ color: @dim_glyph;+ content: "–";+ display: inline-block;+ margin-left: -1.250em;+ width: 1.250em;++ @media (prefers-color-scheme: dark) {+ color: @dark_dim_glyph;+ }+}++/* Tying this tightly to ul at the moment because it's a slight variation thereof */+ul.ul--search li::before {+ content: "⚲";+ top: -0.2em;+ transform: rotate(-45deg);+}++ol {+ margin-top: 1rem;+ margin-bottom: 1rem;+ padding-left: 1.250em;+}++ol li {+ position: relative;+ padding-left: 0;+}+++/* Section: Components+ * ========================================================================== */++/* Component: Badge+ * -------------------------------------------------------------------------- */++.badge {+ position: relative;+ top: -0.1em;+ display: inline-block;+ background-color: @foreground;+ border-radius: 1.3em;+ color: @background;+ font-size: 77%;+ font-weight: bold;+ line-height: 1.563;+ text-align: center;+ height: 1.5em;+ width: 1.5em;++ @media (prefers-color-scheme: dark) {+ background-color: @dark_foreground;+ color: @dark_background;+ }+}++.badge.badge--package {+ background-color: @link;+ letter-spacing: -0.1em;++ @media (prefers-color-scheme: dark) {+ background-color: @dark_link;+ }+}++.badge.badge--module {+ background-color: #75B134;+}+++/* Component: Declarations+ * -------------------------------------------------------------------------- */++.decl {}++.decl__title {+ position: relative;+ padding-bottom: 0.328em;+ margin-bottom: 0.262em;+}++.decl__source {+ display: block;+ float: right;+ font-size: 64%;+ position: relative;+ top: 0.57em;+}++.decl__anchor, .decl__anchor:visited {+ position: absolute;+ left: -0.8em;+ color: lighten(@dim_glyph, 10%);++ @media (prefers-color-scheme: dark) {+ color: darken(@dark_dim_glyph, 10%);+ }+}++.decl__anchor:hover {+ color: @link;++ @media (prefers-color-scheme: dark) {+ color: @dark_link;+ }+}++.decl__signature {+ background-color: transparent;+ border-radius: 0;+ border-top: 1px solid darken(@background, 20%);+ border-bottom: 1px solid darken(@background, 20%);+ padding: 0;++ @media (prefers-color-scheme: dark) {+ border-top-color: lighten(@dark_background, 20%);+ border-bottom-color: lighten(@dark_background, 20%);+ }+}++.decl__signature code {+ display: block;+ padding: 0.328em 0;+ padding-left: 2.441em;+ text-indent: -2.441em;+ white-space: normal;+}++.decl__role {+ font-family: "Roboto", sans-serif;+ font-style: italic;+ font-weight: normal;+}++/* See https://stackoverflow.com/a/32162038+ Content licensed under CC BY-SA 3.0+*/+.decl__role_hover[title] {+ /* Remove line that appears under abbr element */+ border-bottom: none;+ text-decoration: none;++ /* Ensure cursor doesn't change to question mark */+ cursor: inherit;+}++.decl__role_nominal::after {+ content: "nominal";+}++.decl__role_phantom::after {+ content: "phantom";+}++.decl__kind {+ border-bottom: 1px solid darken(@background, 20%);++ @media (prefers-color-scheme: dark) {+ border-bottom-color: lighten(@dark_background, 20%);+ }+}++:target .decl__signature,+:target .decl__signature code {+ /* We want the background to be transparent, even when the parent is a target */+ background-color: transparent;+}++.decl__body .keyword,+.decl__body .syntax {+ color: @keyword;++ @media (prefers-color-scheme: dark) {+ color: @dark_keyword;+ }+}++.decl__child_comments {+ margin-top: 1rem;+ margin-bottom: 1rem;+}++/* Component: Dependency Link+ * -------------------------------------------------------------------------- */++.deplink { /* Currently no root styles, but keep the class as a namespace */ }++.deplink__link {+ display: inline-block;+ margin-right: 0.41em;+}++.deplink__version {+ color: @dim_type;+ display: inline-block;+ font-size: 0.8em;+ line-height: 1;++ @media (prefers-color-scheme: dark) {+ color: @dark_dim_type;+ }+}+++/* Component: Grouped List+ * -------------------------------------------------------------------------- */++.grouped-list {+ border-top: 1px solid darken(@background, 20%);+ margin: 0 0 2.44em 0;++ @media (prefers-color-scheme: dark) {+ border-top-color: lighten(@dark_background, 20%);+ }+}++.grouped-list__title {+ color: @dim_type;+ font-size: 0.8em;+ font-weight: 300;+ letter-spacing: 1px;+ margin: 0.8em 0 -0.1em 0;+ text-transform: uppercase;++ @media (prefers-color-scheme: dark) {+ border-top-color: @dark_dim_type;+ }+}++.grouped-list__item {+ margin: 0;+}+++/* Component: Message+ * -------------------------------------------------------------------------- */++.message {+ border: 5px solid;+ border-radius: 5px;+ padding: 1em !important;+}++.message.message--error {+ background-color: @error_background;+ border-color: @error_border;++ @media (prefers-color-scheme: dark) {+ background-color: @dark_error_background;+ border-color: @dark_error_border;+ }+}++.message.message--not-available {+ background-color: @not_available_background;+ border-color: darken(@not_available_background, 20%);++ @media (prefers-color-scheme: dark) {+ background-color: @dark_not_available_background;+ border-color: lighten(@dark_not_available_background, 20%);+ }+}+++/* Component: Multi Col+ * Multiple columns side by side+ * -------------------------------------------------------------------------- */++.multi-col {+ margin-bottom: 2.44em;+}++.multi-col__col {+ display: block;+ padding-right: 1em;+ position: relative;+ width: 100%;+}++@media (min-width: 38em) and (max-width: 51.999999em) {+ .multi-col__col {+ float: left;+ width: 50%;+ }++ .multi-col__col:nth-child(2n+3) {+ clear: both;+ }+}++@media (min-width: 52em) {+ .multi-col__col {+ float: left;+ width: 33.333333%;+ }++ .multi-col__col:nth-child(3n+4) {+ clear: both;+ }+}+++/* Component: Page Title+ * -------------------------------------------------------------------------- */++.page-title {+ margin: 4.77em 0 1.56em;+ padding-bottom: 1.25em;+ position: relative;+}++.page-title__title {+ margin: 0 0 0 -0.05em; /* Visually align on left edge */+}++.page-title__label {+ position: relative;+ color: @dim_type;+ font-size: 0.8rem;+ font-weight: 300;+ letter-spacing: 1px;+ margin-bottom: -0.8em;+ text-transform: uppercase;+ z-index: 1;++ @media (prefers-color-scheme: dark) {+ color: @dark_dim_type;+ }+}+++/* Component: Top Banner+ * -------------------------------------------------------------------------- */++.top-banner {+ background-color: @banner_background;+ color: @dim_foreground;+ font-weight: normal;++ @media (prefers-color-scheme: dark) {+ background-color: @dark_banner_background;+ color: @dark_dim_foreground;+ }+}++.top-banner__logo,+.top-banner__logo:visited {+ float: left;+ color: @dim_foreground;+ font-size: 2.44em;+ font-weight: 300;+ line-height: 90px;+ margin: 0;++ @media (prefers-color-scheme: dark) {+ color: @dark_dim_foreground;+ }+}++.top-banner__logo:hover {+ color: @link;+ text-decoration: none;+}++.top-banner__form {+ margin-bottom: 1.25em;+}++.top-banner__form input {+ border: 1px solid @banner_background;+ border-radius: 3px;+ background-color: @background;+ color: @banner_background;+ font-weight: 300;+ line-height: 2;+ padding: 0.21em 0.512em;+ width: 100%;++ @media (prefers-color-scheme: dark) {+ border-color: @dark_banner_background;+ background-color: @dark_background;+ color: @dark_foreground;+ }+}++.top-banner__actions {+ float: right;+ text-align: right;+}++.top-banner__actions__item {+ display: inline-block;+ line-height: 90px;+ margin: 0;+ padding-left: 1.25em;+}++.top-banner__actions__item:first-child {+ padding-left: 0;+}++.top-banner__actions__item a,+.top-banner__actions__item a:visited {+ color: @dim_foreground;++ @media (prefers-color-scheme: dark) {+ color: @dark_dim_foreground;+ }+}++.top-banner__actions__item a:hover {+ color: @link;++ @media (prefers-color-scheme: dark) {+ color: @dark_link;+ }+}++@media (min-width: 38em) {+ .top-banner__logo {+ float: left;+ width: 25%;+ }++ .top-banner__form {+ float: left;+ line-height: 90px;+ margin-bottom: 0;+ width: 50%;+ }++ .top-banner__actions {+ float: right;+ width: 25%;+ }+}+++/* Component: Search Results+ * -------------------------------------------------------------------------- */++.result {}++.result.result--empty {+ font-size: 1.25em;+}++.result__title {+ font-size: 1.25em;+ margin-bottom: 0.2rem;+}++.result__badge {+ margin-left: -0.1em;+}++.result__body > *:first-child {+ margin-top: 0!important;+}++.result__body > *:last-child {+ margin-bottom: 0!important;+}++.result__signature {+ background-color: transparent;+ border-radius: 0;+ border-top: 1px solid darken(@background, 20%);+ border-bottom: 1px solid darken(@background, 20%);+ padding: 0.328em 0;++ @media (prefers-color-scheme: dark) {+ border-top-color: lighten(@dark_background, 20%);+ border-bottom-color: lighten(@dark_background, 20%);+ }+}++.result__signature code {+ display: block;+ padding-left: 2.441em;+ text-indent: -2.441em;+ white-space: normal;+}++.result__actions {+ margin-top: 0.2rem;+}++.result__actions__item {+ font-size: 80%;+}++.result__actions__item + .result__actions__item {+ margin-left: 0.65em;+}+++/* Component: Version Selector+ * -------------------------------------------------------------------------- */++.version-selector {+ margin-bottom: 0.8em;+}++@media (min-width: 38em) {+ .version-selector {+ position: absolute;+ top: 0.8em;+ right: 0;+ margin-bottom: 0;+ }+}+++/* Section: FIXME+ * These styles should be cleaned up+ * ========================================================================== */++/* Help paragraphs */+.help {+ padding: 5px 0;+}++.help h3 { /* FIXME: target with class */+ margin-top: 16px;+}+++/* Section: Markdown+ * Github rendered README+ * ========================================================================== */++.markdown-body {+ /*+ Useful for narrow screens, such as mobiles. Documentation often contains URLs+ which would otherwise force the page to become wider, and force creation of+ horizontal scrollbars. Yuck.+ */+ word-wrap: break-word;+}++.markdown-body>*:first-child {+ margin-top: 0 !important;+}++.markdown-body>*:last-child {+ margin-bottom: 0 !important;+}++.markdown-body a:not([href]) {+ color: inherit;+ text-decoration: none;+}++.markdown-body blockquote {+ margin: 0;+ padding: 0 1em;+ color: #777;+ border-left: 0.25em solid #ddd;++ @media (prefers-color-scheme: dark) {+ border-left-color: #444;+ }+}++.markdown-body blockquote>:first-child {+ margin-top: 0;+}++.markdown-body blockquote>:last-child {+ margin-bottom: 0;+}++.markdown-body .anchor {+ /* We hide the anchor because the link doesn't point to a valid location */+ display: none;+}++.markdown-body .pl-k {+ /* Keyword */+ color: #a0a0a0;++ @media (prefers-color-scheme: dark) {+ color: #676767;+ }+}++.markdown-body .pl-c1,+.markdown-body .pl-en {+ /* Not really sure what this is */+ color: #39d;+}++.markdown-body .pl-s {+ /* String literals */+ color: #1a1;+}++.markdown-body .pl-cce {+ /* String literal escape sequences */+ color: #921;+}++.markdown-body .pl-smi {+ /* type variables? */+ color: #62b;+}
+ bundle/README view
@@ -0,0 +1,13 @@+ ____ ____ _ _+| _ \ _ _ _ __ ___/ ___| ___ _ __(_)_ __ | |_+| |_) | | | | '__/ _ \___ \ / __| '__| | '_ \| __|+| __/| |_| | | | __/___) | (__| | | | |_) | |_+|_| \__,_|_| \___|____/ \___|_| |_| .__/ \__|+ |_|++Installation Instructions+-------------------------++This bundle contains the `purs` executable; copy this file anywhere on your+PATH. For information about how to use the `purs` executable, run `purs+--help`.
+ bundle/build.sh view
@@ -0,0 +1,62 @@+#!/bin/bash++# This script can be run on any supported OS to create a binary .tar.gz+# bundle. For Windows, msysgit contains all of the pieces needed to run this+# script.++set -ex++OS=$1++if [ -z $OS ]+then+ echo "Usage: build.sh osname"+ exit 1+fi++pushd $(stack path --project-root)++# Make the staging directory+mkdir -p bundle/build/purescript++# Strip the binary, and copy it to the staging directory+if [ "$OS" = "win64" ]+then+ BIN="purs.exe"+else+ BIN="purs"+fi+FULL_BIN="$(stack path --local-doc-root)/../bin/$BIN"+if [ "$OS" != "win64" ]+then+ strip "$FULL_BIN"+fi+cp "$FULL_BIN" bundle/build/purescript++# Copy extra files to the staging directory+cp bundle/README bundle/build/purescript/+cp LICENSE bundle/build/purescript/+cp INSTALL.md bundle/build/purescript/++stack ls dependencies >bundle/build/purescript/dependencies.txt++# Make the binary bundle+pushd bundle/build > /dev/null+tar -zcvf ../${OS}.tar.gz purescript+popd > /dev/null++# Calculate the SHA hash+if [ "$OS" = "win64" ]+then+ # msys/mingw does not include shasum. :(+ SHASUM="openssl dgst -sha1"+else+ SHASUM="shasum"+fi++$SHASUM bundle/${OS}.tar.gz > bundle/${OS}.sha++# Remove the staging directory+rm -r bundle/build++popd > /dev/null
− examples/failing/ArrayType.purs
@@ -1,11 +0,0 @@-module Main where--import Debug.Trace--bar :: Number -> Number -> Number-bar n m = n + m--foo = x `bar` y- where- x = 1- y = []
− examples/failing/Arrays.purs
@@ -1,5 +0,0 @@-module Main where-- import Prelude-- test = \arr -> arr !! (0 !! 0)
− examples/failing/Do.purs
@@ -1,8 +0,0 @@-module Main where--test1 = do let x = 1--test2 y = do x <- y--test3 = do return 1- return 2
− examples/failing/DuplicateDeclarationsInLet.purs
@@ -1,9 +0,0 @@-module Main where--foo = a- where- a :: Number- a = 1-- a :: Number- a = 2
− examples/failing/DuplicateProperties1.purs
@@ -1,9 +0,0 @@-module DuplicateProperties where--foreign import data Test :: # * -> *--foreign import subtractX "" :: forall r. Test (x :: Unit | r) -> Test r--foreign import hasX "" :: Test (x :: Unit, y :: Unit)--baz = subtractX (subtractX hasX)
− examples/failing/DuplicateProperties2.purs
@@ -1,9 +0,0 @@-module DuplicateProperties where--foreign import data Test :: # * -> *--foreign import subtractX "" :: forall r. Test (x :: Unit | r) -> Test r--foreign import hasX "" :: forall r. Test (x :: Unit, y :: Unit | r)--baz = subtractX (subtractX hasX)
− examples/failing/DuplicateTypeVars.purs
@@ -1,3 +0,0 @@-module Main where--type Foo a a = a
− examples/failing/Eff.purs
@@ -1,12 +0,0 @@-module Main where--import Prelude-import Control.Monad.Eff-import Control.Monad.ST-import Debug.Trace--test = pureST (do- ref <- newSTRef 0- trace "ST"- modifySTRef ref $ \n -> n + 1- readSTRef ref)
− examples/failing/Foldable.purs
@@ -1,12 +0,0 @@-module Main where--class Foldable f where- fold :: forall a b. (a -> b -> b) -> b -> f a -> b- size :: forall a. f a -> Number--instance foldableArray :: Foldable [] where- fold _ z [] = z- fold f z (x:xs) = x `f` (fold f z xs)- size = fold (const ((+) 1)) 0--x = size [1,2,3]
− examples/failing/InstanceExport.purs
@@ -1,15 +0,0 @@-module InstanceExport (S(..), f) where--newtype S = S String--class F a where- f :: a -> String--instance fs :: F S where- f (S s) = s--module Test where--import InstanceExport--test = f $ S "Test"
− examples/failing/KindError.purs
@@ -1,3 +0,0 @@-module Main where-- data KindError f a = One f | Two (f a)
− examples/failing/Let.purs
@@ -1,3 +0,0 @@-module Main where--test = let x = x in x
− examples/failing/MPTCs.purs
@@ -1,7 +0,0 @@-module Main where--class Foo a where- f :: a -> a--instance fooStringString :: Foo String String where- f a = a
− examples/failing/MissingClassExport.purs
@@ -1,4 +0,0 @@-module Test (bar) where-- class Foo a where- bar :: a -> a
− examples/failing/MissingClassMemberExport.purs
@@ -1,4 +0,0 @@-module Test (Foo) where-- class Foo a where- bar :: a -> a
− examples/failing/MultipleErrors.purs
@@ -1,9 +0,0 @@-module MultipleErrors where--foo :: Number -> Number-foo 0 = "Test"-foo n = bar (n - 1)--bar :: Number -> Number-bar 0 = "Test"-bar n = foo (n - 1)
− examples/failing/MultipleErrors2.purs
@@ -1,5 +0,0 @@-module MultipleErrors2 where--foo = itDoesntExist--bar = neitherDoesThis
− examples/failing/MutRec.purs
@@ -1,5 +0,0 @@-module MutRec where--x = y--y = x
− examples/failing/MutRec2.purs
@@ -1,3 +0,0 @@-module Main where--x = x
− examples/failing/NewtypeMultiArgs.purs
@@ -1,3 +0,0 @@-module Main where--newtype Thing = Thing String Boolean
− examples/failing/NewtypeMultiCtor.purs
@@ -1,3 +0,0 @@-module Main where--newtype Thing = Thing String | Other
− examples/failing/NoOverlap.purs
@@ -1,11 +0,0 @@-module Main where--data Foo = Foo--instance showFoo1 :: Show Foo where- show _ = "Foo"--instance showFoo2 :: Show Foo where- show _ = "Bar"--test = show Foo
− examples/failing/NullaryAbs.purs
@@ -1,3 +0,0 @@-module Main where-- func = \ -> "no"
− examples/failing/Object.purs
@@ -1,5 +0,0 @@-module Main where--test o = o.foo--test1 = test {}
− examples/failing/OverlappingArguments.purs
@@ -1,3 +0,0 @@-module OverlappingArguments where--f x x = x
− examples/failing/OverlappingBinders.purs
@@ -1,4 +0,0 @@-module OverlappingBinders where--f x = case x of- (y:y@(z:zs)) -> y
− examples/failing/OverlappingInstances.purs
@@ -1,11 +0,0 @@-module OverlappingInstances where--data A = A--instance showA1 :: Show A where- show A = "Instance 1"--instance showA2 :: Show A where- show A = "Instance 2"--main = Debug.Trace.trace $ show A
− examples/failing/OverlappingInstances2.purs
@@ -1,23 +0,0 @@-module OverlappingInstances where--data A = A | B--instance eqA1 :: Eq A where- (==) A A = true- (==) B B = true- (==) _ _ = false- (/=) x y = not (x == y)--instance eqA2 :: Eq A where- (==) _ _ = true- (/=) _ _ = false--instance ordA :: Ord A where- compare A B = LT- compare B A = GT- compare _ _ = EQ--test :: forall a. (Ord a) => a -> a -> String-test x y = show $ x == y--main = Debug.Trace.trace $ test A B
− examples/failing/OverlappingVars.purs
@@ -1,12 +0,0 @@-module Main where--class OverlappingVars a where- f :: a -> a--data Foo a b = Foo a b--instance overlappingVarsFoo :: OverlappingVars (Foo a a) where- f a = a--test = f (Foo "" 0)-
− examples/failing/Rank2Types.purs
@@ -1,7 +0,0 @@-module Main where-- import Prelude-- foreign import test :: (forall a. a -> a) -> Number-- test1 = test (\n -> n + 1)
− examples/failing/Reserved.purs
@@ -1,4 +0,0 @@-module Main where--(<) :: Number -> Number -> Number-(<) a b = !(a >= b)
− examples/failing/SkolemEscape.purs
@@ -1,5 +0,0 @@-module Main where-- foreign import foo :: (forall a. a -> a) -> Number-- test = \x -> foo x
− examples/failing/SkolemEscape2.purs
@@ -1,9 +0,0 @@-module Main where--import Prelude-import Control.Monad.Eff-import Control.Monad.ST--test _ = do- r <- runST (newSTRef 0)- return 0
− examples/failing/Superclasses1.purs
@@ -1,11 +0,0 @@-module Main where--class Su a where- su :: a -> a--class (Su a) <= Cl a where- cl :: a -> a -> a--instance clNumber :: Cl Number where- cl n m = n + m-
− examples/failing/Superclasses2.purs
@@ -1,9 +0,0 @@-module CycleInSuperclasses where--class (Foo a) <= Bar a--class (Bar a) <= Foo a--instance barString :: Bar String--instance fooString :: Foo String
− examples/failing/Superclasses3.purs
@@ -1,5 +0,0 @@-module UnknownSuperclassTypeVar where--class Foo a--class (Foo b) <= Bar a
− examples/failing/Superclasses4.purs
@@ -1,12 +0,0 @@-module OverlappingInstances where--class Foo a--instance foo1 :: Foo Number--instance foo2 :: Foo Number--test :: forall a. (Foo a) => a -> a-test a = a--test1 = test 0
− examples/failing/TopLevelCaseNoArgs.purs
@@ -1,4 +0,0 @@-module Main where- foo :: Number- foo = 1- foo = 2
− examples/failing/TypeClassInstances.purs
@@ -1,8 +0,0 @@-module Main where--class A a where- a :: a -> String- b :: a -> Number--instance aString :: A String where- a s = s
− examples/failing/TypeClasses2.purs
@@ -1,8 +0,0 @@-module Main where--import Prelude ()--class Show a where- show :: a -> String--test = show "testing"
− examples/failing/TypeError.purs
@@ -1,5 +0,0 @@-module Main where-- import Prelude-- test = 1 ++ "A"
− examples/failing/TypeSynonyms.purs
@@ -1,5 +0,0 @@-module Main where--type T1 = [T2]--type T2 = T1
− examples/failing/TypeSynonyms2.purs
@@ -1,9 +0,0 @@-module Main where--class Foo a where- foo :: a -> String--type Bar = String--instance fooBar :: Foo Bar where- foo s = s
− examples/failing/TypeSynonyms3.purs
@@ -1,9 +0,0 @@-module Main where--class Foo a where- foo :: a -> String--type Bar = String--instance fooBar :: Foo Bar where- foo s = s
− examples/failing/TypeSynonyms4.purs
@@ -1,8 +0,0 @@-module TypeSynonyms4 where--type F x y = x -> y--type G x = F x--f :: G String String -> String-f k = k "Done"
− examples/failing/TypeWildcards1.purs
@@ -1,4 +0,0 @@-module TypeWildcards where--type Test = _-
− examples/failing/TypeWildcards2.purs
@@ -1,4 +0,0 @@-module TypeWildcards where--data Test = Test _-
− examples/failing/TypeWildcards3.purs
@@ -1,7 +0,0 @@-module TypeWildcards where--data Foo a = Foo--instance showFoo :: Show (Foo _) where- show Foo = "Foo"-
− examples/failing/UnderscoreModuleName.purs
@@ -1,3 +0,0 @@-module Bad_Module where--main = Debug.Trace.trace "Done"
− examples/failing/UnifyInTypeInstanceLookup.purs
@@ -1,17 +0,0 @@-module Main where--data Z = Z-data S n = S n--data T-data F--class EQ x y b-instance eqT :: EQ x x T-instance eqF :: EQ x y F--foreign import test :: forall a b. (EQ a b T) => a -> b -> a--foreign import anyNat :: forall a. a--test1 = test anyNat (S Z)
− examples/failing/UnknownType.purs
@@ -1,4 +0,0 @@-module Main where--test :: Number -> Something-test = {}
− examples/passing/652.purs
@@ -1,15 +0,0 @@-module Main where--class Foo a b--class Bar a c--class (Foo a b, Bar a c) <= Baz a b c--instance foo :: Foo (a -> b) a--instance bar :: Bar (a -> b) b--instance baz :: (Eq a) => Baz (a -> b) a b--main = Debug.Trace.trace "Done"
− examples/passing/810.purs
@@ -1,11 +0,0 @@-module Main where--data Maybe a = Nothing | Just a--test :: forall a. Maybe a -> Maybe a-test m = o.x- where- o = case m of Nothing -> { x : Nothing }- Just a -> { x : Just a }--main = Debug.Trace.trace "Done"
− examples/passing/Applicative.purs
@@ -1,16 +0,0 @@-module Main where--import Prelude ()--class Applicative f where- pure :: forall a. a -> f a- (<*>) :: forall a b. f (a -> b) -> f a -> f b--data Maybe a = Nothing | Just a--instance applicativeMaybe :: Applicative Maybe where- pure = Just- (<*>) (Just f) (Just a) = Just (f a)- (<*>) _ _ = Nothing--main = Debug.Trace.trace "Done"
− examples/passing/ArrayType.purs
@@ -1,9 +0,0 @@-module Main where--class Pointed p where- point :: forall a. a -> p a--instance pointedArray :: Pointed [] where- point a = [a]--main = Debug.Trace.trace "Done"
− examples/passing/Arrays.purs
@@ -1,24 +0,0 @@-module Main where--import Prelude.Unsafe (unsafeIndex)--test1 arr = arr `unsafeIndex` 0 + arr `unsafeIndex` 1 + 1--test2 = \arr -> case arr of- [x, y] -> x + y- [x] -> x- [] -> 0- (x : y : _) -> x + y--data Tree = One Number | Some [Tree]--test3 = \tree sum -> case tree of- One n -> n- Some (n1 : n2 : rest) -> test3 n1 sum * 10 + test3 n2 sum * 5 + sum rest--test4 = \arr -> case arr of- [] -> 0- [_] -> 0- x : y : xs -> x * y + test4 xs--main = Debug.Trace.trace "Done"
− examples/passing/Auto.purs
@@ -1,13 +0,0 @@-module Main where-- data Auto s i o = Auto { state :: s, step :: s -> i -> o }-- type SomeAuto i o = forall r. (forall s. Auto s i o -> r) -> r-- exists :: forall s i o. s -> (s -> i -> o) -> SomeAuto i o- exists = \state step f -> f (Auto { state: state, step: step })-- run :: forall i o. SomeAuto i o -> i -> o- run = \s i -> s (\a -> case a of Auto a -> a.step a.state i)-- main = Debug.Trace.trace "Done"
− examples/passing/AutoPrelude.purs
@@ -1,8 +0,0 @@-module Main where--import Debug.Trace--f x = x * 10-g y = y - 10--main = trace $ show $ (f <<< g) 100
− examples/passing/AutoPrelude2.purs
@@ -1,9 +0,0 @@-module Main where--import qualified Prelude as P-import Debug.Trace--f :: forall a. a -> a-f = P.id--main = P.($) trace ((f P.<<< f) "Done")
− examples/passing/BindersInFunctions.purs
@@ -1,18 +0,0 @@-module Main where--import Prelude--tail = \(_:xs) -> xs--foreign import error- """- function error(msg) {- throw msg;- }- """ :: forall a. String -> a--main =- let ts = tail [1, 2, 3] in- if ts == [2, 3]- then Debug.Trace.trace "Done"- else error "Incorrect result from 'tails'."
− examples/passing/BindingGroups.purs
@@ -1,8 +0,0 @@-module Main where--foo = bar- where bar r = r + 1--r = foo 2--main = Debug.Trace.trace "Done"
− examples/passing/BlockString.purs
@@ -1,12 +0,0 @@-module Main where--foreign import foo """- function foo(s) {- return s;- }-""" :: String -> String--bar :: String -> String-bar _ = foo "test"--main = Debug.Trace.trace "Done"
− examples/passing/CaseInDo.purs
@@ -1,20 +0,0 @@-module Main where--import Debug.Trace-import Control.Monad.Eff--foreign import doIt "function doIt() { global.flag = true; }" :: forall eff. Eff eff Unit--foreign import get "function get() { return global.flag; }" :: forall eff. Eff eff Boolean--set = do- trace "Testing..."- case 0 of- 0 -> doIt- _ -> return unit--main = do- set- b <- get- case b of- true -> trace "Done"
− examples/passing/CaseStatement.purs
@@ -1,19 +0,0 @@-module Main where--data A = A | B | C--f a _ A = a-f _ a B = a-f _ _ C = "Done"--g a _ A = a-g _ b B = b-g _ _ C = C--data M a = N | J a--h f N a = a-h f a N = a-h f (J a) (J b) = J (f a b)--main = Debug.Trace.trace $ f "Done" "Failed" A
− examples/passing/CheckFunction.purs
@@ -1,5 +0,0 @@-module Main where--test = ((\x -> x+1) >>> (\x -> x*2)) 4--main = Debug.Trace.trace "Done"
− examples/passing/CheckSynonymBug.purs
@@ -1,16 +0,0 @@-module Main where-- import Prelude-- type Foo a = [a]-- foreign import length- """- function length(a) {- return a.length;- }- """ :: forall a. [a] -> Number-- foo _ = length ([] :: Foo Number)-- main = Debug.Trace.trace "Done"
− examples/passing/CheckTypeClass.purs
@@ -1,16 +0,0 @@-module Main where-- data Bar a = Bar- data Baz-- class Foo a where- foo :: Bar a -> Baz-- foo_ :: forall a. (Foo a) => a -> Baz- foo_ x = foo ((mkBar :: forall a. (Foo a) => a -> Bar a) x)-- mkBar :: forall a. a -> Bar a- mkBar _ = Bar-- main = Debug.Trace.trace "Done"-
− examples/passing/Church.purs
@@ -1,18 +0,0 @@-module Main where-- import Prelude ()-- type List a = forall r. r -> (a -> r -> r) -> r-- empty :: forall a. List a- empty = \r f -> r-- cons :: forall a. a -> List a -> List a- cons = \a l r f -> f a (l r f)-- append :: forall a. List a -> List a -> List a- append = \l1 l2 r f -> l2 (l1 r f) f-- test = append (cons 1 empty) (cons 2 empty)-- main = Debug.Trace.trace "Done"
− examples/passing/Collatz.purs
@@ -1,18 +0,0 @@-module Main where--import Prelude-import Control.Monad.Eff-import Control.Monad.ST--collatz :: Number -> Number-collatz n = runPure (runST (do- r <- newSTRef n- count <- newSTRef 0- untilE $ do- modifySTRef count $ (+) 1- m <- readSTRef r- writeSTRef r $ if m % 2 == 0 then m / 2 else 3 * m + 1- return $ m == 1- readSTRef count))--main = Debug.Trace.print $ collatz 1000
− examples/passing/Comparisons.purs
@@ -1,25 +0,0 @@-module Main where--import Control.Monad.Eff-import Debug.Trace--foreign import data Assert :: !--foreign import assert- """- function assert(x) {- return function() {- if (!x) throw new Error('assertion failed');- return {};- };- }- """ :: forall e. Boolean -> Eff (assert :: Assert | e) Unit--main = do- assert (1 < 2)- assert (2 == 2)- assert (3 > 1)- assert ("a" < "b")- assert ("a" == "a")- assert ("z" > "a")- trace "Done!"
− examples/passing/Conditional.purs
@@ -1,9 +0,0 @@-module Main where-- import Prelude ()-- fns = \f -> if f true then f else \x -> x-- not = \x -> if x then false else true-- main = Debug.Trace.trace "Done"
− examples/passing/Console.purs
@@ -1,13 +0,0 @@-module Main where--import Prelude-import Control.Monad.Eff-import Debug.Trace--replicateM_ :: forall m a. (Monad m) => Number -> m a -> m {}-replicateM_ 0 _ = return {}-replicateM_ n act = do- act- replicateM_ (n - 1) act--main = replicateM_ 10 (trace "Hello World!")
− examples/passing/DataAndType.purs
@@ -1,7 +0,0 @@-module Main where--data A = A B--type B = A--main = Debug.Trace.trace "Done"
− examples/passing/DeepArrayBinder.purs
@@ -1,18 +0,0 @@-module Main where--import Control.Monad.Eff--match2 :: [Number] -> Number-match2 (x : y : xs) = x * y + match2 xs-match2 _ = 0--foreign import explode- """- function explode() {- throw new Error('Incorrect result');- }- """ :: forall eff a. Eff eff a--main = case match2 [1, 2, 3, 4, 5, 6, 7, 8, 9] of- 100 -> Debug.Trace.trace "Done"- _ -> explode
− examples/passing/DeepCase.purs
@@ -1,14 +0,0 @@-module Main where--import Debug.Trace-import Control.Monad.Eff-import Control.Monad.ST--f x y =- let- g = case y of- 0 -> x- x -> 1 + x * x- in g + x + y--main = print $ f 1 10
− examples/passing/Do.purs
@@ -1,67 +0,0 @@-module Main where--import Prelude--data Maybe a = Nothing | Just a--instance functorMaybe :: Functor Maybe where- (<$>) f Nothing = Nothing- (<$>) f (Just x) = Just (f x)--instance applyMaybe :: Apply Maybe where- (<*>) (Just f) (Just x) = Just (f x)- (<*>) _ _ = Nothing--instance applicativeMaybe :: Applicative Maybe where- pure = Just--instance bindMaybe :: Bind Maybe where- (>>=) Nothing _ = Nothing- (>>=) (Just a) f = f a--instance monadMaybe :: Prelude.Monad Maybe--test1 = \_ -> do- Just "abc"--test2 = \_ -> do- (x : _) <- Just [1, 2, 3]- (y : _) <- Just [4, 5, 6]- Just (x + y)--test3 = \_ -> do- Just 1- Nothing :: Maybe Number- Just 2--test4 mx my = do- x <- mx- y <- my- Just (x + y + 1)--test5 mx my mz = do- x <- mx- y <- my- let sum = x + y- z <- mz- Just (z + sum + 1)--test6 mx = \_ -> do- let- f :: forall a. Maybe a -> a- f (Just x) = x- Just (f mx)--test8 = \_ -> do- Just (do- Just 1)--test9 = \_ -> (+) <$> Just 1 <*> Just 2--test10 _ = do- let- f x = g x * 3- g x = f x / 2- Just (f 10)--main = Debug.Trace.trace "Done"
− examples/passing/Dollar.purs
@@ -1,16 +0,0 @@-module Main where--import Prelude ()--($) :: forall a b. (a -> b) -> a -> b-($) f x = f x--infixr 1000 $--id x = x--test1 x = id $ id $ id $ id $ x--test2 x = id id $ id x--main = Debug.Trace.trace "Done"
− examples/passing/Eff.purs
@@ -1,25 +0,0 @@-module Main where--import Prelude-import Control.Monad.Eff-import Control.Monad.ST-import Debug.Trace--test1 = do- trace "Line 1"- trace "Line 2"--test2 = runPure (runST (do- ref <- newSTRef 0- modifySTRef ref $ \n -> n + 1- readSTRef ref))--test3 = pureST (do- ref <- newSTRef 0- modifySTRef ref $ \n -> n + 1- readSTRef ref)--main = do- test1- Debug.Trace.print test2- Debug.Trace.print test3
− examples/passing/EmptyDataDecls.purs
@@ -1,34 +0,0 @@-module Main where--import Prelude--data Z-data S n--data ArrayBox n a = ArrayBox [a]--nil :: forall a. ArrayBox Z a-nil = ArrayBox []--foreign import concat- """- function concat(l1) {- return function(l2) {- return l1.concat(l2);- };- }- """ :: forall a. [a] -> [a] -> [a]--cons' :: forall a n. a -> ArrayBox n a -> ArrayBox (S n) a-cons' x (ArrayBox xs) = ArrayBox $ concat [x] xs--foreign import error- """- function error(msg) {- throw msg;- }- """ :: forall a. String -> a--main = case cons' 1 $ cons' 2 $ cons' 3 nil of- ArrayBox [1, 2, 3] -> Debug.Trace.trace "Done"- _ -> error "Failed"
− examples/passing/EmptyRow.purs
@@ -1,8 +0,0 @@-module Main where--data Foo r = Foo { | r }--test :: Foo ()-test = Foo {}--main = Debug.Trace.trace "Done"
− examples/passing/EmptyTypeClass.purs
@@ -1,12 +0,0 @@-module Main where--import Prelude--class Partial--head :: forall a. (Partial) => [a] -> a-head (x:xs) = x--instance allowPartials :: Partial--main = Debug.Trace.trace $ head ["Done"]
− examples/passing/EqOrd.purs
@@ -1,14 +0,0 @@-module Main where--data Pair a b = Pair a b--instance ordPair :: (Ord a, Ord b) => Ord (Pair a b) where- compare (Pair a1 b1) (Pair a2 b2) = case compare a1 a2 of- EQ -> compare b1 b2- r -> r--instance eqPair :: (Eq a, Eq b) => Eq (Pair a b) where- (==) (Pair a1 b1) (Pair a2 b2) = a1 == a2 && b1 == b2- (/=) (Pair a1 b1) (Pair a2 b2) = a1 /= a2 || b1 /= b2--main = Debug.Trace.print $ Pair 1 2 == Pair 1 2
− examples/passing/ExtendedInfixOperators.purs
@@ -1,20 +0,0 @@-module Main where--zipWith :: forall a b c. (a -> b -> c) -> [a] -> [b] -> [c]-zipWith _ [] _ = []-zipWith _ _ [] = []-zipWith f (x:xs) (y:ys) = f x y : zipWith f xs ys--test1 = [1, 2, 3] `zipWith (+)` [4, 5, 6]--comparing :: forall a b. (Ord b) => (a -> b) -> a -> a -> Ordering-comparing f = compare `Data.Function.on` f--sum [] = 0-sum (x:xs) = x + sum xs--test2 = [1, 2, 3] `comparing sum` [4, 5, 6]--main = do- Debug.Trace.print test1- Debug.Trace.print test2
− examples/passing/ExternData.purs
@@ -1,13 +0,0 @@-module Main where-- foreign import data IO :: * -> *-- foreign import bind "function bind() {}" :: forall a b. IO a -> (a -> IO b) -> IO b-- foreign import showMessage "function showMessage() {}" :: String -> IO { }-- foreign import prompt "function prompt() {}" :: IO String-- test _ = prompt `bind` \s -> showMessage s-- main = Debug.Trace.trace "Done"
− examples/passing/ExternRaw.purs
@@ -1,26 +0,0 @@-module Main where--foreign import first- """- function first(xs) {- return xs[0];- }- """ :: forall a. [a] -> a--foreign import loop- """- function loop() {- while (true) {}- }- """ :: forall a. a--foreign import concat- """- function concat(xs) {- return function(ys) {- return xs.concat(ys);- };- }- """ :: forall a. [a] -> [a] -> [a]--main = Debug.Trace.trace "Done"
− examples/passing/FFI.purs
@@ -1,13 +0,0 @@-module Main where--foreign import foo- """- function foo(s) {- return s;- }- """ :: String -> String--bar :: String -> String-bar _ = foo "test"--main = Debug.Trace.trace "Done"
− examples/passing/Fib.purs
@@ -1,15 +0,0 @@-module Main where--import Prelude-import Control.Monad.Eff-import Control.Monad.ST--main = runST (do- n1 <- newSTRef 1- n2 <- newSTRef 1- whileE ((>) 1000 <$> readSTRef n1) $ do- n1' <- readSTRef n1- n2' <- readSTRef n2- writeSTRef n2 $ n1' + n2'- writeSTRef n1 n2'- Debug.Trace.print n2')
− examples/passing/FinalTagless.purs
@@ -1,22 +0,0 @@-module Main where--import Prelude--class E e where- num :: Number -> e Number- add :: e Number -> e Number -> e Number--type Expr a = forall e. (E e) => e a--data Id a = Id a--instance exprId :: E Id where- num = Id- add (Id n) (Id m) = Id (n + m)--runId (Id a) = a--three :: Expr Number-three = add (num 1) (num 2)--main = Debug.Trace.print $ runId three
− examples/passing/ForeignInstance.purs
@@ -1,20 +0,0 @@-module Main where--class Foo a where- foo :: a -> String--foreign import instance fooArray :: (Foo a) => Foo [a]--foreign import instance fooNumber :: Foo Number--foreign import instance fooString :: Foo String--foreign import fooString "var fooString = {};" :: Unit-foreign import fooNumber "var fooNumber = {};" :: Unit-foreign import fooArray "var fooArray = {};" :: Unit--test1 _ = foo [1, 2, 3]--test2 _ = foo "Test"--main = Debug.Trace.trace "Done"
− examples/passing/FunctionScope.purs
@@ -1,19 +0,0 @@-module Main where-- import Prelude-- mkValue :: Number -> Number- mkValue id = id-- foreign import error- """- function error(msg) {- throw msg;- }- """ :: forall a. String -> a-- main = do- let value = mkValue 1- if value == 1- then Debug.Trace.trace "Done"- else error "Not done"
− examples/passing/Functions.purs
@@ -1,15 +0,0 @@-module Main where-- import Prelude-- test1 = \_ -> 0-- test2 = \a b -> a + b + 1-- test3 = \a -> a-- test4 = \(%%) -> 1 %% 2-- test5 = \(+++) (***) -> 1 +++ 2 *** 3-- main = Debug.Trace.trace "Done"
− examples/passing/Functions2.purs
@@ -1,19 +0,0 @@-module Main where-- import Prelude-- test :: forall a b. a -> b -> a- test = \const _ -> const-- foreign import error- """- function error(msg) {- throw msg;- }- """ :: forall a. String -> a-- main = do- let value = test "Done" {}- if value == "Done"- then Debug.Trace.trace "Done"- else error "Not done"
− examples/passing/Guards.purs
@@ -1,29 +0,0 @@-module Main where-- import Prelude-- collatz = \x -> case x of- y | y % 2 == 0 -> y / 2- y -> y * 3 + 1-- -- Guards have access to current scope- collatz2 = \x y -> case x of- z | y > 0 -> z / 2- z -> z * 3 + 1-- min :: forall a. (Ord a) => a -> a -> a- min n m | n < m = n- | otherwise = m-- max :: forall a. (Ord a) => a -> a -> a- max n m = case unit of- _ | m < n -> n- | otherwise -> m-- testIndentation :: Number -> Number -> Number- testIndentation x y | x > 0- = x + y- | otherwise- = y - x-- main = Debug.Trace.trace $ min "Done" "ZZZZ"
− examples/passing/HoistError.purs
@@ -1,19 +0,0 @@-module Main where--import Control.Monad.Eff-import Debug.Trace--foreign import f- """- function f(x) {- return function() {- if (x !== 0) throw new Error('x is not 0');- };- }- """ :: forall e. Number -> Eff e Number--main = do- let x = 0- f x- let x = 1 + 1- trace "Done"
− examples/passing/IfThenElseMaybe.purs
@@ -1,9 +0,0 @@-module Main where--data Maybe a = Nothing | Just a--test1 = if true then Just 10 else Nothing--test2 = if true then Nothing else Just 10--main = Debug.Trace.trace "Done"
− examples/passing/ImplicitEmptyImport.purs
@@ -1,6 +0,0 @@-module Main where--main = do- Debug.Trace.trace "Hello"- Debug.Trace.trace "Goodbye"- Debug.Trace.trace "Done"
− examples/passing/ImportHiding.purs
@@ -1,18 +0,0 @@-module Main where--import Debug.Trace-import Prelude hiding (- show, -- a value- Show, -- a type class- Unit(..) -- a constructor- )--show = 1--class Show a where- noshow :: a -> a--data Unit = X | Y--main = do- print show
− examples/passing/InferRecFunWithConstrainedArgument.purs
@@ -1,8 +0,0 @@-module Main where--import Prelude--test 100 = 100-test n = test(1 + n)--main = Debug.Trace.print $ test 0
− examples/passing/InstanceBeforeClass.purs
@@ -1,9 +0,0 @@-module Main where--instance fooNumber :: Foo Number where- foo = 0--class Foo a where- foo :: a--main = Debug.Trace.trace "Done"
− examples/passing/JSReserved.purs
@@ -1,12 +0,0 @@-module Main where-- import Prelude-- yield = 0- member = 1-- public = \return -> return-- this catch = catch-- main = Debug.Trace.trace "Done"
− examples/passing/KindedType.purs
@@ -1,31 +0,0 @@-module Main where--type Star2Star f = f :: * -> *--type Star t = t :: *--test1 :: Star2Star [] String-test1 = ["test"]--f :: Star (String -> String)-f s = s--test2 = f "test"--data Proxy (f :: * -> *) = Proxy--test3 :: Proxy []-test3 = Proxy--type Test (f :: * -> *) = f String--test4 :: Test []-test4 = ["test"]--class Clazz (a :: *) where- def :: a--instance clazzString :: Clazz String where- def = "test"--main = Debug.Trace.trace "Done"
− examples/passing/Let.purs
@@ -1,64 +0,0 @@-module Main where--import Prelude-import Control.Monad.Eff-import Control.Monad.ST--test1 x = let- y :: Number- y = x + 1- in y--test2 x y =- let x' = x + 1 in- let y' = y + 1 in- x' + y'--test3 = let f x y z = x + y + z in- f 1 2 3--test4 = let f x [y, z] = x y z in- f (+) [1, 2]--test5 = let- f x | x > 0 = g (x / 2) + 1- f x = 0- g x = f (x - 1) + 1- in f 10--test6 = runPure (runST (do- r <- newSTRef 0- (let- go [] = readSTRef r- go (n : ns) = do- modifySTRef r ((+) n)- go ns- in go [1, 2, 3, 4, 5])- ))--test7 = let- f :: forall a. a -> a- f x = x- in if f true then f 1 else f 2--test8 :: Number -> Number-test8 x = let- go y | (x - 0.1 < y * y) && (y * y < x + 0.1) = y- go y = go $ (y + x / y) / 2- in go x--test10 _ =- let- f x = g x * 3- g x = f x / 2- in f 10--main = do- Debug.Trace.print (test1 1)- Debug.Trace.print (test2 1 2)- Debug.Trace.print test3- Debug.Trace.print test4- Debug.Trace.print test5- Debug.Trace.print test6- Debug.Trace.print test7- Debug.Trace.print (test8 100)
− examples/passing/LetInInstance.purs
@@ -1,12 +0,0 @@-module Main where--class Foo a where- foo :: a -> String--instance fooString :: Foo String where- foo = go- where- go :: String -> String- go s = s--main = Debug.Trace.trace "Done"
− examples/passing/LiberalTypeSynonyms.purs
@@ -1,19 +0,0 @@-module Main where--type Reader = (->) String--foo :: Reader String-foo s = s--type AndFoo r = (foo :: String | r)--getFoo :: forall r. Prim.Object (AndFoo r) -> String-getFoo o = o.foo--type F r = { | r } -> { | r }--f :: (forall r. F r) -> String-f g = case g { x: "Hello" } of- { x = x } -> x--main = Debug.Trace.trace "Done"
− examples/passing/MPTCs.purs
@@ -1,20 +0,0 @@-module Main where--import Prelude--class NullaryTypeClass where- greeting :: String--instance nullaryTypeClass :: NullaryTypeClass where- greeting = "Hello, World!"--class Coerce a b where- coerce :: a -> b--instance coerceRefl :: Coerce a a where- coerce a = a--instance coerceShow :: (Prelude.Show a) => Coerce a String where- coerce = show--main = Debug.Trace.trace "Done"
− examples/passing/Match.purs
@@ -1,7 +0,0 @@-module Main where-- data Foo a = Foo-- foo = \f -> case f of Foo -> "foo"-- main = Debug.Trace.trace "Done"
− examples/passing/Monad.purs
@@ -1,32 +0,0 @@-module Main where-- import Prelude ()-- type Monad m = { return :: forall a. a -> m a- , bind :: forall a b. m a -> (a -> m b) -> m b }-- data Id a = Id a-- id :: Monad Id- id = { return : Id- , bind : \ma f -> case ma of Id a -> f a }-- data Maybe a = Nothing | Just a-- maybe :: Monad Maybe- maybe = { return : Just- , bind : \ma f -> case ma of- Nothing -> Nothing- Just a -> f a- }-- test :: forall m. Monad m -> m Number- test = \m -> m.bind (m.return 1) (\n1 ->- m.bind (m.return "Test") (\n2 ->- m.return n1))-- test1 = test id-- test2 = test maybe-- main = Debug.Trace.trace "Done"
− examples/passing/MonadState.purs
@@ -1,48 +0,0 @@-module Main where--import Prelude--data Tuple a b = Tuple a b--class MonadState s m where- get :: m s- put :: s -> m {}--data State s a = State (s -> Tuple s a)--runState s (State f) = f s--instance functorState :: Functor (State s) where- (<$>) = liftM1--instance applyState :: Apply (State s) where- (<*>) = ap--instance applicativeState :: Applicative (State s) where- pure a = State $ \s -> Tuple s a--instance bindState :: Bind (State s) where- (>>=) f g = State $ \s -> case runState s f of- Tuple s1 a -> runState s1 (g a)--instance monadState :: Monad (State s)--instance monadStateState :: MonadState s (State s) where- get = State (\s -> Tuple s s)- put s = State (\_ -> Tuple s {})--modify :: forall m s. (Prelude.Monad m, MonadState s m) => (s -> s) -> m {}-modify f = do- s <- get- put (f s)--test :: Tuple String String-test = runState "" $ do- modify $ (++) "World!"- modify $ (++) "Hello, "- get--main = do- let t1 = test- Debug.Trace.trace "Done"-
− examples/passing/MultiArgFunctions.purs
@@ -1,26 +0,0 @@-module Main where--import Data.Function-import Control.Monad.Eff-import Debug.Trace--f = mkFn2 $ \a b -> runFn2 g a b + runFn2 g b a--g = mkFn2 $ \a b -> case {} of- _ | a <= 0 || b <= 0 -> b- _ -> runFn2 f (a - 1) (b - 1)--main = do- runFn0 (mkFn0 $ \_ -> trace $ show 0)- runFn1 (mkFn1 $ \a -> trace $ show a) 1- runFn2 (mkFn2 $ \a b -> trace $ show [a, b]) 1 2- runFn3 (mkFn3 $ \a b c -> trace $ show [a, b, c]) 1 2 3- runFn4 (mkFn4 $ \a b c d -> trace $ show [a, b, c, d]) 1 2 3 4- runFn5 (mkFn5 $ \a b c d e -> trace $ show [a, b, c, d, e]) 1 2 3 4 5- runFn6 (mkFn6 $ \a b c d e f -> trace $ show [a, b, c, d, e, f]) 1 2 3 4 5 6- runFn7 (mkFn7 $ \a b c d e f g -> trace $ show [a, b, c, d, e, f, g]) 1 2 3 4 5 6 7- runFn8 (mkFn8 $ \a b c d e f g h -> trace $ show [a, b, c, d, e, f, g, h]) 1 2 3 4 5 6 7 8- runFn9 (mkFn9 $ \a b c d e f g h i -> trace $ show [a, b, c, d, e, f, g, h, i]) 1 2 3 4 5 6 7 8 9- runFn10 (mkFn10 $ \a b c d e f g h i j-> trace $ show [a, b, c, d, e, f, g, h, i, j]) 1 2 3 4 5 6 7 8 9 10- print $ runFn2 g 15 12- trace "Done!"
− examples/passing/MultipleConstructorArgs.purs
@@ -1,21 +0,0 @@-module Main where--import Prelude-import Control.Monad.Eff--data P a b = P a b--runP :: forall a b r. (a -> b -> r) -> P a b -> r-runP f (P a b) = f a b--idP = runP P--testCase = \p -> case p of- P (x:xs) (y:ys) -> x + y- P _ _ -> 0--test1 = testCase (P [1, 2, 3] [4, 5, 6])--main = do- Debug.Trace.trace (runP (\s n -> s ++ show n) (P "Test" 1))- Debug.Trace.print test1
− examples/passing/MutRec.purs
@@ -1,19 +0,0 @@-module Main where-- import Prelude-- f 0 = 0- f x = g x + 1-- g x = f (x / 2)-- data Even = Zero | Even Odd-- data Odd = Odd Even-- evenToNumber Zero = 0- evenToNumber (Even n) = oddToNumber n + 1-- oddToNumber (Odd n) = evenToNumber n + 1-- main = Debug.Trace.trace "Done"
− examples/passing/MutRec2.purs
@@ -1,17 +0,0 @@-module Main where--data A = A B--data B = B A--foreign import data S :: *--f :: A -> S-f a = case a of A b -> g b--g b = case b of B a -> f a--showN :: A -> S-showN a = f a--main = Debug.Trace.trace "Done"
− examples/passing/MutRec3.purs
@@ -1,17 +0,0 @@-module Main where--data A = A B--data B = B A--foreign import data S :: *--f a = case a of A b -> g b--g :: B -> S-g b = case b of B a -> f a--showN :: A -> S-showN a = f a--main = Debug.Trace.trace "Done"
− examples/passing/NamedPatterns.purs
@@ -1,7 +0,0 @@-module Main where-- foo = \x -> case x of- y@{ foo = "Foo" } -> y- y -> y-- main = Debug.Trace.trace "Done"
− examples/passing/NegativeBinder.purs
@@ -1,7 +0,0 @@-module Main where--test :: Number -> Boolean-test -1 = false-test _ = true--main = Debug.Trace.trace "Done"
− examples/passing/Nested.purs
@@ -1,7 +0,0 @@-module Main where-- data Extend r a = Extend { prev :: r a, next :: a }-- data Matrix r a = Square (r (r a)) | Bigger (Matrix (Extend r) a)-- main = Debug.Trace.trace "Done"
− examples/passing/NestedTypeSynonyms.purs
@@ -1,11 +0,0 @@-module Main where-- import Prelude-- type X = String- type Y = X -> X-- fn :: Y- fn a = a-- main = Debug.Trace.print (fn "Done")
− examples/passing/NestedWhere.purs
@@ -1,10 +0,0 @@-module Main where--f x = g x- where- g x = go x- where- go x = go1 (x - 1)- go1 x = go x--main = Debug.Trace.trace "Done"
− examples/passing/Newtype.purs
@@ -1,22 +0,0 @@-module Main where--import Control.Monad.Eff-import Debug.Trace--newtype Thing = Thing String--instance showThing :: Show Thing where- show (Thing x) = "Thing " ++ show x--newtype Box a = Box a--instance showBox :: (Show a) => Show (Box a) where- show (Box x) = "Box " ++ show x--apply f x = f x--main = do- print $ Thing "hello"- print $ Box 42- print $ apply Box 9000- trace "Done"
− examples/passing/NewtypeEff.purs
@@ -1,28 +0,0 @@-module Main where--import Debug.Trace-import Control.Monad.Eff--newtype T a = T (Eff (trace :: Trace) a)--runT :: forall a. T a -> Eff (trace :: Trace) a-runT (T t) = t--instance functorT :: Functor T where- (<$>) f (T t) = T (f <$> t)--instance applyT :: Apply T where- (<*>) (T f) (T x) = T (f <*> x)--instance applicativeT :: Applicative T where- pure t = T (pure t)--instance bindT :: Bind T where- (>>=) (T t) f = T (t >>= \x -> runT (f x))--instance monadT :: Monad T--main = runT do- T $ trace "Done"- T $ trace "Done"- T $ trace "Done"
− examples/passing/NewtypeWithRecordUpdate.purs
@@ -1,15 +0,0 @@--- https://github.com/purescript/purescript/issues/812--module Main where--import Debug.Trace--newtype NewType a = NewType (Object a)--rec1 :: Object (a :: Number, b :: Number, c:: Number)-rec1 = { a: 0, b: 0, c: 0 } --rec2 :: NewType (a :: Number, b :: Number, c :: Number)-rec2 = NewType (rec1 { a = 1 })--main = trace "Done"
− examples/passing/ObjectGetter.purs
@@ -1,11 +0,0 @@-module Main where--getX = _.x--point = { x: 1, y: 0 }--main = do- Debug.Trace.print $ getX point- Debug.Trace.trace $ _." 123 string Prop Name " { " 123 string Prop Name ": "OK" }- Debug.Trace.trace $ (_.x >>> _.y) { x: { y: "Nested" } }- Debug.Trace.trace $ _.value { value: "Done!" }
− examples/passing/ObjectSynonym.purs
@@ -1,13 +0,0 @@-module Main where--type Inner = Number--inner :: Inner-inner = 0--type Outer = { inner :: Inner }--outer :: Outer-outer = { inner: inner }--main = Debug.Trace.trace "Done"
− examples/passing/ObjectUpdate.purs
@@ -1,18 +0,0 @@-module Main where-- update1 = \o -> o { foo = "Foo" }-- update2 :: forall r. { foo :: String | r } -> { foo :: String | r }- update2 = \o -> o { foo = "Foo" }-- replace = \o -> case o of- { foo = "Foo" } -> o { foo = "Bar" }- { foo = "Bar" } -> o { bar = "Baz" }- o -> o-- polyUpdate :: forall a r. { foo :: a | r } -> { foo :: String | r }- polyUpdate = \o -> o { foo = "Foo" }-- inferPolyUpdate = \o -> o { foo = "Foo" }-- main = Debug.Trace.trace ((update1 {foo: ""}).foo)
− examples/passing/ObjectUpdate2.purs
@@ -1,14 +0,0 @@-module Main where--type X r = { | r }--foreign import x "var x = {};" :: forall r. X r--blah :: forall r. X r -> X r-blah x = x--test = blah x- { baz = "blah"- }--main = Debug.Trace.trace "Done"
− examples/passing/ObjectUpdater.purs
@@ -1,35 +0,0 @@-module Main where--import Control.Monad.Eff-import Debug.Trace--foreign import eqeqeq- """- function eqeqeq(x) {- return function (y) {- if (x == y) return x;- throw new Error("Unexpected result: " + x + " /== " + y);- };- };- """ :: forall a. a -> a -> a--(===) = eqeqeq-infixl 4 ===--getValue :: forall e. Eff (| e) Boolean-getValue = return true--main = do- let record = { value: false }- record' <- record { value = _ } <$> getValue- print $ record'.value === true-- let point = { x: 1, y: 1 }- x = 10- point' = (point { x = _, y = x }) 100-- print $ point'.x === 100- print $ point'.y === 10-- let record2 = (_ { x = _ }) { x: 0 } 10- print $ record2.x === 10
− examples/passing/ObjectWildcards.purs
@@ -1,31 +0,0 @@-module Main where--import Control.Monad.Eff-import Debug.Trace--mkRecord = { foo: _, bar: _, baz: "baz" }--getValue :: forall e. Eff (| e) Boolean-getValue = return true--foreign import eqeqeq- """- function eqeqeq(x) {- return function (y) {- if (x == y) return x;- throw new Error("Unexpected result: " + x + " /== " + y);- };- };- """ :: forall a. a -> a -> a--(===) = eqeqeq-infixl 4 ===--main = do- obj <- { value: _ } <$> getValue- print obj.value- let x = 1- point <- { x: _, y: x } <$> return 2- print $ point.x === 2- print $ point.y === 1- trace (mkRecord 1 "Done!").bar
− examples/passing/Objects.purs
@@ -1,35 +0,0 @@-module Main where-- import Prelude-- test = \x -> x.foo + x.bar + 1-- append = \o -> { foo: o.foo, bar: 1 }-- apTest = append({foo : "Foo", baz: "Baz"})-- f = (\a -> a.b.c) { b: { c: 1, d: "Hello" }, e: "World" }-- g = (\a -> a.f { x: 1, y: "y" }) { f: \o -> o.x + 1 }-- typed :: { foo :: Number }- typed = { foo: 0 }-- test2 = \x -> x."!@#"-- test3 = typed."foo"-- test4 = test2 weirdObj- where- weirdObj :: { "!@#" :: Number }- weirdObj = { "!@#": 1 }-- test5 = case { "***": 1 } of- { "***" = n } -> n-- test6 = case { "***": 1 } of- { "***": n } -> n-- test7 {a: snoog , b : blah } = blah-- main = Debug.Trace.trace "Done"
− examples/passing/OneConstructor.purs
@@ -1,7 +0,0 @@-module Main where--data One a = One a--one' (One a) = a--main = Debug.Trace.trace "Done"
− examples/passing/OperatorAssociativity.purs
@@ -1,58 +0,0 @@-module Main where--import Control.Monad.Eff-import Debug.Trace--foreign import data Assert :: !--foreign import assert- """- function assert(x) {- return function(desc) {- return function() {- if (!x) throw new Error('assertion (' + desc + ') failed');- return {};- };- };- }- """ :: forall e. Boolean -> String -> Eff (assert :: Assert | e) Unit--bug :: Number -> Number -> Number-bug a b = 0 - (a - b)--foreign import explode- """- function explode() {- throw new Error('Assertion failed!');- }- """ :: forall eff a. Eff eff a--main = do- assert (bug 0 2 == 2) "bug 0 2 == 2"- assert (0 - (0 - 2) == 2) "0 - (0 - 2) == 2"- assert (0 - (0 + 2) == -2) "0 - (0 + 2) == -2"-- assert (6 / (3 * 2) == 1) "6 / (3 * 2) == 1"- assert ((6 / 3) * 2 == 4) "(6 / 3) * 2 == 4"-- assert (6 % (2 * 2) == 2) "6 % (2 * 2) == 2"- assert ((6 % 2) * 2 == 0) "(6 % 2) * 2 == 0"-- assert (4 % (9 / 3) == 1) "4 % (9 / 3) == 1"- assert ((4 % 9) / 2 == 2) "(4 % 9) / 2 == 2"-- assert (not (1 < 0) == true) "not (1 < 0) == true"- assert (not (complement (1 + 10) == 8) == true) "not (complement (1 + 10) == 8) == true"- assert (not ((negate 1) < 0) == false) "not ((negate 1) < 0) == false"-- assert (negate (1 + 10) == -11) "negate (1 + 10) == -11"-- assert (2 * 3 / 4 == 1.5) "2 * 3 / 4 == 1.5"- assert (1 * 2 * 3 * 4 * 5 / 6 == 20) "1 * 2 * 3 * 4 * 5 / 6 == 20"- assert (complement (2 / 3 * 4) == -3) "complement (2 / 3 * 4) == -3"-- assert (1 + 10 - 5 == 6) "1 + 10 - 5 == 6"- assert (1 + 10 * 5 == 51) "1 + 10 * 5 == 51"- assert (10 * 5 - 1 == 49) "10 * 5 - 1 == 49"-- trace "Success!"
− examples/passing/OperatorSections.purs
@@ -1,21 +0,0 @@-module Main where--foreign import eqeqeq- """- function eqeqeq(x) {- return function (y) {- if (x == y) return x;- throw new Error("Unexpected result: " + x + " /== " + y);- };- };- """ :: forall a. a -> a -> a--(===) = eqeqeq-infixl 4 ===--main = do- Debug.Trace.print $ (/ 2) 4 === 2- Debug.Trace.print $ (2 /) 4 === 0.5- Debug.Trace.print $ (`const` 1) 2 === 2- Debug.Trace.print $ (1 `const`) 2 === 1- Debug.Trace.trace "Done!"
− examples/passing/Operators.purs
@@ -1,102 +0,0 @@-module Main where-- import Control.Monad.Eff- import Debug.Trace-- (?!) :: forall a. a -> a -> a- (?!) x _ = x-- bar :: String -> String -> String- bar = \s1 s2 -> s1 ++ s2-- test1 :: forall n. (Num n) => n -> n -> (n -> n -> n) -> n- test1 x y z = x * y + z x y-- test2 = (\x -> x.foo false) { foo : \_ -> 1 }-- test3 = (\x y -> x)(1 + 2 * (1 + 2)) (true && (false || false))-- k = \x -> \y -> x-- test4 = 1 `k` 2-- infixl 5 %%-- (%%) :: Number -> Number -> Number- (%%) x y = x * y + y-- test5 = 1 %% 2 %% 3-- test6 = ((\x -> x) `k` 2) 3-- (<+>) :: String -> String -> String- (<+>) = \s1 s2 -> s1 ++ s2-- test7 = "Hello" <+> "World!"-- (@@) :: forall a b. (a -> b) -> a -> b- (@@) = \f x -> f x-- foo :: String -> String- foo = \s -> s-- test8 = foo @@ "Hello World"-- test9 = Main.foo @@ "Hello World"-- test10 = "Hello" `Main.bar` "World"-- (...) :: forall a. [a] -> [a] -> [a]- (...) = \as -> \bs -> as-- test11 = [1, 2, 3] ... [4, 5, 6]-- test12 (<%>) a b = a <%> b-- test13 = \(<%>) a b -> a <%> b-- test14 :: Number -> Number -> Boolean- test14 a b = a < b-- test15 :: Number -> Number -> Boolean- test15 a b = const false $ a `test14` b-- test16 :: Number -> Number -> Number- test16 x y = x .|. y .&. y-- test17 :: Number- test17 = negate (-1)-- test18 :: Number- test18 = negate $ negate 1-- test19 :: Number- test19 = negate $ negate (-1)-- test20 :: Number- test20 = 1 @ 2- where- (@) x y = x + y * y-- main = do- let t1 = test1 1 2 (\x y -> x + y)- let t2 = test2- let t3 = test3- let t4 = test4- let t5 = test5- let t6 = test6- let t7 = test7- let t8 = test8- let t9 = test9- let t10 = test10- let t11 = test11- let t12 = test12 k 1 2- let t13 = test13 k 1 2- let t14 = test14 1 2- let t15 = test15 1 2- let t16 = test16 1 2- let t17 = test17- let t18 = test18- let t19 = test19- let t20 = test20- trace "Done"
− examples/passing/OptimizerBug.purs
@@ -1,9 +0,0 @@-module Main where--import Prelude--x a = 1 + y a--y a = x a--main = Debug.Trace.trace "Done"
− examples/passing/PartialFunction.purs
@@ -1,19 +0,0 @@-module Main where--foreign import testError- """- function testError(f) {- try {- return f();- } catch (e) {- if (e instanceof Error) return 'success';- throw new Error('Pattern match failure is not Error');- }- }- """ :: (Unit -> Number) -> String--fn :: Number -> Number-fn 0 = 0-fn 1 = 2--main = Debug.Trace.trace (show $ testError $ \_ -> fn 2)
− examples/passing/Patterns.purs
@@ -1,28 +0,0 @@-module Main where-- import Prelude-- test = \x -> case x of- { str = "Foo", bool = true } -> true- { str = "Bar", bool = b } -> b- _ -> false-- f = \o -> case o of- { foo = "Foo" } -> o.bar- _ -> 0-- g = \o -> case o of- { arr = [x : xs], take = "car" } -> x- { arr = [_, x : xs], take = "cadr" } -> x- _ -> 0--- h = \o -> case o of- a@[_,_,_] -> a- _ -> []-- isDesc :: [Number] -> Boolean- isDesc [x, y] | x > y = true- isDesc _ = false-- main = Debug.Trace.trace "Done"
− examples/passing/Person.purs
@@ -1,18 +0,0 @@-module Main where-- import Prelude ((++))-- data Person = Person { name :: String, age :: Number }-- foreign import itoa- """- function itoa(n) {- return n.toString();- }- """ :: Number -> String-- showPerson :: Person -> String- showPerson = \p -> case p of- Person o -> o.name ++ ", aged " ++ itoa(o.age)-- main = Debug.Trace.trace "Done"
− examples/passing/Rank2Data.purs
@@ -1,29 +0,0 @@-module Main where-- import Prelude-- data Id = Id forall a. a -> a-- runId = \id a -> case id of- Id f -> f a-- data Nat = Nat forall r. r -> (r -> r) -> r-- runNat = \nat -> case nat of- Nat f -> f 0 (\n -> n + 1)-- zero' = Nat (\zero' _ -> zero')-- succ = \n -> case n of- Nat f -> Nat (\zero' succ -> succ (f zero' succ))-- add = \n m -> case n of- Nat f -> case m of- Nat g -> Nat (\zero' succ -> g (f zero' succ) succ)-- one' = succ zero'- two = succ zero'- four = add two two- fourNumber = runNat four-- main = Debug.Trace.trace "Done'"
− examples/passing/Rank2Object.purs
@@ -1,10 +0,0 @@-module Main where--import Debug.Trace--data Foo = Foo { id :: forall a. a -> a }--foo :: Foo -> Number-foo (Foo { id = f }) = f 0--main = trace "Done"
− examples/passing/Rank2TypeSynonym.purs
@@ -1,15 +0,0 @@-module Main where--import Control.Monad.Eff--type Foo a = forall f. (Monad f) => f a--foo :: forall a. a -> Foo a-foo x = pure x--bar :: Foo Number-bar = foo 3--main = do- x <- bar- Debug.Trace.print x
− examples/passing/Rank2Types.purs
@@ -1,11 +0,0 @@-module Main where-- import Prelude-- test1 :: (forall a. (a -> a)) -> Number- test1 = \f -> f 0-- forever :: forall m a b. (forall a b. m a -> (a -> m b) -> m b) -> m a -> m b- forever = \bind action -> bind action $ \_ -> forever bind action-- main = Debug.Trace.trace "Done"
− examples/passing/Recursion.purs
@@ -1,10 +0,0 @@-module Main where-- import Prelude-- fib = \n -> case n of- 0 -> 1- 1 -> 1- n -> fib (n - 1) + fib (n - 2)-- main = Debug.Trace.trace "Done"
− examples/passing/ReservedWords.purs
@@ -1,13 +0,0 @@--- See https://github.com/purescript/purescript/issues/606-module Main where-- o :: { type :: String }- o = { type: "o" }-- p :: { type :: String }- p = o { type = "p" }-- f :: forall r. { type :: String | r } -> String- f { type = "p" } = "Done"-- main = Debug.Trace.trace $ f { type: p.type, foo: "bar" }
− examples/passing/RowPolyInstanceContext.purs
@@ -1,20 +0,0 @@-module Main where--class T s m where- state :: (s -> s) -> m Unit--data S s a = S (s -> { new :: s, ret :: a })--instance st :: T s (S s) where- state f = S $ \s -> { new: f s, ret: unit }--test1 :: forall r . S { foo :: String | r } Unit-test1 = state $ \o -> o { foo = o.foo ++ "!" }--test2 :: forall m r . (T { foo :: String | r } m) => m Unit-test2 = state $ \o -> o { foo = o.foo ++ "!" }--main = do- let t1 = test1- let t2 = test2- Debug.Trace.trace "Done"
− examples/passing/RowSynonyms.purs
@@ -1,46 +0,0 @@-module Main where--import Control.Monad.Eff-import Control.Monad.ST--type State bindings =- {- bindings :: {addition :: Number | bindings},- other :: String- }--type MyBindings = (test :: Number)--data Shadow bindings = Shadow String--shadows :: Shadow (Object MyBindings)-shadows = Shadow "uhh"--main :: Eff () Unit-main = withIt- shadows- \ bindings -> do- let state =- {- bindings : bindings,- other : "Test"- }- runST do- stRef <- newSTRef state- handleKeyD stRef- return unit---withIt :: forall bindings eff a. Shadow (Object bindings) ->- ({addition :: Number | bindings} -> Eff eff a) -> Eff eff a-withIt (Shadow str) success = do- b <- withBindings- success (b{addition = 1})--foreign import withBindings-"""- function withBindings() {}-""" :: forall eff bindings. Eff eff bindings--handleKeyD :: forall h eff. STRef h (State MyBindings) -> Eff (st :: ST h | eff) Unit-handleKeyD state = return unit
− examples/passing/RuntimeScopeIssue.purs
@@ -1,19 +0,0 @@-module Main where--import Prelude--class A a where- a :: a -> Boolean--class B a where- b :: a -> Boolean--instance aNumber :: A Number where- a 0 = true- a n = b (n - 1)--instance bNumber :: B Number where- b 0 = false- b n = a (n - 1)--main = Debug.Trace.print $ a 10
− examples/passing/ScopedTypeVariables.purs
@@ -1,34 +0,0 @@-module Main where--test1 :: forall a. (a -> a) -> a -> a-test1 f x = g (g x)- where- g :: a -> a- g y = f (f y)--test2 :: forall a. (a -> a) -> a -> a-test2 = h- where- h :: forall b. (b -> b) -> b -> b- h f x = g (g x)- where- g :: b -> b- g y = f (f y)--test3 :: Number -test3 = ((\b -> b :: b) :: forall b. b -> b) 0--test4 :: forall a. (a -> a) -> a -> a-test4 = h- where- h :: forall b. (b -> b) -> b -> b- h f x = g (g x)- where- g :: b -> b- g y = j (f (f y))- where- j :: forall b. b -> b- j x = x---main = Debug.Trace.trace "Done"
− examples/passing/Sequence.purs
@@ -1,12 +0,0 @@-module Main where--import Control.Monad.Eff--class Sequence t where- sequence :: forall m a. (Monad m) => t (m a) -> m (t a)--instance sequenceArray :: Sequence [] where- sequence [] = pure []- sequence (x:xs) = (:) <$> x <*> sequence xs--main = sequence $ [Debug.Trace.trace "Done"]
− examples/passing/SequenceDesugared.purs
@@ -1,34 +0,0 @@-module Main where--import Control.Monad.Eff--data Sequence t = Sequence (forall m a. (Monad m) => t (m a) -> m (t a))--sequence :: forall t. Sequence t -> (forall m a. (Monad m) => t (m a) -> m (t a))-sequence (Sequence s) = s--sequenceArraySeq :: forall m a. (Monad m) => Array (m a) -> m (Array a)-sequenceArraySeq [] = pure []-sequenceArraySeq (x:xs) = (:) <$> x <*> sequenceArraySeq xs--sequenceArray :: Sequence []-sequenceArray = Sequence (sequenceArraySeq)--sequenceArray' :: Sequence []-sequenceArray' = Sequence ((\val -> case val of- [] -> pure []- (x:xs) -> (:) <$> x <*> sequence sequenceArray' xs))--sequenceArray'' :: Sequence []-sequenceArray'' = Sequence (sequenceArraySeq :: forall m a. (Monad m) => Array (m a) -> m (Array a))--sequenceArray''' :: Sequence []-sequenceArray''' = Sequence ((\val -> case val of- [] -> pure []- (x:xs) -> (:) <$> x <*> sequence sequenceArray''' xs) :: forall m a. (Monad m) => Array (m a) -> m (Array a))--main = do- sequence sequenceArray $ [Debug.Trace.trace "Done"]- sequence sequenceArray' $ [Debug.Trace.trace "Done"]- sequence sequenceArray'' $ [Debug.Trace.trace "Done"]- sequence sequenceArray''' $ [Debug.Trace.trace "Done"]
− examples/passing/ShadowedRename.purs
@@ -1,21 +0,0 @@-module Main where--import Control.Monad.Eff-import Debug.Trace--foreign import f- """- function f(x) {- return function() {- if (x !== 2) throw new Error('x is not 2');- };- }- """ :: forall e. Number -> Eff e Number--foo foo = let foo_1 = \_ -> foo- foo_2 = foo_1 unit + 1- in foo_2--main = do- f (foo 1)- trace "Done"
− examples/passing/ShadowedTCO.purs
@@ -1,16 +0,0 @@-module Main where--runNat f = f 0 (\n -> n + 1)--zero' z _ = z--succ f zero' succ = succ (f zero' succ)--add f g zero' succ = g (f zero' succ) succ--one' = succ zero'-two = succ one'-four = add two two-fourNumber = runNat four--main = Debug.Trace.trace $ show fourNumber
− examples/passing/ShadowedTCOLet.purs
@@ -1,7 +0,0 @@-module Main where--f x y z =- let f 1 2 3 = 1- in f x z y--main = Debug.Trace.trace $ show $ f 1 3 2
− examples/passing/SignedNumericLiterals.purs
@@ -1,15 +0,0 @@-module Main where-- p = 0.5- q = 1- x = -1- y = -0.5- z = 0.5- w = 1-- f :: Number -> Number- f x = -x-- test1 = 2 - 1-- main = Debug.Trace.trace "Done"
− examples/passing/Superclasses1.purs
@@ -1,18 +0,0 @@-module Main where--class Su a where- su :: a -> a--class (Su a) <= Cl a where- cl :: a -> a -> a--instance suNumber :: Su Number where- su n = n + 1--instance clNumber :: Cl Number where- cl n m = n + m--test :: forall a. (Cl a) => a -> a-test a = su (cl a a)--main = Debug.Trace.print $ test 10
− examples/passing/Superclasses2.purs
@@ -1,23 +0,0 @@-module Main where--import Prelude.Unsafe (unsafeIndex)--class Su a where- su :: a -> a--class (Su [a]) <= Cl a where- cl :: a -> a -> a--instance suNumber :: Su Number where- su n = n + 1--instance suArray :: (Su a) => Su [a] where- su (x : _) = [su x]--instance clNumber :: Cl Number where- cl n m = n + m--test :: forall a. (Cl a) => a -> [a]-test x = su [cl x x]--main = Debug.Trace.print $ test 10 `unsafeIndex` 0
− examples/passing/Superclasses3.purs
@@ -1,41 +0,0 @@-module Main where--import Debug.Trace--import Control.Monad.Eff--class (Monad m) <= MonadWriter w m where- tell :: w -> m Unit--testFunctor :: forall m. (Monad m) => m Number -> m Number-testFunctor n = (+) 1 <$> n--test :: forall w m. (Monad m, MonadWriter w m) => w -> m Unit-test w = do- tell w- tell w- tell w--data MTrace a = MTrace (Eff (trace :: Trace) a)--runMTrace :: forall a. MTrace a -> Eff (trace :: Trace) a-runMTrace (MTrace a) = a--instance functorMTrace :: Functor MTrace where- (<$>) = liftM1--instance applyMTrace :: Apply MTrace where- (<*>) = ap--instance applicativeMTrace :: Applicative MTrace where- pure = MTrace <<< return--instance bindMTrace :: Bind MTrace where- (>>=) m f = MTrace (runMTrace m >>= (runMTrace <<< f))--instance monadMTrace :: Monad MTrace--instance writerMTrace :: MonadWriter String MTrace where- tell s = MTrace (trace s)--main = runMTrace $ test "Done"
− examples/passing/TCOCase.purs
@@ -1,10 +0,0 @@-module Main where--data Data = One | More Data--main = Debug.Trace.trace (from (to 10000 One))- where- to 0 a = a- to n a = to (n - 1) (More a)- from One = "Done"- from (More d) = from d
− examples/passing/TailCall.purs
@@ -1,15 +0,0 @@-module Main where--import Prelude--test :: Number -> [Number] -> Number-test n [] = n-test n (x:xs) = test (n + x) xs--loop :: forall a. Number -> a-loop x = loop (x + 1)--notATailCall = \x ->- (\notATailCall -> notATailCall x) (\x -> x)--main = Debug.Trace.print (test 0 [1, 2, 3])
− examples/passing/Tick.purs
@@ -1,5 +0,0 @@-module Main where--test' x = x--main = Debug.Trace.trace "Done"
− examples/passing/TopLevelCase.purs
@@ -1,18 +0,0 @@-module Main where-- import Prelude-- gcd :: Number -> Number -> Number- gcd 0 x = x- gcd x 0 = x- gcd x y | x > y = gcd (x % y) y- gcd x y = gcd (y % x) x-- guardsTest (x:xs) | x > 0 = guardsTest xs- guardsTest xs = xs-- data A = A-- parseTest A 0 = 0-- main = Debug.Trace.trace "Done"
− examples/passing/TypeClassImport.purs
@@ -1,18 +0,0 @@-module Main where--foreign import data T :: *--foreign import data C :: *--foreign import t "var t = null;" :: T--foreign import inst """- var inst = {- show: function(t) {- return 'Done';- }- }""" :: C--foreign import instance inst :: Show T--main = Debug.Trace.print t
− examples/passing/TypeClassMemberOrderChange.purs
@@ -1,11 +0,0 @@-module Main where--class Test a where- fn :: a -> a -> a- val :: a--instance testBoolean :: Test Boolean where- val = true- fn x y = y--main = Debug.Trace.trace (show (fn true val))
− examples/passing/TypeClasses.purs
@@ -1,69 +0,0 @@-module Main where--import Prelude--test1 = \_ -> show "testing"--f :: forall a. (Prelude.Show a) => a -> String-f x = show x--test2 = \_ -> f "testing"--test7 :: forall a. (Prelude.Show a) => a -> String-test7 = show--test8 = \_ -> show $ "testing"--data Data a = Data a--instance showData :: (Prelude.Show a) => Prelude.Show (Data a) where- show (Data a) = "Data (" ++ show a ++ ")"--test3 = \_ -> show (Data "testing")--instance functorData :: Functor Data where- (<$>) = liftM1--instance applyData :: Apply Data where- (<*>) = ap--instance applicativeData :: Applicative Data where- pure = Data--instance bindData :: Bind Data where- (>>=) (Data a) f = f a--instance monadData :: Monad Data--data Maybe a = Nothing | Just a--instance functorMaybe :: Functor Maybe where- (<$>) = liftM1--instance applyMaybe :: Apply Maybe where- (<*>) = ap--instance applicativeMaybe :: Applicative Maybe where- pure = Just--instance bindMaybe :: Bind Maybe where- (>>=) Nothing _ = Nothing- (>>=) (Just a) f = f a--instance monadMaybe :: Monad Maybe--test4 :: forall a m. (Monad m) => a -> m Number-test4 = \_ -> return 1--test5 = \_ -> Just 1 >>= \n -> return (n + 1)--ask r = r--runReader r f = f r--test9 _ = runReader 0 $ do- n <- ask- return $ n + 1--main = Debug.Trace.trace (test7 "Done")-
− examples/passing/TypeClassesInOrder.purs
@@ -1,11 +0,0 @@-module Main where--import Prelude--class Foo a where- foo :: a -> String--instance fooString :: Foo String where- foo s = s--main = Debug.Trace.trace $ foo "Done"
− examples/passing/TypeClassesWithOverlappingTypeVariables.purs
@@ -1,11 +0,0 @@-module Main where-- import Prelude-- data Either a b = Left a | Right b-- instance functorEither :: Prelude.Functor (Either a) where- (<$>) _ (Left x) = Left x- (<$>) f (Right y) = Right (f y)-- main = Debug.Trace.trace "Done"
− examples/passing/TypeDecl.purs
@@ -1,12 +0,0 @@-module Main where-- import Prelude-- k :: String -> Number -> String- k x y = x-- iterate :: forall a. Number -> (a -> a) -> a -> a- iterate 0 f a = a- iterate n f a = iterate (n - 1) f (f a)-- main = Debug.Trace.trace "Done"
− examples/passing/TypeSynonymInData.purs
@@ -1,9 +0,0 @@-module Main where--type A a = [a]--data Foo a = Foo (A a) | Bar--foo (Foo []) = Bar--main = Debug.Trace.trace "Done"
− examples/passing/TypeSynonyms.purs
@@ -1,25 +0,0 @@-module Main where-- type Lens a b =- { get :: a -> b- , set :: a -> b -> a- }-- composeLenses :: forall a b c. Lens a b -> Lens b c -> Lens a c- composeLenses = \l1 -> \l2 ->- { get: \a -> l2.get (l1.get a)- , set: \a c -> l1.set a (l2.set (l1.get a) c)- }-- type Pair a b = { fst :: a, snd :: b }-- fst :: forall a b. Lens (Pair a b) a- fst =- { get: \p -> p.fst- , set: \p a -> { fst: a, snd: p.snd }- }-- test1 :: forall a b c. Lens (Pair (Pair a b) c) a- test1 = composeLenses fst fst-- main = Debug.Trace.trace "Done"
− examples/passing/TypeWildcards.purs
@@ -1,13 +0,0 @@-module Main where--testTopLevel :: _ -> _-testTopLevel n = n + 1--test :: forall a. (Eq a) => (a -> a) -> a -> a-test f a = go (f a) a- where- go :: _ -> _ -> _- go a1 a2 | a1 == a2 = a1- go a1 _ = go (f a1) a1--main = Debug.Trace.trace "Done"
− examples/passing/TypeWildcardsRecordExtension.purs
@@ -1,6 +0,0 @@-module Main where--foo :: forall a. {b :: Number | a} -> {b :: Number | _}-foo f = f--main = Debug.Trace.trace "Done"
− examples/passing/TypedWhere.purs
@@ -1,13 +0,0 @@-module Main where--data E a b = L a | R b--lefts :: forall a b. [E a b] -> [a]-lefts = go []- where- go :: forall a b. [a] -> [E a b] -> [a]- go ls [] = ls- go ls (L a : rest) = go (a : ls) rest- go ls (_ : rest) = go ls rest--main = Debug.Trace.trace "Done"
− examples/passing/UnderscoreIdent.purs
@@ -1,9 +0,0 @@-module Main where--data Data_type = Con_Structor | Con_2 String--type Type_name = Data_type--done (Con_2 s) = s--main = Debug.Trace.trace (done (Con_2 "Done"))
− examples/passing/Unit.purs
@@ -1,6 +0,0 @@-module Main where--import Prelude-import Debug.Trace--main = print (const unit $ "Hello world")
− examples/passing/UnknownInTypeClassLookup.purs
@@ -1,12 +0,0 @@-module Main where--class EQ a b--instance eqAA :: EQ a a--test :: forall a b. (EQ a b) => a -> b -> String-test _ _ = "Done"--runTest a = test a a--main = Debug.Trace.trace $ runTest 0
− examples/passing/Where.purs
@@ -1,49 +0,0 @@-module Main where--import Prelude-import Control.Monad.Eff-import Control.Monad.ST--test1 x = y- where- y :: Number- y = x + 1--test2 x y = x' + y'- where- x' = x + 1- y' = y + 1---test3 = f 1 2 3- where f x y z = x + y + z---test4 = f (+) [1, 2]- where f x [y, z] = x y z---test5 = g 10- where- f x | x > 0 = g (x / 2) + 1- f x = 0- g x = f (x - 1) + 1--test6 = if f true then f 1 else f 2- where f :: forall a. a -> a- f x = x--test7 :: Number -> Number-test7 x = go x- where- go y | (x - 0.1 < y * y) && (y * y < x + 0.1) = y- go y = go $ (y + x / y) / 2--main = do- Debug.Trace.print (test1 1)- Debug.Trace.print (test2 1 2)- Debug.Trace.print test3- Debug.Trace.print test4- Debug.Trace.print test5- Debug.Trace.print test6- Debug.Trace.print (test7 100)
− examples/passing/iota.purs
@@ -1,9 +0,0 @@-module Main where-- s = \x -> \y -> \z -> x z (y z)-- k = \x -> \y -> x-- iota = \x -> x s k-- main = Debug.Trace.trace "Done"
− examples/passing/s.purs
@@ -1,5 +0,0 @@-module Main where-- s = \x y z -> x z (y z)-- main = Debug.Trace.trace "Done"
− hierarchy/Main.hs
@@ -1,113 +0,0 @@------------------------------------------------------------------------------------ Module : Main--- Copyright : (c) Hardy Jones 2014--- License : MIT------ Maintainer : Hardy Jones <jones3.hardy@gmail.com>--- Stability : experimental--- Portability :------ |--- Generate Directed Graphs of PureScript TypeClasses-----------------------------------------------------------------------------------module Main where--import Control.Monad (unless)--import Data.List (intercalate,nub,sort)-import Data.Foldable (for_)-import Data.Version (showVersion)--import Options.Applicative-import System.Directory (createDirectoryIfMissing)-import System.FilePath ((</>))-import System.Exit (exitFailure, exitSuccess)-import System.IO (hPutStr, stderr)--import Text.Parsec as Par (ParseError)--import qualified Language.PureScript as P-import qualified Paths_purescript as Paths---data HierarchyOptions = HierarchyOptions- { hierachyInput :: FilePath- , hierarchyOutput :: Maybe FilePath- }--newtype SuperMap = SuperMap { unSuperMap :: Either P.ProperName (P.ProperName, P.ProperName) }- deriving Eq--instance Show SuperMap where- show (SuperMap (Left sub)) = show sub- show (SuperMap (Right (super, sub))) = show super ++ " -> " ++ show sub--instance Ord SuperMap where- compare (SuperMap s) (SuperMap s') = getCls s `compare` getCls s'- where- getCls = either id snd--runModuleName :: P.ModuleName -> String-runModuleName (P.ModuleName pns) = intercalate "_" (P.runProperName `map` pns)--readInput :: FilePath -> IO (Either Par.ParseError [P.Module])-readInput filename = do- content <- readFile filename- return $ fmap (map snd) $ P.parseModulesFromFiles id [(filename, content)]--compile :: HierarchyOptions -> IO ()-compile (HierarchyOptions input mOutput) = do- modules <- readInput input- case modules of- Left err -> hPutStr stderr (show err) >> exitFailure- Right ms -> do- for_ ms $ \(P.Module _ moduleName decls _) ->- let name = runModuleName moduleName- tcs = filter P.isTypeClassDeclaration decls- supers = sort . nub . filter (not . null) $ fmap superClasses tcs- prologue = "digraph " ++ name ++ " {\n"- body = intercalate "\n" (concatMap (fmap (\s -> " " ++ show s ++ ";")) supers)- epilogue = "\n}"- hier = prologue ++ body ++ epilogue- in unless (null supers) $ case mOutput of- Just output -> do- createDirectoryIfMissing True output- writeFile (output </> name) hier- Nothing -> putStrLn hier- exitSuccess--superClasses :: P.Declaration -> [SuperMap]-superClasses (P.TypeClassDeclaration sub _ supers@(_:_) _) =- fmap (\(P.Qualified _ super, _) -> SuperMap (Right (super, sub))) supers-superClasses (P.TypeClassDeclaration sub _ _ _) = [SuperMap (Left sub)]-superClasses (P.PositionedDeclaration _ _ decl) = superClasses decl-superClasses _ = []--inputFile :: Parser FilePath-inputFile = strArgument $- metavar "FILE"- <> value "main.purs"- <> showDefault- <> help "The input file to generate a hierarchy from"--outputFile :: Parser (Maybe FilePath)-outputFile = optional . strOption $- short 'o'- <> long "output"- <> help "The output directory"--pscOptions :: Parser HierarchyOptions-pscOptions = HierarchyOptions <$> inputFile- <*> outputFile--main :: IO ()-main = execParser opts >>= compile- where- opts = info (helper <*> pscOptions) infoModList- infoModList = fullDesc <> headerInfo <> footerInfo- headerInfo = header "hierarchy - Creates a GraphViz directed graph of PureScript TypeClasses"- footerInfo = footer $ "hierarchy " ++ showVersion Paths.version-
− prelude/prelude.purs
@@ -1,1478 +0,0 @@-module Prelude- ( otherwise- , flip- , const- , asTypeOf- , Semigroupoid, (<<<), (>>>)- , Category, id- , ($), (#)- , (:), cons- , Show, show- , Functor, (<$>), (<#>), void- , Apply, (<*>)- , Applicative, pure, liftA1- , Bind, (>>=)- , Monad, return, liftM1, ap- , Semiring, (+), zero, (*), one- , ModuloSemiring, (/), mod- , Ring, (-)- , (%)- , negate- , DivisionRing- , Num- , Eq, (==), (/=)- , Ord, Ordering(..), compare, (<), (>), (<=), (>=)- , Bits, (.&.), (.|.), (.^.), shl, shr, zshr, complement- , BoolLike, (&&), (||)- , not- , Semigroup, (<>), (++)- , Unit(..), unit- ) where-- -- | An alias for `true`, which can be useful in guard clauses:- -- |- -- | ```purescript- -- | max x y | x >= y = x- -- | | otherwise = y- -- | ```- -- |- otherwise :: Boolean- otherwise = true-- -- | Flips the order of the arguments to a function of two arguments.- -- |- -- | ```purescript- -- | flip const 1 2 = const 2 1 = 2- -- | ```- -- |- flip :: forall a b c. (a -> b -> c) -> b -> a -> c- flip f b a = f a b-- -- | Returns its first argument and ignores its second.- -- |- -- | ```purescript- -- | const 1 "hello" = 1- -- | ```- -- |- const :: forall a b. a -> b -> a- const a _ = a-- -- | This function returns its first argument, and can be used to assert type equalities.- -- | This can be useful when types are otherwise ambiguous.- -- |- -- | ```purescript- -- | main = print $ [] `asTypeOf` [0]- -- | ```- -- |- -- | If instead, we had written `main = print []`, the type of the argument `[]` would have- -- | been ambiguous, resulting in a compile-time error.- asTypeOf :: forall a. a -> a -> a- asTypeOf x _ = x-- infixr 9 >>>- infixr 9 <<<-- -- | A `Semigroupoid` is similar to a [`Category`](#category) but does not require an identity- -- | element `id`, just composable morphisms.- -- |- -- | `Semigroupoid`s should obey the following rule:- -- |- -- | - Associativity: `p <<< (q <<< r) = (p <<< q) <<< r`- -- |- -- | One example of a `Semigroupoid` is the function type constructor `(->)`, with `(<<<)` defined- -- | as function composition.- class Semigroupoid a where- (<<<) :: forall b c d. a c d -> a b c -> a b d-- instance semigroupoidArr :: Semigroupoid (->) where- (<<<) f g x = f (g x)-- -- | Forwards composition, or `(<<<)` with its arguments reversed.- (>>>) :: forall a b c d. (Semigroupoid a) => a b c -> a c d -> a b d- (>>>) f g = g <<< f-- -- | `Category`s consist of objects and composable morphisms between them, and as such are- -- | [`Semigroupoids`](#semigroupoid), but unlike `semigroupoids` must have an identity element.- -- |- -- | `Category`s should obey the following rules.- -- |- -- | - Left Identity: `id <<< p = p`- -- | - Right Identity: `p <<< id = p`- -- |- class (Semigroupoid a) <= Category a where- id :: forall t. a t t-- instance categoryArr :: Category (->) where- id x = x-- infixr 0 $- infixl 0 #-- -- | Applies a function to its argument- -- |- -- | ```purescript- -- | length $ groupBy productCategory $ filter isInStock products- -- | ```- -- |- -- | is equivalent to- -- |- -- | ```purescript- -- | length (groupBy productCategory (filter isInStock (products)))- -- | ```- -- |- -- | `($)` is different from [`(#)`](#-2) because it is right-infix instead of left, so- -- | `a $ b $ c $ d x` = `a $ (b $ (c $ (d $ x)))` = `a (b (c (d x)))`- -- |- ($) :: forall a b. (a -> b) -> a -> b- ($) f x = f x-- -- | Applies a function to its argument- -- |- -- | ```purescript- -- | products # groupBy productCategory # filter isInStock # length- -- | ```- -- |- -- | is equivalent to- -- |- -- | ```purescript- -- | length (groupBy productCategory (filter isInStock (products)))- -- | ```- -- |- -- | `(#)` is different from [`($)`](#-1) because it is left-infix instead of right, so- -- | `x # a # b # c # d` = `(((x # a) # b) # c) # d` = `d (c (b (a x)))`- -- |- (#) :: forall a b. a -> (a -> b) -> b- (#) x f = f x-- infixr 6 :-- -- | An infix alias for `cons`.- -- |- -- | Note, the running time of this function is `O(n)`.- (:) :: forall a. a -> [a] -> [a]- (:) = cons-- -- | Attaches an element to the front of an array, creating a new array.- -- |- -- | ```purescript- -- | cons 1 [2, 3, 4] = [1, 2, 3, 4]- -- | ```- -- |- -- | Note, the running time of this function is `O(n)`.- foreign import cons- """- function cons(e) {- return function(l) {- return [e].concat(l);- };- }- """ :: forall a. a -> [a] -> [a]-- -- | The `Show` type class represents those types which can be converted into a human-readable `String` representation.- -- |- -- | While not required, it is recommended that for any expression `x`, the string `show x` be executable PureScript code- -- | which evaluates to the same value as the expression `x`.- class Show a where- show :: a -> String-- foreign import showStringImpl- """- function showStringImpl(s) {- return JSON.stringify(s);- }- """ :: String -> String-- instance showUnit :: Show Unit where- show (Unit {}) = "Unit {}"-- instance showString :: Show String where- show = showStringImpl-- instance showBoolean :: Show Boolean where- show true = "true"- show false = "false"-- foreign import showNumberImpl- """- function showNumberImpl(n) {- return n.toString();- }- """ :: Number -> String-- instance showNumber :: Show Number where- show = showNumberImpl-- foreign import showArrayImpl- """- function showArrayImpl(f) {- return function(xs) {- var ss = [];- for (var i = 0, l = xs.length; i < l; i++) {- ss[i] = f(xs[i]);- }- return '[' + ss.join(',') + ']';- };- }- """ :: forall a. (a -> String) -> [a] -> String-- instance showArray :: (Show a) => Show [a] where- show = showArrayImpl show-- infixl 4 <$>- infixl 1 <#>-- -- | A `Functor` is a type constructor which supports a mapping operation `(<$>)`.- -- |- -- | `(<$>)` can be used to turn functions `a -> b` into functions `f a -> f b` whose argument and return- -- | types use the type constructor `f` to represent some computational context.- -- |- -- | `Functor` instances should satisfy the following laws:- -- |- -- | - Identity: `(<$>) id = id`- -- | - Composition: `(<$>) (f <<< g) = (f <$>) <<< (g <$>)`- -- |- class Functor f where- (<$>) :: forall a b. (a -> b) -> f a -> f b-- -- | `(<#>)` is `(<$>)` with its arguments reversed. For example:- -- |- -- | ```purescript- -- | [1, 2, 3] <#> \n -> n * n- -- | ```- (<#>) :: forall f a b. (Functor f) => f a -> (a -> b) -> f b- (<#>) fa f = f <$> fa-- -- | The `void` function is used to ignore the type wrapped by a [`Functor`](#functor), replacing it with `Unit` and- -- | keeping only the type information provided by the type constructor itself.- -- |- -- | `void` is often useful when using `do` notation to change the return type of a monadic computation:- -- |- -- | ```purescript- -- | main = forE 1 10 \n -> void do- -- | print n- -- | print (n * n)- -- | ```- void :: forall f a. (Functor f) => f a -> f Unit- void fa = const unit <$> fa-- infixl 4 <*>-- -- | The `Apply` class provides the `(<*>)` which is used to apply a function to an argument under a type constructor.- -- |- -- | `Apply` can be used to lift functions of two or more arguments to work on values wrapped with the type constructor `f`.- -- | It might also be understood in terms of the `lift2` function:- -- |- -- | ```purescript- -- | lift2 :: forall f a b c. (Apply f) => (a -> b -> c) -> f a -> f b -> f c- -- | lift2 f a b = f <$> a <*> b- -- | ```- -- |- -- | `(<*>)` is recovered from `lift2` as `lift2 ($)`. That is, `(<*>)` lifts the function application operator `($)` to arguments- -- | wrapped with the type constructor `f`.- -- |- -- | `Apply` instances should satisfy the following law:- -- |- -- | - Associative Composition: `(<<<) <$> f <*> g <*> h = f <*> (g <*> h)`- -- |- -- | Formally, `Apply` represents a strong lax semi-monoidal endofunctor.- class (Functor f) <= Apply f where- (<*>) :: forall a b. f (a -> b) -> f a -> f b-- -- | The `Applicative` type class extends the [`Apply`](#apply) type class with a `pure` function, which can be used to- -- | create values of type `f a` from values of type `a`.- -- |- -- | Where [`Apply`](#apply) provides the ability to lift functions of two or more arguments to functions whose arguments are wrapped using `f`,- -- | and [`Functor`](#functor) provides the ability to lift functions of one argument, `pure` can be seen as the function which lifts functions of- -- | _zero_ arguments. That is, `Applicative` functors support a lifting operation for any number of function arguments.- -- |- -- | `Applicative` instances should satisfy the following laws:- -- |- -- | - Identity: `(pure id) <*> v = v`- -- | - Composition: `(pure <<<) <*> f <*> g <*> h = f <*> (g <*> h)`- -- | - Homomorphism: `(pure f) <*> (pure x) = pure (f x)`- -- | - Interchange: `u <*> (pure y) = (pure ($ y)) <*> u`- -- |- class (Apply f) <= Applicative f where- pure :: forall a. a -> f a-- -- | `liftA1` provides a default implementation of `(<$>)` for any [`Applicative`](#applicative) functor,- -- | without using `(<$>)` as provided by the [`Functor`](#functor)-[`Applicative`](#applicative) superclass relationship.- -- |- -- | `liftA1` can therefore be used to write [`Functor`](#functor) instances as follows:- -- |- -- | ```purescript- -- | instance functorF :: Functor F where- -- | (<$>) = liftA1- -- | ```- liftA1 :: forall f a b. (Applicative f) => (a -> b) -> f a -> f b- liftA1 f a = pure f <*> a-- infixl 1 >>=-- -- | The `Bind` type class extends the [`Apply`](#apply) type class with a "bind" operation `(>>=)` which composes computations- -- | in sequence, using the return value of one computation to determine the next computation.- -- |- -- | The `>>=` operator can also be expressed using `do` notation, as follows:- -- |- -- | ```purescript- -- | x >>= f = do y <- x- -- | f y- -- | ```- -- |- -- | where the function argument of `f` is given the name `y`.- -- |- -- | `Bind` instances should satisfy the following law:- -- |- -- | - Associativity: `(x >>= f) >>= g = x >>= (\k => f k >>= g)`- -- |- -- | Or, expressed using `do` notation:- -- |- -- | - Associativity: `do { z <- do { y <- x ; f y } ; g z } = do { k <- x ; do { y <- f k ; g y } }`- -- |- -- | Associativity tells us that we can regroup operations which use do-notation, so that we can unambiguously write, for example:- -- |- -- | ```purescript- -- | do x <- m1- -- | y <- m2 x- -- | m3 x y- -- | ```- class (Apply m) <= Bind m where- (>>=) :: forall a b. m a -> (a -> m b) -> m b-- -- | The `Monad` type class combines the operations of the `Bind` and `Applicative` type classes. Therefore, `Monad` instances- -- | represent type constructors which support sequential composition, and also lifting of functions of arbitrary arity.- -- |- -- | `Monad` instances should satisfy the following laws:- -- |- -- | - Left Identity: `pure x >>= f = f x`- -- | - Right Identity: `x >>= pure = x`- -- |- -- | Or, expressed using `do` notation:- -- |- -- | - Left Identity: `do { y <- pure x ; f y } = f x`- -- | - Right Identity: `do { y <- x ; pure y } = x`- -- |- class (Applicative m, Bind m) <= Monad m-- -- | `return` is an alias for `pure`.- return :: forall m a. (Monad m) => a -> m a- return = pure-- -- | `liftM1` provides a default implementation of `(<$>)` for any [`Monad`](#monad),- -- | without using `(<$>)` as provided by the [`Functor`](#functor)-[`Monad`](#monad) superclass relationship.- -- |- -- | `liftM1` can therefore be used to write [`Functor`](#functor) instances as follows:- -- |- -- | ```purescript- -- | instance functorF :: Functor F where- -- | (<$>) = liftM1- -- | ```- liftM1 :: forall m a b. (Monad m) => (a -> b) -> m a -> m b- liftM1 f a = do- a' <- a- return (f a')-- -- | `ap` provides a default implementation of `(<*>)` for any [`Monad`](#monad),- -- | without using `(<*>)` as provided by the [`Apply`](#apply)-[`Monad`](#monad) superclass relationship.- -- |- -- | `ap` can therefore be used to write [`Apply`](#apply) instances as follows:- -- |- -- | ```purescript- -- | instance applyF :: Apply F where- -- | (<*>) = ap- -- | ```- ap :: forall m a b. (Monad m) => m (a -> b) -> m a -> m b- ap f a = do- f' <- f- a' <- a- return (f' a')-- instance functorArr :: Functor ((->) r) where- (<$>) = (<<<)-- instance applyArr :: Apply ((->) r) where- (<*>) f g x = f x (g x)-- instance applicativeArr :: Applicative ((->) r) where- pure = const-- instance bindArr :: Bind ((->) r) where- (>>=) m f x = f (m x) x-- instance monadArr :: Monad ((->) r)-- infixl 7 *- infixl 7 /- infixl 7 %-- infixl 6 -- infixl 6 +-- -- | Addition and multiplication, satisfying the following laws:- -- |- -- | - `a` is a commutative monoid under addition- -- | - `a` is a monoid under multiplication- -- | - multiplication distributes over addition- -- | - multiplication by `zero` annihilates `a`- -- |- class Semiring a where- (+) :: a -> a -> a- zero :: a- (*) :: a -> a -> a- one :: a-- -- | Addition, multiplication, modulo operation and division, satisfying:- -- |- -- | - ```a / b * b + (a `mod` b) = a```- -- |- class (Semiring a) <= ModuloSemiring a where- (/) :: a -> a -> a- mod :: a -> a -> a-- -- | Addition, multiplication, and subtraction.- -- |- -- | Has the same laws as `Semiring` but additionally satisfying:- -- |- -- | - `a` is an abelian group under addition- -- |- class (Semiring a) <= Ring a where- (-) :: a -> a -> a-- negate :: forall a. (Ring a) => a -> a- negate a = zero - a-- -- | Ring where every nonzero element has a multiplicative inverse so that:- -- |- -- | - ```a `mod` b = zero```- -- |- class (Ring a, ModuloSemiring a) <= DivisionRing a-- -- | A commutative field- class (DivisionRing a) <= Num a-- foreign import numAdd- """- function numAdd(n1) {- return function(n2) {- return n1 + n2;- };- }- """ :: Number -> Number -> Number-- foreign import numSub- """- function numSub(n1) {- return function(n2) {- return n1 - n2;- };- }- """ :: Number -> Number -> Number-- foreign import numMul- """- function numMul(n1) {- return function(n2) {- return n1 * n2;- };- }- """ :: Number -> Number -> Number-- foreign import numDiv- """- function numDiv(n1) {- return function(n2) {- return n1 / n2;- };- }- """ :: Number -> Number -> Number-- foreign import numMod- """- function numMod(n1) {- return function(n2) {- return n1 % n2;- };- }- """ :: Number -> Number -> Number-- (%) = numMod-- instance semiringNumber :: Semiring Number where- (+) = numAdd- zero = 0- (*) = numMul- one = 1-- instance ringNumber :: Ring Number where- (-) = numSub-- instance moduloSemiringNumber :: ModuloSemiring Number where- (/) = numDiv- mod _ _ = 0-- instance divisionRingNumber :: DivisionRing Number-- instance numNumber :: Num Number-- -- | The `Unit` type has a single inhabitant, called `unit`. It represents values with no computational content.- -- |- -- | `Unit` is often used, wrapped in a monadic type constructor, as the return type of a computation where only- -- | the _effects_ are important.- newtype Unit = Unit {}-- -- | `unit` is the sole inhabitant of the `Unit` type.- unit :: Unit- unit = Unit {}-- infix 4 ==- infix 4 /=-- -- | The `Eq` type class represents types which support decidable equality.- -- |- -- | `Eq` instances should satisfy the following laws:- -- |- -- | - Reflexivity: `x == x = true`- -- | - Symmetry: `x == y = y == x`- -- | - Transitivity: if `x == y` and `y == z` then `x == z`- -- | - Negation: `x /= y = not (x == y)`- -- |- -- | `(/=)` may be implemented in terms of `(==)`, but it might give a performance improvement to implement it separately.- class Eq a where- (==) :: a -> a -> Boolean- (/=) :: a -> a -> Boolean-- foreign import refEq- """- function refEq(r1) {- return function(r2) {- return r1 === r2;- };- }- """ :: forall a. a -> a -> Boolean-- foreign import refIneq- """- function refIneq(r1) {- return function(r2) {- return r1 !== r2;- };- }- """ :: forall a. a -> a -> Boolean-- instance eqUnit :: Eq Unit where- (==) (Unit {}) (Unit {}) = true- (/=) (Unit {}) (Unit {}) = false-- instance eqString :: Eq String where- (==) = refEq- (/=) = refIneq-- instance eqNumber :: Eq Number where- (==) = refEq- (/=) = refIneq-- instance eqBoolean :: Eq Boolean where- (==) = refEq- (/=) = refIneq-- foreign import eqArrayImpl- """- function eqArrayImpl(f) {- return function(xs) {- return function(ys) {- if (xs.length !== ys.length) return false;- for (var i = 0; i < xs.length; i++) {- if (!f(xs[i])(ys[i])) return false;- }- return true;- };- };- }- """ :: forall a. (a -> a -> Boolean) -> [a] -> [a] -> Boolean-- instance eqArray :: (Eq a) => Eq [a] where- (==) xs ys = eqArrayImpl (==) xs ys- (/=) xs ys = not (xs == ys)-- -- | The `Ordering` data type represents the three possible outcomes of comparing two values:- -- |- -- | `LT` - The first value is _less than_ the second.- -- | `GT` - The first value is _greater than_ the second.- -- | `EQ` - The first value is _equal to_ or _incomparable to_ the second.- data Ordering = LT | GT | EQ-- instance eqOrdering :: Eq Ordering where- (==) LT LT = true- (==) GT GT = true- (==) EQ EQ = true- (==) _ _ = false- (/=) x y = not (x == y)-- instance showOrdering :: Show Ordering where- show LT = "LT"- show GT = "GT"- show EQ = "EQ"-- instance semigroupOrdering :: Semigroup Ordering where- (<>) LT _ = LT- (<>) GT _ = GT- (<>) EQ y = y-- -- | The `Ord` type class represents types which support comparisons.- -- |- -- | `Ord` instances should satisfy the laws of _partially orderings_:- -- |- -- | - Reflexivity: `a <= a`- -- | - Antisymmetry: if `a <= b` and `b <= a` then `a = b`- -- | - Transitivity: if `a <= b` and `b <= c` then `a <= c`- -- |- class (Eq a) <= Ord a where- compare :: a -> a -> Ordering-- infixl 4 <-- -- | Test whether one value is _strictly less than_ another.- (<) :: forall a. (Ord a) => a -> a -> Boolean- (<) a1 a2 = case a1 `compare` a2 of- LT -> true- _ -> false-- infixl 4 >-- -- | Test whether one value is _strictly greater than_ another.- (>) :: forall a. (Ord a) => a -> a -> Boolean- (>) a1 a2 = case a1 `compare` a2 of- GT -> true- _ -> false-- infixl 4 <=-- -- | Test whether one value is _non-strictly less than_ another.- (<=) :: forall a. (Ord a) => a -> a -> Boolean- (<=) a1 a2 = case a1 `compare` a2 of- GT -> false- _ -> true-- infixl 4 >=-- -- | Test whether one value is _non-strictly greater than_ another.- (>=) :: forall a. (Ord a) => a -> a -> Boolean- (>=) a1 a2 = case a1 `compare` a2 of- LT -> false- _ -> true-- foreign import unsafeCompareImpl- """- function unsafeCompareImpl(lt) {- return function(eq) {- return function(gt) {- return function(x) {- return function(y) {- return x < y ? lt : x > y ? gt : eq;- };- };- };- };- }- """ :: forall a. Ordering -> Ordering -> Ordering -> a -> a -> Ordering-- unsafeCompare :: forall a. a -> a -> Ordering- unsafeCompare = unsafeCompareImpl LT EQ GT-- instance ordUnit :: Ord Unit where- compare (Unit {}) (Unit {}) = EQ-- instance ordBoolean :: Ord Boolean where- compare false false = EQ- compare false true = LT- compare true true = EQ- compare true false = GT-- instance ordNumber :: Ord Number where- compare = unsafeCompare-- instance ordString :: Ord String where- compare = unsafeCompare-- instance ordArray :: (Ord a) => Ord [a] where- compare [] [] = EQ- compare [] _ = LT- compare _ [] = GT- compare (x:xs) (y:ys) = case compare x y of- EQ -> compare xs ys- other -> other-- infixl 10 .&.- infixl 10 .|.- infixl 10 .^.-- -- | The `Bits` type class identifies types which support bitwise operations.- class Bits b where- (.&.) :: b -> b -> b- (.|.) :: b -> b -> b- (.^.) :: b -> b -> b- shl :: b -> Number -> b- shr :: b -> Number -> b- zshr :: b -> Number -> b- complement :: b -> b-- foreign import numShl- """- function numShl(n1) {- return function(n2) {- return n1 << n2;- };- }- """ :: Number -> Number -> Number-- foreign import numShr- """- function numShr(n1) {- return function(n2) {- return n1 >> n2;- };- }- """ :: Number -> Number -> Number-- foreign import numZshr- """- function numZshr(n1) {- return function(n2) {- return n1 >>> n2;- };- }- """ :: Number -> Number -> Number-- foreign import numAnd- """- function numAnd(n1) {- return function(n2) {- return n1 & n2;- };- }- """ :: Number -> Number -> Number-- foreign import numOr- """- function numOr(n1) {- return function(n2) {- return n1 | n2;- };- }- """ :: Number -> Number -> Number-- foreign import numXor- """- function numXor(n1) {- return function(n2) {- return n1 ^ n2;- };- }- """ :: Number -> Number -> Number-- foreign import numComplement- """- function numComplement(n) {- return ~n;- }- """ :: Number -> Number-- instance bitsNumber :: Bits Number where- (.&.) = numAnd- (.|.) = numOr- (.^.) = numXor- shl = numShl- shr = numShr- zshr = numZshr- complement = numComplement-- infixr 2 ||- infixr 3 &&-- -- | The `BoolLike` type class identifies types which support Boolean operations.- -- |- -- | `BoolLike` instances are required to satisfy the laws of a _Boolean algebra_.- -- |- class BoolLike b where- (&&) :: b -> b -> b- (||) :: b -> b -> b- not :: b -> b-- foreign import boolAnd- """- function boolAnd(b1) {- return function(b2) {- return b1 && b2;- };- }- """ :: Boolean -> Boolean -> Boolean-- foreign import boolOr- """- function boolOr(b1) {- return function(b2) {- return b1 || b2;- };- }- """ :: Boolean -> Boolean -> Boolean-- foreign import boolNot- """- function boolNot(b) {- return !b;- }- """ :: Boolean -> Boolean-- instance boolLikeBoolean :: BoolLike Boolean where- (&&) = boolAnd- (||) = boolOr- not = boolNot-- infixr 5 <>-- -- | The `Semigroup` type class identifies an associative operation on a type.- -- |- -- | `Semigroup` instances are required to satisfy the following law:- -- |- -- | - Associativity: `(x <> y) <> z = x <> (y <> z)`- -- |- -- | For example, the `String` type is an instance of `Semigroup`, where `(<>)` is defined to be string concatenation.- class Semigroup a where- (<>) :: a -> a -> a-- foreign import concatString- """- function concatString(s1) {- return function(s2) {- return s1 + s2;- };- }- """ :: String -> String -> String-- instance semigroupUnit :: Semigroup Unit where- (<>) (Unit {}) (Unit {}) = Unit {}-- instance semigroupString :: Semigroup String where- (<>) = concatString-- instance semigroupArr :: (Semigroup s') => Semigroup (s -> s') where- (<>) f g = \x -> f x <> g x-- infixr 5 ++-- -- | `(++)` is an alias for `(<>)`.- (++) :: forall s. (Semigroup s) => s -> s -> s- (++) = (<>)--module Data.Function where-- -- | The `on` function is used to change the domain of a binary operator.- -- |- -- | For example, we can create a function which compares two records based on the values of their `x` properties:- -- |- -- | ```purescript- -- | compareX :: forall r. { x :: Number | r } -> { x :: Number | r } -> Ordering- -- | compareX = compare `on` _.x- -- | ```- on :: forall a b c. (b -> b -> c) -> (a -> b) -> a -> a -> c- on f g x y = g x `f` g y-- -- | A function of zero arguments- foreign import data Fn0 :: * -> *-- -- | A function of one argument- foreign import data Fn1 :: * -> * -> *-- -- | A function of two arguments- foreign import data Fn2 :: * -> * -> * -> *-- -- | A function of three arguments- foreign import data Fn3 :: * -> * -> * -> * -> *-- -- | A function of four arguments- foreign import data Fn4 :: * -> * -> * -> * -> * -> *-- -- | A function of five arguments- foreign import data Fn5 :: * -> * -> * -> * -> * -> * -> *-- -- | A function of six arguments- foreign import data Fn6 :: * -> * -> * -> * -> * -> * -> * -> *-- -- | A function of seven arguments- foreign import data Fn7 :: * -> * -> * -> * -> * -> * -> * -> * -> *-- -- | A function of eight arguments- foreign import data Fn8 :: * -> * -> * -> * -> * -> * -> * -> * -> * -> *-- -- | A function of nine arguments- foreign import data Fn9 :: * -> * -> * -> * -> * -> * -> * -> * -> * -> * -> *-- -- | A function of ten arguments- foreign import data Fn10 :: * -> * -> * -> * -> * -> * -> * -> * -> * -> * -> * -> *-- -- | Create a function of no arguments- foreign import mkFn0- """- function mkFn0(fn) {- return function() {- return fn({});- };- }- """ :: forall a. (Unit -> a) -> Fn0 a-- -- | Create a function of one argument- foreign import mkFn1- """- function mkFn1(fn) {- return function(a) {- return fn(a);- };- }- """ :: forall a b. (a -> b) -> Fn1 a b-- -- | Create a function of two arguments from a curried function- foreign import mkFn2- """- function mkFn2(fn) {- return function(a, b) {- return fn(a)(b);- };- }- """ :: forall a b c. (a -> b -> c) -> Fn2 a b c-- -- | Create a function of three arguments from a curried function- foreign import mkFn3- """- function mkFn3(fn) {- return function(a, b, c) {- return fn(a)(b)(c);- };- }- """ :: forall a b c d. (a -> b -> c -> d) -> Fn3 a b c d-- -- | Create a function of four arguments from a curried function- foreign import mkFn4- """- function mkFn4(fn) {- return function(a, b, c, d) {- return fn(a)(b)(c)(d);- };- }- """ :: forall a b c d e. (a -> b -> c -> d -> e) -> Fn4 a b c d e-- -- | Create a function of five arguments from a curried function- foreign import mkFn5- """- function mkFn5(fn) {- return function(a, b, c, d, e) {- return fn(a)(b)(c)(d)(e);- };- }- """ :: forall a b c d e f. (a -> b -> c -> d -> e -> f) -> Fn5 a b c d e f-- -- | Create a function of six arguments from a curried function- foreign import mkFn6- """- function mkFn6(fn) {- return function(a, b, c, d, e, f) {- return fn(a)(b)(c)(d)(e)(f);- };- }- """ :: forall a b c d e f g. (a -> b -> c -> d -> e -> f -> g) -> Fn6 a b c d e f g-- -- | Create a function of seven arguments from a curried function- foreign import mkFn7- """- function mkFn7(fn) {- return function(a, b, c, d, e, f, g) {- return fn(a)(b)(c)(d)(e)(f)(g);- };- }- """ :: forall a b c d e f g h. (a -> b -> c -> d -> e -> f -> g -> h) -> Fn7 a b c d e f g h-- -- | Create a function of eight arguments from a curried function- foreign import mkFn8- """- function mkFn8(fn) {- return function(a, b, c, d, e, f, g, h) {- return fn(a)(b)(c)(d)(e)(f)(g)(h);- };- }- """ :: forall a b c d e f g h i. (a -> b -> c -> d -> e -> f -> g -> h -> i) -> Fn8 a b c d e f g h i-- -- | Create a function of nine arguments from a curried function- foreign import mkFn9- """- function mkFn9(fn) {- return function(a, b, c, d, e, f, g, h, i) {- return fn(a)(b)(c)(d)(e)(f)(g)(h)(i);- };- }- """ :: forall a b c d e f g h i j. (a -> b -> c -> d -> e -> f -> g -> h -> i -> j) -> Fn9 a b c d e f g h i j-- -- | Create a function of ten arguments from a curried function- foreign import mkFn10- """- function mkFn10(fn) {- return function(a, b, c, d, e, f, g, h, i, j) {- return fn(a)(b)(c)(d)(e)(f)(g)(h)(i)(j);- };- }- """ :: forall a b c d e f g h i j k. (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k) -> Fn10 a b c d e f g h i j k-- -- | Apply a function of no arguments- foreign import runFn0- """- function runFn0(fn) {- return fn();- }- """ :: forall a. Fn0 a -> a-- -- | Apply a function of one argument- foreign import runFn1- """- function runFn1(fn) {- return function(a) {- return fn(a);- };- }- """ :: forall a b. Fn1 a b -> a -> b-- -- | Apply a function of two arguments- foreign import runFn2- """- function runFn2(fn) {- return function(a) {- return function(b) {- return fn(a, b);- };- };- }- """ :: forall a b c. Fn2 a b c -> a -> b -> c-- -- | Apply a function of three arguments- foreign import runFn3- """- function runFn3(fn) {- return function(a) {- return function(b) {- return function(c) {- return fn(a, b, c);- };- };- };- }- """ :: forall a b c d. Fn3 a b c d -> a -> b -> c -> d-- -- | Apply a function of four arguments- foreign import runFn4- """- function runFn4(fn) {- return function(a) {- return function(b) {- return function(c) {- return function(d) {- return fn(a, b, c, d);- };- };- };- };- }- """ :: forall a b c d e. Fn4 a b c d e -> a -> b -> c -> d -> e-- -- | Apply a function of five arguments- foreign import runFn5- """- function runFn5(fn) {- return function(a) {- return function(b) {- return function(c) {- return function(d) {- return function(e) {- return fn(a, b, c, d, e);- };- };- };- };- };- }- """ :: forall a b c d e f. Fn5 a b c d e f -> a -> b -> c -> d -> e -> f-- -- | Apply a function of six arguments- foreign import runFn6- """- function runFn6(fn) {- return function(a) {- return function(b) {- return function(c) {- return function(d) {- return function(e) {- return function(f) {- return fn(a, b, c, d, e, f);- };- };- };- };- };- };- }- """ :: forall a b c d e f g. Fn6 a b c d e f g -> a -> b -> c -> d -> e -> f -> g-- -- | Apply a function of seven arguments- foreign import runFn7- """- function runFn7(fn) {- return function(a) {- return function(b) {- return function(c) {- return function(d) {- return function(e) {- return function(f) {- return function(g) {- return fn(a, b, c, d, e, f, g);- };- };- };- };- };- };- };- }- """ :: forall a b c d e f g h. Fn7 a b c d e f g h -> a -> b -> c -> d -> e -> f -> g -> h-- -- | Apply a function of eight arguments- foreign import runFn8- """- function runFn8(fn) {- return function(a) {- return function(b) {- return function(c) {- return function(d) {- return function(e) {- return function(f) {- return function(g) {- return function(h) {- return fn(a, b, c, d, e, f, g, h);- };- };- };- };- };- };- };- };- }- """ :: forall a b c d e f g h i. Fn8 a b c d e f g h i -> a -> b -> c -> d -> e -> f -> g -> h -> i-- -- | Apply a function of nine arguments- foreign import runFn9- """- function runFn9(fn) {- return function(a) {- return function(b) {- return function(c) {- return function(d) {- return function(e) {- return function(f) {- return function(g) {- return function(h) {- return function(i) {- return fn(a, b, c, d, e, f, g, h, i);- };- };- };- };- };- };- };- };- };- }- """ :: forall a b c d e f g h i j. Fn9 a b c d e f g h i j -> a -> b -> c -> d -> e -> f -> g -> h -> i -> j-- -- | Apply a function of ten arguments- foreign import runFn10- """- function runFn10(fn) {- return function(a) {- return function(b) {- return function(c) {- return function(d) {- return function(e) {- return function(f) {- return function(g) {- return function(h) {- return function(i) {- return function(j) {- return fn(a, b, c, d, e, f, g, h, i, j);- };- };- };- };- };- };- };- };- };- };- }- """ :: forall a b c d e f g h i j k. Fn10 a b c d e f g h i j k -> a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k--module Prelude.Unsafe where-- -- | Find the element of an array at the specified index.- -- |- -- | Note: this function can cause unpredictable failure at runtime if the index is out-of-bounds.- foreign import unsafeIndex- """- function unsafeIndex(xs) {- return function(n) {- return xs[n];- };- }- """ :: forall a. [a] -> Number -> a--module Control.Monad.Eff- ( Eff()- , Pure()- , runPure- , untilE, whileE, forE, foreachE- ) where-- -- | The `Eff` type constructor is used to represent _native_ effects.- -- |- -- | See [Handling Native Effects with the Eff Monad](https://github.com/purescript/purescript/wiki/Handling-Native-Effects-with-the-Eff-Monad) for more details.- -- |- -- | The first type parameter is a row of effects which represents the contexts in which a computation can be run, and the second type parameter is the return type.- foreign import data Eff :: # ! -> * -> *-- foreign import returnE- """- function returnE(a) {- return function() {- return a;- };- }- """ :: forall e a. a -> Eff e a-- foreign import bindE- """- function bindE(a) {- return function(f) {- return function() {- return f(a())();- };- };- }- """ :: forall e a b. Eff e a -> (a -> Eff e b) -> Eff e b-- -- | The `Pure` type synonym represents _pure_ computations, i.e. ones in which all effects have been handled.- -- |- -- | The `runPure` function can be used to run pure computations and obtain their result.- type Pure a = forall e. Eff e a-- -- | Run a pure computation and return its result.- -- |- -- | Note: since this function has a rank-2 type, it may cause problems to apply this function using the `$` operator. The recommended approach- -- | is to use parentheses instead.- foreign import runPure- """- function runPure(f) {- return f();- }- """ :: forall a. Pure a -> a-- instance functorEff :: Functor (Eff e) where- (<$>) = liftA1-- instance applyEff :: Apply (Eff e) where- (<*>) = ap-- instance applicativeEff :: Applicative (Eff e) where- pure = returnE-- instance bindEff :: Bind (Eff e) where- (>>=) = bindE-- instance monadEff :: Monad (Eff e)-- -- | Loop until a condition becomes `true`.- -- |- -- | `untilE b` is an effectful computation which repeatedly runs the effectful computation `b`,- -- | until its return value is `true`.- foreign import untilE- """- function untilE(f) {- return function() {- while (!f());- return {};- };- }- """ :: forall e. Eff e Boolean -> Eff e Unit-- -- | Loop while a condition is `true`.- -- |- -- | `whileE b m` is effectful computation which runs the effectful computation `b`. If its result is- -- | `true`, it runs the effectful computation `m` and loops. If not, the computation ends.- foreign import whileE- """- function whileE(f) {- return function(a) {- return function() {- while (f()) {- a();- }- return {};- };- };- }- """ :: forall e a. Eff e Boolean -> Eff e a -> Eff e Unit-- -- | Loop over a consecutive collection of numbers.- -- |- -- | `forE lo hi f` runs the computation returned by the function `f` for each of the inputs- -- | between `lo` (inclusive) and `hi` (exclusive).- foreign import forE- """- function forE(lo) {- return function(hi) {- return function(f) {- return function() {- for (var i = lo; i < hi; i++) {- f(i)();- }- };- };- };- }- """ :: forall e. Number -> Number -> (Number -> Eff e Unit) -> Eff e Unit-- -- | Loop over an array of values.- -- |- -- | `foreach xs f` runs the computation returned by the function `f` for each of the inputs `xs`.- foreign import foreachE- """- function foreachE(as) {- return function(f) {- return function() {- for (var i = 0; i < as.length; i++) {- f(as[i])();- }- };- };- }- """ :: forall e a. [a] -> (a -> Eff e Unit) -> Eff e Unit--module Control.Monad.Eff.Unsafe where-- import Control.Monad.Eff-- -- | Change the type of an effectful computation, allowing it to be run in another context.- -- |- -- | Note: use of this function can result in arbitrary side-effects.- foreign import unsafeInterleaveEff- """- function unsafeInterleaveEff(f) {- return f;- }- """ :: forall eff1 eff2 a. Eff eff1 a -> Eff eff2 a--module Debug.Trace where-- import Control.Monad.Eff-- -- | The `Trace` effect represents those computations which write to the console.- foreign import data Trace :: !-- -- | Write a `String` to the console.- foreign import trace- """- function trace(s) {- return function() {- console.log(s);- return {};- };- }- """ :: forall r. String -> Eff (trace :: Trace | r) Unit-- -- | Write a value to the console, using its `Show` instance to produce a `String`.- print :: forall a r. (Show a) => a -> Eff (trace :: Trace | r) Unit- print o = trace (show o)--module Control.Monad.ST where-- import Control.Monad.Eff-- -- | The `ST` effect represents _local mutation_, i.e. mutation which does not "escape" into the surrounding computation.- -- |- -- | An `ST` computation is parameterized by a phantom type which is used to restrict the set of reference cells it is allowed to access.- -- |- -- | The `runST` function can be used to handle the `ST` effect.- foreign import data ST :: * -> !-- -- | The type `STRef s a` represents a mutable reference holding a value of type `a`, which can be used with the `ST s` effect.- foreign import data STRef :: * -> * -> *-- -- | Create a new mutable reference.- foreign import newSTRef- """- function newSTRef(val) {- return function() {- return { value: val };- };- }- """ :: forall a h r. a -> Eff (st :: ST h | r) (STRef h a)-- -- | Read the current value of a mutable reference.- foreign import readSTRef- """- function readSTRef(ref) {- return function() {- return ref.value;- };- }- """ :: forall a h r. STRef h a -> Eff (st :: ST h | r) a-- -- | Modify the value of a mutable reference by applying a function to the current value.- foreign import modifySTRef- """- function modifySTRef(ref) {- return function(f) {- return function() {- return ref.value = f(ref.value);- };- };- }- """ :: forall a h r. STRef h a -> (a -> a) -> Eff (st :: ST h | r) a-- -- | Set the value of a mutable reference.- foreign import writeSTRef- """- function writeSTRef(ref) {- return function(a) {- return function() {- return ref.value = a;- };- };- }- """ :: forall a h r. STRef h a -> a -> Eff (st :: ST h | r) a-- -- | Run an `ST` computation.- -- |- -- | Note: the type of `runST` uses a rank-2 type to constrain the phantom type `s`, such that the computation must not leak any mutable references- -- | to the surrounding computation.- -- |- -- | It may cause problems to apply this function using the `$` operator. The recommended approach is to use parentheses instead.- foreign import runST- """- function runST(f) {- return f;- }- """ :: forall a r. (forall h. Eff (st :: ST h | r) a) -> Eff r a-- -- | A convenience function which combines `runST` with `runPure`, which can be used when the only required effect is `ST`.- -- |- -- | Note: since this function has a rank-2 type, it may cause problems to apply this function using the `$` operator. The recommended approach- -- | is to use parentheses instead.- pureST :: forall a. (forall h r. Eff (st :: ST h | r) a) -> a- pureST st = runPure (runST st)
− psc-docs/Ctags.hs
@@ -1,13 +0,0 @@-module Ctags (dumpCtags) where--import qualified Language.PureScript as P-import Tags-import Data.List (sort)--dumpCtags :: [(String, P.Module)] -> [String]-dumpCtags = sort . concat . (map renderModCtags)--renderModCtags :: (String, P.Module) -> [String]-renderModCtags (path, mdl) = sort tagLines- where tagLines = map tagLine $ tags mdl- tagLine (name, line) = name ++ "\t" ++ path ++ "\t" ++ show line
− psc-docs/Etags.hs
@@ -1,15 +0,0 @@-module Etags (dumpEtags) where--import qualified Language.PureScript as P-import Tags--dumpEtags :: [(String, P.Module)] -> [String]-dumpEtags = concat . (map renderModEtags)--renderModEtags :: (String, P.Module) -> [String]-renderModEtags (path, mdl) = ["\x0c", path ++ "," ++ show tagsLen] ++ tagLines- where tagsLen = sum $ map length tagLines- tagLines = map tagLine $ tags mdl- tagLine (name, line) = "\x7f" ++ name ++ "\x01" ++ show line ++ ","--
− psc-docs/Main.hs
@@ -1,265 +0,0 @@----------------------------------------------------------------------------------- Module : Main--- Copyright : (c) Phil Freeman 2013--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ |-----------------------------------------------------------------------------------module Main where--import Control.Applicative-import Control.Monad-import Control.Monad.Writer-import Control.Arrow (first)-import Data.List-import Data.Maybe (fromMaybe)-import Data.Version (showVersion)-import Data.Foldable (traverse_)--import Options.Applicative--import qualified Language.PureScript as P-import qualified Paths_purescript as Paths-import System.Exit (exitSuccess, exitFailure)-import System.IO (hPutStrLn, stderr)--import Etags-import Ctags---- Available output formats-data Format = Markdown -- Output documentation in Markdown format- | Ctags -- Output ctags symbol index suitable for use with vi- | Etags -- Output etags symbol index suitable for use with emacs--data PSCDocsOptions = PSCDocsOptions- { pscdFormat :: Format- , pscdInputFiles :: [FilePath]- }--docgen :: PSCDocsOptions -> IO ()-docgen (PSCDocsOptions fmt input) = do- e <- P.parseModulesFromFiles (fromMaybe "") <$> mapM (fmap (first Just) . parseFile) (nub input)- case e of- Left err -> do- hPutStrLn stderr $ show err- exitFailure- Right ms -> do- case fmt of- Markdown -> putStrLn . runDocs $ renderModules (map snd ms)- Etags -> ldump $ dumpEtags $ pairs ms- Ctags -> ldump $ dumpCtags $ pairs ms- exitSuccess- where pairs :: [(Maybe String, m)] -> [(String, m)]- pairs = map (\(k,m) -> (fromMaybe "" k,m))- ldump :: [String] -> IO ()- ldump = mapM_ putStrLn- -parseFile :: FilePath -> IO (FilePath, String)-parseFile input = (,) input <$> readFile input--type Docs = Writer [String] ()--runDocs :: Docs -> String-runDocs = unlines . execWriter--spacer :: Docs-spacer = tell [""]--headerLevel :: Int -> String -> Docs-headerLevel level hdr = tell [replicate level '#' ++ ' ' : hdr]--withIndent :: Int -> Docs -> Docs-withIndent indent = censor (map (replicate indent ' ' ++ ))--atIndent :: Int -> String -> Docs-atIndent indent text =- let ls = lines text in- withIndent indent (tell ls)--fenced :: String -> Docs-fenced text = fencedBlock (tell $ lines text)--fencedBlock :: Docs -> Docs-fencedBlock inner = do- tell ["``` purescript"]- inner- tell ["```"]--ticks :: String -> String-ticks = ("`" ++) . (++ "`")--renderModules :: [P.Module] -> Docs-renderModules ms = do- headerLevel 1 "Module Documentation"- spacer- mapM_ renderModule ms--renderModule :: P.Module -> Docs-renderModule mdl@(P.Module coms moduleName _ exps) = do- headerLevel 2 $ "Module " ++ P.runModuleName moduleName- spacer- unless (null coms) $ do- renderComments coms- spacer- renderTopLevel exps (P.exportedDeclarations mdl)- spacer--renderTopLevel :: Maybe [P.DeclarationRef] -> [P.Declaration] -> Docs-renderTopLevel exps decls = forM_ decls $ \decl ->- when (canRenderDecl decl) $ do- traverse_ (headerLevel 4) (ticks `fmap` getDeclarationTitle decl)- spacer- renderDeclaration exps decl- spacer--renderTypeclassImage :: P.ModuleName -> Docs-renderTypeclassImage name =- let name' = P.runModuleName name- in tell [""]--getDeclarationTitle :: P.Declaration -> Maybe String-getDeclarationTitle (P.TypeDeclaration name _) = Just (show name)-getDeclarationTitle (P.ExternDeclaration _ name _ _) = Just (show name)-getDeclarationTitle (P.DataDeclaration _ name _ _) = Just (show name)-getDeclarationTitle (P.ExternDataDeclaration name _) = Just (show name)-getDeclarationTitle (P.TypeSynonymDeclaration name _ _) = Just (show name)-getDeclarationTitle (P.TypeClassDeclaration name _ _ _) = Just (show name)-getDeclarationTitle (P.TypeInstanceDeclaration name _ _ _ _) = Just (show name)-getDeclarationTitle (P.PositionedDeclaration _ _ d) = getDeclarationTitle d-getDeclarationTitle _ = Nothing--renderDeclaration :: Maybe [P.DeclarationRef] -> P.Declaration -> Docs-renderDeclaration _ (P.TypeDeclaration ident ty) =- fenced $ show ident ++ " :: " ++ prettyPrintType' ty-renderDeclaration _ (P.ExternDeclaration _ ident _ ty) =- fenced $ show ident ++ " :: " ++ prettyPrintType' ty-renderDeclaration exps (P.DataDeclaration dtype name args ctors) = do- let- typeApp = foldl P.TypeApp (P.TypeConstructor (P.Qualified Nothing name)) (map toTypeVar args)- typeName = prettyPrintType' typeApp- exported = filter (P.isDctorExported name exps . fst) ctors- fencedBlock $ do- tell [show dtype ++ " " ++ typeName]- zipWithM_ (\isFirst (ctor, tys) ->- atIndent 2 $ (if isFirst then "= " else "| ") ++ P.runProperName ctor ++ " " ++ unwords (map P.prettyPrintTypeAtom tys))- (True : repeat False) exported-renderDeclaration _ (P.ExternDataDeclaration name kind) =- fenced $ "data " ++ P.runProperName name ++ " :: " ++ P.prettyPrintKind kind-renderDeclaration _ (P.TypeSynonymDeclaration name args ty) = do- let- typeApp = foldl P.TypeApp (P.TypeConstructor (P.Qualified Nothing name)) (map toTypeVar args)- typeName = prettyPrintType' typeApp- fenced $ "type " ++ typeName ++ " = " ++ prettyPrintType' ty-renderDeclaration _ (P.TypeClassDeclaration name args implies ds) = do- let impliesText = case implies of- [] -> ""- is -> "(" ++ intercalate ", " (map (\(pn, tys') -> show pn ++ " " ++ unwords (map P.prettyPrintTypeAtom tys')) is) ++ ") <= "- classApp = foldl P.TypeApp (P.TypeConstructor (P.Qualified Nothing name)) (map toTypeVar args)- className = prettyPrintType' classApp- fencedBlock $ do- tell ["class " ++ impliesText ++ className ++ " where"]- mapM_ renderClassMember ds- where- renderClassMember (P.PositionedDeclaration _ _ d) = renderClassMember d- renderClassMember (P.TypeDeclaration ident ty) = atIndent 2 $ show ident ++ " :: " ++ prettyPrintType' ty- renderClassMember _ = error "Invalid argument to renderClassMember."-renderDeclaration _ (P.TypeInstanceDeclaration name constraints className tys _) = do- let constraintsText = case constraints of- [] -> ""- cs -> "(" ++ intercalate ", " (map (\(pn, tys') -> show pn ++ " " ++ unwords (map P.prettyPrintTypeAtom tys')) cs) ++ ") => "- fenced $ "instance " ++ show name ++ " :: " ++ constraintsText ++ show className ++ " " ++ unwords (map P.prettyPrintTypeAtom tys)-renderDeclaration exps (P.PositionedDeclaration _ com d) = do- renderDeclaration exps d- renderComments com-renderDeclaration _ _ = return ()--renderComments :: [P.Comment] -> Docs-renderComments cs = do- let raw = concatMap toLines cs- when (all hasPipe raw) $ do- spacer- atIndent 0 . unlines . map stripPipes $ raw- where-- toLines (P.LineComment s) = [s]- toLines (P.BlockComment s) = lines s-- hasPipe s = case dropWhile (== ' ') s of { ('|':_) -> True; _ -> False }-- stripPipes = dropPipe . dropWhile (== ' ')-- dropPipe ('|':' ':s) = s- dropPipe ('|':s) = s- dropPipe s = s--toTypeVar :: (String, Maybe P.Kind) -> P.Type-toTypeVar (s, Nothing) = P.TypeVar s-toTypeVar (s, Just k) = P.KindedType (P.TypeVar s) k--prettyPrintType' :: P.Type -> String-prettyPrintType' = P.prettyPrintType . P.everywhereOnTypes dePrim- where- dePrim ty@(P.TypeConstructor (P.Qualified _ name))- | ty == P.tyBoolean || ty == P.tyNumber || ty == P.tyString =- P.TypeConstructor $ P.Qualified Nothing name- dePrim other = other--getName :: P.Declaration -> String-getName (P.TypeDeclaration ident _) = show ident-getName (P.ExternDeclaration _ ident _ _) = show ident-getName (P.DataDeclaration _ name _ _) = P.runProperName name-getName (P.ExternDataDeclaration name _) = P.runProperName name-getName (P.TypeSynonymDeclaration name _ _) = P.runProperName name-getName (P.TypeClassDeclaration name _ _ _) = P.runProperName name-getName (P.TypeInstanceDeclaration name _ _ _ _) = show name-getName (P.PositionedDeclaration _ _ d) = getName d-getName _ = error "Invalid argument to getName"--canRenderDecl :: P.Declaration -> Bool-canRenderDecl P.TypeDeclaration{} = True-canRenderDecl P.ExternDeclaration{} = True-canRenderDecl P.DataDeclaration{} = True-canRenderDecl P.ExternDataDeclaration{} = True-canRenderDecl P.TypeSynonymDeclaration{} = True-canRenderDecl P.TypeClassDeclaration{} = True-canRenderDecl P.TypeInstanceDeclaration{} = True-canRenderDecl (P.PositionedDeclaration _ _ d) = canRenderDecl d-canRenderDecl _ = False--inputFile :: Parser FilePath-inputFile = strArgument $- metavar "FILE"- <> help "The input .purs file(s)"--instance Read Format where- readsPrec _ "etags" = [(Etags, "")]- readsPrec _ "ctags" = [(Ctags, "")]- readsPrec _ "markdown" = [(Markdown, "")]- readsPrec _ _ = [] --format :: Parser Format-format = option auto $ value Markdown- <> long "format"- <> metavar "FORMAT"- <> help "Set output FORMAT (markdown | etags | ctags)" --pscDocsOptions :: Parser PSCDocsOptions-pscDocsOptions = PSCDocsOptions <$> format <*> many inputFile--main :: IO ()-main = execParser opts >>= docgen- where- opts = info (version <*> helper <*> pscDocsOptions) infoModList- infoModList = fullDesc <> headerInfo <> footerInfo- headerInfo = header "psc-docs - Generate Markdown documentation from PureScript extern files"- footerInfo = footer $ "psc-docs " ++ showVersion Paths.version-- version :: Parser (a -> a)- version = abortOption (InfoMsg (showVersion Paths.version)) $ long "version" <> help "Show the version number" <> hidden
− psc-docs/Tags.hs
@@ -1,18 +0,0 @@-module Tags where--import qualified Language.PureScript as P--tags :: P.Module -> [(String, Int)]-tags = concatMap dtags . P.exportedDeclarations- where dtags (P.PositionedDeclaration sp _ d) = map tag $ names d- where tag name = (name, line)- line = P.sourcePosLine $ P.spanStart sp- dtags _ = []- names (P.DataDeclaration _ name _ dcons) = P.runProperName name : consNames- where consNames = map (\(cname, _) -> P.runProperName cname) dcons- names (P.TypeDeclaration ident _) = [show ident]- names (P.ExternDeclaration _ ident _ _) = [show ident]- names (P.TypeSynonymDeclaration name _ _) = [P.runProperName name]- names (P.TypeClassDeclaration name _ _ _) = [P.runProperName name]- names (P.TypeInstanceDeclaration name _ _ _ _) = [show name]- names _ = []
− psc-make/Main.hs
@@ -1,177 +0,0 @@------------------------------------------------------------------------------------ Module : Main--- Copyright : (c) Phil Freeman 2013--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ |-----------------------------------------------------------------------------------{-# LANGUAGE DataKinds, GeneralizedNewtypeDeriving, TupleSections, RecordWildCards #-}--module Main where--import Control.Applicative-import Control.Monad.Except-import Control.Monad.Reader--import Data.Version (showVersion)-import Data.Traversable (traverse)--import Options.Applicative as Opts--import System.Directory- (doesFileExist, getModificationTime, createDirectoryIfMissing)-import System.FilePath (takeDirectory)-import System.Exit (exitSuccess, exitFailure)-import System.IO.Error (tryIOError)--import qualified Language.PureScript as P-import qualified Paths_purescript as Paths---data PSCMakeOptions = PSCMakeOptions- { pscmInput :: [FilePath]- , pscmOutputDir :: FilePath- , pscmOpts :: P.Options P.Make- , pscmUsePrefix :: Bool- }--data InputOptions = InputOptions- { ioNoPrelude :: Bool- , ioInputFiles :: [FilePath]- }--readInput :: InputOptions -> IO [(Either P.RebuildPolicy FilePath, String)]-readInput InputOptions{..} = do- content <- forM ioInputFiles $ \inFile -> (Right inFile, ) <$> readFile inFile- return (if ioNoPrelude then content else (Left P.RebuildNever, P.prelude) : content)--newtype Make a = Make { unMake :: ReaderT (P.Options P.Make) (ExceptT String IO) a }- deriving (Functor, Applicative, Monad, MonadIO, MonadError String, MonadReader (P.Options P.Make))--runMake :: P.Options P.Make -> Make a -> IO (Either String a)-runMake opts = runExceptT . flip runReaderT opts . unMake--makeIO :: IO a -> Make a-makeIO = Make . lift . ExceptT . fmap (either (Left . show) Right) . tryIOError--instance P.MonadMake Make where- getTimestamp path = makeIO $ do- exists <- doesFileExist path- traverse (const $ getModificationTime path) $ guard exists- readTextFile path = makeIO $ do- putStrLn $ "Reading " ++ path- readFile path- writeTextFile path text = makeIO $ do- mkdirp path- putStrLn $ "Writing " ++ path- writeFile path text- progress = makeIO . putStrLn--compile :: PSCMakeOptions -> IO ()-compile (PSCMakeOptions input outputDir opts usePrefix) = do- modules <- P.parseModulesFromFiles (either (const "") id) <$> readInput (InputOptions (P.optionsNoPrelude opts) input)- case modules of- Left err -> do- print err- exitFailure- Right ms -> do- e <- runMake opts $ P.make outputDir ms prefix- case e of- Left err -> do- putStrLn err- exitFailure- Right _ -> do- exitSuccess- where- prefix = if usePrefix- then ["Generated by psc-make version " ++ showVersion Paths.version]- else []--mkdirp :: FilePath -> IO ()-mkdirp = createDirectoryIfMissing True . takeDirectory--inputFile :: Parser FilePath-inputFile = strArgument $- metavar "FILE"- <> help "The input .purs file(s)"--outputDirectory :: Parser FilePath-outputDirectory = strOption $- short 'o'- <> long "output"- <> Opts.value "output"- <> showDefault- <> help "The output directory"--noTco :: Parser Bool-noTco = switch $- long "no-tco"- <> help "Disable tail call optimizations"--noPrelude :: Parser Bool-noPrelude = switch $- long "no-prelude"- <> help "Omit the Prelude"--noMagicDo :: Parser Bool-noMagicDo = switch $- long "no-magic-do"- <> help "Disable the optimization that overloads the do keyword to generate efficient code specifically for the Eff monad."--noOpts :: Parser Bool-noOpts = switch $- long "no-opts"- <> help "Skip the optimization phase."--comments :: Parser Bool-comments = switch $- short 'c'- <> long "comments"- <> help "Include comments in the generated code."--verboseErrors :: Parser Bool-verboseErrors = switch $- short 'v'- <> long "verbose-errors"- <> help "Display verbose error messages"--noPrefix :: Parser Bool-noPrefix = switch $- short 'p'- <> long "no-prefix"- <> help "Do not include comment header"---options :: Parser (P.Options P.Make)-options = P.Options <$> noPrelude- <*> noTco- <*> noMagicDo- <*> pure Nothing- <*> noOpts- <*> verboseErrors- <*> (not <$> comments)- <*> pure P.MakeOptions--pscMakeOptions :: Parser PSCMakeOptions-pscMakeOptions = PSCMakeOptions <$> many inputFile- <*> outputDirectory- <*> options- <*> (not <$> noPrefix)--main :: IO ()-main = execParser opts >>= compile- where- opts = info (version <*> helper <*> pscMakeOptions) infoModList- infoModList = fullDesc <> headerInfo <> footerInfo- headerInfo = header "psc-make - Compiles PureScript to Javascript"- footerInfo = footer $ "psc-make " ++ showVersion Paths.version-- version :: Parser (a -> a)- version = abortOption (InfoMsg (showVersion Paths.version)) $ long "version" <> help "Show the version number" <> hidden
− psc/Main.hs
@@ -1,209 +0,0 @@------------------------------------------------------------------------------------ Module : Main--- Copyright : (c) Phil Freeman 2013--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ |-----------------------------------------------------------------------------------{-# LANGUAGE DataKinds, GeneralizedNewtypeDeriving, TupleSections, RecordWildCards #-}--module Main where--import Control.Applicative-import Control.Monad.Except-import Control.Monad.Reader--import Data.Maybe (fromMaybe)-import Data.Version (showVersion)--import Options.Applicative as Opts-import System.Directory (createDirectoryIfMissing)-import System.FilePath (takeDirectory)-import System.Exit (exitSuccess, exitFailure)-import System.IO (hPutStrLn, stderr)--import qualified Language.PureScript as P-import qualified Paths_purescript as Paths---data PSCOptions = PSCOptions- { pscInput :: [FilePath]- , pscOpts :: P.Options P.Compile- , pscStdIn :: Bool- , pscOutput :: Maybe FilePath- , pscExterns :: Maybe FilePath- , pscUsePrefix :: Bool- }--data InputOptions = InputOptions- { ioNoPrelude :: Bool- , ioUseStdIn :: Bool- , ioInputFiles :: [FilePath]- }--readInput :: InputOptions -> IO [(Maybe FilePath, String)]-readInput InputOptions{..}- | ioUseStdIn = return . (Nothing ,) <$> getContents- | otherwise = do content <- forM ioInputFiles $ \inFile -> (Just inFile, ) <$> readFile inFile- return (if ioNoPrelude then content else (Nothing, P.prelude) : content)--compile :: PSCOptions -> IO ()-compile (PSCOptions input opts stdin output externs usePrefix) = do- modules <- P.parseModulesFromFiles (fromMaybe "") <$> readInput (InputOptions (P.optionsNoPrelude opts) stdin input)- case modules of- Left err -> do- hPutStrLn stderr $ show err- exitFailure- Right ms -> do- case P.compile (map snd ms) prefix `runReaderT` opts of- Left err -> do- hPutStrLn stderr err- exitFailure- Right (js, exts, _) -> do- case output of- Just path -> mkdirp path >> writeFile path js- Nothing -> putStrLn js- case externs of- Just path -> mkdirp path >> writeFile path exts- Nothing -> return ()- exitSuccess- where- prefix = if usePrefix- then ["Generated by psc version " ++ showVersion Paths.version]- else []--mkdirp :: FilePath -> IO ()-mkdirp = createDirectoryIfMissing True . takeDirectory--codeGenModule :: Parser String-codeGenModule = strOption $- long "codegen"- <> help "A list of modules for which Javascript and externs should be generated. This argument can be used multiple times."--dceModule :: Parser String-dceModule = strOption $- short 'm'- <> long "module"- <> help "Enables dead code elimination, all code which is not a transitive dependency of a specified module will be removed. This argument can be used multiple times."--browserNamespace :: Parser String-browserNamespace = strOption $- long "browser-namespace"- <> Opts.value "PS"- <> showDefault- <> help "Specify the namespace that PureScript modules will be exported to when running in the browser."--verboseErrors :: Parser Bool-verboseErrors = switch $- short 'v'- <> long "verbose-errors"- <> help "Display verbose error messages"--noOpts :: Parser Bool-noOpts = switch $- long "no-opts"- <> help "Skip the optimization phase."--runMain :: Parser (Maybe String)-runMain = optional $ noArgs <|> withArgs- where- defaultVal = "Main"- noArgs = flag' defaultVal (long "main")- withArgs = strOption $- long "main"- <> help (concat [- "Generate code to run the main method in the specified module. ",- "(no argument: \"", defaultVal, "\")"- ])--noMagicDo :: Parser Bool-noMagicDo = switch $- long "no-magic-do"- <> help "Disable the optimization that overloads the do keyword to generate efficient code specifically for the Eff monad."--noTco :: Parser Bool-noTco = switch $- long "no-tco"- <> help "Disable tail call optimizations"--noPrelude :: Parser Bool-noPrelude = switch $- long "no-prelude"- <> help "Omit the Prelude"--comments :: Parser Bool-comments = switch $- short 'c'- <> long "comments"- <> help "Include comments in the generated code."--useStdIn :: Parser Bool-useStdIn = switch $- short 's'- <> long "stdin"- <> help "Read from standard input"--inputFile :: Parser FilePath-inputFile = strArgument $- metavar "FILE"- <> help "The input .purs file(s)"--outputFile :: Parser (Maybe FilePath)-outputFile = optional . strOption $- short 'o'- <> long "output"- <> help "The output .js file"--externsFile :: Parser (Maybe FilePath)-externsFile = optional . strOption $- short 'e'- <> long "externs"- <> help "The output .e.purs file"--noPrefix :: Parser Bool-noPrefix = switch $- short 'p'- <> long "no-prefix"- <> help "Do not include comment header"--options :: Parser (P.Options P.Compile)-options = P.Options <$> noPrelude- <*> noTco- <*> noMagicDo- <*> runMain- <*> noOpts- <*> verboseErrors- <*> (not <$> comments)- <*> additionalOptions- where- additionalOptions =- P.CompileOptions <$> browserNamespace- <*> many dceModule- <*> many codeGenModule--pscOptions :: Parser PSCOptions-pscOptions = PSCOptions <$> many inputFile- <*> options- <*> useStdIn- <*> outputFile- <*> externsFile- <*> (not <$> noPrefix)--main :: IO ()-main = execParser opts >>= compile- where- opts = info (version <*> helper <*> pscOptions) infoModList- infoModList = fullDesc <> headerInfo <> footerInfo- headerInfo = header "psc - Compiles PureScript to Javascript"- footerInfo = footer $ "psc " ++ showVersion Paths.version-- version :: Parser (a -> a)- version = abortOption (InfoMsg (showVersion Paths.version)) $ long "version" <> help "Show the version number" <> hidden-
− psci/Commands.hs
@@ -1,78 +0,0 @@------------------------------------------------------------------------------------ Module : Commands--- Copyright : (c) Phil Freeman 2014--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ |--- Commands for PSCI.-----------------------------------------------------------------------------------module Commands where--import Language.PureScript---- |--- Valid Meta-commands for PSCI----data Command- -- |- -- A purescript expression- --- = Expression Expr- -- |- -- Show the help command- --- | Help- -- |- -- Import a module from a loaded file- --- | Import ImportedModule- -- |- -- Browse a module- --- | Browse ModuleName- -- |- -- Load a file for use with importing- --- | LoadFile FilePath- -- |- -- Exit PSCI- --- | Quit- -- |- -- Reset the state of the REPL- --- | Reset- -- |- -- Add some declarations to the current evaluation context.- --- | Decls [Declaration]- -- |- -- Find the type of an expression- --- | TypeOf Expr- -- |- -- Find the kind of an expression- --- | KindOf Type- -- |- -- Show command- --- | Show String---- | All of the data that is contained by an ImportDeclaration in the AST.--- That is:------ * A module name, the name of the module which is being imported--- * An ImportDeclarationType which specifies whether there is an explicit--- import list, a hiding list, or neither.--- * If the module is imported qualified, its qualified name in the importing--- module. Otherwise, Nothing.----type ImportedModule = (ModuleName, ImportDeclarationType, Maybe ModuleName)
− psci/Directive.hs
@@ -1,79 +0,0 @@------------------------------------------------------------------------------------ Module : Directive--- Copyright :--- License : MIT------ Maintainer :--- Stability : experimental--- Portability :------ |--- Directives for PSCI.-----------------------------------------------------------------------------------module Directive where--import Data.List (nub, isPrefixOf)--data Directive- = Help- | Quit- | Reset- | Browse- | Load- | Type- | Kind- | Show- deriving Eq---- |--- Maps given directive to relating command strings.----commands :: Directive -> [String]-commands Help = ["?", "help"]-commands Quit = ["quit"]-commands Reset = ["reset"]-commands Browse = ["browse"]-commands Load = ["load", "module"]-commands Type = ["type"]-commands Kind = ["kind"]-commands Show = ["show"]---- |--- Tries to parse given string into a directive.----parseDirective :: String -> Maybe Directive-parseDirective cmd =- case filter (matches . snd) mapping of- [directive] -> Just $ fst directive- _ -> Nothing- where- mapping :: [(Directive, [String])]- mapping = zip directives (map commands directives)-- matches :: [String] -> Bool- matches = any (cmd `isPrefixOf`)---- |--- The help menu.----help :: [(Directive, String, String)]-help =- [ (Help, "", "Show this help menu")- , (Quit, "", "Quit PSCi")- , (Reset, "", "Reset")- , (Browse, "<module>", "Browse <module>")- , (Load, "<file>", "Load <file> for importing")- , (Type, "<expr>", "Show the type of <expr>")- , (Kind, "<type>", "Show the kind of <type>")- , (Show, "import", "Show imported modules")- , (Show, "loaded", "Show loaded modules")- ]---- |--- List of all avaliable directives.----directives :: [Directive]-directives = nub . map (\(dir, _, _) -> dir) $ help
− psci/Main.hs
@@ -1,702 +0,0 @@------------------------------------------------------------------------------------ Module : Main--- Copyright : (c) Phil Freeman 2013--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ |--- PureScript Compiler Interactive.-----------------------------------------------------------------------------------{-# LANGUAGE DataKinds #-}-{-# LANGUAGE DoAndIfThenElse #-}-{-# LANGUAGE FlexibleContexts #-}-{-# LANGUAGE GeneralizedNewtypeDeriving #-}-{-# LANGUAGE RecordWildCards #-}--module Main where--import Data.Foldable (traverse_)-import Data.List (intercalate, isPrefixOf, nub, sortBy, sort)-import Data.Maybe (mapMaybe)-import Data.Traversable (traverse)-import Data.Version (showVersion)-import Data.Char (isSpace)-import qualified Data.Map as M--import Control.Applicative-import Control.Monad-import Control.Monad.Except (ExceptT(..), MonadError, runExceptT)-import Control.Monad.Reader (MonadReader, ReaderT, runReaderT)-import Control.Monad.Trans.Class-import Control.Monad.Trans.Maybe (MaybeT(..), runMaybeT)-import Control.Monad.Trans.State.Strict-import qualified Control.Monad.Trans.State.Lazy as L--import Options.Applicative as Opts--import System.Console.Haskeline-import System.Directory (createDirectoryIfMissing, getModificationTime, doesFileExist, findExecutable, getHomeDirectory, getCurrentDirectory)-import System.Exit-import System.FilePath (pathSeparator, takeDirectory, (</>), isPathSeparator)-import System.IO.Error (tryIOError)-import System.Process (readProcessWithExitCode)--import qualified Text.Parsec as Par (ParseError)--import qualified Language.PureScript as P-import qualified Language.PureScript.AST as D-import qualified Language.PureScript.Names as N-import qualified Paths_purescript as Paths--import qualified Commands as C-import qualified Directive as D-import Parser--data PSCiOptions = PSCiOptions- { psciMultiLineMode :: Bool- , psciInputFile :: [FilePath]- , psciInputNodeFlags :: [String]- }---- |--- The PSCI state.--- Holds a list of imported modules, loaded files, and partial let bindings.--- The let bindings are partial,--- because it makes more sense to apply the binding to the final evaluated expression.----data PSCiState = PSCiState- { psciImportedFilenames :: [FilePath]- , psciImportedModules :: [C.ImportedModule]- , psciLoadedModules :: [(Either P.RebuildPolicy FilePath, P.Module)]- , psciLetBindings :: [P.Declaration]- , psciNodeFlags :: [String]- }--psciImportedModuleNames :: PSCiState -> [P.ModuleName]-psciImportedModuleNames (PSCiState{psciImportedModules = is}) =- map (\(mn, _, _) -> mn) is---- State helpers---- |--- Updates the state to have more imported modules.----updateImportedFiles :: FilePath -> PSCiState -> PSCiState-updateImportedFiles filename st = st { psciImportedFilenames = filename : psciImportedFilenames st }---- |--- Updates the state to have more imported modules.----updateImportedModules :: C.ImportedModule -> PSCiState -> PSCiState-updateImportedModules im st = st { psciImportedModules = im : psciImportedModules st }---- |--- Updates the state to have more loaded files.----updateModules :: [(Either P.RebuildPolicy FilePath, P.Module)] -> PSCiState -> PSCiState-updateModules modules st = st { psciLoadedModules = psciLoadedModules st ++ modules }---- |--- Updates the state to have more let bindings.----updateLets :: [P.Declaration] -> PSCiState -> PSCiState-updateLets ds st = st { psciLetBindings = psciLetBindings st ++ ds }---- File helpers--- |--- Load the necessary modules.----defaultImports :: [C.ImportedModule]-defaultImports = [(P.ModuleName [P.ProperName "Prelude"], D.Implicit, Nothing)]---- |--- Locates the node executable.--- Checks for either @nodejs@ or @node@.----findNodeProcess :: IO (Maybe String)-findNodeProcess = runMaybeT . msum $ map (MaybeT . findExecutable) names- where names = ["nodejs", "node"]---- |--- Grabs the filename where the history is stored.----getHistoryFilename :: IO FilePath-getHistoryFilename = do- home <- getHomeDirectory- let filename = home </> ".purescript" </> "psci_history"- mkdirp filename- return filename---- |--- Loads a file for use with imports.----loadModule :: FilePath -> IO (Either String [P.Module])-loadModule filename = do- content <- readFile filename- return $ either (Left . show) (Right . map snd) $ P.parseModulesFromFiles id [(filename, content)]---- |--- Load all modules, including the Prelude----loadAllModules :: [FilePath] -> IO (Either Par.ParseError [(Either P.RebuildPolicy FilePath, P.Module)])-loadAllModules files = do- filesAndContent <- forM files $ \filename -> do- content <- readFile filename- return (Right filename, content)- return $ P.parseModulesFromFiles (either (const "") id) $ (Left P.RebuildNever, P.prelude) : filesAndContent---- |--- Load all modules, updating the application state----loadAllImportedModules :: PSCI ()-loadAllImportedModules = do- files <- PSCI . lift $ fmap psciImportedFilenames get- modulesOrFirstError <- psciIO $ loadAllModules files- case modulesOrFirstError of- Left err -> psciIO $ print err- Right modules -> PSCI . lift . modify $ \st -> st { psciLoadedModules = modules }---- |--- Expands tilde in path.----expandTilde :: FilePath -> IO FilePath-expandTilde ('~':p:rest) | isPathSeparator p = (</> rest) <$> getHomeDirectory-expandTilde p = return p--- Messages---- |--- The help message.----helpMessage :: String-helpMessage = "The following commands are available:\n\n " ++- intercalate "\n " (map line D.help)- where- line :: (D.Directive, String, String) -> String- line (dir, arg, desc) = intercalate " "- [ cmd- , replicate (11 - length cmd) ' '- , arg- , replicate (11 - length arg) ' '- , desc- ]- where cmd = ":" ++ head (D.commands dir)---- |--- The welcome prologue.----prologueMessage :: String-prologueMessage = intercalate "\n"- [ " ____ ____ _ _ "- , "| _ \\ _ _ _ __ ___/ ___| ___ _ __(_)_ __ | |_ "- , "| |_) | | | | '__/ _ \\___ \\ / __| '__| | '_ \\| __|"- , "| __/| |_| | | | __/___) | (__| | | | |_) | |_ "- , "|_| \\__,_|_| \\___|____/ \\___|_| |_| .__/ \\__|"- , " |_| "- , ""- , ":? shows help"- ]---- |--- The quit message.----quitMessage :: String-quitMessage = "See ya!"---- Haskeline completions--data CompletionContext = Command String | FilePath String | Module | Identifier- | Type | Fixed [String] | Multiple [CompletionContext]- deriving (Show)---- |--- Decide what kind of completion we need based on input.-completionContext :: String -> String -> Maybe CompletionContext-completionContext cmd@"" _ = Just $ Multiple [Command cmd, Identifier]-completionContext (':' : cmd) word =- case D.parseDirective dstr of- Just directive | dstr `elem` D.commands directive -> context directive- _ -> Just $ Command cmd- where- dstr :: String- dstr = takeWhile (not . isSpace) cmd-- context :: D.Directive -> Maybe CompletionContext- context D.Browse = Just Module- context D.Load = Just $ FilePath word- context D.Quit = Nothing- context D.Reset = Nothing- context D.Help = Nothing- context D.Show = Just $ Fixed ["import", "loaded"]- context D.Type = Just Identifier- context D.Kind = Just Type-completionContext _ _ = Just Identifier---- |--- Loads module, function, and file completions.----completion :: CompletionFunc (StateT PSCiState IO)-completion = completeWordWithPrev Nothing " \t\n\r" findCompletions- where- findCompletions :: String -> String -> StateT PSCiState IO [Completion]- findCompletions prev word = do- let ctx = completionContext ((dropWhile isSpace (reverse prev)) ++ word) word- completions <- case ctx of- Nothing -> return []- (Just c) -> (mapMaybe $ either (\cand -> if word `isPrefixOf` cand- then Just $ simpleCompletion cand- else Nothing) Just)- <$> getCompletion c- return $ sortBy sorter completions-- getCompletion :: CompletionContext -> StateT PSCiState IO [Either String Completion]- getCompletion (FilePath f) = (map Right) <$> listFiles f- getCompletion Module = (map Left) <$> getModuleNames- getCompletion Identifier = (map Left) <$> ((++) <$> getIdentNames <*> getDctorNames)- getCompletion Type = (map Left) <$> getTypeNames- getCompletion (Fixed list) = return $ (map Left) list- getCompletion (Multiple contexts) = concat <$> mapM getCompletion contexts- getCompletion (Command cmd) = return . map (Left . (":" ++)) . nub $ matching- where- matching :: [String]- matching = filter (isPrefixOf cmd) . concatMap (D.commands) $ D.directives-- getLoadedModules :: StateT PSCiState IO [P.Module]- getLoadedModules = map snd . psciLoadedModules <$> get-- getModuleNames :: StateT PSCiState IO [String]- getModuleNames = moduleNames <$> getLoadedModules-- mapLoadedModulesAndQualify :: (Show a) => (P.Module -> [a]) -> StateT PSCiState IO [String]- mapLoadedModulesAndQualify f = do- ms <- getLoadedModules- q <- sequence [qualifyIfNeeded m (f m) | m <- ms]- return $ concat q-- getIdentNames :: StateT PSCiState IO [String]- getIdentNames = mapLoadedModulesAndQualify identNames-- getDctorNames :: StateT PSCiState IO [String]- getDctorNames = mapLoadedModulesAndQualify dctorNames-- getTypeNames :: StateT PSCiState IO [String]- getTypeNames = mapLoadedModulesAndQualify typeDecls-- qualifyIfNeeded :: (Show a) => P.Module -> [a] -> StateT PSCiState IO [String]- qualifyIfNeeded m decls = do- let name = P.getModuleName m- imported <- psciImportedModuleNames <$> get- let qualified = map (P.Qualified $ Just name) decls- if name `elem` imported then- return $ map show $ qualified ++ (map (P.Qualified Nothing) decls)- else- return $ map show qualified-- typeDecls :: P.Module -> [N.ProperName]- typeDecls m = mapMaybe getTypeName $ filter P.isDataDecl (P.exportedDeclarations m)- where getTypeName :: P.Declaration -> Maybe N.ProperName- getTypeName (P.TypeSynonymDeclaration name _ _) = Just name- getTypeName (P.DataDeclaration _ name _ _) = Just name- getTypeName (P.PositionedDeclaration _ _ d) = getTypeName d- getTypeName _ = Nothing-- identNames :: P.Module -> [N.Ident]- identNames (P.Module _ _ ds exports) = nub [ ident | ident <- mapMaybe (getDeclName exports) (D.flattenDecls ds) ]- where getDeclName :: Maybe [P.DeclarationRef] -> P.Declaration -> Maybe P.Ident- getDeclName exts decl@(P.ValueDeclaration ident _ _ _) | P.isExported exts decl = Just ident- getDeclName exts decl@(P.ExternDeclaration _ ident _ _) | P.isExported exts decl = Just ident- getDeclName exts (P.PositionedDeclaration _ _ d) = getDeclName exts d- getDeclName _ _ = Nothing-- dctorNames :: P.Module -> [N.ProperName]- dctorNames m = nub $ concat $ map (P.exportedDctors m) dnames- where getDataDeclName :: P.Declaration -> Maybe N.ProperName- getDataDeclName (P.DataDeclaration _ name _ _) = Just name- getDataDeclName (P.PositionedDeclaration _ _ d) = getDataDeclName d- getDataDeclName _ = Nothing-- dnames :: [N.ProperName]- dnames = (mapMaybe getDataDeclName onlyDataDecls)-- onlyDataDecls :: [P.Declaration]- onlyDataDecls = (filter P.isDataDecl (P.exportedDeclarations m))-- moduleNames :: [P.Module] -> [String]- moduleNames ms = nub [show moduleName | P.Module _ moduleName _ _ <- ms]-- sorter :: Completion -> Completion -> Ordering- sorter (Completion _ d1 _) (Completion _ d2 _) = if ":" `isPrefixOf` d1 then LT else compare d1 d2---- Compilation---- | Compilation options.----options :: P.Options P.Make-options = P.Options False False False Nothing False False False P.MakeOptions---- |--- PSCI monad----newtype PSCI a = PSCI { runPSCI :: InputT (StateT PSCiState IO) a } deriving (Functor, Applicative, Monad)--psciIO :: IO a -> PSCI a-psciIO io = PSCI . lift $ lift io--newtype Make a = Make { unMake :: ReaderT (P.Options P.Make) (ExceptT String IO) a }- deriving (Functor, Applicative, Monad, MonadError String, MonadReader (P.Options P.Make))--runMake :: Make a -> IO (Either String a)-runMake = runExceptT . flip runReaderT options . unMake--makeIO :: IO a -> Make a-makeIO = Make . lift . ExceptT . fmap (either (Left . show) Right) . tryIOError--instance P.MonadMake Make where- getTimestamp path = makeIO $ do- exists <- doesFileExist path- traverse (const $ getModificationTime path) $ guard exists- readTextFile path = makeIO $ readFile path- writeTextFile path text = makeIO $ do- mkdirp path- writeFile path text- progress s = unless (s == "Compiling $PSCI") $ makeIO . putStrLn $ s--mkdirp :: FilePath -> IO ()-mkdirp = createDirectoryIfMissing True . takeDirectory---- |--- Makes a volatile module to execute the current expression.----createTemporaryModule :: Bool -> PSCiState -> P.Expr -> P.Module-createTemporaryModule exec PSCiState{psciImportedModules = imports, psciLetBindings = lets} val =- let- moduleName = P.ModuleName [P.ProperName "$PSCI"]- traceModule = P.ModuleName [P.ProperName "Debug", P.ProperName "Trace"]- trace = P.Var (P.Qualified (Just traceModule) (P.Ident "print"))- mainValue = P.App trace (P.Var (P.Qualified Nothing (P.Ident "it")))- itDecl = P.ValueDeclaration (P.Ident "it") P.Value [] $ Right val- mainDecl = P.ValueDeclaration (P.Ident "main") P.Value [] $ Right mainValue- decls = if exec then [itDecl, mainDecl] else [itDecl]- in- P.Module [] moduleName ((importDecl `map` imports) ++ lets ++ decls) Nothing----- |--- Makes a volatile module to hold a non-qualified type synonym for a fully-qualified data type declaration.----createTemporaryModuleForKind :: PSCiState -> P.Type -> P.Module-createTemporaryModuleForKind PSCiState{psciImportedModules = imports} typ =- let- moduleName = P.ModuleName [P.ProperName "$PSCI"]- itDecl = P.TypeSynonymDeclaration (P.ProperName "IT") [] typ- in- P.Module [] moduleName ((importDecl `map` imports) ++ [itDecl]) Nothing---- |--- Makes a volatile module to execute the current imports.----createTemporaryModuleForImports :: PSCiState -> P.Module-createTemporaryModuleForImports PSCiState{psciImportedModules = imports} =- let- moduleName = P.ModuleName [P.ProperName "$PSCI"]- in- P.Module [] moduleName (importDecl `map` imports) Nothing--importDecl :: C.ImportedModule -> P.Declaration-importDecl (mn, declType, asQ) = P.ImportDeclaration mn declType asQ--modulesDir :: FilePath-modulesDir = ".psci_modules" ++ pathSeparator : "node_modules"--indexFile :: FilePath-indexFile = ".psci_modules" ++ pathSeparator : "index.js"---- |--- Takes a value declaration and evaluates it with the current state.----handleDeclaration :: P.Expr -> PSCI ()-handleDeclaration val = do- st <- PSCI $ lift get- let m = createTemporaryModule True st val- let nodeArgs = psciNodeFlags st ++ [indexFile]- e <- psciIO . runMake $ P.make modulesDir (psciLoadedModules st ++ [(Left P.RebuildAlways, m)]) []- case e of- Left err -> PSCI $ outputStrLn err- Right _ -> do- psciIO $ writeFile indexFile "require('$PSCI').main();"- process <- psciIO findNodeProcess- result <- psciIO $ traverse (\node -> readProcessWithExitCode node nodeArgs "") process- case result of- Just (ExitSuccess, out, _) -> PSCI $ outputStrLn out- Just (ExitFailure _, _, err) -> PSCI $ outputStrLn err- Nothing -> PSCI $ outputStrLn "Couldn't find node.js"---- |--- Takes a list of declarations and updates the environment, then run a make. If the declaration fails,--- restore the original environment.----handleDecls :: [P.Declaration] -> PSCI ()-handleDecls ds = do- st <- PSCI $ lift get- let st' = updateLets ds st- let m = createTemporaryModule False st' (P.ObjectLiteral [])- e <- psciIO . runMake $ P.make modulesDir (psciLoadedModules st' ++ [(Left P.RebuildAlways, m)]) []- case e of- Left err -> PSCI $ outputStrLn err- Right _ -> PSCI $ lift (put st')---- |--- Show actual loaded modules in psci.----handleShowLoadedModules :: PSCI ()-handleShowLoadedModules = do- PSCiState { psciLoadedModules = loadedModules } <- PSCI $ lift get- psciIO $ readModules loadedModules >>= putStrLn- return ()- where readModules = return . unlines . sort . nub . map toModuleName- toModuleName = N.runModuleName . (\ (D.Module _ mdName _ _) -> mdName) . snd---- |--- Show the imported modules in psci.----handleShowImportedModules :: PSCI ()-handleShowImportedModules = do- PSCiState { psciImportedModules = importedModules } <- PSCI $ lift get- psciIO $ showModules importedModules >>= putStrLn- return ()- where- showModules = return . unlines . sort . map showModule- showModule (mn, declType, asQ) =- "import " ++ case asQ of- Just mn' -> "qualified " ++ N.runModuleName mn ++ " as " ++ N.runModuleName mn'- Nothing -> N.runModuleName mn ++ " " ++ showDeclType declType-- showDeclType D.Implicit = ""- showDeclType (D.Explicit refs) = refsList refs- showDeclType (D.Hiding refs) = "hiding " ++ refsList refs- refsList refs = "(" ++ commaList (map showRef refs) ++ ")"-- showRef :: P.DeclarationRef -> String- showRef (D.TypeRef pn dctors) = show pn ++ "(" ++ maybe ".." (commaList . map N.runProperName) dctors ++ ")"- showRef (D.ValueRef ident) = show ident- showRef (D.TypeClassRef pn) = show pn- showRef (D.TypeInstanceRef ident) = show ident- showRef (D.PositionedDeclarationRef _ _ ref) = showRef ref-- commaList :: [String] -> String- commaList = intercalate ", "---- |--- Imports a module, preserving the initial state on failure.----handleImport :: C.ImportedModule -> PSCI ()-handleImport im = do- st <- updateImportedModules im <$> PSCI (lift get)- let m = createTemporaryModuleForImports st- e <- psciIO . runMake $ P.make modulesDir (psciLoadedModules st ++ [(Left P.RebuildAlways, m)]) []- case e of- Left err -> PSCI $ outputStrLn err- Right _ -> do- PSCI $ lift $ put st- return ()---- |--- Takes a value and prints its type----handleTypeOf :: P.Expr -> PSCI ()-handleTypeOf val = do- st <- PSCI $ lift get- let m = createTemporaryModule False st val- e <- psciIO . runMake $ P.make modulesDir (psciLoadedModules st ++ [(Left P.RebuildAlways, m)]) []- case e of- Left err -> PSCI $ outputStrLn err- Right env' ->- case M.lookup (P.ModuleName [P.ProperName "$PSCI"], P.Ident "it") (P.names env') of- Just (ty, _, _) -> PSCI . outputStrLn . P.prettyPrintType $ ty- Nothing -> PSCI $ outputStrLn "Could not find type"---- |--- Pretty print a module's signatures----printModuleSignatures :: P.ModuleName -> P.Environment -> PSCI ()-printModuleSignatures moduleName env =- PSCI $ let namesEnv = P.names env- moduleNamesIdent = (filter ((== moduleName) . fst) . M.keys) namesEnv- in case moduleNamesIdent of- [] -> outputStrLn $ "This module '"++ P.runModuleName moduleName ++"' does not export functions."- _ -> ( outputStrLn- . unlines- . sort- . map (showType . findType namesEnv)) moduleNamesIdent- where findType :: M.Map (P.ModuleName, P.Ident) (P.Type, P.NameKind, P.NameVisibility) -> (P.ModuleName, P.Ident) -> (P.Ident, Maybe (P.Type, P.NameKind, P.NameVisibility))- findType envNames m@(_, mIdent) = (mIdent, M.lookup m envNames)- showType :: (P.Ident, Maybe (P.Type, P.NameKind, P.NameVisibility)) -> String- showType (mIdent, Just (mType, _, _)) = show mIdent ++ " :: " ++ P.prettyPrintType mType- showType _ = error "The impossible happened in printModuleSignatures."---- |--- Browse a module and displays its signature (if module exists).----handleBrowse :: P.ModuleName -> PSCI ()-handleBrowse moduleName = do- st <- PSCI $ lift get- let loadedModules = psciLoadedModules st- env <- psciIO . runMake $ P.make modulesDir loadedModules []- case env of- Left err -> PSCI $ outputStrLn err- Right env' ->- if moduleName `notElem` (nub . map ((\ (P.Module _ modName _ _ ) -> modName) . snd)) loadedModules- then PSCI $ outputStrLn $ "Module '" ++ N.runModuleName moduleName ++ "' is not valid."- else printModuleSignatures moduleName env'---- |--- Takes a value and prints its kind----handleKindOf :: P.Type -> PSCI ()-handleKindOf typ = do- st <- PSCI $ lift get- let m = createTemporaryModuleForKind st typ- mName = P.ModuleName [P.ProperName "$PSCI"]- e <- psciIO . runMake $ P.make modulesDir (psciLoadedModules st ++ [(Left P.RebuildAlways, m)]) []- case e of- Left err -> PSCI $ outputStrLn err- Right env' ->- case M.lookup (P.Qualified (Just mName) $ P.ProperName "IT") (P.typeSynonyms env') of- Just (_, typ') -> do- let chk = P.CheckState env' 0 0 (Just mName)- k = L.runStateT (P.unCheck (P.kindOf mName typ')) chk- case k of- Left errStack -> PSCI . outputStrLn . P.prettyPrintMultipleErrors False $ errStack- Right (kind, _) -> PSCI . outputStrLn . P.prettyPrintKind $ kind- Nothing -> PSCI $ outputStrLn "Could not find kind"---- Commands---- |--- Parses the input and returns either a Metacommand or an expression.----getCommand :: Bool -> InputT (StateT PSCiState IO) (Either String (Maybe C.Command))-getCommand singleLineMode = do- firstLine <- getInputLine "> "- case firstLine of- Nothing -> return (Right Nothing)- Just "" -> return (Right Nothing)- Just s | singleLineMode || head s == ':' -> return . either Left (Right . Just) $ parseCommand s- Just s -> either Left (Right . Just) . parseCommand <$> go [s]- where- go :: [String] -> InputT (StateT PSCiState IO) String- go ls = maybe (return . unlines $ reverse ls) (go . (:ls)) =<< getInputLine " "---- |--- Performs an action for each meta-command given, and also for expressions..----handleCommand :: C.Command -> PSCI ()-handleCommand (C.Expression val) = handleDeclaration val-handleCommand C.Help = PSCI $ outputStrLn helpMessage-handleCommand (C.Import im) = handleImport im-handleCommand (C.Decls l) = handleDecls l-handleCommand (C.LoadFile filePath) = do- absPath <- psciIO $ expandTilde filePath- exists <- psciIO $ doesFileExist absPath- if exists then do- PSCI . lift $ modify (updateImportedFiles absPath)- m <- psciIO $ loadModule absPath- case m of- Left err -> PSCI $ outputStrLn err- Right mods -> PSCI . lift $ modify (updateModules (map ((,) (Right absPath)) mods))- else- PSCI . outputStrLn $ "Couldn't locate: " ++ filePath-handleCommand C.Reset = do- files <- psciImportedFilenames <$> PSCI (lift get)- PSCI . lift . modify $ \st -> st- { psciImportedFilenames = files- , psciImportedModules = defaultImports- , psciLetBindings = []- }- loadAllImportedModules-handleCommand (C.TypeOf val) = handleTypeOf val-handleCommand (C.KindOf typ) = handleKindOf typ-handleCommand (C.Browse moduleName) = handleBrowse moduleName-handleCommand (C.Show "loaded") = handleShowLoadedModules-handleCommand (C.Show "import") = handleShowImportedModules-handleCommand _ = PSCI $ outputStrLn "Unknown command"--loadUserConfig :: IO (Maybe [C.Command])-loadUserConfig = do- configFile <- (</> ".psci") <$> getCurrentDirectory- exists <- doesFileExist configFile- if exists- then do- ls <- lines <$> readFile configFile- case mapM parseCommand ls of- Left err -> print err >> exitFailure- Right cs -> return $ Just cs- else- return Nothing---- |--- The PSCI main loop.----loop :: PSCiOptions -> IO ()-loop PSCiOptions{..} = do- config <- loadUserConfig- modulesOrFirstError <- loadAllModules psciInputFile- case modulesOrFirstError of- Left err -> print err >> exitFailure- Right modules -> do- historyFilename <- getHistoryFilename- let settings = defaultSettings { historyFile = Just historyFilename }- flip evalStateT (PSCiState psciInputFile defaultImports modules [] psciInputNodeFlags) . runInputT (setComplete completion settings) $ do- outputStrLn prologueMessage- traverse_ (mapM_ (runPSCI . handleCommand)) config- go- where- go :: InputT (StateT PSCiState IO) ()- go = do- c <- getCommand (not psciMultiLineMode)- case c of- Left err -> outputStrLn err >> go- Right Nothing -> go- Right (Just C.Quit) -> outputStrLn quitMessage- Right (Just c') -> runPSCI (loadAllImportedModules >> handleCommand c') >> go--multiLineMode :: Parser Bool-multiLineMode = switch $- long "multi-line-mode"- <> short 'm'- <> Opts.help "Run in multi-line mode (use ^D to terminate commands)"--inputFile :: Parser FilePath-inputFile = strArgument $- metavar "FILE"- <> Opts.help "Optional .purs files to load on start"--nodeFlagsFlag :: Parser [String]-nodeFlagsFlag = option parser $- long "node-opts"- <> metavar "NODE_OPTS"- <> value []- <> Opts.help "Flags to pass to node, separated by spaces"- where- parser = words <$> str--psciOptions :: Parser PSCiOptions-psciOptions = PSCiOptions <$> multiLineMode- <*> many inputFile- <*> nodeFlagsFlag--main :: IO ()-main = execParser opts >>= loop- where- opts = info (version <*> helper <*> psciOptions) infoModList- infoModList = fullDesc <> headerInfo <> footerInfo- headerInfo = header "psci - Interactive mode for PureScript"- footerInfo = footer $ "psci " ++ showVersion Paths.version-- version :: Parser (a -> a)- version = abortOption (InfoMsg (showVersion Paths.version)) $ long "version" <> Opts.help "Show the version number" <> hidden
− psci/Parser.hs
@@ -1,125 +0,0 @@------------------------------------------------------------------------------------ Module : Parser--- Copyright : (c) Phil Freeman 2014--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ |--- Parser for PSCI.-----------------------------------------------------------------------------------module Parser- ( parseCommand- ) where--import Prelude hiding (lex)--import qualified Commands as C-import qualified Directive as D--import Data.Char (isSpace)--import Control.Applicative hiding (many)--import Text.Parsec hiding ((<|>))--import qualified Language.PureScript as P-import qualified Language.PureScript.Parser.Common as C (mark, same)---- |--- Parses PSCI metacommands or expressions input from the user.----parseCommand :: String -> Either String C.Command-parseCommand cmdString =- case cmdString of- (':' : cmd) -> parseDirective cmd- _ -> parseRest psciCommand cmdString--parseRest :: P.TokenParser a -> String -> Either String a-parseRest p s = either (Left . show) Right $ do- ts <- P.lex "" s- P.runTokenParser "" (p <* eof) ts--psciCommand :: P.TokenParser C.Command-psciCommand = choice (map try parsers)- where- parsers =- [ psciLet- , psciImport- , psciOtherDeclaration- , psciExpression- ]--trim :: String -> String-trim = trimEnd . trimStart--trimStart :: String -> String-trimStart = dropWhile isSpace--trimEnd :: String -> String-trimEnd = reverse . trimStart . reverse--parseDirective :: String -> Either String C.Command-parseDirective cmd =- case D.parseDirective dstr of- Just D.Help -> return C.Help- Just D.Quit -> return C.Quit- Just D.Reset -> return C.Reset- Just D.Browse -> C.Browse <$> parseRest P.moduleName arg- Just D.Load -> return $ C.LoadFile (trim arg)- Just D.Show -> return $ C.Show (trim arg)- Just D.Type -> C.TypeOf <$> parseRest P.parseValue arg- Just D.Kind -> C.KindOf <$> parseRest P.parseType arg- Nothing -> Left $ "Unrecognized command. Type :? for help."- where (dstr, arg) = break isSpace cmd---- |--- Parses expressions entered at the PSCI repl.----psciExpression :: P.TokenParser C.Command-psciExpression = C.Expression <$> P.parseValue---- |--- PSCI version of @let@.--- This is essentially let from do-notation.--- However, since we don't support the @Eff@ monad,--- we actually want the normal @let@.----psciLet :: P.TokenParser C.Command-psciLet = C.Decls <$> (P.reserved "let" *> P.indented *> manyDecls)- where- manyDecls :: P.TokenParser [P.Declaration]- manyDecls = C.mark (many1 (C.same *> P.parseLocalDeclaration))---- | Imports must be handled separately from other declarations, so that--- :show import works, for example.-psciImport :: P.TokenParser C.Command-psciImport = C.Import <$> P.parseImportDeclaration'---- | Any other declaration that we don't need a 'special case' parser for--- (like let or import declarations).-psciOtherDeclaration :: P.TokenParser C.Command-psciOtherDeclaration = C.Decls . (:[]) <$> do- decl <- discardPositionInfo <$> P.parseDeclaration- if acceptable decl- then return decl- else fail "this kind of declaration is not supported in psci"--discardPositionInfo :: P.Declaration -> P.Declaration-discardPositionInfo (P.PositionedDeclaration _ _ d) = d-discardPositionInfo d = d--acceptable :: P.Declaration -> Bool-acceptable (P.DataDeclaration _ _ _ _) = True-acceptable (P.TypeSynonymDeclaration _ _ _) = True-acceptable (P.ExternDeclaration _ _ _ _) = True-acceptable (P.ExternDataDeclaration _ _) = True-acceptable (P.ExternInstanceDeclaration _ _ _ _) = True-acceptable (P.TypeClassDeclaration _ _ _ _) = True-acceptable (P.TypeInstanceDeclaration _ _ _ _ _) = True-acceptable _ = False
purescript.cabal view
@@ -1,184 +1,562 @@-name: purescript-version: 0.6.9.5-cabal-version: >=1.8-build-type: Simple-license: MIT-license-file: LICENSE-copyright: (c) 2013-14 Phil Freeman, (c) 2014 Gary Burgess, and other contributors-maintainer: Phil Freeman <paf31@cantab.net>-stability: experimental-synopsis: PureScript Programming Language Compiler-description: A small strongly, statically typed programming language with expressive types, inspired by Haskell and compiling to Javascript.-category: Language-Homepage: http://www.purescript.org/-author: Phil Freeman <paf31@cantab.net>,- Gary Burgess <gary.burgess@gmail.com>,- Hardy Jones <jones3.hardy@gmail.com>+cabal-version: 2.4+name: purescript+version: 0.15.15+license: BSD-3-Clause+license-file: LICENSE+copyright:+ (c) 2013-17 Phil Freeman, (c) 2014-19 Gary Burgess, (c) other contributors (see CONTRIBUTORS.md) -extra-source-files: prelude/prelude.purs- , examples/passing/*.purs- , examples/failing/*.purs+maintainer:+ Gary Burgess <gary.burgess@gmail.com>, Hardy Jones <jones3.hardy@gmail.com>, Harry Garrood <harry@garrood.me>, Christoph Hegemann <christoph.hegemann1337@gmail.com>, Liam Goodacre <goodacre.liam@gmail.com>, Nathan Faubion <nathan@n-son.com> +author: Phil Freeman <paf31@cantab.net>+stability: experimental+homepage: http://www.purescript.org/+bug-reports: https://github.com/purescript/purescript/issues+synopsis: PureScript Programming Language Compiler+description:+ A small strongly, statically typed programming language with expressive types, inspired by Haskell and compiling to JavaScript.++category: Language+build-type: Simple+extra-source-files:+ app/static/*.css+ app/static/*.less+ bundle/build.sh+ bundle/README+ tests/purs/**/*.js+ tests/purs/**/*.js.map+ tests/purs/**/*.purs+ tests/purs/**/*.json+ tests/purs/**/*.out+ tests/json-compat/**/*.json+ tests/support/*.json+ tests/support/checkSourceMapValidity.js+ tests/support/psci/**/*.purs+ tests/support/psci/**/*.edit+ tests/support/pscide/src/**/*.purs+ tests/support/pscide/src/**/*.js+ tests/support/pscide/src/**/*.fail+ stack.yaml+ README.md+ INSTALL.md+ CONTRIBUTORS.md+ CONTRIBUTING.md+ VERSIONING_POLICY.md+ .hspec+ source-repository head- type: git- location: https://github.com/purescript/purescript.git+ type: git+ location: https://github.com/purescript/purescript -library- build-depends: base >=4.6 && <5,- containers -any,- unordered-containers -any,- directory >= 1.2,- filepath -any,- mtl >= 2.1.0 && < 2.3.0,- parsec -any,- transformers >= 0.4.0 && < 0.5,- utf8-string >= 1 && < 2,- pattern-arrows >= 0.0.2 && < 0.1,- file-embed >= 0.0.7 && < 0.0.8,- time -any,- boxes >= 0.1.4 && < 0.2.0- exposed-modules: Language.PureScript- Language.PureScript.AST- Language.PureScript.AST.Binders- Language.PureScript.AST.Declarations- Language.PureScript.AST.Operators- Language.PureScript.AST.SourcePos- Language.PureScript.AST.Traversals- Language.PureScript.CodeGen- Language.PureScript.CodeGen.Externs- Language.PureScript.CodeGen.JS- Language.PureScript.CodeGen.JS.AST- Language.PureScript.CodeGen.JS.Common- Language.PureScript.CodeGen.JS.Optimizer- Language.PureScript.CodeGen.JS.Optimizer.Blocks- Language.PureScript.CodeGen.JS.Optimizer.Common- Language.PureScript.CodeGen.JS.Optimizer.Inliner- Language.PureScript.CodeGen.JS.Optimizer.MagicDo- Language.PureScript.CodeGen.JS.Optimizer.TCO- Language.PureScript.CodeGen.JS.Optimizer.Unused- Language.PureScript.Constants- Language.PureScript.CoreFn- Language.PureScript.CoreFn.Ann- Language.PureScript.CoreFn.Binders- Language.PureScript.CoreFn.Desugar- Language.PureScript.CoreFn.Expr- Language.PureScript.CoreFn.Literals- Language.PureScript.CoreFn.Meta- Language.PureScript.CoreFn.Module- Language.PureScript.CoreFn.Traversals- Language.PureScript.Comments- Language.PureScript.DeadCodeElimination- Language.PureScript.Environment- Language.PureScript.Errors- Language.PureScript.Kinds- Language.PureScript.ModuleDependencies- Language.PureScript.Names- Language.PureScript.Options- Language.PureScript.Parser- Language.PureScript.Parser.Lexer- Language.PureScript.Parser.Common- Language.PureScript.Parser.Declarations- Language.PureScript.Parser.Kinds- Language.PureScript.Parser.State- Language.PureScript.Parser.Types- Language.PureScript.Pretty- Language.PureScript.Pretty.Common- Language.PureScript.Pretty.JS- Language.PureScript.Pretty.Kinds- Language.PureScript.Pretty.Types- Language.PureScript.Pretty.Values- Language.PureScript.Renamer- Language.PureScript.Sugar- Language.PureScript.Sugar.BindingGroups- Language.PureScript.Sugar.CaseDeclarations- Language.PureScript.Sugar.DoNotation- Language.PureScript.Sugar.Names- Language.PureScript.Sugar.ObjectWildcards- Language.PureScript.Sugar.Operators- Language.PureScript.Sugar.TypeClasses- Language.PureScript.Sugar.TypeDeclarations- Language.PureScript.Traversals- Language.PureScript.TypeChecker- Language.PureScript.TypeChecker.Entailment- Language.PureScript.TypeChecker.Kinds- Language.PureScript.TypeChecker.Monad- Language.PureScript.TypeChecker.Rows- Language.PureScript.TypeChecker.Skolems- Language.PureScript.TypeChecker.Subsumption- Language.PureScript.TypeChecker.Synonyms- Language.PureScript.TypeChecker.Types- Language.PureScript.TypeChecker.Unify- Language.PureScript.TypeClassDictionaries- Language.PureScript.Types+flag release+ description:+ Mark this build as a release build: prevents inclusion of extra info e.g. commit SHA in --version output) - Control.Monad.Unify- Control.Monad.Supply- Control.Monad.Supply.Class- exposed: True- buildable: True- hs-source-dirs: src- other-modules: Paths_purescript- ghc-options: -Wall -O2+ default: False -executable psc- build-depends: base >=4 && <5, containers -any, directory -any, filepath -any,- mtl -any, optparse-applicative >= 0.10.0, parsec -any, purescript -any,- transformers -any- main-is: Main.hs- buildable: True- hs-source-dirs: psc- other-modules:- ghc-options: -Wall -O2 -fno-warn-unused-do-bind+library+ exposed-modules:+ Control.Monad.Logger+ Control.Monad.Supply+ Control.Monad.Supply.Class+ Language.PureScript+ Language.PureScript.AST+ Language.PureScript.AST.Binders+ Language.PureScript.AST.Declarations+ Language.PureScript.AST.Declarations.ChainId+ Language.PureScript.AST.Exported+ Language.PureScript.AST.Literals+ Language.PureScript.AST.Operators+ Language.PureScript.AST.SourcePos+ Language.PureScript.AST.Traversals+ Language.PureScript.AST.Utils+ Language.PureScript.Bundle+ Language.PureScript.CodeGen+ Language.PureScript.CodeGen.JS+ Language.PureScript.CodeGen.JS.Common+ Language.PureScript.CodeGen.JS.Printer+ Language.PureScript.Constants.Libs+ Language.PureScript.CoreFn+ Language.PureScript.CoreFn.Ann+ Language.PureScript.CoreFn.Binders+ Language.PureScript.CoreFn.CSE+ Language.PureScript.CoreFn.Desugar+ Language.PureScript.CoreFn.Expr+ Language.PureScript.CoreFn.FromJSON+ Language.PureScript.CoreFn.Laziness+ Language.PureScript.CoreFn.Meta+ Language.PureScript.CoreFn.Module+ Language.PureScript.CoreFn.Optimizer+ Language.PureScript.CoreFn.ToJSON+ Language.PureScript.CoreFn.Traversals+ Language.PureScript.CoreImp+ Language.PureScript.CoreImp.AST+ Language.PureScript.CoreImp.Module+ Language.PureScript.CoreImp.Optimizer+ Language.PureScript.CoreImp.Optimizer.Blocks+ Language.PureScript.CoreImp.Optimizer.Common+ Language.PureScript.CoreImp.Optimizer.Inliner+ Language.PureScript.CoreImp.Optimizer.MagicDo+ Language.PureScript.CoreImp.Optimizer.TCO+ Language.PureScript.CoreImp.Optimizer.Unused+ Language.PureScript.CST+ Language.PureScript.CST.Convert+ Language.PureScript.CST.Errors+ Language.PureScript.CST.Flatten+ Language.PureScript.CST.Layout+ Language.PureScript.CST.Lexer+ Language.PureScript.CST.Monad+ Language.PureScript.CST.Parser+ Language.PureScript.CST.Positions+ Language.PureScript.CST.Print+ Language.PureScript.CST.Traversals+ Language.PureScript.CST.Traversals.Type+ Language.PureScript.CST.Types+ Language.PureScript.CST.Utils+ Language.PureScript.Comments+ Language.PureScript.Constants.Prim+ Language.PureScript.Crash+ Language.PureScript.Docs+ Language.PureScript.Docs.AsHtml+ Language.PureScript.Docs.AsMarkdown+ Language.PureScript.Docs.Collect+ Language.PureScript.Docs.Convert+ Language.PureScript.Docs.Convert.ReExports+ Language.PureScript.Docs.Convert.Single+ Language.PureScript.Docs.Css+ Language.PureScript.Docs.Prim+ Language.PureScript.Docs.Render+ Language.PureScript.Docs.RenderedCode+ Language.PureScript.Docs.RenderedCode.RenderType+ Language.PureScript.Docs.RenderedCode.Types+ Language.PureScript.Docs.Tags+ Language.PureScript.Docs.Types+ Language.PureScript.Docs.Utils.MonoidExtras+ Language.PureScript.Environment+ Language.PureScript.Errors+ Language.PureScript.Errors.JSON+ Language.PureScript.Externs+ Language.PureScript.Glob+ Language.PureScript.Graph+ Language.PureScript.Hierarchy+ Language.PureScript.Ide+ Language.PureScript.Ide.CaseSplit+ Language.PureScript.Ide.Command+ Language.PureScript.Ide.Completion+ Language.PureScript.Ide.Error+ Language.PureScript.Ide.Externs+ Language.PureScript.Ide.Filter+ Language.PureScript.Ide.Filter.Declaration+ Language.PureScript.Ide.Filter.Imports+ Language.PureScript.Ide.Imports+ Language.PureScript.Ide.Imports.Actions+ Language.PureScript.Ide.Logging+ Language.PureScript.Ide.Matcher+ Language.PureScript.Ide.Prim+ Language.PureScript.Ide.Rebuild+ Language.PureScript.Ide.Reexports+ Language.PureScript.Ide.SourceFile+ Language.PureScript.Ide.State+ Language.PureScript.Ide.Types+ Language.PureScript.Ide.Usage+ Language.PureScript.Ide.Util+ Language.PureScript.Interactive+ Language.PureScript.Interactive.Completion+ Language.PureScript.Interactive.Directive+ Language.PureScript.Interactive.IO+ Language.PureScript.Interactive.Message+ Language.PureScript.Interactive.Module+ Language.PureScript.Interactive.Parser+ Language.PureScript.Interactive.Printer+ Language.PureScript.Interactive.Types+ Language.PureScript.Label+ Language.PureScript.Linter+ Language.PureScript.Linter.Exhaustive+ Language.PureScript.Linter.Imports+ Language.PureScript.Linter.Wildcards+ Language.PureScript.Make+ Language.PureScript.Make.Actions+ Language.PureScript.Make.BuildPlan+ Language.PureScript.Make.Cache+ Language.PureScript.Make.Monad+ Language.PureScript.ModuleDependencies+ Language.PureScript.Names+ Language.PureScript.Options+ Language.PureScript.Pretty+ Language.PureScript.Pretty.Common+ Language.PureScript.Pretty.Types+ Language.PureScript.Pretty.Values+ Language.PureScript.PSString+ Language.PureScript.Publish+ Language.PureScript.Publish.BoxesHelpers+ Language.PureScript.Publish.ErrorsWarnings+ Language.PureScript.Publish.Registry.Compat+ Language.PureScript.Publish.Utils+ Language.PureScript.Renamer+ Language.PureScript.Roles+ Language.PureScript.Sugar+ Language.PureScript.Sugar.AdoNotation+ Language.PureScript.Sugar.BindingGroups+ Language.PureScript.Sugar.CaseDeclarations+ Language.PureScript.Sugar.DoNotation+ Language.PureScript.Sugar.LetPattern+ Language.PureScript.Sugar.Names+ Language.PureScript.Sugar.Names.Common+ Language.PureScript.Sugar.Names.Env+ Language.PureScript.Sugar.Names.Exports+ Language.PureScript.Sugar.Names.Imports+ Language.PureScript.Sugar.ObjectWildcards+ Language.PureScript.Sugar.Operators+ Language.PureScript.Sugar.Operators.Binders+ Language.PureScript.Sugar.Operators.Common+ Language.PureScript.Sugar.Operators.Expr+ Language.PureScript.Sugar.Operators.Types+ Language.PureScript.Sugar.TypeClasses+ Language.PureScript.Sugar.TypeClasses.Deriving+ Language.PureScript.Sugar.TypeDeclarations+ Language.PureScript.Traversals+ Language.PureScript.TypeChecker+ Language.PureScript.TypeChecker.Deriving+ Language.PureScript.TypeChecker.Entailment+ Language.PureScript.TypeChecker.Entailment.Coercible+ Language.PureScript.TypeChecker.Entailment.IntCompare+ Language.PureScript.TypeChecker.Kinds+ Language.PureScript.TypeChecker.Monad+ Language.PureScript.TypeChecker.Roles+ Language.PureScript.TypeChecker.Skolems+ Language.PureScript.TypeChecker.Subsumption+ Language.PureScript.TypeChecker.Synonyms+ Language.PureScript.TypeChecker.Types+ Language.PureScript.TypeChecker.TypeSearch+ Language.PureScript.TypeChecker.Unify+ Language.PureScript.TypeClassDictionaries+ Language.PureScript.Types+ System.IO.UTF8 -executable psc-make- build-depends: base >=4 && <5, containers -any, directory -any, filepath -any,- mtl -any, optparse-applicative >= 0.10.0, parsec -any, purescript -any,- transformers -any- main-is: Main.hs- buildable: True- hs-source-dirs: psc-make+ build-tool-depends: happy:happy ==1.20.0+ hs-source-dirs: src other-modules:- ghc-options: -Wall -O2 -fno-warn-unused-do-bind+ Data.Text.PureScript+ Language.PureScript.Constants.TH+ Paths_purescript -executable psci- build-depends: base >=4 && <5, containers -any, directory -any, filepath -any,- mtl -any, optparse-applicative >= 0.10.0, parsec -any,- haskeline >= 0.7.0.0, purescript -any, transformers -any,- process -any+ autogen-modules: Paths_purescript+ default-language: Haskell2010+ default-extensions:+ BangPatterns ConstraintKinds DataKinds DefaultSignatures+ DeriveFunctor DeriveFoldable DeriveTraversable DeriveGeneric+ DerivingStrategies DerivingVia EmptyDataDecls FlexibleContexts+ FlexibleInstances GeneralizedNewtypeDeriving ImportQualifiedPost+ KindSignatures LambdaCase MultiParamTypeClasses NamedFieldPuns+ NoImplicitPrelude PatternGuards PatternSynonyms RankNTypes+ RecordWildCards OverloadedRecordDot OverloadedStrings+ ScopedTypeVariables TupleSections TypeFamilies ViewPatterns - main-is: Main.hs- buildable: True- hs-source-dirs: psci- other-modules: Commands- Parser- Directive- ghc-options: -Wall -O2+ ghc-options:+ -Weverything -Wno-missing-exported-signatures+ -Wno-missing-import-lists -Wno-missed-specialisations+ -Wno-all-missed-specialisations -Wno-unsafe -Wno-safe+ -Wno-trustworthy-safe -Wno-inferred-safe-imports+ -Wno-missing-safe-haskell-mode -Wno-missing-local-signatures+ -Wno-monomorphism-restriction -Wno-missing-deriving-strategies+ -Wno-missing-export-lists -Wno-missing-kind-signatures+ -Wno-partial-fields -executable psc-docs- build-depends: base >=4 && <5, purescript -any,- optparse-applicative >= 0.10.0, process -any, mtl -any- main-is: Main.hs- buildable: True- hs-source-dirs: psc-docs- other-modules: Ctags- Etags- Tags- ghc-options: -Wall -O2+ build-depends:+ aeson >=2.0.3.0 && <2.1,+ aeson-better-errors >=0.9.1.1 && <0.10,+ ansi-terminal >=0.11.3 && <0.12,+ array >=0.5.4.0 && <0.6,+ base >=4.16.2.0 && <4.17,+ blaze-html >=0.9.1.2 && <0.10,+ bower-json >=1.1.0.0 && <1.2,+ boxes >=0.1.5 && <0.2,+ bytestring >=0.11.3.1 && <0.12,+ Cabal >=3.6.3.0 && <3.7,+ cborg >=0.2.7.0 && <0.3,+ serialise >=0.2.5.0 && <0.3,+ cheapskate >=0.1.1.2 && <0.2,+ clock >=0.8.3 && <0.9,+ containers >=0.6.5.1 && <0.7,+ cryptonite >=0.30 && <0.31,+ data-ordlist >=0.4.7.0 && <0.5,+ deepseq >=1.4.6.1 && <1.5,+ directory >=1.3.6.2 && <1.4,+ dlist >=1.0 && <1.1,+ edit-distance >=0.2.2.1 && <0.3,+ file-embed >=0.0.15.0 && <0.1,+ filepath >=1.4.2.2 && <1.5,+ Glob >=0.10.2 && <0.11,+ haskeline >=0.8.2 && <0.9,+ language-javascript ==0.7.0.0,+ lens >=5.1.1 && <5.2,+ lifted-async >=0.10.2.2 && <0.11,+ lifted-base >=0.2.3.12 && <0.3,+ memory >=0.17.0 && <0.18,+ monad-control >=1.0.3.1 && <1.1,+ monad-logger >=0.3.36 && <0.4,+ monoidal-containers >=0.6.2.0 && <0.7,+ mtl >=2.2.2 && <2.3,+ parallel >=3.2.2.0 && <3.3,+ parsec >=3.1.15.0 && <3.2,+ pattern-arrows >=0.0.2 && <0.1,+ process ==1.6.13.1,+ protolude >=0.3.1 && <0.4,+ regex-tdfa >=1.3.1.2 && <1.4,+ safe >=0.3.19 && <0.4,+ scientific >=0.3.7.0 && <0.4,+ semigroups >=0.20 && <0.21,+ semialign >=1.2.0.1 && <1.3,+ sourcemap >=0.1.7 && <0.2,+ stm >=2.5.0.2 && <2.6,+ stringsearch >=0.3.6.6 && <0.4,+ template-haskell >=2.18.0.0 && <2.19,+ text >=1.2.5.0 && <1.3,+ these >=1.1.1.1 && <1.2,+ time >=1.11.1.1 && <1.12,+ transformers >=0.5.6.2 && <0.6,+ transformers-base >=0.4.6 && <0.5,+ utf8-string >=1.0.2 && <1.1,+ vector >=0.12.3.1 && <0.13,+ witherable >=0.4.2 && <0.5 -executable psc-hierarchy- build-depends: base >=4 && <5, purescript -any, optparse-applicative >= 0.10.0,- process -any, mtl -any, parsec -any, filepath -any, directory -any- main-is: Main.hs- buildable: True- hs-source-dirs: hierarchy+executable purs+ main-is: Main.hs+ build-tool-depends: happy:happy ==1.20.0+ hs-source-dirs: app other-modules:- ghc-options: -Wall -O2+ Command.Bundle+ Command.Compile+ Command.Docs+ Command.Docs.Html+ Command.Docs.Markdown+ Command.Graph+ Command.Hierarchy+ Command.Ide+ Command.Publish+ Command.REPL+ SharedCLI+ Version+ Paths_purescript + autogen-modules: Paths_purescript+ default-language: Haskell2010+ default-extensions:+ BangPatterns ConstraintKinds DataKinds DefaultSignatures+ DeriveFunctor DeriveFoldable DeriveTraversable DeriveGeneric+ DerivingStrategies DerivingVia EmptyDataDecls FlexibleContexts+ FlexibleInstances GeneralizedNewtypeDeriving ImportQualifiedPost+ KindSignatures LambdaCase MultiParamTypeClasses NamedFieldPuns+ NoImplicitPrelude PatternGuards PatternSynonyms RankNTypes+ RecordWildCards OverloadedRecordDot OverloadedStrings+ ScopedTypeVariables TupleSections TypeFamilies ViewPatterns++ ghc-options:+ -Weverything -Wno-missing-exported-signatures+ -Wno-missing-import-lists -Wno-missed-specialisations+ -Wno-all-missed-specialisations -Wno-unsafe -Wno-safe+ -Wno-trustworthy-safe -Wno-inferred-safe-imports+ -Wno-missing-safe-haskell-mode -Wno-missing-local-signatures+ -Wno-monomorphism-restriction -Wno-missing-deriving-strategies+ -Wno-missing-export-lists -Wno-missing-kind-signatures+ -Wno-partial-fields -fno-warn-unused-do-bind -threaded -rtsopts+ -with-rtsopts=-N -Wno-unused-packages++ build-depends:+ aeson >=2.0.3.0 && <2.1,+ aeson-better-errors >=0.9.1.1 && <0.10,+ ansi-terminal >=0.11.3 && <0.12,+ array >=0.5.4.0 && <0.6,+ base >=4.16.2.0 && <4.17,+ blaze-html >=0.9.1.2 && <0.10,+ bower-json >=1.1.0.0 && <1.2,+ boxes >=0.1.5 && <0.2,+ bytestring >=0.11.3.1 && <0.12,+ Cabal >=3.6.3.0 && <3.7,+ cborg >=0.2.7.0 && <0.3,+ serialise >=0.2.5.0 && <0.3,+ cheapskate >=0.1.1.2 && <0.2,+ clock >=0.8.3 && <0.9,+ containers >=0.6.5.1 && <0.7,+ cryptonite >=0.30 && <0.31,+ data-ordlist >=0.4.7.0 && <0.5,+ deepseq >=1.4.6.1 && <1.5,+ directory >=1.3.6.2 && <1.4,+ dlist >=1.0 && <1.1,+ edit-distance >=0.2.2.1 && <0.3,+ file-embed >=0.0.15.0 && <0.1,+ filepath >=1.4.2.2 && <1.5,+ Glob >=0.10.2 && <0.11,+ haskeline >=0.8.2 && <0.9,+ language-javascript ==0.7.0.0,+ lens >=5.1.1 && <5.2,+ lifted-async >=0.10.2.2 && <0.11,+ lifted-base >=0.2.3.12 && <0.3,+ memory >=0.17.0 && <0.18,+ monad-control >=1.0.3.1 && <1.1,+ monad-logger >=0.3.36 && <0.4,+ monoidal-containers >=0.6.2.0 && <0.7,+ mtl >=2.2.2 && <2.3,+ parallel >=3.2.2.0 && <3.3,+ parsec >=3.1.15.0 && <3.2,+ pattern-arrows >=0.0.2 && <0.1,+ process ==1.6.13.1,+ protolude >=0.3.1 && <0.4,+ regex-tdfa >=1.3.1.2 && <1.4,+ safe >=0.3.19 && <0.4,+ scientific >=0.3.7.0 && <0.4,+ semigroups >=0.20 && <0.21,+ semialign >=1.2.0.1 && <1.3,+ sourcemap >=0.1.7 && <0.2,+ stm >=2.5.0.2 && <2.6,+ stringsearch >=0.3.6.6 && <0.4,+ template-haskell >=2.18.0.0 && <2.19,+ text >=1.2.5.0 && <1.3,+ these >=1.1.1.1 && <1.2,+ time >=1.11.1.1 && <1.12,+ transformers >=0.5.6.2 && <0.6,+ transformers-base >=0.4.6 && <0.5,+ utf8-string >=1.0.2 && <1.1,+ vector >=0.12.3.1 && <0.13,+ witherable >=0.4.2 && <0.5,+ ansi-wl-pprint >=0.6.9 && <0.7,+ exceptions >=0.10.4 && <0.11,+ network >=3.1.2.7 && <3.2,+ optparse-applicative >=0.17.0.0 && <0.18,+ purescript++ if flag(release)+ cpp-options: -DRELEASE++ else+ build-depends: gitrev >=1.2.0 && <1.4+ test-suite tests- build-depends: base >=4 && <5, containers -any, directory -any,- filepath -any, mtl -any, parsec -any, purescript -any,- transformers -any, process -any- type: exitcode-stdio-1.0- main-is: Main.hs- buildable: True- hs-source-dirs: tests+ type: exitcode-stdio-1.0+ main-is: Main.hs+ build-tool-depends:+ happy:happy ==1.20.0, hspec-discover:hspec-discover,+ purescript:purs++ hs-source-dirs: tests+ other-modules:+ Language.PureScript.Ide.CompletionSpec+ Language.PureScript.Ide.FilterSpec+ Language.PureScript.Ide.ImportsSpec+ Language.PureScript.Ide.MatcherSpec+ Language.PureScript.Ide.RebuildSpec+ Language.PureScript.Ide.ReexportsSpec+ Language.PureScript.Ide.SourceFileSpec+ Language.PureScript.Ide.StateSpec+ Language.PureScript.Ide.Test+ Language.PureScript.Ide.UsageSpec+ PscIdeSpec+ TestAst+ TestCompiler+ TestCoreFn+ TestCst+ TestDocs+ TestGraph+ TestHierarchy+ TestIde+ TestMake+ TestPrimDocs+ TestPsci+ TestPsci.CommandTest+ TestPsci.CompletionTest+ TestPsci.EvalTest+ TestPsci.TestEnv+ TestPscPublish+ TestSourceMaps+ TestUtils+ Paths_purescript++ default-language: Haskell2010+ default-extensions:+ BangPatterns ConstraintKinds DataKinds DefaultSignatures+ DeriveFunctor DeriveFoldable DeriveTraversable DeriveGeneric+ DerivingStrategies DerivingVia EmptyDataDecls FlexibleContexts+ FlexibleInstances GeneralizedNewtypeDeriving ImportQualifiedPost+ KindSignatures LambdaCase MultiParamTypeClasses NamedFieldPuns+ NoImplicitPrelude PatternGuards PatternSynonyms RankNTypes+ RecordWildCards OverloadedRecordDot OverloadedStrings+ ScopedTypeVariables TupleSections TypeFamilies ViewPatterns++ ghc-options:+ -Weverything -Wno-missing-exported-signatures+ -Wno-missing-import-lists -Wno-missed-specialisations+ -Wno-all-missed-specialisations -Wno-unsafe -Wno-safe+ -Wno-trustworthy-safe -Wno-inferred-safe-imports+ -Wno-missing-safe-haskell-mode -Wno-missing-local-signatures+ -Wno-monomorphism-restriction -Wno-missing-deriving-strategies+ -Wno-missing-export-lists -Wno-missing-kind-signatures+ -Wno-partial-fields -Wno-incomplete-uni-patterns+ -Wno-unused-packages++ build-depends:+ aeson >=2.0.3.0 && <2.1,+ aeson-better-errors >=0.9.1.1 && <0.10,+ ansi-terminal >=0.11.3 && <0.12,+ array >=0.5.4.0 && <0.6,+ base >=4.16.2.0 && <4.17,+ blaze-html >=0.9.1.2 && <0.10,+ bower-json >=1.1.0.0 && <1.2,+ boxes >=0.1.5 && <0.2,+ bytestring >=0.11.3.1 && <0.12,+ Cabal >=3.6.3.0 && <3.7,+ cborg >=0.2.7.0 && <0.3,+ serialise >=0.2.5.0 && <0.3,+ cheapskate >=0.1.1.2 && <0.2,+ clock >=0.8.3 && <0.9,+ containers >=0.6.5.1 && <0.7,+ cryptonite >=0.30 && <0.31,+ data-ordlist >=0.4.7.0 && <0.5,+ deepseq >=1.4.6.1 && <1.5,+ directory >=1.3.6.2 && <1.4,+ dlist >=1.0 && <1.1,+ edit-distance >=0.2.2.1 && <0.3,+ file-embed >=0.0.15.0 && <0.1,+ filepath >=1.4.2.2 && <1.5,+ Glob >=0.10.2 && <0.11,+ haskeline >=0.8.2 && <0.9,+ language-javascript ==0.7.0.0,+ lens >=5.1.1 && <5.2,+ lifted-async >=0.10.2.2 && <0.11,+ lifted-base >=0.2.3.12 && <0.3,+ memory >=0.17.0 && <0.18,+ monad-control >=1.0.3.1 && <1.1,+ monad-logger >=0.3.36 && <0.4,+ monoidal-containers >=0.6.2.0 && <0.7,+ mtl >=2.2.2 && <2.3,+ parallel >=3.2.2.0 && <3.3,+ parsec >=3.1.15.0 && <3.2,+ pattern-arrows >=0.0.2 && <0.1,+ process ==1.6.13.1,+ protolude >=0.3.1 && <0.4,+ regex-tdfa >=1.3.1.2 && <1.4,+ safe >=0.3.19 && <0.4,+ scientific >=0.3.7.0 && <0.4,+ semigroups >=0.20 && <0.21,+ semialign >=1.2.0.1 && <1.3,+ sourcemap >=0.1.7 && <0.2,+ stm >=2.5.0.2 && <2.6,+ stringsearch >=0.3.6.6 && <0.4,+ template-haskell >=2.18.0.0 && <2.19,+ text >=1.2.5.0 && <1.3,+ these >=1.1.1.1 && <1.2,+ time >=1.11.1.1 && <1.12,+ transformers >=0.5.6.2 && <0.6,+ transformers-base >=0.4.6 && <0.5,+ utf8-string >=1.0.2 && <1.1,+ vector >=0.12.3.1 && <0.13,+ witherable >=0.4.2 && <0.5,+ purescript,+ generic-random >=1.5.0.1 && <1.6,+ hspec >=2.10.7 && <3,+ HUnit >=1.6.2.0 && <1.7,+ newtype >=0.2.2.0 && <0.3,+ QuickCheck >=2.14.2 && <2.15,+ regex-base >=0.94.0.2 && <0.95,+ split >=0.2.3.4 && <0.3,+ typed-process >=0.2.10.1 && <0.3
+ src/Control/Monad/Logger.hs view
@@ -0,0 +1,56 @@+-- |+-- A replacement for WriterT IO which uses mutable references.+--+module Control.Monad.Logger where++import Prelude++import Control.Monad (ap)+import Control.Monad.Base (MonadBase(..))+import Control.Monad.IO.Class (MonadIO(..))+import Control.Monad.Trans.Control (MonadBaseControl(..))+import Control.Monad.Writer.Class (MonadWriter(..))++import Data.IORef (IORef, atomicModifyIORef', newIORef, readIORef)++-- | A replacement for WriterT IO which uses mutable references.+newtype Logger w a = Logger { runLogger :: IORef w -> IO a }++-- | Run a Logger computation, starting with an empty log.+runLogger' :: (Monoid w) => Logger w a -> IO (a, w)+runLogger' l = do+ r <- newIORef mempty+ a <- runLogger l r+ w <- readIORef r+ return (a, w)++instance Functor (Logger w) where+ fmap f (Logger l) = Logger $ \r -> fmap f (l r)++instance (Monoid w) => Applicative (Logger w) where+ pure = Logger . const . pure+ (<*>) = ap++instance (Monoid w) => Monad (Logger w) where+ return = pure+ Logger l >>= f = Logger $ \r -> l r >>= \a -> runLogger (f a) r++instance (Monoid w) => MonadIO (Logger w) where+ liftIO = Logger . const++instance (Monoid w) => MonadWriter w (Logger w) where+ tell w = Logger $ \r -> atomicModifyIORef' r $ \w' -> (mappend w' w, ())+ listen l = Logger $ \r -> do+ (a, w) <- liftIO (runLogger' l)+ atomicModifyIORef' r $ \w' -> (mappend w' w, (a, w))+ pass l = Logger $ \r -> do+ ((a, f), w) <- liftIO (runLogger' l)+ atomicModifyIORef' r $ \w' -> (mappend w' (f w), a)++instance (Monoid w) => MonadBase IO (Logger w) where+ liftBase = liftIO++instance (Monoid w) => MonadBaseControl IO (Logger w) where+ type StM (Logger w) a = a+ liftBaseWith f = Logger $ \r -> liftBaseWith $ \q -> f (q . flip runLogger r)+ restoreM = return
src/Control/Monad/Supply.hs view
@@ -1,33 +1,21 @@------------------------------------------------------------------------------------ Module : Control.Monad.Supply--- Copyright : (c) Phil Freeman 2014--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :--- -- | -- Fresh variable supply ----------------------------------------------------------------------------------{-# LANGUAGE GeneralizedNewtypeDeriving #-}- module Control.Monad.Supply where -import Data.Functor.Identity+import Prelude -import Control.Applicative-import Control.Monad.State-import Control.Monad.Except-import Control.Monad.Reader-import Control.Monad.Writer+import Control.Applicative (Alternative)+import Control.Monad.Error.Class (MonadError(..))+import Control.Monad.Reader (MonadPlus, MonadReader, MonadTrans)+import Control.Monad.State (StateT(..))+import Control.Monad.Writer (MonadWriter) -newtype SupplyT m a = SupplyT { unSupplyT :: StateT Integer m a } - deriving (Functor, Applicative, Monad, MonadTrans, MonadError e, MonadWriter w, MonadReader r)+import Data.Functor.Identity (Identity(..)) +newtype SupplyT m a = SupplyT { unSupplyT :: StateT Integer m a }+ deriving (Functor, Applicative, Monad, MonadTrans, MonadError e, MonadWriter w, MonadReader r, Alternative, MonadPlus)+ runSupplyT :: Integer -> SupplyT m a -> m (a, Integer) runSupplyT n = flip runStateT n . unSupplyT @@ -38,6 +26,3 @@ runSupply :: Integer -> Supply a -> (a, Integer) runSupply n = runIdentity . runSupplyT n--evalSupply :: Integer -> Supply a -> a-evalSupply n = runIdentity . evalSupplyT n
src/Control/Monad/Supply/Class.hs view
@@ -1,36 +1,35 @@------------------------------------------------------------------------------------ Module : Control.Monad.Supply.Class--- Copyright : (c) PureScript 2015--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :--- -- | -- A class for monads supporting a supply of fresh names -------------------------------------------------------------------------------- -{-# LANGUAGE MultiParamTypeClasses #-}- module Control.Monad.Supply.Class where -import Control.Monad.Supply-import Control.Monad.State+import Prelude -class (Monad m) => MonadSupply m where+import Control.Monad.RWS (MonadState(..), MonadTrans(..), RWST)+import Control.Monad.State (StateT)+import Control.Monad.Supply (SupplyT(..))+import Control.Monad.Writer (WriterT)+import Data.Text (Text, pack)++class Monad m => MonadSupply m where fresh :: m Integer- -instance (Monad m) => MonadSupply (SupplyT m) where+ peek :: m Integer+ default fresh :: (MonadTrans t, MonadSupply n, m ~ t n) => m Integer+ fresh = lift fresh+ default peek :: (MonadTrans t, MonadSupply n, m ~ t n) => m Integer+ peek = lift peek++instance Monad m => MonadSupply (SupplyT m) where fresh = SupplyT $ do n <- get put (n + 1) return n- -instance (MonadSupply m) => MonadSupply (StateT s m) where- fresh = lift fresh+ peek = SupplyT get -freshName :: (MonadSupply m) => m String-freshName = liftM (('_' :) . show) fresh+instance MonadSupply m => MonadSupply (StateT s m)+instance (Monoid w, MonadSupply m) => MonadSupply (WriterT w m)+instance (Monoid w, MonadSupply m) => MonadSupply (RWST r w s m)++freshName :: MonadSupply m => m Text+freshName = fmap (("$" <> ) . pack . show) fresh
− src/Control/Monad/Unify.hs
@@ -1,159 +0,0 @@------------------------------------------------------------------------------------ Module : Control.Monad.Unify--- Copyright : (c) Phil Freeman 2013--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ |--------------------------------------------------------------------------------------{-# LANGUAGE GeneralizedNewtypeDeriving #-}-{-# LANGUAGE FlexibleInstances #-}-{-# LANGUAGE FlexibleContexts #-}-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE MultiParamTypeClasses #-}-{-# LANGUAGE FunctionalDependencies #-}-{-# LANGUAGE UndecidableInstances #-}--module Control.Monad.Unify where--import Data.Monoid--import Control.Applicative-import Control.Monad.State-import Control.Monad.Error.Class--import Data.HashMap.Strict as M---- |--- Untyped unification variables----type Unknown = Int---- |--- A type which can contain unification variables----class Partial t where- unknown :: Unknown -> t- isUnknown :: t -> Maybe Unknown- unknowns :: t -> [Unknown]- ($?) :: Substitution t -> t -> t---- |--- Identifies types which support unification----class (Partial t) => Unifiable m t | t -> m where- (=?=) :: t -> t -> UnifyT t m ()---- |--- A substitution maintains a mapping from unification variables to their values----data Substitution t = Substitution { runSubstitution :: M.HashMap Int t }--instance (Partial t) => Monoid (Substitution t) where- mempty = Substitution M.empty- s1 `mappend` s2 = Substitution $- M.map (s2 $?) (runSubstitution s1) `M.union`- M.map (s1 $?) (runSubstitution s2)---- |--- State required for type checking----data UnifyState t = UnifyState {- -- |- -- The next fresh unification variable- --- unifyNextVar :: Int- -- |- -- The current substitution- --- , unifyCurrentSubstitution :: Substitution t- }---- |--- An empty @UnifyState@----defaultUnifyState :: (Partial t) => UnifyState t-defaultUnifyState = UnifyState 0 mempty---- |--- A class for errors which support unification errors----class UnificationError t e where- occursCheckFailed :: t -> e---- |--- The type checking monad, which provides the state of the type checker, and error reporting capabilities----newtype UnifyT t m a = UnifyT { unUnify :: StateT (UnifyState t) m a }- deriving (Functor, Monad, Applicative, Alternative, MonadPlus)--instance (MonadState s m) => MonadState s (UnifyT t m) where- get = UnifyT . lift $ get- put = UnifyT . lift . put--instance (MonadError e m) => MonadError e (UnifyT t m) where- throwError = UnifyT . throwError- catchError e f = UnifyT $ catchError (unUnify e) (unUnify . f)---- |--- Run a computation in the Unify monad, failing with an error, or succeeding with a return value and the new next unification variable----runUnify :: UnifyState t -> UnifyT t m a -> m (a, UnifyState t)-runUnify s = flip runStateT s . unUnify---- |--- Substitute a single unification variable----substituteOne :: (Partial t) => Unknown -> t -> Substitution t-substituteOne u t = Substitution $ M.singleton u t---- |--- Replace a unification variable with the specified value in the current substitution----(=:=) :: (UnificationError t e, Monad m, MonadError e m, Unifiable m t) => Unknown -> t -> UnifyT t m ()-(=:=) u t' = do- st <- UnifyT get- let sub = unifyCurrentSubstitution st- let t = sub $? t'- occursCheck u t- let current = sub $? unknown u- case isUnknown current of- Just u1 | u1 == u -> return ()- _ -> current =?= t- UnifyT $ modify $ \s -> s { unifyCurrentSubstitution = substituteOne u t <> unifyCurrentSubstitution s }---- |--- Perform the occurs check, to make sure a unification variable does not occur inside a value----occursCheck :: (UnificationError t e, Monad m, MonadError e m, Partial t) => Unknown -> t -> UnifyT t m ()-occursCheck u t =- case isUnknown t of- Nothing -> when (u `elem` unknowns t) $ UnifyT . lift . throwError $ occursCheckFailed t- _ -> return ()---- |--- Generate a fresh untyped unification variable----fresh' :: (Monad m) => UnifyT t m Unknown-fresh' = do- st <- UnifyT get- UnifyT $ modify $ \s -> s { unifyNextVar = succ (unifyNextVar s) }- return $ unifyNextVar st---- |--- Generate a fresh unification variable at a specific type----fresh :: (Monad m, Partial t) => UnifyT t m t-fresh = do- u <- fresh'- return $ unknown u---
+ src/Data/Text/PureScript.hs view
@@ -0,0 +1,23 @@+-- |+-- This module contains internal extensions to Data.Text.+--+module Data.Text.PureScript (spanUpTo) where++import Prelude++import Data.Text.Internal (Text(..), text)+import Data.Text.Unsafe (Iter(..), iter)++-- | /O(n)/ 'spanUpTo', applied to a number @n@, predicate @p@, and text @t@,+-- returns a pair whose first element is the longest prefix (possibly empty) of+-- @t@ of length less than or equal to @n@ of elements that satisfy @p@, and+-- whose second is the remainder of the text.+{-# INLINE spanUpTo #-}+spanUpTo :: Int -> (Char -> Bool) -> Text -> (Text, Text)+spanUpTo n p t@(Text arr off len) = (hd, tl)+ where hd = text arr off k+ tl = text arr (off + k) (len - k)+ !k = loop n 0+ loop !n' !i | n' > 0 && i < len && p c = loop (n' - 1) (i + d)+ | otherwise = i+ where Iter c d = iter t i
src/Language/PureScript.hs view
@@ -1,276 +1,36 @@------------------------------------------------------------------------------------ Module : Language.PureScript--- Copyright : (c) 2013-14 Phil Freeman, (c) 2014 Gary Burgess, and other contributors--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :--- -- | -- The main compiler module ----------------------------------------------------------------------------------{-# LANGUAGE DataKinds #-}-{-# LANGUAGE QuasiQuotes #-}-{-# LANGUAGE TemplateHaskell #-}-{-# LANGUAGE FlexibleContexts #-}-{-# LANGUAGE ScopedTypeVariables #-}- module Language.PureScript ( module P- , compile- , compile'- , RebuildPolicy(..)- , MonadMake(..)- , make- , prelude , version ) where -import Data.FileEmbed (embedFile)-import Data.Function (on)-import Data.List (sortBy, groupBy, intercalate)-import Data.Maybe (fromMaybe)-import Data.Time.Clock-import Data.Version (Version)-import qualified Data.Traversable as T (traverse)-import qualified Data.ByteString.UTF8 as BU-import qualified Data.Map as M-import qualified Data.Set as S -import Control.Applicative-import Control.Arrow ((&&&))-import Control.Monad.Except-import Control.Monad.Reader+import Control.Monad.Supply as P -import System.FilePath ((</>))+import Data.Version (Version) import Language.PureScript.AST as P import Language.PureScript.Comments as P-import Language.PureScript.CodeGen as P-import Language.PureScript.DeadCodeElimination as P+import Language.PureScript.Crash as P import Language.PureScript.Environment as P-import Language.PureScript.Errors as P-import Language.PureScript.Kinds as P+import Language.PureScript.Errors as P hiding (indent)+import Language.PureScript.Externs as P+import Language.PureScript.Graph as P+import Language.PureScript.Linter as P+import Language.PureScript.Make as P import Language.PureScript.ModuleDependencies as P import Language.PureScript.Names as P import Language.PureScript.Options as P-import Language.PureScript.Parser as P import Language.PureScript.Pretty as P import Language.PureScript.Renamer as P+import Language.PureScript.Roles as P import Language.PureScript.Sugar as P-import Control.Monad.Supply as P import Language.PureScript.TypeChecker as P import Language.PureScript.Types as P-import qualified Language.PureScript.CoreFn as CoreFn-import qualified Language.PureScript.Constants as C -import qualified Paths_purescript as Paths---- |--- Compile a collection of modules------ The compilation pipeline proceeds as follows:------ * Sort the modules based on module dependencies, checking for cyclic dependencies.------ * Perform a set of desugaring passes.------ * Type check, and elaborate values to include type annotations and type class dictionaries.------ * Regroup values to take into account new value dependencies introduced by elaboration.------ * Eliminate dead code.------ * Generate Javascript, and perform optimization passes.------ * Pretty-print the generated Javascript----compile :: (Functor m, Applicative m, MonadError String m, MonadReader (Options Compile) m)- => [Module] -> [String] -> m (String, String, Environment)-compile = compile' initEnvironment--compile' :: (Functor m, Applicative m, MonadError String m, MonadReader (Options Compile) m)- => Environment -> [Module] -> [String] -> m (String, String, Environment)-compile' env ms prefix = do- noPrelude <- asks optionsNoPrelude- additional <- asks optionsAdditional- mainModuleIdent <- asks (fmap moduleNameFromString . optionsMain)- (sorted, _) <- sortModules $ map importPrim $ if noPrelude then ms else map importPrelude ms- (desugared, nextVar) <- interpretMultipleErrors True $ runSupplyT 0 $ desugar sorted- (elaborated, env') <- runCheck' env $ forM desugared $ typeCheckModule mainModuleIdent- regrouped <- interpretMultipleErrors True $ createBindingGroupsModule . collapseBindingGroupsModule $ elaborated- let corefn = map (CoreFn.moduleToCoreFn env') regrouped- let entryPoints = moduleNameFromString `map` entryPointModules additional- let elim = if null entryPoints then corefn else eliminateDeadCode entryPoints corefn- let renamed = renameInModules elim- let codeGenModuleNames = moduleNameFromString `map` codeGenModules additional- let modulesToCodeGen = if null codeGenModuleNames then renamed else filter (\(CoreFn.Module _ mn _ _ _ _) -> mn `elem` codeGenModuleNames) renamed- js <- concat <$> (evalSupplyT nextVar $ T.traverse moduleToJs modulesToCodeGen)- let exts = intercalate "\n" . map (`moduleToPs` env') $ regrouped- js' <- generateMain env' js- let pjs = unlines $ map ("// " ++) prefix ++ [prettyPrintJS js']- return (pjs, exts, env')--generateMain :: (MonadError String m, MonadReader (Options Compile) m) => Environment -> [JS] -> m [JS]-generateMain env js = do- main <- asks optionsMain- additional <- asks optionsAdditional- case moduleNameFromString <$> main of- Just mmi -> do- when ((mmi, Ident C.main) `M.notMember` names env) $- throwError $ show mmi ++ "." ++ C.main ++ " is undefined"- return $ js ++ [JSApp (JSAccessor C.main (JSAccessor (moduleNameToJs mmi) (JSVar (browserNamespace additional)))) []]- _ -> return js---- |--- A type class which collects the IO actions we need to be able to run in "make" mode----class (MonadReader (P.Options P.Make) m, MonadError String m) => MonadMake m where- -- |- -- Get a file timestamp- --- getTimestamp :: FilePath -> m (Maybe UTCTime)-- -- |- -- Read a file as a string- --- readTextFile :: FilePath -> m String-- -- |- -- Write a text file- --- writeTextFile :: FilePath -> String -> m ()-- -- |- -- Respond to a progress update- --- progress :: String -> m ()---- |--- Determines when to rebuild a module----data RebuildPolicy- -- | Never rebuild this module- = RebuildNever- -- | Always rebuild this module- | RebuildAlways deriving (Show, Eq, Ord)---- Traverse (Either e) instance (base 4.7)-traverseEither :: Applicative f => (a -> f b) -> Either e a -> f (Either e b)-traverseEither _ (Left x) = pure (Left x)-traverseEither f (Right y) = Right <$> f y---- |--- Compiles in "make" mode, compiling each module separately to a js files and an externs file------ If timestamps have not changed, the externs file can be used to provide the module's types without--- having to typecheck the module again.----make :: forall m. (Functor m, Applicative m, Monad m, MonadMake m)- => FilePath -> [(Either RebuildPolicy FilePath, Module)] -> [String] -> m Environment-make outputDir ms prefix = do- noPrelude <- asks optionsNoPrelude- let filePathMap = M.fromList (map (\(fp, Module _ mn _ _) -> (mn, fp)) ms)-- (sorted, graph) <- sortModules $ map importPrim $ if noPrelude then map snd ms else map (importPrelude . snd) ms-- toRebuild <- foldM (\s (Module _ moduleName' _ _) -> do- let filePath = runModuleName moduleName'-- jsFile = outputDir </> filePath </> "index.js"- externsFile = outputDir </> filePath </> "externs.purs"- inputFile = fromMaybe (error "Module has no filename in 'make'") $ M.lookup moduleName' filePathMap-- jsTimestamp <- getTimestamp jsFile- externsTimestamp <- getTimestamp externsFile- inputTimestamp <- traverseEither getTimestamp inputFile-- return $ case (inputTimestamp, jsTimestamp, externsTimestamp) of- (Right (Just t1), Just t2, Just t3) | t1 < min t2 t3 -> s- (Left RebuildNever, Just _, Just _) -> s- _ -> S.insert moduleName' s) S.empty sorted-- marked <- rebuildIfNecessary (reverseDependencies graph) toRebuild sorted-- (desugared, nextVar) <- interpretMultipleErrors True $ runSupplyT 0 $ zip (map fst marked) <$> desugar (map snd marked)-- evalSupplyT nextVar $ go initEnvironment desugared-- where- go :: Environment -> [(Bool, Module)] -> SupplyT m Environment- go env [] = return env- go env ((False, m) : ms') = do- (_, env') <- lift . runCheck' env $ typeCheckModule Nothing m-- go env' ms'- go env ((True, m@(Module coms moduleName' _ exps)) : ms') = do- let filePath = runModuleName moduleName'- jsFile = outputDir </> filePath </> "index.js"- externsFile = outputDir </> filePath </> "externs.purs"-- lift . progress $ "Compiling " ++ runModuleName moduleName'-- (Module _ _ elaborated _, env') <- lift . runCheck' env $ typeCheckModule Nothing m-- regrouped <- interpretMultipleErrors True . createBindingGroups moduleName' . collapseBindingGroups $ elaborated-- let mod' = Module coms moduleName' regrouped exps- let corefn = CoreFn.moduleToCoreFn env' mod'- let [renamed] = renameInModules [corefn]-- pjs <- prettyPrintJS <$> moduleToJs renamed- let js = unlines $ map ("// " ++) prefix ++ [pjs]- let exts = unlines $ map ("-- " ++) prefix ++ [moduleToPs mod' env']-- lift $ writeTextFile jsFile js- lift $ writeTextFile externsFile exts-- go env' ms'-- rebuildIfNecessary :: M.Map ModuleName [ModuleName] -> S.Set ModuleName -> [Module] -> m [(Bool, Module)]- rebuildIfNecessary _ _ [] = return []- rebuildIfNecessary graph toRebuild (m@(Module _ moduleName' _ _) : ms') | moduleName' `S.member` toRebuild = do- let deps = fromMaybe [] $ moduleName' `M.lookup` graph- toRebuild' = toRebuild `S.union` S.fromList deps- (:) (True, m) <$> rebuildIfNecessary graph toRebuild' ms'- rebuildIfNecessary graph toRebuild (Module _ moduleName' _ _ : ms') = do- let externsFile = outputDir </> runModuleName moduleName' </> "externs.purs"- externs <- readTextFile externsFile- externsModules <- fmap (map snd) . either (throwError . show) return $ P.parseModulesFromFiles id [(externsFile, externs)]- case externsModules of- [m'@(Module _ moduleName'' _ _)] | moduleName'' == moduleName' -> (:) (False, m') <$> rebuildIfNecessary graph toRebuild ms'- _ -> throwError $ "Externs file " ++ externsFile ++ " was invalid"--reverseDependencies :: ModuleGraph -> M.Map ModuleName [ModuleName]-reverseDependencies g = combine [ (dep, mn) | (mn, deps) <- g, dep <- deps ]- where- combine :: (Ord a) => [(a, b)] -> M.Map a [b]- combine = M.fromList . map ((fst . head) &&& map snd) . groupBy ((==) `on` fst) . sortBy (compare `on` fst)---- |--- Add an import declaration for a module if it does not already explicitly import it.----addDefaultImport :: ModuleName -> Module -> Module-addDefaultImport toImport m@(Module coms mn decls exps) =- if isExistingImport `any` decls || mn == toImport then m- else Module coms mn (ImportDeclaration toImport Implicit Nothing : decls) exps- where- isExistingImport (ImportDeclaration mn' _ _) | mn' == toImport = True- isExistingImport (PositionedDeclaration _ _ d) = isExistingImport d- isExistingImport _ = False--importPrim :: Module -> Module-importPrim = addDefaultImport (ModuleName [ProperName C.prim])--importPrelude :: Module -> Module-importPrelude = addDefaultImport (ModuleName [ProperName C.prelude])--prelude :: String-prelude = BU.toString $(embedFile "prelude/prelude.purs")+import Paths_purescript qualified as Paths version :: Version version = Paths.version
src/Language/PureScript/AST.hs view
@@ -1,23 +1,14 @@------------------------------------------------------------------------------------ Module : Language.PureScript.AST--- Copyright : (c) 2013-14 Phil Freeman, (c) 2014 Gary Burgess, and other contributors--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ | The initial PureScript AST+-- |+-- The initial PureScript AST --------------------------------------------------------------------------------- module Language.PureScript.AST ( module AST ) where import Language.PureScript.AST.Binders as AST import Language.PureScript.AST.Declarations as AST+import Language.PureScript.AST.Exported as AST+import Language.PureScript.AST.Literals as AST import Language.PureScript.AST.Operators as AST import Language.PureScript.AST.SourcePos as AST import Language.PureScript.AST.Traversals as AST
src/Language/PureScript/AST/Binders.hs view
@@ -1,26 +1,18 @@------------------------------------------------------------------------------------ Module : Language.PureScript.AST.Binders--- Copyright : (c) 2013-14 Phil Freeman, (c) 2014 Gary Burgess, and other contributors--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ | Case binders+{-# LANGUAGE DeriveAnyClass #-}+-- |+-- Case binders ----------------------------------------------------------------------------------{-# LANGUAGE DeriveDataTypeable #-}- module Language.PureScript.AST.Binders where -import qualified Data.Data as D+import Prelude -import Language.PureScript.AST.SourcePos-import Language.PureScript.Names-import Language.PureScript.Comments+import Control.DeepSeq (NFData)+import GHC.Generics (Generic)+import Language.PureScript.AST.SourcePos (SourceSpan)+import Language.PureScript.AST.Literals (Literal(..))+import Language.PureScript.Names (Ident, OpName, OpNameType(..), ProperName, ProperNameType(..), Qualified)+import Language.PureScript.Comments (Comment)+import Language.PureScript.Types (SourceType) -- | -- Data type for binders@@ -31,57 +23,140 @@ -- = NullBinder -- |- -- A binder which matches a boolean literal- --- | BooleanBinder Bool- -- |- -- A binder which matches a string literal- --- | StringBinder String- -- |- -- A binder which matches a numeric literal+ -- A binder which matches a literal --- | NumberBinder (Either Integer Double)+ | LiteralBinder SourceSpan (Literal Binder) -- | -- A binder which binds an identifier --- | VarBinder Ident+ | VarBinder SourceSpan Ident -- | -- A binder which matches a data constructor --- | ConstructorBinder (Qualified ProperName) [Binder]+ | ConstructorBinder SourceSpan (Qualified (ProperName 'ConstructorName)) [Binder] -- |- -- A binder which matches a record and binds its properties+ -- A operator alias binder. During the rebracketing phase of desugaring,+ -- this data constructor will be removed. --- | ObjectBinder [(String, Binder)]+ | OpBinder SourceSpan (Qualified (OpName 'ValueOpName)) -- |- -- A binder which matches an array and binds its elements+ -- Binary operator application. During the rebracketing phase of desugaring,+ -- this data constructor will be removed. --- | ArrayBinder [Binder]+ | BinaryNoParensBinder Binder Binder Binder -- |- -- A binder which matches an array and binds its head and tail+ -- Explicit parentheses. During the rebracketing phase of desugaring, this+ -- data constructor will be removed. --- | ConsBinder Binder Binder+ -- Note: although it seems this constructor is not used, it _is_ useful,+ -- since it prevents certain traversals from matching.+ --+ | ParensInBinder Binder -- | -- A binder which binds its input to an identifier --- | NamedBinder Ident Binder+ | NamedBinder SourceSpan Ident Binder -- | -- A binder with source position information --- | PositionedBinder SourceSpan [Comment] Binder deriving (Show, D.Data, D.Typeable)+ | PositionedBinder SourceSpan [Comment] Binder+ -- |+ -- A binder with a type annotation+ --+ | TypedBinder SourceType Binder+ deriving (Show, Generic, NFData) +-- Manual Eq and Ord instances for `Binder` were added on 2018-03-05. Comparing+-- the `SourceSpan` values embedded in some of the data constructors of `Binder`+-- was expensive. This made exhaustiveness checking observably slow for code+-- such as the `explode` function in `test/purs/passing/LargeSumTypes.purs`.+-- Custom instances were written to skip comparing the `SourceSpan` values. Only+-- the `Ord` instance was needed for the speed-up, but I did not want the `Eq`+-- to have mismatched behavior.+instance Eq Binder where+ NullBinder == NullBinder =+ True+ (LiteralBinder _ lb) == (LiteralBinder _ lb') =+ lb == lb'+ (VarBinder _ ident) == (VarBinder _ ident') =+ ident == ident'+ (ConstructorBinder _ qpc bs) == (ConstructorBinder _ qpc' bs') =+ qpc == qpc' && bs == bs'+ (OpBinder _ qov) == (OpBinder _ qov') =+ qov == qov'+ (BinaryNoParensBinder b1 b2 b3) == (BinaryNoParensBinder b1' b2' b3') =+ b1 == b1' && b2 == b2' && b3 == b3'+ (ParensInBinder b) == (ParensInBinder b') =+ b == b'+ (NamedBinder _ ident b) == (NamedBinder _ ident' b') =+ ident == ident' && b == b'+ (PositionedBinder _ comments b) == (PositionedBinder _ comments' b') =+ comments == comments' && b == b'+ (TypedBinder ty b) == (TypedBinder ty' b') =+ ty == ty' && b == b'+ _ == _ = False++instance Ord Binder where+ compare NullBinder NullBinder = EQ+ compare (LiteralBinder _ lb) (LiteralBinder _ lb') =+ compare lb lb'+ compare (VarBinder _ ident) (VarBinder _ ident') =+ compare ident ident'+ compare (ConstructorBinder _ qpc bs) (ConstructorBinder _ qpc' bs') =+ compare qpc qpc' <> compare bs bs'+ compare (OpBinder _ qov) (OpBinder _ qov') =+ compare qov qov'+ compare (BinaryNoParensBinder b1 b2 b3) (BinaryNoParensBinder b1' b2' b3') =+ compare b1 b1' <> compare b2 b2' <> compare b3 b3'+ compare (ParensInBinder b) (ParensInBinder b') =+ compare b b'+ compare (NamedBinder _ ident b) (NamedBinder _ ident' b') =+ compare ident ident' <> compare b b'+ compare (PositionedBinder _ comments b) (PositionedBinder _ comments' b') =+ compare comments comments' <> compare b b'+ compare (TypedBinder ty b) (TypedBinder ty' b') =+ compare ty ty' <> compare b b'+ compare binder binder' =+ compare (orderOf binder) (orderOf binder')+ where+ orderOf :: Binder -> Int+ orderOf NullBinder = 0+ orderOf LiteralBinder{} = 1+ orderOf VarBinder{} = 2+ orderOf ConstructorBinder{} = 3+ orderOf OpBinder{} = 4+ orderOf BinaryNoParensBinder{} = 5+ orderOf ParensInBinder{} = 6+ orderOf NamedBinder{} = 7+ orderOf PositionedBinder{} = 8+ orderOf TypedBinder{} = 9+ -- | -- Collect all names introduced in binders in an expression -- binderNames :: Binder -> [Ident]-binderNames = go []+binderNames = map snd . binderNamesWithSpans++binderNamesWithSpans :: Binder -> [(SourceSpan, Ident)]+binderNamesWithSpans = go [] where- go ns (VarBinder name) = name : ns- go ns (ConstructorBinder _ bs) = foldl go ns bs- go ns (ObjectBinder bs) = foldl go ns (map snd bs)- go ns (ArrayBinder bs) = foldl go ns bs- go ns (ConsBinder b1 b2) = go (go ns b1) b2- go ns (NamedBinder name b) = go (name : ns) b+ go ns (LiteralBinder _ b) = lit ns b+ go ns (VarBinder ss name) = (ss, name) : ns+ go ns (ConstructorBinder _ _ bs) = foldl go ns bs+ go ns (BinaryNoParensBinder b1 b2 b3) = foldl go ns [b1, b2, b3]+ go ns (ParensInBinder b) = go ns b+ go ns (NamedBinder ss name b) = go ((ss, name) : ns) b go ns (PositionedBinder _ _ b) = go ns b+ go ns (TypedBinder _ b) = go ns b go ns _ = ns+ lit ns (ObjectLiteral bs) = foldl go ns (map snd bs)+ lit ns (ArrayLiteral bs) = foldl go ns bs+ lit ns _ = ns+++isIrrefutable :: Binder -> Bool+isIrrefutable NullBinder = True+isIrrefutable (VarBinder _ _) = True+isIrrefutable (PositionedBinder _ _ b) = isIrrefutable b+isIrrefutable (TypedBinder _ b) = isIrrefutable b+isIrrefutable _ = False
src/Language/PureScript/AST/Declarations.hs view
@@ -1,133 +1,301 @@------------------------------------------------------------------------------------ Module : Language.PureScript.AST.Declarations--- Copyright : (c) 2013-14 Phil Freeman, (c) 2014 Gary Burgess, and other contributors--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ | Data types for modules and declarations+{-# LANGUAGE DeriveAnyClass #-}+{-# LANGUAGE TemplateHaskell #-}++-- |+-- Data types for modules and declarations --------------------------------------------------------------------------------+module Language.PureScript.AST.Declarations where -{-# LANGUAGE DeriveDataTypeable, ScopedTypeVariables #-}+import Prelude+import Protolude.Exceptions (hush) -module Language.PureScript.AST.Declarations where+import Codec.Serialise (Serialise)+import Control.DeepSeq (NFData)+import Data.Functor.Identity (Identity(..)) -import qualified Data.Data as D+import Data.Aeson.TH (Options(..), SumEncoding(..), defaultOptions, deriveJSON)+import Data.Map qualified as M+import Data.Text (Text)+import Data.List.NonEmpty qualified as NEL+import GHC.Generics (Generic) -import Language.PureScript.AST.Binders-import Language.PureScript.AST.Operators-import Language.PureScript.AST.SourcePos-import Language.PureScript.Types-import Language.PureScript.Names-import Language.PureScript.Kinds-import Language.PureScript.TypeClassDictionaries-import Language.PureScript.Comments-import Language.PureScript.CodeGen.JS.AST-import Language.PureScript.Environment+import Language.PureScript.AST.Binders (Binder)+import Language.PureScript.AST.Literals (Literal(..))+import Language.PureScript.AST.Operators (Fixity)+import Language.PureScript.AST.SourcePos (SourceAnn, SourceSpan)+import Language.PureScript.AST.Declarations.ChainId (ChainId)+import Language.PureScript.Types (SourceConstraint, SourceType)+import Language.PureScript.PSString (PSString)+import Language.PureScript.Label (Label)+import Language.PureScript.Names (pattern ByNullSourcePos, Ident(..), ModuleName(..), Name(..), OpName, OpNameType(..), ProperName, ProperNameType(..), Qualified(..), QualifiedBy(..), toMaybeModuleName)+import Language.PureScript.Roles (Role)+import Language.PureScript.TypeClassDictionaries (NamedDict)+import Language.PureScript.Comments (Comment)+import Language.PureScript.Environment (DataDeclType, Environment, FunctionalDependency, NameKind)+import Language.PureScript.Constants.Prim qualified as C +-- | A map of locally-bound names in scope.+type Context = [(Ident, SourceType)]++-- | Holds the data necessary to do type directed search for typed holes+data TypeSearch+ = TSBefore Environment+ -- ^ An Environment captured for later consumption by type directed search+ | TSAfter+ -- ^ Results of applying type directed search to the previously captured+ -- Environment+ { tsAfterIdentifiers :: [(Qualified Text, SourceType)]+ -- ^ The identifiers that fully satisfy the subsumption check+ , tsAfterRecordFields :: Maybe [(Label, SourceType)]+ -- ^ Record fields that are available on the first argument to the typed+ -- hole+ }+ deriving (Show, Generic, NFData)++onTypeSearchTypes :: (SourceType -> SourceType) -> TypeSearch -> TypeSearch+onTypeSearchTypes f = runIdentity . onTypeSearchTypesM (Identity . f)++onTypeSearchTypesM :: (Applicative m) => (SourceType -> m SourceType) -> TypeSearch -> m TypeSearch+onTypeSearchTypesM f (TSAfter i r) = TSAfter <$> traverse (traverse f) i <*> traverse (traverse (traverse f)) r+onTypeSearchTypesM _ (TSBefore env) = pure (TSBefore env)++-- | Error message hints, providing more detailed information about failure.+data ErrorMessageHint+ = ErrorUnifyingTypes SourceType SourceType+ | ErrorInExpression Expr+ | ErrorInModule ModuleName+ | ErrorInInstance (Qualified (ProperName 'ClassName)) [SourceType]+ | ErrorInSubsumption SourceType SourceType+ | ErrorInRowLabel Label+ | ErrorCheckingAccessor Expr PSString+ | ErrorCheckingType Expr SourceType+ | ErrorCheckingKind SourceType SourceType+ | ErrorCheckingGuard+ | ErrorInferringType Expr+ | ErrorInferringKind SourceType+ | ErrorInApplication Expr SourceType Expr+ | ErrorInDataConstructor (ProperName 'ConstructorName)+ | ErrorInTypeConstructor (ProperName 'TypeName)+ | ErrorInBindingGroup (NEL.NonEmpty Ident)+ | ErrorInDataBindingGroup [ProperName 'TypeName]+ | ErrorInTypeSynonym (ProperName 'TypeName)+ | ErrorInValueDeclaration Ident+ | ErrorInTypeDeclaration Ident+ | ErrorInTypeClassDeclaration (ProperName 'ClassName)+ | ErrorInKindDeclaration (ProperName 'TypeName)+ | ErrorInRoleDeclaration (ProperName 'TypeName)+ | ErrorInForeignImport Ident+ | ErrorInForeignImportData (ProperName 'TypeName)+ | ErrorSolvingConstraint SourceConstraint+ | MissingConstructorImportForCoercible (Qualified (ProperName 'ConstructorName))+ | PositionedError (NEL.NonEmpty SourceSpan)+ | RelatedPositions (NEL.NonEmpty SourceSpan)+ deriving (Show, Generic, NFData)++-- | Categories of hints+data HintCategory+ = ExprHint+ | KindHint+ | CheckHint+ | PositionHint+ | SolverHint+ | DeclarationHint+ | OtherHint+ deriving (Show, Eq)+ -- |+-- In constraint solving, indicates whether there were `TypeUnknown`s that prevented+-- an instance from being found, and whether VTAs are required+-- due to type class members not referencing all the type class+-- head's type variables.+data UnknownsHint+ = NoUnknowns+ | Unknowns+ | UnknownsWithVtaRequiringArgs (NEL.NonEmpty (Qualified Ident, [[Text]]))+ deriving (Show, Generic, NFData)++-- | -- A module declaration, consisting of comments about the module, a module name, -- a list of declarations, and a list of the declarations that are -- explicitly exported. If the export list is Nothing, everything is exported. ---data Module = Module [Comment] ModuleName [Declaration] (Maybe [DeclarationRef]) deriving (Show, D.Data, D.Typeable)+data Module = Module SourceSpan [Comment] ModuleName [Declaration] (Maybe [DeclarationRef])+ deriving (Show) -- | Return a module's name. getModuleName :: Module -> ModuleName-getModuleName (Module _ name _ _) = name+getModuleName (Module _ _ name _ _) = name --- |--- Test if a declaration is exported, given a module's export list.----isExported :: Maybe [DeclarationRef] -> Declaration -> Bool-isExported Nothing _ = True-isExported _ TypeInstanceDeclaration{} = True-isExported exps (PositionedDeclaration _ _ d) = isExported exps d-isExported (Just exps) decl = any (matches decl) exps- where- matches (TypeDeclaration ident _) (ValueRef ident') = ident == ident'- matches (ValueDeclaration ident _ _ _) (ValueRef ident') = ident == ident'- matches (ExternDeclaration _ ident _ _) (ValueRef ident') = ident == ident'- matches (DataDeclaration _ ident _ _) (TypeRef ident' _) = ident == ident'- matches (ExternDataDeclaration ident _) (TypeRef ident' _) = ident == ident'- matches (TypeSynonymDeclaration ident _ _) (TypeRef ident' _) = ident == ident'- matches (TypeClassDeclaration ident _ _ _) (TypeClassRef ident') = ident == ident'- matches (PositionedDeclaration _ _ d) r = d `matches` r- matches d (PositionedDeclarationRef _ _ r) = d `matches` r- matches _ _ = False+-- | Return a module's source span.+getModuleSourceSpan :: Module -> SourceSpan+getModuleSourceSpan (Module ss _ _ _ _) = ss -exportedDeclarations :: Module -> [Declaration]-exportedDeclarations (Module _ _ decls exps) = filter (isExported exps) (flattenDecls decls)+-- | Return a module's declarations.+getModuleDeclarations :: Module -> [Declaration]+getModuleDeclarations (Module _ _ _ declarations _) = declarations -- |--- Test if a data constructor for a given type is exported, given a module's export list.+-- Add an import declaration for a module if it does not already explicitly import it. ---isDctorExported :: ProperName -> Maybe [DeclarationRef] -> ProperName -> Bool-isDctorExported _ Nothing _ = True-isDctorExported ident (Just exps) ctor = test `any` exps- where- test (PositionedDeclarationRef _ _ d) = test d- test (TypeRef ident' Nothing) = ident == ident'- test (TypeRef ident' (Just ctors)) = ident == ident' && ctor `elem` ctors- test _ = False---- |--- Return the exported data constructors for a given type.+-- Will not import an unqualified module if that module has already been imported qualified.+-- (See #2197) ---exportedDctors :: Module -> ProperName -> [ProperName]-exportedDctors (Module _ _ decls exps) ident =- filter (isDctorExported ident exps) dctors+addDefaultImport :: Qualified ModuleName -> Module -> Module+addDefaultImport (Qualified toImportAs toImport) m@(Module ss coms mn decls exps) =+ if isExistingImport `any` decls || mn == toImport then m+ else Module ss coms mn (ImportDeclaration (ss, []) toImport Implicit toImportAs' : decls) exps where- dctors = concatMap getDctors (flattenDecls decls)- getDctors (DataDeclaration _ _ _ ctors) = map fst ctors- getDctors (PositionedDeclaration _ _ d) = getDctors d- getDctors _ = []+ toImportAs' = toMaybeModuleName toImportAs + isExistingImport (ImportDeclaration _ mn' _ as')+ | mn' == toImport =+ case toImportAs' of+ Nothing -> True+ _ -> as' == toImportAs'+ isExistingImport _ = False++-- | Adds import declarations to a module for an implicit Prim import and Prim+-- | qualified as Prim, as necessary.+importPrim :: Module -> Module+importPrim =+ let+ primModName = C.M_Prim+ in+ addDefaultImport (Qualified (ByModuleName primModName) primModName)+ . addDefaultImport (Qualified ByNullSourcePos primModName)++data NameSource = UserNamed | CompilerNamed+ deriving (Show, Generic, NFData, Serialise)+ -- | -- An item in a list of explicit imports or exports -- data DeclarationRef -- |+ -- A type class+ --+ = TypeClassRef SourceSpan (ProperName 'ClassName)+ -- |+ -- A type operator+ --+ | TypeOpRef SourceSpan (OpName 'TypeOpName)+ -- | -- A type constructor with data constructors --- = TypeRef ProperName (Maybe [ProperName])+ | TypeRef SourceSpan (ProperName 'TypeName) (Maybe [ProperName 'ConstructorName]) -- | -- A value --- | ValueRef Ident+ | ValueRef SourceSpan Ident -- |- -- A type class+ -- A value-level operator --- | TypeClassRef ProperName- -- |- -- A type class instance, created during typeclass desugaring (name, class name, instance types)+ | ValueOpRef SourceSpan (OpName 'ValueOpName)+ -- |+ -- A type class instance, created during typeclass desugaring --- | TypeInstanceRef Ident+ | TypeInstanceRef SourceSpan Ident NameSource -- |- -- A declaration reference with source position information+ -- A module, in its entirety --- | PositionedDeclarationRef SourceSpan [Comment] DeclarationRef- deriving (Show, D.Data, D.Typeable)+ | ModuleRef SourceSpan ModuleName+ -- |+ -- A value re-exported from another module. These will be inserted during+ -- elaboration in name desugaring.+ --+ | ReExportRef SourceSpan ExportSource DeclarationRef+ deriving (Show, Generic, NFData, Serialise) instance Eq DeclarationRef where- (TypeRef name dctors) == (TypeRef name' dctors') = name == name' && dctors == dctors'- (ValueRef name) == (ValueRef name') = name == name'- (TypeClassRef name) == (TypeClassRef name') = name == name'- (TypeInstanceRef name) == (TypeInstanceRef name') = name == name'- (PositionedDeclarationRef _ _ r) == r' = r == r'- r == (PositionedDeclarationRef _ _ r') = r == r'+ (TypeClassRef _ name) == (TypeClassRef _ name') = name == name'+ (TypeOpRef _ name) == (TypeOpRef _ name') = name == name'+ (TypeRef _ name dctors) == (TypeRef _ name' dctors') = name == name' && dctors == dctors'+ (ValueRef _ name) == (ValueRef _ name') = name == name'+ (ValueOpRef _ name) == (ValueOpRef _ name') = name == name'+ (TypeInstanceRef _ name _) == (TypeInstanceRef _ name' _) = name == name'+ (ModuleRef _ name) == (ModuleRef _ name') = name == name'+ (ReExportRef _ mn ref) == (ReExportRef _ mn' ref') = mn == mn' && ref == ref' _ == _ = False +instance Ord DeclarationRef where+ TypeClassRef _ name `compare` TypeClassRef _ name' = compare name name'+ TypeOpRef _ name `compare` TypeOpRef _ name' = compare name name'+ TypeRef _ name dctors `compare` TypeRef _ name' dctors' = compare name name' <> compare dctors dctors'+ ValueRef _ name `compare` ValueRef _ name' = compare name name'+ ValueOpRef _ name `compare` ValueOpRef _ name' = compare name name'+ TypeInstanceRef _ name _ `compare` TypeInstanceRef _ name' _ = compare name name'+ ModuleRef _ name `compare` ModuleRef _ name' = compare name name'+ ReExportRef _ mn ref `compare` ReExportRef _ mn' ref' = compare mn mn' <> compare ref ref'+ compare ref ref' =+ compare (orderOf ref) (orderOf ref')+ where+ orderOf :: DeclarationRef -> Int+ orderOf TypeClassRef{} = 0+ orderOf TypeOpRef{} = 1+ orderOf TypeRef{} = 2+ orderOf ValueRef{} = 3+ orderOf ValueOpRef{} = 4+ orderOf TypeInstanceRef{} = 5+ orderOf ModuleRef{} = 6+ orderOf ReExportRef{} = 7++data ExportSource =+ ExportSource+ { exportSourceImportedFrom :: Maybe ModuleName+ , exportSourceDefinedIn :: ModuleName+ }+ deriving (Eq, Ord, Show, Generic, NFData, Serialise)++declRefSourceSpan :: DeclarationRef -> SourceSpan+declRefSourceSpan (TypeRef ss _ _) = ss+declRefSourceSpan (TypeOpRef ss _) = ss+declRefSourceSpan (ValueRef ss _) = ss+declRefSourceSpan (ValueOpRef ss _) = ss+declRefSourceSpan (TypeClassRef ss _) = ss+declRefSourceSpan (TypeInstanceRef ss _ _) = ss+declRefSourceSpan (ModuleRef ss _) = ss+declRefSourceSpan (ReExportRef ss _ _) = ss++declRefName :: DeclarationRef -> Name+declRefName (TypeRef _ n _) = TyName n+declRefName (TypeOpRef _ n) = TyOpName n+declRefName (ValueRef _ n) = IdentName n+declRefName (ValueOpRef _ n) = ValOpName n+declRefName (TypeClassRef _ n) = TyClassName n+declRefName (TypeInstanceRef _ n _) = IdentName n+declRefName (ModuleRef _ n) = ModName n+declRefName (ReExportRef _ _ ref) = declRefName ref++getTypeRef :: DeclarationRef -> Maybe (ProperName 'TypeName, Maybe [ProperName 'ConstructorName])+getTypeRef (TypeRef _ name dctors) = Just (name, dctors)+getTypeRef _ = Nothing++getTypeOpRef :: DeclarationRef -> Maybe (OpName 'TypeOpName)+getTypeOpRef (TypeOpRef _ op) = Just op+getTypeOpRef _ = Nothing++getValueRef :: DeclarationRef -> Maybe Ident+getValueRef (ValueRef _ name) = Just name+getValueRef _ = Nothing++getValueOpRef :: DeclarationRef -> Maybe (OpName 'ValueOpName)+getValueOpRef (ValueOpRef _ op) = Just op+getValueOpRef _ = Nothing++getTypeClassRef :: DeclarationRef -> Maybe (ProperName 'ClassName)+getTypeClassRef (TypeClassRef _ name) = Just name+getTypeClassRef _ = Nothing++isModuleRef :: DeclarationRef -> Bool+isModuleRef ModuleRef{} = True+isModuleRef _ = False+ -- | -- The data type which specifies type of import declaration -- data ImportDeclarationType -- |- -- An import with no explicit list: `import M`+ -- An import with no explicit list: `import M`. -- = Implicit -- |@@ -138,8 +306,78 @@ -- An import with a list of references to hide: `import M hiding (foo)` -- | Hiding [DeclarationRef]- deriving (Show, D.Data, D.Typeable)+ deriving (Eq, Show, Generic, Serialise, NFData) +isExplicit :: ImportDeclarationType -> Bool+isExplicit (Explicit _) = True+isExplicit _ = False++-- | A role declaration assigns a list of roles to a type constructor's+-- parameters, e.g.:+--+-- @type role T representational phantom@+--+-- In this example, @T@ is the identifier and @[representational, phantom]@ is+-- the list of roles (@T@ presumably having two parameters).+data RoleDeclarationData = RoleDeclarationData+ { rdeclSourceAnn :: !SourceAnn+ , rdeclIdent :: !(ProperName 'TypeName)+ , rdeclRoles :: ![Role]+ } deriving (Show, Eq, Generic, NFData)++-- | A type declaration assigns a type to an identifier, eg:+--+-- @identity :: forall a. a -> a@+--+-- In this example @identity@ is the identifier and @forall a. a -> a@ the type.+data TypeDeclarationData = TypeDeclarationData+ { tydeclSourceAnn :: !SourceAnn+ , tydeclIdent :: !Ident+ , tydeclType :: !SourceType+ } deriving (Show, Eq, Generic, NFData)++getTypeDeclaration :: Declaration -> Maybe TypeDeclarationData+getTypeDeclaration (TypeDeclaration d) = Just d+getTypeDeclaration _ = Nothing++unwrapTypeDeclaration :: TypeDeclarationData -> (Ident, SourceType)+unwrapTypeDeclaration td = (tydeclIdent td, tydeclType td)++-- | A value declaration assigns a name and potential binders, to an expression (or multiple guarded expressions).+--+-- @double x = x + x@+--+-- In this example @double@ is the identifier, @x@ is a binder and @x + x@ is the expression.+data ValueDeclarationData a = ValueDeclarationData+ { valdeclSourceAnn :: !SourceAnn+ , valdeclIdent :: !Ident+ -- ^ The declared value's name+ , valdeclName :: !NameKind+ -- ^ Whether or not this value is exported/visible+ , valdeclBinders :: ![Binder]+ , valdeclExpression :: !a+ } deriving (Show, Functor, Generic, NFData, Foldable, Traversable)++getValueDeclaration :: Declaration -> Maybe (ValueDeclarationData [GuardedExpr])+getValueDeclaration (ValueDeclaration d) = Just d+getValueDeclaration _ = Nothing++pattern ValueDecl :: SourceAnn -> Ident -> NameKind -> [Binder] -> [GuardedExpr] -> Declaration+pattern ValueDecl sann ident name binders expr+ = ValueDeclaration (ValueDeclarationData sann ident name binders expr)++data DataConstructorDeclaration = DataConstructorDeclaration+ { dataCtorAnn :: !SourceAnn+ , dataCtorName :: !(ProperName 'ConstructorName)+ , dataCtorFields :: ![(Ident, SourceType)]+ } deriving (Show, Eq, Generic, NFData)++mapDataCtorFields :: ([(Ident, SourceType)] -> [(Ident, SourceType)]) -> DataConstructorDeclaration -> DataConstructorDeclaration+mapDataCtorFields f DataConstructorDeclaration{..} = DataConstructorDeclaration { dataCtorFields = f dataCtorFields, .. }++traverseDataCtorFields :: Monad m => ([(Ident, SourceType)] -> m [(Ident, SourceType)]) -> DataConstructorDeclaration -> m DataConstructorDeclaration+traverseDataCtorFields f DataConstructorDeclaration{..} = DataConstructorDeclaration dataCtorAnn dataCtorName <$> f dataCtorFields+ -- | -- The data type of declarations --@@ -147,136 +385,234 @@ -- | -- A data type declaration (data or newtype, name, arguments, data constructors) --- = DataDeclaration DataDeclType ProperName [(String, Maybe Kind)] [(ProperName, [Type])]+ = DataDeclaration SourceAnn DataDeclType (ProperName 'TypeName) [(Text, Maybe SourceType)] [DataConstructorDeclaration] -- | -- A minimal mutually recursive set of data type declarations --- | DataBindingGroupDeclaration [Declaration]+ | DataBindingGroupDeclaration (NEL.NonEmpty Declaration) -- | -- A type synonym declaration (name, arguments, type) --- | TypeSynonymDeclaration ProperName [(String, Maybe Kind)] Type+ | TypeSynonymDeclaration SourceAnn (ProperName 'TypeName) [(Text, Maybe SourceType)] SourceType -- |+ -- A kind signature declaration+ --+ | KindDeclaration SourceAnn KindSignatureFor (ProperName 'TypeName) SourceType+ -- |+ -- A role declaration (name, roles)+ --+ | RoleDeclaration {-# UNPACK #-} !RoleDeclarationData+ -- | -- A type declaration for a value (name, ty) --- | TypeDeclaration Ident Type+ | TypeDeclaration {-# UNPACK #-} !TypeDeclarationData -- | -- A value declaration (name, top-level binders, optional guard, value) --- | ValueDeclaration Ident NameKind [Binder] (Either [(Guard, Expr)] Expr)+ | ValueDeclaration {-# UNPACK #-} !(ValueDeclarationData [GuardedExpr]) -- |+ -- A declaration paired with pattern matching in let-in expression (binder, optional guard, value)+ | BoundValueDeclaration SourceAnn Binder Expr+ -- | -- A minimal mutually recursive set of value declarations --- | BindingGroupDeclaration [(Ident, NameKind, Expr)]+ | BindingGroupDeclaration (NEL.NonEmpty ((SourceAnn, Ident), NameKind, Expr)) -- |- -- A foreign import declaration (type, name, optional inline Javascript, type)+ -- A foreign import declaration (name, type) --- | ExternDeclaration ForeignImportType Ident (Maybe JS) Type+ | ExternDeclaration SourceAnn Ident SourceType -- | -- A data type foreign import (name, kind) --- | ExternDataDeclaration ProperName Kind- -- |- -- A type class instance foreign import- --- | ExternInstanceDeclaration Ident [Constraint] (Qualified ProperName) [Type]+ | ExternDataDeclaration SourceAnn (ProperName 'TypeName) SourceType -- |- -- A fixity declaration (fixity data, operator name)+ -- A fixity declaration --- | FixityDeclaration Fixity String+ | FixityDeclaration SourceAnn (Either ValueFixity TypeFixity) -- | -- A module import (module name, qualified/unqualified/hiding, optional "qualified as" name) --- | ImportDeclaration ModuleName ImportDeclarationType (Maybe ModuleName)+ | ImportDeclaration SourceAnn ModuleName ImportDeclarationType (Maybe ModuleName) -- | -- A type class declaration (name, argument, implies, member declarations) --- | TypeClassDeclaration ProperName [(String, Maybe Kind)] [Constraint] [Declaration]- -- |- -- A type instance declaration (name, dependencies, class name, instance types, member- -- declarations)- --- | TypeInstanceDeclaration Ident [Constraint] (Qualified ProperName) [Type] [Declaration]+ | TypeClassDeclaration SourceAnn (ProperName 'ClassName) [(Text, Maybe SourceType)] [SourceConstraint] [FunctionalDependency] [Declaration] -- |- -- A declaration with source position information+ -- A type instance declaration (instance chain, chain index, name,+ -- dependencies, class name, instance types, member declarations) --- | PositionedDeclaration SourceSpan [Comment] Declaration- deriving (Show, D.Data, D.Typeable)+ -- The first @SourceAnn@ serves as the annotation for the entire+ -- declaration, while the second @SourceAnn@ serves as the+ -- annotation for the type class and its arguments.+ | TypeInstanceDeclaration SourceAnn SourceAnn ChainId Integer (Either Text Ident) [SourceConstraint] (Qualified (ProperName 'ClassName)) [SourceType] TypeInstanceBody+ deriving (Show, Generic, NFData) +data ValueFixity = ValueFixity Fixity (Qualified (Either Ident (ProperName 'ConstructorName))) (OpName 'ValueOpName)+ deriving (Eq, Ord, Show, Generic, NFData)++data TypeFixity = TypeFixity Fixity (Qualified (ProperName 'TypeName)) (OpName 'TypeOpName)+ deriving (Eq, Ord, Show, Generic, NFData)++pattern ValueFixityDeclaration :: SourceAnn -> Fixity -> Qualified (Either Ident (ProperName 'ConstructorName)) -> OpName 'ValueOpName -> Declaration+pattern ValueFixityDeclaration sa fixity name op = FixityDeclaration sa (Left (ValueFixity fixity name op))++pattern TypeFixityDeclaration :: SourceAnn -> Fixity -> Qualified (ProperName 'TypeName) -> OpName 'TypeOpName -> Declaration+pattern TypeFixityDeclaration sa fixity name op = FixityDeclaration sa (Right (TypeFixity fixity name op))++data InstanceDerivationStrategy+ = KnownClassStrategy+ | NewtypeStrategy+ deriving (Show, Generic, NFData)++-- | The members of a type class instance declaration+data TypeInstanceBody+ = DerivedInstance+ -- ^ This is a derived instance+ | NewtypeInstance+ -- ^ This is an instance derived from a newtype+ | ExplicitInstance [Declaration]+ -- ^ This is a regular (explicit) instance+ deriving (Show, Generic, NFData)++mapTypeInstanceBody :: ([Declaration] -> [Declaration]) -> TypeInstanceBody -> TypeInstanceBody+mapTypeInstanceBody f = runIdentity . traverseTypeInstanceBody (Identity . f)++-- | A traversal for TypeInstanceBody+traverseTypeInstanceBody :: (Applicative f) => ([Declaration] -> f [Declaration]) -> TypeInstanceBody -> f TypeInstanceBody+traverseTypeInstanceBody f (ExplicitInstance ds) = ExplicitInstance <$> f ds+traverseTypeInstanceBody _ other = pure other++-- | What sort of declaration the kind signature applies to.+data KindSignatureFor+ = DataSig+ | NewtypeSig+ | TypeSynonymSig+ | ClassSig+ deriving (Eq, Ord, Show, Generic, NFData)++declSourceAnn :: Declaration -> SourceAnn+declSourceAnn (DataDeclaration sa _ _ _ _) = sa+declSourceAnn (DataBindingGroupDeclaration ds) = declSourceAnn (NEL.head ds)+declSourceAnn (TypeSynonymDeclaration sa _ _ _) = sa+declSourceAnn (KindDeclaration sa _ _ _) = sa+declSourceAnn (RoleDeclaration rd) = rdeclSourceAnn rd+declSourceAnn (TypeDeclaration td) = tydeclSourceAnn td+declSourceAnn (ValueDeclaration vd) = valdeclSourceAnn vd+declSourceAnn (BoundValueDeclaration sa _ _) = sa+declSourceAnn (BindingGroupDeclaration ds) = let ((sa, _), _, _) = NEL.head ds in sa+declSourceAnn (ExternDeclaration sa _ _) = sa+declSourceAnn (ExternDataDeclaration sa _ _) = sa+declSourceAnn (FixityDeclaration sa _) = sa+declSourceAnn (ImportDeclaration sa _ _ _) = sa+declSourceAnn (TypeClassDeclaration sa _ _ _ _ _) = sa+declSourceAnn (TypeInstanceDeclaration sa _ _ _ _ _ _ _ _) = sa++declSourceSpan :: Declaration -> SourceSpan+declSourceSpan = fst . declSourceAnn++-- Note: Kind Declarations' names can refer to either a `TyClassName`+-- or a `TypeName`. Use a helper function for handling `KindDeclaration`s+-- specifically in the context in which it is needed.+declName :: Declaration -> Maybe Name+declName (DataDeclaration _ _ n _ _) = Just (TyName n)+declName (TypeSynonymDeclaration _ n _ _) = Just (TyName n)+declName (ValueDeclaration vd) = Just (IdentName (valdeclIdent vd))+declName (ExternDeclaration _ n _) = Just (IdentName n)+declName (ExternDataDeclaration _ n _) = Just (TyName n)+declName (FixityDeclaration _ (Left (ValueFixity _ _ n))) = Just (ValOpName n)+declName (FixityDeclaration _ (Right (TypeFixity _ _ n))) = Just (TyOpName n)+declName (TypeClassDeclaration _ n _ _ _ _) = Just (TyClassName n)+declName (TypeInstanceDeclaration _ _ _ _ n _ _ _ _) = IdentName <$> hush n+declName (RoleDeclaration RoleDeclarationData{..}) = Just (TyName rdeclIdent)+declName ImportDeclaration{} = Nothing+declName BindingGroupDeclaration{} = Nothing+declName DataBindingGroupDeclaration{} = Nothing+declName BoundValueDeclaration{} = Nothing+declName KindDeclaration{} = Nothing+declName TypeDeclaration{} = Nothing+ -- | -- Test if a declaration is a value declaration -- isValueDecl :: Declaration -> Bool isValueDecl ValueDeclaration{} = True-isValueDecl (PositionedDeclaration _ _ d) = isValueDecl d isValueDecl _ = False -- |--- Test if a declaration is a data type or type synonym declaration+-- Test if a declaration is a data type declaration -- isDataDecl :: Declaration -> Bool isDataDecl DataDeclaration{} = True-isDataDecl TypeSynonymDeclaration{} = True-isDataDecl (PositionedDeclaration _ _ d) = isDataDecl d isDataDecl _ = False -- |+-- Test if a declaration is a type synonym declaration+--+isTypeSynonymDecl :: Declaration -> Bool+isTypeSynonymDecl TypeSynonymDeclaration{} = True+isTypeSynonymDecl _ = False++-- | -- Test if a declaration is a module import -- isImportDecl :: Declaration -> Bool isImportDecl ImportDeclaration{} = True-isImportDecl (PositionedDeclaration _ _ d) = isImportDecl d isImportDecl _ = False -- |+-- Test if a declaration is a role declaration+--+isRoleDecl :: Declaration -> Bool+isRoleDecl RoleDeclaration{} = True+isRoleDecl _ = False++-- | -- Test if a declaration is a data type foreign import -- isExternDataDecl :: Declaration -> Bool isExternDataDecl ExternDataDeclaration{} = True-isExternDataDecl (PositionedDeclaration _ _ d) = isExternDataDecl d isExternDataDecl _ = False -- |--- Test if a declaration is a type class instance foreign import----isExternInstanceDecl :: Declaration -> Bool-isExternInstanceDecl ExternInstanceDeclaration{} = True-isExternInstanceDecl (PositionedDeclaration _ _ d) = isExternInstanceDecl d-isExternInstanceDecl _ = False---- | -- Test if a declaration is a fixity declaration -- isFixityDecl :: Declaration -> Bool isFixityDecl FixityDeclaration{} = True-isFixityDecl (PositionedDeclaration _ _ d) = isFixityDecl d isFixityDecl _ = False +getFixityDecl :: Declaration -> Maybe (Either ValueFixity TypeFixity)+getFixityDecl (FixityDeclaration _ fixity) = Just fixity+getFixityDecl _ = Nothing+ -- | -- Test if a declaration is a foreign import -- isExternDecl :: Declaration -> Bool isExternDecl ExternDeclaration{} = True-isExternDecl (PositionedDeclaration _ _ d) = isExternDecl d isExternDecl _ = False -- | -- Test if a declaration is a type class instance declaration ---isTypeClassInstanceDeclaration :: Declaration -> Bool-isTypeClassInstanceDeclaration TypeInstanceDeclaration{} = True-isTypeClassInstanceDeclaration (PositionedDeclaration _ _ d) = isTypeClassInstanceDeclaration d-isTypeClassInstanceDeclaration _ = False+isTypeClassInstanceDecl :: Declaration -> Bool+isTypeClassInstanceDecl TypeInstanceDeclaration{} = True+isTypeClassInstanceDecl _ = False -- | -- Test if a declaration is a type class declaration ---isTypeClassDeclaration :: Declaration -> Bool-isTypeClassDeclaration TypeClassDeclaration{} = True-isTypeClassDeclaration (PositionedDeclaration _ _ d) = isTypeClassDeclaration d-isTypeClassDeclaration _ = False+isTypeClassDecl :: Declaration -> Bool+isTypeClassDecl TypeClassDeclaration{} = True+isTypeClassDecl _ = False -- |+-- Test if a declaration is a kind signature declaration.+--+isKindDecl :: Declaration -> Bool+isKindDecl KindDeclaration{} = True+isKindDecl _ = False++-- | -- Recursively flatten data binding groups in the list of declarations flattenDecls :: [Declaration] -> [Declaration] flattenDecls = concatMap flattenOne@@ -287,28 +623,31 @@ -- | -- A guard is just a boolean-valued expression that appears alongside a set of binders ---type Guard = Expr+data Guard = ConditionGuard Expr+ | PatternGuard Binder Expr+ deriving (Show, Generic, NFData) -- |+-- The right hand side of a binder in value declarations+-- and case expressions.+data GuardedExpr = GuardedExpr [Guard] Expr+ deriving (Show, Generic, NFData)++pattern MkUnguarded :: Expr -> GuardedExpr+pattern MkUnguarded e = GuardedExpr [] e++-- | -- Data type for expressions and terms -- data Expr -- |- -- A numeric literal- --- = NumericLiteral (Either Integer Double)- -- |- -- A string literal- --- | StringLiteral String- -- |- -- A boolean literal+ -- A literal value --- | BooleanLiteral Bool+ = Literal SourceSpan (Literal Expr) -- | -- A prefix -, will be desugared --- | UnaryMinus Expr+ | UnaryMinus SourceSpan Expr -- | -- Binary operator application. During the rebracketing phase of desugaring, this data constructor -- will be removed.@@ -318,63 +657,60 @@ -- Explicit parentheses. During the rebracketing phase of desugaring, this data constructor -- will be removed. --- | Parens Expr- -- |- -- Operator section. This will be removed during desugaring and replaced with a partially applied- -- operator or lambda to flip the arguments.- --- | OperatorSection Expr (Either Expr Expr)- -- |- -- An array literal- --- | ArrayLiteral [Expr]- -- |- -- An object literal- --- | ObjectLiteral [(String, Expr)]- -- |- -- An object constructor (object literal with underscores). This will be removed during- -- desugaring and expanded into a lambda that returns an object literal.- --- | ObjectConstructor [(String, Maybe Expr)]- -- |- -- An object property getter (e.g. `_.x`). This will be removed during- -- desugaring and expanded into a lambda that reads a property from an object.+ -- Note: although it seems this constructor is not used, it _is_ useful, since it prevents+ -- certain traversals from matching. --- | ObjectGetter String+ | Parens Expr -- |- -- An record property accessor expression+ -- An record property accessor expression (e.g. `obj.x` or `_.x`).+ -- Anonymous arguments will be removed during desugaring and expanded+ -- into a lambda that reads a property from a record. --- | Accessor String Expr+ | Accessor PSString Expr -- | -- Partial record update --- | ObjectUpdate Expr [(String, Expr)]+ | ObjectUpdate Expr [(PSString, Expr)] -- |- -- Partial record updater. This will be removed during desugaring and- -- expanded into a lambda that returns an object update.+ -- Object updates with nested support: `x { foo { bar = e } }`+ -- Replaced during desugaring into a `Let` and nested `ObjectUpdate`s --- | ObjectUpdater (Maybe Expr) [(String, Maybe Expr)]+ | ObjectUpdateNested Expr (PathTree Expr) -- | -- Function introduction --- | Abs (Either Ident Binder) Expr+ | Abs Binder Expr -- | -- Function application -- | App Expr Expr -- |+ -- A type application (e.g. `f @Int`)+ --+ | VisibleTypeApp Expr SourceType+ -- |+ -- Hint that an expression is unused.+ -- This is used to ignore type class dictionaries that are necessarily empty.+ -- The inner expression lets us solve subgoals before eliminating the whole expression.+ -- The code gen will render this as `undefined`, regardless of what the inner expression is.+ | Unused Expr+ -- | -- Variable --- | Var (Qualified Ident)+ | Var SourceSpan (Qualified Ident) -- |+ -- An operator. This will be desugared into a function during the "operators"+ -- phase of desugaring.+ --+ | Op SourceSpan (Qualified (OpName 'ValueOpName))+ -- | -- Conditional (if-then-else expression) -- | IfThenElse Expr Expr Expr -- | -- A data constructor --- | Constructor (Qualified ProperName)+ | Constructor SourceSpan (Qualified (ProperName 'ConstructorName)) -- | -- A case expression. During the case expansion phase of desugaring, top-level binders will get -- desugared into case expressions, hence the need for guards and multiple binders per branch here.@@ -383,20 +719,19 @@ -- | -- A value with a type annotation --- | TypedValue Bool Expr Type+ | TypedValue Bool Expr SourceType -- | -- A let binding --- | Let [Declaration] Expr+ | Let WhereProvenance [Declaration] Expr -- | -- A do-notation block --- | Do [DoNotationElement]+ | Do (Maybe ModuleName) [DoNotationElement] -- |- -- An application of a typeclass dictionary constructor. The value should be- -- an ObjectLiteral.+ -- An ado-notation block --- | TypeClassDictionaryConstructorApp (Qualified ProperName) Expr+ | Ado (Maybe ModuleName) [DoNotationElement] Expr -- | -- A placeholder for a type class dictionary to be inserted later. At the end of type checking, these -- placeholders will be replaced with actual expressions representing type classes dictionaries which@@ -404,21 +739,46 @@ -- at superclass implementations when searching for a dictionary, the type class name and -- instance type, and the type class dictionaries in scope. --- | TypeClassDictionary Bool Constraint [TypeClassDictionaryInScope]+ | TypeClassDictionary SourceConstraint+ (M.Map QualifiedBy (M.Map (Qualified (ProperName 'ClassName)) (M.Map (Qualified Ident) (NEL.NonEmpty NamedDict))))+ [ErrorMessageHint] -- |- -- A typeclass dictionary accessor, the implementation is left unspecified until CoreFn desugaring.+ -- A placeholder for a superclass dictionary to be turned into a TypeClassDictionary during typechecking --- | TypeClassDictionaryAccessor (Qualified ProperName) Ident+ | DeferredDictionary (Qualified (ProperName 'ClassName)) [SourceType] -- |- -- A placeholder for a superclass dictionary to be turned into a TypeClassDictionary during typechecking+ -- A placeholder for a type class instance to be derived during typechecking --- | SuperClassDictionary (Qualified ProperName) [Type]+ | DerivedInstancePlaceholder (Qualified (ProperName 'ClassName)) InstanceDerivationStrategy -- |+ -- A placeholder for an anonymous function argument+ --+ | AnonymousArgument+ -- |+ -- A typed hole that will be turned into a hint/error during typechecking+ --+ | Hole Text+ -- | -- A value with source position information --- | PositionedValue SourceSpan [Comment] Expr deriving (Show, D.Data, D.Typeable)+ | PositionedValue SourceSpan [Comment] Expr+ deriving (Show, Generic, NFData) -- |+-- Metadata that tells where a let binding originated+--+data WhereProvenance+ -- |+ -- The let binding was originally a where clause+ --+ = FromWhere+ -- |+ -- The let binding was always a let binding+ --+ | FromLet+ deriving (Show, Generic, NFData)++-- | -- An alternative in a case statement -- data CaseAlternative = CaseAlternative@@ -429,8 +789,8 @@ -- | -- The result expression or a collect of guarded expressions --- , caseAlternativeResult :: Either [(Guard, Expr)] Expr- } deriving (Show, D.Data, D.Typeable)+ , caseAlternativeResult :: [GuardedExpr]+ } deriving (Show, Generic, NFData) -- | -- A statement in a do-notation block@@ -451,4 +811,58 @@ -- | -- A do notation element with source position information --- | PositionedDoNotationElement SourceSpan [Comment] DoNotationElement deriving (Show, D.Data, D.Typeable)+ | PositionedDoNotationElement SourceSpan [Comment] DoNotationElement+ deriving (Show, Generic, NFData)+++-- For a record update such as:+--+-- x { foo = 0+-- , bar { baz = 1+-- , qux = 2 } }+--+-- We represent the updates as the `PathTree`:+--+-- [ ("foo", Leaf 3)+-- , ("bar", Branch [ ("baz", Leaf 1)+-- , ("qux", Leaf 2) ]) ]+--+-- Which we then convert to an expression representing the following:+--+-- let x' = x+-- in x' { foo = 0+-- , bar = x'.bar { baz = 1+-- , qux = 2 } }+--+-- The `let` here is required to prevent re-evaluating the object expression `x`.+-- However we don't generate this when using an anonymous argument for the object.+--++newtype PathTree t = PathTree (AssocList PSString (PathNode t))+ deriving (Show, Eq, Ord, Functor, Foldable, Traversable)+ deriving newtype NFData++data PathNode t = Leaf t | Branch (PathTree t)+ deriving (Show, Eq, Ord, Generic, NFData, Functor, Foldable, Traversable)++newtype AssocList k t = AssocList { runAssocList :: [(k, t)] }+ deriving (Show, Eq, Ord, Foldable, Functor, Traversable)+ deriving newtype NFData++$(deriveJSON (defaultOptions { sumEncoding = ObjectWithSingleField }) ''NameSource)+$(deriveJSON (defaultOptions { sumEncoding = ObjectWithSingleField }) ''ExportSource)+$(deriveJSON (defaultOptions { sumEncoding = ObjectWithSingleField }) ''DeclarationRef)+$(deriveJSON (defaultOptions { sumEncoding = ObjectWithSingleField }) ''ImportDeclarationType)++isTrueExpr :: Expr -> Bool+isTrueExpr (Literal _ (BooleanLiteral True)) = True+isTrueExpr (Var _ (Qualified (ByModuleName (ModuleName "Prelude")) (Ident "otherwise"))) = True+isTrueExpr (Var _ (Qualified (ByModuleName (ModuleName "Data.Boolean")) (Ident "otherwise"))) = True+isTrueExpr (TypedValue _ e _) = isTrueExpr e+isTrueExpr (PositionedValue _ _ e) = isTrueExpr e+isTrueExpr _ = False++isAnonymousArgument :: Expr -> Bool+isAnonymousArgument AnonymousArgument = True+isAnonymousArgument (PositionedValue _ _ e) = isAnonymousArgument e+isAnonymousArgument _ = False
+ src/Language/PureScript/AST/Declarations/ChainId.hs view
@@ -0,0 +1,20 @@+module Language.PureScript.AST.Declarations.ChainId+ ( ChainId+ , mkChainId+ ) where++import Prelude+import Language.PureScript.AST.SourcePos qualified as Pos+import Control.DeepSeq (NFData)+import Codec.Serialise (Serialise)++-- |+-- For a given instance chain, stores the chain's file name and+-- the starting source pos of the first instance in the chain.+-- This data is used to determine which instances are part of+-- the same instance chain.+newtype ChainId = ChainId (String, Pos.SourcePos)+ deriving (Eq, Ord, Show, NFData, Serialise)++mkChainId :: String -> Pos.SourcePos -> ChainId+mkChainId fileName startingSourcePos = ChainId (fileName, startingSourcePos)
+ src/Language/PureScript/AST/Exported.hs view
@@ -0,0 +1,173 @@+module Language.PureScript.AST.Exported+ ( exportedDeclarations+ , isExported+ ) where++import Prelude+import Protolude (sortOn)++import Control.Category ((>>>))+import Control.Applicative ((<|>))++import Data.Maybe (mapMaybe)+import Data.Map qualified as M++import Language.PureScript.AST.Declarations (DataConstructorDeclaration(..), Declaration(..), DeclarationRef(..), Module(..), declName, declRefName, flattenDecls)+import Language.PureScript.Types (Constraint(..), Type(..), everythingOnTypes)+import Language.PureScript.Names (ModuleName, Name(..), ProperName, ProperNameType(..), Qualified, coerceProperName, disqualify, isQualified, isQualifiedWith)++-- |+-- Return a list of all declarations which are exported from a module.+-- This function descends into data declarations to filter out unexported+-- data constructors, and also filters out type instance declarations if+-- they refer to classes or types which are not themselves exported.+--+-- Note that this function assumes that the module has already had its imports+-- desugared using 'Language.PureScript.Sugar.Names.desugarImports'. It will+-- produce incorrect results if this is not the case - for example, type class+-- instances will be incorrectly removed in some cases.+--+-- The returned declarations are in the same order as they appear in the export+-- list, unless there is no export list, in which case they appear in the same+-- order as they do in the source file.+--+-- Kind signatures declarations are also exported if their associated+-- declaration is exported.+exportedDeclarations :: Module -> [Declaration]+exportedDeclarations (Module _ _ mn decls exps) = go decls+ where+ go = flattenDecls+ >>> filter (isExported exps)+ >>> map (filterDataConstructors exps)+ >>> filterInstances mn exps+ >>> maybe id reorder exps++-- |+-- Filter out all data constructors from a declaration which are not exported.+-- If the supplied declaration is not a data declaration, this function returns+-- it unchanged.+--+filterDataConstructors :: Maybe [DeclarationRef] -> Declaration -> Declaration+filterDataConstructors exps (DataDeclaration sa dType tyName tyArgs dctors) =+ DataDeclaration sa dType tyName tyArgs $+ filter (isDctorExported tyName exps . dataCtorName) dctors+filterDataConstructors _ other = other++-- |+-- Filter out all the type instances from a list of declarations which+-- reference a type or type class which is both local and not exported.+--+-- Note that this function assumes that the module has already had its imports+-- desugared using "Language.PureScript.Sugar.Names.desugarImports". It will+-- produce incorrect results if this is not the case - for example, type class+-- instances will be incorrectly removed in some cases.+--+filterInstances+ :: ModuleName+ -> Maybe [DeclarationRef]+ -> [Declaration]+ -> [Declaration]+filterInstances _ Nothing = id+filterInstances mn (Just exps) =+ let refs = Left `map` mapMaybe typeClassName exps+ ++ Right `map` mapMaybe typeName exps+ in filter (all (visibleOutside refs) . typeInstanceConstituents)+ where+ -- Given a Qualified ProperName, and a list of all exported types and type+ -- classes, returns whether the supplied Qualified ProperName is visible+ -- outside this module. This is true if one of the following hold:+ --+ -- * the name is defined in the same module and is exported,+ -- * the name is defined in a different module (and must be exported from+ -- that module; the code would fail to compile otherwise).+ visibleOutside+ :: [Either (ProperName 'ClassName) (ProperName 'TypeName)]+ -> Either (Qualified (ProperName 'ClassName)) (Qualified (ProperName 'TypeName))+ -> Bool+ visibleOutside refs q+ | either checkQual checkQual q = True+ | otherwise = either (Left . disqualify) (Right . disqualify) q `elem` refs++ -- Check that a qualified name is qualified for a different module+ checkQual :: Qualified a -> Bool+ checkQual q = isQualified q && not (isQualifiedWith mn q)++ typeName :: DeclarationRef -> Maybe (ProperName 'TypeName)+ typeName (TypeRef _ n _) = Just n+ typeName _ = Nothing++ typeClassName :: DeclarationRef -> Maybe (ProperName 'ClassName)+ typeClassName (TypeClassRef _ n) = Just n+ typeClassName _ = Nothing++-- |+-- Get all type and type class names referenced by a type instance declaration.+--+typeInstanceConstituents :: Declaration -> [Either (Qualified (ProperName 'ClassName)) (Qualified (ProperName 'TypeName))]+typeInstanceConstituents (TypeInstanceDeclaration _ _ _ _ _ constraints className tys _) =+ Left className : (concatMap fromConstraint constraints ++ concatMap fromType tys)+ where++ fromConstraint c = Left (constraintClass c) : concatMap fromType (constraintArgs c)+ fromType = everythingOnTypes (++) go++ -- Note that type synonyms are disallowed in instance declarations, so+ -- we don't need to handle them here.+ go (TypeConstructor _ n) = [Right n]+ go (ConstrainedType _ c _) = fromConstraint c+ go _ = []++typeInstanceConstituents _ = []+++-- |+-- Test if a declaration is exported, given a module's export list. Note that+-- this function does not account for type instance declarations of+-- non-exported types, or non-exported data constructors. Therefore, you should+-- prefer 'exportedDeclarations' to this function, where possible.+--+isExported :: Maybe [DeclarationRef] -> Declaration -> Bool+isExported Nothing _ = True+isExported _ TypeInstanceDeclaration{} = True+isExported (Just exps) (KindDeclaration _ _ n _) = any matches exps+ where+ matches declRef = do+ let refName = declRefName declRef+ TyName n == refName || TyClassName (tyToClassName n) == refName+isExported (Just exps) decl = any matches exps+ where+ matches declRef = declName decl == Just (declRefName declRef)++-- |+-- Test if a data constructor for a given type is exported, given a module's+-- export list. Prefer 'exportedDeclarations' to this function, where possible.+--+isDctorExported :: ProperName 'TypeName -> Maybe [DeclarationRef] -> ProperName 'ConstructorName -> Bool+isDctorExported _ Nothing _ = True+isDctorExported ident (Just exps) ctor = test `any` exps+ where+ test (TypeRef _ ident' Nothing) = ident == ident'+ test (TypeRef _ ident' (Just ctors)) = ident == ident' && ctor `elem` ctors+ test _ = False++-- |+-- Reorder declarations based on the order they appear in the given export+-- list.+--+reorder :: [DeclarationRef] -> [Declaration] -> [Declaration]+reorder refs =+ sortOn refIndex+ where+ refIndices =+ M.fromList $ zip (map declRefName refs) [(0::Int)..]+ refIndex = \case+ KindDeclaration _ _ n _ ->+ M.lookup (TyName n) refIndices <|> M.lookup (TyClassName (tyToClassName n)) refIndices++ decl -> declName decl >>= flip M.lookup refIndices++-- |+-- Workaround to the fact that a `KindDeclaration`'s name's `ProperNameType`+-- isn't the same as the corresponding `TypeClassDeclaration`'s `ProperNameType`+tyToClassName :: ProperName 'TypeName -> ProperName 'ClassName+tyToClassName = coerceProperName
+ src/Language/PureScript/AST/Literals.hs view
@@ -0,0 +1,41 @@+{-# LANGUAGE DeriveAnyClass #-}+-- |+-- The core functional representation for literal values.+--+module Language.PureScript.AST.Literals where++import Prelude+import Control.DeepSeq (NFData)+import GHC.Generics (Generic)+import Language.PureScript.PSString (PSString)++-- |+-- Data type for literal values. Parameterised so it can be used for Exprs and+-- Binders.+--+data Literal a+ -- |+ -- A numeric literal+ --+ = NumericLiteral (Either Integer Double)+ -- |+ -- A string literal+ --+ | StringLiteral PSString+ -- |+ -- A character literal+ --+ | CharLiteral Char+ -- |+ -- A boolean literal+ --+ | BooleanLiteral Bool+ -- |+ -- An array literal+ --+ | ArrayLiteral [a]+ -- |+ -- An object literal+ --+ | ObjectLiteral [(PSString, a)]+ deriving (Eq, Ord, Show, Functor, Generic, NFData)
src/Language/PureScript/AST/Operators.hs view
@@ -1,22 +1,17 @@------------------------------------------------------------------------------------ Module : Language.PureScript.AST.Operators--- Copyright : (c) 2013-14 Phil Freeman, (c) 2014 Gary Burgess, and other contributors--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ | Operators fixity and associativity+-- |+-- Operators fixity and associativity --------------------------------------------------------------------------------+module Language.PureScript.AST.Operators where -{-# LANGUAGE DeriveDataTypeable #-}+import Prelude -module Language.PureScript.AST.Operators where+import Codec.Serialise (Serialise)+import GHC.Generics (Generic)+import Control.DeepSeq (NFData)+import Data.Aeson ((.=))+import Data.Aeson qualified as A -import qualified Data.Data as D+import Language.PureScript.Crash (internalError) -- | -- A precedence level for an infix operator@@ -26,14 +21,40 @@ -- | -- Associativity for infix operators ---data Associativity = Infixl | Infixr | Infix deriving (D.Data, D.Typeable)+data Associativity = Infixl | Infixr | Infix+ deriving (Show, Eq, Ord, Generic) -instance Show Associativity where- show Infixl = "infixl"- show Infixr = "infixr"- show Infix = "infix"+instance NFData Associativity+instance Serialise Associativity +showAssoc :: Associativity -> String+showAssoc Infixl = "infixl"+showAssoc Infixr = "infixr"+showAssoc Infix = "infix"++readAssoc :: String -> Associativity+readAssoc "infixl" = Infixl+readAssoc "infixr" = Infixr+readAssoc "infix" = Infix+readAssoc _ = internalError "readAssoc: no parse"++instance A.ToJSON Associativity where+ toJSON = A.toJSON . showAssoc++instance A.FromJSON Associativity where+ parseJSON = fmap readAssoc . A.parseJSON+ -- | -- Fixity data for infix operators ---data Fixity = Fixity Associativity Precedence deriving (Show, D.Data, D.Typeable)+data Fixity = Fixity Associativity Precedence+ deriving (Show, Eq, Ord, Generic)++instance NFData Fixity+instance Serialise Fixity++instance A.ToJSON Fixity where+ toJSON (Fixity associativity precedence) =+ A.object [ "associativity" .= associativity+ , "precedence" .= precedence+ ]
src/Language/PureScript/AST/SourcePos.hs view
@@ -1,53 +1,118 @@------------------------------------------------------------------------------------ Module : Language.PureScript.AST.SourcePos--- Copyright : (c) 2013-14 Phil Freeman, (c) 2014 Gary Burgess, and other contributors--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ | Source position information+{-# LANGUAGE DeriveAnyClass #-}+-- |+-- Source position information --------------------------------------------------------------------------------+module Language.PureScript.AST.SourcePos where -{-# LANGUAGE DeriveDataTypeable, ScopedTypeVariables #-}+import Prelude -module Language.PureScript.AST.SourcePos where+import Codec.Serialise (Serialise)+import Control.DeepSeq (NFData)+import Data.Aeson ((.=), (.:))+import Data.Text (Text)+import GHC.Generics (Generic)+import Language.PureScript.Comments (Comment)+import Data.Aeson qualified as A+import Data.Text qualified as T+import System.FilePath (makeRelative) -import qualified Data.Data as D+-- | Source annotation - position information and comments.+type SourceAnn = (SourceSpan, [Comment]) --- |--- Source position information---+-- | Source position information data SourcePos = SourcePos- { -- |- -- Line number- --- sourcePosLine :: Int- -- |- -- Column number- --+ { sourcePosLine :: Int+ -- ^ Line number , sourcePosColumn :: Int- } deriving (Eq, D.Data, D.Typeable)+ -- ^ Column number+ } deriving (Show, Eq, Ord, Generic, NFData, Serialise) -instance Show SourcePos where- show sp = "line " ++ show (sourcePosLine sp) ++ ", column " ++ show (sourcePosColumn sp)+displaySourcePos :: SourcePos -> Text+displaySourcePos sp =+ "line " <> T.pack (show (sourcePosLine sp)) <>+ ", column " <> T.pack (show (sourcePosColumn sp)) +displaySourcePosShort :: SourcePos -> Text+displaySourcePosShort sp =+ T.pack (show (sourcePosLine sp)) <>+ ":" <> T.pack (show (sourcePosColumn sp))++instance A.ToJSON SourcePos where+ toJSON SourcePos{..} =+ A.toJSON [sourcePosLine, sourcePosColumn]++instance A.FromJSON SourcePos where+ parseJSON arr = do+ [line, col] <- A.parseJSON arr+ return $ SourcePos line col+ data SourceSpan = SourceSpan- { -- |- -- Source name- --- spanName :: String- -- |- -- Start of the span- --+ { spanName :: String+ -- ^ Source name , spanStart :: SourcePos- -- End of the span- --+ -- ^ Start of the span , spanEnd :: SourcePos- } deriving (Eq, D.Data, D.Typeable)+ -- ^ End of the span+ } deriving (Show, Eq, Ord, Generic, NFData, Serialise) -instance Show SourceSpan where- show sp = spanName sp ++ " " ++ show (spanStart sp) ++ " - " ++ show (spanEnd sp)+displayStartEndPos :: SourceSpan -> Text+displayStartEndPos sp =+ "(" <>+ displaySourcePos (spanStart sp) <> " - " <>+ displaySourcePos (spanEnd sp) <> ")"++displayStartEndPosShort :: SourceSpan -> Text+displayStartEndPosShort sp =+ displaySourcePosShort (spanStart sp) <> " - " <>+ displaySourcePosShort (spanEnd sp)++displaySourceSpan :: FilePath -> SourceSpan -> Text+displaySourceSpan relPath sp =+ T.pack (makeRelative relPath (spanName sp)) <> ":" <>+ displayStartEndPosShort sp <> " " <>+ displayStartEndPos sp++instance A.ToJSON SourceSpan where+ toJSON SourceSpan{..} =+ A.object [ "name" .= spanName+ , "start" .= spanStart+ , "end" .= spanEnd+ ]++instance A.FromJSON SourceSpan where+ parseJSON = A.withObject "SourceSpan" $ \o ->+ SourceSpan <$>+ o .: "name" <*>+ o .: "start" <*>+ o .: "end"++internalModuleSourceSpan :: String -> SourceSpan+internalModuleSourceSpan name = SourceSpan name (SourcePos 0 0) (SourcePos 0 0)++nullSourceSpan :: SourceSpan+nullSourceSpan = internalModuleSourceSpan ""++nullSourceAnn :: SourceAnn+nullSourceAnn = (nullSourceSpan, [])++pattern NullSourceSpan :: SourceSpan+pattern NullSourceSpan = SourceSpan "" (SourcePos 0 0) (SourcePos 0 0)++pattern NullSourceAnn :: SourceAnn+pattern NullSourceAnn = (NullSourceSpan, [])++nonEmptySpan :: SourceAnn -> Maybe SourceSpan+nonEmptySpan (NullSourceSpan, _) = Nothing+nonEmptySpan (ss, _) = Just ss++widenSourceSpan :: SourceSpan -> SourceSpan -> SourceSpan+widenSourceSpan NullSourceSpan b = b+widenSourceSpan a NullSourceSpan = a+widenSourceSpan (SourceSpan n1 s1 e1) (SourceSpan n2 s2 e2) =+ SourceSpan n (min s1 s2) (max e1 e2)+ where+ n | n1 == "" = n2+ | otherwise = n1++widenSourceAnn :: SourceAnn -> SourceAnn -> SourceAnn+widenSourceAnn (s1, _) (s2, _) = (widenSourceSpan s1 s2, [])
src/Language/PureScript/AST/Traversals.hs view
@@ -1,407 +1,721 @@------------------------------------------------------------------------------------ Module : Language.PureScript.AST.Traversals--- Copyright : (c) 2013-14 Phil Freeman, (c) 2014 Gary Burgess, and other contributors--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ | AST traversal helpers+-- |+-- AST traversal helpers --------------------------------------------------------------------------------- module Language.PureScript.AST.Traversals where -import Data.Monoid (Monoid(..), mconcat)+import Prelude+import Protolude (swap)++import Control.Monad ((<=<), (>=>))+import Control.Monad.Trans.State (StateT(..))++import Data.Foldable (fold)+import Data.Functor.Identity (runIdentity)+import Data.List (mapAccumL) import Data.Maybe (mapMaybe)+import Data.List.NonEmpty qualified as NEL+import Data.Map qualified as M+import Data.Set qualified as S -import Control.Applicative-import Control.Monad-import Control.Arrow ((***), (+++), second)+import Language.PureScript.AST.Binders (Binder(..), binderNames)+import Language.PureScript.AST.Declarations (CaseAlternative(..), DataConstructorDeclaration(..), Declaration(..), DoNotationElement(..), Expr(..), Guard(..), GuardedExpr(..), TypeDeclarationData(..), TypeInstanceBody(..), pattern ValueDecl, ValueDeclarationData(..), mapTypeInstanceBody, traverseTypeInstanceBody)+import Language.PureScript.AST.Literals (Literal(..))+import Language.PureScript.Names (pattern ByNullSourcePos, Ident)+import Language.PureScript.Traversals (sndM, sndM', thirdM)+import Language.PureScript.TypeClassDictionaries (TypeClassDictionaryInScope(..))+import Language.PureScript.Types (Constraint(..), SourceType, mapConstraintArgs) -import Language.PureScript.AST.Binders-import Language.PureScript.AST.Declarations-import Language.PureScript.Types-import Language.PureScript.Traversals+guardedExprM :: Applicative m+ => (Guard -> m Guard)+ -> (Expr -> m Expr)+ -> GuardedExpr+ -> m GuardedExpr+guardedExprM f g (GuardedExpr guards rhs) =+ GuardedExpr <$> traverse f guards <*> g rhs -everywhereOnValues :: (Declaration -> Declaration) ->- (Expr -> Expr) ->- (Binder -> Binder) ->- (Declaration -> Declaration, Expr -> Expr, Binder -> Binder)+mapGuardedExpr :: (Guard -> Guard)+ -> (Expr -> Expr)+ -> GuardedExpr+ -> GuardedExpr+mapGuardedExpr f g (GuardedExpr guards rhs) =+ GuardedExpr (fmap f guards) (g rhs)++litM :: Monad m => (a -> m a) -> Literal a -> m (Literal a)+litM go (ObjectLiteral as) = ObjectLiteral <$> traverse (sndM go) as+litM go (ArrayLiteral as) = ArrayLiteral <$> traverse go as+litM _ other = pure other++everywhereOnValues+ :: (Declaration -> Declaration)+ -> (Expr -> Expr)+ -> (Binder -> Binder)+ -> ( Declaration -> Declaration+ , Expr -> Expr+ , Binder -> Binder+ ) everywhereOnValues f g h = (f', g', h') where f' :: Declaration -> Declaration- f' (DataBindingGroupDeclaration ds) = f (DataBindingGroupDeclaration (map f' ds))- f' (ValueDeclaration name nameKind bs val) = f (ValueDeclaration name nameKind (map h' bs) ((map (g' *** g') +++ g') val))- f' (BindingGroupDeclaration ds) = f (BindingGroupDeclaration (map (\(name, nameKind, val) -> (name, nameKind, g' val)) ds))- f' (TypeClassDeclaration name args implies ds) = f (TypeClassDeclaration name args implies (map f' ds))- f' (TypeInstanceDeclaration name cs className args ds) = f (TypeInstanceDeclaration name cs className args (map f' ds))- f' (PositionedDeclaration pos com d) = f (PositionedDeclaration pos com (f' d))+ f' (DataBindingGroupDeclaration ds) = f (DataBindingGroupDeclaration (fmap f' ds))+ f' (ValueDecl sa name nameKind bs val) =+ f (ValueDecl sa name nameKind (fmap h' bs) (fmap (mapGuardedExpr handleGuard g') val))+ f' (BoundValueDeclaration sa b expr) = f (BoundValueDeclaration sa (h' b) (g' expr))+ f' (BindingGroupDeclaration ds) = f (BindingGroupDeclaration (fmap (\(name, nameKind, val) -> (name, nameKind, g' val)) ds))+ f' (TypeClassDeclaration sa name args implies deps ds) = f (TypeClassDeclaration sa name args implies deps (fmap f' ds))+ f' (TypeInstanceDeclaration sa na ch idx name cs className args ds) = f (TypeInstanceDeclaration sa na ch idx name cs className args (mapTypeInstanceBody (fmap f') ds)) f' other = f other g' :: Expr -> Expr- g' (UnaryMinus v) = g (UnaryMinus (g' v))+ g' (Literal ss l) = g (Literal ss (lit g' l))+ g' (UnaryMinus ss v) = g (UnaryMinus ss (g' v)) g' (BinaryNoParens op v1 v2) = g (BinaryNoParens (g' op) (g' v1) (g' v2)) g' (Parens v) = g (Parens (g' v))- g' (OperatorSection op (Left v)) = g (OperatorSection (g' op) (Left $ g' v))- g' (OperatorSection op (Right v)) = g (OperatorSection (g' op) (Right $ g' v))- g' (ArrayLiteral vs) = g (ArrayLiteral (map g' vs))- g' (ObjectLiteral vs) = g (ObjectLiteral (map (fmap g') vs))- g' (ObjectConstructor vs) = g (ObjectConstructor (map (second (fmap g')) vs))- g' (TypeClassDictionaryConstructorApp name v) = g (TypeClassDictionaryConstructorApp name (g' v)) g' (Accessor prop v) = g (Accessor prop (g' v))- g' (ObjectUpdate obj vs) = g (ObjectUpdate (g' obj) (map (fmap g') vs))- g' (ObjectUpdater obj vs) = g (ObjectUpdater (fmap g' obj) (map (second (fmap g')) vs))- g' (Abs name v) = g (Abs name (g' v))+ g' (ObjectUpdate obj vs) = g (ObjectUpdate (g' obj) (fmap (fmap g') vs))+ g' (ObjectUpdateNested obj vs) = g (ObjectUpdateNested (g' obj) (fmap g' vs))+ g' (Abs binder v) = g (Abs (h' binder) (g' v)) g' (App v1 v2) = g (App (g' v1) (g' v2))+ g' (VisibleTypeApp v ty) = g (VisibleTypeApp (g' v) ty)+ g' (Unused v) = g (Unused (g' v)) g' (IfThenElse v1 v2 v3) = g (IfThenElse (g' v1) (g' v2) (g' v3))- g' (Case vs alts) = g (Case (map g' vs) (map handleCaseAlternative alts))+ g' (Case vs alts) = g (Case (fmap g' vs) (fmap handleCaseAlternative alts)) g' (TypedValue check v ty) = g (TypedValue check (g' v) ty)- g' (Let ds v) = g (Let (map f' ds) (g' v))- g' (Do es) = g (Do (map handleDoNotationElement es))+ g' (Let w ds v) = g (Let w (fmap f' ds) (g' v))+ g' (Do m es) = g (Do m (fmap handleDoNotationElement es))+ g' (Ado m es v) = g (Ado m (fmap handleDoNotationElement es) (g' v)) g' (PositionedValue pos com v) = g (PositionedValue pos com (g' v)) g' other = g other h' :: Binder -> Binder- h' (ConstructorBinder ctor bs) = h (ConstructorBinder ctor (map h' bs))- h' (ObjectBinder bs) = h (ObjectBinder (map (fmap h') bs))- h' (ArrayBinder bs) = h (ArrayBinder (map h' bs))- h' (ConsBinder b1 b2) = h (ConsBinder (h' b1) (h' b2))- h' (NamedBinder name b) = h (NamedBinder name (h' b))+ h' (ConstructorBinder ss ctor bs) = h (ConstructorBinder ss ctor (fmap h' bs))+ h' (BinaryNoParensBinder b1 b2 b3) = h (BinaryNoParensBinder (h' b1) (h' b2) (h' b3))+ h' (ParensInBinder b) = h (ParensInBinder (h' b))+ h' (LiteralBinder ss l) = h (LiteralBinder ss (lit h' l))+ h' (NamedBinder ss name b) = h (NamedBinder ss name (h' b)) h' (PositionedBinder pos com b) = h (PositionedBinder pos com (h' b))+ h' (TypedBinder t b) = h (TypedBinder t (h' b)) h' other = h other + lit :: (a -> a) -> Literal a -> Literal a+ lit go (ArrayLiteral as) = ArrayLiteral (fmap go as)+ lit go (ObjectLiteral as) = ObjectLiteral (fmap (fmap go) as)+ lit _ other = other+ handleCaseAlternative :: CaseAlternative -> CaseAlternative handleCaseAlternative ca =- ca { caseAlternativeBinders = map h' (caseAlternativeBinders ca)- , caseAlternativeResult = (map (g' *** g') +++ g') (caseAlternativeResult ca)+ ca { caseAlternativeBinders = fmap h' (caseAlternativeBinders ca)+ , caseAlternativeResult = fmap (mapGuardedExpr handleGuard g') (caseAlternativeResult ca) } handleDoNotationElement :: DoNotationElement -> DoNotationElement handleDoNotationElement (DoNotationValue v) = DoNotationValue (g' v) handleDoNotationElement (DoNotationBind b v) = DoNotationBind (h' b) (g' v)- handleDoNotationElement (DoNotationLet ds) = DoNotationLet (map f' ds)+ handleDoNotationElement (DoNotationLet ds) = DoNotationLet (fmap f' ds) handleDoNotationElement (PositionedDoNotationElement pos com e) = PositionedDoNotationElement pos com (handleDoNotationElement e) -everywhereOnValuesTopDownM :: (Functor m, Applicative m, Monad m) =>- (Declaration -> m Declaration) ->- (Expr -> m Expr) ->- (Binder -> m Binder) ->- (Declaration -> m Declaration, Expr -> m Expr, Binder -> m Binder)+ handleGuard :: Guard -> Guard+ handleGuard (ConditionGuard e) = ConditionGuard (g' e)+ handleGuard (PatternGuard b e) = PatternGuard (h' b) (g' e)++everywhereOnValuesTopDownM+ :: forall m+ . (Monad m)+ => (Declaration -> m Declaration)+ -> (Expr -> m Expr)+ -> (Binder -> m Binder)+ -> ( Declaration -> m Declaration+ , Expr -> m Expr+ , Binder -> m Binder+ ) everywhereOnValuesTopDownM f g h = (f' <=< f, g' <=< g, h' <=< h) where- f' (DataBindingGroupDeclaration ds) = DataBindingGroupDeclaration <$> mapM (f' <=< f) ds- f' (ValueDeclaration name nameKind bs val) = ValueDeclaration name nameKind <$> mapM (h' <=< h) bs <*> eitherM (mapM (pairM (g' <=< g) (g' <=< g))) (g' <=< g) val- f' (BindingGroupDeclaration ds) = BindingGroupDeclaration <$> mapM (\(name, nameKind, val) -> (,,) name nameKind <$> (g val >>= g')) ds- f' (TypeClassDeclaration name args implies ds) = TypeClassDeclaration name args implies <$> mapM (f' <=< f) ds- f' (TypeInstanceDeclaration name cs className args ds) = TypeInstanceDeclaration name cs className args <$> mapM (f' <=< f) ds- f' (PositionedDeclaration pos com d) = PositionedDeclaration pos com <$> (f d >>= f')++ f' :: Declaration -> m Declaration+ f' (DataBindingGroupDeclaration ds) = DataBindingGroupDeclaration <$> traverse (f' <=< f) ds+ f' (ValueDecl sa name nameKind bs val) =+ ValueDecl sa name nameKind <$> traverse (h' <=< h) bs <*> traverse (guardedExprM handleGuard (g' <=< g)) val+ f' (BindingGroupDeclaration ds) = BindingGroupDeclaration <$> traverse (\(name, nameKind, val) -> (name, nameKind, ) <$> (g val >>= g')) ds+ f' (TypeClassDeclaration sa name args implies deps ds) = TypeClassDeclaration sa name args implies deps <$> traverse (f' <=< f) ds+ f' (TypeInstanceDeclaration sa na ch idx name cs className args ds) = TypeInstanceDeclaration sa na ch idx name cs className args <$> traverseTypeInstanceBody (traverse (f' <=< f)) ds+ f' (BoundValueDeclaration sa b expr) = BoundValueDeclaration sa <$> (h' <=< h) b <*> (g' <=< g) expr f' other = f other - g' (UnaryMinus v) = UnaryMinus <$> (g v >>= g')+ g' :: Expr -> m Expr+ g' (Literal ss l) = Literal ss <$> litM (g >=> g') l+ g' (UnaryMinus ss v) = UnaryMinus ss <$> (g v >>= g') g' (BinaryNoParens op v1 v2) = BinaryNoParens <$> (g op >>= g') <*> (g v1 >>= g') <*> (g v2 >>= g') g' (Parens v) = Parens <$> (g v >>= g')- g' (OperatorSection op (Left v)) = OperatorSection <$> (g op >>= g') <*> (Left <$> (g v >>= g'))- g' (OperatorSection op (Right v)) = OperatorSection <$> (g op >>= g') <*> (Right <$> (g v >>= g'))- g' (ArrayLiteral vs) = ArrayLiteral <$> mapM (g' <=< g) vs- g' (ObjectLiteral vs) = ObjectLiteral <$> mapM (sndM (g' <=< g)) vs- g' (ObjectConstructor vs) = ObjectConstructor <$> mapM (sndM $ maybeM (g' <=< g)) vs- g' (TypeClassDictionaryConstructorApp name v) = TypeClassDictionaryConstructorApp name <$> (g v >>= g') g' (Accessor prop v) = Accessor prop <$> (g v >>= g')- g' (ObjectUpdate obj vs) = ObjectUpdate <$> (g obj >>= g') <*> mapM (sndM (g' <=< g)) vs- g' (ObjectUpdater obj vs) = ObjectUpdater <$> (maybeM g obj >>= maybeM g') <*> mapM (sndM $ maybeM (g' <=< g)) vs- g' (Abs name v) = Abs name <$> (g v >>= g')+ g' (ObjectUpdate obj vs) = ObjectUpdate <$> (g obj >>= g') <*> traverse (sndM (g' <=< g)) vs+ g' (ObjectUpdateNested obj vs) = ObjectUpdateNested <$> (g obj >>= g') <*> traverse (g' <=< g) vs+ g' (Abs binder v) = Abs <$> (h binder >>= h') <*> (g v >>= g') g' (App v1 v2) = App <$> (g v1 >>= g') <*> (g v2 >>= g')+ g' (VisibleTypeApp v ty) = VisibleTypeApp <$> (g v >>= g') <*> pure ty+ g' (Unused v) = Unused <$> (g v >>= g') g' (IfThenElse v1 v2 v3) = IfThenElse <$> (g v1 >>= g') <*> (g v2 >>= g') <*> (g v3 >>= g')- g' (Case vs alts) = Case <$> mapM (g' <=< g) vs <*> mapM handleCaseAlternative alts+ g' (Case vs alts) = Case <$> traverse (g' <=< g) vs <*> traverse handleCaseAlternative alts g' (TypedValue check v ty) = TypedValue check <$> (g v >>= g') <*> pure ty- g' (Let ds v) = Let <$> mapM (f' <=< f) ds <*> (g v >>= g')- g' (Do es) = Do <$> mapM handleDoNotationElement es+ g' (Let w ds v) = Let w <$> traverse (f' <=< f) ds <*> (g v >>= g')+ g' (Do m es) = Do m <$> traverse handleDoNotationElement es+ g' (Ado m es v) = Ado m <$> traverse handleDoNotationElement es <*> (g v >>= g') g' (PositionedValue pos com v) = PositionedValue pos com <$> (g v >>= g') g' other = g other - h' (ConstructorBinder ctor bs) = ConstructorBinder ctor <$> mapM (h' <=< h) bs- h' (ObjectBinder bs) = ObjectBinder <$> mapM (sndM (h' <=< h)) bs- h' (ArrayBinder bs) = ArrayBinder <$> mapM (h' <=< h) bs- h' (ConsBinder b1 b2) = ConsBinder <$> (h b1 >>= h') <*> (h b2 >>= h')- h' (NamedBinder name b) = NamedBinder name <$> (h b >>= h')+ h' :: Binder -> m Binder+ h' (LiteralBinder ss l) = LiteralBinder ss <$> litM (h >=> h') l+ h' (ConstructorBinder ss ctor bs) = ConstructorBinder ss ctor <$> traverse (h' <=< h) bs+ h' (BinaryNoParensBinder b1 b2 b3) = BinaryNoParensBinder <$> (h b1 >>= h') <*> (h b2 >>= h') <*> (h b3 >>= h')+ h' (ParensInBinder b) = ParensInBinder <$> (h b >>= h')+ h' (NamedBinder ss name b) = NamedBinder ss name <$> (h b >>= h') h' (PositionedBinder pos com b) = PositionedBinder pos com <$> (h b >>= h')+ h' (TypedBinder t b) = TypedBinder t <$> (h b >>= h') h' other = h other - handleCaseAlternative (CaseAlternative bs val) = CaseAlternative <$> mapM (h' <=< h) bs- <*> eitherM (mapM (pairM (g' <=< g) (g' <=< g))) (g' <=< g) val+ handleCaseAlternative :: CaseAlternative -> m CaseAlternative+ handleCaseAlternative (CaseAlternative bs val) =+ CaseAlternative+ <$> traverse (h' <=< h) bs+ <*> traverse (guardedExprM handleGuard (g' <=< g)) val + handleDoNotationElement :: DoNotationElement -> m DoNotationElement handleDoNotationElement (DoNotationValue v) = DoNotationValue <$> (g' <=< g) v handleDoNotationElement (DoNotationBind b v) = DoNotationBind <$> (h' <=< h) b <*> (g' <=< g) v- handleDoNotationElement (DoNotationLet ds) = DoNotationLet <$> mapM (f' <=< f) ds+ handleDoNotationElement (DoNotationLet ds) = DoNotationLet <$> traverse (f' <=< f) ds handleDoNotationElement (PositionedDoNotationElement pos com e) = PositionedDoNotationElement pos com <$> handleDoNotationElement e -everywhereOnValuesM :: (Functor m, Applicative m, Monad m) =>- (Declaration -> m Declaration) ->- (Expr -> m Expr) ->- (Binder -> m Binder) ->- (Declaration -> m Declaration, Expr -> m Expr, Binder -> m Binder)+ handleGuard :: Guard -> m Guard+ handleGuard (ConditionGuard e) = ConditionGuard <$> (g' <=< g) e+ handleGuard (PatternGuard b e) = PatternGuard <$> (h' <=< h) b <*> (g' <=< g) e++everywhereOnValuesM+ :: forall m+ . (Monad m)+ => (Declaration -> m Declaration)+ -> (Expr -> m Expr)+ -> (Binder -> m Binder)+ -> ( Declaration -> m Declaration+ , Expr -> m Expr+ , Binder -> m Binder+ ) everywhereOnValuesM f g h = (f', g', h') where- f' (DataBindingGroupDeclaration ds) = (DataBindingGroupDeclaration <$> mapM f' ds) >>= f- f' (ValueDeclaration name nameKind bs val) = (ValueDeclaration name nameKind <$> mapM h' bs <*> eitherM (mapM (pairM g' g')) g' val) >>= f- f' (BindingGroupDeclaration ds) = (BindingGroupDeclaration <$> mapM (\(name, nameKind, val) -> (,,) name nameKind <$> g' val) ds) >>= f- f' (TypeClassDeclaration name args implies ds) = (TypeClassDeclaration name args implies <$> mapM f' ds) >>= f- f' (TypeInstanceDeclaration name cs className args ds) = (TypeInstanceDeclaration name cs className args <$> mapM f' ds) >>= f- f' (PositionedDeclaration pos com d) = (PositionedDeclaration pos com <$> f' d) >>= f++ f' :: Declaration -> m Declaration+ f' (DataBindingGroupDeclaration ds) = (DataBindingGroupDeclaration <$> traverse f' ds) >>= f+ f' (ValueDecl sa name nameKind bs val) =+ ValueDecl sa name nameKind <$> traverse h' bs <*> traverse (guardedExprM handleGuard g') val >>= f+ f' (BindingGroupDeclaration ds) = (BindingGroupDeclaration <$> traverse (\(name, nameKind, val) -> (name, nameKind, ) <$> g' val) ds) >>= f+ f' (BoundValueDeclaration sa b expr) = (BoundValueDeclaration sa <$> h' b <*> g' expr) >>= f+ f' (TypeClassDeclaration sa name args implies deps ds) = (TypeClassDeclaration sa name args implies deps <$> traverse f' ds) >>= f+ f' (TypeInstanceDeclaration sa na ch idx name cs className args ds) = (TypeInstanceDeclaration sa na ch idx name cs className args <$> traverseTypeInstanceBody (traverse f') ds) >>= f f' other = f other - g' (UnaryMinus v) = (UnaryMinus <$> g' v) >>= g+ g' :: Expr -> m Expr+ g' (Literal ss l) = (Literal ss <$> litM g' l) >>= g+ g' (UnaryMinus ss v) = (UnaryMinus ss <$> g' v) >>= g g' (BinaryNoParens op v1 v2) = (BinaryNoParens <$> g' op <*> g' v1 <*> g' v2) >>= g g' (Parens v) = (Parens <$> g' v) >>= g- g' (OperatorSection op (Left v)) = (OperatorSection <$> g' op <*> (Left <$> g' v)) >>= g- g' (OperatorSection op (Right v)) = (OperatorSection <$> g' op <*> (Right <$> g' v)) >>= g- g' (ArrayLiteral vs) = (ArrayLiteral <$> mapM g' vs) >>= g- g' (ObjectLiteral vs) = (ObjectLiteral <$> mapM (sndM g') vs) >>= g- g' (ObjectConstructor vs) = (ObjectConstructor <$> mapM (sndM $ maybeM g') vs) >>= g- g' (TypeClassDictionaryConstructorApp name v) = (TypeClassDictionaryConstructorApp name <$> g' v) >>= g g' (Accessor prop v) = (Accessor prop <$> g' v) >>= g- g' (ObjectUpdate obj vs) = (ObjectUpdate <$> g' obj <*> mapM (sndM g') vs) >>= g- g' (ObjectUpdater obj vs) = (ObjectUpdater <$> maybeM g' obj <*> mapM (sndM $ maybeM g') vs) >>= g- g' (Abs name v) = (Abs name <$> g' v) >>= g+ g' (ObjectUpdate obj vs) = (ObjectUpdate <$> g' obj <*> traverse (sndM g') vs) >>= g+ g' (ObjectUpdateNested obj vs) = (ObjectUpdateNested <$> g' obj <*> traverse g' vs) >>= g+ g' (Abs binder v) = (Abs <$> h' binder <*> g' v) >>= g g' (App v1 v2) = (App <$> g' v1 <*> g' v2) >>= g+ g' (VisibleTypeApp v ty) = (VisibleTypeApp <$> g' v <*> pure ty) >>= g+ g' (Unused v) = (Unused <$> g' v) >>= g g' (IfThenElse v1 v2 v3) = (IfThenElse <$> g' v1 <*> g' v2 <*> g' v3) >>= g- g' (Case vs alts) = (Case <$> mapM g' vs <*> mapM handleCaseAlternative alts) >>= g+ g' (Case vs alts) = (Case <$> traverse g' vs <*> traverse handleCaseAlternative alts) >>= g g' (TypedValue check v ty) = (TypedValue check <$> g' v <*> pure ty) >>= g- g' (Let ds v) = (Let <$> mapM f' ds <*> g' v) >>= g- g' (Do es) = (Do <$> mapM handleDoNotationElement es) >>= g+ g' (Let w ds v) = (Let w <$> traverse f' ds <*> g' v) >>= g+ g' (Do m es) = (Do m <$> traverse handleDoNotationElement es) >>= g+ g' (Ado m es v) = (Ado m <$> traverse handleDoNotationElement es <*> g' v) >>= g g' (PositionedValue pos com v) = (PositionedValue pos com <$> g' v) >>= g g' other = g other - h' (ConstructorBinder ctor bs) = (ConstructorBinder ctor <$> mapM h' bs) >>= h- h' (ObjectBinder bs) = (ObjectBinder <$> mapM (sndM h') bs) >>= h- h' (ArrayBinder bs) = (ArrayBinder <$> mapM h' bs) >>= h- h' (ConsBinder b1 b2) = (ConsBinder <$> h' b1 <*> h' b2) >>= h- h' (NamedBinder name b) = (NamedBinder name <$> h' b) >>= h+ h' :: Binder -> m Binder+ h' (LiteralBinder ss l) = (LiteralBinder ss <$> litM h' l) >>= h+ h' (ConstructorBinder ss ctor bs) = (ConstructorBinder ss ctor <$> traverse h' bs) >>= h+ h' (BinaryNoParensBinder b1 b2 b3) = (BinaryNoParensBinder <$> h' b1 <*> h' b2 <*> h' b3) >>= h+ h' (ParensInBinder b) = (ParensInBinder <$> h' b) >>= h+ h' (NamedBinder ss name b) = (NamedBinder ss name <$> h' b) >>= h h' (PositionedBinder pos com b) = (PositionedBinder pos com <$> h' b) >>= h+ h' (TypedBinder t b) = (TypedBinder t <$> h' b) >>= h h' other = h other - handleCaseAlternative (CaseAlternative bs val) = CaseAlternative <$> mapM h' bs- <*> eitherM (mapM (pairM g' g')) g' val+ handleCaseAlternative :: CaseAlternative -> m CaseAlternative+ handleCaseAlternative (CaseAlternative bs val) =+ CaseAlternative+ <$> traverse h' bs+ <*> traverse (guardedExprM handleGuard g') val + handleDoNotationElement :: DoNotationElement -> m DoNotationElement handleDoNotationElement (DoNotationValue v) = DoNotationValue <$> g' v handleDoNotationElement (DoNotationBind b v) = DoNotationBind <$> h' b <*> g' v- handleDoNotationElement (DoNotationLet ds) = DoNotationLet <$> mapM f' ds+ handleDoNotationElement (DoNotationLet ds) = DoNotationLet <$> traverse f' ds handleDoNotationElement (PositionedDoNotationElement pos com e) = PositionedDoNotationElement pos com <$> handleDoNotationElement e -everythingOnValues :: (r -> r -> r) ->- (Declaration -> r) ->- (Expr -> r) ->- (Binder -> r) ->- (CaseAlternative -> r) ->- (DoNotationElement -> r) ->- (Declaration -> r, Expr -> r, Binder -> r, CaseAlternative -> r, DoNotationElement -> r)-everythingOnValues (<>) f g h i j = (f', g', h', i', j')+ handleGuard :: Guard -> m Guard+ handleGuard (ConditionGuard e) = ConditionGuard <$> g' e+ handleGuard (PatternGuard b e) = PatternGuard <$> h' b <*> g' e++everythingOnValues+ :: forall r+ . (r -> r -> r)+ -> (Declaration -> r)+ -> (Expr -> r)+ -> (Binder -> r)+ -> (CaseAlternative -> r)+ -> (DoNotationElement -> r)+ -> ( Declaration -> r+ , Expr -> r+ , Binder -> r+ , CaseAlternative -> r+ , DoNotationElement -> r+ )+everythingOnValues (<>.) f g h i j = (f', g', h', i', j') where- f' d@(DataBindingGroupDeclaration ds) = foldl (<>) (f d) (map f' ds)- f' d@(ValueDeclaration _ _ bs (Right val)) = foldl (<>) (f d) (map h' bs) <> g' val- f' d@(ValueDeclaration _ _ bs (Left gs)) = foldl (<>) (f d) (map h' bs ++ concatMap (\(grd, val) -> [g' grd, g' val]) gs)- f' d@(BindingGroupDeclaration ds) = foldl (<>) (f d) (map (\(_, _, val) -> g' val) ds)- f' d@(TypeClassDeclaration _ _ _ ds) = foldl (<>) (f d) (map f' ds)- f' d@(TypeInstanceDeclaration _ _ _ _ ds) = foldl (<>) (f d) (map f' ds)- f' d@(PositionedDeclaration _ _ d1) = f d <> f' d1++ f' :: Declaration -> r+ f' d@(DataBindingGroupDeclaration ds) = foldl (<>.) (f d) (fmap f' ds)+ f' d@(ValueDeclaration vd) = foldl (<>.) (f d) (fmap h' (valdeclBinders vd) ++ concatMap (\(GuardedExpr grd v) -> fmap k' grd ++ [g' v]) (valdeclExpression vd))+ f' d@(BindingGroupDeclaration ds) = foldl (<>.) (f d) (fmap (\(_, _, val) -> g' val) ds)+ f' d@(TypeClassDeclaration _ _ _ _ _ ds) = foldl (<>.) (f d) (fmap f' ds)+ f' d@(TypeInstanceDeclaration _ _ _ _ _ _ _ _ (ExplicitInstance ds)) = foldl (<>.) (f d) (fmap f' ds)+ f' d@(BoundValueDeclaration _ b expr) = f d <>. h' b <>. g' expr f' d = f d - g' v@(UnaryMinus v1) = g v <> g' v1- g' v@(BinaryNoParens op v1 v2) = g v <> g op <> g' v1 <> g' v2- g' v@(Parens v1) = g v <> g' v1- g' v@(OperatorSection op (Left v1)) = g v <> g op <> g' v1- g' v@(OperatorSection op (Right v1)) = g v <> g op <> g' v1- g' v@(ArrayLiteral vs) = foldl (<>) (g v) (map g' vs)- g' v@(ObjectLiteral vs) = foldl (<>) (g v) (map (g' . snd) vs)- g' v@(ObjectConstructor vs) = foldl (<>) (g v) (map g' (mapMaybe snd vs))- g' v@(TypeClassDictionaryConstructorApp _ v1) = g v <> g' v1- g' v@(Accessor _ v1) = g v <> g' v1- g' v@(ObjectUpdate obj vs) = foldl (<>) (g v <> g' obj) (map (g' . snd) vs)- g' v@(ObjectUpdater obj vs) = foldl (<>) (maybe (g v) (\x -> g v <> g' x) obj) (map g' (mapMaybe snd vs))- g' v@(Abs _ v1) = g v <> g' v1- g' v@(App v1 v2) = g v <> g' v1 <> g' v2- g' v@(IfThenElse v1 v2 v3) = g v <> g' v1 <> g' v2 <> g' v3- g' v@(Case vs alts) = foldl (<>) (foldl (<>) (g v) (map g' vs)) (map i' alts)- g' v@(TypedValue _ v1 _) = g v <> g' v1- g' v@(Let ds v1) = foldl (<>) (g v) (map f' ds) <> g' v1- g' v@(Do es) = foldl (<>) (g v) (map j' es)- g' v@(PositionedValue _ _ v1) = g v <> g' v1+ g' :: Expr -> r+ g' v@(Literal _ l) = lit (g v) g' l+ g' v@(UnaryMinus _ v1) = g v <>. g' v1+ g' v@(BinaryNoParens op v1 v2) = g v <>. g' op <>. g' v1 <>. g' v2+ g' v@(Parens v1) = g v <>. g' v1+ g' v@(Accessor _ v1) = g v <>. g' v1+ g' v@(ObjectUpdate obj vs) = foldl (<>.) (g v <>. g' obj) (fmap (g' . snd) vs)+ g' v@(ObjectUpdateNested obj vs) = foldl (<>.) (g v <>. g' obj) (fmap g' vs)+ g' v@(Abs b v1) = g v <>. h' b <>. g' v1+ g' v@(App v1 v2) = g v <>. g' v1 <>. g' v2+ g' v@(VisibleTypeApp v' _) = g v <>. g' v'+ g' v@(Unused v1) = g v <>. g' v1+ g' v@(IfThenElse v1 v2 v3) = g v <>. g' v1 <>. g' v2 <>. g' v3+ g' v@(Case vs alts) = foldl (<>.) (foldl (<>.) (g v) (fmap g' vs)) (fmap i' alts)+ g' v@(TypedValue _ v1 _) = g v <>. g' v1+ g' v@(Let _ ds v1) = foldl (<>.) (g v) (fmap f' ds) <>. g' v1+ g' v@(Do _ es) = foldl (<>.) (g v) (fmap j' es)+ g' v@(Ado _ es v1) = foldl (<>.) (g v) (fmap j' es) <>. g' v1+ g' v@(PositionedValue _ _ v1) = g v <>. g' v1 g' v = g v - h' b@(ConstructorBinder _ bs) = foldl (<>) (h b) (map h' bs)- h' b@(ObjectBinder bs) = foldl (<>) (h b) (map (h' . snd) bs)- h' b@(ArrayBinder bs) = foldl (<>) (h b) (map h' bs)- h' b@(ConsBinder b1 b2) = h b <> h' b1 <> h' b2- h' b@(NamedBinder _ b1) = h b <> h' b1- h' b@(PositionedBinder _ _ b1) = h b <> h' b1+ h' :: Binder -> r+ h' b@(LiteralBinder _ l) = lit (h b) h' l+ h' b@(ConstructorBinder _ _ bs) = foldl (<>.) (h b) (fmap h' bs)+ h' b@(BinaryNoParensBinder b1 b2 b3) = h b <>. h' b1 <>. h' b2 <>. h' b3+ h' b@(ParensInBinder b1) = h b <>. h' b1+ h' b@(NamedBinder _ _ b1) = h b <>. h' b1+ h' b@(PositionedBinder _ _ b1) = h b <>. h' b1+ h' b@(TypedBinder _ b1) = h b <>. h' b1 h' b = h b - i' ca@(CaseAlternative bs (Right val)) = foldl (<>) (i ca) (map h' bs) <> g' val- i' ca@(CaseAlternative bs (Left gs)) = foldl (<>) (i ca) (map h' bs ++ concatMap (\(grd, val) -> [g' grd, g' val]) gs)+ lit :: r -> (a -> r) -> Literal a -> r+ lit r go (ArrayLiteral as) = foldl (<>.) r (fmap go as)+ lit r go (ObjectLiteral as) = foldl (<>.) r (fmap (go . snd) as)+ lit r _ _ = r - j' e@(DoNotationValue v) = j e <> g' v- j' e@(DoNotationBind b v) = j e <> h' b <> g' v- j' e@(DoNotationLet ds) = foldl (<>) (j e) (map f' ds)- j' e@(PositionedDoNotationElement _ _ e1) = j e <> j' e1+ i' :: CaseAlternative -> r+ i' ca@(CaseAlternative bs gs) =+ foldl (<>.) (i ca) (fmap h' bs ++ concatMap (\(GuardedExpr grd val) -> fmap k' grd ++ [g' val]) gs) -everythingWithContextOnValues ::- s ->- r ->- (r -> r -> r) ->- (s -> Declaration -> (s, r)) ->- (s -> Expr -> (s, r)) ->- (s -> Binder -> (s, r)) ->- (s -> CaseAlternative -> (s, r)) ->- (s -> DoNotationElement -> (s, r)) ->- ( Declaration -> r- , Expr -> r- , Binder -> r- , CaseAlternative -> r- , DoNotationElement -> r)-everythingWithContextOnValues s0 r0 (<>) f g h i j = (f'' s0, g'' s0, h'' s0, i'' s0, j'' s0)+ j' :: DoNotationElement -> r+ j' e@(DoNotationValue v) = j e <>. g' v+ j' e@(DoNotationBind b v) = j e <>. h' b <>. g' v+ j' e@(DoNotationLet ds) = foldl (<>.) (j e) (fmap f' ds)+ j' e@(PositionedDoNotationElement _ _ e1) = j e <>. j' e1++ k' :: Guard -> r+ k' (ConditionGuard e) = g' e+ k' (PatternGuard b e) = h' b <>. g' e++everythingWithContextOnValues+ :: forall s r+ . s+ -> r+ -> (r -> r -> r)+ -> (s -> Declaration -> (s, r))+ -> (s -> Expr -> (s, r))+ -> (s -> Binder -> (s, r))+ -> (s -> CaseAlternative -> (s, r))+ -> (s -> DoNotationElement -> (s, r))+ -> ( Declaration -> r+ , Expr -> r+ , Binder -> r+ , CaseAlternative -> r+ , DoNotationElement -> r)+everythingWithContextOnValues s0 r0 (<>.) f g h i j = (f'' s0, g'' s0, h'' s0, i'' s0, j'' s0) where- f'' s d = let (s', r) = f s d in r <> f' s' d - f' s (DataBindingGroupDeclaration ds) = foldl (<>) r0 (map (f'' s) ds)- f' s (ValueDeclaration _ _ bs (Right val)) = foldl (<>) r0 (map (h'' s) bs) <> g'' s val- f' s (ValueDeclaration _ _ bs (Left gs)) = foldl (<>) r0 (map (h'' s) bs ++ concatMap (\(grd, val) -> [g'' s grd, g'' s val]) gs)- f' s (BindingGroupDeclaration ds) = foldl (<>) r0 (map (\(_, _, val) -> g'' s val) ds)- f' s (TypeClassDeclaration _ _ _ ds) = foldl (<>) r0 (map (f'' s) ds)- f' s (TypeInstanceDeclaration _ _ _ _ ds) = foldl (<>) r0 (map (f'' s) ds)- f' s (PositionedDeclaration _ _ d1) = f'' s d1+ f'' :: s -> Declaration -> r+ f'' s d = let (s', r) = f s d in r <>. f' s' d++ f' :: s -> Declaration -> r+ f' s (DataBindingGroupDeclaration ds) = foldl (<>.) r0 (fmap (f'' s) ds)+ f' s (ValueDeclaration vd) = foldl (<>.) r0 (fmap (h'' s) (valdeclBinders vd) ++ concatMap (\(GuardedExpr grd v) -> fmap (k' s) grd ++ [g'' s v]) (valdeclExpression vd))+ f' s (BindingGroupDeclaration ds) = foldl (<>.) r0 (fmap (\(_, _, val) -> g'' s val) ds)+ f' s (TypeClassDeclaration _ _ _ _ _ ds) = foldl (<>.) r0 (fmap (f'' s) ds)+ f' s (TypeInstanceDeclaration _ _ _ _ _ _ _ _ (ExplicitInstance ds)) = foldl (<>.) r0 (fmap (f'' s) ds) f' _ _ = r0 - g'' s v = let (s', r) = g s v in r <> g' s' v+ g'' :: s -> Expr -> r+ g'' s v = let (s', r) = g s v in r <>. g' s' v - g' s (UnaryMinus v1) = g'' s v1- g' s (BinaryNoParens op v1 v2) = g'' s op <> g'' s v1 <> g'' s v2+ g' :: s -> Expr -> r+ g' s (Literal _ l) = lit g'' s l+ g' s (UnaryMinus _ v1) = g'' s v1+ g' s (BinaryNoParens op v1 v2) = g'' s op <>. g'' s v1 <>. g'' s v2 g' s (Parens v1) = g'' s v1- g' s (OperatorSection op (Left v)) = g'' s op <> g'' s v- g' s (OperatorSection op (Right v)) = g'' s op <> g'' s v- g' s (ArrayLiteral vs) = foldl (<>) r0 (map (g'' s) vs)- g' s (ObjectLiteral vs) = foldl (<>) r0 (map (g'' s . snd) vs)- g' s (ObjectConstructor vs) = foldl (<>) r0 (map (g'' s) (mapMaybe snd vs))- g' s (TypeClassDictionaryConstructorApp _ v1) = g'' s v1 g' s (Accessor _ v1) = g'' s v1- g' s (ObjectUpdate obj vs) = foldl (<>) (g'' s obj) (map (g'' s . snd) vs)- g' s (ObjectUpdater obj vs) = foldl (<>) (maybe r0 (g'' s) obj) (map (g'' s) (mapMaybe snd vs))- g' s (Abs _ v1) = g'' s v1- g' s (App v1 v2) = g'' s v1 <> g'' s v2- g' s (IfThenElse v1 v2 v3) = g'' s v1 <> g'' s v2 <> g'' s v3- g' s (Case vs alts) = foldl (<>) (foldl (<>) r0 (map (g'' s) vs)) (map (i'' s) alts)+ g' s (ObjectUpdate obj vs) = foldl (<>.) (g'' s obj) (fmap (g'' s . snd) vs)+ g' s (ObjectUpdateNested obj vs) = foldl (<>.) (g'' s obj) (fmap (g'' s) vs)+ g' s (Abs binder v1) = h'' s binder <>. g'' s v1+ g' s (App v1 v2) = g'' s v1 <>. g'' s v2+ g' s (VisibleTypeApp v _) = g'' s v+ g' s (Unused v) = g'' s v+ g' s (IfThenElse v1 v2 v3) = g'' s v1 <>. g'' s v2 <>. g'' s v3+ g' s (Case vs alts) = foldl (<>.) (foldl (<>.) r0 (fmap (g'' s) vs)) (fmap (i'' s) alts) g' s (TypedValue _ v1 _) = g'' s v1- g' s (Let ds v1) = foldl (<>) r0 (map (f'' s) ds) <> g'' s v1- g' s (Do es) = foldl (<>) r0 (map (j'' s) es)+ g' s (Let _ ds v1) = foldl (<>.) r0 (fmap (f'' s) ds) <>. g'' s v1+ g' s (Do _ es) = foldl (<>.) r0 (fmap (j'' s) es)+ g' s (Ado _ es v1) = foldl (<>.) r0 (fmap (j'' s) es) <>. g'' s v1 g' s (PositionedValue _ _ v1) = g'' s v1 g' _ _ = r0 - h'' s b = let (s', r) = h s b in r <> h' s' b+ h'' :: s -> Binder -> r+ h'' s b = let (s', r) = h s b in r <>. h' s' b - h' s (ConstructorBinder _ bs) = foldl (<>) r0 (map (h'' s) bs)- h' s (ObjectBinder bs) = foldl (<>) r0 (map (h'' s . snd) bs)- h' s (ArrayBinder bs) = foldl (<>) r0 (map (h'' s) bs)- h' s (ConsBinder b1 b2) = h'' s b1 <> h'' s b2- h' s (NamedBinder _ b1) = h'' s b1+ h' :: s -> Binder -> r+ h' s (LiteralBinder _ l) = lit h'' s l+ h' s (ConstructorBinder _ _ bs) = foldl (<>.) r0 (fmap (h'' s) bs)+ h' s (BinaryNoParensBinder b1 b2 b3) = h'' s b1 <>. h'' s b2 <>. h'' s b3+ h' s (ParensInBinder b) = h'' s b+ h' s (NamedBinder _ _ b1) = h'' s b1 h' s (PositionedBinder _ _ b1) = h'' s b1+ h' s (TypedBinder _ b1) = h'' s b1 h' _ _ = r0 - i'' s ca = let (s', r) = i s ca in r <> i' s' ca+ lit :: (s -> a -> r) -> s -> Literal a -> r+ lit go s (ArrayLiteral as) = foldl (<>.) r0 (fmap (go s) as)+ lit go s (ObjectLiteral as) = foldl (<>.) r0 (fmap (go s . snd) as)+ lit _ _ _ = r0 - i' s (CaseAlternative bs (Right val)) = foldl (<>) r0 (map (h'' s) bs) <> g'' s val- i' s (CaseAlternative bs (Left gs)) = foldl (<>) r0 (map (h'' s) bs ++ concatMap (\(grd, val) -> [g'' s grd, g'' s val]) gs)+ i'' :: s -> CaseAlternative -> r+ i'' s ca = let (s', r) = i s ca in r <>. i' s' ca - j'' s e = let (s', r) = j s e in r <> j' s' e+ i' :: s -> CaseAlternative -> r+ i' s (CaseAlternative bs gs) = foldl (<>.) r0 (fmap (h'' s) bs ++ concatMap (\(GuardedExpr grd val) -> fmap (k' s) grd ++ [g'' s val]) gs) + j'' :: s -> DoNotationElement -> r+ j'' s e = let (s', r) = j s e in r <>. j' s' e++ j' :: s -> DoNotationElement -> r j' s (DoNotationValue v) = g'' s v- j' s (DoNotationBind b v) = h'' s b <> g'' s v- j' s (DoNotationLet ds) = foldl (<>) r0 (map (f'' s) ds)+ j' s (DoNotationBind b v) = h'' s b <>. g'' s v+ j' s (DoNotationLet ds) = foldl (<>.) r0 (fmap (f'' s) ds) j' s (PositionedDoNotationElement _ _ e1) = j'' s e1 -everywhereWithContextOnValuesM :: (Functor m, Applicative m, Monad m) =>- s ->- (s -> Declaration -> m (s, Declaration)) ->- (s -> Expr -> m (s, Expr)) ->- (s -> Binder -> m (s, Binder)) ->- (s -> CaseAlternative -> m (s, CaseAlternative)) ->- (s -> DoNotationElement -> m (s, DoNotationElement)) ->- ( Declaration -> m Declaration- , Expr -> m Expr- , Binder -> m Binder- , CaseAlternative -> m CaseAlternative- , DoNotationElement -> m DoNotationElement)-everywhereWithContextOnValuesM s0 f g h i j = (f'' s0, g'' s0, h'' s0, i'' s0, j'' s0)+ k' :: s -> Guard -> r+ k' s (ConditionGuard e) = g'' s e+ k' s (PatternGuard b e) = h'' s b <>. g'' s e++everywhereWithContextOnValues+ :: forall s+ . s+ -> (s -> Declaration -> (s, Declaration))+ -> (s -> Expr -> (s, Expr))+ -> (s -> Binder -> (s, Binder))+ -> (s -> CaseAlternative -> (s, CaseAlternative))+ -> (s -> DoNotationElement -> (s, DoNotationElement))+ -> (s -> Guard -> (s, Guard))+ -> ( Declaration -> Declaration+ , Expr -> Expr+ , Binder -> Binder+ , CaseAlternative -> CaseAlternative+ , DoNotationElement -> DoNotationElement+ , Guard -> Guard+ )+everywhereWithContextOnValues s f g h i j k = (runIdentity . f', runIdentity . g', runIdentity . h', runIdentity . i', runIdentity . j', runIdentity . k') where+ (f', g', h', i', j', k') = everywhereWithContextOnValuesM s (wrap f) (wrap g) (wrap h) (wrap i) (wrap j) (wrap k)+ wrap = ((pure .) .)++everywhereWithContextOnValuesM+ :: forall m s+ . (Monad m)+ => s+ -> (s -> Declaration -> m (s, Declaration))+ -> (s -> Expr -> m (s, Expr))+ -> (s -> Binder -> m (s, Binder))+ -> (s -> CaseAlternative -> m (s, CaseAlternative))+ -> (s -> DoNotationElement -> m (s, DoNotationElement))+ -> (s -> Guard -> m (s, Guard))+ -> ( Declaration -> m Declaration+ , Expr -> m Expr+ , Binder -> m Binder+ , CaseAlternative -> m CaseAlternative+ , DoNotationElement -> m DoNotationElement+ , Guard -> m Guard+ )+everywhereWithContextOnValuesM s0 f g h i j k = (f'' s0, g'' s0, h'' s0, i'' s0, j'' s0, k'' s0)+ where f'' s = uncurry f' <=< f s - f' s (DataBindingGroupDeclaration ds) = DataBindingGroupDeclaration <$> mapM (f'' s) ds- f' s (ValueDeclaration name nameKind bs val) = ValueDeclaration name nameKind <$> mapM (h'' s) bs <*> eitherM (mapM (pairM (g'' s) (g'' s))) (g'' s) val- f' s (BindingGroupDeclaration ds) = BindingGroupDeclaration <$> mapM (thirdM (g'' s)) ds- f' s (TypeClassDeclaration name args implies ds) = TypeClassDeclaration name args implies <$> mapM (f'' s) ds- f' s (TypeInstanceDeclaration name cs className args ds) = TypeInstanceDeclaration name cs className args <$> mapM (f'' s) ds- f' s (PositionedDeclaration pos com d1) = PositionedDeclaration pos com <$> f'' s d1+ f' s (DataBindingGroupDeclaration ds) = DataBindingGroupDeclaration <$> traverse (f'' s) ds+ f' s (ValueDecl sa name nameKind bs val) =+ ValueDecl sa name nameKind <$> traverse (h'' s) bs <*> traverse (guardedExprM (k' s) (g'' s)) val+ f' s (BindingGroupDeclaration ds) = BindingGroupDeclaration <$> traverse (thirdM (g'' s)) ds+ f' s (TypeClassDeclaration sa name args implies deps ds) = TypeClassDeclaration sa name args implies deps <$> traverse (f'' s) ds+ f' s (TypeInstanceDeclaration sa na ch idx name cs className args ds) = TypeInstanceDeclaration sa na ch idx name cs className args <$> traverseTypeInstanceBody (traverse (f'' s)) ds f' _ other = return other g'' s = uncurry g' <=< g s - g' s (UnaryMinus v) = UnaryMinus <$> g'' s v+ g' s (Literal ss l) = Literal ss <$> lit g'' s l+ g' s (UnaryMinus ss v) = UnaryMinus ss <$> g'' s v g' s (BinaryNoParens op v1 v2) = BinaryNoParens <$> g'' s op <*> g'' s v1 <*> g'' s v2 g' s (Parens v) = Parens <$> g'' s v- g' s (OperatorSection op (Left v)) = OperatorSection <$> g'' s op <*> (Left <$> g'' s v)- g' s (OperatorSection op (Right v)) = OperatorSection <$> g'' s op <*> (Right <$> g'' s v)- g' s (ArrayLiteral vs) = ArrayLiteral <$> mapM (g'' s) vs- g' s (ObjectLiteral vs) = ObjectLiteral <$> mapM (sndM (g'' s)) vs- g' s (ObjectConstructor vs) = ObjectConstructor <$> mapM (sndM $ maybeM (g'' s)) vs- g' s (TypeClassDictionaryConstructorApp name v) = TypeClassDictionaryConstructorApp name <$> g'' s v g' s (Accessor prop v) = Accessor prop <$> g'' s v- g' s (ObjectUpdate obj vs) = ObjectUpdate <$> g'' s obj <*> mapM (sndM (g'' s)) vs- g' s (ObjectUpdater obj vs) = ObjectUpdater <$> maybeM (g'' s) obj <*> mapM (sndM $ maybeM (g'' s)) vs- g' s (Abs name v) = Abs name <$> g'' s v+ g' s (ObjectUpdate obj vs) = ObjectUpdate <$> g'' s obj <*> traverse (sndM (g'' s)) vs+ g' s (ObjectUpdateNested obj vs) = ObjectUpdateNested <$> g'' s obj <*> traverse (g'' s) vs+ g' s (Abs binder v) = Abs <$> h' s binder <*> g'' s v g' s (App v1 v2) = App <$> g'' s v1 <*> g'' s v2+ g' s (VisibleTypeApp v ty) = VisibleTypeApp <$> g'' s v <*> pure ty+ g' s (Unused v) = Unused <$> g'' s v g' s (IfThenElse v1 v2 v3) = IfThenElse <$> g'' s v1 <*> g'' s v2 <*> g'' s v3- g' s (Case vs alts) = Case <$> mapM (g'' s) vs <*> mapM (i'' s) alts+ g' s (Case vs alts) = Case <$> traverse (g'' s) vs <*> traverse (i'' s) alts g' s (TypedValue check v ty) = TypedValue check <$> g'' s v <*> pure ty- g' s (Let ds v) = Let <$> mapM (f'' s) ds <*> g'' s v- g' s (Do es) = Do <$> mapM (j'' s) es+ g' s (Let w ds v) = Let w <$> traverse (f'' s) ds <*> g'' s v+ g' s (Do m es) = Do m <$> traverse (j'' s) es+ g' s (Ado m es v) = Ado m <$> traverse (j'' s) es <*> g'' s v g' s (PositionedValue pos com v) = PositionedValue pos com <$> g'' s v g' _ other = return other h'' s = uncurry h' <=< h s - h' s (ConstructorBinder ctor bs) = ConstructorBinder ctor <$> mapM (h'' s) bs- h' s (ObjectBinder bs) = ObjectBinder <$> mapM (sndM (h'' s)) bs- h' s (ArrayBinder bs) = ArrayBinder <$> mapM (h'' s) bs- h' s (ConsBinder b1 b2) = ConsBinder <$> h'' s b1 <*> h'' s b2- h' s (NamedBinder name b) = NamedBinder name <$> h'' s b+ h' s (LiteralBinder ss l) = LiteralBinder ss <$> lit h'' s l+ h' s (ConstructorBinder ss ctor bs) = ConstructorBinder ss ctor <$> traverse (h'' s) bs+ h' s (BinaryNoParensBinder b1 b2 b3) = BinaryNoParensBinder <$> h'' s b1 <*> h'' s b2 <*> h'' s b3+ h' s (ParensInBinder b) = ParensInBinder <$> h'' s b+ h' s (NamedBinder ss name b) = NamedBinder ss name <$> h'' s b h' s (PositionedBinder pos com b) = PositionedBinder pos com <$> h'' s b+ h' s (TypedBinder t b) = TypedBinder t <$> h'' s b h' _ other = return other + lit :: (s -> a -> m a) -> s -> Literal a -> m (Literal a)+ lit go s (ArrayLiteral as) = ArrayLiteral <$> traverse (go s) as+ lit go s (ObjectLiteral as) = ObjectLiteral <$> traverse (sndM (go s)) as+ lit _ _ other = return other+ i'' s = uncurry i' <=< i s - i' s (CaseAlternative bs val) = CaseAlternative <$> mapM (h'' s) bs <*> eitherM (mapM (pairM (g'' s) (g'' s))) (g'' s) val+ i' s (CaseAlternative bs val) = CaseAlternative <$> traverse (h'' s) bs <*> traverse (guardedExprM' s) val + -- A specialized `guardedExprM` that keeps track of the context `s`+ -- after traversing `guards`, such that it's also exposed to `expr`.+ guardedExprM' :: s -> GuardedExpr -> m GuardedExpr+ guardedExprM' s (GuardedExpr guards expr) = do+ (guards', s') <- runStateT (traverse (StateT . goGuard) guards) s+ GuardedExpr guards' <$> g'' s' expr++ -- Like k'', but `s` is tracked.+ goGuard :: Guard -> s -> m (Guard, s)+ goGuard x s = k s x >>= fmap swap . sndM' k'+ j'' s = uncurry j' <=< j s j' s (DoNotationValue v) = DoNotationValue <$> g'' s v j' s (DoNotationBind b v) = DoNotationBind <$> h'' s b <*> g'' s v- j' s (DoNotationLet ds) = DoNotationLet <$> mapM (f'' s) ds+ j' s (DoNotationLet ds) = DoNotationLet <$> traverse (f'' s) ds j' s (PositionedDoNotationElement pos com e1) = PositionedDoNotationElement pos com <$> j'' s e1 -accumTypes :: (Monoid r) => (Type -> r) -> (Declaration -> r, Expr -> r, Binder -> r, CaseAlternative -> r, DoNotationElement -> r)-accumTypes f = everythingOnValues mappend forDecls forValues (const mempty) (const mempty) (const mempty)+ k'' s = uncurry k' <=< k s++ k' s (ConditionGuard e) = ConditionGuard <$> g'' s e+ k' s (PatternGuard b e) = PatternGuard <$> h'' s b <*> g'' s e++data ScopedIdent = LocalIdent Ident | ToplevelIdent Ident+ deriving (Show, Eq, Ord)++inScope :: Ident -> S.Set ScopedIdent -> Bool+inScope i s = (LocalIdent i `S.member` s) || (ToplevelIdent i `S.member` s)++everythingWithScope+ :: forall r+ . (Monoid r)+ => (S.Set ScopedIdent -> Declaration -> r)+ -> (S.Set ScopedIdent -> Expr -> r)+ -> (S.Set ScopedIdent -> Binder -> r)+ -> (S.Set ScopedIdent -> CaseAlternative -> r)+ -> (S.Set ScopedIdent -> DoNotationElement -> r)+ -> ( S.Set ScopedIdent -> Declaration -> r+ , S.Set ScopedIdent -> Expr -> r+ , S.Set ScopedIdent -> Binder -> r+ , S.Set ScopedIdent -> CaseAlternative -> r+ , S.Set ScopedIdent -> DoNotationElement -> r+ )+everythingWithScope f g h i j = (f'', g'', h'', i'', \s -> snd . j'' s) where- forDecls (DataDeclaration _ _ _ dctors) = mconcat (concatMap (map f . snd) dctors)- forDecls (ExternDeclaration _ _ _ ty) = f ty- forDecls (ExternInstanceDeclaration _ cs _ tys) = mconcat (concatMap (map f . snd) cs) `mappend` mconcat (map f tys)- forDecls (TypeClassDeclaration _ _ implies _) = mconcat (concatMap (map f . snd) implies)- forDecls (TypeInstanceDeclaration _ cs _ tys _) = mconcat (concatMap (map f . snd) cs) `mappend` mconcat (map f tys)- forDecls (TypeSynonymDeclaration _ _ ty) = f ty- forDecls (TypeDeclaration _ ty) = f ty+ f'' :: S.Set ScopedIdent -> Declaration -> r+ f'' s a = f s a <> f' s a++ f' :: S.Set ScopedIdent -> Declaration -> r+ f' s (DataBindingGroupDeclaration ds) =+ let s' = S.union s (S.fromList (map ToplevelIdent (mapMaybe getDeclIdent (NEL.toList ds))))+ in foldMap (f'' s') ds+ f' s (ValueDecl _ name _ bs val) =+ let s' = S.insert (ToplevelIdent name) s+ s'' = S.union s' (S.fromList (concatMap localBinderNames bs))+ in foldMap (h'' s') bs <> foldMap (l' s'') val+ f' s (BindingGroupDeclaration ds) =+ let s' = S.union s (S.fromList (NEL.toList (fmap (\((_, name), _, _) -> ToplevelIdent name) ds)))+ in foldMap (\(_, _, val) -> g'' s' val) ds+ f' s (TypeClassDeclaration _ _ _ _ _ ds) = foldMap (f'' s) ds+ f' s (TypeInstanceDeclaration _ _ _ _ _ _ _ _ (ExplicitInstance ds)) = foldMap (f'' s) ds+ f' _ _ = mempty++ g'' :: S.Set ScopedIdent -> Expr -> r+ g'' s a = g s a <> g' s a++ g' :: S.Set ScopedIdent -> Expr -> r+ g' s (Literal _ l) = lit g'' s l+ g' s (UnaryMinus _ v1) = g'' s v1+ g' s (BinaryNoParens op v1 v2) = g'' s op <> g'' s v1 <> g'' s v2+ g' s (Parens v1) = g'' s v1+ g' s (Accessor _ v1) = g'' s v1+ g' s (ObjectUpdate obj vs) = g'' s obj <> foldMap (g'' s . snd) vs+ g' s (ObjectUpdateNested obj vs) = g'' s obj <> foldMap (g'' s) vs+ g' s (Abs b v1) =+ let s' = S.union (S.fromList (localBinderNames b)) s+ in h'' s b <> g'' s' v1+ g' s (App v1 v2) = g'' s v1 <> g'' s v2+ g' s (VisibleTypeApp v _) = g'' s v+ g' s (Unused v) = g'' s v+ g' s (IfThenElse v1 v2 v3) = g'' s v1 <> g'' s v2 <> g'' s v3+ g' s (Case vs alts) = foldMap (g'' s) vs <> foldMap (i'' s) alts+ g' s (TypedValue _ v1 _) = g'' s v1+ g' s (Let _ ds v1) =+ let s' = S.union s (S.fromList (map LocalIdent (mapMaybe getDeclIdent ds)))+ in foldMap (f'' s') ds <> g'' s' v1+ g' s (Do _ es) = fold . snd . mapAccumL j'' s $ es+ g' s (Ado _ es v1) =+ let s' = S.union s (foldMap (fst . j'' s) es)+ in g'' s' v1+ g' s (PositionedValue _ _ v1) = g'' s v1+ g' _ _ = mempty++ h'' :: S.Set ScopedIdent -> Binder -> r+ h'' s a = h s a <> h' s a++ h' :: S.Set ScopedIdent -> Binder -> r+ h' s (LiteralBinder _ l) = lit h'' s l+ h' s (ConstructorBinder _ _ bs) = foldMap (h'' s) bs+ h' s (BinaryNoParensBinder b1 b2 b3) = foldMap (h'' s) [b1, b2, b3]+ h' s (ParensInBinder b) = h'' s b+ h' s (NamedBinder _ name b1) = h'' (S.insert (LocalIdent name) s) b1+ h' s (PositionedBinder _ _ b1) = h'' s b1+ h' s (TypedBinder _ b1) = h'' s b1+ h' _ _ = mempty++ lit :: (S.Set ScopedIdent -> a -> r) -> S.Set ScopedIdent -> Literal a -> r+ lit go s (ArrayLiteral as) = foldMap (go s) as+ lit go s (ObjectLiteral as) = foldMap (go s . snd) as+ lit _ _ _ = mempty++ i'' :: S.Set ScopedIdent -> CaseAlternative -> r+ i'' s a = i s a <> i' s a++ i' :: S.Set ScopedIdent -> CaseAlternative -> r+ i' s (CaseAlternative bs gs) =+ let s' = S.union s (S.fromList (concatMap localBinderNames bs))+ in foldMap (h'' s) bs <> foldMap (l' s') gs++ j'' :: S.Set ScopedIdent -> DoNotationElement -> (S.Set ScopedIdent, r)+ j'' s a = let (s', r) = j' s a in (s', j s a <> r)++ j' :: S.Set ScopedIdent -> DoNotationElement -> (S.Set ScopedIdent, r)+ j' s (DoNotationValue v) = (s, g'' s v)+ j' s (DoNotationBind b v) =+ let s' = S.union (S.fromList (localBinderNames b)) s+ in (s', h'' s b <> g'' s v)+ j' s (DoNotationLet ds) =+ let s' = S.union s (S.fromList (map LocalIdent (mapMaybe getDeclIdent ds)))+ in (s', foldMap (f'' s') ds)+ j' s (PositionedDoNotationElement _ _ e1) = j'' s e1++ k' :: S.Set ScopedIdent -> Guard -> (S.Set ScopedIdent, r)+ k' s (ConditionGuard e) = (s, g'' s e)+ k' s (PatternGuard b e) =+ let s' = S.union (S.fromList (localBinderNames b)) s+ in (s', h'' s b <> g'' s' e)++ l' s (GuardedExpr [] e) = g'' s e+ l' s (GuardedExpr (grd:gs) e) =+ let (s', r) = k' s grd+ in r <> l' s' (GuardedExpr gs e)++ getDeclIdent :: Declaration -> Maybe Ident+ getDeclIdent (ValueDeclaration vd) = Just (valdeclIdent vd)+ getDeclIdent (TypeDeclaration td) = Just (tydeclIdent td)+ getDeclIdent _ = Nothing++ localBinderNames = map LocalIdent . binderNames++accumTypes+ :: (Monoid r)+ => (SourceType -> r)+ -> ( Declaration -> r+ , Expr -> r+ , Binder -> r+ , CaseAlternative -> r+ , DoNotationElement -> r+ )+accumTypes f = everythingOnValues mappend forDecls forValues forBinders (const mempty) (const mempty)+ where+ forDecls (DataDeclaration _ _ _ args dctors) =+ foldMap (foldMap f . snd) args <>+ foldMap (foldMap (f . snd) . dataCtorFields) dctors+ forDecls (ExternDataDeclaration _ _ ty) = f ty+ forDecls (ExternDeclaration _ _ ty) = f ty+ forDecls (TypeClassDeclaration _ _ args implies _ _) =+ foldMap (foldMap (foldMap f)) args <>+ foldMap (foldMap f . constraintArgs) implies+ forDecls (TypeInstanceDeclaration _ _ _ _ _ cs _ tys _) =+ foldMap (foldMap f . constraintArgs) cs <> foldMap f tys+ forDecls (TypeSynonymDeclaration _ _ args ty) =+ foldMap (foldMap f . snd) args <>+ f ty+ forDecls (KindDeclaration _ _ _ ty) = f ty+ forDecls (TypeDeclaration td) = f (tydeclType td) forDecls _ = mempty - forValues (TypeClassDictionary _ (_, cs) _) = mconcat (map f cs)- forValues (SuperClassDictionary _ tys) = mconcat (map f tys)+ forValues (TypeClassDictionary c _ _) = foldMap f (constraintArgs c)+ forValues (DeferredDictionary _ tys) = foldMap f tys forValues (TypedValue _ _ ty) = f ty+ forValues (VisibleTypeApp _ ty) = f ty forValues _ = mempty++ forBinders (TypedBinder ty _) = f ty+ forBinders _ = mempty++-- |+-- Map a function over type annotations appearing inside a value+--+overTypes :: (SourceType -> SourceType) -> Expr -> Expr+overTypes f = let (_, f', _) = everywhereOnValues id g id in f'+ where+ g :: Expr -> Expr+ g (TypedValue checkTy val t) = TypedValue checkTy val (f t)+ g (TypeClassDictionary c sco hints) =+ TypeClassDictionary+ (mapConstraintArgs (fmap f) c)+ (updateCtx sco)+ hints+ g other = other+ updateDict fn dict = dict { tcdInstanceTypes = fn (tcdInstanceTypes dict) }+ updateScope = fmap . fmap . fmap . fmap $ updateDict $ fmap f+ updateCtx = M.alter updateScope ByNullSourcePos
+ src/Language/PureScript/AST/Utils.hs view
@@ -0,0 +1,59 @@+module Language.PureScript.AST.Utils where++import Protolude++import Language.PureScript.AST (Binder(..), CaseAlternative, Expr(..), GuardedExpr, Literal, pattern MkUnguarded, nullSourceSpan)+import Language.PureScript.Names (Ident, ModuleName, ProperName, ProperNameType(..), Qualified(..), QualifiedBy(..), byMaybeModuleName)+import Language.PureScript.Types (SourceType, Type(..))++lam :: Ident -> Expr -> Expr+lam = Abs . mkBinder++lamCase :: Ident -> [CaseAlternative] -> Expr+lamCase s = lam s . Case [mkVar s]++lamCase2 :: Ident -> Ident -> [CaseAlternative] -> Expr+lamCase2 s t = lam s . lam t . Case [mkVar s, mkVar t]++mkRef :: Qualified Ident -> Expr+mkRef = Var nullSourceSpan++mkVarMn :: Maybe ModuleName -> Ident -> Expr+mkVarMn mn = mkRef . Qualified (byMaybeModuleName mn)++mkVar :: Ident -> Expr+mkVar = mkVarMn Nothing++mkBinder :: Ident -> Binder+mkBinder = VarBinder nullSourceSpan++mkLit :: Literal Expr -> Expr+mkLit = Literal nullSourceSpan++mkCtor :: ModuleName -> ProperName 'ConstructorName -> Expr+mkCtor mn name = Constructor nullSourceSpan (Qualified (ByModuleName mn) name)++mkCtorBinder :: ModuleName -> ProperName 'ConstructorName -> [Binder] -> Binder+mkCtorBinder mn name = ConstructorBinder nullSourceSpan (Qualified (ByModuleName mn) name)++unguarded :: Expr -> [GuardedExpr]+unguarded e = [MkUnguarded e]++data UnwrappedTypeConstructor = UnwrappedTypeConstructor+ { utcModuleName :: ModuleName+ , utcTyCon :: ProperName 'TypeName+ , utcKindArgs :: [SourceType]+ , utcArgs :: [SourceType]+ }++utcQTyCon :: UnwrappedTypeConstructor -> Qualified (ProperName 'TypeName)+utcQTyCon UnwrappedTypeConstructor{..} = Qualified (ByModuleName utcModuleName) utcTyCon++unwrapTypeConstructor :: SourceType -> Maybe UnwrappedTypeConstructor+unwrapTypeConstructor = go [] []+ where+ go kargs args = \case+ TypeConstructor _ (Qualified (ByModuleName mn) tyCon) -> Just (UnwrappedTypeConstructor mn tyCon kargs args)+ TypeApp _ ty arg -> go kargs (arg : args) ty+ KindApp _ ty karg -> go (karg : kargs) args ty+ _ -> Nothing
+ src/Language/PureScript/Bundle.hs view
@@ -0,0 +1,449 @@+-- |+-- Bundles compiled PureScript modules for the browser.+--+-- This module takes as input the individual generated modules from 'Language.PureScript.Make' and+-- performs dead code elimination, filters empty modules,+-- and generates the final JavaScript bundle.+{-# LANGUAGE DeriveAnyClass #-}+module Language.PureScript.Bundle+ ( ModuleIdentifier(..)+ , ModuleType(..)+ , ErrorMessage(..)+ , printErrorMessage+ , ForeignModuleExports(..)+ , getExportedIdentifiers+ , ForeignModuleImports(..)+ , getImportedModules+ , Module+ ) where++import Prelude++import Control.DeepSeq (NFData)+import Control.Monad.Error.Class (MonadError(..))++import Data.Aeson ((.=))+import Data.Char (chr, digitToInt)+import Data.Foldable (fold)+import Data.Maybe (mapMaybe, maybeToList)+import Data.Aeson qualified as A+import Data.Text.Lazy qualified as LT++import GHC.Generics (Generic)++import Language.JavaScript.Parser (JSAST(..), JSAnnot(..), JSAssignOp(..), JSExpression(..), JSStatement(..), renderToText)+import Language.JavaScript.Parser.AST (JSCommaList(..), JSCommaTrailingList(..), JSExportClause(..), JSExportDeclaration(..), JSExportSpecifier(..), JSFromClause(..), JSIdent(..), JSImportDeclaration(..), JSModuleItem(..), JSObjectProperty(..), JSObjectPropertyList, JSPropertyName(..), JSVarInitializer(..))+import Language.JavaScript.Process.Minify (minifyJS)++-- | The type of error messages. We separate generation and rendering of errors using a data+-- type, in case we need to match on error types later.+data ErrorMessage+ = UnsupportedModulePath String+ | InvalidTopLevel+ | UnableToParseModule String+ | UnsupportedImport+ | UnsupportedExport+ | ErrorInModule ModuleIdentifier ErrorMessage+ | MissingEntryPoint String+ | MissingMainModule String+ deriving (Show, Generic, NFData)++-- | Modules are either "regular modules" (i.e. those generated by the PureScript compiler) or+-- foreign modules.+data ModuleType+ = Regular+ | Foreign+ deriving (Show, Eq, Ord, Generic, NFData)++showModuleType :: ModuleType -> String+showModuleType Regular = "Regular"+showModuleType Foreign = "Foreign"++-- | A module is identified by its module name and its type.+data ModuleIdentifier = ModuleIdentifier String ModuleType+ deriving (Show, Eq, Ord, Generic, NFData)++instance A.ToJSON ModuleIdentifier where+ toJSON (ModuleIdentifier name mt) =+ A.object [ "name" .= name+ , "type" .= show mt+ ]++data Visibility+ = Public+ | Internal+ deriving (Show, Eq, Ord)++-- | A piece of code is identified by its module, its name, and whether it is an internal variable+-- or a public member. These keys are used to label vertices in the dependency graph.+type Key = (ModuleIdentifier, String, Visibility)++-- | An export is either a "regular export", which exports a name from the regular module we are in,+-- or a reexport of a declaration in the corresponding foreign module.+--+-- Regular exports are labelled, since they might re-export an operator with another name.+data ExportType+ = RegularExport String+ | ForeignReexport+ deriving (Show, Eq, Ord)++-- | There are four types of module element we are interested in:+--+-- 1) Import declarations and require statements+-- 2) Member declarations+-- 3) Export lists+-- 4) Everything else+--+-- Each is labelled with the original AST node which generated it, so that we can dump it back+-- into the output during codegen.+data ModuleElement+ = Import JSModuleItem String (Either String ModuleIdentifier)+ | Member JSStatement Visibility String JSExpression [Key]+ | ExportsList [(ExportType, String, JSExpression, [Key])]+ | Other JSStatement+ | Skip JSModuleItem+ deriving (Show)++instance A.ToJSON ModuleElement where+ toJSON = \case+ (Import _ name (Right target)) ->+ A.object [ "type" .= A.String "Import"+ , "name" .= name+ , "target" .= target+ ]+ (Import _ name (Left targetPath)) ->+ A.object [ "type" .= A.String "Import"+ , "name" .= name+ , "targetPath" .= targetPath+ ]+ (Member _ visibility name _ dependsOn) ->+ A.object [ "type" .= A.String "Member"+ , "name" .= name+ , "visibility" .= show visibility+ , "dependsOn" .= map keyToJSON dependsOn+ ]+ (ExportsList exports) ->+ A.object [ "type" .= A.String "ExportsList"+ , "exports" .= map exportToJSON exports+ ]+ (Other stmt) ->+ A.object [ "type" .= A.String "Other"+ , "js" .= getFragment (JSAstStatement stmt JSNoAnnot)+ ]+ (Skip item) ->+ A.object [ "type" .= A.String "Skip"+ , "js" .= getFragment (JSAstModule [item] JSNoAnnot)+ ]++ where++ keyToJSON (mid, member, visibility) =+ A.object [ "module" .= mid+ , "member" .= member+ , "visibility" .= show visibility+ ]++ exportToJSON (RegularExport sourceName, name, _, dependsOn) =+ A.object [ "type" .= A.String "RegularExport"+ , "name" .= name+ , "sourceName" .= sourceName+ , "dependsOn" .= map keyToJSON dependsOn+ ]+ exportToJSON (ForeignReexport, name, _, dependsOn) =+ A.object [ "type" .= A.String "ForeignReexport"+ , "name" .= name+ , "dependsOn" .= map keyToJSON dependsOn+ ]++ getFragment = ellipsize . renderToText . minifyJS+ where+ ellipsize text = if LT.compareLength text 20 == GT then LT.take 19 text `LT.snoc` ellipsis else text+ ellipsis = '\x2026'++-- | A module is just a list of elements of the types listed above.+data Module = Module ModuleIdentifier (Maybe FilePath) [ModuleElement] deriving (Show)++instance A.ToJSON Module where+ toJSON (Module moduleId filePath elements) =+ A.object [ "moduleId" .= moduleId+ , "filePath" .= filePath+ , "elements" .= elements+ ]++-- | Prepare an error message for consumption by humans.+printErrorMessage :: ErrorMessage -> [String]+printErrorMessage (UnsupportedModulePath s) =+ [ "An ES or CommonJS module has an unsupported name (" ++ show s ++ ")."+ , "The following file names are supported:"+ , " 1) index.js (PureScript native modules)"+ , " 2) foreign.js (PureScript ES foreign modules)"+ , " 3) foreign.cjs (PureScript CommonJS foreign modules)"+ ]+printErrorMessage InvalidTopLevel =+ [ "Expected a list of source elements at the top level." ]+printErrorMessage (UnableToParseModule err) =+ [ "The module could not be parsed:"+ , err+ ]+printErrorMessage UnsupportedImport =+ [ "An import was unsupported."+ , "Modules can be imported with ES namespace imports declarations:"+ , " import * as module from \"Module.Name\""+ , "Alternatively, they can be also be imported with the CommonJS require function:"+ , " var module = require(\"Module.Name\")"+ ]+printErrorMessage UnsupportedExport =+ [ "An export was unsupported."+ , "Declarations can be exported as ES named exports:"+ , " export var decl"+ , "Existing identifiers can be exported as well:"+ , " export { name }"+ , "They can also be renamed on export:"+ , " export { name as alias }"+ , "Alternatively, CommonJS exports can be defined in one of two ways:"+ , " 1) exports.name = value"+ , " 2) exports = { name: value }"+ ]+printErrorMessage (ErrorInModule mid e) =+ ("Error in module " ++ displayIdentifier mid ++ ":")+ : ""+ : map (" " ++) (printErrorMessage e)+ where+ displayIdentifier (ModuleIdentifier name ty) =+ name ++ " (" ++ showModuleType ty ++ ")"+printErrorMessage (MissingEntryPoint mName) =+ [ "Could not find an ES module or CommonJS module for the specified entry point: " ++ mName+ ]+printErrorMessage (MissingMainModule mName) =+ [ "Could not find an ES module or CommonJS module for the specified main module: " ++ mName+ ]++-- String literals include the quote chars+fromStringLiteral :: JSExpression -> Maybe String+fromStringLiteral (JSStringLiteral _ str) = Just $ strValue str+fromStringLiteral _ = Nothing++strValue :: String -> String+strValue str = go $ drop 1 str+ where+ go ('\\' : 'b' : xs) = '\b' : go xs+ go ('\\' : 'f' : xs) = '\f' : go xs+ go ('\\' : 'n' : xs) = '\n' : go xs+ go ('\\' : 'r' : xs) = '\r' : go xs+ go ('\\' : 't' : xs) = '\t' : go xs+ go ('\\' : 'v' : xs) = '\v' : go xs+ go ('\\' : '0' : xs) = '\0' : go xs+ go ('\\' : 'x' : a : b : xs) = chr (a' + b') : go xs+ where+ a' = 16 * digitToInt a+ b' = digitToInt b+ go ('\\' : 'u' : a : b : c : d : xs) = chr (a' + b' + c' + d') : go xs+ where+ a' = 16 * 16 * 16 * digitToInt a+ b' = 16 * 16 * digitToInt b+ c' = 16 * digitToInt c+ d' = digitToInt d+ go ('\\' : x : xs) = x : go xs+ go "\"" = ""+ go "'" = ""+ go (x : xs) = x : go xs+ go "" = ""++commaList :: JSCommaList a -> [a]+commaList JSLNil = []+commaList (JSLOne x) = [x]+commaList (JSLCons l _ x) = commaList l ++ [x]++trailingCommaList :: JSCommaTrailingList a -> [a]+trailingCommaList (JSCTLComma l _) = commaList l+trailingCommaList (JSCTLNone l) = commaList l++identName :: JSIdent -> Maybe String+identName (JSIdentName _ ident) = Just ident+identName _ = Nothing++exportStatementIdentifiers :: JSStatement -> [String]+exportStatementIdentifiers (JSVariable _ jsExpressions _) =+ varNames jsExpressions+exportStatementIdentifiers (JSConstant _ jsExpressions _) =+ varNames jsExpressions+exportStatementIdentifiers (JSLet _ jsExpressions _) =+ varNames jsExpressions+exportStatementIdentifiers (JSClass _ jsIdent _ _ _ _ _) =+ maybeToList . identName $ jsIdent+exportStatementIdentifiers (JSFunction _ jsIdent _ _ _ _ _) =+ maybeToList . identName $ jsIdent+exportStatementIdentifiers (JSGenerator _ _ jsIdent _ _ _ _ _) =+ maybeToList . identName $ jsIdent+exportStatementIdentifiers _ = []++varNames :: JSCommaList JSExpression -> [String]+varNames = mapMaybe varName . commaList+ where+ varName (JSVarInitExpression (JSIdentifier _ ident) _) = Just ident+ varName _ = Nothing++data ForeignModuleExports =+ ForeignModuleExports+ { cjsExports :: [String]+ , esExports :: [String]+ } deriving (Show)++instance Semigroup ForeignModuleExports where+ (ForeignModuleExports cjsExports esExports) <> (ForeignModuleExports cjsExports' esExports') =+ ForeignModuleExports (cjsExports <> cjsExports') (esExports <> esExports')+instance Monoid ForeignModuleExports where+ mempty = ForeignModuleExports [] []++-- Get a list of all the exported identifiers from a foreign module.+--+-- TODO: what if we assign to exports.foo and then later assign to+-- module.exports (presumably overwriting exports.foo)?+getExportedIdentifiers :: forall m. (MonadError ErrorMessage m)+ => String+ -> JSAST+ -> m ForeignModuleExports+getExportedIdentifiers mname top+ | JSAstModule jsModuleItems _ <- top = fold <$> traverse go jsModuleItems+ | otherwise = err InvalidTopLevel+ where+ err :: ErrorMessage -> m a+ err = throwError . ErrorInModule (ModuleIdentifier mname Foreign)++ go (JSModuleStatementListItem jsStatement)+ | Just props <- matchExportsAssignment jsStatement+ = do cjsExports <- traverse toIdent (trailingCommaList props)+ pure ForeignModuleExports{ cjsExports, esExports = [] }+ | Just (Public, name, _) <- matchMember jsStatement+ = pure ForeignModuleExports{ cjsExports = [name], esExports = [] }+ | otherwise+ = pure mempty+ go (JSModuleExportDeclaration _ jsExportDeclaration) =+ pure ForeignModuleExports{ cjsExports = [], esExports = exportDeclarationIdentifiers jsExportDeclaration }+ go _ = pure mempty++ toIdent (JSPropertyNameandValue name _ [_]) =+ extractLabel' name+ toIdent _ =+ err UnsupportedExport++ extractLabel' = maybe (err UnsupportedExport) pure . extractLabel++ exportDeclarationIdentifiers (JSExportFrom jsExportClause _ _) =+ exportClauseIdentifiers jsExportClause+ exportDeclarationIdentifiers (JSExportLocals jsExportClause _) =+ exportClauseIdentifiers jsExportClause+ exportDeclarationIdentifiers (JSExport jsStatement _) =+ exportStatementIdentifiers jsStatement++ exportClauseIdentifiers (JSExportClause _ jsExportsSpecifiers _) =+ mapMaybe exportSpecifierName $ commaList jsExportsSpecifiers++ exportSpecifierName (JSExportSpecifier jsIdent) = identName jsIdent+ exportSpecifierName (JSExportSpecifierAs _ _ jsIdentAs) = identName jsIdentAs++data ForeignModuleImports =+ ForeignModuleImports+ { cjsImports :: [String]+ , esImports :: [String]+ } deriving (Show)++instance Semigroup ForeignModuleImports where+ (ForeignModuleImports cjsImports esImports) <> (ForeignModuleImports cjsImports' esImports') =+ ForeignModuleImports (cjsImports <> cjsImports') (esImports <> esImports')+instance Monoid ForeignModuleImports where+ mempty = ForeignModuleImports [] []++-- Get a list of all the imported module identifiers from a foreign module.+getImportedModules :: forall m. (MonadError ErrorMessage m)+ => String+ -> JSAST+ -> m ForeignModuleImports+getImportedModules mname top+ | JSAstModule jsModuleItems _ <- top = pure $ foldMap go jsModuleItems+ | otherwise = err InvalidTopLevel+ where+ err :: ErrorMessage -> m a+ err = throwError . ErrorInModule (ModuleIdentifier mname Foreign)++ go (JSModuleStatementListItem jsStatement)+ | Just (_, mid) <- matchRequire jsStatement+ = ForeignModuleImports{ cjsImports = [mid], esImports = [] }+ go (JSModuleImportDeclaration _ jsImportDeclaration) =+ ForeignModuleImports{ cjsImports = [], esImports = [importDeclarationModuleId jsImportDeclaration] }+ go _ = mempty++ importDeclarationModuleId (JSImportDeclaration _ (JSFromClause _ _ mid) _) = mid+ importDeclarationModuleId (JSImportDeclarationBare _ mid _) = mid++-- Matches JS statements like this:+-- var ModuleName = require("file");+matchRequire :: JSStatement -> Maybe (String, String)+matchRequire stmt+ | JSVariable _ jsInit _ <- stmt+ , [JSVarInitExpression var varInit] <- commaList jsInit+ , JSIdentifier _ importName <- var+ , JSVarInit _ jsInitEx <- varInit+ , JSMemberExpression req _ argsE _ <- jsInitEx+ , JSIdentifier _ "require" <- req+ , [ Just importPath ] <- map fromStringLiteral (commaList argsE)+ = Just (importName, importPath)+ | otherwise+ = Nothing++-- Matches JS member declarations.+matchMember :: JSStatement -> Maybe (Visibility, String, JSExpression)+matchMember stmt+ | Just (name, decl) <- matchInternalMember stmt+ = pure (Internal, name, decl)+ -- exports.foo = expr; exports["foo"] = expr;+ | JSAssignStatement e (JSAssign _) decl _ <- stmt+ , Just name <- exportsAccessor e+ = Just (Public, name, decl)+ | otherwise+ = Nothing++matchInternalMember :: JSStatement -> Maybe (String, JSExpression)+matchInternalMember stmt+ -- var foo = expr;+ | JSVariable _ jsInit _ <- stmt+ , [JSVarInitExpression var varInit] <- commaList jsInit+ , JSIdentifier _ name <- var+ , JSVarInit _ decl <- varInit+ = pure (name, decl)+ -- function foo(...args) { body }+ | JSFunction a0 jsIdent a1 args a2 body _ <- stmt+ , JSIdentName _ name <- jsIdent+ = pure (name, JSFunctionExpression a0 jsIdent a1 args a2 body)+ | otherwise+ = Nothing++-- Matches exports.* or exports["*"] expressions and returns the property name.+exportsAccessor :: JSExpression -> Maybe String+exportsAccessor (JSMemberDot exports _ nm)+ | JSIdentifier _ "exports" <- exports+ , JSIdentifier _ name <- nm+ = Just name+exportsAccessor (JSMemberSquare exports _ nm _)+ | JSIdentifier _ "exports" <- exports+ , Just name <- fromStringLiteral nm+ = Just name+exportsAccessor _ = Nothing++-- Matches assignments to module.exports, like this:+-- module.exports = { ... }+matchExportsAssignment :: JSStatement -> Maybe JSObjectPropertyList+matchExportsAssignment stmt+ | JSAssignStatement e (JSAssign _) decl _ <- stmt+ , JSMemberDot module' _ exports <- e+ , JSIdentifier _ "module" <- module'+ , JSIdentifier _ "exports" <- exports+ , JSObjectLiteral _ props _ <- decl+ = Just props+ | otherwise+ = Nothing++extractLabel :: JSPropertyName -> Maybe String+extractLabel (JSPropertyString _ nm) = Just $ strValue nm+extractLabel (JSPropertyIdent _ nm) = Just nm+extractLabel _ = Nothing
+ src/Language/PureScript/CST.hs view
@@ -0,0 +1,105 @@+module Language.PureScript.CST+ ( parseFromFile+ , parseFromFiles+ , parseModuleFromFile+ , parseModulesFromFiles+ , unwrapParserError+ , toMultipleErrors+ , toMultipleWarnings+ , toPositionedError+ , toPositionedWarning+ , pureResult+ , module Language.PureScript.CST.Convert+ , module Language.PureScript.CST.Errors+ , module Language.PureScript.CST.Lexer+ , module Language.PureScript.CST.Monad+ , module Language.PureScript.CST.Parser+ , module Language.PureScript.CST.Print+ , module Language.PureScript.CST.Types+ ) where++import Prelude hiding (lex)++import Control.Monad.Error.Class (MonadError(..))+import Control.Parallel.Strategies (withStrategy, parList, evalTuple2, r0, rseq)+import Data.List.NonEmpty qualified as NE+import Data.Text (Text)+import Language.PureScript.AST qualified as AST+import Language.PureScript.Errors qualified as E+import Language.PureScript.CST.Convert+import Language.PureScript.CST.Errors+import Language.PureScript.CST.Lexer+import Language.PureScript.CST.Monad (Parser, ParserM(..), ParserState(..), LexResult, runParser, runTokenParser)+import Language.PureScript.CST.Parser+import Language.PureScript.CST.Print+import Language.PureScript.CST.Types++pureResult :: a -> PartialResult a+pureResult a = PartialResult a ([], pure a)++parseModulesFromFiles+ :: forall m k+ . MonadError E.MultipleErrors m+ => (k -> FilePath)+ -> [(k, Text)]+ -> m [(k, PartialResult AST.Module)]+parseModulesFromFiles toFilePath input =+ flip E.parU (handleParserError toFilePath)+ . inParallel+ . flip fmap input+ $ \(k, a) -> (k, parseModuleFromFile (toFilePath k) a)++parseFromFiles+ :: forall m k+ . MonadError E.MultipleErrors m+ => (k -> FilePath)+ -> [(k, Text)]+ -> m [(k, ([ParserWarning], AST.Module))]+parseFromFiles toFilePath input =+ flip E.parU (handleParserError toFilePath)+ . inParallel+ . flip fmap input+ $ \(k, a) -> (k, sequence $ parseFromFile (toFilePath k) a)++parseModuleFromFile :: FilePath -> Text -> Either (NE.NonEmpty ParserError) (PartialResult AST.Module)+parseModuleFromFile fp content = fmap (convertModule fp) <$> parseModule (lexModule content)++parseFromFile :: FilePath -> Text -> ([ParserWarning], Either (NE.NonEmpty ParserError) AST.Module)+parseFromFile fp content = fmap (convertModule fp) <$> parse content++handleParserError+ :: forall m k a+ . MonadError E.MultipleErrors m+ => (k -> FilePath)+ -> (k, Either (NE.NonEmpty ParserError) a)+ -> m (k, a)+handleParserError toFilePath (k, res) =+ (k,) <$> unwrapParserError (toFilePath k) res++unwrapParserError+ :: forall m a+ . MonadError E.MultipleErrors m+ => FilePath+ -> Either (NE.NonEmpty ParserError) a+ -> m a+unwrapParserError fp =+ either (throwError . toMultipleErrors fp) pure++toMultipleErrors :: FilePath -> NE.NonEmpty ParserError -> E.MultipleErrors+toMultipleErrors fp =+ E.MultipleErrors . NE.toList . fmap (toPositionedError fp)++toMultipleWarnings :: FilePath -> [ParserWarning] -> E.MultipleErrors+toMultipleWarnings fp =+ E.MultipleErrors . fmap (toPositionedWarning fp)++toPositionedError :: FilePath -> ParserError -> E.ErrorMessage+toPositionedError name perr =+ E.ErrorMessage [E.positionedError $ sourceSpan name $ errRange perr] (E.ErrorParsingCSTModule perr)++toPositionedWarning :: FilePath -> ParserWarning -> E.ErrorMessage+toPositionedWarning name perr =+ E.ErrorMessage [E.positionedError $ sourceSpan name $ errRange perr] (E.WarningParsingCSTModule perr)++inParallel :: [(k, Either (NE.NonEmpty ParserError) a)] -> [(k, Either (NE.NonEmpty ParserError) a)]+inParallel = withStrategy (parList (evalTuple2 r0 rseq))
+ src/Language/PureScript/CST/Convert.hs view
@@ -0,0 +1,709 @@+-- | This module contains functions for converting the CST into the core AST. It+-- is mostly boilerplate, and does the job of resolving ranges for all the nodes+-- and attaching comments.++module Language.PureScript.CST.Convert+ ( convertType+ , convertExpr+ , convertBinder+ , convertDeclaration+ , convertImportDecl+ , convertModule+ , sourcePos+ , sourceSpan+ , comment+ , comments+ ) where++import Prelude hiding (take)++import Data.Bifunctor (bimap, first)+import Data.Char (toLower)+import Data.Foldable (foldl', toList)+import Data.Functor (($>))+import Data.List.NonEmpty qualified as NE+import Data.Maybe (isJust, fromJust, mapMaybe)+import Data.Text qualified as Text+import Language.PureScript.AST qualified as AST+import Language.PureScript.AST.Declarations.ChainId (mkChainId)+import Language.PureScript.AST.SourcePos qualified as Pos+import Language.PureScript.Comments qualified as C+import Language.PureScript.Crash (internalError)+import Language.PureScript.Environment qualified as Env+import Language.PureScript.Label qualified as L+import Language.PureScript.Names qualified as N+import Language.PureScript.PSString (mkString, prettyPrintStringJS)+import Language.PureScript.Types qualified as T+import Language.PureScript.CST.Positions+import Language.PureScript.CST.Print (printToken)+import Language.PureScript.CST.Types++comment :: Comment a -> Maybe C.Comment+comment = \case+ Comment t+ | "{-" `Text.isPrefixOf` t -> Just $ C.BlockComment $ Text.drop 2 $ Text.dropEnd 2 t+ | "--" `Text.isPrefixOf` t -> Just $ C.LineComment $ Text.drop 2 t+ _ -> Nothing++comments :: [Comment a] -> [C.Comment]+comments = mapMaybe comment++sourcePos :: SourcePos -> Pos.SourcePos+sourcePos (SourcePos line col) = Pos.SourcePos line col++sourceSpan :: String -> SourceRange -> Pos.SourceSpan+sourceSpan name (SourceRange start end) = Pos.SourceSpan name (sourcePos start) (sourcePos end)++widenLeft :: TokenAnn -> Pos.SourceAnn -> Pos.SourceAnn+widenLeft ann (sp, _) =+ ( Pos.widenSourceSpan (sourceSpan (Pos.spanName sp) $ tokRange ann) sp+ , comments $ tokLeadingComments ann+ )++sourceAnnCommented :: String -> SourceToken -> SourceToken -> Pos.SourceAnn+sourceAnnCommented fileName (SourceToken ann1 _) (SourceToken ann2 _) =+ ( Pos.SourceSpan fileName (sourcePos $ srcStart $ tokRange ann1) (sourcePos $ srcEnd $ tokRange ann2)+ , comments $ tokLeadingComments ann1+ )++sourceAnn :: String -> SourceToken -> SourceToken -> Pos.SourceAnn+sourceAnn fileName (SourceToken ann1 _) (SourceToken ann2 _) =+ ( Pos.SourceSpan fileName (sourcePos $ srcStart $ tokRange ann1) (sourcePos $ srcEnd $ tokRange ann2)+ , []+ )++sourceName :: String -> Name a -> Pos.SourceAnn+sourceName fileName a = sourceAnnCommented fileName (nameTok a) (nameTok a)++sourceQualName :: String -> QualifiedName a -> Pos.SourceAnn+sourceQualName fileName a = sourceAnnCommented fileName (qualTok a) (qualTok a)++moduleName :: Token -> Maybe N.ModuleName+moduleName = \case+ TokLowerName as _ -> go as+ TokUpperName as _ -> go as+ TokSymbolName as _ -> go as+ TokOperator as _ -> go as+ _ -> Nothing+ where+ go [] = Nothing+ go ns = Just $ N.ModuleName $ Text.intercalate "." ns++qualified :: QualifiedName a -> N.Qualified a+qualified q = N.Qualified qb (qualName q)+ where+ qb = maybe N.ByNullSourcePos N.ByModuleName $ qualModule q++ident :: Ident -> N.Ident+ident = N.Ident . getIdent++convertType :: String -> Type a -> T.SourceType+convertType = convertType' False++convertVtaType :: String -> Type a -> T.SourceType+convertVtaType = convertType' True++convertType' :: Bool -> String -> Type a -> T.SourceType+convertType' withinVta fileName = go+ where+ goRow (Row labels tl) b = do+ let+ rowTail = case tl of+ Just (_, ty) -> go ty+ Nothing -> T.REmpty $ sourceAnnCommented fileName b b+ rowCons (Labeled a _ ty) c = do+ let ann = sourceAnnCommented fileName (lblTok a) (snd $ typeRange ty)+ T.RCons ann (L.Label $ lblName a) (go ty) c+ case labels of+ Just (Separated h t) ->+ rowCons h $ foldr (rowCons . snd) rowTail t+ Nothing ->+ rowTail++ go = \case+ TypeVar _ a ->+ T.TypeVar (sourceName fileName a) . getIdent $ nameValue a+ TypeConstructor _ a ->+ T.TypeConstructor (sourceQualName fileName a) $ qualified a+ TypeWildcard _ a ->+ T.TypeWildcard (sourceAnnCommented fileName a a) $ if withinVta then T.IgnoredWildcard else T.UnnamedWildcard+ TypeHole _ a ->+ T.TypeWildcard (sourceName fileName a) . T.HoleWildcard . getIdent $ nameValue a+ TypeString _ a b ->+ T.TypeLevelString (sourceAnnCommented fileName a a) b+ TypeInt _ _ a b ->+ T.TypeLevelInt (sourceAnnCommented fileName a a) b+ TypeRow _ (Wrapped _ row b) ->+ goRow row b+ TypeRecord _ (Wrapped a row b) -> do+ let+ ann = sourceAnnCommented fileName a b+ annRec = sourceAnn fileName a a+ T.TypeApp ann (Env.tyRecord $> annRec) $ goRow row b+ TypeForall _ kw bindings _ ty -> do+ let+ mkForAll a b v t = do+ let ann' = widenLeft (tokAnn $ nameTok a) $ T.getAnnForType t+ T.ForAll ann' (maybe T.TypeVarInvisible (const T.TypeVarVisible) v) (getIdent $ nameValue a) b t Nothing+ k (TypeVarKinded (Wrapped _ (Labeled (v, a) _ b) _)) = mkForAll a (Just (go b)) v+ k (TypeVarName (v, a)) = mkForAll a Nothing v+ ty' = foldr k (go ty) bindings+ ann = widenLeft (tokAnn kw) $ T.getAnnForType ty'+ T.setAnnForType ann ty'+ TypeKinded _ ty _ kd -> do+ let+ ty' = go ty+ kd' = go kd+ ann = Pos.widenSourceAnn (T.getAnnForType ty') (T.getAnnForType kd')+ T.KindedType ann ty' kd'+ TypeApp _ a b -> do+ let+ a' = go a+ b' = go b+ ann = Pos.widenSourceAnn (T.getAnnForType a') (T.getAnnForType b')+ T.TypeApp ann a' b'+ ty@(TypeOp _ _ _ _) -> do+ let+ reassoc op b' a = do+ let+ a' = go a+ op' = T.TypeOp (sourceQualName fileName op) $ qualified op+ ann = Pos.widenSourceAnn (T.getAnnForType a') (T.getAnnForType b')+ T.BinaryNoParensType ann op' (go a) b'+ loop k = \case+ TypeOp _ a op b -> loop (reassoc op (k b)) a+ expr' -> k expr'+ loop go ty+ TypeOpName _ op -> do+ let rng = qualRange op+ T.TypeOp (uncurry (sourceAnnCommented fileName) rng) (qualified op)+ TypeArr _ a arr b -> do+ let+ a' = go a+ b' = go b+ arr' = Env.tyFunction $> sourceAnnCommented fileName arr arr+ ann = Pos.widenSourceAnn (T.getAnnForType a') (T.getAnnForType b')+ T.TypeApp ann (T.TypeApp ann arr' a') b'+ TypeArrName _ a ->+ Env.tyFunction $> sourceAnnCommented fileName a a+ TypeConstrained _ a _ b -> do+ let+ a' = convertConstraint withinVta fileName a+ b' = go b+ ann = Pos.widenSourceAnn (T.constraintAnn a') (T.getAnnForType b')+ T.ConstrainedType ann a' b'+ TypeParens _ (Wrapped a ty b) ->+ T.ParensInType (sourceAnnCommented fileName a b) $ go ty+ ty@(TypeUnaryRow _ _ a) -> do+ let+ a' = go a+ rng = typeRange ty+ ann = uncurry (sourceAnnCommented fileName) rng+ T.setAnnForType ann $ Env.kindRow a'++convertConstraint :: Bool -> String -> Constraint a -> T.SourceConstraint+convertConstraint withinVta fileName = go+ where+ go = \case+ cst@(Constraint _ name args) -> do+ let ann = uncurry (sourceAnnCommented fileName) $ constraintRange cst+ T.Constraint ann (qualified name) [] (convertType' withinVta fileName <$> args) Nothing+ ConstraintParens _ (Wrapped _ c _) -> go c++convertGuarded :: String -> Guarded a -> [AST.GuardedExpr]+convertGuarded fileName = \case+ Unconditional _ x -> [AST.GuardedExpr [] (convertWhere fileName x)]+ Guarded gs -> (\(GuardedExpr _ ps _ x) -> AST.GuardedExpr (p <$> toList ps) (convertWhere fileName x)) <$> NE.toList gs+ where+ go = convertExpr fileName+ p (PatternGuard Nothing x) = AST.ConditionGuard (go x)+ p (PatternGuard (Just (b, _)) x) = AST.PatternGuard (convertBinder fileName b) (go x)++convertWhere :: String -> Where a -> AST.Expr+convertWhere fileName = \case+ Where expr Nothing -> convertExpr fileName expr+ Where expr (Just (_, bs)) -> do+ let ann = uncurry (sourceAnnCommented fileName) $ exprRange expr+ uncurry AST.PositionedValue ann . AST.Let AST.FromWhere (convertLetBinding fileName <$> NE.toList bs) $ convertExpr fileName expr++convertLetBinding :: String -> LetBinding a -> AST.Declaration+convertLetBinding fileName = \case+ LetBindingSignature _ lbl ->+ convertSignature fileName lbl+ binding@(LetBindingName _ fields) -> do+ let ann = uncurry (sourceAnnCommented fileName) $ letBindingRange binding+ convertValueBindingFields fileName ann fields+ binding@(LetBindingPattern _ a _ b) -> do+ let ann = uncurry (sourceAnnCommented fileName) $ letBindingRange binding+ AST.BoundValueDeclaration ann (convertBinder fileName a) (convertWhere fileName b)++convertExpr :: forall a. String -> Expr a -> AST.Expr+convertExpr fileName = go+ where+ positioned =+ uncurry AST.PositionedValue++ goDoStatement = \case+ stmt@(DoLet _ as) -> do+ let ann = uncurry (sourceAnnCommented fileName) $ doStatementRange stmt+ uncurry AST.PositionedDoNotationElement ann . AST.DoNotationLet $ convertLetBinding fileName <$> NE.toList as+ stmt@(DoDiscard a) -> do+ let ann = uncurry (sourceAnn fileName) $ doStatementRange stmt+ uncurry AST.PositionedDoNotationElement ann . AST.DoNotationValue $ go a+ stmt@(DoBind a _ b) -> do+ let+ ann = uncurry (sourceAnn fileName) $ doStatementRange stmt+ a' = convertBinder fileName a+ b' = go b+ uncurry AST.PositionedDoNotationElement ann $ AST.DoNotationBind a' b'++ go = \case+ ExprHole _ a ->+ positioned (sourceName fileName a) . AST.Hole . getIdent $ nameValue a+ ExprSection _ a ->+ positioned (sourceAnnCommented fileName a a) AST.AnonymousArgument+ ExprIdent _ a -> do+ let ann = sourceQualName fileName a+ positioned ann . AST.Var (fst ann) . qualified $ fmap ident a+ ExprConstructor _ a -> do+ let ann = sourceQualName fileName a+ positioned ann . AST.Constructor (fst ann) $ qualified a+ ExprBoolean _ a b -> do+ let ann = sourceAnnCommented fileName a a+ positioned ann . AST.Literal (fst ann) $ AST.BooleanLiteral b+ ExprChar _ a b -> do+ let ann = sourceAnnCommented fileName a a+ positioned ann . AST.Literal (fst ann) $ AST.CharLiteral b+ ExprString _ a b -> do+ let ann = sourceAnnCommented fileName a a+ positioned ann . AST.Literal (fst ann) . AST.StringLiteral $ b+ ExprNumber _ a b -> do+ let ann = sourceAnnCommented fileName a a+ positioned ann . AST.Literal (fst ann) $ AST.NumericLiteral b+ ExprArray _ (Wrapped a bs c) -> do+ let+ ann = sourceAnnCommented fileName a c+ vals = case bs of+ Just (Separated x xs) -> go x : (go . snd <$> xs)+ Nothing -> []+ positioned ann . AST.Literal (fst ann) $ AST.ArrayLiteral vals+ ExprRecord z (Wrapped a bs c) -> do+ let+ ann = sourceAnnCommented fileName a c+ lbl = \case+ RecordPun f -> (mkString . getIdent $ nameValue f, go . ExprIdent z $ QualifiedName (nameTok f) Nothing (nameValue f))+ RecordField f _ v -> (lblName f, go v)+ vals = case bs of+ Just (Separated x xs) -> lbl x : (lbl . snd <$> xs)+ Nothing -> []+ positioned ann . AST.Literal (fst ann) $ AST.ObjectLiteral vals+ ExprParens _ (Wrapped a b c) ->+ positioned (sourceAnnCommented fileName a c) . AST.Parens $ go b+ expr@(ExprTyped _ a _ b) -> do+ let+ a' = go a+ b' = convertType fileName b+ ann = (sourceSpan fileName . toSourceRange $ exprRange expr, [])+ positioned ann $ AST.TypedValue True a' b'+ expr@(ExprInfix _ a (Wrapped _ b _) c) -> do+ let ann = (sourceSpan fileName . toSourceRange $ exprRange expr, [])+ positioned ann $ AST.BinaryNoParens (go b) (go a) (go c)+ expr@(ExprOp _ _ _ _) -> do+ let+ ann = uncurry (sourceAnn fileName) $ exprRange expr+ reassoc op b a = do+ let op' = AST.Op (sourceSpan fileName . toSourceRange $ qualRange op) $ qualified op+ AST.BinaryNoParens op' (go a) b+ loop k = \case+ ExprOp _ a op b -> loop (reassoc op (k b)) a+ expr' -> k expr'+ positioned ann $ loop go expr+ ExprOpName _ op -> do+ let+ rng = qualRange op+ op' = AST.Op (sourceSpan fileName $ toSourceRange rng) $ qualified op+ positioned (uncurry (sourceAnnCommented fileName) rng) op'+ expr@(ExprNegate _ _ b) -> do+ let ann = uncurry (sourceAnnCommented fileName) $ exprRange expr+ positioned ann . AST.UnaryMinus (fst ann) $ go b+ expr@(ExprRecordAccessor _ (RecordAccessor a _ (Separated h t))) -> do+ let+ ann = uncurry (sourceAnnCommented fileName) $ exprRange expr+ field x f = AST.Accessor (lblName f) x+ positioned ann $ foldl' (\x (_, f) -> field x f) (field (go a) h) t+ expr@(ExprRecordUpdate _ a b) -> do+ let+ ann = uncurry (sourceAnnCommented fileName) $ exprRange expr+ k (RecordUpdateLeaf f _ x) = (lblName f, AST.Leaf $ go x)+ k (RecordUpdateBranch f xs) = (lblName f, AST.Branch $ toTree xs)+ toTree (Wrapped _ xs _) = AST.PathTree . AST.AssocList . map k $ toList xs+ positioned ann . AST.ObjectUpdateNested (go a) $ toTree b+ expr@(ExprApp _ a b) -> do+ let ann = uncurry (sourceAnn fileName) $ exprRange expr+ positioned ann $ AST.App (go a) (go b)+ expr@(ExprVisibleTypeApp _ a _ b) -> do+ let ann = uncurry (sourceAnn fileName) $ exprRange expr+ positioned ann $ AST.VisibleTypeApp (go a) (convertVtaType fileName b)+ expr@(ExprLambda _ (Lambda _ as _ b)) -> do+ let ann = uncurry (sourceAnnCommented fileName) $ exprRange expr+ positioned ann+ . AST.Abs (convertBinder fileName (NE.head as))+ . foldr (AST.Abs . convertBinder fileName) (go b)+ $ NE.tail as+ expr@(ExprIf _ (IfThenElse _ a _ b _ c)) -> do+ let ann = uncurry (sourceAnnCommented fileName) $ exprRange expr+ positioned ann $ AST.IfThenElse (go a) (go b) (go c)+ expr@(ExprCase _ (CaseOf _ as _ bs)) -> do+ let+ ann = uncurry (sourceAnnCommented fileName) $ exprRange expr+ as' = go <$> toList as+ bs' = uncurry AST.CaseAlternative . bimap (map (convertBinder fileName) . toList) (convertGuarded fileName) <$> NE.toList bs+ positioned ann $ AST.Case as' bs'+ expr@(ExprLet _ (LetIn _ as _ b)) -> do+ let ann = uncurry (sourceAnnCommented fileName) $ exprRange expr+ positioned ann . AST.Let AST.FromLet (convertLetBinding fileName <$> NE.toList as) $ go b+ -- expr@(ExprWhere _ (Where a _ bs)) -> do+ -- let ann = uncurry (sourceAnnCommented fileName) $ exprRange expr+ -- positioned ann . AST.Let AST.FromWhere (goLetBinding <$> bs) $ go a+ expr@(ExprDo _ (DoBlock kw stmts)) -> do+ let ann = uncurry (sourceAnnCommented fileName) $ exprRange expr+ positioned ann . AST.Do (moduleName $ tokValue kw) $ goDoStatement <$> NE.toList stmts+ expr@(ExprAdo _ (AdoBlock kw stms _ a)) -> do+ let ann = uncurry (sourceAnnCommented fileName) $ exprRange expr+ positioned ann . AST.Ado (moduleName $ tokValue kw) (goDoStatement <$> stms) $ go a++convertBinder :: String -> Binder a -> AST.Binder+convertBinder fileName = go+ where+ positioned =+ uncurry AST.PositionedBinder++ go = \case+ BinderWildcard _ a ->+ positioned (sourceAnnCommented fileName a a) AST.NullBinder+ BinderVar _ a -> do+ let ann = sourceName fileName a+ positioned ann . AST.VarBinder (fst ann) . ident $ nameValue a+ binder@(BinderNamed _ a _ b) -> do+ let ann = uncurry (sourceAnnCommented fileName) $ binderRange binder+ positioned ann . AST.NamedBinder (fst ann) (ident $ nameValue a) $ go b+ binder@(BinderConstructor _ a bs) -> do+ let ann = uncurry (sourceAnnCommented fileName) $ binderRange binder+ positioned ann . AST.ConstructorBinder (fst ann) (qualified a) $ go <$> bs+ BinderBoolean _ a b -> do+ let ann = sourceAnnCommented fileName a a+ positioned ann . AST.LiteralBinder (fst ann) $ AST.BooleanLiteral b+ BinderChar _ a b -> do+ let ann = sourceAnnCommented fileName a a+ positioned ann . AST.LiteralBinder (fst ann) $ AST.CharLiteral b+ BinderString _ a b -> do+ let ann = sourceAnnCommented fileName a a+ positioned ann . AST.LiteralBinder (fst ann) . AST.StringLiteral $ b+ BinderNumber _ n a b -> do+ let+ ann = sourceAnnCommented fileName a a+ b'+ | isJust n = bimap negate negate b+ | otherwise = b+ positioned ann . AST.LiteralBinder (fst ann) $ AST.NumericLiteral b'+ BinderArray _ (Wrapped a bs c) -> do+ let+ ann = sourceAnnCommented fileName a c+ vals = case bs of+ Just (Separated x xs) -> go x : (go . snd <$> xs)+ Nothing -> []+ positioned ann . AST.LiteralBinder (fst ann) $ AST.ArrayLiteral vals+ BinderRecord z (Wrapped a bs c) -> do+ let+ ann = sourceAnnCommented fileName a c+ lbl = \case+ RecordPun f -> (mkString . getIdent $ nameValue f, go $ BinderVar z f)+ RecordField f _ v -> (lblName f, go v)+ vals = case bs of+ Just (Separated x xs) -> lbl x : (lbl . snd <$> xs)+ Nothing -> []+ positioned ann . AST.LiteralBinder (fst ann) $ AST.ObjectLiteral vals+ BinderParens _ (Wrapped a b c) ->+ positioned (sourceAnnCommented fileName a c) . AST.ParensInBinder $ go b+ binder@(BinderTyped _ a _ b) -> do+ let+ a' = go a+ b' = convertType fileName b+ ann = (sourceSpan fileName . toSourceRange $ binderRange binder, [])+ positioned ann $ AST.TypedBinder b' a'+ binder@(BinderOp _ _ _ _) -> do+ let+ ann = uncurry (sourceAnn fileName) $ binderRange binder+ reassoc op b a = do+ let op' = AST.OpBinder (sourceSpan fileName . toSourceRange $ qualRange op) $ qualified op+ AST.BinaryNoParensBinder op' (go a) b+ loop k = \case+ BinderOp _ a op b -> loop (reassoc op (k b)) a+ binder' -> k binder'+ positioned ann $ loop go binder++convertDeclaration :: String -> Declaration a -> [AST.Declaration]+convertDeclaration fileName decl = case decl of+ DeclData _ (DataHead _ a vars) bd -> do+ let+ ctrs :: SourceToken -> DataCtor a -> [(SourceToken, DataCtor a)] -> [AST.DataConstructorDeclaration]+ ctrs st (DataCtor _ name fields) tl+ = AST.DataConstructorDeclaration (sourceAnnCommented fileName st (nameTok name)) (nameValue name) (zip ctrFields $ convertType fileName <$> fields)+ : (case tl of+ [] -> []+ (st', ctor) : tl' -> ctrs st' ctor tl'+ )+ pure $ AST.DataDeclaration ann Env.Data (nameValue a) (goTypeVar <$> vars) (maybe [] (\(st, Separated hd tl) -> ctrs st hd tl) bd)+ DeclType _ (DataHead _ a vars) _ bd ->+ pure $ AST.TypeSynonymDeclaration ann+ (nameValue a)+ (goTypeVar <$> vars)+ (convertType fileName bd)+ DeclNewtype _ (DataHead _ a vars) st x ys -> do+ let ctrs = [AST.DataConstructorDeclaration (sourceAnnCommented fileName st (snd $ declRange decl)) (nameValue x) [(head ctrFields, convertType fileName ys)]]+ pure $ AST.DataDeclaration ann Env.Newtype (nameValue a) (goTypeVar <$> vars) ctrs+ DeclClass _ (ClassHead _ sup name vars fdeps) bd -> do+ let+ goTyVar (TypeVarKinded (Wrapped _ (Labeled (_, a) _ _) _)) = nameValue a+ goTyVar (TypeVarName (_, a)) = nameValue a+ vars' = zip (toList $ goTyVar <$> vars) [0..]+ goName = fromJust . flip lookup vars' . nameValue+ goFundep (FundepDetermined _ bs) = Env.FunctionalDependency [] (goName <$> NE.toList bs)+ goFundep (FundepDetermines as _ bs) = Env.FunctionalDependency (goName <$> NE.toList as) (goName <$> NE.toList bs)+ goSig (Labeled n _ ty) = do+ let+ ty' = convertType fileName ty+ ann' = widenLeft (tokAnn $ nameTok n) $ T.getAnnForType ty'+ AST.TypeDeclaration $ AST.TypeDeclarationData ann' (ident $ nameValue n) ty'+ pure $ AST.TypeClassDeclaration ann+ (nameValue name)+ (goTypeVar <$> vars)+ (convertConstraint False fileName <$> maybe [] (toList . fst) sup)+ (goFundep <$> maybe [] (toList . snd) fdeps)+ (goSig <$> maybe [] (NE.toList . snd) bd)+ DeclInstanceChain _ insts -> do+ let+ chainId = mkChainId fileName $ startSourcePos $ instKeyword $ instHead $ sepHead insts+ goInst ix inst@(Instance (InstanceHead _ nameSep ctrs cls args) bd) = do+ let ann' = uncurry (sourceAnnCommented fileName) $ instanceRange inst+ clsAnn = findInstanceAnn cls args+ AST.TypeInstanceDeclaration ann' clsAnn chainId ix+ (mkPartialInstanceName nameSep cls args)+ (convertConstraint False fileName <$> maybe [] (toList . fst) ctrs)+ (qualified cls)+ (convertType fileName <$> args)+ (AST.ExplicitInstance $ goInstanceBinding <$> maybe [] (NE.toList . snd) bd)+ uncurry goInst <$> zip [0..] (toList insts)+ DeclDerive _ _ new (InstanceHead kw nameSep ctrs cls args) -> do+ let+ chainId = mkChainId fileName $ startSourcePos kw+ name' = mkPartialInstanceName nameSep cls args+ instTy+ | isJust new = AST.NewtypeInstance+ | otherwise = AST.DerivedInstance+ clsAnn = findInstanceAnn cls args+ pure $ AST.TypeInstanceDeclaration ann clsAnn chainId 0 name'+ (convertConstraint False fileName <$> maybe [] (toList . fst) ctrs)+ (qualified cls)+ (convertType fileName <$> args)+ instTy+ DeclKindSignature _ kw (Labeled name _ ty) -> do+ let+ kindFor = case tokValue kw of+ TokLowerName [] "data" -> AST.DataSig+ TokLowerName [] "newtype" -> AST.NewtypeSig+ TokLowerName [] "type" -> AST.TypeSynonymSig+ TokLowerName [] "class" -> AST.ClassSig+ tok -> internalError $ "Invalid kind signature keyword " <> Text.unpack (printToken tok)+ pure . AST.KindDeclaration ann kindFor (nameValue name) $ convertType fileName ty+ DeclSignature _ lbl ->+ pure $ convertSignature fileName lbl+ DeclValue _ fields ->+ pure $ convertValueBindingFields fileName ann fields+ DeclFixity _ (FixityFields (_, kw) (_, prec) fxop) -> do+ let+ assoc = case kw of+ Infix -> AST.Infix+ Infixr -> AST.Infixr+ Infixl -> AST.Infixl+ fixity = AST.Fixity assoc prec+ pure $ AST.FixityDeclaration ann $ case fxop of+ FixityValue name _ op -> do+ Left $ AST.ValueFixity fixity (first ident <$> qualified name) (nameValue op)+ FixityType _ name _ op ->+ Right $ AST.TypeFixity fixity (qualified name) (nameValue op)+ DeclForeign _ _ _ frn ->+ pure $ case frn of+ ForeignValue (Labeled a _ b) ->+ AST.ExternDeclaration ann (ident $ nameValue a) $ convertType fileName b+ ForeignData _ (Labeled a _ b) ->+ AST.ExternDataDeclaration ann (nameValue a) $ convertType fileName b+ ForeignKind _ a ->+ AST.DataDeclaration ann Env.Data (nameValue a) [] []+ DeclRole _ _ _ name roles ->+ pure $ AST.RoleDeclaration $+ AST.RoleDeclarationData ann (nameValue name) (roleValue <$> NE.toList roles)+ where+ ann =+ uncurry (sourceAnnCommented fileName) $ declRange decl++ startSourcePos :: SourceToken -> Pos.SourcePos+ startSourcePos = sourcePos . srcStart . tokRange . tokAnn++ mkPartialInstanceName :: Maybe (Name Ident, SourceToken) -> QualifiedName (N.ProperName 'N.ClassName) -> [Type a] -> Either Text.Text N.Ident+ mkPartialInstanceName nameSep cls args =+ maybe (Left genName) (Right . ident . nameValue . fst) nameSep+ where+ -- truncate to 25 chars to reduce verbosity+ -- of name and still keep it readable+ -- name will be used to create a GenIdent+ -- in desugaring process+ genName :: Text.Text+ genName = Text.take 25 (className <> typeArgs)++ className :: Text.Text+ className+ = foldMap (uncurry Text.cons . first toLower)+ . Text.uncons+ . N.runProperName+ $ qualName cls++ typeArgs :: Text.Text+ typeArgs = foldMap argName args++ argName :: Type a -> Text.Text+ argName = \case+ -- These are only useful to disambiguate between overlapping instances+ -- but they’re disallowed outside of instance chains. Since we’re+ -- avoiding name collisions with unique identifiers anyway,+ -- we don't need to render this constructor.+ TypeVar{} -> ""+ TypeConstructor _ qn -> N.runProperName $ qualName qn+ TypeOpName _ qn -> N.runOpName $ qualName qn+ TypeString _ _ ps -> prettyPrintStringJS ps+ TypeInt _ _ _ nt -> Text.pack $ show nt++ -- Typed holes are disallowed in instance heads+ TypeHole{} -> ""+ TypeParens _ t -> argName $ wrpValue t+ TypeKinded _ t1 _ t2 -> argName t1 <> argName t2+ TypeRecord _ _ -> "Record"+ TypeRow _ _ -> "Row"+ TypeArrName _ _ -> "Function"+ TypeWildcard{} -> "_"++ -- Polytypes are disallowed in instance heads+ TypeForall{} -> ""+ TypeApp _ t1 t2 -> argName t1 <> argName t2+ TypeOp _ t1 op t2 ->+ argName t1 <> N.runOpName (qualName op) <> argName t2+ TypeArr _ t1 _ t2 -> argName t1 <> "Function" <> argName t2+ TypeConstrained{} -> ""+ TypeUnaryRow{} -> "Row"++ goTypeVar = \case+ TypeVarKinded (Wrapped _ (Labeled (_, x) _ y) _) -> (getIdent $ nameValue x, Just $ convertType fileName y)+ TypeVarName (_, x) -> (getIdent $ nameValue x, Nothing)++ goInstanceBinding = \case+ InstanceBindingSignature _ lbl ->+ convertSignature fileName lbl+ binding@(InstanceBindingName _ fields) -> do+ let ann' = uncurry (sourceAnnCommented fileName) $ instanceBindingRange binding+ convertValueBindingFields fileName ann' fields++ findInstanceAnn cls args = uncurry (sourceAnnCommented fileName) $+ if null args then+ qualRange cls+ else+ (fst $ qualRange cls, snd $ typeRange $ last args)++convertSignature :: String -> Labeled (Name Ident) (Type a) -> AST.Declaration+convertSignature fileName (Labeled a _ b) = do+ let+ b' = convertType fileName b+ ann = widenLeft (tokAnn $ nameTok a) $ T.getAnnForType b'+ AST.TypeDeclaration $ AST.TypeDeclarationData ann (ident $ nameValue a) b'++convertValueBindingFields :: String -> Pos.SourceAnn -> ValueBindingFields a -> AST.Declaration+convertValueBindingFields fileName ann (ValueBindingFields a bs c) = do+ let+ bs' = convertBinder fileName <$> bs+ cs' = convertGuarded fileName c+ AST.ValueDeclaration $ AST.ValueDeclarationData ann (ident $ nameValue a) Env.Public bs' cs'++convertImportDecl+ :: String+ -> ImportDecl a+ -> (Pos.SourceAnn, N.ModuleName, AST.ImportDeclarationType, Maybe N.ModuleName)+convertImportDecl fileName decl@(ImportDecl _ _ modName mbNames mbQual) = do+ let+ ann = uncurry (sourceAnnCommented fileName) $ importDeclRange decl+ importTy = case mbNames of+ Nothing -> AST.Implicit+ Just (hiding, Wrapped _ imps _) -> do+ let imps' = convertImport fileName <$> toList imps+ if isJust hiding+ then AST.Hiding imps'+ else AST.Explicit imps'+ (ann, nameValue modName, importTy, nameValue . snd <$> mbQual)++convertImport :: String -> Import a -> AST.DeclarationRef+convertImport fileName imp = case imp of+ ImportValue _ a ->+ AST.ValueRef ann . ident $ nameValue a+ ImportOp _ a ->+ AST.ValueOpRef ann $ nameValue a+ ImportType _ a mb -> do+ let+ ctrs = case mb of+ Nothing -> Just []+ Just (DataAll _ _) -> Nothing+ Just (DataEnumerated _ (Wrapped _ Nothing _)) -> Just []+ Just (DataEnumerated _ (Wrapped _ (Just idents) _)) ->+ Just . map nameValue $ toList idents+ AST.TypeRef ann (nameValue a) ctrs+ ImportTypeOp _ _ a ->+ AST.TypeOpRef ann $ nameValue a+ ImportClass _ _ a ->+ AST.TypeClassRef ann $ nameValue a+ where+ ann = sourceSpan fileName . toSourceRange $ importRange imp++convertExport :: String -> Export a -> AST.DeclarationRef+convertExport fileName export = case export of+ ExportValue _ a ->+ AST.ValueRef ann . ident $ nameValue a+ ExportOp _ a ->+ AST.ValueOpRef ann $ nameValue a+ ExportType _ a mb -> do+ let+ ctrs = case mb of+ Nothing -> Just []+ Just (DataAll _ _) -> Nothing+ Just (DataEnumerated _ (Wrapped _ Nothing _)) -> Just []+ Just (DataEnumerated _ (Wrapped _ (Just idents) _)) ->+ Just . map nameValue $ toList idents+ AST.TypeRef ann (nameValue a) ctrs+ ExportTypeOp _ _ a ->+ AST.TypeOpRef ann $ nameValue a+ ExportClass _ _ a ->+ AST.TypeClassRef ann $ nameValue a+ ExportModule _ _ a ->+ AST.ModuleRef ann (nameValue a)+ where+ ann = sourceSpan fileName . toSourceRange $ exportRange export++convertModule :: String -> Module a -> AST.Module+convertModule fileName module'@(Module _ _ modName exps _ imps decls _) = do+ let+ ann = uncurry (sourceAnnCommented fileName) $ moduleRange module'+ imps' = importCtr. convertImportDecl fileName <$> imps+ decls' = convertDeclaration fileName =<< decls+ exps' = map (convertExport fileName) . toList . wrpValue <$> exps+ uncurry AST.Module ann (nameValue modName) (imps' <> decls') exps'+ where+ importCtr (a, b, c, d) = AST.ImportDeclaration a b c d++ctrFields :: [N.Ident]+ctrFields = [N.Ident ("value" <> Text.pack (show (n :: Integer))) | n <- [0..]]
+ src/Language/PureScript/CST/Errors.hs view
@@ -0,0 +1,201 @@+{-# LANGUAGE DeriveAnyClass #-}+module Language.PureScript.CST.Errors+ ( ParserErrorInfo(..)+ , ParserErrorType(..)+ , ParserWarningType(..)+ , ParserError+ , ParserWarning+ , prettyPrintError+ , prettyPrintErrorMessage+ , prettyPrintWarningMessage+ ) where++import Prelude++import Control.DeepSeq (NFData)+import Data.Text qualified as Text+import Data.Char (isSpace, toUpper)+import GHC.Generics (Generic)+import Language.PureScript.CST.Layout (LayoutStack)+import Language.PureScript.CST.Print (printToken)+import Language.PureScript.CST.Types (SourcePos(..), SourceRange(..), SourceToken(..), Token(..))+import Text.Printf (printf)++data ParserErrorType+ = ErrWildcardInType+ | ErrConstraintInKind+ | ErrHoleInType+ | ErrExprInBinder+ | ErrExprInDeclOrBinder+ | ErrExprInDecl+ | ErrBinderInDecl+ | ErrRecordUpdateInCtr+ | ErrRecordPunInUpdate+ | ErrRecordCtrInUpdate+ | ErrTypeInConstraint+ | ErrElseInDecl+ | ErrInstanceNameMismatch+ | ErrUnknownFundep+ | ErrImportInDecl+ | ErrGuardInLetBinder+ | ErrKeywordVar+ | ErrKeywordSymbol+ | ErrQuotedPun+ | ErrToken+ | ErrLineFeedInString+ | ErrAstralCodePointInChar+ | ErrCharEscape+ | ErrNumberOutOfRange+ | ErrLeadingZero+ | ErrExpectedFraction+ | ErrExpectedExponent+ | ErrExpectedHex+ | ErrReservedSymbol+ | ErrCharInGap Char+ | ErrModuleName+ | ErrQualifiedName+ | ErrEmptyDo+ | ErrLexeme (Maybe String) [String]+ | ErrConstraintInForeignImportSyntax+ | ErrEof+ | ErrCustom String+ deriving (Show, Eq, Ord, Generic, NFData)++data ParserWarningType+ = WarnDeprecatedRowSyntax+ | WarnDeprecatedForeignKindSyntax+ | WarnDeprecatedKindImportSyntax+ | WarnDeprecatedKindExportSyntax+ | WarnDeprecatedCaseOfOffsideSyntax+ deriving (Show, Eq, Ord, Generic, NFData)++data ParserErrorInfo a = ParserErrorInfo+ { errRange :: SourceRange+ , errToks :: [SourceToken]+ , errStack :: LayoutStack+ , errType :: a+ } deriving (Show, Eq, Generic, NFData)++type ParserError = ParserErrorInfo ParserErrorType+type ParserWarning = ParserErrorInfo ParserWarningType++prettyPrintError :: ParserError -> String+prettyPrintError pe@ParserErrorInfo { errRange } =+ prettyPrintErrorMessage pe <> " at " <> errPos+ where+ errPos = case errRange of+ SourceRange (SourcePos line col) _ ->+ "line " <> show line <> ", column " <> show col++prettyPrintErrorMessage :: ParserError -> String+prettyPrintErrorMessage ParserErrorInfo {..} = case errType of+ ErrWildcardInType ->+ "Unexpected wildcard in type; type wildcards are only allowed in value annotations"+ ErrConstraintInKind ->+ "Unsupported constraint in kind; constraints are only allowed in value annotations"+ ErrHoleInType ->+ "Unexpected hole in type; type holes are only allowed in value annotations"+ ErrExprInBinder ->+ "Expected pattern, saw expression"+ ErrExprInDeclOrBinder ->+ "Expected declaration or pattern, saw expression"+ ErrExprInDecl ->+ "Expected declaration, saw expression"+ ErrBinderInDecl ->+ "Expected declaration, saw pattern"+ ErrRecordUpdateInCtr ->+ "Expected ':', saw '='"+ ErrRecordPunInUpdate ->+ "Expected record update, saw pun"+ ErrRecordCtrInUpdate ->+ "Expected '=', saw ':'"+ ErrTypeInConstraint ->+ "Expected constraint, saw type"+ ErrElseInDecl ->+ "Expected declaration, saw 'else'"+ ErrInstanceNameMismatch ->+ "All instances in a chain must implement the same type class"+ ErrUnknownFundep ->+ "Unknown type variable in functional dependency"+ ErrImportInDecl ->+ "Expected declaration, saw 'import'"+ ErrGuardInLetBinder ->+ "Unexpected guard in let pattern"+ ErrKeywordVar ->+ "Expected variable, saw keyword"+ ErrKeywordSymbol ->+ "Expected symbol, saw reserved symbol"+ ErrQuotedPun ->+ "Unexpected quoted label in record pun, perhaps due to a missing ':'"+ ErrEof ->+ "Unexpected end of input"+ ErrLexeme (Just (hd : _)) _ | isSpace hd ->+ "Illegal whitespace character " <> displayCodePoint hd+ ErrLexeme (Just a) _ ->+ "Unexpected " <> a+ ErrLineFeedInString ->+ "Unexpected line feed in string literal"+ ErrAstralCodePointInChar ->+ "Illegal astral code point in character literal"+ ErrCharEscape ->+ "Illegal character escape code"+ ErrNumberOutOfRange ->+ "Number literal is out of range"+ ErrLeadingZero ->+ "Unexpected leading zeros"+ ErrExpectedFraction ->+ "Expected fraction"+ ErrExpectedExponent ->+ "Expected exponent"+ ErrExpectedHex ->+ "Expected hex digit"+ ErrReservedSymbol ->+ "Unexpected reserved symbol"+ ErrCharInGap ch ->+ "Unexpected character '" <> [ch] <> "' in gap"+ ErrModuleName ->+ "Invalid module name; underscores and primes are not allowed in module names"+ ErrQualifiedName ->+ "Unexpected qualified name"+ ErrEmptyDo ->+ "Expected do statement"+ ErrLexeme _ _ ->+ basicError+ ErrConstraintInForeignImportSyntax ->+ "Constraints are not allowed in foreign imports. Omit the constraint instead and update the foreign module accordingly."+ ErrToken+ | SourceToken _ (TokLeftArrow _) : _ <- errToks ->+ "Unexpected \"<-\" in expression, perhaps due to a missing 'do' or 'ado' keyword"+ ErrToken ->+ basicError+ ErrCustom err ->+ err++ where+ basicError = case errToks of+ tok : _ -> basicTokError (tokValue tok)+ [] -> "Unexpected input"++ basicTokError = \case+ TokLayoutStart -> "Unexpected or mismatched indentation"+ TokLayoutSep -> "Unexpected or mismatched indentation"+ TokLayoutEnd -> "Unexpected or mismatched indentation"+ TokEof -> "Unexpected end of input"+ tok -> "Unexpected token '" <> Text.unpack (printToken tok) <> "'"++ displayCodePoint :: Char -> String+ displayCodePoint x =+ "U+" <> map toUpper (printf "%0.4x" (fromEnum x))++prettyPrintWarningMessage :: ParserWarning -> String+prettyPrintWarningMessage ParserErrorInfo {..} = case errType of+ WarnDeprecatedRowSyntax ->+ "Unary '#' syntax for row kinds is deprecated and will be removed in a future release. Use the 'Row' kind instead."+ WarnDeprecatedForeignKindSyntax ->+ "Foreign kind imports are deprecated and will be removed in a future release. Use empty 'data' instead."+ WarnDeprecatedKindImportSyntax ->+ "Kind imports are deprecated and will be removed in a future release. Omit the 'kind' keyword instead."+ WarnDeprecatedKindExportSyntax ->+ "Kind exports are deprecated and will be removed in a future release. Omit the 'kind' keyword instead."+ WarnDeprecatedCaseOfOffsideSyntax ->+ "Dedented expressions in case branches are deprecated and will be removed in a future release. Indent the branch's expression past it's binder instead."
+ src/Language/PureScript/CST/Flatten.hs view
@@ -0,0 +1,315 @@+module Language.PureScript.CST.Flatten where++import Prelude++import Data.DList (DList)+import Language.PureScript.CST.Types+import Language.PureScript.CST.Positions (advanceLeading, moduleRange, srcRange)++flattenModule :: Module a -> DList SourceToken+flattenModule m@(Module _ a b c d e f g) =+ pure a <>+ flattenName b <>+ foldMap (flattenWrapped (flattenSeparated flattenExport)) c <>+ pure d <>+ foldMap flattenImportDecl e <>+ foldMap flattenDeclaration f <>+ pure (SourceToken (TokenAnn eofRange g []) TokEof)+ where+ (_, endTkn) = moduleRange m+ eofPos = advanceLeading (srcEnd (srcRange endTkn)) g+ eofRange = SourceRange eofPos eofPos++flattenDataHead :: DataHead a -> DList SourceToken+flattenDataHead (DataHead a b c) = pure a <> flattenName b <> foldMap flattenTypeVarBinding c++flattenDataCtor :: DataCtor a -> DList SourceToken+flattenDataCtor (DataCtor _ a b) = flattenName a <> foldMap flattenType b++flattenClassHead :: ClassHead a -> DList SourceToken+flattenClassHead (ClassHead a b c d e) =+ pure a <>+ foldMap (\(f, g) -> flattenOneOrDelimited flattenConstraint f <> pure g) b <>+ flattenName c <>+ foldMap flattenTypeVarBinding d <>+ foldMap (\(f, g) -> pure f <> flattenSeparated flattenClassFundep g) e++flattenClassFundep :: ClassFundep -> DList SourceToken+flattenClassFundep = \case+ FundepDetermined a b ->+ pure a <> foldMap flattenName b+ FundepDetermines a b c ->+ foldMap flattenName a <> pure b <> foldMap flattenName c++flattenInstance :: Instance a -> DList SourceToken+flattenInstance (Instance a b) =+ flattenInstanceHead a <> foldMap (\(c, d) -> pure c <> foldMap flattenInstanceBinding d) b++flattenInstanceHead :: InstanceHead a -> DList SourceToken+flattenInstanceHead (InstanceHead a b c d e) =+ pure a <>+ foldMap (\(n, s) -> flattenName n <> pure s) b <>+ foldMap (\(g, h) -> flattenOneOrDelimited flattenConstraint g <> pure h) c <>+ flattenQualifiedName d <>+ foldMap flattenType e++flattenInstanceBinding :: InstanceBinding a -> DList SourceToken+flattenInstanceBinding = \case+ InstanceBindingSignature _ a -> flattenLabeled flattenName flattenType a+ InstanceBindingName _ a -> flattenValueBindingFields a++flattenValueBindingFields :: ValueBindingFields a -> DList SourceToken+flattenValueBindingFields (ValueBindingFields a b c) =+ flattenName a <>+ foldMap flattenBinder b <>+ flattenGuarded c++flattenBinder :: Binder a -> DList SourceToken+flattenBinder = \case+ BinderWildcard _ a -> pure a+ BinderVar _ a -> flattenName a+ BinderNamed _ a b c -> flattenName a <> pure b <> flattenBinder c+ BinderConstructor _ a b -> flattenQualifiedName a <> foldMap flattenBinder b+ BinderBoolean _ a _ -> pure a+ BinderChar _ a _ -> pure a+ BinderString _ a _ -> pure a+ BinderNumber _ a b _ -> foldMap pure a <> pure b+ BinderArray _ a -> flattenWrapped (foldMap (flattenSeparated flattenBinder)) a+ BinderRecord _ a ->+ flattenWrapped (foldMap (flattenSeparated (flattenRecordLabeled flattenBinder))) a+ BinderParens _ a -> flattenWrapped flattenBinder a+ BinderTyped _ a b c -> flattenBinder a <> pure b <> flattenType c+ BinderOp _ a b c -> flattenBinder a <> flattenQualifiedName b <> flattenBinder c++flattenRecordLabeled :: (a -> DList SourceToken) -> RecordLabeled a -> DList SourceToken+flattenRecordLabeled f = \case+ RecordPun a -> flattenName a+ RecordField a b c -> flattenLabel a <> pure b <> f c++flattenRecordAccessor :: RecordAccessor a -> DList SourceToken+flattenRecordAccessor (RecordAccessor a b c) =+ flattenExpr a <> pure b <> flattenSeparated flattenLabel c++flattenRecordUpdate :: RecordUpdate a -> DList SourceToken+flattenRecordUpdate = \case+ RecordUpdateLeaf a b c -> flattenLabel a <> pure b <> flattenExpr c+ RecordUpdateBranch a b ->+ flattenLabel a <> flattenWrapped (flattenSeparated flattenRecordUpdate) b++flattenLambda :: Lambda a -> DList SourceToken+flattenLambda (Lambda a b c d) =+ pure a <> foldMap flattenBinder b <> pure c <> flattenExpr d++flattenIfThenElse :: IfThenElse a -> DList SourceToken+flattenIfThenElse (IfThenElse a b c d e f) =+ pure a <> flattenExpr b <> pure c <> flattenExpr d <> pure e <> flattenExpr f++flattenCaseOf :: CaseOf a -> DList SourceToken+flattenCaseOf (CaseOf a b c d) =+ pure a <>+ flattenSeparated flattenExpr b <>+ pure c <>+ foldMap (\(e, f) -> flattenSeparated flattenBinder e <> flattenGuarded f) d++flattenLetIn :: LetIn a -> DList SourceToken+flattenLetIn (LetIn a b c d) =+ pure a <> foldMap flattenLetBinding b <> pure c <> flattenExpr d++flattenDoBlock :: DoBlock a -> DList SourceToken+flattenDoBlock (DoBlock a b) =+ pure a <> foldMap flattenDoStatement b++flattenAdoBlock :: AdoBlock a -> DList SourceToken+flattenAdoBlock (AdoBlock a b c d) =+ pure a <> foldMap flattenDoStatement b <> pure c <> flattenExpr d++flattenDoStatement :: DoStatement a -> DList SourceToken+flattenDoStatement = \case+ DoLet a b -> pure a <> foldMap flattenLetBinding b+ DoDiscard a -> flattenExpr a+ DoBind a b c -> flattenBinder a <> pure b <> flattenExpr c++flattenExpr :: Expr a -> DList SourceToken+flattenExpr = \case+ ExprHole _ a -> flattenName a+ ExprSection _ a -> pure a+ ExprIdent _ a -> flattenQualifiedName a+ ExprConstructor _ a -> flattenQualifiedName a+ ExprBoolean _ a _ -> pure a+ ExprChar _ a _ -> pure a+ ExprString _ a _ -> pure a+ ExprNumber _ a _ -> pure a+ ExprArray _ a -> flattenWrapped (foldMap (flattenSeparated flattenExpr)) a+ ExprRecord _ a ->+ flattenWrapped (foldMap (flattenSeparated (flattenRecordLabeled flattenExpr))) a+ ExprParens _ a -> flattenWrapped flattenExpr a+ ExprTyped _ a b c -> flattenExpr a <> pure b <> flattenType c+ ExprInfix _ a b c -> flattenExpr a <> flattenWrapped flattenExpr b <> flattenExpr c+ ExprOp _ a b c -> flattenExpr a <> flattenQualifiedName b <> flattenExpr c+ ExprOpName _ a -> flattenQualifiedName a+ ExprNegate _ a b -> pure a <> flattenExpr b+ ExprRecordAccessor _ a -> flattenRecordAccessor a+ ExprRecordUpdate _ a b -> flattenExpr a <> flattenWrapped (flattenSeparated flattenRecordUpdate) b+ ExprApp _ a b -> flattenExpr a <> flattenExpr b+ ExprVisibleTypeApp _ a b c -> flattenExpr a <> pure b <> flattenType c+ ExprLambda _ a -> flattenLambda a+ ExprIf _ a -> flattenIfThenElse a+ ExprCase _ a -> flattenCaseOf a+ ExprLet _ a -> flattenLetIn a+ ExprDo _ a -> flattenDoBlock a+ ExprAdo _ a -> flattenAdoBlock a++flattenLetBinding :: LetBinding a -> DList SourceToken+flattenLetBinding = \case+ LetBindingSignature _ a -> flattenLabeled flattenName flattenType a+ LetBindingName _ a -> flattenValueBindingFields a+ LetBindingPattern _ a b c -> flattenBinder a <> pure b <> flattenWhere c++flattenWhere :: Where a -> DList SourceToken+flattenWhere (Where a b) =+ flattenExpr a <> foldMap (\(c, d) -> pure c <> foldMap flattenLetBinding d) b++flattenPatternGuard :: PatternGuard a -> DList SourceToken+flattenPatternGuard (PatternGuard a b) =+ foldMap (\(c, d) -> flattenBinder c <> pure d) a <> flattenExpr b++flattenGuardedExpr :: GuardedExpr a -> DList SourceToken+flattenGuardedExpr (GuardedExpr a b c d) =+ pure a <>+ flattenSeparated flattenPatternGuard b <>+ pure c <>+ flattenWhere d++flattenGuarded :: Guarded a -> DList SourceToken+flattenGuarded = \case+ Unconditional a b -> pure a <> flattenWhere b+ Guarded a -> foldMap flattenGuardedExpr a++flattenFixityFields :: FixityFields -> DList SourceToken+flattenFixityFields (FixityFields (a, _) (b, _) c) =+ pure a <> pure b <> flattenFixityOp c++flattenFixityOp :: FixityOp -> DList SourceToken+flattenFixityOp = \case+ FixityValue a b c -> flattenQualifiedName a <> pure b <> flattenName c+ FixityType a b c d -> pure a <> flattenQualifiedName b <> pure c <> flattenName d++flattenForeign :: Foreign a -> DList SourceToken+flattenForeign = \case+ ForeignValue a -> flattenLabeled flattenName flattenType a+ ForeignData a b -> pure a <> flattenLabeled flattenName flattenType b+ ForeignKind a b -> pure a <> flattenName b++flattenRole :: Role -> DList SourceToken+flattenRole = pure . roleTok++flattenDeclaration :: Declaration a -> DList SourceToken+flattenDeclaration = \case+ DeclData _ a b ->+ flattenDataHead a <>+ foldMap (\(t, cs) -> pure t <> flattenSeparated flattenDataCtor cs) b+ DeclType _ a b c ->flattenDataHead a <> pure b <> flattenType c+ DeclNewtype _ a b c d -> flattenDataHead a <> pure b <> flattenName c <> flattenType d+ DeclClass _ a b ->+ flattenClassHead a <>+ foldMap (\(c, d) -> pure c <> foldMap (flattenLabeled flattenName flattenType) d) b+ DeclInstanceChain _ a -> flattenSeparated flattenInstance a+ DeclDerive _ a b c -> pure a <> foldMap pure b <> flattenInstanceHead c+ DeclKindSignature _ a b -> pure a <> flattenLabeled flattenName flattenType b+ DeclSignature _ a -> flattenLabeled flattenName flattenType a+ DeclFixity _ a -> flattenFixityFields a+ DeclForeign _ a b c -> pure a <> pure b <> flattenForeign c+ DeclRole _ a b c d -> pure a <> pure b <> flattenName c <> foldMap flattenRole d+ DeclValue _ a -> flattenValueBindingFields a++flattenQualifiedName :: QualifiedName a -> DList SourceToken+flattenQualifiedName = pure . qualTok++flattenName :: Name a -> DList SourceToken+flattenName = pure . nameTok++flattenLabel :: Label -> DList SourceToken+flattenLabel = pure . lblTok++flattenExport :: Export a -> DList SourceToken+flattenExport = \case+ ExportValue _ n -> flattenName n+ ExportOp _ n -> flattenName n+ ExportType _ n dms -> flattenName n <> foldMap flattenDataMembers dms+ ExportTypeOp _ t n -> pure t <> flattenName n+ ExportClass _ t n -> pure t <> flattenName n+ ExportModule _ t n -> pure t <> flattenName n++flattenDataMembers :: DataMembers a -> DList SourceToken+flattenDataMembers = \case+ DataAll _ t -> pure t+ DataEnumerated _ ns -> flattenWrapped (foldMap (flattenSeparated flattenName)) ns++flattenImportDecl :: ImportDecl a -> DList SourceToken+flattenImportDecl (ImportDecl _ a b c d) =+ pure a <>+ flattenName b <>+ foldMap (\(mt, is) ->+ foldMap pure mt <> flattenWrapped (flattenSeparated flattenImport) is) c <>+ foldMap (\(t, n) -> pure t <> flattenName n) d++flattenImport :: Import a -> DList SourceToken+flattenImport = \case+ ImportValue _ n -> flattenName n+ ImportOp _ n -> flattenName n+ ImportType _ n dms -> flattenName n <> foldMap flattenDataMembers dms+ ImportTypeOp _ t n -> pure t <> flattenName n+ ImportClass _ t n -> pure t <> flattenName n++flattenWrapped :: (a -> DList SourceToken) -> Wrapped a -> DList SourceToken+flattenWrapped k (Wrapped a b c) = pure a <> k b <> pure c++flattenSeparated :: (a -> DList SourceToken) -> Separated a -> DList SourceToken+flattenSeparated k (Separated a b) = k a <> foldMap (\(c, d) -> pure c <> k d) b++flattenOneOrDelimited+ :: (a -> DList SourceToken) -> OneOrDelimited a -> DList SourceToken+flattenOneOrDelimited f = \case+ One a -> f a+ Many a -> flattenWrapped (flattenSeparated f) a++flattenLabeled :: (a -> DList SourceToken) -> (b -> DList SourceToken) -> Labeled a b -> DList SourceToken+flattenLabeled ka kc (Labeled a b c) = ka a <> pure b <> kc c++flattenType :: Type a -> DList SourceToken+flattenType = \case+ TypeVar _ a -> pure $ nameTok a+ TypeConstructor _ a -> pure $ qualTok a+ TypeWildcard _ a -> pure a+ TypeHole _ a -> pure $ nameTok a+ TypeString _ a _ -> pure a+ TypeInt _ a b _ -> maybe mempty pure a <> pure b+ TypeRow _ a -> flattenWrapped flattenRow a+ TypeRecord _ a -> flattenWrapped flattenRow a+ TypeForall _ a b c d -> pure a <> foldMap flattenTypeVarBinding b <> pure c <> flattenType d+ TypeKinded _ a b c -> flattenType a <> pure b <> flattenType c+ TypeApp _ a b -> flattenType a <> flattenType b+ TypeOp _ a b c -> flattenType a <> pure (qualTok b) <> flattenType c+ TypeOpName _ a -> pure $ qualTok a+ TypeArr _ a b c -> flattenType a <> pure b <> flattenType c+ TypeArrName _ a -> pure a+ TypeConstrained _ a b c -> flattenConstraint a <> pure b <> flattenType c+ TypeParens _ a -> flattenWrapped flattenType a+ TypeUnaryRow _ a b -> pure a <> flattenType b++flattenRow :: Row a -> DList SourceToken+flattenRow (Row lbls tl) =+ foldMap (flattenSeparated (flattenLabeled (pure . lblTok) flattenType)) lbls+ <> foldMap (\(a, b) -> pure a <> flattenType b) tl++flattenTypeVarBinding :: TypeVarBinding a -> DList SourceToken+flattenTypeVarBinding = \case+ TypeVarKinded a -> flattenWrapped (flattenLabeled go flattenType) a+ TypeVarName a -> go a+ where+ go (a, b) = maybe mempty pure a <> pure (nameTok b)++flattenConstraint :: Constraint a -> DList SourceToken+flattenConstraint = \case+ Constraint _ a b -> pure (qualTok a) <> foldMap flattenType b+ ConstraintParens _ a -> flattenWrapped flattenConstraint a
+ src/Language/PureScript/CST/Layout.hs view
@@ -0,0 +1,552 @@+-- |+-- ## High-Level Summary+--+-- This section provides a high-level summary of this file. For those who+-- know more about compiler-development, the below explanation is likely enough.+-- For everyone else, see the next section.+--+-- The parser itself is unaware of indentation, and instead only parses explicit+-- delimiters which are inserted by this layout algorithm (much like Haskell).+-- This is convenient because the actual grammar can be specified apart from the+-- indentation rules. Haskell has a few problematic productions which make it+-- impossible to implement a purely lexical layout algorithm, so it also has an+-- additional (and somewhat contentious) parser error side condition. PureScript+-- does not have these problematic productions (particularly foo, bar ::+-- SomeType syntax in declarations), but it does have a few gotchas of it's own.+-- The algorithm is "non-trivial" to say the least, but it is implemented as a+-- purely lexical delimiter parser on a token-by-token basis, which is highly+-- convenient, since it can be replicated in any language or toolchain. There is+-- likely room to simplify it, but there are some seemingly innocuous things+-- that complicate it.+--+-- "Naked" commas (case, patterns, guards, fundeps) are a constant source of+-- complexity, and indeed too much of this is what prevents Haskell from having+-- such an algorithm. Unquoted properties for layout keywords introduce a domino+-- effect of complexity since we have to mask and unmask any usage of . (also in+-- foralls!) or labels in record literals.+--+-- ## Detailed Summary+--+-- ### The Problem+--+-- The parser itself is unaware of indentation or other such layout concerns.+-- Rather than dealing with it explicitly, the parser and its+-- grammar rules are only aware of normal tokens (e.g. @TokLowerName@) and+-- three special zero-width tokens, @TokLayoutStart@, @TokLayoutSep@,+-- and @TokLayoutEnd@. This is convenient because the actual grammar+-- can be specified apart from the indentation rules and other such+-- layout concerns.+--+-- For a simple example, the parser parses all three examples of the code below+-- using the exact same grammar rules for the @let@ keyword despite+-- each example using different indentations levels:+--+-- @+-- -- Example 1+-- let foo = 5+-- x = 2 in foo+--+-- -- Example 2+-- let+-- bar = 5+-- y = 2+-- in bar+--+-- -- Example 3+-- let baz+-- =+-- 5+-- z= 2 in baz+-- @+--+-- Each block of code might appear to the parser as a stream of the+-- following source tokens where the @\{@ sequence represents+-- @TokLayoutStart@, the @\;@ sequence represents @TokLayoutSep@,+-- and the @\}@ sequence represents @TokLayoutEnd@:+-- - @let \{foo = 5\;x = 2\} in foo@+-- - @let \{bar = 5\;y = 2\} in bar@+-- - @let \{baz = 5\;z = 2\} in baz@+--+--+-- For a more complex example, consider commas:+--+-- @+-- case one, { twoA, twoB }, [ three1+-- , three2+-- , do+-- { three3, three4 } <- case arg1, arg2 of+-- Nothing, _ -> { three3: 1, three4: 2 }+-- Just _, Nothing -> { three3: 2, three4: 3 }+-- _, _ -> { three3: 3, three4: 4 }+-- pure $ three3 + three4+-- ] of+-- @+--+-- Which of the above 13 commas function as the separators between the+-- case binders (e.g. @one@) in the outermost @case ... of@ context?+--+-- ### The Solution+--+-- The parser doesn't have to care about layout concerns (e.g. indentation+-- or what starts and ends a context, such as a case binder) because the+-- lexer solves that problem instead.+--+-- So, how does the lexer solve this problem? It follows this general algorithm:+-- 1. Lex the source code text into an initial stream of `SourceToken`s+-- that do not have any of the three special tokens mentioned previously.+-- 2. On a token-by-token basis, determine whether the lexer should+-- 1. insert one of the three special tokens,+-- 2. modify the current context (e.g. are we within a case binder?+-- Are we in a record expression?)+--+-- Step 2 is handled via 'insertLayout' and is essentially a state machine.+-- The layout delimiters, (e.g. 'LytCase', 'LytBrace', 'LytProperty',+-- and 'LytOf' in the next section's example) either stop certain "rules"+-- from applying or ensure that certain "rules" now apply. By "rules",+-- we mean whether and where one of the three special tokens are added.+-- The comments in the source code for the 'insertLayout' algorithm call+-- pushing these delimiters onto the stack "masking" and popping them off+-- as "unmasking". Seeing when a layout delimiter is pushed and popped+-- are the keys to understanding this algorithm.+--+-- ### Walking Through an Example+--+-- Before showing an example, let's remember a few things.+-- 1. The @TokLowerName "case"@ token (i.e. a "case" keyword) indicates the start+-- of a @case ... of@ context. That context includes case binders (like the+-- example shown previously) that can get quite complex. When encountered,+-- we may need to insert one or more of the three special tokens here+-- until we encounter the terminating @TokLowerName "of"@ token that+-- signifies its end.+-- 2. "case" and "of" can also appear as a record field's name. In such a context,+-- they would not start or end a @case ... of@ block.+--+-- Given the below source code...+--+-- @+-- case { case: "foo", of: "bar" } of+-- @+--+-- the lexer would go through something like the following states:+-- 1. Encountered @TokLowerName "case"@. Update current context to+-- "within a case of expression" by pushing the 'LytCase' delimiter+-- onto the layout delimiter stack. Insert the @case@ token+-- into the stream of source tokens.+-- 2. Encountered @TokLeftBrace@. Update current context to+-- "within a record expression" by pushing the 'LytBrace' delimiter.+-- Since we expect a field name to be the next token we see,+-- which may include a reserved keyword, update the current context again to+-- "expecting a field name" by pushing the `LytProperty`.+-- delimiter. Insert the @{@ token into the stream of source tokens.+-- 3. Encountered @TokLowerName "case"@. Check the current context.+-- Since it's a `LytProperty`, this is a field name and we shouldn't+-- assume that the next few tokens will be case binders. However,+-- since this might be a record with no more fields, update the+-- current context back to "within a record expression" by popping+-- the `LytProperty` off the layout delimiter stack. Insert the @case@ token+-- 4. Encountered @TokColon@. Insert the @:@ token+-- 5. Encountered @TokLowerName "foo"@. Insert the @foo@ token.+-- 6. Encountered @TokComma@. Check the current context. Since it's a `LytBrace`,+-- we're in a record expression and there is another field. Update the+-- current context by pushing `LytProperty` as we expect a field name again.+-- 7. Encountered @TokLowerName "of"@. Check the current context.+-- Since it's a `LytProperty`, this is a field name rather+-- than the end of a case binder. Thus, we don't expect the next tokens+-- to be the @body@ in a @case ... of body@ expression. However, since+-- this might be a record with no more fields, update the current context+-- back to "within a record expression" by popping the `LytProperty`+-- off the stack. Insert the @of@ token.+-- 8. Encountered @TokRightBrace@. Check the current context.+-- Since it's a `LytBrace`, this is the end of a record expression.+-- Update the current context to "within a case of expression"+-- by popping the `LytBrace` off the stack. Insert the @}@ token.+-- 9. Encountered @TokLowername "of"@. Check the current context.+-- Since it's a 'LytCase', this is the end of a @case ... of@ expression+-- and the body will follow. Update the current context to+-- "body of a case of expression" by pushing 'LytOf' onto the layout stack.+-- Insert the @of@ token into the stream of tokens.+--+{-# LANGUAGE DeriveAnyClass #-}+module Language.PureScript.CST.Layout where++import Prelude++import Control.DeepSeq (NFData)+import Data.DList (snoc)+import Data.DList qualified as DList+import Data.Foldable (find)+import Data.Function ((&))+import GHC.Generics (Generic)+import Language.PureScript.CST.Types (Comment, LineFeed, SourcePos(..), SourceRange(..), SourceToken(..), Token(..), TokenAnn(..))++type LayoutStack = [(SourcePos, LayoutDelim)]++data LayoutDelim+ = LytRoot+ | LytTopDecl+ | LytTopDeclHead+ | LytDeclGuard+ | LytCase+ | LytCaseBinders+ | LytCaseGuard+ | LytLambdaBinders+ | LytParen+ | LytBrace+ | LytSquare+ | LytIf+ | LytThen+ | LytProperty+ | LytForall+ | LytTick+ | LytLet+ | LytLetStmt+ | LytWhere+ | LytOf+ | LytDo+ | LytAdo+ deriving (Show, Eq, Ord, Generic, NFData)++isIndented :: LayoutDelim -> Bool+isIndented = \case+ LytLet -> True+ LytLetStmt -> True+ LytWhere -> True+ LytOf -> True+ LytDo -> True+ LytAdo -> True+ _ -> False++isTopDecl :: SourcePos -> LayoutStack -> Bool+isTopDecl tokPos = \case+ [(lytPos, LytWhere), (_, LytRoot)]+ | srcColumn tokPos == srcColumn lytPos -> True+ _ -> False++lytToken :: SourcePos -> Token -> SourceToken+lytToken pos = SourceToken ann+ where+ ann = TokenAnn+ { tokRange = SourceRange pos pos+ , tokLeadingComments = []+ , tokTrailingComments = []+ }++insertLayout :: SourceToken -> SourcePos -> LayoutStack -> (LayoutStack, [SourceToken])+insertLayout src@(SourceToken tokAnn tok) nextPos stack =+ DList.toList <$> insert (stack, mempty)+ where+ tokPos =+ srcStart $ tokRange tokAnn++ insert state@(stk, acc) = case tok of+ -- `data` declarations need masking (LytTopDecl) because the usage of `|`+ -- should not introduce a LytDeclGard context.+ TokLowerName [] "data" ->+ case state & insertDefault of+ state'@(stk', _) | isTopDecl tokPos stk' ->+ state' & pushStack tokPos LytTopDecl+ state' ->+ state' & popStack (== LytProperty)++ -- `class` declaration heads need masking (LytTopDeclHead) because the+ -- usage of commas in functional dependencies.+ TokLowerName [] "class" ->+ case state & insertDefault of+ state'@(stk', _) | isTopDecl tokPos stk' ->+ state' & pushStack tokPos LytTopDeclHead+ state' ->+ state' & popStack (== LytProperty)++ TokLowerName [] "where" ->+ case stk of+ (_, LytTopDeclHead) : stk' ->+ (stk', acc) & insertToken src & insertStart LytWhere+ (_, LytProperty) : stk' ->+ (stk', acc) & insertToken src+ _ ->+ state & collapse whereP & insertToken src & insertStart LytWhere+ where+ -- `where` always closes do blocks:+ -- example = do do do do foo where foo = ...+ --+ -- `where` closes layout contexts even when indented at the same level:+ -- example = case+ -- Foo -> ...+ -- Bar -> ...+ -- where foo = ...+ whereP _ LytDo = True+ whereP lytPos lyt = offsideEndP lytPos lyt++ TokLowerName [] "in" ->+ case collapse inP state of+ -- `let/in` is not allowed in `ado` syntax. `in` is treated as a+ -- delimiter and must always close the `ado`.+ -- example = ado+ -- foo <- ...+ -- let bar = ...+ -- in ...+ ((_, LytLetStmt) : (_, LytAdo) : stk', acc') ->+ (stk', acc') & insertEnd & insertEnd & insertToken src+ ((_, lyt) : stk', acc') | isIndented lyt ->+ (stk', acc') & insertEnd & insertToken src+ _ ->+ state & insertDefault & popStack (== LytProperty)+ where+ inP _ LytLet = False+ inP _ LytAdo = False+ inP _ lyt = isIndented lyt++ TokLowerName [] "let" ->+ state & insertKwProperty next+ where+ next state'@(stk', _) = case stk' of+ (p, LytDo) : _ | srcColumn p == srcColumn tokPos ->+ state' & insertStart LytLetStmt+ (p, LytAdo) : _ | srcColumn p == srcColumn tokPos ->+ state' & insertStart LytLetStmt+ _ ->+ state' & insertStart LytLet++ TokLowerName _ "do" ->+ state & insertKwProperty (insertStart LytDo)++ TokLowerName _ "ado" ->+ state & insertKwProperty (insertStart LytAdo)++ -- `case` heads need masking due to commas.+ TokLowerName [] "case" ->+ state & insertKwProperty (pushStack tokPos LytCase)++ TokLowerName [] "of" ->+ case collapse indentedP state of+ -- When `of` is matched with a `case`, we are in a case block, and we+ -- need to mask additional contexts (LytCaseBinders, LytCaseGuards)+ -- due to commas.+ ((_, LytCase) : stk', acc') ->+ (stk', acc') & insertToken src & insertStart LytOf & pushStack nextPos LytCaseBinders+ state' ->+ state' & insertDefault & popStack (== LytProperty)++ -- `if/then/else` is considered a delimiter context. This allows us to+ -- write chained expressions in `do` blocks without stair-stepping:+ -- example = do+ -- foo+ -- if ... then+ -- ...+ -- else if ... then+ -- ...+ -- else+ -- ...+ TokLowerName [] "if" ->+ state & insertKwProperty (pushStack tokPos LytIf)++ TokLowerName [] "then" ->+ case state & collapse indentedP of+ ((_, LytIf) : stk', acc') ->+ (stk', acc') & insertToken src & pushStack tokPos LytThen+ _ ->+ state & insertDefault & popStack (== LytProperty)++ TokLowerName [] "else" ->+ case state & collapse indentedP of+ ((_, LytThen) : stk', acc') ->+ (stk', acc') & insertToken src+ _ ->+ -- We don't want to insert a layout separator for top-level `else` in+ -- instance chains.+ case state & collapse offsideP of+ state'@(stk', _) | isTopDecl tokPos stk' ->+ state' & insertToken src+ state' ->+ state' & insertSep & insertToken src & popStack (== LytProperty)++ -- `forall` binders need masking because the usage of `.` should not+ -- introduce a LytProperty context.+ TokForall _ ->+ state & insertKwProperty (pushStack tokPos LytForall)++ -- Lambdas need masking because the usage of `->` should not close a+ -- LytDeclGuard or LytCaseGuard context.+ TokBackslash ->+ state & insertDefault & pushStack tokPos LytLambdaBinders++ TokRightArrow _ ->+ state & collapse arrowP & popStack guardP & insertToken src+ where+ arrowP _ LytDo = True+ arrowP _ LytOf = False+ arrowP lytPos lyt = offsideEndP lytPos lyt++ guardP LytCaseBinders = True+ guardP LytCaseGuard = True+ guardP LytLambdaBinders = True+ guardP _ = False++ TokEquals ->+ case state & collapse equalsP of+ ((_, LytDeclGuard) : stk', acc') ->+ (stk', acc') & insertToken src+ _ ->+ state & insertDefault+ where+ equalsP _ LytWhere = True+ equalsP _ LytLet = True+ equalsP _ LytLetStmt = True+ equalsP _ _ = False++ -- Guards need masking because of commas.+ TokPipe ->+ case collapse offsideEndP state of+ state'@((_, LytOf) : _, _) ->+ state' & pushStack tokPos LytCaseGuard & insertToken src+ state'@((_, LytLet) : _, _) ->+ state' & pushStack tokPos LytDeclGuard & insertToken src+ state'@((_, LytLetStmt) : _, _) ->+ state' & pushStack tokPos LytDeclGuard & insertToken src+ state'@((_, LytWhere) : _, _) ->+ state' & pushStack tokPos LytDeclGuard & insertToken src+ _ ->+ state & insertDefault++ -- Ticks can either start or end an infix expression. We preemptively+ -- collapse all indentation contexts in search of a starting delimiter,+ -- and backtrack if we don't find one.+ TokTick ->+ case state & collapse indentedP of+ ((_, LytTick) : stk', acc') ->+ (stk', acc') & insertToken src+ _ ->+ state & collapse offsideEndP & insertSep & insertToken src & pushStack tokPos LytTick++ -- In general, commas should close all indented contexts.+ -- example = [ do foo+ -- bar, baz ]+ TokComma ->+ case state & collapse indentedP of+ -- If we see a LytBrace, then we are in a record type or literal.+ -- Record labels need masking so we can use unquoted keywords as labels+ -- without accidentally littering layout delimiters.+ state'@((_, LytBrace) : _, _) ->+ state' & insertToken src & pushStack tokPos LytProperty+ state' ->+ state' & insertToken src++ -- TokDot tokens usually entail property access, which need masking so we+ -- can use unquoted keywords as labels.+ TokDot ->+ case state & insertDefault of+ ((_, LytForall) : stk', acc') ->+ (stk', acc')+ state' ->+ state' & pushStack tokPos LytProperty++ TokLeftParen ->+ state & insertDefault & pushStack tokPos LytParen++ TokLeftBrace ->+ state & insertDefault & pushStack tokPos LytBrace & pushStack tokPos LytProperty++ TokLeftSquare ->+ state & insertDefault & pushStack tokPos LytSquare++ TokRightParen ->+ state & collapse indentedP & popStack (== LytParen) & insertToken src++ TokRightBrace ->+ state & collapse indentedP & popStack (== LytProperty) & popStack (== LytBrace) & insertToken src++ TokRightSquare ->+ state & collapse indentedP & popStack (== LytSquare) & insertToken src++ TokString _ _ ->+ state & insertDefault & popStack (== LytProperty)++ TokLowerName [] _ ->+ state & insertDefault & popStack (== LytProperty)++ TokOperator _ _ ->+ state & collapse offsideEndP & insertSep & insertToken src++ _ ->+ state & insertDefault++ insertDefault state =+ state & collapse offsideP & insertSep & insertToken src++ insertStart lyt state@(stk, _) =+ -- We only insert a new layout start when it's going to increase indentation.+ -- This prevents things like the following from parsing:+ -- instance foo :: Foo where+ -- foo = 42+ case find (isIndented . snd) stk of+ Just (pos, _) | srcColumn nextPos <= srcColumn pos -> state+ _ -> state & pushStack nextPos lyt & insertToken (lytToken nextPos TokLayoutStart)++ insertSep state@(stk, acc) = case stk of+ -- LytTopDecl is closed by a separator.+ (lytPos, LytTopDecl) : stk' | sepP lytPos ->+ (stk', acc) & insertToken sepTok+ -- LytTopDeclHead can be closed by a separator if there is no `where`.+ (lytPos, LytTopDeclHead) : stk' | sepP lytPos ->+ (stk', acc) & insertToken sepTok+ (lytPos, lyt) : _ | indentSepP lytPos lyt ->+ case lyt of+ -- If a separator is inserted in a case block, we need to push an+ -- additional LytCaseBinders context for comma masking.+ LytOf -> state & insertToken sepTok & pushStack tokPos LytCaseBinders+ _ -> state & insertToken sepTok+ _ -> state+ where+ sepTok = lytToken tokPos TokLayoutSep++ insertKwProperty k state =+ case state & insertDefault of+ ((_, LytProperty) : stk', acc') ->+ (stk', acc')+ state' ->+ k state'++ insertEnd =+ insertToken (lytToken tokPos TokLayoutEnd)++ insertToken token (stk, acc) =+ (stk, acc `snoc` token)++ pushStack lytPos lyt (stk, acc) =+ ((lytPos, lyt) : stk, acc)++ popStack p ((_, lyt) : stk', acc)+ | p lyt = (stk', acc)+ popStack _ state = state++ collapse p = uncurry go+ where+ go ((lytPos, lyt) : stk) acc+ | p lytPos lyt =+ go stk $ if isIndented lyt+ then acc `snoc` lytToken tokPos TokLayoutEnd+ else acc+ go stk acc = (stk, acc)++ indentedP =+ const isIndented++ offsideP lytPos lyt =+ isIndented lyt && srcColumn tokPos < srcColumn lytPos++ offsideEndP lytPos lyt =+ isIndented lyt && srcColumn tokPos <= srcColumn lytPos++ indentSepP lytPos lyt =+ isIndented lyt && sepP lytPos++ sepP lytPos =+ srcColumn tokPos == srcColumn lytPos && srcLine tokPos /= srcLine lytPos++unwindLayout :: SourcePos -> [Comment LineFeed] -> LayoutStack -> [SourceToken]+unwindLayout pos leading = go+ where+ go [] = []+ go ((_, LytRoot) : _) = [SourceToken (TokenAnn (SourceRange pos pos) leading []) TokEof]+ go ((_, lyt) : stk) | isIndented lyt = lytToken pos TokLayoutEnd : go stk+ go (_ : stk) = go stk
+ src/Language/PureScript/CST/Lexer.hs view
@@ -0,0 +1,780 @@+module Language.PureScript.CST.Lexer+ ( lenient+ , lexModule+ , lex+ , lexTopLevel+ , lexWithState+ , isUnquotedKey+ ) where++import Prelude hiding (lex, exp, exponent, lines)++import Control.Monad (join)+import Data.Char qualified as Char+import Data.DList qualified as DList+import Data.Foldable (foldl')+import Data.Functor (($>))+import Data.Scientific qualified as Sci+import Data.String (fromString)+import Data.Text (Text)+import Data.Text qualified as Text+import Data.Text.PureScript qualified as Text+import Language.PureScript.CST.Errors (ParserErrorInfo(..), ParserErrorType(..))+import Language.PureScript.CST.Monad (LexResult, LexState(..), ParserM(..), throw)+import Language.PureScript.CST.Layout (LayoutDelim(..), insertLayout, lytToken, unwindLayout)+import Language.PureScript.CST.Positions (advanceLeading, advanceToken, advanceTrailing, applyDelta, textDelta)+import Language.PureScript.CST.Types (Comment(..), LineFeed(..), SourcePos(..), SourceRange(..), SourceStyle(..), SourceToken(..), Token(..), TokenAnn(..))++-- | Stops at the first lexing error and replaces it with TokEof. Otherwise,+-- the parser will fail when it attempts to draw a lookahead token.+lenient :: [LexResult] -> [LexResult]+lenient = go+ where+ go [] = []+ go (Right a : as) = Right a : go as+ go (Left (st, _) : _) = do+ let+ pos = lexPos st+ ann = TokenAnn (SourceRange pos pos) (lexLeading st) []+ [Right (SourceToken ann TokEof)]++lexModule :: Text -> [LexResult]+lexModule = lex' shebangThenComments++-- | Lexes according to root layout rules.+lex :: Text -> [LexResult]+lex = lex' comments++lex' :: (Text -> ([Comment LineFeed], Text)) -> Text -> [LexResult]+lex' lexComments src = do+ let (leading, src') = lexComments src++ lexWithState $ LexState+ { lexPos = advanceLeading (SourcePos 1 1) leading+ , lexLeading = leading+ , lexSource = src'+ , lexStack = [(SourcePos 0 0, LytRoot)]+ }++-- | Lexes according to top-level declaration context rules.+lexTopLevel :: Text -> [LexResult]+lexTopLevel src = do+ let+ (leading, src') = comments src+ lexPos = advanceLeading (SourcePos 1 1) leading+ hd = Right $ lytToken lexPos TokLayoutStart+ tl = lexWithState $ LexState+ { lexPos = lexPos+ , lexLeading = leading+ , lexSource = src'+ , lexStack = [(lexPos, LytWhere), (SourcePos 0 0, LytRoot)]+ }+ hd : tl++-- | Lexes according to some LexState.+lexWithState :: LexState -> [LexResult]+lexWithState = go+ where+ Parser lexK =+ tokenAndComments++ go state@LexState {..} =+ lexK lexSource onError onSuccess+ where+ onError lexSource' err = do+ let+ len1 = Text.length lexSource+ len2 = Text.length lexSource'+ chunk = Text.take (max 0 (len1 - len2)) lexSource+ chunkDelta = textDelta chunk+ pos = applyDelta lexPos chunkDelta+ pure $ Left+ ( state { lexSource = lexSource' }+ , ParserErrorInfo (SourceRange pos $ applyDelta pos (0, 1)) [] lexStack err+ )++ onSuccess _ (TokEof, _) =+ Right <$> unwindLayout lexPos lexLeading lexStack+ onSuccess lexSource' (tok, (trailing, lexLeading')) = do+ let+ endPos = advanceToken lexPos tok+ lexPos' = advanceLeading (advanceTrailing endPos trailing) lexLeading'+ tokenAnn = TokenAnn+ { tokRange = SourceRange lexPos endPos+ , tokLeadingComments = lexLeading+ , tokTrailingComments = trailing+ }+ (lexStack', toks) =+ insertLayout (SourceToken tokenAnn tok) lexPos' lexStack+ state' = LexState+ { lexPos = lexPos'+ , lexLeading = lexLeading'+ , lexSource = lexSource'+ , lexStack = lexStack'+ }+ go2 state' toks++ go2 state [] = go state+ go2 state (t : ts) = Right t : go2 state ts++type Lexer = ParserM ParserErrorType Text++{-# INLINE next #-}+next :: Lexer ()+next = Parser $ \inp _ ksucc ->+ ksucc (Text.drop 1 inp) ()++{-# INLINE nextWhile #-}+nextWhile :: (Char -> Bool) -> Lexer Text+nextWhile p = Parser $ \inp _ ksucc -> do+ let (chs, inp') = Text.span p inp+ ksucc inp' chs++{-# INLINE nextWhile' #-}+nextWhile' :: Int -> (Char -> Bool) -> Lexer Text+nextWhile' n p = Parser $ \inp _ ksucc -> do+ let (chs, inp') = Text.spanUpTo n p inp+ ksucc inp' chs++{-# INLINE peek #-}+peek :: Lexer (Maybe Char)+peek = Parser $ \inp _ ksucc ->+ if Text.null inp+ then ksucc inp Nothing+ else ksucc inp $ Just $ Text.head inp++{-# INLINE restore #-}+restore :: (ParserErrorType -> Bool) -> Lexer a -> Lexer a+restore p (Parser k) = Parser $ \inp kerr ksucc ->+ k inp (\inp' err -> kerr (if p err then inp else inp') err) ksucc++tokenAndComments :: Lexer (Token, ([Comment void], [Comment LineFeed]))+tokenAndComments = (,) <$> token <*> breakComments++shebangThenComments :: Text -> ([Comment LineFeed], Text)+shebangThenComments src = do+ let+ (sb, (coms, src')) = comments <$> shebang src+ (sb <> coms, src')++shebang :: Text -> ([Comment LineFeed], Text)+shebang = \src -> k src (\_ _ -> ([], src)) (\inp a -> (a, inp))+ where+ Parser k = breakShebang++comments :: Text -> ([Comment LineFeed], Text)+comments = \src -> k src (\_ _ -> ([], src)) (\inp (a, b) -> (a <> b, inp))+ where+ Parser k = breakComments++breakComments :: Lexer ([Comment void], [Comment LineFeed])+breakComments = k0 []+ where+ k0 acc = do+ spaces <- nextWhile (== ' ')+ lines <- nextWhile isLineFeed+ let+ acc'+ | Text.null spaces = acc+ | otherwise = Space (Text.length spaces) : acc+ if Text.null lines+ then do+ mbComm <- comment+ case mbComm of+ Just comm -> k0 (comm : acc')+ Nothing -> pure (reverse acc', [])+ else+ k1 acc' (goWs [] $ Text.unpack lines)++ k1 trl acc = do+ ws <- nextWhile (\c -> c == ' ' || isLineFeed c)+ let acc' = goWs acc $ Text.unpack ws+ mbComm <- comment+ case mbComm of+ Just comm -> k1 trl (comm : acc')+ Nothing -> pure (reverse trl, reverse acc')++ goWs a ('\r' : '\n' : ls) = goWs (Line CRLF : a) ls+ goWs a ('\r' : ls) = goWs (Line CRLF : a) ls+ goWs a ('\n' : ls) = goWs (Line LF : a) ls+ goWs a (' ' : ls) = goSpace a 1 ls+ goWs a _ = a++ goSpace a !n (' ' : ls) = goSpace a (n + 1) ls+ goSpace a n ls = goWs (Space n : a) ls++ isBlockComment = Parser $ \inp _ ksucc ->+ case Text.uncons inp of+ Just ('-', inp2) ->+ case Text.uncons inp2 of+ Just ('-', inp3) ->+ ksucc inp3 $ Just False+ _ ->+ ksucc inp Nothing+ Just ('{', inp2) ->+ case Text.uncons inp2 of+ Just ('-', inp3) ->+ ksucc inp3 $ Just True+ _ ->+ ksucc inp Nothing+ _ ->+ ksucc inp Nothing++ comment = isBlockComment >>= \case+ Just True -> Just <$> blockComment "{-"+ Just False -> Just <$> lineComment "--"+ Nothing -> pure Nothing++ blockComment acc = do+ chs <- nextWhile (/= '-')+ dashes <- nextWhile (== '-')+ if Text.null dashes+ then pure $ Comment $ acc <> chs+ else peek >>= \case+ Just '}' -> next $> Comment (acc <> chs <> dashes <> "}")+ _ -> blockComment (acc <> chs <> dashes)++breakShebang :: ParserM ParserErrorType Text [Comment LineFeed]+breakShebang = shebangComment >>= \case+ Just comm -> k0 [comm]+ Nothing -> pure []+ where+ k0 acc = lineFeedShebang >>= \case+ Just (lf, sb) -> do+ comm <- lineComment sb+ k0 (comm : lf : acc)+ Nothing ->+ pure $ reverse acc++ lineFeedShebang = Parser $ \inp _ ksucc ->+ case unconsLineFeed inp of+ Just (lf, inp2)+ | Just (sb, inp3) <- unconsShebang inp2 ->+ ksucc inp3 $ Just (lf, sb)+ _ ->+ ksucc inp Nothing++ unconsLineFeed :: Text -> Maybe (Comment LineFeed, Text)+ unconsLineFeed inp =+ case Text.uncons inp of+ Just ('\r', inp2) ->+ case Text.uncons inp2 of+ Just ('\n', inp3) ->+ Just (Line CRLF, inp3)+ _ ->+ Just (Line CRLF, inp2)+ Just ('\n', inp2) ->+ Just (Line LF, inp2)+ _ ->+ Nothing++ unconsShebang :: Text -> Maybe (Text, Text)+ unconsShebang = fmap ("#!",) . Text.stripPrefix "#!"++ shebangComment = isShebang >>= traverse lineComment++ isShebang = Parser $ \inp _ ksucc ->+ case unconsShebang inp of+ Just (sb, inp3) ->+ ksucc inp3 $ Just sb+ _ ->+ ksucc inp Nothing++lineComment :: forall lf. Text -> ParserM ParserErrorType Text (Comment lf)+lineComment acc = do+ comm <- nextWhile (\c -> c /= '\r' && c /= '\n')+ pure $ Comment (acc <> comm)++token :: Lexer Token+token = peek >>= maybe (pure TokEof) k0+ where+ k0 ch1 = case ch1 of+ '(' -> next *> leftParen+ ')' -> next $> TokRightParen+ '{' -> next $> TokLeftBrace+ '}' -> next $> TokRightBrace+ '[' -> next $> TokLeftSquare+ ']' -> next $> TokRightSquare+ '`' -> next $> TokTick+ ',' -> next $> TokComma+ '∷' -> next *> orOperator1 (TokDoubleColon Unicode) ch1+ '←' -> next *> orOperator1 (TokLeftArrow Unicode) ch1+ '→' -> next *> orOperator1 (TokRightArrow Unicode) ch1+ '⇒' -> next *> orOperator1 (TokRightFatArrow Unicode) ch1+ '∀' -> next *> orOperator1 (TokForall Unicode) ch1+ '|' -> next *> orOperator1 TokPipe ch1+ '.' -> next *> orOperator1 TokDot ch1+ '\\' -> next *> orOperator1 TokBackslash ch1+ '<' -> next *> orOperator2 (TokLeftArrow ASCII) ch1 '-'+ '-' -> next *> orOperator2 (TokRightArrow ASCII) ch1 '>'+ '=' -> next *> orOperator2' TokEquals (TokRightFatArrow ASCII) ch1 '>'+ ':' -> next *> orOperator2' (TokOperator [] ":") (TokDoubleColon ASCII) ch1 ':'+ '?' -> next *> hole+ '\'' -> next *> char+ '"' -> next *> string+ _ | Char.isDigit ch1 -> restore (== ErrNumberOutOfRange) (next *> number ch1)+ | Char.isUpper ch1 -> next *> upper [] ch1+ | isIdentStart ch1 -> next *> lower [] ch1+ | isSymbolChar ch1 -> next *> operator [] [ch1]+ | otherwise -> throw $ ErrLexeme (Just [ch1]) []++ {-# INLINE orOperator1 #-}+ orOperator1 :: Token -> Char -> Lexer Token+ orOperator1 tok ch1 = join $ Parser $ \inp _ ksucc ->+ case Text.uncons inp of+ Just (ch2, inp2) | isSymbolChar ch2 ->+ ksucc inp2 $ operator [] [ch1, ch2]+ _ ->+ ksucc inp $ pure tok++ {-# INLINE orOperator2 #-}+ orOperator2 :: Token -> Char -> Char -> Lexer Token+ orOperator2 tok ch1 ch2 = join $ Parser $ \inp _ ksucc ->+ case Text.uncons inp of+ Just (ch2', inp2) | ch2 == ch2' ->+ case Text.uncons inp2 of+ Just (ch3, inp3) | isSymbolChar ch3 ->+ ksucc inp3 $ operator [] [ch1, ch2, ch3]+ _ ->+ ksucc inp2 $ pure tok+ _ ->+ ksucc inp $ operator [] [ch1]++ {-# INLINE orOperator2' #-}+ orOperator2' :: Token -> Token -> Char -> Char -> Lexer Token+ orOperator2' tok1 tok2 ch1 ch2 = join $ Parser $ \inp _ ksucc ->+ case Text.uncons inp of+ Just (ch2', inp2) | ch2 == ch2' ->+ case Text.uncons inp2 of+ Just (ch3, inp3) | isSymbolChar ch3 ->+ ksucc inp3 $ operator [] [ch1, ch2, ch3]+ _ ->+ ksucc inp2 $ pure tok2+ Just (ch2', inp2) | isSymbolChar ch2' ->+ ksucc inp2 $ operator [] [ch1, ch2']+ _ ->+ ksucc inp $ pure tok1++ {-+ leftParen+ : '(' '→' ')'+ | '(' '->' ')'+ | '(' symbolChar+ ')'+ | '('+ -}+ leftParen :: Lexer Token+ leftParen = Parser $ \inp kerr ksucc ->+ case Text.span isSymbolChar inp of+ (chs, inp2)+ | Text.null chs -> ksucc inp TokLeftParen+ | otherwise ->+ case Text.uncons inp2 of+ Just (')', inp3) ->+ case chs of+ "→" -> ksucc inp3 $ TokSymbolArr Unicode+ "->" -> ksucc inp3 $ TokSymbolArr ASCII+ _ | isReservedSymbol chs -> kerr inp ErrReservedSymbol+ | otherwise -> ksucc inp3 $ TokSymbolName [] chs+ _ -> ksucc inp TokLeftParen++ {-+ symbol+ : '(' symbolChar+ ')'+ -}+ symbol :: [Text] -> Lexer Token+ symbol qual = restore isReservedSymbolError $ peek >>= \case+ Just ch | isSymbolChar ch ->+ nextWhile isSymbolChar >>= \chs ->+ peek >>= \case+ Just ')'+ | isReservedSymbol chs -> throw ErrReservedSymbol+ | otherwise -> next $> TokSymbolName (reverse qual) chs+ Just ch2 -> throw $ ErrLexeme (Just [ch2]) []+ Nothing -> throw ErrEof+ Just ch -> throw $ ErrLexeme (Just [ch]) []+ Nothing -> throw ErrEof++ {-+ operator+ : symbolChar++ -}+ operator :: [Text] -> String -> Lexer Token+ operator qual pre = do+ rest <- nextWhile isSymbolChar+ pure . TokOperator (reverse qual) $ Text.pack pre <> rest++ {-+ moduleName+ : upperChar alphaNumChar*++ qualifier+ : (moduleName '.')* moduleName++ upper+ : (qualifier '.')? upperChar identChar*+ | qualifier '.' lowerQualified+ | qualifier '.' operator+ | qualifier '.' symbol+ -}+ upper :: [Text] -> Char -> Lexer Token+ upper qual pre = do+ rest <- nextWhile isIdentChar+ ch1 <- peek+ let name = Text.cons pre rest+ case ch1 of+ Just '.' -> do+ let qual' = name : qual+ next *> peek >>= \case+ Just '(' -> next *> symbol qual'+ Just ch2+ | Char.isUpper ch2 -> next *> upper qual' ch2+ | isIdentStart ch2 -> next *> lower qual' ch2+ | isSymbolChar ch2 -> next *> operator qual' [ch2]+ | otherwise -> throw $ ErrLexeme (Just [ch2]) []+ Nothing ->+ throw ErrEof+ _ ->+ pure $ TokUpperName (reverse qual) name++ {-+ lower+ : '_'+ | 'forall'+ | lowerChar identChar*++ lowerQualified+ : lowerChar identChar*+ -}+ lower :: [Text] -> Char -> Lexer Token+ lower qual pre = do+ rest <- nextWhile isIdentChar+ case pre of+ '_' | Text.null rest ->+ if null qual+ then pure TokUnderscore+ else throw $ ErrLexeme (Just [pre]) []+ _ ->+ case Text.cons pre rest of+ "forall" | null qual -> pure $ TokForall ASCII+ name -> pure $ TokLowerName (reverse qual) name++ {-+ hole+ : '?' identChar++ -}+ hole :: Lexer Token+ hole = do+ name <- nextWhile isIdentChar+ if Text.null name+ then operator [] ['?']+ else pure $ TokHole name++ {-+ char+ : "'" '\' escape "'"+ | "'" [^'] "'"+ -}+ char :: Lexer Token+ char = do+ (raw, ch) <- peek >>= \case+ Just '\\' -> do+ (raw, ch2) <- next *> escape+ pure (Text.cons '\\' raw, ch2)+ Just ch ->+ next $> (Text.singleton ch, ch)+ Nothing ->+ throw ErrEof+ peek >>= \case+ Just '\''+ | fromEnum ch > 0xFFFF -> throw ErrAstralCodePointInChar+ | otherwise -> next $> TokChar raw ch+ Just ch2 ->+ throw $ ErrLexeme (Just [ch2]) []+ _ ->+ throw ErrEof++ {-+ stringPart+ : '\' escape+ | '\' [ \r\n]+ '\'+ | [^"]++ string+ : '"' stringPart* '"'+ | '"""' '"'{0,2} ([^"]+ '"'{1,2})* [^"]* '"""'++ A raw string literal can't contain any sequence of 3 or more quotes,+ although sequences of 1 or 2 quotes are allowed anywhere, including at the+ beginning or the end.+ -}+ string :: Lexer Token+ string = do+ quotes1 <- nextWhile' 7 (== '"')+ case Text.length quotes1 of+ 0 -> do+ let+ go raw acc = do+ chs <- nextWhile isNormalStringChar+ let+ raw' = raw <> chs+ acc' = acc <> DList.fromList (Text.unpack chs)+ peek >>= \case+ Just '"' -> next $> TokString raw' (fromString (DList.toList acc'))+ Just '\\' -> next *> goEscape (raw' <> "\\") acc'+ Just _ -> throw ErrLineFeedInString+ Nothing -> throw ErrEof++ goEscape raw acc = do+ mbCh <- peek+ case mbCh of+ Just ch1 | isStringGapChar ch1 -> do+ gap <- nextWhile isStringGapChar+ peek >>= \case+ Just '"' -> next $> TokString (raw <> gap) (fromString (DList.toList acc))+ Just '\\' -> next *> go (raw <> gap <> "\\") acc+ Just ch -> throw $ ErrCharInGap ch+ Nothing -> throw ErrEof+ _ -> do+ (raw', ch) <- escape+ go (raw <> raw') (acc <> DList.singleton ch)+ go "" mempty+ 1 ->+ pure $ TokString "" ""+ n | n >= 5 ->+ pure $ TokRawString $ Text.drop 5 quotes1+ _ -> do+ let+ go acc = do+ chs <- nextWhile (/= '"')+ quotes2 <- nextWhile' 5 (== '"')+ case Text.length quotes2 of+ 0 -> throw ErrEof+ n | n >= 3 -> pure $ TokRawString $ acc <> chs <> Text.drop 3 quotes2+ _ -> go (acc <> chs <> quotes2)+ go $ Text.drop 2 quotes1++ {-+ escape+ : 't'+ | 'r'+ | 'n'+ | "'"+ | '"'+ | 'x' [0-9a-fA-F]{0,6}+ -}+ escape :: Lexer (Text, Char)+ escape = do+ ch <- peek+ case ch of+ Just 't' -> next $> ("t", '\t')+ Just 'r' -> next $> ("r", '\r')+ Just 'n' -> next $> ("n", '\n')+ Just '"' -> next $> ("\"", '"')+ Just '\'' -> next $> ("'", '\'')+ Just '\\' -> next $> ("\\", '\\')+ Just 'x' -> (*>) next $ Parser $ \inp kerr ksucc -> do+ let+ go n acc (ch' : chs)+ | Char.isHexDigit ch' = go (n * 16 + Char.digitToInt ch') (ch' : acc) chs+ go n acc _+ | n <= 0x10FFFF =+ ksucc (Text.drop (length acc) inp)+ ("x" <> Text.pack (reverse acc), Char.chr n)+ | otherwise =+ kerr inp ErrCharEscape -- TODO+ go 0 [] $ Text.unpack $ Text.take 6 inp+ _ -> throw ErrCharEscape++ {-+ number+ : hexadecimal+ | integer ('.' fraction)? exponent?+ -}+ number :: Char -> Lexer Token+ number ch1 = peek >>= \ch2 -> case (ch1, ch2) of+ ('0', Just 'x') -> next *> hexadecimal+ (_, _) -> do+ mbInt <- integer1 ch1+ mbFraction <- fraction+ case (mbInt, mbFraction) of+ (Just (raw, int), Nothing) -> do+ let int' = digitsToInteger int+ exponent >>= \case+ Just (raw', exp) ->+ sciDouble (raw <> raw') $ Sci.scientific int' exp+ Nothing ->+ pure $ TokInt raw int'+ (Just (raw, int), Just (raw', frac)) -> do+ let sci = digitsToScientific int frac+ exponent >>= \case+ Just (raw'', exp) ->+ sciDouble (raw <> raw' <> raw'') $ uncurry Sci.scientific $ (+ exp) <$> sci+ Nothing ->+ sciDouble (raw <> raw') $ uncurry Sci.scientific sci+ (Nothing, Just (raw, frac)) -> do+ let sci = digitsToScientific [] frac+ exponent >>= \case+ Just (raw', exp) ->+ sciDouble (raw <> raw') $ uncurry Sci.scientific $ (+ exp) <$> sci+ Nothing ->+ sciDouble raw $ uncurry Sci.scientific sci+ (Nothing, Nothing) ->+ peek >>= \ch -> throw $ ErrLexeme (pure <$> ch) []++ sciDouble :: Text -> Sci.Scientific -> Lexer Token+ sciDouble raw sci = case Sci.toBoundedRealFloat sci of+ Left _ -> throw ErrNumberOutOfRange+ Right n -> pure $ TokNumber raw n++ {-+ integer+ : '0'+ | [1-9] digits+ -}+ integer :: Lexer (Maybe (Text, String))+ integer = peek >>= \case+ Just '0' -> next *> peek >>= \case+ Just ch | isNumberChar ch -> throw ErrLeadingZero+ _ -> pure $ Just ("0", "0")+ Just ch | Char.isDigit ch -> Just <$> digits+ _ -> pure Nothing++ {-+ integer1+ : '0'+ | [1-9] digits++ This is the same as 'integer', the only difference is that this expects the+ first char to be consumed during dispatch.+ -}+ integer1 :: Char -> Lexer (Maybe (Text, String))+ integer1 = \case+ '0' -> peek >>= \case+ Just ch | isNumberChar ch -> throw ErrLeadingZero+ _ -> pure $ Just ("0", "0")+ ch | Char.isDigit ch -> do+ (raw, chs) <- digits+ pure $ Just (Text.cons ch raw, ch : chs)+ _ -> pure Nothing++ {-+ fraction+ : '.' [0-9_]++ -}+ fraction :: Lexer (Maybe (Text, String))+ fraction = Parser $ \inp _ ksucc ->+ -- We need more than a single char lookahead for things like `1..10`.+ case Text.uncons inp of+ Just ('.', inp')+ | (raw, inp'') <- Text.span isNumberChar inp'+ , not (Text.null raw) ->+ ksucc inp'' $ Just ("." <> raw, filter (/= '_') $ Text.unpack raw)+ _ ->+ ksucc inp Nothing++ {-+ digits+ : [0-9_]*++ Digits can contain underscores, which are ignored.+ -}+ digits :: Lexer (Text, String)+ digits = do+ raw <- nextWhile isNumberChar+ pure (raw, filter (/= '_') $ Text.unpack raw)++ {-+ exponent+ : 'e' ('+' | '-')? integer+ -}+ exponent :: Lexer (Maybe (Text, Int))+ exponent = peek >>= \case+ Just 'e' -> do+ (neg, sign) <- next *> peek >>= \case+ Just '-' -> next $> (True, "-")+ Just '+' -> next $> (False, "+")+ _ -> pure (False, "")+ integer >>= \case+ Just (raw, chs) -> do+ let+ int | neg = negate $ digitsToInteger chs+ | otherwise = digitsToInteger chs+ pure $ Just ("e" <> sign <> raw, fromInteger int)+ Nothing -> throw ErrExpectedExponent+ _ ->+ pure Nothing++ {-+ hexadecimal+ : '0x' [0-9a-fA-F]++ -}+ hexadecimal :: Lexer Token+ hexadecimal = do+ chs <- nextWhile Char.isHexDigit+ if Text.null chs+ then throw ErrExpectedHex+ else pure $ TokInt ("0x" <> chs) $ digitsToIntegerBase 16 $ Text.unpack chs++digitsToInteger :: String -> Integer+digitsToInteger = digitsToIntegerBase 10++digitsToIntegerBase :: Integer -> String -> Integer+digitsToIntegerBase b = foldl' (\n c -> n * b + toInteger (Char.digitToInt c)) 0++digitsToScientific :: String -> String -> (Integer, Int)+digitsToScientific = go 0 . reverse+ where+ go !exp is [] = (digitsToInteger (reverse is), exp)+ go exp is (f : fs) = go (exp - 1) (f : is) fs++isSymbolChar :: Char -> Bool+isSymbolChar c = (c `elem` (":!#$%&*+./<=>?@\\^|-~" :: String)) || (not (Char.isAscii c) && Char.isSymbol c)++isReservedSymbolError :: ParserErrorType -> Bool+isReservedSymbolError = (== ErrReservedSymbol)++isReservedSymbol :: Text -> Bool+isReservedSymbol = flip elem symbols+ where+ symbols =+ [ "::"+ , "∷"+ , "<-"+ , "←"+ , "->"+ , "→"+ , "=>"+ , "⇒"+ , "∀"+ , "|"+ , "."+ , "\\"+ , "="+ ]++isIdentStart :: Char -> Bool+isIdentStart c = Char.isLower c || c == '_'++isIdentChar :: Char -> Bool+isIdentChar c = Char.isAlphaNum c || c == '_' || c == '\''++isNumberChar :: Char -> Bool+isNumberChar c = Char.isDigit c || c == '_'++isNormalStringChar :: Char -> Bool+isNormalStringChar c = c /= '"' && c /= '\\' && c /= '\r' && c /= '\n'++isStringGapChar :: Char -> Bool+isStringGapChar c = c == ' ' || c == '\r' || c == '\n'++isLineFeed :: Char -> Bool+isLineFeed c = c == '\r' || c == '\n'++-- | Checks if some identifier is a valid unquoted key.+isUnquotedKey :: Text -> Bool+isUnquotedKey t =+ case Text.uncons t of+ Nothing ->+ False+ Just (hd, tl) ->+ isIdentStart hd && Text.all isIdentChar tl
+ src/Language/PureScript/CST/Monad.hs view
@@ -0,0 +1,185 @@+module Language.PureScript.CST.Monad where++import Prelude++import Data.List (sortOn)+import Data.List.NonEmpty qualified as NE+import Data.Ord (comparing)+import Data.Text (Text)+import Language.PureScript.CST.Errors (ParserError, ParserErrorInfo(..), ParserErrorType(..), ParserWarning, ParserWarningType)+import Language.PureScript.CST.Layout (LayoutStack)+import Language.PureScript.CST.Positions (widen)+import Language.PureScript.CST.Types (Comment, LineFeed, SourcePos(..), SourceRange(..), SourceToken(..), Token, TokenAnn(..))++type LexResult = Either (LexState, ParserError) SourceToken++data LexState = LexState+ { lexPos :: SourcePos+ , lexLeading :: [Comment LineFeed]+ , lexSource :: Text+ , lexStack :: LayoutStack+ } deriving (Show)++data ParserState = ParserState+ { parserBuff :: [LexResult]+ , parserErrors :: [ParserError]+ , parserWarnings :: [ParserWarning]+ } deriving (Show)++-- | A bare bones, CPS'ed `StateT s (Except e) a`.+newtype ParserM e s a =+ Parser (forall r. s -> (s -> e -> r) -> (s -> a -> r) -> r)++type Parser = ParserM ParserError ParserState++instance Functor (ParserM e s) where+ {-# INLINE fmap #-}+ fmap f (Parser k) =+ Parser $ \st kerr ksucc ->+ k st kerr (\st' a -> ksucc st' (f a))++instance Applicative (ParserM e s) where+ {-# INLINE pure #-}+ pure a = Parser $ \st _ k -> k st a+ {-# INLINE (<*>) #-}+ Parser k1 <*> Parser k2 =+ Parser $ \st kerr ksucc ->+ k1 st kerr $ \st' f ->+ k2 st' kerr $ \st'' a ->+ ksucc st'' (f a)++instance Monad (ParserM e s) where+ {-# INLINE return #-}+ return = pure+ {-# INLINE (>>=) #-}+ Parser k1 >>= k2 =+ Parser $ \st kerr ksucc ->+ k1 st kerr $ \st' a -> do+ let Parser k3 = k2 a+ k3 st' kerr ksucc++runParser :: ParserState -> Parser a -> (ParserState, Either (NE.NonEmpty ParserError) a)+runParser st (Parser k) = k st left right+ where+ left st'@ParserState {..} err =+ (st', Left $ NE.sortBy (comparing errRange) $ err NE.:| parserErrors)++ right st'@ParserState {..} res+ | null parserErrors = (st', Right res)+ | otherwise = (st', Left $ NE.fromList $ sortOn errRange parserErrors)++runTokenParser :: Parser a -> [LexResult] -> Either (NE.NonEmpty ParserError) ([ParserWarning], a)+runTokenParser p buff = fmap (warnings,) res+ where+ (ParserState _ _ warnings, res) =+ runParser initialState p++ initialState = ParserState+ { parserBuff = buff+ , parserErrors = []+ , parserWarnings = []+ }++{-# INLINE throw #-}+throw :: e -> ParserM e s a+throw e = Parser $ \st kerr _ -> kerr st e++parseError :: SourceToken -> Parser a+parseError tok = Parser $ \st kerr _ ->+ kerr st $ ParserErrorInfo+ { errRange = tokRange . tokAnn $ tok+ , errToks = [tok]+ , errStack = [] -- TODO parserStack st+ , errType = ErrToken+ }++mkParserError :: LayoutStack -> [SourceToken] -> a -> ParserErrorInfo a+mkParserError stack toks ty =+ ParserErrorInfo+ { errRange = range+ , errToks = toks+ , errStack = stack+ , errType = ty+ }+ where+ range = case toks of+ [] -> SourceRange (SourcePos 0 0) (SourcePos 0 0)+ _ -> widen (tokRange . tokAnn $ head toks) (tokRange . tokAnn $ last toks)++addFailure :: [SourceToken] -> ParserErrorType -> Parser ()+addFailure toks ty = Parser $ \st _ ksucc ->+ ksucc (st { parserErrors = mkParserError [] toks ty : parserErrors st }) ()++parseFail' :: [SourceToken] -> ParserErrorType -> Parser a+parseFail' toks msg = Parser $ \st kerr _ -> kerr st (mkParserError [] toks msg)++parseFail :: SourceToken -> ParserErrorType -> Parser a+parseFail = parseFail' . pure++addWarning :: [SourceToken] -> ParserWarningType -> Parser ()+addWarning toks ty = Parser $ \st _ ksucc ->+ ksucc (st { parserWarnings = mkParserError [] toks ty : parserWarnings st }) ()++pushBack :: SourceToken -> Parser ()+pushBack tok = Parser $ \st _ ksucc ->+ ksucc (st { parserBuff = Right tok : parserBuff st }) ()++{-# INLINE tryPrefix #-}+tryPrefix :: Parser a -> Parser b -> Parser (Maybe a, b)+tryPrefix (Parser lhs) rhs = Parser $ \st kerr ksucc ->+ lhs st+ (\_ _ -> do+ let Parser k = (Nothing,) <$> rhs+ k st kerr ksucc)+ (\st' res -> do+ let Parser k = (Just res,) <$> rhs+ k st' kerr ksucc)++oneOf :: NE.NonEmpty (Parser a) -> Parser a+oneOf parsers = Parser $ \st kerr ksucc -> do+ let+ prevErrs = parserErrors st+ go (st', Right a) _ = (st', Right a)+ go _ (st', Right a) = (st', Right a)+ go (st1, Left errs1) (st2, Left errs2)+ | errRange (NE.last errs2) > errRange (NE.last errs1) = (st2, Left errs2)+ | otherwise = (st1, Left errs1)+ case foldr1 go $ runParser (st { parserErrors = [] }) <$> parsers of+ (st', Left errs) -> kerr (st' { parserErrors = prevErrs <> NE.tail errs}) $ NE.head errs+ (st', Right res) -> ksucc (st' { parserErrors = prevErrs }) res++manyDelimited :: Token -> Token -> Token -> Parser a -> Parser [a]+manyDelimited open close sep p = do+ _ <- token open+ res <- go1+ _ <- token close+ pure res+ where+ go1 =+ oneOf $ NE.fromList+ [ go2 . pure =<< p+ , pure []+ ]++ go2 acc =+ oneOf $ NE.fromList+ [ token sep *> (go2 . (: acc) =<< p)+ , pure (reverse acc)+ ]++token :: Token -> Parser SourceToken+token t = do+ t' <- munch+ if t == tokValue t'+ then pure t'+ else parseError t'++munch :: Parser SourceToken+munch = Parser $ \state@ParserState {..} kerr ksucc ->+ case parserBuff of+ Right tok : parserBuff' ->+ ksucc (state { parserBuff = parserBuff' }) tok+ Left (_, err) : _ ->+ kerr state err+ [] ->+ error "Empty input"
+ src/Language/PureScript/CST/Parser.y view
@@ -0,0 +1,818 @@+{+module Language.PureScript.CST.Parser+ ( parseType+ , parseExpr+ , parseDecl+ , parseIdent+ , parseOperator+ , parseModule+ , parseImportDeclP+ , parseDeclP+ , parseExprP+ , parseTypeP+ , parseModuleNameP+ , parseQualIdentP+ , parse+ , PartialResult(..)+ ) where++import Prelude hiding (lex)++import Control.Monad ((<=<), when)+import Data.Bifunctor (second)+import Data.Foldable (foldl', for_, toList)+import qualified Data.List.NonEmpty as NE+import Data.Text (Text)+import Data.Traversable (for, sequence)+import Language.PureScript.CST.Errors+import Language.PureScript.CST.Flatten (flattenType)+import Language.PureScript.CST.Lexer+import Language.PureScript.CST.Monad+import Language.PureScript.CST.Positions+import Language.PureScript.CST.Types+import Language.PureScript.CST.Utils+import qualified Language.PureScript.Names as N+import qualified Language.PureScript.Roles as R+import Language.PureScript.PSString (PSString)+}++%expect 0++%name parseType type+%name parseExpr expr+%name parseIdent ident+%name parseOperator op+%name parseModuleBody moduleBody+%name parseDecl decl+%partial parseImportDeclP importDeclP+%partial parseDeclP declP+%partial parseExprP exprP+%partial parseTypeP typeP+%partial parseModuleNameP moduleNameP+%partial parseQualIdentP qualIdentP+%partial parseModuleHeader moduleHeader+%partial parseDoStatement doStatement+%partial parseDoExpr doExpr+%partial parseDoNext doNext+%partial parseGuardExpr guardExpr+%partial parseGuardNext guardNext+%partial parseGuardStatement guardStatement+%partial parseClassSignature classSignature+%partial parseClassSuper classSuper+%partial parseClassNameAndFundeps classNameAndFundeps+%partial parseBinderAndArrow binderAndArrow+%tokentype { SourceToken }+%monad { Parser }+%error { parseError }+%lexer { lexer } { SourceToken _ TokEof }++%token+ '(' { SourceToken _ TokLeftParen }+ ')' { SourceToken _ TokRightParen }+ '{' { SourceToken _ TokLeftBrace }+ '}' { SourceToken _ TokRightBrace }+ '[' { SourceToken _ TokLeftSquare }+ ']' { SourceToken _ TokRightSquare }+ '\{' { SourceToken _ TokLayoutStart }+ '\}' { SourceToken _ TokLayoutEnd }+ '\;' { SourceToken _ TokLayoutSep }+ '<-' { SourceToken _ (TokLeftArrow _) }+ '->' { SourceToken _ (TokRightArrow _) }+ '<=' { SourceToken _ (TokOperator [] sym) | isLeftFatArrow sym }+ '=>' { SourceToken _ (TokRightFatArrow _) }+ ':' { SourceToken _ (TokOperator [] ":") }+ '::' { SourceToken _ (TokDoubleColon _) }+ '=' { SourceToken _ TokEquals }+ '|' { SourceToken _ TokPipe }+ '`' { SourceToken _ TokTick }+ '.' { SourceToken _ TokDot }+ ',' { SourceToken _ TokComma }+ '_' { SourceToken _ TokUnderscore }+ '\\' { SourceToken _ TokBackslash }+ '-' { SourceToken _ (TokOperator [] "-") }+ '@' { SourceToken _ (TokOperator [] "@") }+ 'ado' { SourceToken _ (TokLowerName _ "ado") }+ 'as' { SourceToken _ (TokLowerName [] "as") }+ 'case' { SourceToken _ (TokLowerName [] "case") }+ 'class' { SourceToken _ (TokLowerName [] "class") }+ 'data' { SourceToken _ (TokLowerName [] "data") }+ 'derive' { SourceToken _ (TokLowerName [] "derive") }+ 'do' { SourceToken _ (TokLowerName _ "do") }+ 'else' { SourceToken _ (TokLowerName [] "else") }+ 'false' { SourceToken _ (TokLowerName [] "false") }+ 'forall' { SourceToken _ (TokForall ASCII) }+ 'forallu' { SourceToken _ (TokForall Unicode) }+ 'foreign' { SourceToken _ (TokLowerName [] "foreign") }+ 'hiding' { SourceToken _ (TokLowerName [] "hiding") }+ 'import' { SourceToken _ (TokLowerName [] "import") }+ 'if' { SourceToken _ (TokLowerName [] "if") }+ 'in' { SourceToken _ (TokLowerName [] "in") }+ 'infix' { SourceToken _ (TokLowerName [] "infix") }+ 'infixl' { SourceToken _ (TokLowerName [] "infixl") }+ 'infixr' { SourceToken _ (TokLowerName [] "infixr") }+ 'instance' { SourceToken _ (TokLowerName [] "instance") }+ 'let' { SourceToken _ (TokLowerName [] "let") }+ 'module' { SourceToken _ (TokLowerName [] "module") }+ 'newtype' { SourceToken _ (TokLowerName [] "newtype") }+ 'nominal' { SourceToken _ (TokLowerName [] "nominal") }+ 'phantom' { SourceToken _ (TokLowerName [] "phantom") }+ 'of' { SourceToken _ (TokLowerName [] "of") }+ 'representational' { SourceToken _ (TokLowerName [] "representational") }+ 'role' { SourceToken _ (TokLowerName [] "role") }+ 'then' { SourceToken _ (TokLowerName [] "then") }+ 'true' { SourceToken _ (TokLowerName [] "true") }+ 'type' { SourceToken _ (TokLowerName [] "type") }+ 'where' { SourceToken _ (TokLowerName [] "where") }+ '(->)' { SourceToken _ (TokSymbolArr _) }+ '(..)' { SourceToken _ (TokSymbolName [] "..") }+ LOWER { SourceToken _ (TokLowerName [] _) }+ QUAL_LOWER { SourceToken _ (TokLowerName _ _) }+ UPPER { SourceToken _ (TokUpperName [] _) }+ QUAL_UPPER { SourceToken _ (TokUpperName _ _) }+ SYMBOL { SourceToken _ (TokSymbolName [] _) }+ QUAL_SYMBOL { SourceToken _ (TokSymbolName _ _) }+ OPERATOR { SourceToken _ (TokOperator [] _) }+ QUAL_OPERATOR { SourceToken _ (TokOperator _ _) }+ LIT_HOLE { SourceToken _ (TokHole _) }+ LIT_CHAR { SourceToken _ (TokChar _ _) }+ LIT_STRING { SourceToken _ (TokString _ _) }+ LIT_RAW_STRING { SourceToken _ (TokRawString _) }+ LIT_INT { SourceToken _ (TokInt _ _) }+ LIT_NUMBER { SourceToken _ (TokNumber _ _) }++%%++many(a) :: { NE.NonEmpty a }+ : many1(a) %shift { NE.reverse $1 }++many1(a) :: { NE.NonEmpty a }+ : a { pure $1 }+ | many1(a) a { NE.cons $2 $1 }++manySep(a, sep) :: { NE.NonEmpty a }+ : manySep1(a, sep) { NE.reverse $1 }++manySep1(a, sep) :: { NE.NonEmpty a }+ : a { pure $1 }+ | manySep1(a, sep) sep a { NE.cons $3 $1 }++manySepOrEmpty(a, sep) :: { [a] }+ : {- empty -} { [] }+ | manySep(a, sep) { NE.toList $1 }++manyOrEmpty(a) :: { [a] }+ : {- empty -} { [] }+ | many(a) { NE.toList $1 }++sep(a, s) :: { Separated a }+ : sep1(a, s) { separated $1 }++sep1(a, s) :: { [(SourceToken, a)] }+ : a %shift { [(placeholder, $1)] }+ | sep1(a, s) s a { ($2, $3) : $1 }++delim(a, b, c, d) :: { Delimited b }+ : a d { Wrapped $1 Nothing $2 }+ | a sep(b, c) d { Wrapped $1 (Just $2) $3 }++moduleName :: { Name N.ModuleName }+ : UPPER {% upperToModuleName $1 }+ | QUAL_UPPER {% upperToModuleName $1 }++qualProperName :: { QualifiedProperName }+ : UPPER {% qualifiedProperName <\$> toQualifiedName N.ProperName $1 }+ | QUAL_UPPER {% qualifiedProperName <\$> toQualifiedName N.ProperName $1 }++properName :: { ProperName }+ : UPPER {% properName <\$> toName N.ProperName $1 }++qualIdent :: { QualifiedName Ident }+ : LOWER {% toQualifiedName Ident $1 }+ | QUAL_LOWER {% toQualifiedName Ident $1 }+ | 'as' {% toQualifiedName Ident $1 }+ | 'hiding' {% toQualifiedName Ident $1 }+ | 'role' {% toQualifiedName Ident $1 }+ | 'nominal' {% toQualifiedName Ident $1 }+ | 'representational' {% toQualifiedName Ident $1 }+ | 'phantom' {% toQualifiedName Ident $1 }++ident :: { Name Ident }+ : LOWER {% toName Ident $1 }+ | 'as' {% toName Ident $1 }+ | 'hiding' {% toName Ident $1 }+ | 'role' {% toName Ident $1 }+ | 'nominal' {% toName Ident $1 }+ | 'representational' {% toName Ident $1 }+ | 'phantom' {% toName Ident $1 }++qualOp :: { QualifiedOpName }+ : OPERATOR {% qualifiedOpName <\$> toQualifiedName N.OpName $1 }+ | QUAL_OPERATOR {% qualifiedOpName <\$> toQualifiedName N.OpName $1 }+ | '<=' {% qualifiedOpName <\$> toQualifiedName N.OpName $1 }+ | '-' {% qualifiedOpName <\$> toQualifiedName N.OpName $1 }+ | ':' {% qualifiedOpName <\$> toQualifiedName N.OpName $1 }++op :: { OpName }+ : OPERATOR {% opName <\$> toName N.OpName $1 }+ | '<=' {% opName <\$> toName N.OpName $1 }+ | '-' {% opName <\$> toName N.OpName $1 }+ | ':' {% opName <\$> toName N.OpName $1 }++qualSymbol :: { QualifiedOpName }+ : SYMBOL {% qualifiedOpName <\$> toQualifiedName N.OpName $1 }+ | QUAL_SYMBOL {% qualifiedOpName <\$> toQualifiedName N.OpName $1 }+ | '(..)' {% qualifiedOpName <\$> toQualifiedName N.OpName $1 }++symbol :: { OpName }+ : SYMBOL {% opName <\$> toName N.OpName $1 }+ | '(..)' {% opName <\$> toName N.OpName $1 }++label :: { Label }+ : LOWER { toLabel $1 }+ | LIT_STRING { toLabel $1 }+ | LIT_RAW_STRING { toLabel $1 }+ | 'ado' { toLabel $1 }+ | 'as' { toLabel $1 }+ | 'case' { toLabel $1 }+ | 'class' { toLabel $1 }+ | 'data' { toLabel $1 }+ | 'derive' { toLabel $1 }+ | 'do' { toLabel $1 }+ | 'else' { toLabel $1 }+ | 'false' { toLabel $1 }+ | 'forall' { toLabel $1 }+ | 'foreign' { toLabel $1 }+ | 'hiding' { toLabel $1 }+ | 'import' { toLabel $1 }+ | 'if' { toLabel $1 }+ | 'in' { toLabel $1 }+ | 'infix' { toLabel $1 }+ | 'infixl' { toLabel $1 }+ | 'infixr' { toLabel $1 }+ | 'instance' { toLabel $1 }+ | 'let' { toLabel $1 }+ | 'module' { toLabel $1 }+ | 'newtype' { toLabel $1 }+ | 'nominal' { toLabel $1 }+ | 'of' { toLabel $1 }+ | 'phantom' { toLabel $1 }+ | 'representational' { toLabel $1 }+ | 'role' { toLabel $1 }+ | 'then' { toLabel $1 }+ | 'true' { toLabel $1 }+ | 'type' { toLabel $1 }+ | 'where' { toLabel $1 }++hole :: { Name Ident }+ : LIT_HOLE {% toName Ident $1 }++string :: { (SourceToken, PSString) }+ : LIT_STRING { toString $1 }+ | LIT_RAW_STRING { toString $1 }++char :: { (SourceToken, Char) }+ : LIT_CHAR { toChar $1 }++number :: { (SourceToken, Either Integer Double) }+ : LIT_INT { toNumber $1 }+ | LIT_NUMBER { toNumber $1 }++int :: { (SourceToken, Integer) }+ : LIT_INT { toInt $1 }++boolean :: { (SourceToken, Bool) }+ : 'true' { toBoolean $1 }+ | 'false' { toBoolean $1 }++type :: { Type () }+ : type1 %shift { $1 }+ | type1 '::' type { TypeKinded () $1 $2 $3 }++type1 :: { Type () }+ : type2 { $1 }+ | forall many(typeVarBinding) '.' type1 { TypeForall () $1 $2 $3 $4 }++type2 :: { Type () }+ : type3 %shift { $1 }+ | type3 '->' type1 { TypeArr () $1 $2 $3 }+ | type3 '=>' type1 {% do cs <- toConstraint $1; pure $ TypeConstrained () cs $2 $3 }++type3 :: { Type () }+ : type4 %shift { $1 }+ | type3 qualOp type4 %shift { TypeOp () $1 (getQualifiedOpName $2) $3 }++type4 :: { Type () }+ : type5 %shift { $1 }+ | '-' int { uncurry (TypeInt () (Just $1)) (second negate $2) }++type5 :: { Type () }+ : typeAtom { $1 }+ | type5 typeAtom { TypeApp () $1 $2 }++typeAtom :: { Type ()}+ : '_' { TypeWildcard () $1 }+ | ident { TypeVar () $1 }+ | qualProperName { TypeConstructor () (getQualifiedProperName $1) }+ | qualSymbol { TypeOpName () (getQualifiedOpName $1) }+ | string { uncurry (TypeString ()) $1 }+ | int { uncurry (TypeInt () Nothing) $1 }+ | hole { TypeHole () $1 }+ | '(->)' { TypeArrName () $1 }+ | '{' row '}' { TypeRecord () (Wrapped $1 $2 $3) }+ | '(' row ')' { TypeRow () (Wrapped $1 $2 $3) }+ | '(' type1 ')' { TypeParens () (Wrapped $1 $2 $3) }+ | '(' typeKindedAtom '::' type ')' { TypeParens () (Wrapped $1 (TypeKinded () $2 $3 $4) $5) }++-- Due to a conflict between row syntax and kinded type syntax, we require+-- kinded type variables to be wrapped in parens. Thus `(a :: Foo)` is always a+-- row, and to annotate `a` with kind `Foo`, one must use `((a) :: Foo)`.+typeKindedAtom :: { Type () }+ : '_' { TypeWildcard () $1 }+ | qualProperName { TypeConstructor () (getQualifiedProperName $1) }+ | qualSymbol { TypeOpName () (getQualifiedOpName $1) }+ | int { uncurry (TypeInt () Nothing) $1 }+ | hole { TypeHole () $1 }+ | '{' row '}' { TypeRecord () (Wrapped $1 $2 $3) }+ | '(' row ')' { TypeRow () (Wrapped $1 $2 $3) }+ | '(' type1 ')' { TypeParens () (Wrapped $1 $2 $3) }+ | '(' typeKindedAtom '::' type ')' { TypeParens () (Wrapped $1 (TypeKinded () $2 $3 $4) $5) }++row :: { Row () }+ : {- empty -} { Row Nothing Nothing }+ | '|' type { Row Nothing (Just ($1, $2)) }+ | sep(rowLabel, ',') { Row (Just $1) Nothing }+ | sep(rowLabel, ',') '|' type { Row (Just $1) (Just ($2, $3)) }++rowLabel :: { Labeled Label (Type ()) }+ : label '::' type { Labeled $1 $2 $3 }++typeVarBinding :: { TypeVarBinding () }+ : ident { TypeVarName (Nothing, $1) }+ | '@' ident { TypeVarName (Just $1, $2) }+ | '(' ident '::' type ')' {% checkNoWildcards $4 *> pure (TypeVarKinded (Wrapped $1 (Labeled (Nothing, $2) $3 $4) $5)) }+ | '(' '@' ident '::' type ')' {% checkNoWildcards $5 *> pure (TypeVarKinded (Wrapped $1 (Labeled (Just $2, $3) $4 $5) $6)) }++typeVarBindingPlain :: { TypeVarBinding () }+ : ident { TypeVarName (Nothing, $1) }+ | '(' ident '::' type ')' {% checkNoWildcards $4 *> pure (TypeVarKinded (Wrapped $1 (Labeled (Nothing, $2) $3 $4) $5)) }++forall :: { SourceToken }+ : 'forall' { $1 }+ | 'forallu' { $1 }++exprWhere :: { Where () }+ : expr %shift { Where $1 Nothing }+ | expr 'where' '\{' manySep(letBinding, '\;') '\}' { Where $1 (Just ($2, $4)) }++expr :: { Expr () }+ : expr1 %shift { $1 }+ | expr1 '::' type { ExprTyped () $1 $2 $3 }++expr1 :: { Expr () }+ : expr2 %shift { $1 }+ | expr1 qualOp expr2 %shift { ExprOp () $1 (getQualifiedOpName $2) $3 }++expr2 :: { Expr () }+ : expr3 { $1 }+ | expr2 '`' exprBacktick '`' expr3 { ExprInfix () $1 (Wrapped $2 $3 $4) $5 }++exprBacktick :: { Expr () }+ : expr3 { $1 }+ | exprBacktick qualOp expr3 { ExprOp () $1 (getQualifiedOpName $2) $3 }++expr3 :: { Expr () }+ : expr4 %shift { $1 }+ | '-' expr3 { ExprNegate () $1 $2 }++expr4 :: { Expr () }+ : expr5 { $1 }+ | expr4 expr5+ { -- Record application/updates can introduce a function application+ -- associated to the right, so we need to correct it.+ case $2 of+ ExprApp _ lhs rhs ->+ ExprApp () (ExprApp () $1 lhs) rhs+ _ -> ExprApp () $1 $2+ }+ | expr4 '@' typeAtom { ExprVisibleTypeApp () $1 $2 $3 }++expr5 :: { Expr () }+ : expr6 { $1 }+ | 'if' expr 'then' expr 'else' expr { ExprIf () (IfThenElse $1 $2 $3 $4 $5 $6) }+ | doBlock { ExprDo () $1 }+ | adoBlock 'in' expr { ExprAdo () $ uncurry AdoBlock $1 $2 $3 }+ | '\\' many(binderAtom) '->' expr { ExprLambda () (Lambda $1 $2 $3 $4) }+ | 'let' '\{' manySep(letBinding, '\;') '\}' 'in' expr { ExprLet () (LetIn $1 $3 $5 $6) }+ | 'case' sep(expr, ',') 'of' '\{' manySep(caseBranch, '\;') '\}' { ExprCase () (CaseOf $1 $2 $3 $5) }+ -- These special cases handle some idiosynchratic syntax that the current+ -- parser allows. Technically the parser allows the rhs of a case branch to be+ -- at any level, but this is ambiguous. We allow it in the case of a singleton+ -- case, since this is used in the wild.+ | 'case' sep(expr, ',') 'of' '\{' sep(binder1, ',') '->' '\}' exprWhere+ {% addWarning (let (a,b) = whereRange $8 in [a, b]) WarnDeprecatedCaseOfOffsideSyntax *> pure (ExprCase () (CaseOf $1 $2 $3 (pure ($5, Unconditional $6 $8)))) }+ | 'case' sep(expr, ',') 'of' '\{' sep(binder1, ',') '\}' guardedCase+ {% addWarning (let (a,b) = guardedRange $7 in [a, b]) WarnDeprecatedCaseOfOffsideSyntax *> pure (ExprCase () (CaseOf $1 $2 $3 (pure ($5, $7)))) }++expr6 :: { Expr () }+ : expr7 %shift { $1 }+ | expr7 '{' '}' { ExprApp () $1 (ExprRecord () (Wrapped $2 Nothing $3)) }+ | expr7 '{' sep(recordUpdateOrLabel, ',') '}'+ {% toRecordFields $3 >>= \case+ Left xs -> pure $ ExprApp () $1 (ExprRecord () (Wrapped $2 (Just xs) $4))+ Right xs -> pure $ ExprRecordUpdate () $1 (Wrapped $2 xs $4)+ }++expr7 :: { Expr () }+ : exprAtom { $1 }+ | exprAtom '.' sep(label, '.') { ExprRecordAccessor () (RecordAccessor $1 $2 $3) }++exprAtom :: { Expr () }+ : '_' { ExprSection () $1 }+ | hole { ExprHole () $1 }+ | qualIdent { ExprIdent () $1 }+ | qualProperName { ExprConstructor () (getQualifiedProperName $1) }+ | qualSymbol { ExprOpName () (getQualifiedOpName $1) }+ | boolean { uncurry (ExprBoolean ()) $1 }+ | char { uncurry (ExprChar ()) $1 }+ | string { uncurry (ExprString ()) $1 }+ | number { uncurry (ExprNumber ()) $1 }+ | delim('[', expr, ',', ']') { ExprArray () $1 }+ | delim('{', recordLabel, ',', '}') { ExprRecord () $1 }+ | '(' expr ')' { ExprParens () (Wrapped $1 $2 $3) }++recordLabel :: { RecordLabeled (Expr ()) }+ : label {% fmap RecordPun . toName Ident $ lblTok $1 }+ | label '=' expr {% addFailure [$2] ErrRecordUpdateInCtr *> pure (RecordPun $ unexpectedName $ lblTok $1) }+ | label ':' expr { RecordField $1 $2 $3 }++recordUpdateOrLabel :: { Either (RecordLabeled (Expr ())) (RecordUpdate ()) }+ : label ':' expr { Left (RecordField $1 $2 $3) }+ | label {% fmap (Left . RecordPun) . toName Ident $ lblTok $1 }+ | label '=' expr { Right (RecordUpdateLeaf $1 $2 $3) }+ | label '{' sep(recordUpdate, ',') '}' { Right (RecordUpdateBranch $1 (Wrapped $2 $3 $4)) }++recordUpdate :: { RecordUpdate () }+ : label '=' expr { RecordUpdateLeaf $1 $2 $3 }+ | label '{' sep(recordUpdate, ',') '}' { RecordUpdateBranch $1 (Wrapped $2 $3 $4) }++letBinding :: { LetBinding () }+ : ident '::' type { LetBindingSignature () (Labeled $1 $2 $3) }+ | ident guardedDecl { LetBindingName () (ValueBindingFields $1 [] $2) }+ | ident many(binderAtom) guardedDecl { LetBindingName () (ValueBindingFields $1 (NE.toList $2) $3) }+ | binder1 '=' exprWhere { LetBindingPattern () $1 $2 $3 }++caseBranch :: { (Separated (Binder ()), Guarded ()) }+ : sep(binder1, ',') guardedCase { ($1, $2) }++guardedDecl :: { Guarded () }+ : '=' exprWhere { Unconditional $1 $2 }+ | many(guardedDeclExpr) { Guarded $1 }++guardedDeclExpr :: { GuardedExpr () }+ : guard '=' exprWhere { uncurry GuardedExpr $1 $2 $3 }++guardedCase :: { Guarded () }+ : '->' exprWhere { Unconditional $1 $2 }+ | many(guardedCaseExpr) { Guarded $1 }++guardedCaseExpr :: { GuardedExpr () }+ : guard '->' exprWhere { uncurry GuardedExpr $1 $2 $3 }++-- Do/Ado statements and pattern guards require unbounded lookahead due to many+-- conflicts between `binder` and `expr` syntax. For example `Foo a b c` can+-- either be a constructor `binder` or several `expr` applications, and we won't+-- know until we see a `<-` or layout separator.+--+-- One way to resolve this would be to parse a `binder` as an `expr` and then+-- reassociate it after the fact. However this means we can't use the `binder`+-- productions to parse it, so we'd have to maintain an ad-hoc handwritten+-- parser which is very difficult to audit.+--+-- As an alternative we introduce some backtracking. Using %partial parsers and+-- monadic reductions, we can invoke productions manually and use the+-- backtracking `tryPrefix` combinator. Binders are generally very short in+-- comparison to expressions, so the cost is modest.+--+-- doBlock+-- : 'do' '\{' manySep(doStatement, '\;') '\}'+--+-- doStatement+-- : 'let' '\{' manySep(letBinding, '\;') '\}'+-- | expr+-- | binder '<-' expr+--+-- guard+-- : '|' sep(patternGuard, ',')+--+-- patternGuard+-- : expr1+-- | binder '<-' expr1+--+doBlock :: { DoBlock () }+ : 'do' '\{'+ {%% revert $ do+ res <- parseDoStatement+ when (null res) $ addFailure [$2] ErrEmptyDo+ pure $ DoBlock $1 $ NE.fromList res+ }++adoBlock :: { (SourceToken, [DoStatement ()]) }+ : 'ado' '\{' '\}' { ($1, []) }+ | 'ado' '\{'+ {%% revert $ fmap ($1,) parseDoStatement }++doStatement :: { [DoStatement ()] }+ : 'let' '\{' manySep(letBinding, '\;') '\}'+ {%^ revert $ fmap (DoLet $1 $3 :) parseDoNext }+ | {- empty -}+ {%^ revert $ do+ stmt <- tryPrefix parseBinderAndArrow parseDoExpr+ let+ ctr = case stmt of+ (Just (binder, sep), expr) ->+ (DoBind binder sep expr :)+ (Nothing, expr) ->+ (DoDiscard expr :)+ fmap ctr parseDoNext+ }++doExpr :: { Expr () }+ : expr {%^ revert $ pure $1 }++doNext :: { [DoStatement ()] }+ : '\;' {%^ revert parseDoStatement }+ | '\}' {%^ revert $ pure [] }++guard :: { (SourceToken, Separated (PatternGuard ())) }+ : '|' {%% revert $ fmap (($1,) . uncurry Separated) parseGuardStatement }++guardStatement :: { (PatternGuard (), [(SourceToken, PatternGuard ())]) }+ : {- empty -}+ {%^ revert $ do+ grd <- fmap (uncurry PatternGuard) $ tryPrefix parseBinderAndArrow parseGuardExpr+ fmap (grd,) parseGuardNext+ }++guardExpr :: { Expr() }+ : expr1 {%^ revert $ pure $1 }++guardNext :: { [(SourceToken, PatternGuard ())] }+ : ',' {%^ revert $ fmap (\(g, gs) -> ($1, g) : gs) parseGuardStatement }+ | {- empty -} {%^ revert $ pure [] }++binderAndArrow :: { (Binder (), SourceToken) }+ : binder '<-' {%^ revert $ pure ($1, $2) }++binder :: { Binder () }+ : binder1 { $1 }+ | binder1 '::' type { BinderTyped () $1 $2 $3 }++binder1 :: { Binder () }+ : binder2 { $1 }+ | binder1 qualOp binder2 { BinderOp () $1 (getQualifiedOpName $2) $3 }++binder2 :: { Binder () }+ : many(binderAtom) {% toBinderConstructor $1 }+ | '-' number { uncurry (BinderNumber () (Just $1)) $2 }++binderAtom :: { Binder () }+ : '_' { BinderWildcard () $1 }+ | ident %shift { BinderVar () $1 }+ | ident '@' binderAtom { BinderNamed () $1 $2 $3 }+ | qualProperName { BinderConstructor () (getQualifiedProperName $1) [] }+ | boolean { uncurry (BinderBoolean ()) $1 }+ | char { uncurry (BinderChar ()) $1 }+ | string { uncurry (BinderString ()) $1 }+ | number { uncurry (BinderNumber () Nothing) $1 }+ | delim('[', binder, ',', ']') { BinderArray () $1 }+ | delim('{', recordBinder, ',', '}') { BinderRecord () $1 }+ | '(' binder ')' { BinderParens () (Wrapped $1 $2 $3) }++recordBinder :: { RecordLabeled (Binder ()) }+ : label {% fmap RecordPun . toName Ident $ lblTok $1 }+ | label '=' binder {% addFailure [$2] ErrRecordUpdateInCtr *> pure (RecordPun $ unexpectedName $ lblTok $1) }+ | label ':' binder { RecordField $1 $2 $3 }++-- By splitting up the module header from the body, we can incrementally parse+-- just the header, and then continue parsing the body while still sharing work.+moduleHeader :: { Module () }+ : 'module' moduleName exports 'where' '\{' moduleImports+ { (Module () $1 $2 $3 $4 $6 [] []) }++moduleBody :: { ([Declaration ()], [Comment LineFeed]) }+ : moduleDecls '\}'+ {%^ \(SourceToken ann _) -> pure (snd $1, tokLeadingComments ann) }++moduleImports :: { [ImportDecl ()] }+ : importDecls importDecl '\}'+ {%^ revert $ pushBack $3 *> pure (reverse ($2 : $1)) }+ | importDecls+ {%^ revert $ pure (reverse $1) }++importDecls :: { [ImportDecl ()] }+ : importDecls importDecl '\;' { $2 : $1 }+ | {- empty -} { [] }++moduleDecls :: { ([ImportDecl ()], [Declaration ()]) }+ : manySep(moduleDecl, '\;') {% toModuleDecls $ NE.toList $1 }+ | {- empty -} { ([], []) }++moduleDecl :: { TmpModuleDecl () }+ : importDecl { TmpImport $1 }+ | sep(decl, declElse) { TmpChain $1 }++declElse :: { SourceToken }+ : 'else' { $1 }+ | 'else' '\;' { $1 }++exports :: { Maybe (DelimitedNonEmpty (Export ())) }+ : {- empty -} { Nothing }+ | '(' sep(export, ',') ')' { Just (Wrapped $1 $2 $3) }++export :: { Export () }+ : ident { ExportValue () $1 }+ | symbol { ExportOp () (getOpName $1) }+ | properName { ExportType () (getProperName $1) Nothing }+ | properName dataMembers { ExportType () (getProperName $1) (Just $2) }+ | 'type' symbol { ExportTypeOp () $1 (getOpName $2) }+ | 'class' properName { ExportClass () $1 (getProperName $2) }+ | 'module' moduleName { ExportModule () $1 $2 }++dataMembers :: { (DataMembers ()) }+ : '(..)' { DataAll () $1 }+ | '(' ')' { DataEnumerated () (Wrapped $1 Nothing $2) }+ | '(' sep(properName, ',') ')' { DataEnumerated () (Wrapped $1 (Just \$ getProperName <\$> $2) $3) }++importDecl :: { ImportDecl () }+ : 'import' moduleName imports { ImportDecl () $1 $2 $3 Nothing }+ | 'import' moduleName imports 'as' moduleName { ImportDecl () $1 $2 $3 (Just ($4, $5)) }++imports :: { Maybe (Maybe SourceToken, DelimitedNonEmpty (Import ())) }+ : {- empty -} { Nothing }+ | '(' sep(import, ',') ')' { Just (Nothing, Wrapped $1 $2 $3) }+ | 'hiding' '(' sep(import, ',') ')' { Just (Just $1, Wrapped $2 $3 $4) }++import :: { Import () }+ : ident { ImportValue () $1 }+ | symbol { ImportOp () (getOpName $1) }+ | properName { ImportType () (getProperName $1) Nothing }+ | properName dataMembers { ImportType () (getProperName $1) (Just $2) }+ | 'type' symbol { ImportTypeOp () $1 (getOpName $2) }+ | 'class' properName { ImportClass () $1 (getProperName $2) }++decl :: { Declaration () }+ : dataHead { DeclData () $1 Nothing }+ | dataHead '=' sep(dataCtor, '|') { DeclData () $1 (Just ($2, $3)) }+ | typeHead '=' type {% checkNoWildcards $3 *> pure (DeclType () $1 $2 $3) }+ | newtypeHead '=' properName typeAtom {% checkNoWildcards $4 *> pure (DeclNewtype () $1 $2 (getProperName $3) $4) }+ | classHead { either id (\h -> DeclClass () h Nothing) $1 }+ | classHead 'where' '\{' manySep(classMember, '\;') '\}' {% either (const (parseError $2)) (\h -> pure $ DeclClass () h (Just ($2, $4))) $1 }+ | instHead { DeclInstanceChain () (Separated (Instance $1 Nothing) []) }+ | instHead 'where' '\{' manySep(instBinding, '\;') '\}' { DeclInstanceChain () (Separated (Instance $1 (Just ($2, $4))) []) }+ | 'data' properName '::' type {% checkNoWildcards $4 *> pure (DeclKindSignature () $1 (Labeled (getProperName $2) $3 $4)) }+ | 'newtype' properName '::' type {% checkNoWildcards $4 *> pure (DeclKindSignature () $1 (Labeled (getProperName $2) $3 $4)) }+ | 'type' properName '::' type {% checkNoWildcards $4 *> pure (DeclKindSignature () $1 (Labeled (getProperName $2) $3 $4)) }+ | 'derive' instHead { DeclDerive () $1 Nothing $2 }+ | 'derive' 'newtype' instHead { DeclDerive () $1 (Just $2) $3 }+ | ident '::' type { DeclSignature () (Labeled $1 $2 $3) }+ | ident manyOrEmpty(binderAtom) guardedDecl { DeclValue () (ValueBindingFields $1 $2 $3) }+ | fixity { DeclFixity () $1 }+ | 'foreign' 'import' ident '::' type {% when (isConstrained $5) (addFailure ([$1, $2, nameTok $3, $4] <> toList (flattenType $5)) ErrConstraintInForeignImportSyntax) *> pure (DeclForeign () $1 $2 (ForeignValue (Labeled $3 $4 $5))) }+ | 'foreign' 'import' 'data' properName '::' type { DeclForeign () $1 $2 (ForeignData $3 (Labeled (getProperName $4) $5 $6)) }+ | 'type' 'role' properName many(role) { DeclRole () $1 $2 (getProperName $3) $4 }++dataHead :: { DataHead () }+ : 'data' properName manyOrEmpty(typeVarBindingPlain) { DataHead $1 (getProperName $2) $3 }++typeHead :: { DataHead () }+ : 'type' properName manyOrEmpty(typeVarBindingPlain) { DataHead $1 (getProperName $2) $3 }++newtypeHead :: { DataHead () }+ : 'newtype' properName manyOrEmpty(typeVarBindingPlain) { DataHead $1 (getProperName $2) $3 }++dataCtor :: { DataCtor () }+ : properName manyOrEmpty(typeAtom)+ {% for_ $2 checkNoWildcards *> pure (DataCtor () (getProperName $1) $2) }++-- Class head syntax requires unbounded lookahead due to a conflict between+-- row syntax and `typeVarBinding`. `(a :: B)` is either a row in `constraint`+-- where `B` is a type or a `typeVarBinding` where `B` is a kind. We must see+-- either a `<=`, `where`, or layout delimiter before deciding which it is.+--+-- classHead+-- : 'class' classNameAndFundeps+-- | 'class' constraints '<=' classNameAndFundeps+--+classHead :: { Either (Declaration ()) (ClassHead ()) }+ : 'class'+ {%% revert $ oneOf $ NE.fromList+ [ fmap (Left . DeclKindSignature () $1) parseClassSignature+ , do+ (super, (name, vars, fundeps)) <- tryPrefix parseClassSuper parseClassNameAndFundeps+ let hd = ClassHead $1 super name vars fundeps+ checkFundeps hd+ pure $ Right hd+ ]+ }++classSignature :: { Labeled (Name (N.ProperName 'N.TypeName)) (Type ()) }+ : properName '::' type {%^ revert $ checkNoWildcards $3 *> pure (Labeled (getProperName $1) $2 $3) }++classSuper :: { (OneOrDelimited (Constraint ()), SourceToken) }+ : constraints '<=' {%^ revert $ pure ($1, $2) }++classNameAndFundeps :: { (Name (N.ProperName 'N.ClassName), [TypeVarBinding ()], Maybe (SourceToken, Separated ClassFundep)) }+ : properName manyOrEmpty(typeVarBindingPlain) fundeps {%^ revert $ pure (getProperName $1, $2, $3) }++fundeps :: { Maybe (SourceToken, Separated ClassFundep) }+ : {- empty -} { Nothing }+ | '|' sep(fundep, ',') { Just ($1, $2) }++fundep :: { ClassFundep }+ : '->' many(ident) { FundepDetermined $1 $2 }+ | many(ident) '->' many(ident) { FundepDetermines $1 $2 $3 }++classMember :: { Labeled (Name Ident) (Type ()) }+ : ident '::' type {% checkNoWildcards $3 *> pure (Labeled $1 $2 $3) }++instHead :: { InstanceHead () }+ : 'instance' constraints '=>' qualProperName manyOrEmpty(typeAtom)+ { InstanceHead $1 Nothing (Just ($2, $3)) (getQualifiedProperName $4) $5 }+ | 'instance' qualProperName manyOrEmpty(typeAtom)+ { InstanceHead $1 Nothing Nothing (getQualifiedProperName $2) $3 }+ | 'instance' ident '::' constraints '=>' qualProperName manyOrEmpty(typeAtom)+ { InstanceHead $1 (Just ($2, $3)) (Just ($4, $5)) (getQualifiedProperName $6) $7 }+ | 'instance' ident '::' qualProperName manyOrEmpty(typeAtom)+ { InstanceHead $1 (Just ($2, $3)) Nothing (getQualifiedProperName $4) $5 }++constraints :: { OneOrDelimited (Constraint ()) }+ : constraint { One $1 }+ | '(' sep(constraint, ',') ')' { Many (Wrapped $1 $2 $3) }++constraint :: { Constraint () }+ : qualProperName manyOrEmpty(typeAtom) {% for_ $2 checkNoWildcards *> for_ $2 checkNoForalls *> pure (Constraint () (getQualifiedProperName $1) $2) }+ | '(' constraint ')' { ConstraintParens () (Wrapped $1 $2 $3) }++instBinding :: { InstanceBinding () }+ : ident '::' type { InstanceBindingSignature () (Labeled $1 $2 $3) }+ | ident manyOrEmpty(binderAtom) guardedDecl { InstanceBindingName () (ValueBindingFields $1 $2 $3) }++fixity :: { FixityFields }+ : infix int qualIdent 'as' op { FixityFields $1 $2 (FixityValue (fmap Left $3) $4 (getOpName $5)) }+ | infix int qualProperName 'as' op { FixityFields $1 $2 (FixityValue (fmap Right (getQualifiedProperName $3)) $4 (getOpName $5)) }+ | infix int 'type' qualProperName 'as' op { FixityFields $1 $2 (FixityType $3 (getQualifiedProperName $4) $5 (getOpName $6)) }++infix :: { (SourceToken, Fixity) }+ : 'infix' { ($1, Infix) }+ | 'infixl' { ($1, Infixl) }+ | 'infixr' { ($1, Infixr) }++role :: { Role }+ : 'nominal' { Role $1 R.Nominal }+ | 'representational' { Role $1 R.Representational }+ | 'phantom' { Role $1 R.Phantom }++-- Partial parsers which can be combined with combinators for adhoc use. We need+-- to revert the lookahead token so that it doesn't consume an extra token+-- before succeeding.++importDeclP :: { ImportDecl () }+ : importDecl {%^ revert $ pure $1 }++declP :: { Declaration () }+ : decl {%^ revert $ pure $1 }++exprP :: { Expr () }+ : expr {%^ revert $ pure $1 }++typeP :: { Type () }+ : type {%^ revert $ pure $1 }++moduleNameP :: { Name N.ModuleName }+ : moduleName {%^ revert $ pure $1 }++qualIdentP :: { QualifiedName Ident }+ : qualIdent {%^ revert $ pure $1 }++{+lexer :: (SourceToken -> Parser a) -> Parser a+lexer k = munch >>= k++parse :: Text -> ([ParserWarning], Either (NE.NonEmpty ParserError) (Module ()))+parse = either (([],) . Left) resFull . parseModule . lexModule++data PartialResult a = PartialResult+ { resPartial :: a+ , resFull :: ([ParserWarning], Either (NE.NonEmpty ParserError) a)+ } deriving (Functor)++parseModule :: [LexResult] -> Either (NE.NonEmpty ParserError) (PartialResult (Module ()))+parseModule toks = fmap (\header -> PartialResult header (parseFull header)) headerRes+ where+ (st, headerRes) =+ runParser (ParserState toks [] []) parseModuleHeader++ parseFull header = do+ let (ParserState _ _ warnings, res) = runParser st parseModuleBody+ (warnings, (\(decls, trailing) -> header { modDecls = decls, modTrailingComments = trailing }) <$> res)+}
+ src/Language/PureScript/CST/Positions.hs view
@@ -0,0 +1,338 @@+-- | This module contains utilities for calculating positions and offsets. While+-- tokens are annotated with ranges, CST nodes are not, but they can be+-- dynamically derived with the functions in this module, which will return the+-- first and last tokens for a given node.++module Language.PureScript.CST.Positions where++import Prelude++import Data.Foldable (foldl')+import Data.List.NonEmpty qualified as NE+import Data.Maybe (fromMaybe)+import Data.Text (Text)+import Data.Void (Void)+import Data.Text qualified as Text+import Language.PureScript.CST.Types++advanceToken :: SourcePos -> Token -> SourcePos+advanceToken pos = applyDelta pos . tokenDelta++advanceLeading :: SourcePos -> [Comment LineFeed] -> SourcePos+advanceLeading = foldl' $ \a -> applyDelta a . commentDelta lineDelta++advanceTrailing :: SourcePos -> [Comment Void] -> SourcePos+advanceTrailing = foldl' $ \a -> applyDelta a . commentDelta (const (0, 0))++tokenDelta :: Token -> (Int, Int)+tokenDelta = \case+ TokLeftParen -> (0, 1)+ TokRightParen -> (0, 1)+ TokLeftBrace -> (0, 1)+ TokRightBrace -> (0, 1)+ TokLeftSquare -> (0, 1)+ TokRightSquare -> (0, 1)+ TokLeftArrow ASCII -> (0, 2)+ TokLeftArrow Unicode -> (0, 1)+ TokRightArrow ASCII -> (0, 2)+ TokRightArrow Unicode -> (0, 1)+ TokRightFatArrow ASCII -> (0, 2)+ TokRightFatArrow Unicode -> (0, 1)+ TokDoubleColon ASCII -> (0, 2)+ TokDoubleColon Unicode -> (0, 1)+ TokForall ASCII -> (0, 6)+ TokForall Unicode -> (0, 1)+ TokEquals -> (0, 1)+ TokPipe -> (0, 1)+ TokTick -> (0, 1)+ TokDot -> (0, 1)+ TokComma -> (0, 1)+ TokUnderscore -> (0, 1)+ TokBackslash -> (0, 1)+ TokLowerName qual name -> (0, qualDelta qual + Text.length name)+ TokUpperName qual name -> (0, qualDelta qual + Text.length name)+ TokOperator qual sym -> (0, qualDelta qual + Text.length sym)+ TokSymbolName qual sym -> (0, qualDelta qual + Text.length sym + 2)+ TokSymbolArr Unicode -> (0, 3)+ TokSymbolArr ASCII -> (0, 4)+ TokHole hole -> (0, Text.length hole + 1)+ TokChar raw _ -> (0, Text.length raw + 2)+ TokInt raw _ -> (0, Text.length raw)+ TokNumber raw _ -> (0, Text.length raw)+ TokString raw _ -> multiLine 1 $ textDelta raw+ TokRawString raw -> multiLine 3 $ textDelta raw+ TokLayoutStart -> (0, 0)+ TokLayoutSep -> (0, 0)+ TokLayoutEnd -> (0, 0)+ TokEof -> (0, 0)++qualDelta :: [Text] -> Int+qualDelta = foldr ((+) . (+ 1) . Text.length) 0++multiLine :: Int -> (Int, Int) -> (Int, Int)+multiLine n (0, c) = (0, c + n + n)+multiLine n (l, c) = (l, c + n)++commentDelta :: (a -> (Int, Int)) -> Comment a -> (Int, Int)+commentDelta k = \case+ Comment raw -> textDelta raw+ Space n -> (0, n)+ Line a -> k a++lineDelta :: LineFeed -> (Int, Int)+lineDelta _ = (1, 1)++textDelta :: Text -> (Int, Int)+textDelta = Text.foldl' go (0, 0)+ where+ go (!l, !c) = \case+ '\n' -> (l + 1, 1)+ _ -> (l, c + 1)++applyDelta :: SourcePos -> (Int, Int) -> SourcePos+applyDelta (SourcePos l c) = \case+ (0, n) -> SourcePos l (c + n)+ (k, d) -> SourcePos (l + k) d++sepLast :: Separated a -> a+sepLast (Separated hd []) = hd+sepLast (Separated _ tl) = snd $ last tl++type TokenRange = (SourceToken, SourceToken)++toSourceRange :: TokenRange -> SourceRange+toSourceRange (a, b) = widen (srcRange a) (srcRange b)++widen :: SourceRange -> SourceRange -> SourceRange+widen (SourceRange s1 _) (SourceRange _ e2) = SourceRange s1 e2++srcRange :: SourceToken -> SourceRange+srcRange = tokRange . tokAnn++nameRange :: Name a -> TokenRange+nameRange a = (nameTok a, nameTok a)++qualRange :: QualifiedName a -> TokenRange+qualRange a = (qualTok a, qualTok a)++wrappedRange :: Wrapped a -> TokenRange+wrappedRange Wrapped { wrpOpen, wrpClose } = (wrpOpen, wrpClose)++moduleRange :: Module a -> TokenRange+moduleRange Module { modKeyword, modWhere, modImports, modDecls } =+ case (modImports, modDecls) of+ ([], []) -> (modKeyword, modWhere)+ (is, []) -> (modKeyword, snd . importDeclRange $ last is)+ (_, ds) -> (modKeyword, snd . declRange $ last ds)++exportRange :: Export a -> TokenRange+exportRange = \case+ ExportValue _ a -> nameRange a+ ExportOp _ a -> nameRange a+ ExportType _ a b+ | Just b' <- b -> (nameTok a, snd $ dataMembersRange b')+ | otherwise -> nameRange a+ ExportTypeOp _ a b -> (a, nameTok b)+ ExportClass _ a b -> (a, nameTok b)+ ExportModule _ a b -> (a, nameTok b)++importDeclRange :: ImportDecl a -> TokenRange+importDeclRange ImportDecl { impKeyword, impModule, impNames, impQual }+ | Just (_, modName) <- impQual = (impKeyword, nameTok modName)+ | Just (_, imports) <- impNames = (impKeyword, wrpClose imports)+ | otherwise = (impKeyword, nameTok impModule)++importRange :: Import a -> TokenRange+importRange = \case+ ImportValue _ a -> nameRange a+ ImportOp _ a -> nameRange a+ ImportType _ a b+ | Just b' <- b -> (nameTok a, snd $ dataMembersRange b')+ | otherwise -> nameRange a+ ImportTypeOp _ a b -> (a, nameTok b)+ ImportClass _ a b -> (a, nameTok b)++dataMembersRange :: DataMembers a -> TokenRange+dataMembersRange = \case+ DataAll _ a -> (a, a)+ DataEnumerated _ (Wrapped a _ b) -> (a, b)++declRange :: Declaration a -> TokenRange+declRange = \case+ DeclData _ hd ctors+ | Just (_, cs) <- ctors -> (fst start, snd . dataCtorRange $ sepLast cs)+ | otherwise -> start+ where start = dataHeadRange hd+ DeclType _ a _ b -> (fst $ dataHeadRange a, snd $ typeRange b)+ DeclNewtype _ a _ _ b -> (fst $ dataHeadRange a, snd $ typeRange b)+ DeclClass _ hd body+ | Just (_, ts) <- body -> (fst start, snd . typeRange . lblValue $ NE.last ts)+ | otherwise -> start+ where start = classHeadRange hd+ DeclInstanceChain _ a -> (fst . instanceRange $ sepHead a, snd . instanceRange $ sepLast a)+ DeclDerive _ a _ b -> (a, snd $ instanceHeadRange b)+ DeclKindSignature _ a (Labeled _ _ b) -> (a, snd $ typeRange b)+ DeclSignature _ (Labeled a _ b) -> (nameTok a, snd $ typeRange b)+ DeclValue _ a -> valueBindingFieldsRange a+ DeclFixity _ (FixityFields a _ (FixityValue _ _ b)) -> (fst a, nameTok b)+ DeclFixity _ (FixityFields a _ (FixityType _ _ _ b)) -> (fst a, nameTok b)+ DeclForeign _ a _ b -> (a, snd $ foreignRange b)+ DeclRole _ a _ _ b -> (a, roleTok $ NE.last b)++dataHeadRange :: DataHead a -> TokenRange+dataHeadRange (DataHead kw name vars)+ | [] <- vars = (kw, nameTok name)+ | otherwise = (kw, snd . typeVarBindingRange $ last vars)++dataCtorRange :: DataCtor a -> TokenRange+dataCtorRange (DataCtor _ name fields)+ | [] <- fields = nameRange name+ | otherwise = (nameTok name, snd . typeRange $ last fields)++classHeadRange :: ClassHead a -> TokenRange+classHeadRange (ClassHead kw _ name vars fdeps)+ | Just (_, fs) <- fdeps = (kw, snd . classFundepRange $ sepLast fs)+ | [] <- vars = (kw, snd $ nameRange name)+ | otherwise = (kw, snd . typeVarBindingRange $ last vars)++classFundepRange :: ClassFundep -> TokenRange+classFundepRange = \case+ FundepDetermined arr bs -> (arr, nameTok $ NE.last bs)+ FundepDetermines as _ bs -> (nameTok $ NE.head as, nameTok $ NE.last bs)++instanceRange :: Instance a -> TokenRange+instanceRange (Instance hd bd)+ | Just (_, ts) <- bd = (fst start, snd . instanceBindingRange $ NE.last ts)+ | otherwise = start+ where start = instanceHeadRange hd++instanceHeadRange :: InstanceHead a -> TokenRange+instanceHeadRange (InstanceHead kw _ _ cls types)+ | [] <- types = (kw, qualTok cls)+ | otherwise = (kw, snd . typeRange $ last types)++instanceBindingRange :: InstanceBinding a -> TokenRange+instanceBindingRange = \case+ InstanceBindingSignature _ (Labeled a _ b) -> (nameTok a, snd $ typeRange b)+ InstanceBindingName _ a -> valueBindingFieldsRange a++foreignRange :: Foreign a -> TokenRange+foreignRange = \case+ ForeignValue (Labeled a _ b) -> (nameTok a, snd $ typeRange b)+ ForeignData a (Labeled _ _ b) -> (a, snd $ typeRange b)+ ForeignKind a b -> (a, nameTok b)++valueBindingFieldsRange :: ValueBindingFields a -> TokenRange+valueBindingFieldsRange (ValueBindingFields a _ b) = (nameTok a, snd $ guardedRange b)++guardedRange :: Guarded a -> TokenRange+guardedRange = \case+ Unconditional a b -> (a, snd $ whereRange b)+ Guarded as -> (fst . guardedExprRange $ NE.head as, snd . guardedExprRange $ NE.last as)++guardedExprRange :: GuardedExpr a -> TokenRange+guardedExprRange (GuardedExpr a _ _ b) = (a, snd $ whereRange b)++whereRange :: Where a -> TokenRange+whereRange (Where a bs)+ | Just (_, ls) <- bs = (fst $ exprRange a, snd . letBindingRange $ NE.last ls)+ | otherwise = exprRange a++typeRange :: Type a -> TokenRange+typeRange = \case+ TypeVar _ a -> nameRange a+ TypeConstructor _ a -> qualRange a+ TypeWildcard _ a -> (a, a)+ TypeHole _ a -> nameRange a+ TypeString _ a _ -> (a, a)+ TypeInt _ a b _ -> (fromMaybe b a, b)+ TypeRow _ a -> wrappedRange a+ TypeRecord _ a -> wrappedRange a+ TypeForall _ a _ _ b -> (a, snd $ typeRange b)+ TypeKinded _ a _ b -> (fst $ typeRange a, snd $ typeRange b)+ TypeApp _ a b -> (fst $ typeRange a, snd $ typeRange b)+ TypeOp _ a _ b -> (fst $ typeRange a, snd $ typeRange b)+ TypeOpName _ a -> qualRange a+ TypeArr _ a _ b -> (fst $ typeRange a, snd $ typeRange b)+ TypeArrName _ a -> (a, a)+ TypeConstrained _ a _ b -> (fst $ constraintRange a, snd $ typeRange b)+ TypeParens _ a -> wrappedRange a+ TypeUnaryRow _ a b -> (a, snd $ typeRange b)++constraintRange :: Constraint a -> TokenRange+constraintRange = \case+ Constraint _ name args+ | [] <- args -> qualRange name+ | otherwise -> (qualTok name, snd . typeRange $ last args)+ ConstraintParens _ wrp -> wrappedRange wrp++typeVarBindingRange :: TypeVarBinding a -> TokenRange+typeVarBindingRange = \case+ TypeVarKinded a -> wrappedRange a+ TypeVarName (atSign, a) -> (fromMaybe (nameTok a) atSign, nameTok a)++exprRange :: Expr a -> TokenRange+exprRange = \case+ ExprHole _ a -> nameRange a+ ExprSection _ a -> (a, a)+ ExprIdent _ a -> qualRange a+ ExprConstructor _ a -> qualRange a+ ExprBoolean _ a _ -> (a, a)+ ExprChar _ a _ -> (a, a)+ ExprString _ a _ -> (a, a)+ ExprNumber _ a _ -> (a, a)+ ExprArray _ a -> wrappedRange a+ ExprRecord _ a -> wrappedRange a+ ExprParens _ a -> wrappedRange a+ ExprTyped _ a _ b -> (fst $ exprRange a, snd $ typeRange b)+ ExprInfix _ a _ b -> (fst $ exprRange a, snd $ exprRange b)+ ExprOp _ a _ b -> (fst $ exprRange a, snd $ exprRange b)+ ExprOpName _ a -> qualRange a+ ExprNegate _ a b -> (a, snd $ exprRange b)+ ExprRecordAccessor _ (RecordAccessor a _ b) -> (fst $ exprRange a, lblTok $ sepLast b)+ ExprRecordUpdate _ a b -> (fst $ exprRange a, snd $ wrappedRange b)+ ExprApp _ a b -> (fst $ exprRange a, snd $ exprRange b)+ ExprVisibleTypeApp _ a _ b -> (fst $ exprRange a, snd $ typeRange b)+ ExprLambda _ (Lambda a _ _ b) -> (a, snd $ exprRange b)+ ExprIf _ (IfThenElse a _ _ _ _ b) -> (a, snd $ exprRange b)+ ExprCase _ (CaseOf a _ _ c) -> (a, snd . guardedRange . snd $ NE.last c)+ ExprLet _ (LetIn a _ _ b) -> (a, snd $ exprRange b)+ ExprDo _ (DoBlock a b) -> (a, snd . doStatementRange $ NE.last b)+ ExprAdo _ (AdoBlock a _ _ b) -> (a, snd $ exprRange b)++letBindingRange :: LetBinding a -> TokenRange+letBindingRange = \case+ LetBindingSignature _ (Labeled a _ b) -> (nameTok a, snd $ typeRange b)+ LetBindingName _ a -> valueBindingFieldsRange a+ LetBindingPattern _ a _ b -> (fst $ binderRange a, snd $ whereRange b)++doStatementRange :: DoStatement a -> TokenRange+doStatementRange = \case+ DoLet a bs -> (a, snd . letBindingRange $ NE.last bs)+ DoDiscard a -> exprRange a+ DoBind a _ b -> (fst $ binderRange a, snd $ exprRange b)++binderRange :: Binder a -> TokenRange+binderRange = \case+ BinderWildcard _ a -> (a, a)+ BinderVar _ a -> nameRange a+ BinderNamed _ a _ b -> (nameTok a, snd $ binderRange b)+ BinderConstructor _ a bs+ | [] <- bs -> qualRange a+ | otherwise -> (qualTok a, snd . binderRange $ last bs)+ BinderBoolean _ a _ -> (a, a)+ BinderChar _ a _ -> (a, a)+ BinderString _ a _ -> (a, a)+ BinderNumber _ a b _+ | Just a' <- a -> (a', b)+ | otherwise -> (b, b)+ BinderArray _ a -> wrappedRange a+ BinderRecord _ a -> wrappedRange a+ BinderParens _ a -> wrappedRange a+ BinderTyped _ a _ b -> (fst $ binderRange a, snd $ typeRange b)+ BinderOp _ a _ b -> (fst $ binderRange a, snd $ binderRange b)++recordUpdateRange :: RecordUpdate a -> TokenRange+recordUpdateRange = \case+ RecordUpdateLeaf a _ b -> (lblTok a, snd $ exprRange b)+ RecordUpdateBranch a (Wrapped _ _ b) -> (lblTok a, b)
+ src/Language/PureScript/CST/Print.hs view
@@ -0,0 +1,96 @@+-- | This is just a simple token printer. It's not a full fledged formatter, but+-- it is used by the layout golden tests. Printing each token in the tree with+-- this printer will result in the exact input that was given to the lexer.++module Language.PureScript.CST.Print+ ( printToken+ , printTokens+ , printModule+ , printLeadingComment+ , printTrailingComment+ ) where++import Prelude++import Data.DList qualified as DList+import Data.Text (Text)+import Data.Text qualified as Text+import Language.PureScript.CST.Types (Comment(..), LineFeed(..), Module, SourceStyle(..), SourceToken(..), Token(..), TokenAnn(..))+import Language.PureScript.CST.Flatten (flattenModule)++printToken :: Token -> Text+printToken = printToken' True++-- | Prints a given Token. The bool controls whether or not layout+-- tokens should be printed.+printToken' :: Bool -> Token -> Text+printToken' showLayout = \case+ TokLeftParen -> "("+ TokRightParen -> ")"+ TokLeftBrace -> "{"+ TokRightBrace -> "}"+ TokLeftSquare -> "["+ TokRightSquare -> "]"+ TokLeftArrow ASCII -> "<-"+ TokLeftArrow Unicode -> "←"+ TokRightArrow ASCII -> "->"+ TokRightArrow Unicode -> "→"+ TokRightFatArrow ASCII -> "=>"+ TokRightFatArrow Unicode -> "⇒"+ TokDoubleColon ASCII -> "::"+ TokDoubleColon Unicode -> "∷"+ TokForall ASCII -> "forall"+ TokForall Unicode -> "∀"+ TokEquals -> "="+ TokPipe -> "|"+ TokTick -> "`"+ TokDot -> "."+ TokComma -> ","+ TokUnderscore -> "_"+ TokBackslash -> "\\"+ TokLowerName qual name -> printQual qual <> name+ TokUpperName qual name -> printQual qual <> name+ TokOperator qual sym -> printQual qual <> sym+ TokSymbolName qual sym -> printQual qual <> "(" <> sym <> ")"+ TokSymbolArr Unicode -> "(→)"+ TokSymbolArr ASCII -> "(->)"+ TokHole hole -> "?" <> hole+ TokChar raw _ -> "'" <> raw <> "'"+ TokString raw _ -> "\"" <> raw <> "\""+ TokRawString raw -> "\"\"\"" <> raw <> "\"\"\""+ TokInt raw _ -> raw+ TokNumber raw _ -> raw+ TokLayoutStart -> if showLayout then "{" else ""+ TokLayoutSep -> if showLayout then ";" else ""+ TokLayoutEnd -> if showLayout then "}" else ""+ TokEof -> if showLayout then "<eof>" else ""++printQual :: [Text] -> Text+printQual = Text.concat . map (<> ".")++printTokens :: [SourceToken] -> Text+printTokens = printTokens' True++printTokens' :: Bool -> [SourceToken] -> Text+printTokens' showLayout toks = Text.concat (map pp toks)+ where+ pp (SourceToken (TokenAnn _ leading trailing) tok) =+ Text.concat (map printLeadingComment leading)+ <> printToken' showLayout tok+ <> Text.concat (map printTrailingComment trailing)++printModule :: Module a -> Text+printModule = printTokens' False . DList.toList . flattenModule++printLeadingComment :: Comment LineFeed -> Text+printLeadingComment = \case+ Comment raw -> raw+ Space n -> Text.replicate n " "+ Line LF -> "\n"+ Line CRLF -> "\r\n"++printTrailingComment :: Comment void -> Text+printTrailingComment = \case+ Comment raw -> raw+ Space n -> Text.replicate n " "+ Line _ -> ""
+ src/Language/PureScript/CST/Traversals.hs view
@@ -0,0 +1,11 @@+module Language.PureScript.CST.Traversals where++import Prelude++import Language.PureScript.CST.Types (Separated(..))++everythingOnSeparated :: (r -> r -> r) -> (a -> r) -> Separated a -> r+everythingOnSeparated op k (Separated hd tl) = go hd tl+ where+ go a [] = k a+ go a (b : bs) = k a `op` go (snd b) bs
+ src/Language/PureScript/CST/Traversals/Type.hs view
@@ -0,0 +1,41 @@+module Language.PureScript.CST.Traversals.Type where++import Prelude++import Language.PureScript.CST.Types (Constraint(..), Labeled(..), Row(..), Type(..), Wrapped(..))+import Language.PureScript.CST.Traversals (everythingOnSeparated)++everythingOnTypes :: (r -> r -> r) -> (Type a -> r) -> Type a -> r+everythingOnTypes op k = goTy+ where+ goTy ty = case ty of+ TypeVar _ _ -> k ty+ TypeConstructor _ _ -> k ty+ TypeWildcard _ _ -> k ty+ TypeHole _ _ -> k ty+ TypeString _ _ _ -> k ty+ TypeInt _ _ _ _ -> k ty+ TypeRow _ (Wrapped _ row _) -> goRow ty row+ TypeRecord _ (Wrapped _ row _) -> goRow ty row+ TypeForall _ _ _ _ ty2 -> k ty `op` goTy ty2+ TypeKinded _ ty2 _ ty3 -> k ty `op` (goTy ty2 `op` goTy ty3)+ TypeApp _ ty2 ty3 -> k ty `op` (goTy ty2 `op` goTy ty3)+ TypeOp _ ty2 _ ty3 -> k ty `op` (goTy ty2 `op` goTy ty3)+ TypeOpName _ _ -> k ty+ TypeArr _ ty2 _ ty3 -> k ty `op` (goTy ty2 `op` goTy ty3)+ TypeArrName _ _ -> k ty+ TypeConstrained _ (constraintTys -> ty2) _ ty3+ | null ty2 -> k ty `op` goTy ty3+ | otherwise -> k ty `op` (foldr1 op (k <$> ty2) `op` goTy ty3)+ TypeParens _ (Wrapped _ ty2 _) -> k ty `op` goTy ty2+ TypeUnaryRow _ _ ty2 -> k ty `op` goTy ty2++ goRow ty = \case+ Row Nothing Nothing -> k ty+ Row Nothing (Just (_, ty2)) -> k ty `op` goTy ty2+ Row (Just lbls) Nothing -> k ty `op` everythingOnSeparated op (goTy . lblValue) lbls+ Row (Just lbls) (Just (_, ty2)) -> k ty `op` (everythingOnSeparated op (goTy . lblValue) lbls `op` goTy ty2)++ constraintTys = \case+ Constraint _ _ tys -> tys+ ConstraintParens _ (Wrapped _ c _) -> constraintTys c
+ src/Language/PureScript/CST/Types.hs view
@@ -0,0 +1,440 @@+{-# LANGUAGE DeriveAnyClass #-}+-- | This module contains data types for the entire PureScript surface language. Every+-- token is represented in the tree, and every token is annotated with+-- whitespace and comments (both leading and trailing). This means one can write+-- an exact printer so that `print . parse = id`. Every constructor is laid out+-- with tokens in left-to-right order. The core productions are given a slot for+-- arbitrary annotations, however this is not used by the parser.++module Language.PureScript.CST.Types where++import Prelude++import Control.DeepSeq (NFData)+import Data.List.NonEmpty (NonEmpty)+import Data.Text (Text)+import Data.Void (Void)+import GHC.Generics (Generic)+import Language.PureScript.Names qualified as N+import Language.PureScript.Roles qualified as R+import Language.PureScript.PSString (PSString)++data SourcePos = SourcePos+ { srcLine :: {-# UNPACK #-} !Int+ , srcColumn :: {-# UNPACK #-} !Int+ } deriving (Show, Eq, Ord, Generic, NFData)++data SourceRange = SourceRange+ { srcStart :: !SourcePos+ , srcEnd :: !SourcePos+ } deriving (Show, Eq, Ord, Generic, NFData)++data Comment l+ = Comment !Text+ | Space {-# UNPACK #-} !Int+ | Line !l+ deriving (Show, Eq, Ord, Generic, Functor, NFData)++data LineFeed = LF | CRLF+ deriving (Show, Eq, Ord, Generic, NFData)++data TokenAnn = TokenAnn+ { tokRange :: !SourceRange+ , tokLeadingComments :: ![Comment LineFeed]+ , tokTrailingComments :: ![Comment Void]+ } deriving (Show, Eq, Ord, Generic, NFData)++data SourceStyle = ASCII | Unicode+ deriving (Show, Eq, Ord, Generic, NFData)++data Token+ = TokLeftParen+ | TokRightParen+ | TokLeftBrace+ | TokRightBrace+ | TokLeftSquare+ | TokRightSquare+ | TokLeftArrow !SourceStyle+ | TokRightArrow !SourceStyle+ | TokRightFatArrow !SourceStyle+ | TokDoubleColon !SourceStyle+ | TokForall !SourceStyle+ | TokEquals+ | TokPipe+ | TokTick+ | TokDot+ | TokComma+ | TokUnderscore+ | TokBackslash+ | TokLowerName ![Text] !Text+ | TokUpperName ![Text] !Text+ | TokOperator ![Text] !Text+ | TokSymbolName ![Text] !Text+ | TokSymbolArr !SourceStyle+ | TokHole !Text+ | TokChar !Text !Char+ | TokString !Text !PSString+ | TokRawString !Text+ | TokInt !Text !Integer+ | TokNumber !Text !Double+ | TokLayoutStart+ | TokLayoutSep+ | TokLayoutEnd+ | TokEof+ deriving (Show, Eq, Ord, Generic, NFData)++data SourceToken = SourceToken+ { tokAnn :: !TokenAnn+ , tokValue :: !Token+ } deriving (Show, Eq, Ord, Generic, NFData)++data Ident = Ident+ { getIdent :: Text+ } deriving (Show, Eq, Ord, Generic)++data Name a = Name+ { nameTok :: SourceToken+ , nameValue :: a+ } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic)++data QualifiedName a = QualifiedName+ { qualTok :: SourceToken+ , qualModule :: Maybe N.ModuleName+ , qualName :: a+ } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic)++data Label = Label+ { lblTok :: SourceToken+ , lblName :: PSString+ } deriving (Show, Eq, Ord, Generic)++data Wrapped a = Wrapped+ { wrpOpen :: SourceToken+ , wrpValue :: a+ , wrpClose :: SourceToken+ } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic)++data Separated a = Separated+ { sepHead :: a+ , sepTail :: [(SourceToken, a)]+ } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic)++data Labeled a b = Labeled+ { lblLabel :: a+ , lblSep :: SourceToken+ , lblValue :: b+ } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic)++type Delimited a = Wrapped (Maybe (Separated a))+type DelimitedNonEmpty a = Wrapped (Separated a)++data OneOrDelimited a+ = One a+ | Many (DelimitedNonEmpty a)+ deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic)++data Type a+ = TypeVar a (Name Ident)+ | TypeConstructor a (QualifiedName (N.ProperName 'N.TypeName))+ | TypeWildcard a SourceToken+ | TypeHole a (Name Ident)+ | TypeString a SourceToken PSString+ | TypeInt a (Maybe SourceToken) SourceToken Integer+ | TypeRow a (Wrapped (Row a))+ | TypeRecord a (Wrapped (Row a))+ | TypeForall a SourceToken (NonEmpty (TypeVarBinding a)) SourceToken (Type a)+ | TypeKinded a (Type a) SourceToken (Type a)+ | TypeApp a (Type a) (Type a)+ | TypeOp a (Type a) (QualifiedName (N.OpName 'N.TypeOpName)) (Type a)+ | TypeOpName a (QualifiedName (N.OpName 'N.TypeOpName))+ | TypeArr a (Type a) SourceToken (Type a)+ | TypeArrName a SourceToken+ | TypeConstrained a (Constraint a) SourceToken (Type a)+ | TypeParens a (Wrapped (Type a))+ | TypeUnaryRow a SourceToken (Type a)+ deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic)++data TypeVarBinding a+ = TypeVarKinded (Wrapped (Labeled (Maybe SourceToken, Name Ident) (Type a)))+ | TypeVarName (Maybe SourceToken, Name Ident)+ deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic)++data Constraint a+ = Constraint a (QualifiedName (N.ProperName 'N.ClassName)) [Type a]+ | ConstraintParens a (Wrapped (Constraint a))+ deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic)++data Row a = Row+ { rowLabels :: Maybe (Separated (Labeled Label (Type a)))+ , rowTail :: Maybe (SourceToken, Type a)+ } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic)++data Module a = Module+ { modAnn :: a+ , modKeyword :: SourceToken+ , modNamespace :: Name N.ModuleName+ , modExports :: Maybe (DelimitedNonEmpty (Export a))+ , modWhere :: SourceToken+ , modImports :: [ImportDecl a]+ , modDecls :: [Declaration a]+ , modTrailingComments :: [Comment LineFeed]+ } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic)++data Export a+ = ExportValue a (Name Ident)+ | ExportOp a (Name (N.OpName 'N.ValueOpName))+ | ExportType a (Name (N.ProperName 'N.TypeName)) (Maybe (DataMembers a))+ | ExportTypeOp a SourceToken (Name (N.OpName 'N.TypeOpName))+ | ExportClass a SourceToken (Name (N.ProperName 'N.ClassName))+ | ExportModule a SourceToken (Name N.ModuleName)+ deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic)++data DataMembers a+ = DataAll a SourceToken+ | DataEnumerated a (Delimited (Name (N.ProperName 'N.ConstructorName)))+ deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic)++data Declaration a+ = DeclData a (DataHead a) (Maybe (SourceToken, Separated (DataCtor a)))+ | DeclType a (DataHead a) SourceToken (Type a)+ | DeclNewtype a (DataHead a) SourceToken (Name (N.ProperName 'N.ConstructorName)) (Type a)+ | DeclClass a (ClassHead a) (Maybe (SourceToken, NonEmpty (Labeled (Name Ident) (Type a))))+ | DeclInstanceChain a (Separated (Instance a))+ | DeclDerive a SourceToken (Maybe SourceToken) (InstanceHead a)+ | DeclKindSignature a SourceToken (Labeled (Name (N.ProperName 'N.TypeName)) (Type a))+ | DeclSignature a (Labeled (Name Ident) (Type a))+ | DeclValue a (ValueBindingFields a)+ | DeclFixity a FixityFields+ | DeclForeign a SourceToken SourceToken (Foreign a)+ | DeclRole a SourceToken SourceToken (Name (N.ProperName 'N.TypeName)) (NonEmpty Role)+ deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic)++data Instance a = Instance+ { instHead :: InstanceHead a+ , instBody :: Maybe (SourceToken, NonEmpty (InstanceBinding a))+ } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic)++data InstanceBinding a+ = InstanceBindingSignature a (Labeled (Name Ident) (Type a))+ | InstanceBindingName a (ValueBindingFields a)+ deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic)++data ImportDecl a = ImportDecl+ { impAnn :: a+ , impKeyword :: SourceToken+ , impModule :: Name N.ModuleName+ , impNames :: Maybe (Maybe SourceToken, DelimitedNonEmpty (Import a))+ , impQual :: Maybe (SourceToken, Name N.ModuleName)+ } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic)++data Import a+ = ImportValue a (Name Ident)+ | ImportOp a (Name (N.OpName 'N.ValueOpName))+ | ImportType a (Name (N.ProperName 'N.TypeName)) (Maybe (DataMembers a))+ | ImportTypeOp a SourceToken (Name (N.OpName 'N.TypeOpName))+ | ImportClass a SourceToken (Name (N.ProperName 'N.ClassName))+ deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic)++data DataHead a = DataHead+ { dataHdKeyword :: SourceToken+ , dataHdName :: Name (N.ProperName 'N.TypeName)+ , dataHdVars :: [TypeVarBinding a]+ } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic)++data DataCtor a = DataCtor+ { dataCtorAnn :: a+ , dataCtorName :: Name (N.ProperName 'N.ConstructorName)+ , dataCtorFields :: [Type a]+ } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic)++data ClassHead a = ClassHead+ { clsKeyword :: SourceToken+ , clsSuper :: Maybe (OneOrDelimited (Constraint a), SourceToken)+ , clsName :: Name (N.ProperName 'N.ClassName)+ , clsVars :: [TypeVarBinding a]+ , clsFundeps :: Maybe (SourceToken, Separated ClassFundep)+ } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic)++data ClassFundep+ = FundepDetermined SourceToken (NonEmpty (Name Ident))+ | FundepDetermines (NonEmpty (Name Ident)) SourceToken (NonEmpty (Name Ident))+ deriving (Show, Eq, Ord, Generic)++data InstanceHead a = InstanceHead+ { instKeyword :: SourceToken+ , instNameSep :: Maybe (Name Ident, SourceToken)+ , instConstraints :: Maybe (OneOrDelimited (Constraint a), SourceToken)+ , instClass :: QualifiedName (N.ProperName 'N.ClassName)+ , instTypes :: [Type a]+ } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic)++data Fixity+ = Infix+ | Infixl+ | Infixr+ deriving (Show, Eq, Ord, Generic)++data FixityOp+ = FixityValue (QualifiedName (Either Ident (N.ProperName 'N.ConstructorName))) SourceToken (Name (N.OpName 'N.ValueOpName))+ | FixityType SourceToken (QualifiedName (N.ProperName 'N.TypeName)) SourceToken (Name (N.OpName 'N.TypeOpName))+ deriving (Show, Eq, Ord, Generic)++data FixityFields = FixityFields+ { fxtKeyword :: (SourceToken, Fixity)+ , fxtPrec :: (SourceToken, Integer)+ , fxtOp :: FixityOp+ } deriving (Show, Eq, Ord, Generic)++data ValueBindingFields a = ValueBindingFields+ { valName :: Name Ident+ , valBinders :: [Binder a]+ , valGuarded :: Guarded a+ } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic)++data Guarded a+ = Unconditional SourceToken (Where a)+ | Guarded (NonEmpty (GuardedExpr a))+ deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic)++data GuardedExpr a = GuardedExpr+ { grdBar :: SourceToken+ , grdPatterns :: Separated (PatternGuard a)+ , grdSep :: SourceToken+ , grdWhere :: Where a+ } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic)++data PatternGuard a = PatternGuard+ { patBinder :: Maybe (Binder a, SourceToken)+ , patExpr :: Expr a+ } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic)++data Foreign a+ = ForeignValue (Labeled (Name Ident) (Type a))+ | ForeignData SourceToken (Labeled (Name (N.ProperName 'N.TypeName)) (Type a))+ | ForeignKind SourceToken (Name (N.ProperName 'N.TypeName))+ deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic)++data Role = Role+ { roleTok :: SourceToken+ , roleValue :: R.Role+ } deriving (Show, Eq, Ord, Generic)++data Expr a+ = ExprHole a (Name Ident)+ | ExprSection a SourceToken+ | ExprIdent a (QualifiedName Ident)+ | ExprConstructor a (QualifiedName (N.ProperName 'N.ConstructorName))+ | ExprBoolean a SourceToken Bool+ | ExprChar a SourceToken Char+ | ExprString a SourceToken PSString+ | ExprNumber a SourceToken (Either Integer Double)+ | ExprArray a (Delimited (Expr a))+ | ExprRecord a (Delimited (RecordLabeled (Expr a)))+ | ExprParens a (Wrapped (Expr a))+ | ExprTyped a (Expr a) SourceToken (Type a)+ | ExprInfix a (Expr a) (Wrapped (Expr a)) (Expr a)+ | ExprOp a (Expr a) (QualifiedName (N.OpName 'N.ValueOpName)) (Expr a)+ | ExprOpName a (QualifiedName (N.OpName 'N.ValueOpName))+ | ExprNegate a SourceToken (Expr a)+ | ExprRecordAccessor a (RecordAccessor a)+ | ExprRecordUpdate a (Expr a) (DelimitedNonEmpty (RecordUpdate a))+ | ExprApp a (Expr a) (Expr a)+ | ExprVisibleTypeApp a (Expr a) SourceToken (Type a)+ | ExprLambda a (Lambda a)+ | ExprIf a (IfThenElse a)+ | ExprCase a (CaseOf a)+ | ExprLet a (LetIn a)+ | ExprDo a (DoBlock a)+ | ExprAdo a (AdoBlock a)+ deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic)++data RecordLabeled a+ = RecordPun (Name Ident)+ | RecordField Label SourceToken a+ deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic)++data RecordUpdate a+ = RecordUpdateLeaf Label SourceToken (Expr a)+ | RecordUpdateBranch Label (DelimitedNonEmpty (RecordUpdate a))+ deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic)++data RecordAccessor a = RecordAccessor+ { recExpr :: Expr a+ , recDot :: SourceToken+ , recPath :: Separated Label+ } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic)++data Lambda a = Lambda+ { lmbSymbol :: SourceToken+ , lmbBinders :: NonEmpty (Binder a)+ , lmbArr :: SourceToken+ , lmbBody :: Expr a+ } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic)++data IfThenElse a = IfThenElse+ { iteIf :: SourceToken+ , iteCond :: Expr a+ , iteThen :: SourceToken+ , iteTrue :: Expr a+ , iteElse :: SourceToken+ , iteFalse :: Expr a+ } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic)++data CaseOf a = CaseOf+ { caseKeyword :: SourceToken+ , caseHead :: Separated (Expr a)+ , caseOf :: SourceToken+ , caseBranches :: NonEmpty (Separated (Binder a), Guarded a)+ } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic)++data LetIn a = LetIn+ { letKeyword :: SourceToken+ , letBindings :: NonEmpty (LetBinding a)+ , letIn :: SourceToken+ , letBody :: Expr a+ } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic)++data Where a = Where+ { whereExpr :: Expr a+ , whereBindings :: Maybe (SourceToken, NonEmpty (LetBinding a))+ } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic)++data LetBinding a+ = LetBindingSignature a (Labeled (Name Ident) (Type a))+ | LetBindingName a (ValueBindingFields a)+ | LetBindingPattern a (Binder a) SourceToken (Where a)+ deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic)++data DoBlock a = DoBlock+ { doKeyword :: SourceToken+ , doStatements :: NonEmpty (DoStatement a)+ } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic)++data DoStatement a+ = DoLet SourceToken (NonEmpty (LetBinding a))+ | DoDiscard (Expr a)+ | DoBind (Binder a) SourceToken (Expr a)+ deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic)++data AdoBlock a = AdoBlock+ { adoKeyword :: SourceToken+ , adoStatements :: [DoStatement a]+ , adoIn :: SourceToken+ , adoResult :: Expr a+ } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic)++data Binder a+ = BinderWildcard a SourceToken+ | BinderVar a (Name Ident)+ | BinderNamed a (Name Ident) SourceToken (Binder a)+ | BinderConstructor a (QualifiedName (N.ProperName 'N.ConstructorName)) [Binder a]+ | BinderBoolean a SourceToken Bool+ | BinderChar a SourceToken Char+ | BinderString a SourceToken PSString+ | BinderNumber a (Maybe SourceToken) SourceToken (Either Integer Double)+ | BinderArray a (Delimited (Binder a))+ | BinderRecord a (Delimited (RecordLabeled (Binder a)))+ | BinderParens a (Wrapped (Binder a))+ | BinderTyped a (Binder a) SourceToken (Type a)+ | BinderOp a (Binder a) (QualifiedName (N.OpName 'N.ValueOpName)) (Binder a)+ deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic)
+ src/Language/PureScript/CST/Utils.hs view
@@ -0,0 +1,355 @@+module Language.PureScript.CST.Utils where++import Prelude++import Control.Monad (unless)+import Data.Coerce (coerce)+import Data.Foldable (for_)+import Data.Functor (($>))+import Data.List.NonEmpty qualified as NE+import Data.Set (Set)+import Data.Set qualified as Set+import Data.Text (Text)+import Data.Text qualified as Text+import Language.PureScript.CST.Errors (ParserErrorType(..))+import Language.PureScript.CST.Monad (Parser, addFailure, parseFail, pushBack)+import Language.PureScript.CST.Positions (TokenRange, binderRange, importDeclRange, recordUpdateRange, typeRange)+import Language.PureScript.CST.Traversals.Type (everythingOnTypes)+import Language.PureScript.CST.Types+import Language.PureScript.Names qualified as N+import Language.PureScript.PSString (PSString, mkString)++-- |+-- A newtype for a qualified proper name whose ProperNameType has not yet been determined.+-- This is a workaround for Happy's limited support for polymorphism; it is used+-- inside the parser to allow us to write just one parser for qualified proper names+-- which can be used for all of the different ProperNameTypes+-- (via a call to getQualifiedProperName).+newtype QualifiedProperName =+ QualifiedProperName { getQualifiedProperName :: forall a. QualifiedName (N.ProperName a) }++qualifiedProperName :: QualifiedName (N.ProperName a) -> QualifiedProperName+qualifiedProperName n = QualifiedProperName (N.coerceProperName <$> n)++-- |+-- A newtype for a proper name whose ProperNameType has not yet been determined.+-- This is a workaround for Happy's limited support for polymorphism; it is used+-- inside the parser to allow us to write just one parser for proper names+-- which can be used for all of the different ProperNameTypes+-- (via a call to getProperName).+newtype ProperName =+ ProperName { _getProperName :: forall a. Name (N.ProperName a) }++properName :: Name (N.ProperName a) -> ProperName+properName n = ProperName (N.coerceProperName <$> n)++getProperName :: forall a. ProperName -> Name (N.ProperName a)+getProperName pn = _getProperName pn -- eta expansion needed here due to simplified subsumption++-- |+-- A newtype for a qualified operator name whose OpNameType has not yet been determined.+-- This is a workaround for Happy's limited support for polymorphism; it is used+-- inside the parser to allow us to write just one parser for qualified operator names+-- which can be used for all of the different OpNameTypes+-- (via a call to getQualifiedOpName).+newtype QualifiedOpName =+ QualifiedOpName { getQualifiedOpName :: forall a. QualifiedName (N.OpName a) }++qualifiedOpName :: QualifiedName (N.OpName a) -> QualifiedOpName+qualifiedOpName n = QualifiedOpName (N.coerceOpName <$> n)++-- |+-- A newtype for a operator name whose OpNameType has not yet been determined.+-- This is a workaround for Happy's limited support for polymorphism; it is used+-- inside the parser to allow us to write just one parser for operator names+-- which can be used for all of the different OpNameTypes+-- (via a call to getOpName).+newtype OpName =+ OpName { getOpName :: forall a. Name (N.OpName a) }++opName :: Name (N.OpName a) -> OpName+opName n = OpName (N.coerceOpName <$> n)++placeholder :: SourceToken+placeholder = SourceToken+ { tokAnn = TokenAnn (SourceRange (SourcePos 0 0) (SourcePos 0 0)) [] []+ , tokValue = TokLowerName [] "<placeholder>"+ }++unexpectedName :: SourceToken -> Name Ident+unexpectedName tok = Name tok (Ident "<unexpected>")++unexpectedQual :: SourceToken -> QualifiedName Ident+unexpectedQual tok = QualifiedName tok Nothing (Ident "<unexpected>")++unexpectedLabel :: SourceToken -> Label+unexpectedLabel tok = Label tok "<unexpected>"++unexpectedExpr :: Monoid a => [SourceToken] -> Expr a+unexpectedExpr toks = ExprIdent mempty (unexpectedQual (head toks))++unexpectedBinder :: Monoid a => [SourceToken] -> Binder a+unexpectedBinder toks = BinderVar mempty (unexpectedName (head toks))++unexpectedRecordUpdate :: Monoid a => [SourceToken] -> RecordUpdate a+unexpectedRecordUpdate toks = RecordUpdateLeaf (unexpectedLabel (head toks)) (head toks) (unexpectedExpr toks)++unexpectedRecordLabeled :: [SourceToken] -> RecordLabeled a+unexpectedRecordLabeled toks = RecordPun (unexpectedName (head toks))++rangeToks :: TokenRange -> [SourceToken]+rangeToks (a, b) = [a, b]++unexpectedToks :: (a -> TokenRange) -> ([SourceToken] -> b) -> ParserErrorType -> (a -> Parser b)+unexpectedToks toRange toCst err old = do+ let toks = rangeToks $ toRange old+ addFailure toks err+ pure $ toCst toks++separated :: [(SourceToken, a)] -> Separated a+separated = go []+ where+ go accum [(_, a)] = Separated a accum+ go accum (x : xs) = go (x : accum) xs+ go _ [] = internalError "Separated should not be empty"++internalError :: String -> a+internalError = error . ("Internal parser error: " <>)++toModuleName :: SourceToken -> [Text] -> Parser (Maybe N.ModuleName)+toModuleName _ [] = pure Nothing+toModuleName tok ns = do+ unless (all isValidModuleNamespace ns) $ addFailure [tok] ErrModuleName+ pure . Just . N.ModuleName $ Text.intercalate "." ns++upperToModuleName :: SourceToken -> Parser (Name N.ModuleName)+upperToModuleName tok = case tokValue tok of+ TokUpperName q a -> do+ let ns = q <> [a]+ unless (all isValidModuleNamespace ns) $ addFailure [tok] ErrModuleName+ pure . Name tok . N.ModuleName $ Text.intercalate "." ns+ _ -> internalError $ "Invalid upper name: " <> show tok++toQualifiedName :: (Text -> a) -> SourceToken -> Parser (QualifiedName a)+toQualifiedName k tok = case tokValue tok of+ TokLowerName q a+ | not (Set.member a reservedNames) -> flip (QualifiedName tok) (k a) <$> toModuleName tok q+ | otherwise -> addFailure [tok] ErrKeywordVar $> QualifiedName tok Nothing (k "<unexpected>")+ TokUpperName q a -> flip (QualifiedName tok) (k a) <$> toModuleName tok q+ TokSymbolName q a -> flip (QualifiedName tok) (k a) <$> toModuleName tok q+ TokOperator q a -> flip (QualifiedName tok) (k a) <$> toModuleName tok q+ _ -> internalError $ "Invalid qualified name: " <> show tok++toName :: (Text -> a) -> SourceToken -> Parser (Name a)+toName k tok = case tokValue tok of+ TokLowerName [] a+ | not (Set.member a reservedNames) -> pure $ Name tok (k a)+ | otherwise -> addFailure [tok] ErrKeywordVar $> Name tok (k "<unexpected>")+ TokString _ _ -> parseFail tok ErrQuotedPun+ TokRawString _ -> parseFail tok ErrQuotedPun+ TokUpperName [] a -> pure $ Name tok (k a)+ TokSymbolName [] a -> pure $ Name tok (k a)+ TokOperator [] a -> pure $ Name tok (k a)+ TokHole a -> pure $ Name tok (k a)+ _ -> internalError $ "Invalid name: " <> show tok++toLabel :: SourceToken -> Label+toLabel tok = case tokValue tok of+ TokLowerName [] a -> Label tok $ mkString a+ TokString _ a -> Label tok a+ TokRawString a -> Label tok $ mkString a+ TokForall ASCII -> Label tok $ mkString "forall"+ _ -> internalError $ "Invalid label: " <> show tok++toString :: SourceToken -> (SourceToken, PSString)+toString tok = case tokValue tok of+ TokString _ a -> (tok, a)+ TokRawString a -> (tok, mkString a)+ _ -> internalError $ "Invalid string literal: " <> show tok++toChar :: SourceToken -> (SourceToken, Char)+toChar tok = case tokValue tok of+ TokChar _ a -> (tok, a)+ _ -> internalError $ "Invalid char literal: " <> show tok++toNumber :: SourceToken -> (SourceToken, Either Integer Double)+toNumber tok = case tokValue tok of+ TokInt _ a -> (tok, Left a)+ TokNumber _ a -> (tok, Right a)+ _ -> internalError $ "Invalid number literal: " <> show tok++toInt :: SourceToken -> (SourceToken, Integer)+toInt tok = case tokValue tok of+ TokInt _ a -> (tok, a)+ _ -> internalError $ "Invalid integer literal: " <> show tok++toBoolean :: SourceToken -> (SourceToken, Bool)+toBoolean tok = case tokValue tok of+ TokLowerName [] "true" -> (tok, True)+ TokLowerName [] "false" -> (tok, False)+ _ -> internalError $ "Invalid boolean literal: " <> show tok++toConstraint :: forall a. Monoid a => Type a -> Parser (Constraint a)+toConstraint = convertParens+ where+ convertParens :: Type a -> Parser (Constraint a)+ convertParens = \case+ TypeParens a (Wrapped b c d) -> do+ c' <- convertParens c+ pure $ ConstraintParens a (Wrapped b c' d)+ ty -> convert mempty [] ty++ convert :: a -> [Type a] -> Type a -> Parser (Constraint a)+ convert ann acc = \case+ TypeApp a lhs rhs -> convert (a <> ann) (rhs : acc) lhs+ TypeConstructor a name -> do+ for_ acc checkNoForalls+ pure $ Constraint (a <> ann) (coerce name) acc+ ty -> do+ let (tok1, tok2) = typeRange ty+ addFailure [tok1, tok2] ErrTypeInConstraint+ pure $ Constraint mempty (QualifiedName tok1 Nothing (N.ProperName "<unexpected")) []++isConstrained :: Type a -> Bool+isConstrained = everythingOnTypes (||) $ \case+ TypeConstrained{} -> True+ _ -> False++toBinderConstructor :: Monoid a => NE.NonEmpty (Binder a) -> Parser (Binder a)+toBinderConstructor = \case+ BinderConstructor a name [] NE.:| bs ->+ pure $ BinderConstructor a name bs+ a NE.:| [] -> pure a+ a NE.:| _ -> unexpectedToks binderRange unexpectedBinder ErrExprInBinder a++toRecordFields+ :: Monoid a+ => Separated (Either (RecordLabeled (Expr a)) (RecordUpdate a))+ -> Parser (Either (Separated (RecordLabeled (Expr a))) (Separated (RecordUpdate a)))+toRecordFields = \case+ Separated (Left a) as ->+ Left . Separated a <$> traverse (traverse unLeft) as+ Separated (Right a) as ->+ Right . Separated a <$> traverse (traverse unRight) as+ where+ unLeft (Left tok) = pure tok+ unLeft (Right tok) =+ unexpectedToks recordUpdateRange unexpectedRecordLabeled ErrRecordUpdateInCtr tok++ unRight (Right tok) = pure tok+ unRight (Left (RecordPun (Name tok _))) = do+ addFailure [tok] ErrRecordPunInUpdate+ pure $ unexpectedRecordUpdate [tok]+ unRight (Left (RecordField _ tok _)) = do+ addFailure [tok] ErrRecordCtrInUpdate+ pure $ unexpectedRecordUpdate [tok]++checkFundeps :: ClassHead a -> Parser ()+checkFundeps (ClassHead _ _ _ _ Nothing) = pure ()+checkFundeps (ClassHead _ _ _ vars (Just (_, fundeps))) = do+ let+ k (TypeVarKinded (Wrapped _ (Labeled (_, a) _ _) _)) = getIdent $ nameValue a+ k (TypeVarName (_, a)) = getIdent $ nameValue a+ names = k <$> vars+ check a+ | getIdent (nameValue a) `elem` names = pure ()+ | otherwise = addFailure [nameTok a] ErrUnknownFundep+ for_ fundeps $ \case+ FundepDetermined _ bs -> for_ bs check+ FundepDetermines as _ bs -> do+ for_ as check+ for_ bs check++data TmpModuleDecl a+ = TmpImport (ImportDecl a)+ | TmpChain (Separated (Declaration a))+ deriving (Show)++toModuleDecls :: Monoid a => [TmpModuleDecl a] -> Parser ([ImportDecl a], [Declaration a])+toModuleDecls = goImport []+ where+ goImport acc (TmpImport x : xs) = goImport (x : acc) xs+ goImport acc xs = (reverse acc,) <$> goDecl [] xs++ goDecl acc [] = pure $ reverse acc+ goDecl acc (TmpChain (Separated x []) : xs) = goDecl (x : acc) xs+ goDecl acc (TmpChain (Separated (DeclInstanceChain a (Separated h t)) t') : xs) = do+ (a', instances) <- goChain (getName h) a [] t'+ goDecl (DeclInstanceChain a' (Separated h (t <> instances)) : acc) xs+ goDecl acc (TmpChain (Separated _ t) : xs) = do+ for_ t $ \(tok, _) -> addFailure [tok] ErrElseInDecl+ goDecl acc xs+ goDecl acc (TmpImport imp : xs) = do+ unexpectedToks importDeclRange (const ()) ErrImportInDecl imp+ goDecl acc xs++ goChain _ ann acc [] = pure (ann, reverse acc)+ goChain name ann acc ((tok, DeclInstanceChain a (Separated h t)) : xs)+ | eqName (getName h) name = goChain name (ann <> a) (reverse ((tok, h) : t) <> acc) xs+ | otherwise = do+ addFailure [qualTok $ getName h] ErrInstanceNameMismatch+ goChain name ann acc xs+ goChain name ann acc ((tok, _) : xs) = do+ addFailure [tok] ErrElseInDecl+ goChain name ann acc xs++ getName = instClass . instHead+ eqName (QualifiedName _ a b) (QualifiedName _ c d) = a == c && b == d++checkNoWildcards :: Type a -> Parser ()+checkNoWildcards ty = do+ let+ k = \case+ TypeWildcard _ a -> [addFailure [a] ErrWildcardInType]+ TypeHole _ a -> [addFailure [nameTok a] ErrHoleInType]+ _ -> []+ sequence_ $ everythingOnTypes (<>) k ty++checkNoForalls :: Type a -> Parser ()+checkNoForalls ty = do+ let+ k = \case+ TypeForall _ a _ _ _ -> [addFailure [a] ErrToken]+ _ -> []+ sequence_ $ everythingOnTypes (<>) k ty++revert :: Parser a -> SourceToken -> Parser a+revert p lk = pushBack lk *> p++reservedNames :: Set Text+reservedNames = Set.fromList+ [ "ado"+ , "case"+ , "class"+ , "data"+ , "derive"+ , "do"+ , "else"+ , "false"+ , "forall"+ , "foreign"+ , "import"+ , "if"+ , "in"+ , "infix"+ , "infixl"+ , "infixr"+ , "instance"+ , "let"+ , "module"+ , "newtype"+ , "of"+ , "true"+ , "type"+ , "where"+ ]++isValidModuleNamespace :: Text -> Bool+isValidModuleNamespace = Text.null . snd . Text.span (\c -> c /= '_' && c /= '\'')++-- | This is to keep the @Parser.y@ file ASCII, otherwise @happy@ will break+-- in non-unicode locales.+--+-- Related GHC issue: https://gitlab.haskell.org/ghc/ghc/issues/8167+isLeftFatArrow :: Text -> Bool+isLeftFatArrow str = str == "<=" || str == "⇐"
src/Language/PureScript/CodeGen.hs view
@@ -1,25 +1,8 @@------------------------------------------------------------------------------------ Module : Language.PureScript.CodeGen--- Copyright : (c) Phil Freeman 2013--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ |--- A collection of modules related to code generation:------ [@Language.PureScript.CodeGen.JS@] Code generator for Javascript------ [@Language.PureScript.CodeGen.Externs@] Code generator for extern (foreign import) files------ [@Language.PureScript.CodeGen.Optimize@] Optimization passes for generated Javascript-----------------------------------------------------------------------------------module Language.PureScript.CodeGen (module C) where--import Language.PureScript.CodeGen.JS as C-import Language.PureScript.CodeGen.Externs as C+-- | +-- A collection of modules related to code generation: +-- +-- [@Language.PureScript.CodeGen.JS@] Code generator for JavaScript +-- +module Language.PureScript.CodeGen (module C) where + +import Language.PureScript.CodeGen.JS as C
− src/Language/PureScript/CodeGen/Externs.hs
@@ -1,121 +0,0 @@------------------------------------------------------------------------------------ Module : Language.PureScript.CodeGen.Externs--- Copyright : (c) Phil Freeman 2013--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ |--- This module generates code for \"externs\" files, i.e. files containing only foreign import declarations.-----------------------------------------------------------------------------------module Language.PureScript.CodeGen.Externs (- moduleToPs-) where--import Data.List (intercalate, find)-import Data.Maybe (fromMaybe, mapMaybe)-import qualified Data.Map as M--import Control.Monad.Writer--import Language.PureScript.AST-import Language.PureScript.Environment-import Language.PureScript.Kinds-import Language.PureScript.Names-import Language.PureScript.Pretty-import Language.PureScript.TypeClassDictionaries-import Language.PureScript.Types-import Language.PureScript.Comments---- |--- Generate foreign imports for all declarations in a module----moduleToPs :: Module -> Environment -> String-moduleToPs (Module _ _ _ Nothing) _ = error "Module exports were not elaborated in moduleToPs"-moduleToPs (Module _ moduleName ds (Just exts)) env = intercalate "\n" . execWriter $ do- tell [ "module " ++ runModuleName moduleName ++ " where"]- mapM_ declToPs ds- mapM_ exportToPs exts- where-- declToPs :: Declaration -> Writer [String] ()- declToPs (ImportDeclaration mn _ _) = tell ["import " ++ show mn ++ " ()"]- declToPs (FixityDeclaration (Fixity assoc prec) op) =- case find exportsOp exts of- Nothing -> return ()- Just _ -> tell [ unwords [ show assoc, show prec, op ] ]- where- exportsOp :: DeclarationRef -> Bool- exportsOp (PositionedDeclarationRef _ _ r) = exportsOp r- exportsOp (ValueRef ident') = ident' == Op op- exportsOp _ = False- declToPs (PositionedDeclaration _ com d) = mapM commentToPs com >> declToPs d- declToPs _ = return ()-- commentToPs :: Comment -> Writer [String] ()- commentToPs (LineComment s) = tell ["-- " ++ s]- commentToPs (BlockComment s) = tell ["{- " ++ s ++ " -}"]-- exportToPs :: DeclarationRef -> Writer [String] ()- exportToPs (PositionedDeclarationRef _ _ r) = exportToPs r- exportToPs (TypeRef pn dctors) = do- case Qualified (Just moduleName) pn `M.lookup` types env of- Nothing -> error $ show pn ++ " has no kind in exportToPs"- Just (kind, ExternData) ->- tell ["foreign import data " ++ show pn ++ " :: " ++ prettyPrintKind kind]- Just (_, DataType args tys) -> do- let dctors' = fromMaybe (map fst tys) dctors- printDctor dctor = case dctor `lookup` tys of- Nothing -> Nothing- Just tyArgs -> Just $ show dctor ++ " " ++ unwords (map prettyPrintTypeAtom tyArgs)- let dtype = if length dctors' == 1 && isNewtypeConstructor env (Qualified (Just moduleName) $ head dctors')- then "newtype"- else "data"- typeName = prettyPrintType $ foldl TypeApp (TypeConstructor (Qualified Nothing pn)) (map toTypeVar args)- tell [dtype ++ " " ++ typeName ++ (if null dctors' then "" else " = " ++ intercalate " | " (mapMaybe printDctor dctors'))]- Just (_, TypeSynonym) ->- case Qualified (Just moduleName) pn `M.lookup` typeSynonyms env of- Nothing -> error $ show pn ++ " has no type synonym info in exportToPs"- Just (args, synTy) ->- let- typeName = prettyPrintType $ foldl TypeApp (TypeConstructor (Qualified Nothing pn)) (map toTypeVar args)- in tell ["type " ++ typeName ++ " = " ++ prettyPrintType synTy]- _ -> error "Invalid input in exportToPs"-- exportToPs (ValueRef ident) =- case (moduleName, ident) `M.lookup` names env of- Nothing -> error $ show ident ++ " has no type in exportToPs"- Just (ty, nameKind, _) | nameKind == Value || nameKind == Extern ForeignImport || nameKind == Extern InlineJavascript ->- tell ["foreign import " ++ show ident ++ " :: " ++ prettyPrintType ty]- _ -> return ()- exportToPs (TypeClassRef className) =- case Qualified (Just moduleName) className `M.lookup` typeClasses env of- Nothing -> error $ show className ++ " has no type class definition in exportToPs"- Just (args, members, implies) -> do- let impliesString = if null implies- then ""- else "(" ++ intercalate ", " (map (\(pn, tys') -> show pn ++ " " ++ unwords (map prettyPrintTypeAtom tys')) implies) ++ ") <= "- typeName = prettyPrintType $ foldl TypeApp (TypeConstructor (Qualified Nothing className)) (map toTypeVar args)- tell ["class " ++ impliesString ++ typeName ++ " where"]- forM_ (filter (isValueExported . fst) members) $ \(member ,ty) ->- tell [ " " ++ show member ++ " :: " ++ prettyPrintType ty ]-- exportToPs (TypeInstanceRef ident) = do- let TypeClassDictionaryInScope { tcdClassName = className, tcdInstanceTypes = tys, tcdDependencies = deps} =- fromMaybe (error $ "Type class instance has no dictionary in exportToPs") . find (\tcd -> tcdName tcd == Qualified (Just moduleName) ident && tcdType tcd == TCDRegular) $ M.elems $ typeClassDictionaries env- let constraintsText = case fromMaybe [] deps of- [] -> ""- cs -> "(" ++ intercalate ", " (map (\(pn, tys') -> show pn ++ " " ++ unwords (map prettyPrintTypeAtom tys')) cs) ++ ") => "- tell ["foreign import instance " ++ show ident ++ " :: " ++ constraintsText ++ show className ++ " " ++ unwords (map prettyPrintTypeAtom tys)]-- toTypeVar :: (String, Maybe Kind) -> Type- toTypeVar (s, Nothing) = TypeVar s- toTypeVar (s, Just k) = KindedType (TypeVar s) k-- isValueExported :: Ident -> Bool- isValueExported ident = ValueRef ident `elem` exts
src/Language/PureScript/CodeGen/JS.hs view
@@ -1,359 +1,519 @@------------------------------------------------------------------------------------ Module : Language.PureScript.CodeGen.JS--- Copyright : (c) Phil Freeman 2013--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ |--- This module generates code in the simplified Javascript intermediate representation from Purescript code-----------------------------------------------------------------------------------{-# LANGUAGE GADTs #-}-{-# LANGUAGE ViewPatterns #-}-{-# LANGUAGE FlexibleContexts #-}-{-# LANGUAGE ScopedTypeVariables #-}--module Language.PureScript.CodeGen.JS (- module AST,- module Common,- moduleToJs-) where+-- | This module generates code in the core imperative representation from+-- elaborated PureScript code.+module Language.PureScript.CodeGen.JS+ ( module AST+ , module Common+ , moduleToJs+ ) where -import Data.List ((\\), delete)-import Data.Maybe (mapMaybe)-import qualified Data.Traversable as T (traverse)+import Prelude+import Protolude (ordNub) -import Control.Applicative-import Control.Arrow ((&&&))-import Control.Monad (foldM, replicateM, forM)+import Control.Applicative (liftA2)+import Control.Monad (forM, replicateM, void)+import Control.Monad.Except (MonadError, throwError) import Control.Monad.Reader (MonadReader, asks)-import Control.Monad.Supply.Class+import Control.Monad.Supply.Class (MonadSupply, freshName)+import Control.Monad.Writer (MonadWriter, runWriterT, writer) -import Language.PureScript.CodeGen.JS.AST as AST+import Data.Bifunctor (first)+import Data.List ((\\), intersect)+import Data.List.NonEmpty qualified as NEL (nonEmpty)+import Data.Foldable qualified as F+import Data.Map qualified as M+import Data.Set qualified as S+import Data.Maybe (fromMaybe, mapMaybe, maybeToList)+import Data.Monoid (Any(..))+import Data.String (fromString)+import Data.Text (Text)+import Data.Text qualified as T++import Language.PureScript.AST.SourcePos (SourceSpan, displayStartEndPos) import Language.PureScript.CodeGen.JS.Common as Common-import Language.PureScript.CoreFn-import Language.PureScript.Names-import Language.PureScript.CodeGen.JS.Optimizer-import Language.PureScript.Options+import Language.PureScript.CoreImp.AST (AST, InitializerEffects(..), everywhere, everywhereTopDownM, withSourceSpan)+import Language.PureScript.CoreImp.AST qualified as AST+import Language.PureScript.CoreImp.Module qualified as AST+import Language.PureScript.CoreImp.Optimizer (optimize)+import Language.PureScript.CoreFn (Ann, Bind(..), Binder(..), CaseAlternative(..), ConstructorType(..), Expr(..), Guard, Literal(..), Meta(..), Module(..), extractAnn, extractBinderAnn, modifyAnn, removeComments)+import Language.PureScript.CoreFn.Laziness (applyLazinessTransform)+import Language.PureScript.Crash (internalError)+import Language.PureScript.Errors (ErrorMessageHint(..), SimpleErrorMessage(..),+ MultipleErrors(..), rethrow, errorMessage,+ errorMessage', rethrowWithPosition, addHint)+import Language.PureScript.Names (Ident(..), ModuleName, ProperName(..), Qualified(..), QualifiedBy(..), runIdent, runModuleName, showIdent, showQualified)+import Language.PureScript.Options (CodegenTarget(..), Options(..))+import Language.PureScript.PSString (PSString, mkString) import Language.PureScript.Traversals (sndM)-import qualified Language.PureScript.Constants as C+import Language.PureScript.Constants.Prim qualified as C --- |--- Generate code in the simplified Javascript intermediate representation for all declarations in a+import System.FilePath.Posix ((</>))++-- | Generate code in the simplified JavaScript intermediate representation for all declarations in a -- module.----moduleToJs :: forall m mode. (Applicative m, Monad m, MonadReader (Options mode) m, MonadSupply m)- => Module Ann -> m [JS]-moduleToJs (Module coms mn imps exps foreigns decls) = do- additional <- asks optionsAdditional- jsImports <- T.traverse importToJs . delete (ModuleName [ProperName C.prim]) . (\\ [mn]) $ imps- let foreigns' = mapMaybe (\(_, js, _) -> js) foreigns- jsDecls <- mapM bindToJs decls- optimized <- T.traverse (T.traverse optimize) jsDecls- let isModuleEmpty = null exps- comments <- not <$> asks optionsNoComments- let strict = JSStringLiteral "use strict"- let header = if comments && not (null coms) then JSComment coms strict else strict- let moduleBody = header : jsImports ++ foreigns' ++ concat optimized- let exps' = JSObjectLiteral $ map (runIdent &&& JSVar . identToJs) exps- return $ case additional of- MakeOptions -> moduleBody ++ [JSAssignment (JSAccessor "exports" (JSVar "module")) exps']- CompileOptions ns _ _ | not isModuleEmpty ->- [ JSVariableIntroduction ns- (Just (JSBinary Or (JSVar ns) (JSObjectLiteral [])) )- , JSAssignment (JSAccessor (moduleNameToJs mn) (JSVar ns))- (JSApp (JSFunction Nothing [] (JSBlock (moduleBody ++ [JSReturn exps']))) [])- ]- _ -> []+moduleToJs+ :: forall m+ . (MonadReader Options m, MonadSupply m, MonadError MultipleErrors m)+ => Module Ann+ -> Maybe PSString+ -> m AST.Module+moduleToJs (Module _ coms mn _ imps exps reExps foreigns decls) foreignInclude =+ rethrow (addHint (ErrorInModule mn)) $ do+ let usedNames = concatMap getNames decls+ let imps' = ordNub $ map snd imps+ let mnLookup = renameImports usedNames imps'+ (jsDecls, Any needRuntimeLazy) <- runWriterT $ mapM (moduleBindToJs mn) decls+ optimized <- fmap (fmap (fmap annotatePure)) . optimize (map identToJs exps) $ if needRuntimeLazy then [runtimeLazy] : jsDecls else jsDecls+ F.traverse_ (F.traverse_ checkIntegers) optimized+ comments <- not <$> asks optionsNoComments+ let header = if comments then coms else []+ let foreign' = maybe [] (pure . AST.Import FFINamespace) $ if null foreigns then Nothing else foreignInclude+ let moduleBody = concat optimized+ let (S.union (M.keysSet reExps) -> usedModuleNames, renamedModuleBody) = traverse (replaceModuleAccessors mnLookup) moduleBody+ let jsImports+ = map (importToJs mnLookup)+ . filter (flip S.member usedModuleNames)+ $ (\\ (mn : C.primModules)) imps'+ let foreignExps = exps `intersect` foreigns+ let standardExps = exps \\ foreignExps+ let reExps' = M.toList (M.withoutKeys reExps (S.fromList C.primModules))+ let jsExports+ = (maybeToList . exportsToJs foreignInclude $ foreignExps)+ ++ (maybeToList . exportsToJs Nothing $ standardExps)+ ++ mapMaybe reExportsToJs reExps'+ return $ AST.Module header (foreign' ++ jsImports) renamedModuleBody jsExports where+ -- Adds purity annotations to top-level values for bundlers.+ -- The semantics here derive from treating top-level module evaluation as pure, which lets+ -- us remove any unreferenced top-level declarations. To achieve this, we wrap any non-trivial+ -- top-level values in an IIFE marked with a pure annotation.+ annotatePure :: AST -> AST+ annotatePure = annotateOrWrap+ where+ annotateOrWrap = liftA2 fromMaybe pureIife maybePure - -- |- -- Generates Javascript code for a module import.- --- importToJs :: ModuleName -> m JS- importToJs mn' = do- additional <- asks optionsAdditional- let moduleBody = case additional of- MakeOptions -> JSApp (JSVar "require") [JSStringLiteral (runModuleName mn')]- CompileOptions ns _ _ -> JSAccessor (moduleNameToJs mn') (JSVar ns)- return $ JSVariableIntroduction (moduleNameToJs mn') (Just moduleBody)+ -- If the JS is potentially effectful (in the eyes of a bundler that+ -- doesn't know about PureScript), return Nothing. Otherwise, return Just+ -- the JS with any needed pure annotations added, and, in the case of a+ -- variable declaration, an IIFE to be annotated.+ maybePure :: AST -> Maybe AST+ maybePure = maybePureGen False - -- |- -- Generate code in the simplified Javascript intermediate representation for a declaration- --- bindToJs :: Bind Ann -> m [JS]- bindToJs (NonRec ident val) = return <$> nonRecToJS ident val- bindToJs (Rec vals) = forM vals (uncurry nonRecToJS)+ -- Like maybePure, but doesn't add a pure annotation to App. This exists+ -- to prevent from doubling up on annotation comments on curried+ -- applications; from experimentation, it turns out that a comment on the+ -- outermost App is sufficient for the entire curried chain to be+ -- considered effect-free.+ maybePure' :: AST -> Maybe AST+ maybePure' = maybePureGen True - -- |- -- Generate code in the simplified Javascript intermediate representation for a single non-recursive+ maybePureGen alreadyAnnotated = \case+ AST.VariableIntroduction ss name j -> Just (AST.VariableIntroduction ss name (fmap annotateOrWrap <$> j))+ AST.App ss f args -> (if alreadyAnnotated then AST.App else pureApp) ss <$> maybePure' f <*> traverse maybePure args+ AST.ArrayLiteral ss jss -> AST.ArrayLiteral ss <$> traverse maybePure jss+ AST.ObjectLiteral ss props -> AST.ObjectLiteral ss <$> traverse (traverse maybePure) props+ AST.Comment c js -> AST.Comment c <$> maybePure js++ js@(AST.Indexer _ _ (AST.Var _ FFINamespace)) -> Just js++ js@AST.NumericLiteral{} -> Just js+ js@AST.StringLiteral{} -> Just js+ js@AST.BooleanLiteral{} -> Just js+ js@AST.Function{} -> Just js+ js@AST.Var{} -> Just js+ js@AST.ModuleAccessor{} -> Just js++ _ -> Nothing++ pureIife :: AST -> AST+ pureIife val = pureApp Nothing (AST.Function Nothing Nothing [] (AST.Block Nothing [AST.Return Nothing val])) []++ pureApp :: Maybe SourceSpan -> AST -> [AST] -> AST+ pureApp ss f = AST.Comment AST.PureAnnotation . AST.App ss f++ -- Extracts all declaration names from a binding group.+ getNames :: Bind Ann -> [Ident]+ getNames (NonRec _ ident _) = [ident]+ getNames (Rec vals) = map (snd . fst) vals++ -- Creates alternative names for each module to ensure they don't collide+ -- with declaration names.+ renameImports :: [Ident] -> [ModuleName] -> M.Map ModuleName Text+ renameImports = go M.empty+ where+ go :: M.Map ModuleName Text -> [Ident] -> [ModuleName] -> M.Map ModuleName Text+ go acc used (mn' : mns') =+ let mnj = moduleNameToJs mn'+ in if mn' /= mn && Ident mnj `elem` used+ then let newName = freshModuleName 1 mnj used+ in go (M.insert mn' newName acc) (Ident newName : used) mns'+ else go (M.insert mn' mnj acc) used mns'+ go acc _ [] = acc++ freshModuleName :: Integer -> Text -> [Ident] -> Text+ freshModuleName i mn' used =+ let newName = mn' <> "_" <> T.pack (show i)+ in if Ident newName `elem` used+ then freshModuleName (i + 1) mn' used+ else newName++ -- Generates JavaScript code for a module import, binding the required module+ -- to the alternative+ importToJs :: M.Map ModuleName Text -> ModuleName -> AST.Import+ importToJs mnLookup mn' =+ let mnSafe = fromMaybe (internalError "Missing value in mnLookup") $ M.lookup mn' mnLookup+ in AST.Import mnSafe (moduleImportPath mn')++ -- Generates JavaScript code for exporting at least one identifier,+ -- eventually from another module.+ exportsToJs :: Maybe PSString -> [Ident] -> Maybe AST.Export+ exportsToJs from = fmap (flip AST.Export from) . NEL.nonEmpty . fmap runIdent++ -- Generates JavaScript code for re-exporting at least one identifier from+ -- from another module.+ reExportsToJs :: (ModuleName, [Ident]) -> Maybe AST.Export+ reExportsToJs = uncurry exportsToJs . first (Just . moduleImportPath)++ moduleImportPath :: ModuleName -> PSString+ moduleImportPath mn' = fromString (".." </> T.unpack (runModuleName mn') </> "index.js")++ -- Replaces the `ModuleAccessor`s in the AST with `Indexer`s, ensuring that+ -- the generated code refers to the collision-avoiding renamed module+ -- imports. Also returns set of used module names.+ replaceModuleAccessors :: M.Map ModuleName Text -> AST -> (S.Set ModuleName, AST)+ replaceModuleAccessors mnLookup = everywhereTopDownM $ \case+ AST.ModuleAccessor _ mn' name ->+ let mnSafe = fromMaybe (internalError "Missing value in mnLookup") $ M.lookup mn' mnLookup+ in (S.singleton mn', accessorString name $ AST.Var Nothing mnSafe)+ other -> pure other++ -- Check that all integers fall within the valid int range for JavaScript.+ checkIntegers :: AST -> m ()+ checkIntegers = void . everywhereTopDownM go+ where+ go :: AST -> m AST+ go (AST.Unary _ AST.Negate (AST.NumericLiteral ss (Left i))) =+ -- Move the negation inside the literal; since this is a top-down+ -- traversal doing this replacement will stop the next case from raising+ -- the error when attempting to use -2147483648, as if left unrewritten+ -- the value is `Unary Negate (NumericLiteral (Left 2147483648))`, and+ -- 2147483648 is larger than the maximum allowed int.+ return $ AST.NumericLiteral ss (Left (-i))+ go js@(AST.NumericLiteral ss (Left i)) =+ let minInt = -2147483648+ maxInt = 2147483647+ in if i < minInt || i > maxInt+ then throwError . maybe errorMessage errorMessage' ss $ IntOutOfRange i "JavaScript" minInt maxInt+ else return js+ go other = return other++ runtimeLazy :: AST+ runtimeLazy =+ AST.VariableIntroduction Nothing "$runtime_lazy" . Just . (UnknownEffects, ) . AST.Function Nothing Nothing ["name", "moduleName", "init"] . AST.Block Nothing $+ [ AST.VariableIntroduction Nothing "state" . Just . (UnknownEffects, ) . AST.NumericLiteral Nothing $ Left 0+ , AST.VariableIntroduction Nothing "val" Nothing+ , AST.Return Nothing . AST.Function Nothing Nothing ["lineNumber"] . AST.Block Nothing $+ [ AST.IfElse Nothing (AST.Binary Nothing AST.EqualTo (AST.Var Nothing "state") (AST.NumericLiteral Nothing (Left 2))) (AST.Return Nothing $ AST.Var Nothing "val") Nothing+ , AST.IfElse Nothing (AST.Binary Nothing AST.EqualTo (AST.Var Nothing "state") (AST.NumericLiteral Nothing (Left 1))) (AST.Throw Nothing $ AST.Unary Nothing AST.New (AST.App Nothing (AST.Var Nothing "ReferenceError") [foldl1 (AST.Binary Nothing AST.Add)+ [ AST.Var Nothing "name"+ , AST.StringLiteral Nothing " was needed before it finished initializing (module "+ , AST.Var Nothing "moduleName"+ , AST.StringLiteral Nothing ", line "+ , AST.Var Nothing "lineNumber"+ , AST.StringLiteral Nothing ")"+ ], AST.Var Nothing "moduleName", AST.Var Nothing "lineNumber"])) Nothing+ , AST.Assignment Nothing (AST.Var Nothing "state") . AST.NumericLiteral Nothing $ Left 1+ , AST.Assignment Nothing (AST.Var Nothing "val") $ AST.App Nothing (AST.Var Nothing "init") []+ , AST.Assignment Nothing (AST.Var Nothing "state") . AST.NumericLiteral Nothing $ Left 2+ , AST.Return Nothing $ AST.Var Nothing "val"+ ]+ ]+++moduleBindToJs+ :: forall m+ . (MonadReader Options m, MonadSupply m, MonadWriter Any m, MonadError MultipleErrors m)+ => ModuleName+ -> Bind Ann+ -> m [AST]+moduleBindToJs mn = bindToJs+ where+ -- Generate code in the simplified JavaScript intermediate representation for a declaration+ bindToJs :: Bind Ann -> m [AST]+ bindToJs (NonRec (_, _, Just IsTypeClassConstructor) _ _) = pure []+ -- Unlike other newtype constructors, type class constructors are only+ -- ever applied; it's not possible to use them as values. So it's safe to+ -- erase them.+ bindToJs (NonRec ann ident val) = return <$> nonRecToJS ann ident val+ bindToJs (Rec vals) = writer (applyLazinessTransform mn vals) >>= traverse (uncurry . uncurry $ nonRecToJS)++ -- Generate code in the simplified JavaScript intermediate representation for a single non-recursive -- declaration. -- -- The main purpose of this function is to handle code generation for comments.- --- nonRecToJS :: Ident -> Expr Ann -> m JS- nonRecToJS i e@(extractAnn -> (_, com, _, _)) | not (null com) = do+ nonRecToJS :: Ann -> Ident -> Expr Ann -> m AST+ nonRecToJS a i e@(extractAnn -> (_, com, _)) | not (null com) = do withoutComment <- asks optionsNoComments if withoutComment- then nonRecToJS i (modifyAnn removeComments e)- else JSComment com <$> nonRecToJS i (modifyAnn removeComments e)- nonRecToJS ident val = do+ then nonRecToJS a i (modifyAnn removeComments e)+ else AST.Comment (AST.SourceComments com) <$> nonRecToJS a i (modifyAnn removeComments e)+ nonRecToJS (ss, _, _) ident val = do js <- valueToJs val- return $ JSVariableIntroduction (identToJs ident) (Just js)+ withPos ss $ AST.VariableIntroduction Nothing (identToJs ident) (Just (guessEffects val, js)) - -- |- -- Generate code in the simplified Javascript intermediate representation for a variable based on a- -- PureScript identifier.- --- var :: Ident -> JS- var = JSVar . identToJs+ guessEffects :: Expr Ann -> AST.InitializerEffects+ guessEffects = \case+ Var _ (Qualified (BySourcePos _) _) -> NoEffects+ App (_, _, Just IsSyntheticApp) _ _ -> NoEffects+ _ -> UnknownEffects - -- |- -- Generate code in the simplified Javascript intermediate representation for an accessor based on- -- a PureScript identifier. If the name is not valid in Javascript (symbol based, reserved name) an- -- indexer is returned.- --- accessor :: Ident -> JS -> JS- accessor (Ident prop) = accessorString prop- accessor (Op op) = JSIndexer (JSStringLiteral op)+ withPos :: SourceSpan -> AST -> m AST+ withPos ss js = do+ withSM <- asks (elem JSSourceMap . optionsCodegenTargets)+ return $ if withSM+ then withSourceSpan ss js+ else js - accessorString :: String -> JS -> JS- accessorString prop | identNeedsEscaping prop = JSIndexer (JSStringLiteral prop)- | otherwise = JSAccessor prop+ -- Generate code in the simplified JavaScript intermediate representation for a variable based on a+ -- PureScript identifier.+ var :: Ident -> AST+ var = AST.Var Nothing . identToJs - -- |- -- Generate code in the simplified Javascript intermediate representation for a value or expression.- --- valueToJs :: Expr Ann -> m JS- valueToJs (Literal _ l) =- literalToValueJS l- valueToJs (Var (_, _, _, Just (IsConstructor _ [])) name) =- return $ JSAccessor "value" $ qualifiedToJS id name- valueToJs (Var (_, _, _, Just (IsConstructor _ _)) name) =- return $ JSAccessor "create" $ qualifiedToJS id name- valueToJs (Accessor _ prop val) =+ -- Generate code in the simplified JavaScript intermediate representation for a value or expression.+ valueToJs :: Expr Ann -> m AST+ valueToJs e =+ let (ss, _, _) = extractAnn e in+ withPos ss =<< valueToJs' e++ valueToJs' :: Expr Ann -> m AST+ valueToJs' (Literal (pos, _, _) l) =+ rethrowWithPosition pos $ literalToValueJS pos l+ valueToJs' (Var (_, _, Just (IsConstructor _ [])) name) =+ return $ accessorString "value" $ qualifiedToJS id name+ valueToJs' (Var (_, _, Just (IsConstructor _ _)) name) =+ return $ accessorString "create" $ qualifiedToJS id name+ valueToJs' (Accessor _ prop val) = accessorString prop <$> valueToJs val- valueToJs (ObjectUpdate _ o ps) = do+ valueToJs' (ObjectUpdate (pos, _, _) o copy ps) = do obj <- valueToJs o sts <- mapM (sndM valueToJs) ps- extendObj obj sts- valueToJs e@(Abs (_, _, _, Just IsTypeClassConstructor) _ _) =- let args = unAbs e- in return $ JSFunction Nothing (map identToJs args) (JSBlock $ map assign args)- where- unAbs :: Expr Ann -> [Ident]- unAbs (Abs _ arg val) = arg : unAbs val- unAbs _ = []- assign :: Ident -> JS- assign name = JSAssignment (accessorString (runIdent name) (JSVar "this"))- (var name)- valueToJs (Abs _ arg val) = do+ case copy of+ Nothing -> extendObj obj sts+ Just names -> pure $ AST.ObjectLiteral (Just pos) (map f names ++ sts)+ where f name = (name, accessorString name obj)+ valueToJs' (Abs _ arg val) = do ret <- valueToJs val- return $ JSFunction Nothing [identToJs arg] (JSBlock [JSReturn ret])- valueToJs e@App{} = do+ let jsArg = case arg of+ UnusedIdent -> []+ _ -> [identToJs arg]+ return $ AST.Function Nothing Nothing jsArg (AST.Block Nothing [AST.Return Nothing ret])+ valueToJs' e@App{} = do let (f, args) = unApp e [] args' <- mapM valueToJs args case f of- Var (_, _, _, Just IsNewtype) _ -> return (head args')- Var (_, _, _, Just (IsConstructor _ fields)) name | length args == length fields ->- return $ JSUnary JSNew $ JSApp (qualifiedToJS id name) args'- Var (_, _, _, Just IsTypeClassConstructor) name ->- return $ JSUnary JSNew $ JSApp (qualifiedToJS id name) args'- _ -> flip (foldl (\fn a -> JSApp fn [a])) args' <$> valueToJs f+ Var (_, _, Just IsNewtype) _ -> return (head args')+ Var (_, _, Just (IsConstructor _ fields)) name | length args == length fields ->+ return $ AST.Unary Nothing AST.New $ AST.App Nothing (qualifiedToJS id name) args'+ _ -> flip (foldl (\fn a -> AST.App Nothing fn [a])) args' <$> valueToJs f where unApp :: Expr Ann -> [Expr Ann] -> (Expr Ann, [Expr Ann]) unApp (App _ val arg) args = unApp val (arg : args) unApp other args = (other, args)- valueToJs (Var _ ident) =- return $ varToJs ident- valueToJs (Case _ values binders) = do+ valueToJs' (Var (_, _, Just IsForeign) qi@(Qualified (ByModuleName mn') ident)) =+ return $ if mn' == mn+ then foreignIdent ident+ else varToJs qi+ valueToJs' (Var (_, _, Just IsForeign) ident) =+ internalError $ "Encountered an unqualified reference to a foreign ident " ++ T.unpack (showQualified showIdent ident)+ valueToJs' (Var _ ident) = return $ varToJs ident+ valueToJs' (Case (ss, _, _) values binders) = do vals <- mapM valueToJs values- bindersToJs binders vals- valueToJs (Let _ ds val) = do+ bindersToJs ss binders vals+ valueToJs' (Let _ ds val) = do ds' <- concat <$> mapM bindToJs ds ret <- valueToJs val- return $ JSApp (JSFunction Nothing [] (JSBlock (ds' ++ [JSReturn ret]))) []- valueToJs (Constructor (_, _, _, Just IsNewtype) _ (ProperName ctor) _) =- return $ JSVariableIntroduction ctor (Just $- JSObjectLiteral [("create",- JSFunction Nothing ["value"]- (JSBlock [JSReturn $ JSVar "value"]))])- valueToJs (Constructor _ _ (ProperName ctor) []) =- return $ iife ctor [ JSFunction (Just ctor) [] (JSBlock [])- , JSAssignment (JSAccessor "value" (JSVar ctor))- (JSUnary JSNew $ JSApp (JSVar ctor) []) ]- valueToJs (Constructor _ _ (ProperName ctor) fields) =+ return $ AST.App Nothing (AST.Function Nothing Nothing [] (AST.Block Nothing (ds' ++ [AST.Return Nothing ret]))) []+ valueToJs' (Constructor (_, _, Just IsNewtype) _ ctor _) =+ return $ AST.VariableIntroduction Nothing (properToJs ctor) (Just . (UnknownEffects, ) $+ AST.ObjectLiteral Nothing [("create",+ AST.Function Nothing Nothing ["value"]+ (AST.Block Nothing [AST.Return Nothing $ AST.Var Nothing "value"]))])+ valueToJs' (Constructor _ _ ctor []) =+ return $ iife (properToJs ctor) [ AST.Function Nothing (Just (properToJs ctor)) [] (AST.Block Nothing [])+ , AST.Assignment Nothing (accessorString "value" (AST.Var Nothing (properToJs ctor)))+ (AST.Unary Nothing AST.New $ AST.App Nothing (AST.Var Nothing (properToJs ctor)) []) ]+ valueToJs' (Constructor _ _ ctor fields) = let constructor =- let body = [ JSAssignment (JSAccessor (identToJs f) (JSVar "this")) (var f) | f <- fields ]- in JSFunction (Just ctor) (identToJs `map` fields) (JSBlock body)+ let body = [ AST.Assignment Nothing ((accessorString $ mkString $ identToJs f) (AST.Var Nothing "this")) (var f) | f <- fields ]+ in AST.Function Nothing (Just (properToJs ctor)) (identToJs `map` fields) (AST.Block Nothing body) createFn =- let body = JSUnary JSNew $ JSApp (JSVar ctor) (var `map` fields)- in foldr (\f inner -> JSFunction Nothing [identToJs f] (JSBlock [JSReturn inner])) body fields- in return $ iife ctor [ constructor- , JSAssignment (JSAccessor "create" (JSVar ctor)) createFn+ let body = AST.Unary Nothing AST.New $ AST.App Nothing (AST.Var Nothing (properToJs ctor)) (var `map` fields)+ in foldr (\f inner -> AST.Function Nothing Nothing [identToJs f] (AST.Block Nothing [AST.Return Nothing inner])) body fields+ in return $ iife (properToJs ctor) [ constructor+ , AST.Assignment Nothing (accessorString "create" (AST.Var Nothing (properToJs ctor))) createFn ] - iife :: String -> [JS] -> JS- iife v exprs = JSApp (JSFunction Nothing [] (JSBlock $ exprs ++ [JSReturn $ JSVar v])) []+ iife :: Text -> [AST] -> AST+ iife v exprs = AST.App Nothing (AST.Function Nothing Nothing [] (AST.Block Nothing $ exprs ++ [AST.Return Nothing $ AST.Var Nothing v])) [] - literalToValueJS :: Literal (Expr Ann) -> m JS- literalToValueJS (NumericLiteral n) = return $ JSNumericLiteral n- literalToValueJS (StringLiteral s) = return $ JSStringLiteral s- literalToValueJS (BooleanLiteral b) = return $ JSBooleanLiteral b- literalToValueJS (ArrayLiteral xs) = JSArrayLiteral <$> mapM valueToJs xs- literalToValueJS (ObjectLiteral ps) = JSObjectLiteral <$> mapM (sndM valueToJs) ps+ literalToValueJS :: SourceSpan -> Literal (Expr Ann) -> m AST+ literalToValueJS ss (NumericLiteral (Left i)) = return $ AST.NumericLiteral (Just ss) (Left i)+ literalToValueJS ss (NumericLiteral (Right n)) = return $ AST.NumericLiteral (Just ss) (Right n)+ literalToValueJS ss (StringLiteral s) = return $ AST.StringLiteral (Just ss) s+ literalToValueJS ss (CharLiteral c) = return $ AST.StringLiteral (Just ss) (fromString [c])+ literalToValueJS ss (BooleanLiteral b) = return $ AST.BooleanLiteral (Just ss) b+ literalToValueJS ss (ArrayLiteral xs) = AST.ArrayLiteral (Just ss) <$> mapM valueToJs xs+ literalToValueJS ss (ObjectLiteral ps) = AST.ObjectLiteral (Just ss) <$> mapM (sndM valueToJs) ps - -- | -- Shallow copy an object.- --- extendObj :: JS -> [(String, JS)] -> m JS+ extendObj :: AST -> [(PSString, AST)] -> m AST extendObj obj sts = do newObj <- freshName key <- freshName+ evaluatedObj <- freshName let- jsKey = JSVar key- jsNewObj = JSVar newObj- block = JSBlock (objAssign:copy:extend ++ [JSReturn jsNewObj])- objAssign = JSVariableIntroduction newObj (Just $ JSObjectLiteral [])- copy = JSForIn key obj $ JSBlock [JSIfElse cond assign Nothing]- cond = JSApp (JSAccessor "hasOwnProperty" obj) [jsKey]- assign = JSBlock [JSAssignment (JSIndexer jsKey jsNewObj) (JSIndexer jsKey obj)]- stToAssign (s, js) = JSAssignment (JSAccessor s jsNewObj) js+ jsKey = AST.Var Nothing key+ jsNewObj = AST.Var Nothing newObj+ jsEvaluatedObj = AST.Var Nothing evaluatedObj+ block = AST.Block Nothing (evaluate:objAssign:copy:extend ++ [AST.Return Nothing jsNewObj])+ evaluate = AST.VariableIntroduction Nothing evaluatedObj (Just (UnknownEffects, obj))+ objAssign = AST.VariableIntroduction Nothing newObj (Just (NoEffects, AST.ObjectLiteral Nothing []))+ copy = AST.ForIn Nothing key jsEvaluatedObj $ AST.Block Nothing [AST.IfElse Nothing cond assign Nothing]+ cond = AST.App Nothing (accessorString "call" (accessorString "hasOwnProperty" (AST.ObjectLiteral Nothing []))) [jsEvaluatedObj, jsKey]+ assign = AST.Block Nothing [AST.Assignment Nothing (AST.Indexer Nothing jsKey jsNewObj) (AST.Indexer Nothing jsKey jsEvaluatedObj)]+ stToAssign (s, js) = AST.Assignment Nothing (accessorString s jsNewObj) js extend = map stToAssign sts- return $ JSApp (JSFunction Nothing [] block) []+ return $ AST.App Nothing (AST.Function Nothing Nothing [] block) [] - -- |- -- Generate code in the simplified Javascript intermediate representation for a reference to a+ -- Generate code in the simplified JavaScript intermediate representation for a reference to a -- variable.- --- varToJs :: Qualified Ident -> JS- varToJs (Qualified Nothing ident) = var ident+ varToJs :: Qualified Ident -> AST+ varToJs (Qualified (BySourcePos _) ident) = var ident varToJs qual = qualifiedToJS id qual - -- |- -- Generate code in the simplified Javascript intermediate representation for a reference to a+ -- Generate code in the simplified JavaScript intermediate representation for a reference to a -- variable that may have a qualified name.- --- qualifiedToJS :: (a -> Ident) -> Qualified a -> JS- qualifiedToJS f (Qualified (Just (ModuleName [ProperName mn'])) a) | mn' == C.prim = JSVar . runIdent $ f a- qualifiedToJS f (Qualified (Just mn') a) | mn /= mn' = accessor (f a) (JSVar (moduleNameToJs mn'))- qualifiedToJS f (Qualified _ a) = JSVar $ identToJs (f a)+ qualifiedToJS :: (a -> Ident) -> Qualified a -> AST+ qualifiedToJS f (Qualified (ByModuleName C.M_Prim) a) = AST.Var Nothing . runIdent $ f a+ qualifiedToJS f (Qualified (ByModuleName mn') a) | mn /= mn' = AST.ModuleAccessor Nothing mn' . mkString . T.concatMap identCharToText . runIdent $ f a+ qualifiedToJS f (Qualified _ a) = AST.Var Nothing $ identToJs (f a) - -- |- -- Generate code in the simplified Javascript intermediate representation for pattern match binders+ foreignIdent :: Ident -> AST+ foreignIdent ident = accessorString (mkString $ runIdent ident) (AST.Var Nothing FFINamespace)++ -- Generate code in the simplified JavaScript intermediate representation for pattern match binders -- and guards.- --- bindersToJs :: [CaseAlternative Ann] -> [JS] -> m JS- bindersToJs binders vals = do+ bindersToJs :: SourceSpan -> [CaseAlternative Ann] -> [AST] -> m AST+ bindersToJs ss binders vals = do valNames <- replicateM (length vals) freshName- let assignments = zipWith JSVariableIntroduction valNames (map Just vals)+ let assignments = zipWith (AST.VariableIntroduction Nothing) valNames (map (Just . (UnknownEffects, )) vals) jss <- forM binders $ \(CaseAlternative bs result) -> do ret <- guardsToJs result go valNames ret bs- return $ JSApp (JSFunction Nothing [] (JSBlock (assignments ++ concat jss ++ [JSThrow $ JSUnary JSNew $ JSApp (JSVar "Error") [JSStringLiteral "Failed pattern match"]])))+ return $ AST.App Nothing (AST.Function Nothing Nothing [] (AST.Block Nothing (assignments ++ concat jss ++ [AST.Throw Nothing $ failedPatternError valNames]))) [] where- go :: [String] -> [JS] -> [Binder Ann] -> m [JS]+ go :: [Text] -> [AST] -> [Binder Ann] -> m [AST] go _ done [] = return done go (v:vs) done' (b:bs) = do done'' <- go vs done' bs binderToJs v done'' b- go _ _ _ = error "Invalid arguments to bindersToJs"+ go _ _ _ = internalError "Invalid arguments to bindersToJs" - guardsToJs :: Either [(Guard Ann, Expr Ann)] (Expr Ann) -> m [JS]- guardsToJs (Left gs) = forM gs $ \(cond, val) -> do- cond' <- valueToJs cond- done <- valueToJs val- return $ JSIfElse cond' (JSBlock [JSReturn done]) Nothing- guardsToJs (Right v) = return . JSReturn <$> valueToJs v+ failedPatternError :: [Text] -> AST+ failedPatternError names = AST.Unary Nothing AST.New $ AST.App Nothing (AST.Var Nothing "Error") [AST.Binary Nothing AST.Add (AST.StringLiteral Nothing $ mkString failedPatternMessage) (AST.ArrayLiteral Nothing $ zipWith valueError names vals)] - -- |- -- Generate code in the simplified Javascript intermediate representation for a pattern match+ failedPatternMessage :: Text+ failedPatternMessage = "Failed pattern match at " <> runModuleName mn <> " " <> displayStartEndPos ss <> ": "++ valueError :: Text -> AST -> AST+ valueError _ l@(AST.NumericLiteral _ _) = l+ valueError _ l@(AST.StringLiteral _ _) = l+ valueError _ l@(AST.BooleanLiteral _ _) = l+ valueError s _ = accessorString "name" . accessorString "constructor" $ AST.Var Nothing s++ guardsToJs :: Either [(Guard Ann, Expr Ann)] (Expr Ann) -> m [AST]+ guardsToJs (Left gs) = traverse genGuard gs where+ genGuard (cond, val) = do+ cond' <- valueToJs cond+ val' <- valueToJs val+ return+ (AST.IfElse Nothing cond'+ (AST.Block Nothing [AST.Return Nothing val']) Nothing)++ guardsToJs (Right v) = return . AST.Return Nothing <$> valueToJs v++ binderToJs :: Text -> [AST] -> Binder Ann -> m [AST]+ binderToJs s done binder =+ let (ss, _, _) = extractBinderAnn binder in+ traverse (withPos ss) =<< binderToJs' s done binder++ -- Generate code in the simplified JavaScript intermediate representation for a pattern match -- binder.- --- binderToJs :: String -> [JS] -> Binder Ann -> m [JS]- binderToJs _ done (NullBinder{}) = return done- binderToJs varName done (LiteralBinder _ l) =+ binderToJs' :: Text -> [AST] -> Binder Ann -> m [AST]+ binderToJs' _ done NullBinder{} = return done+ binderToJs' varName done (LiteralBinder _ l) = literalToBinderJS varName done l- binderToJs varName done (VarBinder _ ident) =- return (JSVariableIntroduction (identToJs ident) (Just (JSVar varName)) : done)- binderToJs varName done (ConstructorBinder (_, _, _, Just IsNewtype) _ _ [b]) =+ binderToJs' varName done (VarBinder _ ident) =+ return (AST.VariableIntroduction Nothing (identToJs ident) (Just (NoEffects, AST.Var Nothing varName)) : done)+ binderToJs' varName done (ConstructorBinder (_, _, Just IsNewtype) _ _ [b]) = binderToJs varName done b- binderToJs varName done (ConstructorBinder (_, _, _, Just (IsConstructor ctorType fields)) _ ctor bs) = do+ binderToJs' varName done (ConstructorBinder (_, _, Just (IsConstructor ctorType fields)) _ ctor bs) = do js <- go (zip fields bs) done return $ case ctorType of ProductType -> js SumType ->- [JSIfElse (JSInstanceOf (JSVar varName) (qualifiedToJS (Ident . runProperName) ctor))- (JSBlock js)+ [AST.IfElse Nothing (AST.InstanceOf Nothing (AST.Var Nothing varName) (qualifiedToJS (Ident . runProperName) ctor))+ (AST.Block Nothing js) Nothing] where- go :: [(Ident, Binder Ann)] -> [JS] -> m [JS]+ go :: [(Ident, Binder Ann)] -> [AST] -> m [AST] go [] done' = return done' go ((field, binder) : remain) done' = do argVar <- freshName done'' <- go remain done' js <- binderToJs argVar done'' binder- return (JSVariableIntroduction argVar (Just (JSAccessor (identToJs field) (JSVar varName))) : js)- binderToJs varName done binder@(ConstructorBinder _ _ ctor _) | isCons ctor = do- let (headBinders, tailBinder) = uncons [] binder- numberOfHeadBinders = fromIntegral $ length headBinders- js1 <- foldM (\done' (headBinder, index) -> do- headVar <- freshName- jss <- binderToJs headVar done' headBinder- return (JSVariableIntroduction headVar (Just (JSIndexer (JSNumericLiteral (Left index)) (JSVar varName))) : jss)) done (zip headBinders [0..])- tailVar <- freshName- js2 <- binderToJs tailVar js1 tailBinder- return [JSIfElse (JSBinary GreaterThanOrEqualTo (JSAccessor "length" (JSVar varName)) (JSNumericLiteral (Left numberOfHeadBinders))) (JSBlock- ( JSVariableIntroduction tailVar (Just (JSApp (JSAccessor "slice" (JSVar varName)) [JSNumericLiteral (Left numberOfHeadBinders)])) :- js2- )) Nothing]- where- uncons :: [Binder Ann] -> Binder Ann -> ([Binder Ann], Binder Ann)- uncons acc (ConstructorBinder _ _ ctor' [h, t]) | isCons ctor' = uncons (h : acc) t- uncons acc tailBinder = (reverse acc, tailBinder)- binderToJs _ _ b@(ConstructorBinder{}) =- error $ "Invalid ConstructorBinder in binderToJs: " ++ show b- binderToJs varName done (NamedBinder _ ident binder) = do+ return (AST.VariableIntroduction Nothing argVar (Just (UnknownEffects, accessorString (mkString $ identToJs field) $ AST.Var Nothing varName)) : js)+ binderToJs' _ _ ConstructorBinder{} =+ internalError "binderToJs: Invalid ConstructorBinder in binderToJs"+ binderToJs' varName done (NamedBinder _ ident binder) = do js <- binderToJs varName done binder- return (JSVariableIntroduction (identToJs ident) (Just (JSVar varName)) : js)+ return (AST.VariableIntroduction Nothing (identToJs ident) (Just (NoEffects, AST.Var Nothing varName)) : js) - literalToBinderJS :: String -> [JS] -> Literal (Binder Ann) -> m [JS]+ literalToBinderJS :: Text -> [AST] -> Literal (Binder Ann) -> m [AST] literalToBinderJS varName done (NumericLiteral num) =- return [JSIfElse (JSBinary EqualTo (JSVar varName) (JSNumericLiteral num)) (JSBlock done) Nothing]+ return [AST.IfElse Nothing (AST.Binary Nothing AST.EqualTo (AST.Var Nothing varName) (AST.NumericLiteral Nothing num)) (AST.Block Nothing done) Nothing]+ literalToBinderJS varName done (CharLiteral c) =+ return [AST.IfElse Nothing (AST.Binary Nothing AST.EqualTo (AST.Var Nothing varName) (AST.StringLiteral Nothing (fromString [c]))) (AST.Block Nothing done) Nothing] literalToBinderJS varName done (StringLiteral str) =- return [JSIfElse (JSBinary EqualTo (JSVar varName) (JSStringLiteral str)) (JSBlock done) Nothing]+ return [AST.IfElse Nothing (AST.Binary Nothing AST.EqualTo (AST.Var Nothing varName) (AST.StringLiteral Nothing str)) (AST.Block Nothing done) Nothing] literalToBinderJS varName done (BooleanLiteral True) =- return [JSIfElse (JSVar varName) (JSBlock done) Nothing]+ return [AST.IfElse Nothing (AST.Var Nothing varName) (AST.Block Nothing done) Nothing] literalToBinderJS varName done (BooleanLiteral False) =- return [JSIfElse (JSUnary Not (JSVar varName)) (JSBlock done) Nothing]+ return [AST.IfElse Nothing (AST.Unary Nothing AST.Not (AST.Var Nothing varName)) (AST.Block Nothing done) Nothing] literalToBinderJS varName done (ObjectLiteral bs) = go done bs where- go :: [JS] -> [(String, Binder Ann)] -> m [JS]+ go :: [AST] -> [(PSString, Binder Ann)] -> m [AST] go done' [] = return done' go done' ((prop, binder):bs') = do propVar <- freshName done'' <- go done' bs' js <- binderToJs propVar done'' binder- return (JSVariableIntroduction propVar (Just (accessorString prop (JSVar varName))) : js)+ return (AST.VariableIntroduction Nothing propVar (Just (UnknownEffects, accessorString prop (AST.Var Nothing varName))) : js) literalToBinderJS varName done (ArrayLiteral bs) = do js <- go done 0 bs- return [JSIfElse (JSBinary EqualTo (JSAccessor "length" (JSVar varName)) (JSNumericLiteral (Left (fromIntegral $ length bs)))) (JSBlock js) Nothing]+ return [AST.IfElse Nothing (AST.Binary Nothing AST.EqualTo (accessorString "length" (AST.Var Nothing varName)) (AST.NumericLiteral Nothing (Left (fromIntegral $ length bs)))) (AST.Block Nothing js) Nothing] where- go :: [JS] -> Integer -> [Binder Ann] -> m [JS]+ go :: [AST] -> Integer -> [Binder Ann] -> m [AST] go done' _ [] = return done' go done' index (binder:bs') = do elVar <- freshName done'' <- go done' (index + 1) bs' js <- binderToJs elVar done'' binder- return (JSVariableIntroduction elVar (Just (JSIndexer (JSNumericLiteral (Left index)) (JSVar varName))) : js)+ return (AST.VariableIntroduction Nothing elVar (Just (UnknownEffects, AST.Indexer Nothing (AST.NumericLiteral Nothing (Left index)) (AST.Var Nothing varName))) : js) - isCons :: Qualified ProperName -> Bool- isCons (Qualified (Just mn') ctor) = mn' == ModuleName [ProperName C.prim] && ctor == ProperName "Array"- isCons name = error $ "Unexpected argument in isCons: " ++ show name+accessorString :: PSString -> AST -> AST+accessorString prop = AST.Indexer Nothing (AST.StringLiteral Nothing prop)++pattern FFINamespace :: Text+pattern FFINamespace = "$foreign"
− src/Language/PureScript/CodeGen/JS/AST.hs
@@ -1,337 +0,0 @@------------------------------------------------------------------------------------ Module : Language.PureScript.CodeGen.JS.AST--- Copyright : (c) Phil Freeman 2013--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ |--- Data types for the intermediate simplified-Javascript AST-----------------------------------------------------------------------------------{-# LANGUAGE DeriveDataTypeable #-}--module Language.PureScript.CodeGen.JS.AST where--import Data.Data--import Language.PureScript.Comments---- |--- Built-in unary operators----data UnaryOperator- -- |- -- Numeric negation- --- = Negate- -- |- -- Boolean negation- --- | Not- -- |- -- Bitwise negation- --- | BitwiseNot- -- |- -- Numeric unary \'plus\'- --- | Positive- -- |- -- Constructor- --- | JSNew deriving (Show, Eq, Data, Typeable)---- |--- Built-in binary operators----data BinaryOperator- -- |- -- Numeric addition- --- = Add- -- |- -- Numeric subtraction- --- | Subtract- -- |- -- Numeric multiplication- --- | Multiply- -- |- -- Numeric division- --- | Divide- -- |- -- Remainder- --- | Modulus- -- |- -- Generic equality test- --- | EqualTo- -- |- -- Generic inequality test- --- | NotEqualTo- -- |- -- Numeric less-than- --- | LessThan- -- |- -- Numeric less-than-or-equal- --- | LessThanOrEqualTo- -- |- -- Numeric greater-than- --- | GreaterThan- -- |- -- Numeric greater-than-or-equal- --- | GreaterThanOrEqualTo- -- |- -- Boolean and- --- | And- -- |- -- Boolean or- --- | Or- -- |- -- Bitwise and- --- | BitwiseAnd- -- |- -- Bitwise or- --- | BitwiseOr- -- |- -- Bitwise xor- --- | BitwiseXor- -- |- -- Bitwise left shift- --- | ShiftLeft- -- |- -- Bitwise right shift- --- | ShiftRight- -- |- -- Bitwise right shift with zero-fill- --- | ZeroFillShiftRight deriving (Show, Eq, Data, Typeable)---- |--- Data type for simplified Javascript expressions----data JS- -- |- -- A numeric literal- --- = JSNumericLiteral (Either Integer Double)- -- |- -- A string literal- --- | JSStringLiteral String- -- |- -- A boolean literal- --- | JSBooleanLiteral Bool- -- |- -- A unary operator application- --- | JSUnary UnaryOperator JS- -- |- -- A binary operator application- --- | JSBinary BinaryOperator JS JS- -- |- -- An array literal- --- | JSArrayLiteral [JS]- -- |- -- An array indexer expression- --- | JSIndexer JS JS- -- |- -- An object literal- --- | JSObjectLiteral [(String, JS)]- -- |- -- An object property accessor expression- --- | JSAccessor String JS- -- |- -- A function introduction (optional name, arguments, body)- --- | JSFunction (Maybe String) [String] JS- -- |- -- Function application- --- | JSApp JS [JS]- -- |- -- Variable- --- | JSVar String- -- |- -- Conditional expression- --- | JSConditional JS JS JS- -- |- -- A block of expressions in braces- --- | JSBlock [JS]- -- |- -- A variable introduction and optional initialization- --- | JSVariableIntroduction String (Maybe JS)- -- |- -- A variable assignment- --- | JSAssignment JS JS- -- |- -- While loop- --- | JSWhile JS JS- -- |- -- For loop- --- | JSFor String JS JS JS- -- |- -- ForIn loop- --- | JSForIn String JS JS- -- |- -- If-then-else statement- --- | JSIfElse JS JS (Maybe JS)- -- |- -- Return statement- --- | JSReturn JS- -- |- -- Throw statement- --- | JSThrow JS- -- |- -- Type-Of operator- --- | JSTypeOf JS- -- |- -- InstanceOf test- --- | JSInstanceOf JS JS- -- |- -- Labelled statement- --- | JSLabel String JS- -- |- -- Break statement- --- | JSBreak String- -- |- -- Continue statement- --- | JSContinue String- -- |- -- Raw Javascript (generated when parsing fails for an inline foreign import declaration)- --- | JSRaw String- -- |- -- Commented Javascript- --- | JSComment [Comment] JS deriving (Show, Eq, Data, Typeable)------- Traversals-----everywhereOnJS :: (JS -> JS) -> JS -> JS-everywhereOnJS f = go- where- go :: JS -> JS- go (JSUnary op j) = f (JSUnary op (go j))- go (JSBinary op j1 j2) = f (JSBinary op (go j1) (go j2))- go (JSArrayLiteral js) = f (JSArrayLiteral (map go js))- go (JSIndexer j1 j2) = f (JSIndexer (go j1) (go j2))- go (JSObjectLiteral js) = f (JSObjectLiteral (map (fmap go) js))- go (JSAccessor prop j) = f (JSAccessor prop (go j))- go (JSFunction name args j) = f (JSFunction name args (go j))- go (JSApp j js) = f (JSApp (go j) (map go js))- go (JSConditional j1 j2 j3) = f (JSConditional (go j1) (go j2) (go j3))- go (JSBlock js) = f (JSBlock (map go js))- go (JSVariableIntroduction name j) = f (JSVariableIntroduction name (fmap go j))- go (JSAssignment j1 j2) = f (JSAssignment (go j1) (go j2))- go (JSWhile j1 j2) = f (JSWhile (go j1) (go j2))- go (JSFor name j1 j2 j3) = f (JSFor name (go j1) (go j2) (go j3))- go (JSForIn name j1 j2) = f (JSForIn name (go j1) (go j2))- go (JSIfElse j1 j2 j3) = f (JSIfElse (go j1) (go j2) (fmap go j3))- go (JSReturn js) = f (JSReturn (go js))- go (JSThrow js) = f (JSThrow (go js))- go (JSTypeOf js) = f (JSTypeOf (go js))- go (JSLabel name js) = f (JSLabel name (go js))- go (JSInstanceOf j1 j2) = f (JSInstanceOf (go j1) (go j2))- go (JSComment com j) = f (JSComment com (go j))- go other = f other--everywhereOnJSTopDown :: (JS -> JS) -> JS -> JS-everywhereOnJSTopDown f = go . f- where- go :: JS -> JS- go (JSUnary op j) = JSUnary op (go (f j))- go (JSBinary op j1 j2) = JSBinary op (go (f j1)) (go (f j2))- go (JSArrayLiteral js) = JSArrayLiteral (map (go . f) js)- go (JSIndexer j1 j2) = JSIndexer (go (f j1)) (go (f j2))- go (JSObjectLiteral js) = JSObjectLiteral (map (fmap (go . f)) js)- go (JSAccessor prop j) = JSAccessor prop (go (f j))- go (JSFunction name args j) = JSFunction name args (go (f j))- go (JSApp j js) = JSApp (go (f j)) (map (go . f) js)- go (JSConditional j1 j2 j3) = JSConditional (go (f j1)) (go (f j2)) (go (f j3))- go (JSBlock js) = JSBlock (map (go . f) js)- go (JSVariableIntroduction name j) = JSVariableIntroduction name (fmap (go . f) j)- go (JSAssignment j1 j2) = JSAssignment (go (f j1)) (go (f j2))- go (JSWhile j1 j2) = JSWhile (go (f j1)) (go (f j2))- go (JSFor name j1 j2 j3) = JSFor name (go (f j1)) (go (f j2)) (go (f j3))- go (JSForIn name j1 j2) = JSForIn name (go (f j1)) (go (f j2))- go (JSIfElse j1 j2 j3) = JSIfElse (go (f j1)) (go (f j2)) (fmap (go . f) j3)- go (JSReturn j) = JSReturn (go (f j))- go (JSThrow j) = JSThrow (go (f j))- go (JSTypeOf j) = JSTypeOf (go (f j))- go (JSLabel name j) = JSLabel name (go (f j))- go (JSInstanceOf j1 j2) = JSInstanceOf (go (f j1)) (go (f j2))- go (JSComment com j) = JSComment com (go (f j))- go other = f other--everythingOnJS :: (r -> r -> r) -> (JS -> r) -> JS -> r-everythingOnJS (<>) f = go- where- go j@(JSUnary _ j1) = f j <> go j1- go j@(JSBinary _ j1 j2) = f j <> go j1 <> go j2- go j@(JSArrayLiteral js) = foldl (<>) (f j) (map go js)- go j@(JSIndexer j1 j2) = f j <> go j1 <> go j2- go j@(JSObjectLiteral js) = foldl (<>) (f j) (map (go . snd) js)- go j@(JSAccessor _ j1) = f j <> go j1- go j@(JSFunction _ _ j1) = f j <> go j1- go j@(JSApp j1 js) = foldl (<>) (f j <> go j1) (map go js)- go j@(JSConditional j1 j2 j3) = f j <> go j1 <> go j2 <> go j3- go j@(JSBlock js) = foldl (<>) (f j) (map go js)- go j@(JSVariableIntroduction _ (Just j1)) = f j <> go j1- go j@(JSAssignment j1 j2) = f j <> go j1 <> go j2- go j@(JSWhile j1 j2) = f j <> go j1 <> go j2- go j@(JSFor _ j1 j2 j3) = f j <> go j1 <> go j2 <> go j3- go j@(JSForIn _ j1 j2) = f j <> go j1 <> go j2- go j@(JSIfElse j1 j2 Nothing) = f j <> go j1 <> go j2- go j@(JSIfElse j1 j2 (Just j3)) = f j <> go j1 <> go j2 <> go j3- go j@(JSReturn j1) = f j <> go j1- go j@(JSThrow j1) = f j <> go j1- go j@(JSTypeOf j1) = f j <> go j1- go j@(JSLabel _ j1) = f j <> go j1- go j@(JSInstanceOf j1 j2) = f j <> go j1 <> go j2- go j@(JSComment _ j1) = f j <> go j1- go other = f other
src/Language/PureScript/CodeGen/JS/Common.hs view
@@ -1,181 +1,249 @@------------------------------------------------------------------------------------ Module : Language.PureScript.CodeGen.Common--- Copyright : (c) Phil Freeman 2013--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ |--- Common code generation utility functions----------------------------------------------------------------------------------+-- | Common code generation utility functions module Language.PureScript.CodeGen.JS.Common where -import Data.Char-import Data.List (intercalate)+import Prelude -import Language.PureScript.Names+import Data.Char (isAlpha, isAlphaNum, isDigit, ord)+import Data.Text (Text)+import Data.Text qualified as T --- |--- Convert an Ident into a valid Javascript identifier:+import Language.PureScript.Crash (internalError)+import Language.PureScript.Names (Ident(..), InternalIdentData(..), ModuleName(..), ProperName(..), unusedIdent)++moduleNameToJs :: ModuleName -> Text+moduleNameToJs (ModuleName mn) =+ let name = T.replace "." "_" mn+ in if nameIsJsBuiltIn name then "$$" <> name else name++-- | Convert an 'Ident' into a valid JavaScript identifier: -- -- * Alphanumeric characters are kept unmodified. ----- * Reserved javascript identifiers are prefixed with '$$'.+-- * Reserved javascript identifiers and identifiers starting with digits are+-- prefixed with '$$'.+identToJs :: Ident -> Text+identToJs (Ident name)+ | not (T.null name) && isDigit (T.head name) = "$$" <> T.concatMap identCharToText name+ | otherwise = anyNameToJs name+identToJs (GenIdent _ _) = internalError "GenIdent in identToJs"+identToJs UnusedIdent = unusedIdent+identToJs (InternalIdent RuntimeLazyFactory) = "$runtime_lazy"+identToJs (InternalIdent (Lazy name)) = "$lazy_" <> anyNameToJs name++-- | Convert a 'ProperName' into a valid JavaScript identifier: ----- * Symbols are prefixed with '$' followed by a symbol name or their ordinal value.+-- * Alphanumeric characters are kept unmodified. ---identToJs :: Ident -> String-identToJs (Ident name) | nameIsJsReserved name = "$$" ++ name-identToJs (Ident name) = concatMap identCharToString name-identToJs (Op op) = concatMap identCharToString op+-- * Reserved javascript identifiers are prefixed with '$$'.+properToJs :: ProperName a -> Text+properToJs = anyNameToJs . runProperName --- |--- Test if a string is a valid JS identifier without escaping.+-- | Convert any name into a valid JavaScript identifier. ---identNeedsEscaping :: String -> Bool-identNeedsEscaping s = s /= identToJs (Ident s)+-- Note that this function assumes that the argument is a valid PureScript+-- identifier (either an 'Ident' or a 'ProperName') to begin with; as such it+-- will not produce valid JavaScript identifiers if the argument e.g. begins+-- with a digit. Prefer 'identToJs' or 'properToJs' where possible.+anyNameToJs :: Text -> Text+anyNameToJs name+ | nameIsJsReserved name || nameIsJsBuiltIn name = "$$" <> name+ | otherwise = T.concatMap identCharToText name --- |--- Attempts to find a human-readable name for a symbol, if none has been specified returns the+-- | Test if a string is a valid JavaScript identifier as-is. Note that, while+-- a return value of 'True' guarantees that the string is a valid JS+-- identifier, a return value of 'False' does not guarantee that the string is+-- not a valid JS identifier. That is, this check is more conservative than+-- absolutely necessary.+isValidJsIdentifier :: Text -> Bool+isValidJsIdentifier s =+ not (T.null s) &&+ isAlpha (T.head s) &&+ s == anyNameToJs s++-- | Attempts to find a human-readable name for a symbol, if none has been specified returns the -- ordinal value.----identCharToString :: Char -> String-identCharToString c | isAlphaNum c = [c]-identCharToString '_' = "_"-identCharToString '.' = "$dot"-identCharToString '$' = "$dollar"-identCharToString '~' = "$tilde"-identCharToString '=' = "$eq"-identCharToString '<' = "$less"-identCharToString '>' = "$greater"-identCharToString '!' = "$bang"-identCharToString '#' = "$hash"-identCharToString '%' = "$percent"-identCharToString '^' = "$up"-identCharToString '&' = "$amp"-identCharToString '|' = "$bar"-identCharToString '*' = "$times"-identCharToString '/' = "$div"-identCharToString '+' = "$plus"-identCharToString '-' = "$minus"-identCharToString ':' = "$colon"-identCharToString '\\' = "$bslash"-identCharToString '?' = "$qmark"-identCharToString '@' = "$at"-identCharToString '\'' = "$prime"-identCharToString c = '$' : show (ord c)+identCharToText :: Char -> Text+identCharToText c | isAlphaNum c = T.singleton c+identCharToText '_' = "_"+identCharToText '.' = "$dot"+identCharToText '$' = "$dollar"+identCharToText '~' = "$tilde"+identCharToText '=' = "$eq"+identCharToText '<' = "$less"+identCharToText '>' = "$greater"+identCharToText '!' = "$bang"+identCharToText '#' = "$hash"+identCharToText '%' = "$percent"+identCharToText '^' = "$up"+identCharToText '&' = "$amp"+identCharToText '|' = "$bar"+identCharToText '*' = "$times"+identCharToText '/' = "$div"+identCharToText '+' = "$plus"+identCharToText '-' = "$minus"+identCharToText ':' = "$colon"+identCharToText '\\' = "$bslash"+identCharToText '?' = "$qmark"+identCharToText '@' = "$at"+identCharToText '\'' = "$prime"+identCharToText c = '$' `T.cons` T.pack (show (ord c)) --- |--- Checks whether an identifier name is reserved in Javascript.----nameIsJsReserved :: String -> Bool+-- | Checks whether an identifier name is reserved in JavaScript.+nameIsJsReserved :: Text -> Bool nameIsJsReserved name =- name `elem` [ "abstract"- , "arguments"- , "boolean"- , "break"- , "byte"- , "case"- , "catch"- , "char"- , "class"- , "const"- , "continue"- , "debugger"- , "default"- , "delete"- , "do"- , "double"- , "else"- , "enum"- , "eval"- , "export"- , "extends"- , "final"- , "finally"- , "float"- , "for"- , "function"- , "goto"- , "if"- , "implements"- , "import"- , "in"- , "instanceof"- , "int"- , "interface"- , "let"- , "long"- , "native"- , "new"- , "null"- , "package"- , "private"- , "protected"- , "public"- , "return"- , "short"- , "static"- , "super"- , "switch"- , "synchronized"- , "this"- , "throw"- , "throws"- , "transient"- , "try"- , "typeof"- , "var"- , "void"- , "volatile"- , "while"- , "with"- , "yield" ] || properNameIsJsReserved name+ name `elem` jsAnyReserved -moduleNameToJs :: ModuleName -> String-moduleNameToJs (ModuleName pns) =- let name = intercalate "_" (runProperName `map` pns)- in if properNameIsJsReserved name then "$$" ++ name else name+-- | Checks whether a name matches a built-in value in JavaScript.+nameIsJsBuiltIn :: Text -> Bool+nameIsJsBuiltIn name =+ name `elem`+ [ "arguments"+ , "Array"+ , "ArrayBuffer"+ , "Boolean"+ , "DataView"+ , "Date"+ , "decodeURI"+ , "decodeURIComponent"+ , "encodeURI"+ , "encodeURIComponent"+ , "Error"+ , "escape"+ , "eval"+ , "EvalError"+ , "Float32Array"+ , "Float64Array"+ , "Function"+ , "Infinity"+ , "Int16Array"+ , "Int32Array"+ , "Int8Array"+ , "Intl"+ , "isFinite"+ , "isNaN"+ , "JSON"+ , "Map"+ , "Math"+ , "NaN"+ , "Number"+ , "Object"+ , "parseFloat"+ , "parseInt"+ , "Promise"+ , "Proxy"+ , "RangeError"+ , "ReferenceError"+ , "Reflect"+ , "RegExp"+ , "Set"+ , "SIMD"+ , "String"+ , "Symbol"+ , "SyntaxError"+ , "TypeError"+ , "Uint16Array"+ , "Uint32Array"+ , "Uint8Array"+ , "Uint8ClampedArray"+ , "undefined"+ , "unescape"+ , "URIError"+ , "WeakMap"+ , "WeakSet"+ ] --- |--- Checks whether a proper name is reserved in Javascript.----properNameIsJsReserved :: String -> Bool-properNameIsJsReserved name =- name `elem` [ "Infinity"- , "NaN"- , "Object"- , "Function"- , "Boolean"- , "Error"- , "EvalError"- , "InternalError"- , "RangeError"- , "ReferenceError"- , "SyntaxError"- , "TypeError"- , "URIError"- , "Number"- , "Math"- , "Date"- , "String"- , "RegExp"- , "Array"- , "Int8Array"- , "Uint8Array"- , "Uint8ClampedArray"- , "Int16Array"- , "Uint16Array"- , "Int32Array"- , "Uint32Array"- , "Float32Array"- , "Float64Array"- , "ArrayBuffer"- , "DataView"- , "JSON"- , "Intl" ]+jsAnyReserved :: [Text]+jsAnyReserved =+ concat+ [ jsKeywords+ , jsSometimesReserved+ , jsFutureReserved+ , jsFutureReservedStrict+ , jsOldReserved+ , jsLiterals+ ]++jsKeywords :: [Text]+jsKeywords =+ [ "break"+ , "case"+ , "catch"+ , "class"+ , "const"+ , "continue"+ , "debugger"+ , "default"+ , "delete"+ , "do"+ , "else"+ , "export"+ , "extends"+ , "finally"+ , "for"+ , "function"+ , "if"+ , "import"+ , "in"+ , "instanceof"+ , "new"+ , "return"+ , "super"+ , "switch"+ , "this"+ , "throw"+ , "try"+ , "typeof"+ , "var"+ , "void"+ , "while"+ , "with"+ ]++jsSometimesReserved :: [Text]+jsSometimesReserved =+ [ "await"+ , "let"+ , "static"+ , "yield"+ ]++jsFutureReserved :: [Text]+jsFutureReserved =+ [ "enum" ]++jsFutureReservedStrict :: [Text]+jsFutureReservedStrict =+ [ "implements"+ , "interface"+ , "package"+ , "private"+ , "protected"+ , "public"+ ]++jsOldReserved :: [Text]+jsOldReserved =+ [ "abstract"+ , "boolean"+ , "byte"+ , "char"+ , "double"+ , "final"+ , "float"+ , "goto"+ , "int"+ , "long"+ , "native"+ , "short"+ , "synchronized"+ , "throws"+ , "transient"+ , "volatile"+ ]++jsLiterals :: [Text]+jsLiterals =+ [ "null"+ , "true"+ , "false"+ ]
− src/Language/PureScript/CodeGen/JS/Optimizer.hs
@@ -1,86 +0,0 @@------------------------------------------------------------------------------------ Module : Language.PureScript.CodeGen.JS.Optimizer--- Copyright : (c) Phil Freeman 2013--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ |--- This module optimizes code in the simplified-Javascript intermediate representation.------ The following optimizations are supported:------ * Collapsing nested blocks------ * Tail call elimination------ * Inlining of (>>=) and ret for the Eff monad------ * Removal of unnecessary thunks------ * Eta conversion------ * Inlining variables------ * Inline Prelude.($), Prelude.(#), Prelude.(++), Prelude.(!!)------ * Inlining primitive Javascript operators-----------------------------------------------------------------------------------{-# LANGUAGE FlexibleContexts #-}--module Language.PureScript.CodeGen.JS.Optimizer (- optimize-) where--import Control.Monad.Reader (MonadReader, ask, asks)--import Language.PureScript.CodeGen.JS.AST-import Language.PureScript.Options-import qualified Language.PureScript.Constants as C--import Language.PureScript.CodeGen.JS.Optimizer.Common-import Language.PureScript.CodeGen.JS.Optimizer.TCO-import Language.PureScript.CodeGen.JS.Optimizer.MagicDo-import Language.PureScript.CodeGen.JS.Optimizer.Inliner-import Language.PureScript.CodeGen.JS.Optimizer.Unused-import Language.PureScript.CodeGen.JS.Optimizer.Blocks---- |--- Apply a series of optimizer passes to simplified Javascript code----optimize :: (Monad m, MonadReader (Options mode) m) => JS -> m JS-optimize js = do- noOpt <- asks optionsNoOptimizations- if noOpt then return js else optimize' js--optimize' :: (Monad m, MonadReader (Options mode) m) => JS -> m JS-optimize' js = do- opts <- ask- return $ untilFixedPoint (applyAll- [ collapseNestedBlocks- , collapseNestedIfs- , tco opts- , magicDo opts- , removeCodeAfterReturnStatements- , removeUnusedArg- , removeUndefinedApp- , unThunk- , etaConvert- , evaluateIifes- , inlineVariables- , inlineValues- , inlineOperator (C.prelude, (C.$)) $ \f x -> JSApp f [x]- , inlineOperator (C.prelude, (C.#)) $ \x f -> JSApp f [x]- , inlineOperator (C.preludeUnsafe, C.unsafeIndex) $ flip JSIndexer- , inlineCommonOperators ]) js--untilFixedPoint :: (Eq a) => (a -> a) -> a -> a-untilFixedPoint f = go- where- go a = let a' = f a in- if a' == a then a' else go a'
− src/Language/PureScript/CodeGen/JS/Optimizer/Blocks.hs
@@ -1,42 +0,0 @@------------------------------------------------------------------------------------ Module : Language.PureScript.CodeGen.JS.Optimizer.Blocks--- Copyright : (c) Phil Freeman 2013-14--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ |--- Optimizer steps for simplifying Javascript blocks-----------------------------------------------------------------------------------module Language.PureScript.CodeGen.JS.Optimizer.Blocks- ( collapseNestedBlocks- , collapseNestedIfs- ) where--import Language.PureScript.CodeGen.JS.AST---- |--- Collapse blocks which appear nested directly below another block----collapseNestedBlocks :: JS -> JS-collapseNestedBlocks = everywhereOnJS collapse- where- collapse :: JS -> JS- collapse (JSBlock sts) = JSBlock (concatMap go sts)- collapse js = js- go :: JS -> [JS]- go (JSBlock sts) = sts- go s = [s]--collapseNestedIfs :: JS -> JS-collapseNestedIfs = everywhereOnJS collapse- where- collapse :: JS -> JS- collapse (JSIfElse cond1 (JSBlock [JSIfElse cond2 body Nothing]) Nothing) =- JSIfElse (JSBinary And cond1 cond2) body Nothing- collapse js = js
− src/Language/PureScript/CodeGen/JS/Optimizer/Common.hs
@@ -1,77 +0,0 @@------------------------------------------------------------------------------------ Module : Language.PureScript.CodeGen.JS.Optimizer.Common--- Copyright : (c) Phil Freeman 2013-14--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ |--- Common functions used by the various optimizer phases-----------------------------------------------------------------------------------module Language.PureScript.CodeGen.JS.Optimizer.Common where--import Data.Maybe (fromMaybe)--import Language.PureScript.CodeGen.JS.AST--applyAll :: [a -> a] -> a -> a-applyAll = foldl1 (.)--replaceIdent :: String -> JS -> JS -> JS-replaceIdent var1 js = everywhereOnJS replace- where- replace (JSVar var2) | var1 == var2 = js- replace other = other--replaceIdents :: [(String, JS)] -> JS -> JS-replaceIdents vars = everywhereOnJS replace- where- replace v@(JSVar var) = fromMaybe v $ lookup var vars- replace other = other--isReassigned :: String -> JS -> Bool-isReassigned var1 = everythingOnJS (||) check- where- check :: JS -> Bool- check (JSFunction _ args _) | var1 `elem` args = True- check (JSVariableIntroduction arg _) | var1 == arg = True- check (JSAssignment (JSVar arg) _) | var1 == arg = True- check (JSFor arg _ _ _) | var1 == arg = True- check (JSForIn arg _ _) | var1 == arg = True- check _ = False--isRebound :: JS -> JS -> Bool-isRebound js d = any (\v -> isReassigned v d || isUpdated v d) (everythingOnJS (++) variablesOf js)- where- variablesOf (JSVar var) = [var]- variablesOf _ = []--isUsed :: String -> JS -> Bool-isUsed var1 = everythingOnJS (||) check- where- check :: JS -> Bool- check (JSVar var2) | var1 == var2 = True- check (JSAssignment target _) | var1 == targetVariable target = True- check _ = False--targetVariable :: JS -> String-targetVariable (JSVar var) = var-targetVariable (JSAccessor _ tgt) = targetVariable tgt-targetVariable (JSIndexer _ tgt) = targetVariable tgt-targetVariable _ = error "Invalid argument to targetVariable"--isUpdated :: String -> JS -> Bool-isUpdated var1 = everythingOnJS (||) check- where- check :: JS -> Bool- check (JSAssignment target _) | var1 == targetVariable target = True- check _ = False--removeFromBlock :: ([JS] -> [JS]) -> JS -> JS-removeFromBlock go (JSBlock sts) = JSBlock (go sts)-removeFromBlock _ js = js
− src/Language/PureScript/CodeGen/JS/Optimizer/Inliner.hs
@@ -1,201 +0,0 @@------------------------------------------------------------------------------------ Module : Language.PureScript.CodeGen.JS.Optimizer.Inliner--- Copyright : (c) Phil Freeman 2013-14--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ |--- This module provides basic inlining capabilities-----------------------------------------------------------------------------------module Language.PureScript.CodeGen.JS.Optimizer.Inliner (- inlineVariables,- inlineValues,- inlineOperator,- inlineCommonOperators,- etaConvert,- unThunk,- evaluateIifes-) where--import Data.Maybe (fromMaybe)--import Language.PureScript.CodeGen.JS.AST-import Language.PureScript.CodeGen.JS.Common-import Language.PureScript.Names-import Language.PureScript.CodeGen.JS.Optimizer.Common-import qualified Language.PureScript.Constants as C--shouldInline :: JS -> Bool-shouldInline (JSVar _) = True-shouldInline (JSNumericLiteral _) = True-shouldInline (JSStringLiteral _) = True-shouldInline (JSBooleanLiteral _) = True-shouldInline (JSAccessor _ val) = shouldInline val-shouldInline (JSIndexer index val) = shouldInline index && shouldInline val-shouldInline _ = False--etaConvert :: JS -> JS-etaConvert = everywhereOnJS convert- where- convert :: JS -> JS- convert (JSBlock [JSReturn (JSApp (JSFunction Nothing idents block@(JSBlock body)) args)])- | all shouldInline args &&- not (any (`isRebound` block) (map JSVar idents)) &&- not (any (`isRebound` block) args)- = JSBlock (map (replaceIdents (zip idents args)) body)- convert (JSFunction Nothing [] (JSBlock [JSReturn (JSApp fn [])])) = fn- convert js = js--unThunk :: JS -> JS-unThunk = everywhereOnJS convert- where- convert :: JS -> JS- convert (JSBlock []) = JSBlock []- convert (JSBlock jss) =- case last jss of- JSReturn (JSApp (JSFunction Nothing [] (JSBlock body)) []) -> JSBlock $ init jss ++ body- _ -> JSBlock jss- convert js = js--evaluateIifes :: JS -> JS-evaluateIifes = everywhereOnJS convert- where- convert :: JS -> JS- convert (JSApp (JSFunction Nothing [] (JSBlock [JSReturn ret])) []) = ret- convert js = js--inlineVariables :: JS -> JS-inlineVariables = everywhereOnJS $ removeFromBlock go- where- go :: [JS] -> [JS]- go [] = []- go (JSVariableIntroduction var (Just js) : sts)- | shouldInline js && not (any (isReassigned var) sts) && not (any (isRebound js) sts) && not (any (isUpdated var) sts) =- go (map (replaceIdent var js) sts)- go (s:sts) = s : go sts--inlineValues :: JS -> JS-inlineValues = everywhereOnJS convert- where- convert :: JS -> JS- convert (JSApp fn [dict]) | isPreludeDict C.semiringNumber dict && isPreludeFn C.zero fn = JSNumericLiteral (Left 0)- convert (JSApp fn [dict]) | isPreludeDict C.semiringNumber dict && isPreludeFn C.one fn = JSNumericLiteral (Left 1)- convert (JSApp (JSApp fn [x]) [y]) | isPreludeFn (C.%) fn = JSBinary Modulus x y- convert other = other--inlineOperator :: (String, String) -> (JS -> JS -> JS) -> JS -> JS-inlineOperator (m, op) f = everywhereOnJS convert- where- convert :: JS -> JS- convert (JSApp (JSApp op' [x]) [y]) | isOp op' = f x y- convert other = other- isOp (JSAccessor longForm (JSVar m')) = m == m' && longForm == identToJs (Op op)- isOp (JSIndexer (JSStringLiteral op') (JSVar m')) = m == m' && op == op'- isOp _ = False--inlineCommonOperators :: JS -> JS-inlineCommonOperators = applyAll $- [ binary C.semiringNumber (C.+) Add- , binary C.semiringNumber (C.*) Multiply- , binary C.ringNumber (C.-) Subtract- , unary C.ringNumber C.negate Negate- , binary C.moduloSemiringNumber (C./) Divide-- , binary C.ordNumber (C.<) LessThan- , binary C.ordNumber (C.>) GreaterThan- , binary C.ordNumber (C.<=) LessThanOrEqualTo- , binary C.ordNumber (C.>=) GreaterThanOrEqualTo-- , binary C.eqNumber (C.==) EqualTo- , binary C.eqNumber (C./=) NotEqualTo- , binary C.eqString (C.==) EqualTo- , binary C.eqString (C./=) NotEqualTo- , binary C.eqBoolean (C.==) EqualTo- , binary C.eqBoolean (C./=) NotEqualTo-- , binary C.semigroupString (C.<>) Add- , binary C.semigroupString (C.++) Add-- , binaryFunction C.bitsNumber C.shl ShiftLeft- , binaryFunction C.bitsNumber C.shr ShiftRight- , binaryFunction C.bitsNumber C.zshr ZeroFillShiftRight- , binary C.bitsNumber (C..&.) BitwiseAnd- , binary C.bitsNumber (C..|.) BitwiseOr- , binary C.bitsNumber (C..^.) BitwiseXor- , unary C.bitsNumber C.complement BitwiseNot-- , binary C.boolLikeBoolean (C.&&) And- , binary C.boolLikeBoolean (C.||) Or- , unary C.boolLikeBoolean C.not Not- ] ++- [ fn | i <- [0..10], fn <- [ mkFn i, runFn i ] ]- where- binary :: String -> String -> BinaryOperator -> JS -> JS- binary dictName opString op = everywhereOnJS convert- where- convert :: JS -> JS- convert (JSApp (JSApp (JSApp fn [dict]) [x]) [y]) | isPreludeDict dictName dict && isPreludeFn opString fn = JSBinary op x y- convert other = other- binaryFunction :: String -> String -> BinaryOperator -> JS -> JS- binaryFunction dictName fnName op = everywhereOnJS convert- where- convert :: JS -> JS- convert (JSApp (JSApp (JSApp fn [dict]) [x]) [y]) | isPreludeFn fnName fn && isPreludeDict dictName dict = JSBinary op x y- convert other = other- unary :: String -> String -> UnaryOperator -> JS -> JS- unary dictName fnName op = everywhereOnJS convert- where- convert :: JS -> JS- convert (JSApp (JSApp fn [dict]) [x]) | isPreludeFn fnName fn && isPreludeDict dictName dict = JSUnary op x- convert other = other- mkFn :: Int -> JS -> JS- mkFn 0 = everywhereOnJS convert- where- convert :: JS -> JS- convert (JSApp mkFnN [JSFunction Nothing [_] (JSBlock js)]) | isNFn C.mkFn 0 mkFnN =- JSFunction Nothing [] (JSBlock js)- convert other = other- mkFn n = everywhereOnJS convert- where- convert :: JS -> JS- convert orig@(JSApp mkFnN [fn]) | isNFn C.mkFn n mkFnN =- case collectArgs n [] fn of- Just (args, js) -> JSFunction Nothing args (JSBlock js)- Nothing -> orig- convert other = other- collectArgs :: Int -> [String] -> JS -> Maybe ([String], [JS])- collectArgs 1 acc (JSFunction Nothing [oneArg] (JSBlock js)) | length acc == n - 1 = Just (reverse (oneArg : acc), js)- collectArgs m acc (JSFunction Nothing [oneArg] (JSBlock [JSReturn ret])) = collectArgs (m - 1) (oneArg : acc) ret- collectArgs _ _ _ = Nothing-- isNFn :: String -> Int -> JS -> Bool- isNFn prefix n (JSVar name) = name == (prefix ++ show n)- isNFn prefix n (JSAccessor name (JSVar dataFunction)) | dataFunction == C.dataFunction = name == (prefix ++ show n)- isNFn _ _ _ = False-- runFn :: Int -> JS -> JS- runFn n = everywhereOnJS convert- where- convert :: JS -> JS- convert js = fromMaybe js $ go n [] js-- go :: Int -> [JS] -> JS -> Maybe JS- go 0 acc (JSApp runFnN [fn]) | isNFn C.runFn n runFnN && length acc == n = Just (JSApp fn acc)- go m acc (JSApp lhs [arg]) = go (m - 1) (arg : acc) lhs- go _ _ _ = Nothing--isPreludeDict :: String -> JS -> Bool-isPreludeDict dictName (JSAccessor prop (JSVar prelude)) = prelude == C.prelude && prop == dictName-isPreludeDict _ _ = False--isPreludeFn :: String -> JS -> Bool-isPreludeFn fnName (JSAccessor fnName' (JSVar prelude)) = prelude == C.prelude && fnName' == fnName-isPreludeFn fnName (JSIndexer (JSStringLiteral fnName') (JSVar prelude)) = prelude == C.prelude && fnName' == fnName-isPreludeFn fnName (JSAccessor longForm (JSAccessor prelude (JSVar _))) = prelude == C.prelude && longForm == identToJs (Op fnName)-isPreludeFn _ _ = False
− src/Language/PureScript/CodeGen/JS/Optimizer/MagicDo.hs
@@ -1,165 +0,0 @@------------------------------------------------------------------------------------ Module : Language.PureScript.CodeGen.JS.Optimizer.MagicDo--- Copyright : (c) Phil Freeman 2013-14--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ |--- This module implements the "Magic Do" optimization, which inlines calls to return--- and bind for the Eff monad, as well as some of its actions.-----------------------------------------------------------------------------------module Language.PureScript.CodeGen.JS.Optimizer.MagicDo (- magicDo-) where--import Data.List (nub)-import Data.Maybe (fromJust, isJust)--import Language.PureScript.CodeGen.JS.AST-import Language.PureScript.CodeGen.JS.Common-import Language.PureScript.Names-import Language.PureScript.Options-import qualified Language.PureScript.Constants as C--magicDo :: Options mode -> JS -> JS-magicDo opts | optionsNoMagicDo opts = id- | otherwise = inlineST . magicDo'---- |--- Inline type class dictionaries for >>= and return for the Eff monad------ E.g.------ Prelude[">>="](dict)(m1)(function(x) {--- return ...;--- })------ becomes------ function __do {--- var x = m1();--- ...--- }----magicDo' :: JS -> JS-magicDo' = everywhereOnJS undo . everywhereOnJSTopDown convert- where- -- The name of the function block which is added to denote a do block- fnName = "__do"- -- Desugar monomorphic calls to >>= and return for the Eff monad- convert :: JS -> JS- -- Desugar return- convert (JSApp (JSApp ret [val]) []) | isReturn ret = val- -- Desugar pure- convert (JSApp (JSApp pure' [val]) []) | isPure pure' = val- -- Desugar >>- convert (JSApp (JSApp bind [m]) [JSFunction Nothing [] (JSBlock js)]) | isBind bind =- JSFunction (Just fnName) [] $ JSBlock (JSApp m [] : map applyReturns js )- -- Desugar >>=- convert (JSApp (JSApp bind [m]) [JSFunction Nothing [arg] (JSBlock js)]) | isBind bind =- JSFunction (Just fnName) [] $ JSBlock (JSVariableIntroduction arg (Just (JSApp m [])) : map applyReturns js)- -- Desugar untilE- convert (JSApp (JSApp f [arg]) []) | isEffFunc C.untilE f =- JSApp (JSFunction Nothing [] (JSBlock [ JSWhile (JSUnary Not (JSApp arg [])) (JSBlock []), JSReturn $ JSObjectLiteral []])) []- -- Desugar whileE- convert (JSApp (JSApp (JSApp f [arg1]) [arg2]) []) | isEffFunc C.whileE f =- JSApp (JSFunction Nothing [] (JSBlock [ JSWhile (JSApp arg1 []) (JSBlock [ JSApp arg2 [] ]), JSReturn $ JSObjectLiteral []])) []- convert other = other- -- Check if an expression represents a monomorphic call to >>= for the Eff monad- isBind (JSApp bindPoly [effDict]) | isBindPoly bindPoly && isEffDict C.bindEffDictionary effDict = True- isBind _ = False- -- Check if an expression represents a monomorphic call to return for the Eff monad- isReturn (JSApp retPoly [effDict]) | isRetPoly retPoly && isEffDict C.monadEffDictionary effDict = True- isReturn _ = False- -- Check if an expression represents a monomorphic call to pure for the Eff applicative- isPure (JSApp purePoly [effDict]) | isPurePoly purePoly && isEffDict C.applicativeEffDictionary effDict = True- isPure _ = False- -- Check if an expression represents the polymorphic >>= function- isBindPoly (JSAccessor prop (JSVar prelude)) = prelude == C.prelude && prop == identToJs (Op (C.>>=))- isBindPoly (JSIndexer (JSStringLiteral bind) (JSVar prelude)) = prelude == C.prelude && bind == (C.>>=)- isBindPoly _ = False- -- Check if an expression represents the polymorphic return function- isRetPoly (JSAccessor returnEscaped (JSVar prelude)) = prelude == C.prelude && returnEscaped == C.returnEscaped- isRetPoly (JSIndexer (JSStringLiteral return') (JSVar prelude)) = prelude == C.prelude && return' == C.return- isRetPoly _ = False- -- Check if an expression represents the polymorphic pure function- isPurePoly (JSAccessor pure' (JSVar prelude)) = prelude == C.prelude && pure' == C.pure'- isPurePoly (JSIndexer (JSStringLiteral pure') (JSVar prelude)) = prelude == C.prelude && pure' == C.pure'- isPurePoly _ = False- -- Check if an expression represents a function in the Ef module- isEffFunc name (JSAccessor name' (JSVar eff)) = eff == C.eff && name == name'- isEffFunc _ _ = False- -- Check if an expression represents the Monad Eff dictionary- isEffDict name (JSVar ident) | ident == name = True- isEffDict name (JSAccessor prop (JSVar eff)) = eff == C.eff && prop == name- isEffDict _ _ = False- -- Remove __do function applications which remain after desugaring- undo :: JS -> JS- undo (JSReturn (JSApp (JSFunction (Just ident) [] body) [])) | ident == fnName = body- undo other = other-- applyReturns :: JS -> JS- applyReturns (JSReturn ret) = JSReturn (JSApp ret [])- applyReturns (JSBlock jss) = JSBlock (map applyReturns jss)- applyReturns (JSWhile cond js) = JSWhile cond (applyReturns js)- applyReturns (JSFor v lo hi js) = JSFor v lo hi (applyReturns js)- applyReturns (JSForIn v xs js) = JSForIn v xs (applyReturns js)- applyReturns (JSIfElse cond t f) = JSIfElse cond (applyReturns t) (applyReturns `fmap` f)- applyReturns other = other---- |--- Inline functions in the ST module----inlineST :: JS -> JS-inlineST = everywhereOnJS convertBlock- where- -- Look for runST blocks and inline the STRefs there.- -- If all STRefs are used in the scope of the same runST, only using { read, write, modify }STRef then- -- we can be more aggressive about inlining, and actually turn STRefs into local variables.- convertBlock (JSApp f [arg]) | isSTFunc C.runST f =- let refs = nub . findSTRefsIn $ arg- usages = findAllSTUsagesIn arg- allUsagesAreLocalVars = all (\u -> let v = toVar u in isJust v && fromJust v `elem` refs) usages- localVarsDoNotEscape = all (\r -> length (r `appearingIn` arg) == length (filter (\u -> let v = toVar u in v == Just r) usages)) refs- in everywhereOnJS (convert (allUsagesAreLocalVars && localVarsDoNotEscape)) arg- convertBlock other = other- -- Convert a block in a safe way, preserving object wrappers of references,- -- or in a more aggressive way, turning wrappers into local variables depending on the- -- agg(ressive) parameter.- convert agg (JSApp f [arg]) | isSTFunc C.newSTRef f =- JSFunction Nothing [] (JSBlock [JSReturn $ if agg then arg else JSObjectLiteral [(C.stRefValue, arg)]])- convert agg (JSApp (JSApp f [ref]) []) | isSTFunc C.readSTRef f =- if agg then ref else JSAccessor C.stRefValue ref- convert agg (JSApp (JSApp (JSApp f [ref]) [arg]) []) | isSTFunc C.writeSTRef f =- if agg then JSAssignment ref arg else JSAssignment (JSAccessor C.stRefValue ref) arg- convert agg (JSApp (JSApp (JSApp f [ref]) [func]) []) | isSTFunc C.modifySTRef f =- if agg then JSAssignment ref (JSApp func [ref]) else JSAssignment (JSAccessor C.stRefValue ref) (JSApp func [JSAccessor C.stRefValue ref])- convert _ other = other- -- Check if an expression represents a function in the ST module- isSTFunc name (JSAccessor name' (JSVar st)) = st == C.st && name == name'- isSTFunc _ _ = False- -- Find all ST Refs initialized in this block- findSTRefsIn = everythingOnJS (++) isSTRef- where- isSTRef (JSVariableIntroduction ident (Just (JSApp (JSApp f [_]) []))) | isSTFunc C.newSTRef f = [ident]- isSTRef _ = []- -- Find all STRefs used as arguments to readSTRef, writeSTRef, modifySTRef- findAllSTUsagesIn = everythingOnJS (++) isSTUsage- where- isSTUsage (JSApp (JSApp f [ref]) []) | isSTFunc C.readSTRef f = [ref]- isSTUsage (JSApp (JSApp (JSApp f [ref]) [_]) []) | isSTFunc C.writeSTRef f || isSTFunc C.modifySTRef f = [ref]- isSTUsage _ = []- -- Find all uses of a variable- appearingIn ref = everythingOnJS (++) isVar- where- isVar e@(JSVar v) | v == ref = [e]- isVar _ = []- -- Convert a JS value to a String if it is a JSVar- toVar (JSVar v) = Just v- toVar _ = Nothing
− src/Language/PureScript/CodeGen/JS/Optimizer/TCO.hs
@@ -1,103 +0,0 @@------------------------------------------------------------------------------------ Module : Language.PureScript.CodeGen.JS.Optimizer.TCO--- Copyright : (c) Phil Freeman 2013-14--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ |--- This module implements tail call elimination.-----------------------------------------------------------------------------------module Language.PureScript.CodeGen.JS.Optimizer.TCO (tco) where--import Language.PureScript.Options-import Language.PureScript.CodeGen.JS.AST---- |--- Eliminate tail calls----tco :: Options mode -> JS -> JS-tco opts | optionsNoTco opts = id- | otherwise = tco'--tco' :: JS -> JS-tco' = everywhereOnJS convert- where- tcoLabel :: String- tcoLabel = "tco"- tcoVar :: String -> String- tcoVar arg = "__tco_" ++ arg- copyVar :: String -> String- copyVar arg = "__copy_" ++ arg- convert :: JS -> JS- convert js@(JSVariableIntroduction name (Just fn@JSFunction {})) =- let- (argss, body', replace) = collectAllFunctionArgs [] id fn- in case () of- _ | isTailCall name body' ->- let- allArgs = concat $ reverse argss- in- JSVariableIntroduction name (Just (replace (toLoop name allArgs body')))- | otherwise -> js- convert js = js- collectAllFunctionArgs :: [[String]] -> (JS -> JS) -> JS -> ([[String]], JS, JS -> JS)- collectAllFunctionArgs allArgs f (JSFunction ident args (JSBlock (body@(JSReturn _):_))) =- collectAllFunctionArgs (args : allArgs) (\b -> f (JSFunction ident (map copyVar args) (JSBlock [b]))) body- collectAllFunctionArgs allArgs f (JSFunction ident args body@(JSBlock _)) =- (args : allArgs, body, f . JSFunction ident (map copyVar args))- collectAllFunctionArgs allArgs f (JSReturn (JSFunction ident args (JSBlock [body]))) =- collectAllFunctionArgs (args : allArgs) (\b -> f (JSReturn (JSFunction ident (map copyVar args) (JSBlock [b])))) body- collectAllFunctionArgs allArgs f (JSReturn (JSFunction ident args body@(JSBlock _))) =- (args : allArgs, body, f . JSReturn . JSFunction ident (map copyVar args))- collectAllFunctionArgs allArgs f body = (allArgs, body, f)- isTailCall :: String -> JS -> Bool- isTailCall ident js =- let- numSelfCalls = everythingOnJS (+) countSelfCalls js- numSelfCallsInTailPosition = everythingOnJS (+) countSelfCallsInTailPosition js- numSelfCallsUnderFunctions = everythingOnJS (+) countSelfCallsUnderFunctions js- in- numSelfCalls > 0- && numSelfCalls == numSelfCallsInTailPosition- && numSelfCallsUnderFunctions == 0- where- countSelfCalls :: JS -> Int- countSelfCalls (JSApp (JSVar ident') _) | ident == ident' = 1- countSelfCalls _ = 0- countSelfCallsInTailPosition :: JS -> Int- countSelfCallsInTailPosition (JSReturn ret) | isSelfCall ident ret = 1- countSelfCallsInTailPosition _ = 0- countSelfCallsUnderFunctions (JSFunction _ _ js') = everythingOnJS (+) countSelfCalls js'- countSelfCallsUnderFunctions _ = 0- toLoop :: String -> [String] -> JS -> JS- toLoop ident allArgs js = JSBlock $- map (\arg -> JSVariableIntroduction arg (Just (JSVar (copyVar arg)))) allArgs ++- [ JSLabel tcoLabel $ JSWhile (JSBooleanLiteral True) (JSBlock [ everywhereOnJS loopify js ]) ]- where- loopify :: JS -> JS- loopify (JSReturn ret) | isSelfCall ident ret =- let- allArgumentValues = concat $ collectSelfCallArgs [] ret- in- JSBlock $ zipWith (\val arg ->- JSVariableIntroduction (tcoVar arg) (Just val)) allArgumentValues allArgs- ++ map (\arg ->- JSAssignment (JSVar arg) (JSVar (tcoVar arg))) allArgs- ++ [ JSContinue tcoLabel ]- loopify other = other- collectSelfCallArgs :: [[JS]] -> JS -> [[JS]]- collectSelfCallArgs allArgumentValues (JSApp fn args') = collectSelfCallArgs (args' : allArgumentValues) fn- collectSelfCallArgs allArgumentValues _ = allArgumentValues- isSelfCall :: String -> JS -> Bool- isSelfCall ident (JSApp (JSVar ident') args) | ident == ident' && not (any isFunction args) = True- isSelfCall ident (JSApp fn args) | not (any isFunction args) = isSelfCall ident fn- isSelfCall _ _ = False- isFunction :: JS -> Bool- isFunction (JSFunction _ _ _) = True- isFunction _ = False
− src/Language/PureScript/CodeGen/JS/Optimizer/Unused.hs
@@ -1,46 +0,0 @@------------------------------------------------------------------------------------ Module : Language.PureScript.CodeGen.JS.Optimizer.Unused--- Copyright : (c) Phil Freeman 2013-14--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ |--- Removes unused variables-----------------------------------------------------------------------------------module Language.PureScript.CodeGen.JS.Optimizer.Unused- ( removeCodeAfterReturnStatements- , removeUnusedArg- , removeUndefinedApp- ) where--import Language.PureScript.CodeGen.JS.AST-import Language.PureScript.CodeGen.JS.Optimizer.Common--import qualified Language.PureScript.Constants as C--removeCodeAfterReturnStatements :: JS -> JS-removeCodeAfterReturnStatements = everywhereOnJS (removeFromBlock go)- where- go :: [JS] -> [JS]- go jss | not (any isJSReturn jss) = jss- | otherwise = let (body, ret : _) = span (not . isJSReturn) jss in body ++ [ret]- isJSReturn (JSReturn _) = True- isJSReturn _ = False--removeUnusedArg :: JS -> JS-removeUnusedArg = everywhereOnJS convert- where- convert (JSFunction name [arg] body) | arg == C.__unused = JSFunction name [] body- convert js = js--removeUndefinedApp :: JS -> JS-removeUndefinedApp = everywhereOnJS convert- where- convert (JSApp fn [JSVar arg]) | arg == C.undefined = JSApp fn []- convert js = js
+ src/Language/PureScript/CodeGen/JS/Printer.hs view
@@ -0,0 +1,310 @@+-- | Pretty printer for the JavaScript AST+module Language.PureScript.CodeGen.JS.Printer+ ( prettyPrintJS+ , prettyPrintJSWithSourceMaps+ ) where++import Prelude++import Control.Arrow ((<+>))+import Control.Monad (forM, mzero)+import Control.Monad.State (StateT, evalStateT)+import Control.PatternArrows (Operator(..), OperatorTable(..), Pattern(..), buildPrettyPrinter, mkPattern, mkPattern')+import Control.Arrow qualified as A++import Data.Maybe (fromMaybe)+import Data.Text (Text)+import Data.Text qualified as T+import Data.List.NonEmpty qualified as NEL (toList)++import Language.PureScript.AST (SourceSpan(..))+import Language.PureScript.CodeGen.JS.Common (identCharToText, isValidJsIdentifier, nameIsJsBuiltIn, nameIsJsReserved)+import Language.PureScript.CoreImp.AST (AST(..), BinaryOperator(..), CIComments(..), UnaryOperator(..), getSourceSpan)+import Language.PureScript.CoreImp.Module (Export(..), Import(..), Module(..))+import Language.PureScript.Comments (Comment(..))+import Language.PureScript.Crash (internalError)+import Language.PureScript.Pretty.Common (Emit(..), PrinterState(..), SMap, StrPos(..), addMapping', currentIndent, intercalate, parensPos, runPlainString, withIndent)+import Language.PureScript.PSString (PSString, decodeString, prettyPrintStringJS)++-- TODO (Christoph): Get rid of T.unpack / pack++literals :: (Emit gen) => Pattern PrinterState AST gen+literals = mkPattern' match'+ where+ match' :: (Emit gen) => AST -> StateT PrinterState Maybe gen+ match' js = (addMapping' (getSourceSpan js) <>) <$> match js++ match :: (Emit gen) => AST -> StateT PrinterState Maybe gen+ match (NumericLiteral _ n) = return $ emit $ T.pack $ either show show n+ match (StringLiteral _ s) = return $ emit $ prettyPrintStringJS s+ match (BooleanLiteral _ True) = return $ emit "true"+ match (BooleanLiteral _ False) = return $ emit "false"+ match (ArrayLiteral _ xs) = mconcat <$> sequence+ [ return $ emit "[ "+ , intercalate (emit ", ") <$> forM xs prettyPrintJS'+ , return $ emit " ]"+ ]+ match (ObjectLiteral _ []) = return $ emit "{}"+ match (ObjectLiteral _ ps) = mconcat <$> sequence+ [ return $ emit "{\n"+ , withIndent $ do+ jss <- forM ps $ \(key, value) -> fmap ((objectPropertyToString key <> emit ": ") <>) . prettyPrintJS' $ value+ indentString <- currentIndent+ return $ intercalate (emit ",\n") $ map (indentString <>) jss+ , return $ emit "\n"+ , currentIndent+ , return $ emit "}"+ ]+ where+ objectPropertyToString :: (Emit gen) => PSString -> gen+ objectPropertyToString s =+ emit $ case decodeString s of+ Just s' | isValidJsIdentifier s' ->+ s'+ _ ->+ prettyPrintStringJS s+ match (Block _ sts) = mconcat <$> sequence+ [ return $ emit "{\n"+ , withIndent $ prettyStatements sts+ , return $ emit "\n"+ , currentIndent+ , return $ emit "}"+ ]+ match (Var _ ident) = return $ emit ident+ match (VariableIntroduction _ ident value) = mconcat <$> sequence+ [ return $ emit $ "var " <> ident+ , maybe (return mempty) (fmap (emit " = " <>) . prettyPrintJS' . snd) value+ ]+ match (Assignment _ target value) = mconcat <$> sequence+ [ prettyPrintJS' target+ , return $ emit " = "+ , prettyPrintJS' value+ ]+ match (While _ cond sts) = mconcat <$> sequence+ [ return $ emit "while ("+ , prettyPrintJS' cond+ , return $ emit ") "+ , prettyPrintJS' sts+ ]+ match (For _ ident start end sts) = mconcat <$> sequence+ [ return $ emit $ "for (var " <> ident <> " = "+ , prettyPrintJS' start+ , return $ emit $ "; " <> ident <> " < "+ , prettyPrintJS' end+ , return $ emit $ "; " <> ident <> "++) "+ , prettyPrintJS' sts+ ]+ match (ForIn _ ident obj sts) = mconcat <$> sequence+ [ return $ emit $ "for (var " <> ident <> " in "+ , prettyPrintJS' obj+ , return $ emit ") "+ , prettyPrintJS' sts+ ]+ match (IfElse _ cond thens elses) = mconcat <$> sequence+ [ return $ emit "if ("+ , prettyPrintJS' cond+ , return $ emit ") "+ , prettyPrintJS' thens+ , maybe (return mempty) (fmap (emit " else " <>) . prettyPrintJS') elses+ ]+ match (Return _ value) = mconcat <$> sequence+ [ return $ emit "return "+ , prettyPrintJS' value+ ]+ match (ReturnNoResult _) = return $ emit "return"+ match (Throw _ value) = mconcat <$> sequence+ [ return $ emit "throw "+ , prettyPrintJS' value+ ]+ match (Comment (SourceComments com) js) = mconcat <$> sequence+ [ return $ emit "\n"+ , mconcat <$> forM com comment+ , prettyPrintJS' js+ ]+ match (Comment PureAnnotation js) = mconcat <$> sequence + [ return $ emit "/* #__PURE__ */ "+ , prettyPrintJS' js + ]+ match _ = mzero++comment :: (Emit gen) => Comment -> StateT PrinterState Maybe gen+comment (LineComment com) = mconcat <$> sequence+ [ currentIndent+ , return $ emit "//" <> emit com <> emit "\n"+ ]+comment (BlockComment com) = fmap mconcat $ sequence $+ [ currentIndent+ , return $ emit "/**\n"+ ] +++ map asLine (T.lines com) +++ [ currentIndent+ , return $ emit " */\n"+ , currentIndent+ ]+ where+ asLine :: (Emit gen) => Text -> StateT PrinterState Maybe gen+ asLine s = do+ i <- currentIndent+ return $ i <> emit " * " <> (emit . removeComments) s <> emit "\n"++ removeComments :: Text -> Text+ removeComments t =+ case T.stripPrefix "*/" t of+ Just rest -> removeComments rest+ Nothing -> case T.uncons t of+ Just (x, xs) -> x `T.cons` removeComments xs+ Nothing -> ""++prettyImport :: (Emit gen) => Import -> StateT PrinterState Maybe gen+prettyImport (Import ident from) =+ return . emit $+ "import * as " <> ident <> " from " <> prettyPrintStringJS from <> ";"++prettyExport :: (Emit gen) => Export -> StateT PrinterState Maybe gen+prettyExport (Export idents from) =+ mconcat <$> sequence+ [ return $ emit "export {\n"+ , withIndent $ do+ let exportsStrings = emit . exportedIdentToString from <$> idents+ indentString <- currentIndent+ return . intercalate (emit ",\n") . NEL.toList $ (indentString <>) <$> exportsStrings+ , return $ emit "\n"+ , currentIndent+ , return . emit $ "}" <> maybe "" ((" from " <>) . prettyPrintStringJS) from <> ";"+ ]+ where+ exportedIdentToString Nothing ident+ | nameIsJsReserved ident || nameIsJsBuiltIn ident+ = "$$" <> ident <> " as " <> ident+ exportedIdentToString _ "$main"+ = T.concatMap identCharToText "$main" <> " as $main"+ exportedIdentToString _ ident+ = T.concatMap identCharToText ident++accessor :: Pattern PrinterState AST (Text, AST)+accessor = mkPattern match+ where+ match (Indexer _ (StringLiteral _ prop) val) =+ case decodeString prop of+ Just s | isValidJsIdentifier s -> Just (s, val)+ _ -> Nothing+ match _ = Nothing++indexer :: (Emit gen) => Pattern PrinterState AST (gen, AST)+indexer = mkPattern' match+ where+ match (Indexer _ index val) = (,) <$> prettyPrintJS' index <*> pure val+ match _ = mzero++lam :: Pattern PrinterState AST ((Maybe Text, [Text], Maybe SourceSpan), AST)+lam = mkPattern match+ where+ match (Function ss name args ret) = Just ((name, args, ss), ret)+ match _ = Nothing++app :: (Emit gen) => Pattern PrinterState AST (gen, AST)+app = mkPattern' match+ where+ match (App _ val args) = do+ jss <- traverse prettyPrintJS' args+ return (intercalate (emit ", ") jss, val)+ match _ = mzero++instanceOf :: Pattern PrinterState AST (AST, AST)+instanceOf = mkPattern match+ where+ match (InstanceOf _ val ty) = Just (val, ty)+ match _ = Nothing++unary' :: (Emit gen) => UnaryOperator -> (AST -> Text) -> Operator PrinterState AST gen+unary' op mkStr = Wrap match (<>)+ where+ match :: (Emit gen) => Pattern PrinterState AST (gen, AST)+ match = mkPattern match'+ where+ match' (Unary _ op' val) | op' == op = Just (emit $ mkStr val, val)+ match' _ = Nothing++unary :: (Emit gen) => UnaryOperator -> Text -> Operator PrinterState AST gen+unary op str = unary' op (const str)++negateOperator :: (Emit gen) => Operator PrinterState AST gen+negateOperator = unary' Negate (\v -> if isNegate v then "- " else "-")+ where+ isNegate (Unary _ Negate _) = True+ isNegate _ = False++binary :: (Emit gen) => BinaryOperator -> Text -> Operator PrinterState AST gen+binary op str = AssocL match (\v1 v2 -> v1 <> emit (" " <> str <> " ") <> v2)+ where+ match :: Pattern PrinterState AST (AST, AST)+ match = mkPattern match'+ where+ match' (Binary _ op' v1 v2) | op' == op = Just (v1, v2)+ match' _ = Nothing++prettyStatements :: (Emit gen) => [AST] -> StateT PrinterState Maybe gen+prettyStatements sts = do+ jss <- forM sts prettyPrintJS'+ indentString <- currentIndent+ return $ intercalate (emit "\n") $ map ((<> emit ";") . (indentString <>)) jss++prettyModule :: (Emit gen) => Module -> StateT PrinterState Maybe gen+prettyModule Module{..} = do+ header <- mconcat <$> traverse comment modHeader+ imps <- traverse prettyImport modImports+ body <- prettyStatements modBody+ exps <- traverse prettyExport modExports+ pure $ header <> intercalate (emit "\n") (imps ++ body : exps)++-- | Generate a pretty-printed string representing a collection of JavaScript expressions at the same indentation level+prettyPrintJSWithSourceMaps :: Module -> (Text, [SMap])+prettyPrintJSWithSourceMaps js =+ let StrPos (_, s, mp) = (fromMaybe (internalError "Incomplete pattern") . flip evalStateT (PrinterState 0) . prettyModule) js+ in (s, mp)++prettyPrintJS :: Module -> Text+prettyPrintJS = maybe (internalError "Incomplete pattern") runPlainString . flip evalStateT (PrinterState 0) . prettyModule++-- | Generate an indented, pretty-printed string representing a JavaScript expression+prettyPrintJS' :: (Emit gen) => AST -> StateT PrinterState Maybe gen+prettyPrintJS' = A.runKleisli $ runPattern matchValue+ where+ matchValue :: (Emit gen) => Pattern PrinterState AST gen+ matchValue = buildPrettyPrinter operators (literals <+> fmap parensPos matchValue)+ operators :: (Emit gen) => OperatorTable PrinterState AST gen+ operators =+ OperatorTable [ [ Wrap indexer $ \index val -> val <> emit "[" <> index <> emit "]" ]+ , [ Wrap accessor $ \prop val -> val <> emit "." <> emit prop ]+ , [ Wrap app $ \args val -> val <> emit "(" <> args <> emit ")" ]+ , [ unary New "new " ]+ , [ Wrap lam $ \(name, args, ss) ret -> addMapping' ss <>+ emit ("function "+ <> fromMaybe "" name+ <> "(" <> intercalate ", " args <> ") ")+ <> ret ]+ , [ unary Not "!"+ , unary BitwiseNot "~"+ , unary Positive "+"+ , negateOperator ]+ , [ binary Multiply "*"+ , binary Divide "/"+ , binary Modulus "%" ]+ , [ binary Add "+"+ , binary Subtract "-" ]+ , [ binary ShiftLeft "<<"+ , binary ShiftRight ">>"+ , binary ZeroFillShiftRight ">>>" ]+ , [ binary LessThan "<"+ , binary LessThanOrEqualTo "<="+ , binary GreaterThan ">"+ , binary GreaterThanOrEqualTo ">="+ , AssocR instanceOf $ \v1 v2 -> v1 <> emit " instanceof " <> v2 ]+ , [ binary EqualTo "==="+ , binary NotEqualTo "!==" ]+ , [ binary BitwiseAnd "&" ]+ , [ binary BitwiseXor "^" ]+ , [ binary BitwiseOr "|" ]+ , [ binary And "&&" ]+ , [ binary Or "||" ]+ ]
src/Language/PureScript/Comments.hs view
@@ -1,25 +1,24 @@------------------------------------------------------------------------------------ Module : Language.PureScript.Parser.Comments--- Copyright : (c) Phil Freeman 2015--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :---+{-# LANGUAGE TemplateHaskell #-}+ -- | -- Defines the types of source code comments ----------------------------------------------------------------------------------{-# LANGUAGE DeriveDataTypeable #-}- module Language.PureScript.Comments where -import qualified Data.Data as D+import Prelude+import Codec.Serialise (Serialise)+import Control.DeepSeq (NFData)+import Data.Text (Text)+import GHC.Generics (Generic) +import Data.Aeson.TH (Options(..), SumEncoding(..), defaultOptions, deriveJSON)+ data Comment- = LineComment String- | BlockComment String- deriving (Show, Eq, Ord, D.Data, D.Typeable)+ = LineComment Text+ | BlockComment Text+ deriving (Show, Eq, Ord, Generic)++instance NFData Comment+instance Serialise Comment++$(deriveJSON (defaultOptions { sumEncoding = ObjectWithSingleField }) ''Comment)
− src/Language/PureScript/Constants.hs
@@ -1,239 +0,0 @@------------------------------------------------------------------------------------ Module : Language.PureScript.Constants--- Copyright : (c) Phil Freeman 2013--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ |--- Various constants which refer to things in the Prelude-----------------------------------------------------------------------------------module Language.PureScript.Constants where---- Prelude Operators--($) :: String-($) = "$"--(#) :: String-(#) = "#"--(<>) :: String-(<>) = "<>"--(++) :: String-(++) = "++"--(>>=) :: String-(>>=) = ">>="--(+) :: String-(+) = "+"--(-) :: String-(-) = "-"--(*) :: String-(*) = "*"--(/) :: String-(/) = "/"--(%) :: String-(%) = "%"--(<) :: String-(<) = "<"--(>) :: String-(>) = ">"--(<=) :: String-(<=) = "<="--(>=) :: String-(>=) = ">="--(==) :: String-(==) = "=="--(/=) :: String-(/=) = "/="--(.&.) :: String-(.&.) = ".&."--(.|.) :: String-(.|.) = ".|."--(.^.) :: String-(.^.) = ".^."--(&&) :: String-(&&) = "&&"--(||) :: String-(||) = "||"--unsafeIndex :: String-unsafeIndex = "unsafeIndex"---- Prelude Operator Functions--negate :: String-negate = "negate"--shl :: String-shl = "shl"--shr :: String-shr = "shr"--zshr :: String-zshr = "zshr"--complement :: String-complement = "complement"--not :: String-not = "not"---- Prelude Values--zero :: String-zero = "zero"--one :: String-one = "one"--return :: String-return = "return"--pure' :: String-pure' = "pure"--returnEscaped :: String-returnEscaped = "$return"--untilE :: String-untilE = "untilE"--whileE :: String-whileE = "whileE"--runST :: String-runST = "runST"--stRefValue :: String-stRefValue = "value"--newSTRef :: String-newSTRef = "newSTRef"--readSTRef :: String-readSTRef = "readSTRef"--writeSTRef :: String-writeSTRef = "writeSTRef"--modifySTRef :: String-modifySTRef = "modifySTRef"--mkFn :: String-mkFn = "mkFn"--runFn :: String-runFn = "runFn"--unit :: String-unit = "unit"---- Prim values--undefined :: String-undefined = "undefined"---- Type Class Dictionary Names--monadEffDictionary :: String-monadEffDictionary = "monadEff"--applicativeEffDictionary :: String-applicativeEffDictionary = "applicativeEff"--bindEffDictionary :: String-bindEffDictionary = "bindEff"--semiringNumber :: String-semiringNumber = "semiringNumber"--ringNumber :: String-ringNumber = "ringNumber"--moduloSemiringNumber :: String-moduloSemiringNumber = "moduloSemiringNumber"--numNumber :: String-numNumber = "numNumber"--ordNumber :: String-ordNumber = "ordNumber"--eqNumber :: String-eqNumber = "eqNumber"--eqString :: String-eqString = "eqString"--eqBoolean :: String-eqBoolean = "eqBoolean"--bitsNumber :: String-bitsNumber = "bitsNumber"--boolLikeBoolean :: String-boolLikeBoolean = "boolLikeBoolean"--semigroupString :: String-semigroupString = "semigroupString"--semigroupoidArr :: String-semigroupoidArr = "semigroupoidArr"---- Main module--main :: String-main = "main"---- Code Generation--__superclass_ :: String-__superclass_ = "__superclass_"--__unused :: String-__unused = "__unused"---- Modules--prim :: String-prim = "Prim"--prelude :: String-prelude = "Prelude"--preludeUnsafe :: String-preludeUnsafe = "Prelude_Unsafe"--eff :: String-eff = "Control_Monad_Eff"--st :: String-st = "Control_Monad_ST"--dataFunction :: String-dataFunction = "Data_Function"
+ src/Language/PureScript/Constants/Libs.hs view
@@ -0,0 +1,264 @@+{-# LANGUAGE BlockArguments #-}+{-# LANGUAGE TemplateHaskell #-}+-- | Various constants which refer to things in the Prelude and other core libraries+module Language.PureScript.Constants.Libs where++import Protolude qualified as P++import Data.String (IsString)+import Language.PureScript.PSString (PSString)+import Language.PureScript.Constants.TH qualified as TH++-- Core lib values++stRefValue :: forall a. IsString a => a+stRefValue = "value"++-- Type Class Dictionary Names++data EffectDictionaries = EffectDictionaries+ { edApplicativeDict :: PSString+ , edBindDict :: PSString+ , edMonadDict :: PSString+ , edWhile :: PSString+ , edUntil :: PSString+ }++effDictionaries :: EffectDictionaries+effDictionaries = EffectDictionaries+ { edApplicativeDict = "applicativeEff"+ , edBindDict = "bindEff"+ , edMonadDict = "monadEff"+ , edWhile = "whileE"+ , edUntil = "untilE"+ }++effectDictionaries :: EffectDictionaries+effectDictionaries = EffectDictionaries+ { edApplicativeDict = "applicativeEffect"+ , edBindDict = "bindEffect"+ , edMonadDict = "monadEffect"+ , edWhile = "whileE"+ , edUntil = "untilE"+ }++stDictionaries :: EffectDictionaries+stDictionaries = EffectDictionaries+ { edApplicativeDict = "applicativeST"+ , edBindDict = "bindST"+ , edMonadDict = "monadST"+ , edWhile = "while"+ , edUntil = "until"+ }++$(TH.declare do++ -- purescript-prelude+ + TH.mod "Control.Apply" do+ TH.asIdent do TH.asString do TH.var "apply"++ TH.mod "Control.Applicative" do+ TH.asIdent do TH.asPair do TH.asString do TH.var "pure"++ TH.mod "Control.Bind" do+ TH.asPair do+ TH.asString do+ TH.var "bind"+ TH.cls "Discard" ; TH.var "discard"++ TH.var "discardUnit"++ TH.mod "Control.Category" do+ TH.asPair do+ TH.asIdent do TH.var "identity"++ TH.var "categoryFn"++ TH.mod "Control.Semigroupoid" do+ TH.asPair do+ TH.vars ["compose", "composeFlipped"]+ TH.var "semigroupoidFn"++ TH.mod "Data.Bounded" do+ TH.asPair do+ TH.vars ["bottom", "top"]+ TH.var "boundedBoolean"++ TH.mod "Data.Eq" do+ TH.cls "Eq" ; TH.asIdent do TH.asPair do TH.asString do TH.var "eq"+ TH.cls "Eq1" ; TH.asIdent do TH.asString do TH.var "eq1"+ TH.asPair do+ TH.var "notEq"++ TH.var "eqBoolean"+ TH.var "eqChar"+ TH.var "eqInt"+ TH.var "eqNumber"+ TH.var "eqString"++ TH.mod "Data.EuclideanRing" do+ TH.asPair do+ TH.var "div"++ TH.var "euclideanRingNumber"++ TH.mod "Data.Function" do+ TH.asIdent do+ TH.prefixWith "function" do TH.vars ["apply", "applyFlipped"]+ TH.var "const"+ TH.var "flip"++ TH.mod "Data.Functor" do+ TH.cls "Functor" ; TH.asIdent do TH.asString do TH.var "map"++ TH.mod "Data.Generic.Rep" do+ TH.cls "Generic" ; TH.asIdent do TH.vars ["from", "to"]+ TH.ntys ["Argument", "Constructor", "NoArguments", "NoConstructors", "Product"]+ TH.dty "Sum" ["Inl", "Inr"]++ TH.mod "Data.HeytingAlgebra" do+ TH.asPair do+ TH.asIdent do TH.vars ["conj", "disj", "not"]++ TH.var "heytingAlgebraBoolean"++ TH.mod "Data.Monoid" do+ TH.asIdent do TH.var "mempty"++ TH.mod "Data.Ord" do+ TH.cls "Ord" ; TH.asIdent do TH.asString do TH.var "compare"+ TH.cls "Ord1" ; TH.asIdent do TH.asString do TH.var "compare1"+ TH.asPair do+ TH.vars ["greaterThan", "greaterThanOrEq", "lessThan", "lessThanOrEq"]++ TH.var "ordBoolean"+ TH.var "ordChar"+ TH.var "ordInt"+ TH.var "ordNumber"+ TH.var "ordString"++ TH.mod "Data.Ordering" do+ TH.dty "Ordering" ["EQ", "GT", "LT"]++ TH.mod "Data.Reflectable" do+ TH.cls "Reflectable"++ TH.mod "Data.Ring" do+ TH.asPair do+ TH.asString do TH.vars ["negate", "sub"]++ TH.var "ringInt"+ TH.var "ringNumber"++ TH.mod "Data.Semigroup" do+ TH.asPair do+ TH.asIdent do TH.var "append"++ TH.var "semigroupString"++ TH.mod "Data.Semiring" do+ TH.asPair do+ TH.vars ["add", "mul", "one", "zero"]++ TH.var "semiringInt"+ TH.var "semiringNumber"++ TH.mod "Data.Symbol" do+ TH.cls "IsSymbol"++ -- purescript-arrays++ TH.mod "Data.Array" do+ TH.asPair do TH.var "unsafeIndex"++ -- purescript-bifunctors++ TH.mod "Data.Bifunctor" do+ TH.cls "Bifunctor" ; TH.asIdent do TH.asString do TH.var "bimap"+ TH.asIdent do TH.vars ["lmap", "rmap"]++ -- purescript-contravariant++ TH.mod "Data.Functor.Contravariant" do+ TH.cls "Contravariant" ; TH.asIdent do TH.asString do TH.var "cmap"++ -- purescript-eff++ TH.mod "Control.Monad.Eff" (P.pure ())++ TH.mod "Control.Monad.Eff.Uncurried" do+ TH.asPair do TH.vars ["mkEffFn", "runEffFn"]++ -- purescript-effect++ TH.mod "Effect" (P.pure ())++ TH.mod "Effect.Uncurried" do+ TH.asPair do TH.vars ["mkEffectFn", "runEffectFn"]++ -- purescript-foldable-traversable++ TH.mod "Data.Bifoldable" do+ TH.cls "Bifoldable" ; TH.asIdent do TH.asString do TH.vars ["bifoldMap", "bifoldl", "bifoldr"]++ TH.mod "Data.Bitraversable" do+ TH.cls "Bitraversable" ; TH.asString do TH.asIdent (TH.var "bitraverse"); TH.var "bisequence"+ TH.asIdent do+ TH.vars ["ltraverse", "rtraverse"]++ TH.mod "Data.Foldable" do+ TH.cls "Foldable" ; TH.asIdent do TH.asString do TH.vars ["foldMap", "foldl", "foldr"]++ TH.mod "Data.Traversable" do+ TH.cls "Traversable" ; TH.asString do TH.asIdent (TH.var "traverse") ; TH.var "sequence"++ -- purescript-functions++ TH.mod "Data.Function.Uncurried" do+ TH.asPair do TH.asString do TH.vars ["mkFn", "runFn"]++ -- purescript-integers++ TH.mod "Data.Int.Bits" do+ TH.asPair do+ TH.var "and"+ TH.var "complement"+ TH.var "or"+ TH.var "shl"+ TH.var "shr"+ TH.var "xor"+ TH.var "zshr"++ -- purescript-newtype++ TH.mod "Data.Newtype" do+ TH.cls "Newtype"++ -- purescript-partial++ TH.mod "Partial.Unsafe" do+ TH.asIdent do TH.asPair do TH.var "unsafePartial"++ -- purescript-profunctor++ TH.mod "Data.Profunctor" do+ TH.cls "Profunctor" ; TH.asIdent do TH.asString do TH.var "dimap"+ TH.asIdent do+ TH.var "lcmap"+ TH.prefixWith "profunctor" do TH.var "rmap"++ -- purescript-st++ TH.mod "Control.Monad.ST.Internal" do+ TH.asPair do TH.vars ["modify", "new", "read", "run", "write"]++ TH.mod "Control.Monad.ST.Uncurried" do+ TH.asPair do TH.vars ["mkSTFn", "runSTFn"]++ -- purescript-unsafe-coerce++ TH.mod "Unsafe.Coerce" do+ TH.asPair do TH.var "unsafeCoerce"++ )
+ src/Language/PureScript/Constants/Prim.hs view
@@ -0,0 +1,57 @@+{-# LANGUAGE BlockArguments #-}+{-# LANGUAGE TemplateHaskell #-}+-- | Various constants which refer to things in Prim+module Language.PureScript.Constants.Prim where++import Language.PureScript.Names (ModuleName)+import Language.PureScript.Constants.TH qualified as TH++$(TH.declare do+ TH.mod "Prim" do+ TH.cls "Partial"+ TH.ty "Array"+ TH.ty "Boolean"+ TH.ty "Char"+ TH.ty "Constraint"+ TH.ty "Function"+ TH.ty "Int"+ TH.ty "Number"+ TH.ty "Record"+ TH.ty "Row"+ TH.ty "String"+ TH.ty "Symbol"+ TH.ty "Type"+ TH.asIdent do TH.asString do TH.var "undefined"++ TH.mod "Prim.Boolean" do+ TH.tys ["False", "True"]++ TH.mod "Prim.Coerce" do+ TH.cls "Coercible"++ TH.mod "Prim.Int" do+ TH.prefixWith "Int" do TH.clss ["Add", "Compare", "Mul", "ToString"]++ TH.mod "Prim.Ordering" do+ TH.prefixWith "Type" do TH.ty "Ordering"+ TH.tys ["EQ", "GT", "LT"]++ TH.mod "Prim.Row" do+ TH.prefixWith "Row" do TH.clss ["Cons", "Lacks", "Nub", "Union"]+ + TH.mod "Prim.RowList" do+ TH.ty "RowList"+ TH.cls "RowToList"+ TH.prefixWith "RowList" do TH.tys ["Cons", "Nil"]++ TH.mod "Prim.Symbol" do+ TH.prefixWith "Symbol" do TH.clss ["Append", "Compare", "Cons"]++ TH.mod "Prim.TypeError" do+ TH.clss ["Fail", "Warn"]+ TH.tys ["Above", "Beside", "Doc", "Quote", "QuoteLabel", "Text"]++ )++primModules :: [ModuleName]+primModules = [M_Prim, M_Prim_Boolean, M_Prim_Coerce, M_Prim_Ordering, M_Prim_Row, M_Prim_RowList, M_Prim_Symbol, M_Prim_Int, M_Prim_TypeError]
+ src/Language/PureScript/Constants/TH.hs view
@@ -0,0 +1,224 @@+{-# LANGUAGE TemplateHaskell #-}+-- | This module implements an eDSL for compactly declaring pattern synonyms+-- representing known PureScript modules and their members.+--+-- The following example assumes this module is imported qualified as TH and+-- the BlockArguments extension is used, both of which I recommend.+--+-- > $(TH.declare do+-- > TH.mod "Data.Foo" do+-- > TH.ty "SomeType"+-- > TH.asIdent do+-- > TH.var "someVariable"+-- > )+--+-- will become:+--+-- > pattern M_Data_Foo :: ModuleName+-- > pattern M_Data_Foo = ModuleName "Data.Foo"+-- >+-- > pattern SomeType :: Qualified (ProperName 'TypeName)+-- > pattern SomeType = Qualified (ByModuleName M_Data_Foo) (ProperName "SomeType")+-- >+-- > pattern I_someVariable :: Qualified Ident+-- > pattern I_someVariable = Qualified (ByModuleName M_Data_Foo) (Ident "someVariable")+--+-- All pattern synonyms must start with an uppercase letter. To prevent+-- namespace collisions, different types of pattern are distinguished by a sort+-- of Hungarian notation convention:+--+-- @+-- SomeType -- a type or class name+-- C_Ctor -- a constructor name+-- I_name -- a Qualified Ident+-- M_Data_Foo -- a module name+-- P_name -- a (module name, polymorphic string) pair+-- S_name -- a lone polymorphic string (this doesn't contain any module information)+-- @+--+-- I_, P_, and S_ patterns are all optional and have to be enabled with+-- `asIdent`, `asPair`, and `asString` modifiers respectively.+--+-- Finally, to disambiguate between identifiers with the same name (such as+-- Data.Function.apply and Data.Apply.apply), the `prefixWith` modifier will+-- modify the names of the patterns created within it.+--+-- > TH.mod "Data.Function" do+-- > TH.prefixWith "function" do+-- > TH.asIdent do+-- > TH.var "apply"+-- +-- results in:+--+-- > pattern I_functionApply :: Qualified Ident+-- > pattern I_functionApply = Qualified (ByModuleName (M_Data_Function) (Ident "apply")+--+module Language.PureScript.Constants.TH+ ( declare+ , mod+ , cls, clss+ , dty+ , nty, ntys+ , ty, tys+ , var, vars+ , prefixWith+ , asIdent+ , asPair+ , asString+ ) where++import Protolude hiding (Type, mod)++import Control.Lens (over, _head)+import Control.Monad.Trans.RWS (RWS, execRWS)+import Control.Monad.Trans.Writer (Writer, execWriter)+import Control.Monad.Writer.Class (tell)+import Data.String (String)+import Language.Haskell.TH (Dec, Name, Pat, Q, Type, conP, implBidir, litP, mkName, patSynD, patSynSigD, prefixPatSyn, stringL)+import Language.PureScript.Names (Ident(..), ModuleName(..), ProperName(..), ProperNameType(..), Qualified(..), QualifiedBy(..))++-- | Generate pattern synonyms corresponding to the provided PureScript+-- declarations.+declare :: Writer (Q [Dec]) () -> Q [Dec]+declare = execWriter++-- | Declare a module.+mod :: String -> ModDecs -> Writer (Q [Dec]) ()+mod mnStr inner = do+ -- pattern M_Data_Foo :: ModuleName+ -- pattern M_Data_Foo = ModuleName "Data.Foo"+ let mn = mkModuleName mnStr+ tell $ typedPatSyn mn [t| ModuleName |] [p| ModuleName $(litP $ stringL mnStr) |]+ tell $ snd $ execRWS inner (mn, "", []) ()++-- | Declare a type class. The resulting pattern will use the name of the class+-- and have type `Qualified (ProperName 'ClassName)`.+cls :: String -> ModDecs+cls cn = ask >>= \(mn, prefix, _) -> tell $ mkPnPat [t| 'ClassName |] mn prefix cn++-- | Declare a list of type classes; shorthand for repeatedly calling `cls`.+clss :: [String] -> ModDecs+clss = traverse_ cls++-- | Declare a data type, given the name of the type and a list of constructor+-- names. A pattern will be created using the name of the type and have type+-- `Qualified (ProperName 'TypeName)`. A pattern will also be created for each+-- constructor prefixed with "C_", having type `Qualified (ProperName+-- 'ConstructorName)`.+dty :: String -> [String] -> ModDecs+dty dn ctors = ask >>= \(mn, prefix, _) -> do+ tell $ mkPnPat [t| 'TypeName |] mn prefix dn+ tell $ map fold $ traverse (mkPnPat [t| 'ConstructorName |] mn $ "C_" <> prefix) ctors++-- | Declare a data type with a singular constructor named the same as the+-- type, as is commonly the case with newtypes (but this does not require the+-- type to be a newtype in reality). Shorthand for calling `dty`.+nty :: String -> ModDecs+nty tn = dty tn [tn]++-- | Declare a list of data types with singular constructors; shorthand for+-- repeatedly calling `nty`, which itself is shorthand for `dty`.+ntys :: [String] -> ModDecs+ntys = traverse_ nty++-- | Declare a type. The resulting pattern will use the name of the type and have+-- type `Qualified (ProperName 'TypeName)`.+ty :: String -> ModDecs+ty tn = ask >>= \(mn, prefix, _) -> tell $ mkPnPat [t| 'TypeName |] mn prefix tn++-- | Declare a list of types; shorthand for repeatedly calling `ty`.+tys :: [String] -> ModDecs+tys = traverse_ ty++-- | Declare a variable, function, named instance, or generally a lower-case+-- value member of a module. The patterns created depend on which of `asPair`,+-- `asIdent`, or `asString` are used in the enclosing context.+var :: String -> ModDecs+var nm = ask >>= \(mn, prefix, vtds) -> tell $ foldMap (\f -> f mn prefix nm) vtds++-- | Declare a list of variables; shorthand for repeatedly calling `var`.+vars :: [String] -> ModDecs+vars = traverse_ var++-- | For every variable declared within, create a pattern synonym prefixed+-- with "P_" having type `forall a. (Eq a, IsString a) => (ModuleName, a)`.+asPair :: ModDecs -> ModDecs+asPair = local $ addToVars mkPairDec++-- | For every variable declared within, cerate a pattern synonym prefixed+-- with "I_" having type `Qualified Ident`.+asIdent :: ModDecs -> ModDecs+asIdent = local $ addToVars mkIdentDec++-- | For every variable declared within, cerate a pattern synonym prefixed+-- with "S_" having type `forall a. (Eq a, IsString a) => a`.+asString :: ModDecs -> ModDecs+asString = local $ addToVars mkStringDec++-- | Prefix the names of all enclosed declarations with the provided string, to+-- prevent collisions with other identifiers. For example,+-- `prefixWith "function"` would turn `I_apply` into `I_functionApply`, and+-- `C_Example` into `C_FunctionExample`.+prefixWith :: String -> ModDecs -> ModDecs+prefixWith = local . applyPrefix++-- Internals start here++type ModDecs = RWS (Name, String, [VarToDec]) (Q [Dec]) () ()+type VarToDec = Name -> String -> String -> Q [Dec]++addToVars :: VarToDec -> (a, b, [VarToDec]) -> (a, b, [VarToDec])+addToVars f (a, b, fs) = (a, b, f : fs)++applyPrefix :: String -> (a, String, c) -> (a, String, c)+applyPrefix prefix (a, prefix', c) = (a, camelAppend prefix' prefix, c)++cap :: String -> String+cap = over _head toUpper++camelAppend :: String -> String -> String+camelAppend l r = if null l then r else l <> cap r++-- "Data.Foo" -> M_Data_Foo+mkModuleName :: String -> Name+mkModuleName = mkName . ("M_" <>) . map (\case '.' -> '_'; other -> other)++-- "I_" -> "fn" -> "foo" -> I_fnFoo+-- "I_" -> "" -> "foo" -> I_foo+mkPrefixedName :: String -> String -> String -> Name+mkPrefixedName tag prefix = mkName . (tag <>) . camelAppend prefix++-- 'TypeName -> M_Data_Foo -> "Function" -> "Foo" ->+-- pattern FunctionFoo :: Qualified (ProperName 'TypeName)+-- pattern FunctionFoo = Qualified (ByModuleName M_Data_Foo) (ProperName "Foo")+mkPnPat :: Q Type -> VarToDec+mkPnPat pnType mn prefix str = typedPatSyn (mkName $ cap prefix <> str)+ [t| Qualified (ProperName $pnType) |]+ [p| Qualified (ByModuleName $(conP mn [])) (ProperName $(litP $ stringL str)) |]++-- M_Data_Foo -> "function" -> "foo" ->+-- pattern I_functionFoo :: Qualified Ident+-- pattern I_functionFoo = Qualified (ByModuleName M_Data_Foo) (Ident "foo")+mkIdentDec :: VarToDec+mkIdentDec mn prefix str = typedPatSyn (mkPrefixedName "I_" prefix str)+ [t| Qualified Ident |]+ [p| Qualified (ByModuleName $(conP mn [])) (Ident $(litP $ stringL str)) |]++-- M_Data_Foo -> "function" -> "foo" ->+-- pattern P_functionFoo :: forall a. (Eq a, IsString a) => (ModuleName, a)+-- pattern P_functionFoo = (M_Data_Foo, "foo")+mkPairDec :: VarToDec+mkPairDec mn prefix str = typedPatSyn (mkPrefixedName "P_" prefix str)+ [t| forall a. (Eq a, IsString a) => (ModuleName, a) |]+ [p| ($(conP mn []), $(litP $ stringL str)) |]++-- _ -> "function" -> "foo" ->+-- pattern S_functionFoo :: forall a. (Eq a, IsString a) => a+-- pattern S_functionFoo = "foo"+mkStringDec :: VarToDec+mkStringDec _ prefix str = typedPatSyn (mkPrefixedName "S_" prefix str)+ [t| forall a. (Eq a, IsString a) => a |]+ (litP $ stringL str)++typedPatSyn :: Name -> Q Type -> Q Pat -> Q [Dec]+typedPatSyn nm t p = sequence [patSynSigD nm t, patSynD nm (prefixPatSyn []) implBidir p]
src/Language/PureScript/CoreFn.hs view
@@ -1,26 +1,16 @@------------------------------------------------------------------------------------ Module : Language.PureScript.CoreFn--- Copyright : (c) 2013-14 Phil Freeman, (c) 2014 Gary Burgess, and other contributors--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>, Gary Burgess <gary.burgess@gmail.com>--- Stability : experimental--- Portability :------ | The core functional representation+-- |+-- The core functional representation --------------------------------------------------------------------------------- module Language.PureScript.CoreFn ( module C ) where +import Language.PureScript.AST.Literals as C import Language.PureScript.CoreFn.Ann as C import Language.PureScript.CoreFn.Binders as C import Language.PureScript.CoreFn.Desugar as C import Language.PureScript.CoreFn.Expr as C-import Language.PureScript.CoreFn.Literals as C import Language.PureScript.CoreFn.Meta as C import Language.PureScript.CoreFn.Module as C+import Language.PureScript.CoreFn.Optimizer as C import Language.PureScript.CoreFn.Traversals as C
src/Language/PureScript/CoreFn/Ann.hs view
@@ -1,37 +1,24 @@------------------------------------------------------------------------------------ Module : Language.PureScript.CoreFn.Ann--- Copyright : (c) 2013-14 Phil Freeman, (c) 2014 Gary Burgess, and other contributors--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>, Gary Burgess <gary.burgess@gmail.com>--- Stability : experimental--- Portability :------ | Type alias for basic annotations---------------------------------------------------------------------------------- module Language.PureScript.CoreFn.Ann where -import Language.PureScript.AST.SourcePos-import Language.PureScript.CoreFn.Meta-import Language.PureScript.Types-import Language.PureScript.Comments+import Prelude +import Language.PureScript.AST.SourcePos (SourceSpan)+import Language.PureScript.Comments (Comment)+import Language.PureScript.CoreFn.Meta (Meta)+ -- | -- Type alias for basic annotations ---type Ann = (Maybe SourceSpan, [Comment], Maybe Type, Maybe Meta)+type Ann = (SourceSpan, [Comment], Maybe Meta) -- |--- Initial annotation with no metadata+-- An annotation empty of metadata aside from a source span. ---nullAnn :: Ann-nullAnn = (Nothing, [], Nothing, Nothing)+ssAnn :: SourceSpan -> Ann+ssAnn ss = (ss, [], Nothing) -- | -- Remove the comments from an annotation -- removeComments :: Ann -> Ann-removeComments (ss, _, ty, meta) = (ss, [], ty, meta)+removeComments (ss, _, meta) = (ss, [], meta)
src/Language/PureScript/CoreFn/Binders.hs view
@@ -1,26 +1,12 @@------------------------------------------------------------------------------------ Module : Language.PureScript.CoreFn.Binders--- Copyright : (c) 2013-14 Phil Freeman, (c) 2014 Gary Burgess, and other contributors--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>, Gary Burgess <gary.burgess@gmail.com>--- Stability : experimental--- Portability :------ | The core functional representation for binders+-- |+-- The core functional representation for binders ----------------------------------------------------------------------------------{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveFunctor #-}- module Language.PureScript.CoreFn.Binders where -import qualified Data.Data as D+import Prelude -import Language.PureScript.CoreFn.Literals-import Language.PureScript.Names+import Language.PureScript.AST.Literals (Literal)+import Language.PureScript.Names (Ident, ProperName, ProperNameType(..), Qualified) -- | -- Data type for binders@@ -39,10 +25,18 @@ -- | VarBinder a Ident -- |- -- A binder which matches a data constructor (type name, constructor name, binders)+ -- A binder which matches a data constructor --- | ConstructorBinder a (Qualified ProperName) (Qualified ProperName) [Binder a]+ | ConstructorBinder a (Qualified (ProperName 'TypeName)) (Qualified (ProperName 'ConstructorName)) [Binder a] -- | -- A binder which binds its input to an identifier --- | NamedBinder a Ident (Binder a) deriving (Show, D.Data, D.Typeable, Functor)+ | NamedBinder a Ident (Binder a) deriving (Eq, Ord, Show, Functor)+++extractBinderAnn :: Binder a -> a+extractBinderAnn (NullBinder a) = a+extractBinderAnn (LiteralBinder a _) = a+extractBinderAnn (VarBinder a _) = a+extractBinderAnn (ConstructorBinder a _ _ _) = a+extractBinderAnn (NamedBinder a _ _) = a
+ src/Language/PureScript/CoreFn/CSE.hs view
@@ -0,0 +1,442 @@+{-# LANGUAGE TemplateHaskell #-}+-- | This module performs limited common subexpression elimination+module Language.PureScript.CoreFn.CSE (optimizeCommonSubexpressions) where++import Protolude hiding (pass)++import Control.Lens (At(..), makeLenses, non, view, (%~), (.=), (.~), (<>~), (^.))+import Control.Monad.Supply (Supply)+import Control.Monad.Supply.Class (MonadSupply)+import Control.Monad.RWS (MonadWriter, RWST, censor, evalRWST, listen, pass, tell)+import Data.Bitraversable (bitraverse)+import Data.Functor.Compose (Compose(..))+import Data.IntMap.Monoidal qualified as IM+import Data.IntSet qualified as IS+import Data.Map.Strict qualified as M+import Data.Maybe (fromJust)+import Data.Semigroup (Min(..))+import Data.Semigroup.Generic (GenericSemigroupMonoid(..))++import Language.PureScript.AST.Literals (Literal(..))+import Language.PureScript.AST.SourcePos (nullSourceSpan)+import Language.PureScript.Constants.Libs qualified as C+import Language.PureScript.CoreFn.Ann (Ann)+import Language.PureScript.CoreFn.Binders (Binder(..))+import Language.PureScript.CoreFn.Expr (Bind(..), CaseAlternative(..), Expr(..))+import Language.PureScript.CoreFn.Meta (Meta(IsSyntheticApp))+import Language.PureScript.CoreFn.Traversals (everywhereOnValues, traverseCoreFn)+import Language.PureScript.Environment (dictTypeName)+import Language.PureScript.Names (pattern ByNullSourcePos, Ident(..), ModuleName, ProperName(..), Qualified(..), QualifiedBy(..), freshIdent, runIdent, toMaybeModuleName)+import Language.PureScript.PSString (decodeString)++-- |+-- `discuss f m` is an action that listens to the output of `m`, passes that+-- and its value through `f`, and uses (only) the value of the result to set+-- the new value and output. (Any output produced via the monad in `f` is+-- ignored, though other monadic effects will hold.)+--+discuss :: MonadWriter w m => ((a, w) -> m (b, w)) -> m a -> m b+discuss f = pass . fmap (second const) . (f <=< listen)++-- |+-- Modify the target of an optic in the state with a monadic computation that+-- returns some extra information of type `r` in a tuple.+--+-- I would prefer that this be a named function, but I don't know what to name+-- it. I went with symbols instead because the function that this operator most+-- resembles is `(%%=)`, which doesn't have a textual name as far as I know.+-- Compare the following (approximate) types:+--+-- @+-- (%%=) :: MonadState s m => Lens s s a b -> (a -> (r, b)) -> m r+-- (%%<~) :: MonadState s m => Lens s s a b -> (a -> m (r, b)) -> m r+-- @+--+-- Replacing the `=` with `<~` was inspired by analogy with the following pair:+--+-- @+-- (.=) :: MonadState s m => Lens s s a b -> b -> m ()+-- (<~) :: MonadState s m => Lens s s a b -> m b -> m ()+-- @+--+-- I regret any confusion that ensues.+--+-- Note that there are two interpretations that could reasonably be expected+-- for this type.+--+-- @+-- (%%<~) :: MonadState s m => Lens s s a b -> (a -> m (r, b)) -> m r+-- @+--+-- One is:+-- * Get the focused `a` value from the monad+-- * Run the computation+-- * Get the new state from the returned monad+-- * Take the returned `b` value and set it in the new state+--+-- The other is:+-- * Get the focused `a` value from the monad+-- * Run the computation+-- * Take the returned `b` value and set it in the *original* state+-- * Put the result into the returned monad+--+-- This operator corresponds to the second interpretation. The purpose of this,+-- and part of the purpose of having this operator at all instead of composing+-- simpler operators, is to enable using the lens only once (on the original+-- state) instead of twice (for a get and a set on different states).+--+(%%<~)+ :: MonadState s m+ => ((a -> Compose m ((,) r) b) -> s -> Compose m ((,) r) s)+ -- ^ please read as Lens s s a b+ -> (a -> m (r, b))+ -> m r+l %%<~ f = get >>= getCompose . l (Compose . f) >>= state . const+infix 4 %%<~++-- |+-- A PluralityMap is like a weaker multiset: like a multiset, it can hold+-- several of the same value, but instead of keeping track of their exact+-- counts, it only records whether there is one (False) or more than one+-- (True).+--+newtype PluralityMap k = PluralityMap { getPluralityMap :: M.Map k Bool }++instance Ord k => Semigroup (PluralityMap k) where+ PluralityMap l <> PluralityMap r =+ let+ l' = M.mapWithKey (\k -> (|| k `M.member` r)) l+ in PluralityMap $ l' `M.union` r++instance Ord k => Monoid (PluralityMap k) where+ mempty = PluralityMap M.empty++data BindingType = NonRecursive | Recursive deriving Eq++-- |+-- Record summary data about an expression.+--+data CSESummary = CSESummary+ { _scopesUsed :: IS.IntSet+ -- ^ set of the scope numbers used in this expression+ , _noFloatWithin :: Maybe (Min Int)+ -- ^ optionally a scope within which this expression is not to be floated+ -- (because the expression uses an identifier bound recursively in that+ -- scope)+ , _plurality :: PluralityMap Ident+ -- ^ which floated identifiers are used more than once in this expression+ -- (note that a single use inside an Abs will be considered multiple uses,+ -- as this pass doesn't know when/how many times an Abs will be executed)+ , _newBindings :: IM.MonoidalIntMap [(Ident, (PluralityMap Ident, Expr Ann))]+ -- ^ floated bindings, organized by scope number+ , _toBeReinlined :: M.Map Ident (Expr Ann)+ -- ^ a map of floated identifiers that did not end up getting bound and+ -- will need to be reinlined at the end of the pass+ }+ deriving Generic+ deriving (Semigroup, Monoid) via GenericSemigroupMonoid CSESummary++-- |+-- Append a value at a given scope depth.+--+addToScope :: Semigroup v => Int -> v -> IM.MonoidalIntMap v -> IM.MonoidalIntMap v+addToScope depth v+ = IM.alter (Just . maybe v (<> v)) depth++-- |+-- Remove and return an entire scope from a map of bindings.+--+popScope :: Monoid v => Int -> IM.MonoidalIntMap v -> (v, IM.MonoidalIntMap v)+popScope depth+ = first fold . IM.updateLookupWithKey (\_ _ -> Nothing) depth++-- |+-- Describe the context of an expression.+--+data CSEEnvironment = CSEEnvironment+ { _depth :: Int+ -- ^ number of enclosing binding scopes (this includes not only Abs, but+ -- Let and CaseAlternative bindings)+ , _deepestTopLevelScope :: Int+ -- ^ number of enclosing binding scopes outside the first Abs; used to+ -- decide whether to qualify floated identifiers+ , _bound :: M.Map Ident (Int, BindingType)+ -- ^ map from identifiers to depth in which they are bound and whether+ -- or not the binding is recursive+ }++makeLenses ''CSESummary+makeLenses ''CSEEnvironment++-- |+-- Map from the shape of an expression to an identifier created to represent+-- that expression, organized by scope depth.+--+type CSEState = IM.MonoidalIntMap (M.Map (Expr ()) Ident)++-- |+-- The monad in which CSE takes place.+--+type CSEMonad a = RWST CSEEnvironment CSESummary CSEState Supply a++type HasCSEReader = MonadReader CSEEnvironment+type HasCSEWriter = MonadWriter CSESummary+type HasCSEState = MonadState CSEState++-- |+-- Run a CSEMonad computation; the return value is augmented with a map of+-- identifiers that should be replaced in the final expression because they+-- didn't end up needing to be floated.+--+runCSEMonad :: CSEMonad a -> Supply (a, M.Map Ident (Expr Ann))+runCSEMonad x = second (^. toBeReinlined) <$> evalRWST x (CSEEnvironment 0 0 M.empty) IM.empty++-- |+-- Mark all expressions floated out of this computation as "plural". This pass+-- assumes that any given Abs may be invoked multiple times, so any expressions+-- inside the Abs but floated out of it also count as having multiple uses,+-- even if they only appear once within the Abs. Consequently, any expressions+-- that can be floated out of an Abs won't be reinlined at the end.+--+enterAbs :: HasCSEWriter m => m a -> m a+enterAbs = censor $ plurality %~ PluralityMap . fmap (const True) . getPluralityMap++-- |+-- Run the provided computation in a new scope.+--+newScope :: (HasCSEReader m, HasCSEWriter m) => Bool -> (Int -> m a) -> m a+newScope isTopLevel body = local goDeeper $ do+ d <- view depth+ censor (filterToDepth d) (body d)+ where+ filterToDepth d+ = (scopesUsed %~ IS.filter (< d))+ . (noFloatWithin %~ find (< Min d))+ goDeeper env@CSEEnvironment{..} =+ if isTopLevel+ then env{ _depth = depth', _deepestTopLevelScope = depth' }+ else env{ _depth = depth' }+ where+ depth' = succ _depth++-- |+-- Record a list of identifiers as being bound in the given scope.+--+withBoundIdents :: HasCSEReader m => [Ident] -> (Int, BindingType) -> m a -> m a+withBoundIdents idents t = local (bound %~ flip (foldl' (flip (flip M.insert t))) idents)++-- |+-- Run the provided computation in a new scope in which the provided+-- identifiers are bound non-recursively.+--+newScopeWithIdents :: (HasCSEReader m, HasCSEWriter m) => Bool -> [Ident] -> m a -> m a+newScopeWithIdents isTopLevel idents = newScope isTopLevel . flip (withBoundIdents idents . (, NonRecursive))++-- |+-- Produce, or retrieve from the state, an identifier for referencing the given+-- expression, at and below the given depth.+--+generateIdentFor :: (HasCSEState m, MonadSupply m) => Int -> Expr () -> m (Bool, Ident)+generateIdentFor d e = at d . non mempty . at e %%<~ \case+ Nothing -> freshIdent (nameHint e) <&> \ident -> ((True, ident), Just ident)+ Just ident -> pure ((False, ident), Just ident)+ -- A reminder: as with %%=, the first element of the returned pair is the+ -- final result of the expression, and the second element is the value to+ -- stuff back through the lens into the state. (The difference is that %%<~+ -- enables doing monadic work in the RHS, namely `freshIdent` here.)+ where+ nameHint = \case+ App _ v1 v2+ | Var _ n <- v1+ , fmap (ProperName . runIdent) n == fmap dictTypeName C.IsSymbol+ , Literal _ (ObjectLiteral [(_, Abs _ _ (Literal _ (StringLiteral str)))]) <- v2+ , Just decodedStr <- decodeString str+ -> decodedStr <> "IsSymbol"+ | otherwise+ -> nameHint v1+ Var _ (Qualified _ ident)+ | Ident name <- ident -> name+ | GenIdent (Just name) _ <- ident -> name+ Accessor _ prop _+ | Just decodedProp <- decodeString prop -> decodedProp+ _ -> "ref"++nullAnn :: Ann+nullAnn = (nullSourceSpan, [], Nothing)++-- |+-- Use a map to substitute local Vars in a list of Binds.+--+replaceLocals :: M.Map Ident (Expr Ann) -> [Bind Ann] -> [Bind Ann]+replaceLocals m = if M.null m then identity else map f' where+ (f', g', _) = everywhereOnValues identity f identity+ f e@(Var _ (Qualified _ ident)) = maybe e g' $ ident `M.lookup` m+ f e = e++-- |+-- Store in the monad a new binding for the given expression, returning a Var+-- referencing it. The provided CSESummary will be transformed to reflect the+-- replacement.+--+floatExpr+ :: (HasCSEReader m, HasCSEState m, MonadSupply m)+ => QualifiedBy+ -> (Expr Ann, CSESummary)+ -> m (Expr Ann, CSESummary)+floatExpr topLevelQB = \case+ (e, w@CSESummary{ _noFloatWithin = Nothing, .. }) -> do+ let deepestScope = if IS.null _scopesUsed then 0 else IS.findMax _scopesUsed+ (isNew, ident) <- generateIdentFor deepestScope (void e)+ topLevel <- view deepestTopLevelScope+ let qb = if deepestScope > topLevel then ByNullSourcePos else topLevelQB+ let w' = w+ & (if isNew then newBindings %~ addToScope deepestScope [(ident, (_plurality, e))] else identity)+ & plurality .~ PluralityMap (M.singleton ident False)+ pure (Var nullAnn (Qualified qb ident), w')+ (e, w) -> pure (e, w)++-- |+-- Take possession of the Binds intended to be added to the current scope,+-- removing them from the state, and return the list of Binds along with+-- whatever value is returned by the provided computation.+--+getNewBinds+ :: (HasCSEReader m, HasCSEState m, HasCSEWriter m)+ => m a+ -> m ([Bind Ann], a)+getNewBinds =+ discuss $ \(a, w) -> do+ d <- view depth+ at d .= Nothing+ let (floatedHere, w') = newBindings (popScope d) w+ pure $ first (, a) $ foldr handleFloat ([], w') floatedHere+ where+ handleFloat (ident, (p, e)) (bs, w) =+ if fromJust . M.lookup ident . getPluralityMap $ w ^. plurality+ then (NonRec nullAnn ident e : bs, w')+ else (bs, w' & toBeReinlined %~ M.insert ident e)+ where w' = w & plurality <>~ p++-- |+-- Like getNewBinds, but also stores the Binds in a Let wrapping the provided+-- expression. If said expression is already a Let, adds these Binds to that+-- Let instead.+--+getNewBindsAsLet+ :: (HasCSEReader m, HasCSEWriter m, HasCSEState m)+ => m (Expr Ann)+ -> m (Expr Ann)+getNewBindsAsLet = fmap (uncurry go) . getNewBinds where+ go bs = if null bs then identity else \case+ Let a bs' e' -> Let a (bs ++ bs') e'+ e' -> Let nullAnn bs e'++-- |+-- Feed the Writer part of the monad with the requirements of this name.+--+summarizeName+ :: (HasCSEReader m, HasCSEWriter m)+ => ModuleName+ -> Qualified Ident+ -> m ()+summarizeName mn (Qualified mn' ident) = do+ m <- view bound+ let (s, bt) =+ fromMaybe (0, NonRecursive) $+ guard (all (== mn) (toMaybeModuleName mn')) *> ident `M.lookup` m+ tell $ mempty+ & scopesUsed .~ IS.singleton s+ & noFloatWithin .~ (guard (bt == Recursive) $> Min s)++-- |+-- Collect all the Idents put in scope by a list of Binders.+--+identsFromBinders :: [Binder a] -> [Ident]+identsFromBinders = foldMap identsFromBinder where+ identsFromBinder = \case+ LiteralBinder _ (ArrayLiteral xs) -> identsFromBinders xs+ LiteralBinder _ (ObjectLiteral xs) -> identsFromBinders (map snd xs)+ VarBinder _ ident -> [ident]+ ConstructorBinder _ _ _ xs -> identsFromBinders xs+ NamedBinder _ ident x -> ident : identsFromBinder x+ LiteralBinder _ BooleanLiteral{} -> []+ LiteralBinder _ CharLiteral{} -> []+ LiteralBinder _ NumericLiteral{} -> []+ LiteralBinder _ StringLiteral{} -> []+ NullBinder{} -> []++-- |+-- Float synthetic Apps (right now, the only Apps marked as synthetic are type+-- class dictionaries being fed to functions with constraints, superclass+-- accessors, and instances of IsSymbol) to a new or existing Let as close to+-- the top level as possible.+--+optimizeCommonSubexpressions :: ModuleName -> [Bind Ann] -> Supply [Bind Ann]+optimizeCommonSubexpressions mn+ = fmap (uncurry (flip replaceLocals))+ . runCSEMonad+ . fmap (uncurry (++))+ . getNewBinds+ . fmap fst+ . handleBinds True (pure ())++ where++ -- This is the one place (I think?) that keeps this from being a general+ -- common subexpression elimination pass.+ shouldFloatExpr :: Expr Ann -> Bool+ shouldFloatExpr = \case+ App (_, _, Just IsSyntheticApp) e _ -> isSimple e+ _ -> False++ isSimple :: Expr Ann -> Bool+ isSimple = \case+ Var{} -> True+ Accessor _ _ e -> isSimple e+ _ -> False++ handleAndWrapExpr :: Expr Ann -> CSEMonad (Expr Ann)+ handleAndWrapExpr = getNewBindsAsLet . handleExpr++ (handleBind, handleExprDefault, handleBinder, _) = traverseCoreFn handleBind handleExpr handleBinder handleCaseAlternative++ topLevelQB = ByModuleName mn++ handleExpr :: Expr Ann -> CSEMonad (Expr Ann)+ handleExpr = discuss (ifM (shouldFloatExpr . fst) (floatExpr topLevelQB) pure) . \case+ Abs a ident e -> enterAbs $ Abs a ident <$> newScopeWithIdents False [ident] (handleAndWrapExpr e)+ v@(Var _ qname) -> summarizeName mn qname $> v+ Let a bs e -> uncurry (Let a) <$> handleBinds False (handleExpr e) bs+ x -> handleExprDefault x++ handleCaseAlternative :: CaseAlternative Ann -> CSEMonad (CaseAlternative Ann)+ handleCaseAlternative (CaseAlternative bs x) = CaseAlternative bs <$> do+ newScopeWithIdents False (identsFromBinders bs) $+ bitraverse (traverse $ bitraverse handleAndWrapExpr handleAndWrapExpr) handleAndWrapExpr x++ handleBinds :: forall a. Bool -> CSEMonad a -> [Bind Ann] -> CSEMonad ([Bind Ann], a)+ handleBinds isTopLevel = foldr go . fmap pure where+ go :: Bind Ann -> CSEMonad ([Bind Ann], a) -> CSEMonad ([Bind Ann], a)+ go b inner = case b of+ -- For a NonRec Bind, traverse the bound expression in the current scope+ -- and then create a new scope for any remaining Binds and/or whatever+ -- inner thing all these Binds are applied to.+ NonRec a ident e -> do+ e' <- handleExpr e+ newScopeWithIdents isTopLevel [ident] $+ prependToNewBindsFromInner $ NonRec a ident e'+ Rec es ->+ -- For a Rec Bind, the bound expressions need a new scope in which all+ -- these identifiers are bound recursively; then the remaining Binds+ -- and the inner thing can be traversed in the same scope with the same+ -- identifiers now bound non-recursively.+ newScope isTopLevel $ \d -> do+ let idents = map (snd . fst) es+ es' <- withBoundIdents idents (d, Recursive) $ traverse (traverse handleExpr) es+ withBoundIdents idents (d, NonRecursive) $+ prependToNewBindsFromInner $ Rec es'++ where++ prependToNewBindsFromInner :: Bind Ann -> CSEMonad ([Bind Ann], a)+ prependToNewBindsFromInner hd = first (hd :) . join <$> getNewBinds inner
src/Language/PureScript/CoreFn/Desugar.hs view
@@ -1,175 +1,203 @@------------------------------------------------------------------------------------ Module : Language.PureScript.CoreFn.Desugar--- Copyright : (c) 2013-14 Phil Freeman, (c) 2014 Gary Burgess, and other contributors--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>, Gary Burgess <gary.burgess@gmail.com>--- Stability : experimental--- Portability :------ | The AST -> CoreFn desugaring step---------------------------------------------------------------------------------- module Language.PureScript.CoreFn.Desugar (moduleToCoreFn) where +import Prelude+import Protolude (ordNub, orEmpty)++import Control.Arrow (second)+ import Data.Function (on)-import Data.List (sort, sortBy, nub) import Data.Maybe (mapMaybe)-import qualified Data.Map as M--import Control.Arrow (second, (***))+import Data.Tuple (swap)+import Data.List.NonEmpty qualified as NEL+import Data.Map qualified as M -import Language.PureScript.AST.SourcePos-import Language.PureScript.AST.Traversals-import Language.PureScript.CoreFn.Ann-import Language.PureScript.CoreFn.Binders-import Language.PureScript.CoreFn.Expr-import Language.PureScript.CoreFn.Literals-import Language.PureScript.CoreFn.Meta-import Language.PureScript.CoreFn.Module-import Language.PureScript.Environment-import Language.PureScript.Names-import Language.PureScript.Sugar.TypeClasses (typeClassMemberName, superClassDictionaryNames)-import Language.PureScript.Types-import Language.PureScript.Comments-import qualified Language.PureScript.AST as A+import Language.PureScript.AST.Literals (Literal(..))+import Language.PureScript.AST.SourcePos (pattern NullSourceSpan, SourceSpan(..))+import Language.PureScript.AST.Traversals (everythingOnValues)+import Language.PureScript.Comments (Comment)+import Language.PureScript.CoreFn.Ann (Ann, ssAnn)+import Language.PureScript.CoreFn.Binders (Binder(..))+import Language.PureScript.CoreFn.Expr (Bind(..), CaseAlternative(..), Expr(..), Guard)+import Language.PureScript.CoreFn.Meta (ConstructorType(..), Meta(..))+import Language.PureScript.CoreFn.Module (Module(..))+import Language.PureScript.Crash (internalError)+import Language.PureScript.Environment (DataDeclType(..), Environment(..), NameKind(..), isDictTypeName, lookupConstructor, lookupValue)+import Language.PureScript.Label (Label(..))+import Language.PureScript.Names (pattern ByNullSourcePos, Ident(..), ModuleName, ProperName(..), ProperNameType(..), Qualified(..), QualifiedBy(..), getQual)+import Language.PureScript.PSString (PSString)+import Language.PureScript.Types (pattern REmptyKinded, SourceType, Type(..))+import Language.PureScript.AST qualified as A+import Language.PureScript.Constants.Prim qualified as C --- |--- Desugars a module from AST to CoreFn representation.---+-- | Desugars a module from AST to CoreFn representation. moduleToCoreFn :: Environment -> A.Module -> Module Ann-moduleToCoreFn _ (A.Module _ _ _ Nothing) =- error "Module exports were not elaborated before moduleToCoreFn"-moduleToCoreFn env (A.Module coms mn decls (Just exps)) =- let imports = nub $ mapMaybe importToCoreFn decls ++ findQualModules decls- exps' = nub $ concatMap exportToCoreFn exps- externs = nub $ mapMaybe externToCoreFn decls- decls' = concatMap (declToCoreFn Nothing []) decls- in Module coms mn imports exps' externs decls'-+moduleToCoreFn _ (A.Module _ _ _ _ Nothing) =+ internalError "Module exports were not elaborated before moduleToCoreFn"+moduleToCoreFn env (A.Module modSS coms mn decls (Just exps)) =+ let imports = mapMaybe importToCoreFn decls ++ fmap (ssAnn modSS,) (findQualModules decls)+ imports' = dedupeImports imports+ exps' = ordNub $ concatMap exportToCoreFn exps+ reExps = M.map ordNub $ M.unionsWith (++) (mapMaybe (fmap reExportsToCoreFn . toReExportRef) exps)+ externs = ordNub $ mapMaybe externToCoreFn decls+ decls' = concatMap declToCoreFn decls+ in Module modSS coms mn (spanName modSS) imports' exps' reExps externs decls' where+ -- Creates a map from a module name to the re-export references defined in+ -- that module.+ reExportsToCoreFn :: (ModuleName, A.DeclarationRef) -> M.Map ModuleName [Ident]+ reExportsToCoreFn (mn', ref') = M.singleton mn' (exportToCoreFn ref') - -- |+ toReExportRef :: A.DeclarationRef -> Maybe (ModuleName, A.DeclarationRef)+ toReExportRef (A.ReExportRef _ src ref) =+ fmap+ (, ref)+ (A.exportSourceImportedFrom src)+ toReExportRef _ = Nothing++ -- Remove duplicate imports+ dedupeImports :: [(Ann, ModuleName)] -> [(Ann, ModuleName)]+ dedupeImports = fmap swap . M.toList . M.fromListWith const . fmap swap++ ssA :: SourceSpan -> Ann+ ssA ss = (ss, [], Nothing)+ -- Desugars member declarations from AST to CoreFn representation.- --- declToCoreFn :: Maybe SourceSpan -> [Comment] -> A.Declaration -> [Bind Ann]- declToCoreFn ss com (A.DataDeclaration Newtype _ _ [(ctor, _)]) =- [NonRec (properToIdent ctor) $- Abs (ss, com, Nothing, Just IsNewtype) (Ident "x") (Var nullAnn $ Qualified Nothing (Ident "x"))]- declToCoreFn _ _ d@(A.DataDeclaration Newtype _ _ _) =+ declToCoreFn :: A.Declaration -> [Bind Ann]+ declToCoreFn (A.DataDeclaration (ss, com) Newtype _ _ [ctor]) =+ [NonRec (ss, [], declMeta) (properToIdent $ A.dataCtorName ctor) $+ Abs (ss, com, Just IsNewtype) (Ident "x") (Var (ssAnn ss) $ Qualified ByNullSourcePos (Ident "x"))]+ where+ declMeta = isDictTypeName (A.dataCtorName ctor) `orEmpty` IsTypeClassConstructor+ declToCoreFn d@(A.DataDeclaration _ Newtype _ _ _) = error $ "Found newtype with multiple constructors: " ++ show d- declToCoreFn ss com (A.DataDeclaration Data tyName _ ctors) =- flip map ctors $ \(ctor, _) ->- let (_, _, _, fields) = lookupConstructor env (Qualified (Just mn) ctor)- in NonRec (properToIdent ctor) $ Constructor (ss, com, Nothing, Nothing) tyName ctor fields- declToCoreFn ss _ (A.DataBindingGroupDeclaration ds) = concatMap (declToCoreFn ss []) ds- declToCoreFn ss com (A.ValueDeclaration name _ _ (Right e)) =- [NonRec name (exprToCoreFn ss com Nothing e)]- declToCoreFn ss _ (A.BindingGroupDeclaration ds) =- [Rec $ map (\(name, _, e) -> (name, exprToCoreFn ss [] Nothing e)) ds]- declToCoreFn ss com (A.TypeClassDeclaration name _ supers members) =- [NonRec (properToIdent name) $ mkTypeClassConstructor ss com supers members]- declToCoreFn _ com (A.PositionedDeclaration ss com1 d) =- declToCoreFn (Just ss) (com ++ com1) d- declToCoreFn _ _ _ = []+ declToCoreFn (A.DataDeclaration (ss, com) Data tyName _ ctors) =+ flip fmap ctors $ \ctorDecl ->+ let+ ctor = A.dataCtorName ctorDecl+ (_, _, _, fields) = lookupConstructor env (Qualified (ByModuleName mn) ctor)+ in NonRec (ssA ss) (properToIdent ctor) $ Constructor (ss, com, Nothing) tyName ctor fields+ declToCoreFn (A.DataBindingGroupDeclaration ds) =+ concatMap declToCoreFn ds+ declToCoreFn (A.ValueDecl (ss, com) name _ _ [A.MkUnguarded e]) =+ [NonRec (ssA ss) name (exprToCoreFn ss com Nothing e)]+ declToCoreFn (A.BindingGroupDeclaration ds) =+ [Rec . NEL.toList $ fmap (\(((ss, com), name), _, e) -> ((ssA ss, name), exprToCoreFn ss com Nothing e)) ds]+ declToCoreFn _ = [] - -- | -- Desugars expressions from AST to CoreFn representation.- --- exprToCoreFn :: Maybe SourceSpan -> [Comment] -> Maybe Type -> A.Expr -> Expr Ann- exprToCoreFn ss com ty (A.NumericLiteral v) =- Literal (ss, com, ty, Nothing) (NumericLiteral v)- exprToCoreFn ss com ty (A.StringLiteral v) =- Literal (ss, com, ty, Nothing) (StringLiteral v)- exprToCoreFn ss com ty (A.BooleanLiteral v) =- Literal (ss, com, ty, Nothing) (BooleanLiteral v)- exprToCoreFn ss com ty (A.ArrayLiteral vs) =- Literal (ss, com, ty, Nothing) (ArrayLiteral $ map (exprToCoreFn ss [] Nothing) vs)- exprToCoreFn ss com ty (A.ObjectLiteral vs) =- Literal (ss, com, ty, Nothing) (ObjectLiteral $ map (second (exprToCoreFn ss [] Nothing)) vs)- exprToCoreFn ss com ty (A.Accessor name v) =- Accessor (ss, com, ty, Nothing) name (exprToCoreFn ss [] Nothing v)+ exprToCoreFn :: SourceSpan -> [Comment] -> Maybe SourceType -> A.Expr -> Expr Ann+ exprToCoreFn _ com _ (A.Literal ss lit) =+ Literal (ss, com, Nothing) (fmap (exprToCoreFn ss com Nothing) lit)+ exprToCoreFn ss com _ (A.Accessor name v) =+ Accessor (ss, com, Nothing) name (exprToCoreFn ss [] Nothing v) exprToCoreFn ss com ty (A.ObjectUpdate obj vs) =- ObjectUpdate (ss, com, ty, Nothing) (exprToCoreFn ss [] Nothing obj) $ map (second (exprToCoreFn ss [] Nothing)) vs- exprToCoreFn ss com ty (A.Abs (Left name) v) =- Abs (ss, com, ty, Nothing) name (exprToCoreFn ss [] Nothing v)+ ObjectUpdate (ss, com, Nothing) (exprToCoreFn ss [] Nothing obj) (ty >>= unchangedRecordFields (fmap fst vs)) $ fmap (second (exprToCoreFn ss [] Nothing)) vs+ where+ -- Return the unchanged labels of a closed record, or Nothing for other types or open records.+ unchangedRecordFields :: [PSString] -> Type a -> Maybe [PSString]+ unchangedRecordFields updated (TypeApp _ (TypeConstructor _ C.Record) row) =+ collect row+ where+ collect :: Type a -> Maybe [PSString]+ collect (REmptyKinded _ _) = Just []+ collect (RCons _ (Label l) _ r) = (if l `elem` updated then id else (l :)) <$> collect r+ collect _ = Nothing+ unchangedRecordFields _ _ = Nothing+ exprToCoreFn ss com _ (A.Abs (A.VarBinder _ name) v) =+ Abs (ss, com, Nothing) name (exprToCoreFn ss [] Nothing v) exprToCoreFn _ _ _ (A.Abs _ _) =- error "Abs with Binder argument was not desugared before exprToCoreFn mn"- exprToCoreFn ss com ty (A.App v1 v2) =- App (ss, com, ty, Nothing) (exprToCoreFn ss [] Nothing v1) (exprToCoreFn ss [] Nothing v2)- exprToCoreFn ss com ty (A.Var ident) =- Var (ss, com, ty, Nothing) ident- exprToCoreFn ss com ty (A.IfThenElse v1 v2 v3) =- Case (ss, com, ty, Nothing) [exprToCoreFn ss [] Nothing v1]- [ CaseAlternative [LiteralBinder nullAnn $ BooleanLiteral True]- (Right $ exprToCoreFn Nothing [] Nothing v2)- , CaseAlternative [LiteralBinder nullAnn $ BooleanLiteral False]- (Right $ exprToCoreFn Nothing [] Nothing v3) ]- exprToCoreFn ss com ty (A.Constructor name) =- Var (ss, com, ty, Just $ getConstructorMeta name) $ fmap properToIdent name- exprToCoreFn ss com ty (A.Case vs alts) =- Case (ss, com, ty, Nothing) (map (exprToCoreFn ss [] Nothing) vs) (map (altToCoreFn ss) alts)+ internalError "Abs with Binder argument was not desugared before exprToCoreFn mn"+ exprToCoreFn ss com _ (A.App v1 v2) =+ App (ss, com, (isDictCtor v1 || isSynthetic v2) `orEmpty` IsSyntheticApp) v1' v2'+ where+ v1' = exprToCoreFn ss [] Nothing v1+ v2' = exprToCoreFn ss [] Nothing v2+ isDictCtor = \case+ A.Constructor _ (Qualified _ name) -> isDictTypeName name+ _ -> False+ isSynthetic = \case+ A.App v3 v4 -> isDictCtor v3 || isSynthetic v3 && isSynthetic v4+ A.Accessor _ v3 -> isSynthetic v3+ A.Var NullSourceSpan _ -> True+ A.Unused{} -> True+ _ -> False+ exprToCoreFn ss com _ (A.Unused _) =+ Var (ss, com, Nothing) C.I_undefined+ exprToCoreFn _ com _ (A.Var ss ident) =+ Var (ss, com, getValueMeta ident) ident+ exprToCoreFn ss com _ (A.IfThenElse v1 v2 v3) =+ Case (ss, com, Nothing) [exprToCoreFn ss [] Nothing v1]+ [ CaseAlternative [LiteralBinder (ssAnn ss) $ BooleanLiteral True]+ (Right $ exprToCoreFn ss [] Nothing v2)+ , CaseAlternative [NullBinder (ssAnn ss)]+ (Right $ exprToCoreFn ss [] Nothing v3) ]+ exprToCoreFn _ com _ (A.Constructor ss name) =+ Var (ss, com, Just $ getConstructorMeta name) $ fmap properToIdent name+ exprToCoreFn ss com _ (A.Case vs alts) =+ Case (ss, com, Nothing) (fmap (exprToCoreFn ss [] Nothing) vs) (fmap (altToCoreFn ss) alts) exprToCoreFn ss com _ (A.TypedValue _ v ty) = exprToCoreFn ss com (Just ty) v- exprToCoreFn ss com ty (A.Let ds v) =- Let (ss, com, ty, Nothing) (concatMap (declToCoreFn ss []) ds) (exprToCoreFn ss [] Nothing v)- exprToCoreFn ss com _ (A.TypeClassDictionaryConstructorApp name (A.TypedValue _ (A.ObjectLiteral vs) _)) =- let args = map (exprToCoreFn ss [] Nothing . snd) $ sortBy (compare `on` fst) vs- ctor = Var (ss, [], Nothing, Just IsTypeClassConstructor) (fmap properToIdent name)- in foldl (App (ss, com, Nothing, Nothing)) ctor args- exprToCoreFn ss com ty (A.TypeClassDictionaryAccessor _ ident) =- Abs (ss, com, ty, Nothing) (Ident "dict")- (Accessor nullAnn (runIdent ident) (Var nullAnn $ Qualified Nothing (Ident "dict")))+ exprToCoreFn ss com _ (A.Let w ds v) =+ Let (ss, com, getLetMeta w) (concatMap declToCoreFn ds) (exprToCoreFn ss [] Nothing v) exprToCoreFn _ com ty (A.PositionedValue ss com1 v) =- exprToCoreFn (Just ss) (com ++ com1) ty v+ exprToCoreFn ss (com ++ com1) ty v exprToCoreFn _ _ _ e = error $ "Unexpected value in exprToCoreFn mn: " ++ show e - -- | -- Desugars case alternatives from AST to CoreFn representation.- --- altToCoreFn :: Maybe SourceSpan -> A.CaseAlternative -> CaseAlternative Ann+ altToCoreFn :: SourceSpan -> A.CaseAlternative -> CaseAlternative Ann altToCoreFn ss (A.CaseAlternative bs vs) = CaseAlternative (map (binderToCoreFn ss []) bs) (go vs) where- go :: Either [(A.Guard, A.Expr)] A.Expr -> Either [(Guard Ann, Expr Ann)] (Expr Ann)- go (Left ges) = Left $ map (exprToCoreFn ss [] Nothing *** exprToCoreFn ss [] Nothing) ges- go (Right e) = Right (exprToCoreFn ss [] Nothing e)+ go :: [A.GuardedExpr] -> Either [(Guard Ann, Expr Ann)] (Expr Ann)+ go [A.MkUnguarded e]+ = Right (exprToCoreFn ss [] Nothing e)+ go gs+ = Left [ (exprToCoreFn ss [] Nothing cond, exprToCoreFn ss [] Nothing e)+ | A.GuardedExpr g e <- gs+ , let cond = guardToExpr g+ ] - -- |+ guardToExpr [A.ConditionGuard cond] = cond+ guardToExpr _ = internalError "Guard not correctly desugared"+ -- Desugars case binders from AST to CoreFn representation.- --- binderToCoreFn :: Maybe SourceSpan -> [Comment] -> A.Binder -> Binder Ann- binderToCoreFn ss com (A.NullBinder) =- NullBinder (ss, com, Nothing, Nothing)- binderToCoreFn ss com (A.BooleanBinder b) =- LiteralBinder (ss, com, Nothing, Nothing) (BooleanLiteral b)- binderToCoreFn ss com (A.StringBinder s) =- LiteralBinder (ss, com, Nothing, Nothing) (StringLiteral s)- binderToCoreFn ss com (A.NumberBinder n) =- LiteralBinder (ss, com, Nothing, Nothing) (NumericLiteral n)- binderToCoreFn ss com (A.VarBinder name) =- VarBinder (ss, com, Nothing, Nothing) name- binderToCoreFn ss com (A.ConstructorBinder dctor@(Qualified mn' _) bs) =+ binderToCoreFn :: SourceSpan -> [Comment] -> A.Binder -> Binder Ann+ binderToCoreFn _ com (A.LiteralBinder ss lit) =+ LiteralBinder (ss, com, Nothing) (fmap (binderToCoreFn ss com) lit)+ binderToCoreFn ss com A.NullBinder =+ NullBinder (ss, com, Nothing)+ binderToCoreFn _ com (A.VarBinder ss name) =+ VarBinder (ss, com, Nothing) name+ binderToCoreFn _ com (A.ConstructorBinder ss dctor@(Qualified mn' _) bs) = let (_, tctor, _, _) = lookupConstructor env dctor- in ConstructorBinder (ss, com, Nothing, Just $ getConstructorMeta dctor) (Qualified mn' tctor) dctor (map (binderToCoreFn ss []) bs)- binderToCoreFn ss com (A.ObjectBinder bs) =- LiteralBinder (ss, com, Nothing, Nothing) (ObjectLiteral $ map (second (binderToCoreFn ss [])) bs)- binderToCoreFn ss com (A.ArrayBinder bs) =- LiteralBinder (ss, com, Nothing, Nothing) (ArrayLiteral $ map (binderToCoreFn ss []) bs)- binderToCoreFn ss com (A.ConsBinder b1 b2) =- let arrCtor = Qualified (Just $ ModuleName [ProperName "Prim"]) (ProperName "Array")- in ConstructorBinder (ss, com, Nothing, Nothing) arrCtor arrCtor $ map (binderToCoreFn ss []) [b1, b2]- binderToCoreFn ss com (A.NamedBinder name b) =- NamedBinder (ss, com, Nothing, Nothing) name (binderToCoreFn ss [] b)+ in ConstructorBinder (ss, com, Just $ getConstructorMeta dctor) (Qualified mn' tctor) dctor (fmap (binderToCoreFn ss []) bs)+ binderToCoreFn _ com (A.NamedBinder ss name b) =+ NamedBinder (ss, com, Nothing) name (binderToCoreFn ss [] b) binderToCoreFn _ com (A.PositionedBinder ss com1 b) =- binderToCoreFn (Just ss) (com ++ com1) b+ binderToCoreFn ss (com ++ com1) b+ binderToCoreFn ss com (A.TypedBinder _ b) =+ binderToCoreFn ss com b+ binderToCoreFn _ _ A.OpBinder{} =+ internalError "OpBinder should have been desugared before binderToCoreFn"+ binderToCoreFn _ _ A.BinaryNoParensBinder{} =+ internalError "BinaryNoParensBinder should have been desugared before binderToCoreFn"+ binderToCoreFn _ _ A.ParensInBinder{} =+ internalError "ParensInBinder should have been desugared before binderToCoreFn" - -- |+ -- Gets metadata for let bindings.+ getLetMeta :: A.WhereProvenance -> Maybe Meta+ getLetMeta A.FromWhere = Just IsWhere+ getLetMeta A.FromLet = Nothing++ -- Gets metadata for values.+ getValueMeta :: Qualified Ident -> Maybe Meta+ getValueMeta name =+ case lookupValue env name of+ Just (_, External, _) -> Just IsForeign+ _ -> Nothing+ -- Gets metadata for data constructors.- --- getConstructorMeta :: Qualified ProperName -> Meta+ getConstructorMeta :: Qualified (ProperName 'ConstructorName) -> Meta getConstructorMeta ctor = case lookupConstructor env ctor of (Newtype, _, _, _) -> IsNewtype@@ -177,78 +205,68 @@ let constructorType = if numConstructors (ctor, dc) == 1 then ProductType else SumType in IsConstructor constructorType fields where- numConstructors :: (Qualified ProperName, (DataDeclType, ProperName, Type, [Ident])) -> Int++ numConstructors+ :: (Qualified (ProperName 'ConstructorName), (DataDeclType, ProperName 'TypeName, SourceType, [Ident]))+ -> Int numConstructors ty = length $ filter (((==) `on` typeConstructor) ty) $ M.toList $ dataConstructors env- typeConstructor :: (Qualified ProperName, (DataDeclType, ProperName, Type, [Ident])) -> (ModuleName, ProperName)- typeConstructor (Qualified (Just mn') _, (_, tyCtor, _, _)) = (mn', tyCtor)- typeConstructor _ = error "Invalid argument to typeConstructor" --- |--- Find module names from qualified references to values. This is used to+ typeConstructor+ :: (Qualified (ProperName 'ConstructorName), (DataDeclType, ProperName 'TypeName, SourceType, [Ident]))+ -> (ModuleName, ProperName 'TypeName)+ typeConstructor (Qualified (ByModuleName mn') _, (_, tyCtor, _, _)) = (mn', tyCtor)+ typeConstructor _ = internalError "Invalid argument to typeConstructor"++-- | Find module names from qualified references to values. This is used to -- ensure instances are imported from any module that is referenced by the -- current module, not just from those that are imported explicitly (#667).--- findQualModules :: [A.Declaration] -> [ModuleName] findQualModules decls =- let (f, _, _, _, _) = everythingOnValues (++) (const []) fqValues fqBinders (const []) (const [])+ let (f, _, _, _, _) = everythingOnValues (++) fqDecls fqValues fqBinders (const []) (const []) in f `concatMap` decls where+ fqDecls :: A.Declaration -> [ModuleName]+ fqDecls (A.TypeInstanceDeclaration _ _ _ _ _ _ q _ _) = getQual' q+ fqDecls (A.ValueFixityDeclaration _ _ q _) = getQual' q+ fqDecls (A.TypeFixityDeclaration _ _ q _) = getQual' q+ fqDecls _ = []+ fqValues :: A.Expr -> [ModuleName]- fqValues (A.Var (Qualified (Just mn) _)) = [mn]- fqValues (A.Constructor (Qualified (Just mn) _)) = [mn]+ fqValues (A.Var _ q) = getQual' q+ fqValues (A.Constructor _ q) = getQual' q fqValues _ = []- + fqBinders :: A.Binder -> [ModuleName]- fqBinders (A.ConstructorBinder (Qualified (Just mn) _) _) = [mn]+ fqBinders (A.ConstructorBinder _ q _) = getQual' q fqBinders _ = [] --- |--- Desugars import declarations from AST to CoreFn representation.----importToCoreFn :: A.Declaration -> Maybe ModuleName-importToCoreFn (A.ImportDeclaration name _ _) = Just name-importToCoreFn (A.PositionedDeclaration _ _ d) = importToCoreFn d+ getQual' :: Qualified a -> [ModuleName]+ getQual' = maybe [] return . getQual++-- | Desugars import declarations from AST to CoreFn representation.+importToCoreFn :: A.Declaration -> Maybe (Ann, ModuleName)+importToCoreFn (A.ImportDeclaration (ss, com) name _ _) = Just ((ss, com, Nothing), name) importToCoreFn _ = Nothing --- |--- Desugars foreign declarations from AST to CoreFn representation.----externToCoreFn :: A.Declaration -> Maybe ForeignDecl-externToCoreFn (A.ExternDeclaration _ name js ty) = Just (name, js, ty)-externToCoreFn (A.ExternInstanceDeclaration name _ _ _) = Just (name, Nothing, tyObject)-externToCoreFn (A.PositionedDeclaration _ _ d) = externToCoreFn d+-- | Desugars foreign declarations from AST to CoreFn representation.+externToCoreFn :: A.Declaration -> Maybe Ident+externToCoreFn (A.ExternDeclaration _ name _) = Just name externToCoreFn _ = Nothing --- |--- Desugars export declarations references from AST to CoreFn representation.--- CoreFn modules only export values, so all data constructors, class--- constructor, instances and values are flattened into one list.---+-- | Desugars export declarations references from AST to CoreFn representation.+-- CoreFn modules only export values, so all data constructors, instances and+-- values are flattened into one list. exportToCoreFn :: A.DeclarationRef -> [Ident]-exportToCoreFn (A.TypeRef _ (Just dctors)) = map properToIdent dctors-exportToCoreFn (A.ValueRef name) = [name]-exportToCoreFn (A.TypeClassRef name) = [properToIdent name]-exportToCoreFn (A.TypeInstanceRef name) = [name]-exportToCoreFn (A.PositionedDeclarationRef _ _ d) = exportToCoreFn d-exportToCoreFn _ = []---- |--- Makes a typeclass dictionary constructor function. The returned expression--- is a function that accepts the superclass instances and member--- implementations and returns a record for the instance dictionary.----mkTypeClassConstructor :: Maybe SourceSpan -> [Comment] -> [Constraint] -> [A.Declaration] -> Expr Ann-mkTypeClassConstructor ss com [] [] = Literal (ss, com, Nothing, Just IsTypeClassConstructor) (ObjectLiteral [])-mkTypeClassConstructor ss com supers members =- let args@(a:as) = sort $ map typeClassMemberName members ++ superClassDictionaryNames supers- props = [ (arg, Var nullAnn $ Qualified Nothing (Ident arg)) | arg <- args ]- dict = Literal nullAnn (ObjectLiteral props)- in Abs (ss, com, Nothing, Just IsTypeClassConstructor)- (Ident a)- (foldr (Abs nullAnn . Ident) dict as)+exportToCoreFn (A.TypeRef _ _ (Just dctors)) = fmap properToIdent dctors+exportToCoreFn (A.TypeRef _ _ Nothing) = []+exportToCoreFn (A.TypeOpRef _ _) = []+exportToCoreFn (A.ValueRef _ name) = [name]+exportToCoreFn (A.ValueOpRef _ _) = []+exportToCoreFn (A.TypeClassRef _ _) = []+exportToCoreFn (A.TypeInstanceRef _ name _) = [name]+exportToCoreFn (A.ModuleRef _ _) = []+exportToCoreFn (A.ReExportRef _ _ _) = [] --- |--- Converts a ProperName to an Ident.----properToIdent :: ProperName -> Ident+-- | Converts a ProperName to an Ident.+properToIdent :: ProperName a -> Ident properToIdent = Ident . runProperName
src/Language/PureScript/CoreFn/Expr.hs view
@@ -1,29 +1,16 @@------------------------------------------------------------------------------------ Module : Language.PureScript.CoreFn.Expr--- Copyright : (c) 2013-14 Phil Freeman, (c) 2014 Gary Burgess, and other contributors--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>, Gary Burgess <gary.burgess@gmail.com>--- Stability : experimental--- Portability :------ | The core functional representation+-- |+-- The core functional representation ----------------------------------------------------------------------------------{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveFunctor #-}- module Language.PureScript.CoreFn.Expr where -import Control.Arrow ((***))+import Prelude -import qualified Data.Data as D+import Control.Arrow ((***)) -import Language.PureScript.CoreFn.Binders-import Language.PureScript.CoreFn.Literals-import Language.PureScript.Names+import Language.PureScript.AST.Literals (Literal)+import Language.PureScript.CoreFn.Binders (Binder)+import Language.PureScript.Names (Ident, ProperName, ProperNameType(..), Qualified)+import Language.PureScript.PSString (PSString) -- | -- Data type for expressions and terms@@ -36,15 +23,15 @@ -- | -- A data constructor (type name, constructor name, field names) --- | Constructor a ProperName ProperName [Ident]+ | Constructor a (ProperName 'TypeName) (ProperName 'ConstructorName) [Ident] -- | -- A record property accessor --- | Accessor a String (Expr a)+ | Accessor a PSString (Expr a) -- |- -- Partial record update+ -- Partial record update (original value, fields to copy (if known), fields to update) --- | ObjectUpdate a (Expr a) [(String, Expr a)]+ | ObjectUpdate a (Expr a) (Maybe [PSString]) [(PSString, Expr a)] -- | -- Function introduction --@@ -64,7 +51,8 @@ -- | -- A let binding --- | Let a [Bind a] (Expr a) deriving (Show, D.Data, D.Typeable, Functor)+ | Let a [Bind a] (Expr a)+ deriving (Eq, Ord, Show, Functor) -- | -- A let or module binding.@@ -73,11 +61,11 @@ -- | -- Non-recursive binding for a single value --- = NonRec Ident (Expr a)+ = NonRec a Ident (Expr a) -- | -- Mutually recursive binding group for several values --- | Rec [(Ident, Expr a)] deriving (Show, D.Data, D.Typeable, Functor)+ | Rec [((a, Ident), Expr a)] deriving (Eq, Ord, Show, Functor) -- | -- A guard is just a boolean-valued expression that appears alongside a set of binders@@ -96,12 +84,12 @@ -- The result expression or a collect of guarded expressions -- , caseAlternativeResult :: Either [(Guard a, Expr a)] (Expr a)- } deriving (Show, D.Data, D.Typeable)+ } deriving (Eq, Ord, Show) instance Functor CaseAlternative where fmap f (CaseAlternative cabs car) = CaseAlternative- (fmap (fmap f) $ cabs)+ (fmap (fmap f) cabs) (either (Left . fmap (fmap f *** fmap f)) (Right . fmap f) car) -- |@@ -111,7 +99,7 @@ extractAnn (Literal a _) = a extractAnn (Constructor a _ _ _) = a extractAnn (Accessor a _ _) = a-extractAnn (ObjectUpdate a _ _) = a+extractAnn (ObjectUpdate a _ _ _) = a extractAnn (Abs a _ _) = a extractAnn (App a _ _) = a extractAnn (Var a _) = a@@ -123,12 +111,12 @@ -- Modify the annotation on a term -- modifyAnn :: (a -> a) -> Expr a -> Expr a-modifyAnn f (Literal a b) = Literal (f a) b-modifyAnn f (Constructor a b c d) = Constructor (f a) b c d-modifyAnn f (Accessor a b c) = Accessor (f a) b c-modifyAnn f (ObjectUpdate a b c) = ObjectUpdate (f a) b c-modifyAnn f (Abs a b c) = Abs (f a) b c-modifyAnn f (App a b c) = App (f a) b c-modifyAnn f (Var a b) = Var (f a) b-modifyAnn f (Case a b c) = Case (f a) b c-modifyAnn f (Let a b c) = Let (f a) b c+modifyAnn f (Literal a b) = Literal (f a) b+modifyAnn f (Constructor a b c d) = Constructor (f a) b c d+modifyAnn f (Accessor a b c) = Accessor (f a) b c+modifyAnn f (ObjectUpdate a b c d) = ObjectUpdate (f a) b c d+modifyAnn f (Abs a b c) = Abs (f a) b c+modifyAnn f (App a b c) = App (f a) b c+modifyAnn f (Var a b) = Var (f a) b+modifyAnn f (Case a b c) = Case (f a) b c+modifyAnn f (Let a b c) = Let (f a) b c
+ src/Language/PureScript/CoreFn/FromJSON.hs view
@@ -0,0 +1,319 @@+-- |+-- Read the core functional representation from JSON format+--++module Language.PureScript.CoreFn.FromJSON+ ( moduleFromJSON+ , parseVersion'+ ) where++import Prelude++import Control.Applicative ((<|>))++import Data.Aeson (FromJSON(..), Object, Value(..), withObject, withText, (.:))+import Data.Aeson.Types (Parser, listParser)+import Data.Map.Strict qualified as M+import Data.Text (Text)+import Data.Text qualified as T+import Data.Vector qualified as V+import Data.Version (Version, parseVersion)++import Language.PureScript.AST.SourcePos (SourceSpan(..))+import Language.PureScript.AST.Literals (Literal(..))+import Language.PureScript.CoreFn.Ann (Ann)+import Language.PureScript.CoreFn (Bind(..), Binder(..), CaseAlternative(..), ConstructorType(..), Expr(..), Guard, Meta(..), Module(..))+import Language.PureScript.Names (Ident(..), ModuleName(..), ProperName(..), Qualified(..), QualifiedBy(..), unusedIdent)+import Language.PureScript.PSString (PSString)++import Text.ParserCombinators.ReadP (readP_to_S)++parseVersion' :: String -> Maybe Version+parseVersion' str =+ case filter (null . snd) $ readP_to_S parseVersion str of+ [(vers, "")] -> Just vers+ _ -> Nothing++constructorTypeFromJSON :: Value -> Parser ConstructorType+constructorTypeFromJSON v = do+ t <- parseJSON v+ case t of+ "ProductType" -> return ProductType+ "SumType" -> return SumType+ _ -> fail ("not recognized ConstructorType: " ++ T.unpack t)++metaFromJSON :: Value -> Parser (Maybe Meta)+metaFromJSON Null = return Nothing+metaFromJSON v = withObject "Meta" metaFromObj v+ where+ metaFromObj o = do+ type_ <- o .: "metaType"+ case type_ of+ "IsConstructor" -> isConstructorFromJSON o+ "IsNewtype" -> return $ Just IsNewtype+ "IsTypeClassConstructor"+ -> return $ Just IsTypeClassConstructor+ "IsForeign" -> return $ Just IsForeign+ "IsWhere" -> return $ Just IsWhere+ "IsSyntheticApp"+ -> return $ Just IsSyntheticApp+ _ -> fail ("not recognized Meta: " ++ T.unpack type_)++ isConstructorFromJSON o = do+ ct <- o .: "constructorType" >>= constructorTypeFromJSON+ is <- o .: "identifiers" >>= listParser identFromJSON+ return $ Just (IsConstructor ct is)++annFromJSON :: FilePath -> Value -> Parser Ann+annFromJSON modulePath = withObject "Ann" annFromObj+ where+ annFromObj o = do+ ss <- o .: "sourceSpan" >>= sourceSpanFromJSON modulePath+ mm <- o .: "meta" >>= metaFromJSON+ return (ss, [], mm)++sourceSpanFromJSON :: FilePath -> Value -> Parser SourceSpan+sourceSpanFromJSON modulePath = withObject "SourceSpan" $ \o ->+ SourceSpan modulePath <$>+ o .: "start" <*>+ o .: "end"++literalFromJSON :: (Value -> Parser a) -> Value -> Parser (Literal a)+literalFromJSON t = withObject "Literal" literalFromObj+ where+ literalFromObj o = do+ type_ <- o .: "literalType" :: Parser Text+ case type_ of+ "IntLiteral" -> NumericLiteral . Left <$> o .: "value"+ "NumberLiteral" -> NumericLiteral . Right <$> o .: "value"+ "StringLiteral" -> StringLiteral <$> o .: "value"+ "CharLiteral" -> CharLiteral <$> o .: "value"+ "BooleanLiteral" -> BooleanLiteral <$> o .: "value"+ "ArrayLiteral" -> parseArrayLiteral o+ "ObjectLiteral" -> parseObjectLiteral o+ _ -> fail ("error parsing Literal: " ++ show o)++ parseArrayLiteral o = do+ val <- o .: "value"+ as <- mapM t (V.toList val)+ return $ ArrayLiteral as++ parseObjectLiteral o = do+ val <- o .: "value"+ ObjectLiteral <$> recordFromJSON t val++identFromJSON :: Value -> Parser Ident+identFromJSON = withText "Ident" $ \case+ ident | ident == unusedIdent -> pure UnusedIdent + | otherwise -> pure $ Ident ident ++properNameFromJSON :: Value -> Parser (ProperName a)+properNameFromJSON = fmap ProperName . parseJSON++qualifiedFromJSON :: (Text -> a) -> Value -> Parser (Qualified a)+qualifiedFromJSON f = withObject "Qualified" qualifiedFromObj+ where+ qualifiedFromObj o =+ qualifiedByModuleFromObj o <|> qualifiedBySourcePosFromObj o+ qualifiedByModuleFromObj o = do+ mn <- o .: "moduleName" >>= moduleNameFromJSON+ i <- o .: "identifier" >>= withText "Ident" (return . f)+ pure $ Qualified (ByModuleName mn) i+ qualifiedBySourcePosFromObj o = do+ ss <- o .: "sourcePos"+ i <- o .: "identifier" >>= withText "Ident" (return . f)+ pure $ Qualified (BySourcePos ss) i++moduleNameFromJSON :: Value -> Parser ModuleName+moduleNameFromJSON v = ModuleName . T.intercalate "." <$> listParser parseJSON v++moduleFromJSON :: Value -> Parser (Version, Module Ann)+moduleFromJSON = withObject "Module" moduleFromObj+ where+ moduleFromObj o = do+ version <- o .: "builtWith" >>= versionFromJSON+ moduleName <- o .: "moduleName" >>= moduleNameFromJSON+ modulePath <- o .: "modulePath"+ moduleSourceSpan <- o .: "sourceSpan" >>= sourceSpanFromJSON modulePath+ moduleImports <- o .: "imports" >>= listParser (importFromJSON modulePath)+ moduleExports <- o .: "exports" >>= listParser identFromJSON+ moduleReExports <- o .: "reExports" >>= reExportsFromJSON+ moduleDecls <- o .: "decls" >>= listParser (bindFromJSON modulePath)+ moduleForeign <- o .: "foreign" >>= listParser identFromJSON+ moduleComments <- o .: "comments" >>= listParser parseJSON+ return (version, Module {..})++ versionFromJSON :: String -> Parser Version+ versionFromJSON v =+ case parseVersion' v of+ Just r -> return r+ Nothing -> fail "failed parsing purs version"++ importFromJSON :: FilePath -> Value -> Parser (Ann, ModuleName)+ importFromJSON modulePath = withObject "Import"+ (\o -> do+ ann <- o .: "annotation" >>= annFromJSON modulePath+ mn <- o .: "moduleName" >>= moduleNameFromJSON+ return (ann, mn))++ reExportsFromJSON :: Value -> Parser (M.Map ModuleName [Ident])+ reExportsFromJSON = fmap (M.map (map Ident)) . parseJSON++bindFromJSON :: FilePath -> Value -> Parser (Bind Ann)+bindFromJSON modulePath = withObject "Bind" bindFromObj+ where+ bindFromObj :: Object -> Parser (Bind Ann)+ bindFromObj o = do+ type_ <- o .: "bindType" :: Parser Text+ case type_ of+ "NonRec" -> (uncurry . uncurry) NonRec <$> bindFromObj' o+ "Rec" -> Rec <$> (o .: "binds" >>= listParser (withObject "Bind" bindFromObj'))+ _ -> fail ("not recognized bind type \"" ++ T.unpack type_ ++ "\"")+ + bindFromObj' :: Object -> Parser ((Ann, Ident), Expr Ann)+ bindFromObj' o = do+ a <- o .: "annotation" >>= annFromJSON modulePath+ i <- o .: "identifier" >>= identFromJSON+ e <- o .: "expression" >>= exprFromJSON modulePath+ return ((a, i), e)++recordFromJSON :: (Value -> Parser a) -> Value -> Parser [(PSString, a)]+recordFromJSON p = listParser parsePair+ where+ parsePair v = do+ (l, v') <- parseJSON v :: Parser (PSString, Value)+ a <- p v'+ return (l, a)++exprFromJSON :: FilePath -> Value -> Parser (Expr Ann)+exprFromJSON modulePath = withObject "Expr" exprFromObj+ where+ exprFromObj o = do+ type_ <- o .: "type"+ case type_ of+ "Var" -> varFromObj o+ "Literal" -> literalExprFromObj o+ "Constructor" -> constructorFromObj o+ "Accessor" -> accessorFromObj o+ "ObjectUpdate" -> objectUpdateFromObj o+ "Abs" -> absFromObj o+ "App" -> appFromObj o+ "Case" -> caseFromObj o+ "Let" -> letFromObj o+ _ -> fail ("not recognized expression type: \"" ++ T.unpack type_ ++ "\"")++ varFromObj o = do+ ann <- o .: "annotation" >>= annFromJSON modulePath+ qi <- o .: "value" >>= qualifiedFromJSON Ident+ return $ Var ann qi++ literalExprFromObj o = do+ ann <- o .: "annotation" >>= annFromJSON modulePath+ lit <- o .: "value" >>= literalFromJSON (exprFromJSON modulePath)+ return $ Literal ann lit++ constructorFromObj o = do+ ann <- o .: "annotation" >>= annFromJSON modulePath+ tyn <- o .: "typeName" >>= properNameFromJSON+ con <- o .: "constructorName" >>= properNameFromJSON+ is <- o .: "fieldNames" >>= listParser identFromJSON+ return $ Constructor ann tyn con is++ accessorFromObj o = do+ ann <- o .: "annotation" >>= annFromJSON modulePath+ f <- o .: "fieldName"+ e <- o .: "expression" >>= exprFromJSON modulePath+ return $ Accessor ann f e++ objectUpdateFromObj o = do+ ann <- o .: "annotation" >>= annFromJSON modulePath+ e <- o .: "expression" >>= exprFromJSON modulePath+ copy <- o .: "copy" >>= parseJSON+ us <- o .: "updates" >>= recordFromJSON (exprFromJSON modulePath)+ return $ ObjectUpdate ann e copy us++ absFromObj o = do+ ann <- o .: "annotation" >>= annFromJSON modulePath+ idn <- o .: "argument" >>= identFromJSON+ e <- o .: "body" >>= exprFromJSON modulePath+ return $ Abs ann idn e++ appFromObj o = do+ ann <- o .: "annotation" >>= annFromJSON modulePath+ e <- o .: "abstraction" >>= exprFromJSON modulePath+ e' <- o .: "argument" >>= exprFromJSON modulePath+ return $ App ann e e'++ caseFromObj o = do+ ann <- o .: "annotation" >>= annFromJSON modulePath+ cs <- o .: "caseExpressions" >>= listParser (exprFromJSON modulePath)+ cas <- o .: "caseAlternatives" >>= listParser (caseAlternativeFromJSON modulePath)+ return $ Case ann cs cas++ letFromObj o = do+ ann <- o .: "annotation" >>= annFromJSON modulePath+ bs <- o .: "binds" >>= listParser (bindFromJSON modulePath)+ e <- o .: "expression" >>= exprFromJSON modulePath+ return $ Let ann bs e++caseAlternativeFromJSON :: FilePath -> Value -> Parser (CaseAlternative Ann)+caseAlternativeFromJSON modulePath = withObject "CaseAlternative" caseAlternativeFromObj+ where+ caseAlternativeFromObj o = do+ bs <- o .: "binders" >>= listParser (binderFromJSON modulePath)+ isGuarded <- o .: "isGuarded"+ if isGuarded+ then do+ es <- o .: "expressions" >>= listParser parseResultWithGuard+ return $ CaseAlternative bs (Left es)+ else do+ e <- o .: "expression" >>= exprFromJSON modulePath+ return $ CaseAlternative bs (Right e)++ parseResultWithGuard :: Value -> Parser (Guard Ann, Expr Ann)+ parseResultWithGuard = withObject "parseCaseWithGuards" $+ \o -> do+ g <- o .: "guard" >>= exprFromJSON modulePath+ e <- o .: "expression" >>= exprFromJSON modulePath+ return (g, e)++binderFromJSON :: FilePath -> Value -> Parser (Binder Ann)+binderFromJSON modulePath = withObject "Binder" binderFromObj+ where+ binderFromObj o = do+ type_ <- o .: "binderType"+ case type_ of+ "NullBinder" -> nullBinderFromObj o+ "VarBinder" -> varBinderFromObj o+ "LiteralBinder" -> literalBinderFromObj o+ "ConstructorBinder" -> constructorBinderFromObj o+ "NamedBinder" -> namedBinderFromObj o+ _ -> fail ("not recognized binder: \"" ++ T.unpack type_ ++ "\"")+++ nullBinderFromObj o = do+ ann <- o .: "annotation" >>= annFromJSON modulePath+ return $ NullBinder ann++ varBinderFromObj o = do+ ann <- o .: "annotation" >>= annFromJSON modulePath+ idn <- o .: "identifier" >>= identFromJSON+ return $ VarBinder ann idn++ literalBinderFromObj o = do+ ann <- o .: "annotation" >>= annFromJSON modulePath+ lit <- o .: "literal" >>= literalFromJSON (binderFromJSON modulePath)+ return $ LiteralBinder ann lit++ constructorBinderFromObj o = do+ ann <- o .: "annotation" >>= annFromJSON modulePath+ tyn <- o .: "typeName" >>= qualifiedFromJSON ProperName+ con <- o .: "constructorName" >>= qualifiedFromJSON ProperName+ bs <- o .: "binders" >>= listParser (binderFromJSON modulePath)+ return $ ConstructorBinder ann tyn con bs++ namedBinderFromObj o = do+ ann <- o .: "annotation" >>= annFromJSON modulePath+ n <- o .: "identifier" >>= identFromJSON+ b <- o .: "binder" >>= binderFromJSON modulePath+ return $ NamedBinder ann n b
+ src/Language/PureScript/CoreFn/Laziness.hs view
@@ -0,0 +1,568 @@+module Language.PureScript.CoreFn.Laziness+ ( applyLazinessTransform+ ) where++import Protolude hiding (force)+import Protolude.Unsafe (unsafeHead)++import Control.Arrow ((&&&))+import Data.Array qualified as A+import Data.Coerce (coerce)+import Data.Graph (SCC(..), stronglyConnComp)+import Data.List (foldl1', (!!))+import Data.IntMap.Monoidal qualified as IM+import Data.IntSet qualified as IS+import Data.Map.Monoidal qualified as M+import Data.Semigroup (Max(..))+import Data.Set qualified as S++import Language.PureScript.AST.SourcePos (SourcePos(..), SourceSpan(..), nullSourceSpan)+import Language.PureScript.Constants.Libs qualified as C+import Language.PureScript.CoreFn (Ann, Bind, Expr(..), Literal(..), Meta(..), ssAnn, traverseCoreFn)+import Language.PureScript.Crash (internalError)+import Language.PureScript.Names (pattern ByNullSourcePos, Ident(..), InternalIdentData(..), ModuleName, Qualified(..), QualifiedBy(..), runIdent, runModuleName, toMaybeModuleName)+import Language.PureScript.PSString (mkString)++-- This module is responsible for ensuring that the bindings in recursive+-- binding groups are initialized in a valid order, introducing run-time+-- laziness and initialization checks as necessary.+--+-- PureScript is a call-by-value language with strict data constructors, this+-- transformation notwithstanding. The only laziness introduced here is in the+-- initialization of a binding. PureScript is uninterested in the order in+-- which bindings are written by the user. The compiler has always attempted to+-- emit the bindings in an order that makes sense for the backend, but without+-- this transformation, recursive bindings are emitted in an arbitrary order,+-- which can cause unexpected behavior at run time if a binding is dereferenced+-- before it has initialized.+--+-- To prevent unexpected errors, this transformation does a syntax-driven+-- analysis of a single recursive binding group to attempt to statically order+-- the bindings, and when that fails, falls back to lazy initializers that will+-- succeed or fail deterministically with a clear error at run time.+--+-- Example:+--+-- x = f \_ ->+-- x+--+-- becomes (with some details of the $runtime_lazy function elided):+-- +-- -- the binding of x has been rewritten as a lazy initializer+-- $lazy_x = $runtime_lazy \_ ->+-- f \_ ->+-- $lazy_x 2 -- the reference to x has been rewritten as a force call+-- x = $lazy_x 1+--+-- Central to this analysis are the concepts of delay and force, which are+-- attributes given to every subexpression in the binding group. Delay and+-- force are defined by the following traversal. This traversal is used twice:+-- once to collect all the references made by each binding in the group, and+-- then again to rewrite some references to force calls. (The implications of+-- delay and force on initialization order are specified later.)++-- |+-- Visits every `Var` in an expression with the provided function, including+-- the amount of delay and force applied to that `Var`, and substitutes the+-- result back into the tree (propagating an `Applicative` effect).+--+-- Delay is a non-negative integer that represents the number of lambdas that+-- enclose an expression. Force is a non-negative integer that represents the+-- number of values that are being applied to an expression. Delay is always+-- statically determinable, but force can be *unknown*, so it's represented+-- here with a Maybe. In a function application `f a b`, `f` has force 2, but+-- `a` and `b` have unknown force--it depends on what `f` does with them.+--+-- The rules of assigning delay and force are simple:+-- * The expressions that are assigned to bindings in this group have+-- delay 0, force 0.+-- * In a function application, the function expression has force 1 higher+-- than the force of the application expression, and the argument+-- expression has unknown force.+-- * UNLESS this argument is being directly provided to a constructor (in+-- other words, the function expression is either a constructor itself or+-- a constructor that has already been partially applied), in which case+-- the force of both subexpressions is unchanged. We can assume that+-- constructors don't apply any additional force to their arguments.+-- * If the force of a lambda is zero, the delay of the body of the lambda is+-- incremented; otherwise, the force of the body of the lambda is+-- decremented. (Applying one argument to a lambda cancels out one unit of+-- delay.)+-- * In the argument of a Case and the bindings of a Let, force is unknown.+-- * Everywhere else, preserve the delay and force of the enclosing+-- expression.+--+-- Here are some illustrative examples of the above rules. We will use a+-- pseudocode syntax to annotate a subexpression with delay and force:+-- `expr#d!f` means `expr` has delay d and force f. `!*` is used to denote+-- unknown force.+--+-- x = y#0!0+-- x = y#0!2 a#0!* b#0!*+-- x = (\_ -> y#1!0)#0!0+-- x = \_ _ -> y#2!1 a#2!*+-- x = (\_ -> y#0!0)#0!1 z#0!*+-- x = Just { a: a#0!0, b: b#0!0 }+-- x = let foo = (y#1!* a b#1!*)#1!* in foo + 1+--+-- (Note that this analysis is quite ignorant of any actual control flow+-- choices made at run time. It doesn't even track what happens to a reference+-- after it has been locally bound by a Let or Case. Instead, it just assumes+-- the worst--once locally bound to a new name, it imagines that absolutely+-- anything could happen to that new name and thus to the underlying reference.+-- But the value-to-weight ratio of this approach is perhaps surprisingly+-- high.)+--+-- Every subexpression gets a delay and a force, but we are only interested+-- in references to other bindings in the binding group, so the traversal only+-- exposes `Var`s to the provided function.+--+onVarsWithDelayAndForce :: forall f. Applicative f => (Int -> Maybe Int -> Ann -> Qualified Ident -> f (Expr Ann)) -> Expr Ann -> f (Expr Ann)+onVarsWithDelayAndForce f = snd . go 0 $ Just 0+ where+ go :: Int -> Maybe Int -> (Bind Ann -> f (Bind Ann), Expr Ann -> f (Expr Ann))+ go delay force = (handleBind, handleExpr')+ where+ (handleBind, handleExpr, handleBinder, handleCaseAlternative) = traverseCoreFn handleBind handleExpr' handleBinder handleCaseAlternative+ handleExpr' = \case+ Var a i -> f delay force a i+ Abs a i e -> Abs a i <$> snd (if force == Just 0 then go (succ delay) force else go delay $ fmap pred force) e+ -- A clumsy hack to preserve TCO in a particular idiom of unsafePartial once seen in Data.Map.Internal, possibly still used elsewhere.+ App a1 e1@(Var _ C.I_unsafePartial) (Abs a2 i e2) -> App a1 e1 . Abs a2 i <$> handleExpr' e2+ App a e1 e2 ->+ -- `handleApp` is just to handle the constructor application exception+ -- somewhat gracefully (i.e., without requiring a deep inspection of+ -- the function expression at every step). If we didn't care about+ -- constructors, this could have been simply:+ -- App a <$> snd (go delay (fmap succ force)) e1 <*> snd (go delay Nothing) e2+ handleApp 1 [(a, e2)] e1+ Case a vs alts -> Case a <$> traverse (snd $ go delay Nothing) vs <*> traverse handleCaseAlternative alts+ Let a ds e -> Let a <$> traverse (fst $ go delay Nothing) ds <*> handleExpr' e+ other -> handleExpr other++ handleApp len args = \case+ App a e1 e2 -> handleApp (len + 1) ((a, e2) : args) e1+ Var a@(_, _, Just meta) i | isConstructorLike meta+ -> foldl (\e1 (a2, e2) -> App a2 <$> e1 <*> handleExpr' e2) (f delay force a i) args+ e -> foldl (\e1 (a2, e2) -> App a2 <$> e1 <*> snd (go delay Nothing) e2) (snd (go delay (fmap (+ len) force)) e) args+ isConstructorLike = \case+ IsConstructor{} -> True+ IsNewtype -> True+ _ -> False++-- Once we assign a delay and force value to every `Var` in the binding group,+-- we can consider how to order the bindings to allow them all to successfully+-- initialize. There is one principle here: each binding must be initialized+-- before the identifier being bound is ready for use. If the preorder thus+-- induced has cycles, those cycles need to be resolved with laziness. All of+-- the details concern what "ready for use" means.+--+-- The definition of delay and force suggests that "ready for use" depends on+-- those attributes. If a lambda is bound to the name x, then the references in+-- the lambda don't need to be initialized before x is initialized. This is+-- represented by the fact that those references have non-zero delay. But if+-- the expression bound to x is instead the application of a function y that is+-- also bound in this binding group, then not only does y need to be+-- initialized before x, so do some of the non-zero delay references in y. This+-- is represented by the fact that the occurrence of y in the expression bound+-- to x has non-zero force.+--+-- An example, reusing the pseudocode annotations defined above:+--+-- x _ = y#1!0+-- y = x#0!1 a+--+-- y doesn't need to be initialized before x is, because the reference to y in+-- x's initializer has delay 1. But y does need to be initialized before x is+-- ready for use with force 1, because force 1 is enough to overcome the delay+-- of that reference. And since y has a delay-0 reference to x with force 1, y+-- will need to be ready for use before it is initialized; thus, y needs to be+-- made lazy.+--+-- So just as function applications "cancel out" lambdas, a known applied force+-- cancels out an equal amount of delay, causing some references that may not+-- have been needed earlier to enter play. (And to be safe, we must assume that+-- unknown force cancels out *any* amount of delay.) There is another, subtler+-- aspect of this: if there are not enough lambdas to absorb every argument+-- applied to a function, those arguments will end up applied to the result of+-- the function. Likewise, if there is excess force left over after some of it+-- has been canceled by delay, that excess is carried to the references+-- activated. (Again, an unknown amount of force must be assumed to lead to an+-- unknown amount of excess force.)+--+-- Another example:+--+-- f = g#0!2 a b+-- g x = h#1!2 c x+-- h _ _ _ = f#3!0+--+-- Initializing f will lead to an infinite loop in this example. f invokes g+-- with two arguments. g absorbs one argument, and the second ends up being+-- applied to the result of h c x, resulting in h being invoked with three+-- arguments. Invoking h with three arguments results in dereferencing f, which+-- is not yet ready. To capture this loop in our analysis, we say that making+-- f ready for use with force 0 requires making g ready for use with force 2,+-- which requires making h ready for use with force 3 (two units of force from+-- the lexical position of h, plus one unit of excess force carried forward),+-- which cyclically requires f to be ready for use with force 0.+--+-- These preceding observations are captured and generalized by the following+-- rules:+--+-- USE-INIT: Before a reference to x is ready for use with any force, x must+-- be initialized.+--+-- We will make x lazy iff this rule induces a cycle--i.e., initializing x+-- requires x to be ready for use first.+--+-- USE-USE: Before a reference to x is ready for use with force f:+-- * if a reference in the initializer of x has delay d and force f',+-- * and either d <= f or f is unknown,+-- * then that reference must itself be ready for use with+-- force f – d + f' (or with unknown force if f or f' is unknown).+--+-- USE-IMMEDIATE: Initializing a binding x is equivalent to requiring a+-- reference to x to be ready for use with force 0, per USE-USE.+-- +-- Equivalently: before x is initialized, any reference in the initializer+-- of x with delay 0 and force f must be ready for use with force f.+--+-- Examples:+--+-- Assume x is bound in a recursive binding group with the below bindings.+--+-- All of the following initializers require x to be ready for use with some+-- amount of force, and therefore require x to be initialized first.+--+-- a = x#0!0+-- b = (\_ -> x#0!0) 1+-- c = foo x#0!*+-- d = (\_ -> foo x#0!*) 1+--+-- In the following initializers, before p can be initialized, x must be+-- ready for use with force f – d + f'. (And both x and q must be+-- initialized, of course; but x being ready for use with that force may+-- induce additional constraints.)+--+-- p = ... q#0!f ...+-- q = ... x#d!f' ... (where d <= f)+--+-- Excess force stacks, of course: in the following initializers, before r+-- can be initialized, x must be ready for use with force+-- f — d + f' — d' + f'':+--+-- r = ... s#0!f ...+-- s = ... t#d!f' ... (where d <= f)+-- t = ... x#d'!f'' ... (where d' <= f – d + f')+--+--+-- To satisfy these rules, we will construct a graph between (identifier,+-- delay) pairs, with edges induced by the USE-USE rule, and effectively run a+-- topsort to get the initialization preorder. For this part, it's simplest to+-- think of delay as an element of the naturals extended with a positive+-- infinity, corresponding to an unknown amount of force. (We'll do arithmetic+-- on these extended naturals as you would naively expect; we won't do anything+-- suspect like subtracting infinity from infinity.) With that in mind, we can+-- construct the graph as follows: for each reference from i1 to i2 with delay+-- d and force f, draw an infinite family of edges from (i1, d + n) to (i2, f ++-- n) for all 0 <= n <= ∞, where n represents the excess force carried over+-- from a previous edge. Unfortunately, as an infinite graph, we can't expect+-- the tools in Data.Graph to help us traverse it; we will have to be a little+-- bit clever.+--+-- The following data types and functions are for searching this infinite graph+-- and carving from it a finite amount of data to work with. Specifically, we+-- want to know for each identifier i, which other identifiers are+-- irreflexively reachable from (i, 0) (and thus must be initialized before i+-- is), and with what maximum force (in the event of a loop, not every+-- reference to i in the reachable identifier needs to be rewritten to a force+-- call; only the ones with delay up to the maximum force used during i's+-- initialization). We also want the option of aborting a given reachability+-- search, for one of two reasons.+--+-- * If we encounter a reference with unknown force, abort.+-- * If we encounter a cycle where force on a single identifier is+-- increasing, abort. (Because of USE-USE, as soon as an identifier is+-- revisited with greater force than its first visit, the difference is+-- carried forward as excess, so it is possible to retrace that path to get+-- an arbitrarily high amount of force.)+--+-- Both reasons mean that it is theoretically possible for the identifier in+-- question to need every other identifier in the binding group to be+-- initialized before it is. (Every identifier in a recursive binding group is+-- necessarily reachable from every other, ignoring delay and force, which is+-- what arbitrarily high force lets you do.)+--+-- In order to reuse parts of this reachability computation across identifiers,+-- we are going to represent it with a rose tree data structure interleaved with+-- a monad capturing the abort semantics. (The monad is Maybe, but we don't+-- need to know that here!)++type MaxRoseTree m a = m (IM.MonoidalIntMap (MaxRoseNode m a))+data MaxRoseNode m a = MaxRoseNode a (MaxRoseTree m a)++-- Dissecting this data structure:+--+-- m (...)+-- ^ represents whether to abort or continue the search+--+-- IM.MonoidalIntMap (...)+-- ^ the keys of this map are other identifiers reachable from the current+-- one (we'll map the identifiers in this binding group to Ints for ease of+-- computation)+--+-- the values of this map are:+--+-- MaxRoseNode a (...)+-- ^ this will store the force applied to the next identifier+-- (MaxRoseTree m a)+-- ^ and this, the tree of identifiers reachable from there+--+-- We're only interested in continuing down the search path that applies the+-- most force to a given identifier! So when we combine two MaxRoseTrees,+-- we want to resolve any key collisions in their MonoidalIntMaps with this+-- semigroup:++instance Ord a => Semigroup (MaxRoseNode m a) where+ l@(MaxRoseNode l1 _) <> r@(MaxRoseNode r1 _) = if r1 > l1 then r else l++-- And that's why this is called a MaxRoseTree.+--+-- Traversing this tree to get a single MonoidalIntMap with the entire closure+-- plus force information is fairly straightforward:++mrtFlatten :: (Monad m, Ord a) => MaxRoseTree m a -> m (IM.MonoidalIntMap (Max a))+mrtFlatten = (getAp . IM.foldMapWithKey (\i (MaxRoseNode a inner) -> Ap $ (IM.singleton i (Max a) <>) <$> mrtFlatten inner) =<<)++-- The use of the `Ap` monoid ensures that if any child of this tree aborts,+-- the entire tree aborts.+--+-- One might ask, why interleave the abort monad with the tree at all if we're+-- just going to flatten it out at the end? The point is to flatten it out at+-- the end, but *not* during the generation of the tree. Attempting to flatten+-- the tree as we generate it can result in an infinite loop, because a subtree+-- needs to be exhaustively searched for abort conditions before it can be used+-- in another tree. With this approach, we can use lazy trees as building+-- blocks and, as long as they get rewritten to be finite or have aborts before+-- they're flattened, the analysis still terminates.++-- |+-- Given a maximum index and a function that returns a map of edges to next+-- indices, returns an array for each index up to maxIndex of maps from the+-- indices reachable from the current index, to the maximum force applied to+-- those indices.+searchReachable+ :: forall m force+ . (Alternative m, Monad m, Enum force, Ord force)+ => Int+ -> ((Int, force) -> m (IM.MonoidalIntMap (Max force)))+ -> A.Array Int (m (IM.MonoidalIntMap (Max force)))+searchReachable maxIdx lookupEdges = mrtFlatten . unsafeHead <$> mem+ where+ -- This is a finite array of infinite lists, used to memoize all the search+ -- trees. `unsafeHead` is used above to pull the first tree out of each list+ -- in the array--the one corresponding to zero force, which is what's needed+ -- to initialize the corresponding identifier. (`unsafeHead` is safe here, of+ -- course: infinite lists.)+ mem :: A.Array Int [MaxRoseTree m force]+ mem = A.listArray (0, maxIdx)+ [ [cutLoops <*> fmap (IM.mapWithKey memoizedNode) . lookupEdges $ (i, f) | f <- [toEnum 0..]]+ | i <- [0..maxIdx]+ ]++ memoizedNode :: Int -> Max force -> MaxRoseNode m force+ memoizedNode i (Max force) = MaxRoseNode force $ mem A.! i !! fromEnum force++ -- And this is the function that prevents the search from actually being+ -- infinite. It applies a filter to a `MaxRoseTree` at every level, looking for+ -- indices anywhere in the tree that match the current vertex. If a match is+ -- found with greater force than the current force, that part of the tree is+ -- rewritten to abort; otherwise, that part of the tree is rewritten to be+ -- empty (there's nothing new in that part of the search).+ --+ -- A new version of `cutLoops` is applied for each node in the search, so+ -- each edge in a search path will add another filter on a new index. Since+ -- there are a finite number of indices in our universe, this guarantees that+ -- the analysis terminates, because no single search path can have length+ -- greater than `maxIdx`.+ cutLoops :: (Int, force) -> MaxRoseTree m force -> MaxRoseTree m force+ cutLoops (i, force) = go+ where+ go = (=<<) . IM.traverseWithKey $ \i' (MaxRoseNode force' inner) ->+ MaxRoseNode force' <$> if i == i' then guard (force >= force') $> pure IM.empty else pure $ go inner++-- One last data structure to define and then it's on to the main event.+--+-- The laziness transform effectively takes a list of eager bindings (x = ...)+-- and splits some of them into lazy definitions ($lazy_x = ...) and lazy+-- bindings (x = $lazy_x ...). It's convenient to work with these three+-- declarations as the following sum type:++data RecursiveGroupItem e = EagerBinding Ann e | LazyDefinition e | LazyBinding Ann+ deriving Functor++-- |+-- Transform a recursive binding group, reordering the bindings within when a+-- correct initialization order can be statically determined, and rewriting+-- bindings and references to be lazy otherwise.+--+applyLazinessTransform :: ModuleName -> [((Ann, Ident), Expr Ann)] -> ([((Ann, Ident), Expr Ann)], Any)+applyLazinessTransform mn rawItems = let++ -- Establish the mapping from names to ints.+ rawItemsByName :: M.MonoidalMap Ident (Ann, Expr Ann)+ rawItemsByName = M.fromList $ (snd . fst &&& first fst) <$> rawItems++ maxIdx = M.size rawItemsByName - 1++ rawItemsByIndex :: A.Array Int (Ann, Expr Ann)+ rawItemsByIndex = A.listArray (0, maxIdx) $ M.elems rawItemsByName++ names :: S.Set Ident+ names = M.keysSet rawItemsByName++ -- Now do the first delay/force traversal of all the bindings to find+ -- references to other names in this binding group.+ --+ -- The parts of this type mean:+ -- D is the maximum force (or Nothing if unknown) with which the identifier C+ -- is referenced in any delay-B position inside the expression A.+ --+ -- where A, B, C, and D are as below:+ -- A B (keys) C (keys) D+ findReferences :: Expr Ann -> IM.MonoidalIntMap (IM.MonoidalIntMap (Ap Maybe (Max Int)))+ findReferences = (getConst .) . onVarsWithDelayAndForce $ \delay force _ -> \case+ Qualified qb ident | all (== mn) (toMaybeModuleName qb), Just i <- ident `S.lookupIndex` names+ -> Const . IM.singleton delay . IM.singleton i $ coerceForce force+ _ -> Const IM.empty++ -- The parts of this type mean:+ -- D is the maximum force (or Nothing if unknown) with which the identifier C+ -- is referenced in any delay-B position inside the binding of identifier A.+ --+ -- where A, B, C, and D are as below:+ -- A B (keys) C (keys) D+ refsByIndex :: A.Array Int (IM.MonoidalIntMap (IM.MonoidalIntMap (Ap Maybe (Max Int))))+ refsByIndex = findReferences . snd <$> rawItemsByIndex++ -- Using the approach explained above, traverse the reference graph generated+ -- by `refsByIndex` and find all reachable names.+ --+ -- The parts of this type mean:+ -- D is the maximum force with which the identifier C is referenced,+ -- directly or indirectly, during the initialization of identifier A. B is+ -- Nothing if the analysis of A was inconclusive and A might need the entire+ -- binding group.+ -- + -- where A, B, C, and D are as below:+ -- A B C (keys) D+ reachablesByIndex :: A.Array Int (Maybe (IM.MonoidalIntMap (Max Int)))+ reachablesByIndex = searchReachable maxIdx $ \(i, force) ->+ getAp . flip IM.foldMapWithKey (dropKeysAbove force $ refsByIndex A.! i) $ \delay ->+ IM.foldMapWithKey $ \i' force' ->+ Ap $ IM.singleton i' . Max . (force - delay +) <$> uncoerceForce force'++ -- If `reachablesByIndex` is a sort of labeled relation, this function+ -- produces part of the reverse relation, but only for the edges from the+ -- given vertex.+ --+ -- The parts of this type mean:+ -- The identifier A is reachable from the identifier B with maximum force C+ -- (B is also the index provided to the function).+ --+ -- where A, B, and C are as below:+ -- (B) A B (singleton key) C+ reverseReachablesFor :: Int -> IM.MonoidalIntMap (IM.MonoidalIntMap (Ap Maybe (Max Int)))+ reverseReachablesFor i = case reachablesByIndex A.! i of+ Nothing -> IM.fromAscList $ (, IM.singleton i $ Ap Nothing) <$> [0..maxIdx]+ Just im -> IM.singleton i . Ap . Just <$> im++ -- We can use `reachablesByIndex` to build a finite graph and topsort it;+ -- in the process, we'll pack the nodes of the graph with data we'll want+ -- next. Remember that if our reachability computation aborted, we have to+ -- assume that every other identifier is reachable from that one--hence the+ -- `maybe [0..maxIdx]`.+ sccs = stronglyConnComp $ do+ (i, mbReachable) <- A.assocs reachablesByIndex+ pure ((reverseReachablesFor i, (S.elemAt i names, rawItemsByIndex A.! i)), i, maybe [0..maxIdx] (IS.toList . IM.keysSet) mbReachable)++ (replacements, items) = flip foldMap sccs $ \case+ -- The easy case: this binding doesn't need to be made lazy after all!+ AcyclicSCC (_, (ident, (a, e))) -> pure [(ident, EagerBinding a e)]+ -- The tough case: we have a loop.+ -- We need to do two things here:+ -- * Collect the reversed reachables relation for each vertex in this+ -- loop; we'll use this to replace references with force calls+ -- * Copy the vertex list into two lists: a list of lazy definitions and+ -- a list of lazy bindings+ -- Both of these results are monoidal, so the outer `foldMap` will+ -- concatenate them pairwise.+ CyclicSCC vertices -> (foldMap fst vertices, map (fmap (LazyDefinition . snd) . snd) vertices ++ map (fmap (LazyBinding . fst) . snd) vertices)++ -- We have `replacements` expressed in terms of indices; we want to map it+ -- back to names before traversing the bindings again.+ replacementsByName :: M.MonoidalMap Ident (M.MonoidalMap Ident (Ap Maybe (Max Int)))+ replacementsByName = M.fromAscList . map (bimap (flip S.elemAt names) (M.fromAscList . map (first (flip S.elemAt names)) . IM.toAscList)) . IM.toAscList $ replacements++ -- And finally, this is the second delay/force traversal where we take+ -- `replacementsByName` and use it to rewrite references with force calls,+ -- but only if the delay of those references is at most the maximum amount+ -- of force used by the initialization of the referenced binding to+ -- reference the outer binding. A reference made with a higher delay than+ -- that can safely continue to use the original reference, since it won't be+ -- needed until after the referenced binding is done initializing.+ replaceReferencesWithForceCall :: (Ident, RecursiveGroupItem (Expr Ann)) -> (Ident, RecursiveGroupItem (Expr Ann))+ replaceReferencesWithForceCall pair@(ident, item) = case ident `M.lookup` replacementsByName of+ Nothing -> pair+ Just m -> let+ rewriteExpr = (runIdentity .) . onVarsWithDelayAndForce $ \delay _ ann -> pure . \case+ Qualified qb ident' | all (== mn) (toMaybeModuleName qb), any (all (>= Max delay) . getAp) $ ident' `M.lookup` m+ -> makeForceCall ann ident'+ q -> Var ann q+ in (ident, rewriteExpr <$> item)++ -- All that's left to do is run the above replacement on every item,+ -- translate items from our `RecursiveGroupItem` representation back into the+ -- form CoreFn expects, and inform the caller whether we made any laziness+ -- transformations after all. (That last bit of information is used to+ -- determine if the runtime factory function needs to be injected.)+ in (uncurry fromRGI . replaceReferencesWithForceCall <$> items, Any . not $ IM.null replacements)++ where++ nullAnn = ssAnn nullSourceSpan+ runtimeLazy = Var nullAnn . Qualified ByNullSourcePos $ InternalIdent RuntimeLazyFactory+ runFn3 = Var nullAnn . Qualified (ByModuleName C.M_Data_Function_Uncurried) . Ident $ C.S_runFn <> "3"+ strLit = Literal nullAnn . StringLiteral . mkString++ lazifyIdent = \case+ Ident txt -> InternalIdent $ Lazy txt+ _ -> internalError "Unexpected argument to lazifyIdent"++ makeForceCall :: Ann -> Ident -> Expr Ann+ makeForceCall (ss, _, _) ident+ -- We expect the functions produced by `runtimeLazy` to accept one+ -- argument: the line number on which this reference is made. The runtime+ -- code uses this number to generate a message that identifies where the+ -- evaluation looped.+ = App nullAnn (Var nullAnn . Qualified ByNullSourcePos $ lazifyIdent ident)+ . Literal nullAnn . NumericLiteral . Left . toInteger . sourcePosLine+ $ spanStart ss++ fromRGI :: Ident -> RecursiveGroupItem (Expr Ann) -> ((Ann, Ident), Expr Ann)+ fromRGI i = \case+ EagerBinding a e -> ((a, i), e)+ -- We expect the `runtimeLazy` factory to accept three arguments: the+ -- identifier being initialized, the name of the module, and of course a+ -- thunk that actually contains the initialization code.+ LazyDefinition e -> ((nullAnn, lazifyIdent i), foldl1' (App nullAnn) [runFn3, runtimeLazy, strLit $ runIdent i, strLit $ runModuleName mn, Abs nullAnn UnusedIdent e])+ LazyBinding a -> ((a, i), makeForceCall a i)++ dropKeysAbove :: Int -> IM.MonoidalIntMap a -> IM.MonoidalIntMap a+ dropKeysAbove n = fst . IM.split (n + 1)++ coerceForce :: Maybe Int -> Ap Maybe (Max Int)+ coerceForce = coerce++ uncoerceForce :: Ap Maybe (Max Int) -> Maybe Int+ uncoerceForce = coerce
− src/Language/PureScript/CoreFn/Literals.hs
@@ -1,46 +0,0 @@------------------------------------------------------------------------------------ Module : Language.PureScript.CoreFn.Literals--- Copyright : (c) 2013-14 Phil Freeman, (c) 2014 Gary Burgess, and other contributors--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>, Gary Burgess <gary.burgess@gmail.com>--- Stability : experimental--- Portability :------ | The core functional representation for literal values.-----------------------------------------------------------------------------------{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveFunctor #-}--module Language.PureScript.CoreFn.Literals where--import qualified Data.Data as D---- |--- Data type for literal values. Parameterised so it can be used for Exprs and--- Binders.----data Literal a- -- |- -- A numeric literal- --- = NumericLiteral (Either Integer Double)- -- |- -- A string literal- --- | StringLiteral String- -- |- -- A boolean literal- --- | BooleanLiteral Bool- -- |- -- An array literal- --- | ArrayLiteral [a]- -- |- -- An object literal- --- | ObjectLiteral [(String, a)] deriving (Show, D.Data, D.Typeable, Functor)
src/Language/PureScript/CoreFn/Meta.hs view
@@ -1,24 +1,11 @@------------------------------------------------------------------------------------ Module : Language.PureScript.CoreFn.Meta--- Copyright : (c) 2013-14 Phil Freeman, (c) 2014 Gary Burgess, and other contributors--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>, Gary Burgess <gary.burgess@gmail.com>--- Stability : experimental--- Portability :------ | Metadata annotations for core functional representation+-- |+-- Metadata annotations for core functional representation ----------------------------------------------------------------------------------{-# LANGUAGE DeriveDataTypeable #-}- module Language.PureScript.CoreFn.Meta where -import qualified Data.Data as D+import Prelude -import Language.PureScript.Names+import Language.PureScript.Names (Ident) -- | -- Metadata annotations@@ -35,17 +22,30 @@ -- | -- The contained value is a typeclass dictionary constructor --- | IsTypeClassConstructor deriving (Show, D.Data, D.Typeable)+ | IsTypeClassConstructor+ -- |+ -- The contained reference is for a foreign member+ --+ | IsForeign+ -- |+ -- The contained value is a where clause+ --+ | IsWhere+ -- |+ -- The contained function application was synthesized by the compiler+ --+ | IsSyntheticApp+ deriving (Show, Eq, Ord) -- | -- Data constructor metadata -- data ConstructorType -- |- -- The constructor is for a type with a single construcor+ -- The constructor is for a type with a single constructor -- = ProductType -- |- -- The constructor is for a type with multiple construcors+ -- The constructor is for a type with multiple constructors --- | SumType deriving (Show, D.Data, D.Typeable)+ | SumType deriving (Show, Eq, Ord)
src/Language/PureScript/CoreFn/Module.hs view
@@ -1,32 +1,25 @@------------------------------------------------------------------------------------ Module : Language.PureScript.CoreFn.Module--- Copyright : (c) 2013-14 Phil Freeman, (c) 2014 Gary Burgess, and other contributors--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>, Gary Burgess <gary.burgess@gmail.com>--- Stability : experimental--- Portability :------ | The CoreFn module representation---------------------------------------------------------------------------------- module Language.PureScript.CoreFn.Module where -import Language.PureScript.CodeGen.JS.AST-import Language.PureScript.Comments-import Language.PureScript.CoreFn.Expr-import Language.PureScript.Names-import Language.PureScript.Types+import Prelude +import Data.Map.Strict (Map)++import Language.PureScript.AST.SourcePos (SourceSpan)+import Language.PureScript.Comments (Comment)+import Language.PureScript.CoreFn.Expr (Bind)+import Language.PureScript.Names (Ident, ModuleName)++-- |+-- The CoreFn module representation+-- data Module a = Module- { moduleComments :: [Comment]+ { moduleSourceSpan :: SourceSpan+ , moduleComments :: [Comment] , moduleName :: ModuleName- , moduleImports :: [ModuleName]+ , modulePath :: FilePath+ , moduleImports :: [(a, ModuleName)] , moduleExports :: [Ident]- , moduleForeign :: [ForeignDecl]+ , moduleReExports :: Map ModuleName [Ident]+ , moduleForeign :: [Ident] , moduleDecls :: [Bind a]- } deriving (Show)--type ForeignDecl = (Ident, Maybe JS, Type)+ } deriving (Functor, Show)
+ src/Language/PureScript/CoreFn/Optimizer.hs view
@@ -0,0 +1,31 @@+module Language.PureScript.CoreFn.Optimizer (optimizeCoreFn) where++import Protolude hiding (Type, moduleName)++import Control.Monad.Supply (Supply)+import Language.PureScript.CoreFn.Ann (Ann)+import Language.PureScript.CoreFn.CSE (optimizeCommonSubexpressions)+import Language.PureScript.CoreFn.Expr (Bind, Expr(..))+import Language.PureScript.CoreFn.Module (Module(..))+import Language.PureScript.CoreFn.Traversals (everywhereOnValues)+import Language.PureScript.Constants.Libs qualified as C++-- |+-- CoreFn optimization pass.+--+optimizeCoreFn :: Module Ann -> Supply (Module Ann)+optimizeCoreFn m = fmap (\md -> m {moduleDecls = md}) . optimizeCommonSubexpressions (moduleName m) . optimizeModuleDecls $ moduleDecls m++optimizeModuleDecls :: [Bind Ann] -> [Bind Ann]+optimizeModuleDecls = map transformBinds+ where+ (transformBinds, _, _) = everywhereOnValues identity transformExprs identity+ transformExprs+ = optimizeDataFunctionApply++optimizeDataFunctionApply :: Expr a -> Expr a+optimizeDataFunctionApply e = case e of+ (App a (App _ (Var _ fn) x) y)+ | C.I_functionApply <- fn -> App a x y+ | C.I_functionApplyFlipped <- fn -> App a y x+ _ -> e
+ src/Language/PureScript/CoreFn/ToJSON.hs view
@@ -0,0 +1,249 @@+{-# LANGUAGE NoOverloadedStrings #-}+-- |+-- Dump the core functional representation in JSON format for consumption+-- by third-party code generators+--+module Language.PureScript.CoreFn.ToJSON+ ( moduleToJSON+ ) where++import Prelude++import Control.Arrow ((***))+import Data.Either (isLeft)+import Data.Map.Strict qualified as M+import Data.Aeson (ToJSON(..), Value(..), object)+import Data.Aeson qualified+import Data.Aeson.Key qualified+import Data.Aeson.Types (Pair)+import Data.Version (Version, showVersion)+import Data.Text (Text)+import Data.Text qualified as T++import Language.PureScript.AST.Literals (Literal(..))+import Language.PureScript.AST.SourcePos (SourceSpan(..))+import Language.PureScript.CoreFn (Ann, Bind(..), Binder(..), CaseAlternative(..), ConstructorType(..), Expr(..), Meta(..), Module(..))+import Language.PureScript.Names (Ident, ModuleName(..), ProperName(..), Qualified(..), QualifiedBy(..), runIdent)+import Language.PureScript.PSString (PSString)++constructorTypeToJSON :: ConstructorType -> Value+constructorTypeToJSON ProductType = toJSON "ProductType"+constructorTypeToJSON SumType = toJSON "SumType"++infixr 8 .=+(.=) :: ToJSON a => String -> a -> Pair+key .= value = Data.Aeson.Key.fromString key Data.Aeson..= value++metaToJSON :: Meta -> Value+metaToJSON (IsConstructor t is)+ = object+ [ "metaType" .= "IsConstructor"+ , "constructorType" .= constructorTypeToJSON t+ , "identifiers" .= identToJSON `map` is+ ]+metaToJSON IsNewtype = object [ "metaType" .= "IsNewtype" ]+metaToJSON IsTypeClassConstructor = object [ "metaType" .= "IsTypeClassConstructor" ]+metaToJSON IsForeign = object [ "metaType" .= "IsForeign" ]+metaToJSON IsWhere = object [ "metaType" .= "IsWhere" ]+metaToJSON IsSyntheticApp = object [ "metaType" .= "IsSyntheticApp" ]++sourceSpanToJSON :: SourceSpan -> Value+sourceSpanToJSON (SourceSpan _ spanStart spanEnd) =+ object [ "start" .= spanStart+ , "end" .= spanEnd+ ]++annToJSON :: Ann -> Value+annToJSON (ss, _, m) = object [ "sourceSpan" .= sourceSpanToJSON ss+ , "meta" .= maybe Null metaToJSON m+ ]++literalToJSON :: (a -> Value) -> Literal a -> Value+literalToJSON _ (NumericLiteral (Left n))+ = object+ [ "literalType" .= "IntLiteral"+ , "value" .= n+ ]+literalToJSON _ (NumericLiteral (Right n))+ = object+ [ "literalType" .= "NumberLiteral"+ , "value" .= n+ ]+literalToJSON _ (StringLiteral s)+ = object+ [ "literalType" .= "StringLiteral"+ , "value" .= s+ ]+literalToJSON _ (CharLiteral c)+ = object+ [ "literalType" .= "CharLiteral"+ , "value" .= c+ ]+literalToJSON _ (BooleanLiteral b)+ = object+ [ "literalType" .= "BooleanLiteral"+ , "value" .= b+ ]+literalToJSON t (ArrayLiteral xs)+ = object+ [ "literalType" .= "ArrayLiteral"+ , "value" .= map t xs+ ]+literalToJSON t (ObjectLiteral xs)+ = object+ [ "literalType" .= "ObjectLiteral"+ , "value" .= recordToJSON t xs+ ]++identToJSON :: Ident -> Value+identToJSON = toJSON . runIdent++properNameToJSON :: ProperName a -> Value+properNameToJSON = toJSON . runProperName++qualifiedToJSON :: (a -> Text) -> Qualified a -> Value+qualifiedToJSON f (Qualified qb a) =+ case qb of+ ByModuleName mn -> object+ [ "moduleName" .= moduleNameToJSON mn+ , "identifier" .= toJSON (f a)+ ]+ BySourcePos ss -> object+ [ "sourcePos" .= toJSON ss+ , "identifier" .= toJSON (f a)+ ]++moduleNameToJSON :: ModuleName -> Value+moduleNameToJSON (ModuleName name) = toJSON (T.splitOn (T.pack ".") name)++moduleToJSON :: Version -> Module Ann -> Value+moduleToJSON v m = object+ [ "sourceSpan" .= sourceSpanToJSON (moduleSourceSpan m)+ , "moduleName" .= moduleNameToJSON (moduleName m)+ , "modulePath" .= toJSON (modulePath m)+ , "imports" .= map importToJSON (moduleImports m)+ , "exports" .= map identToJSON (moduleExports m)+ , "reExports" .= reExportsToJSON (moduleReExports m)+ , "foreign" .= map identToJSON (moduleForeign m)+ , "decls" .= map bindToJSON (moduleDecls m)+ , "builtWith" .= toJSON (showVersion v)+ , "comments" .= map toJSON (moduleComments m)+ ]++ where+ importToJSON (ann,mn) = object+ [ "annotation" .= annToJSON ann+ , "moduleName" .= moduleNameToJSON mn+ ]++ reExportsToJSON :: M.Map ModuleName [Ident] -> Value+ reExportsToJSON = toJSON . M.map (map runIdent)++bindToJSON :: Bind Ann -> Value+bindToJSON (NonRec ann n e)+ = object+ [ "bindType" .= "NonRec"+ , "annotation" .= annToJSON ann+ , "identifier" .= identToJSON n+ , "expression" .= exprToJSON e+ ]+bindToJSON (Rec bs)+ = object+ [ "bindType" .= "Rec"+ , "binds" .= map (\((ann, n), e)+ -> object+ [ "identifier" .= identToJSON n+ , "annotation" .= annToJSON ann+ , "expression" .= exprToJSON e+ ]) bs+ ]++recordToJSON :: (a -> Value) -> [(PSString, a)] -> Value+recordToJSON f = toJSON . map (toJSON *** f)++exprToJSON :: Expr Ann -> Value+exprToJSON (Var ann i) = object [ "type" .= toJSON "Var"+ , "annotation" .= annToJSON ann+ , "value" .= qualifiedToJSON runIdent i+ ]+exprToJSON (Literal ann l) = object [ "type" .= "Literal"+ , "annotation" .= annToJSON ann+ , "value" .= literalToJSON exprToJSON l+ ]+exprToJSON (Constructor ann d c is) = object [ "type" .= "Constructor"+ , "annotation" .= annToJSON ann+ , "typeName" .= properNameToJSON d+ , "constructorName" .= properNameToJSON c+ , "fieldNames" .= map identToJSON is+ ]+exprToJSON (Accessor ann f r) = object [ "type" .= "Accessor"+ , "annotation" .= annToJSON ann+ , "fieldName" .= f+ , "expression" .= exprToJSON r+ ]+exprToJSON (ObjectUpdate ann r copy fs)+ = object [ "type" .= "ObjectUpdate"+ , "annotation" .= annToJSON ann+ , "expression" .= exprToJSON r+ , "copy" .= toJSON copy+ , "updates" .= recordToJSON exprToJSON fs+ ]+exprToJSON (Abs ann p b) = object [ "type" .= "Abs"+ , "annotation" .= annToJSON ann+ , "argument" .= identToJSON p+ , "body" .= exprToJSON b+ ]+exprToJSON (App ann f x) = object [ "type" .= "App"+ , "annotation" .= annToJSON ann+ , "abstraction" .= exprToJSON f+ , "argument" .= exprToJSON x+ ]+exprToJSON (Case ann ss cs) = object [ "type" .= "Case"+ , "annotation" .= annToJSON ann+ , "caseExpressions"+ .= map exprToJSON ss+ , "caseAlternatives"+ .= map caseAlternativeToJSON cs+ ]+exprToJSON (Let ann bs e) = object [ "type" .= "Let" + , "annotation" .= annToJSON ann+ , "binds" .= map bindToJSON bs+ , "expression" .= exprToJSON e+ ]++caseAlternativeToJSON :: CaseAlternative Ann -> Value+caseAlternativeToJSON (CaseAlternative bs r') =+ let isGuarded = isLeft r'+ in object+ [ "binders" .= toJSON (map binderToJSON bs)+ , "isGuarded" .= toJSON isGuarded+ , (if isGuarded then "expressions" else "expression")+ .= case r' of+ Left rs -> toJSON $ map (\(g, e) -> object [ "guard" .= exprToJSON g, "expression" .= exprToJSON e]) rs+ Right r -> exprToJSON r+ ]++binderToJSON :: Binder Ann -> Value+binderToJSON (VarBinder ann v) = object [ "binderType" .= "VarBinder"+ , "annotation" .= annToJSON ann+ , "identifier" .= identToJSON v+ ]+binderToJSON (NullBinder ann) = object [ "binderType" .= "NullBinder"+ , "annotation" .= annToJSON ann+ ]+binderToJSON (LiteralBinder ann l) = object [ "binderType" .= "LiteralBinder"+ , "annotation" .= annToJSON ann+ , "literal" .= literalToJSON binderToJSON l+ ]+binderToJSON (ConstructorBinder ann d c bs) = object [ "binderType" .= "ConstructorBinder"+ , "annotation" .= annToJSON ann+ , "typeName" .= qualifiedToJSON runProperName d+ , "constructorName"+ .= qualifiedToJSON runProperName c+ , "binders" .= map binderToJSON bs+ ]+binderToJSON (NamedBinder ann n b) = object [ "binderType" .= "NamedBinder"+ , "annotation" .= annToJSON ann+ , "identifier" .= identToJSON n+ , "binder" .= binderToJSON b+ ]
src/Language/PureScript/CoreFn/Traversals.hs view
@@ -1,24 +1,16 @@------------------------------------------------------------------------------------ Module : Language.PureScript.CoreFn.Traversals--- Copyright : (c) 2013-14 Phil Freeman, (c) 2014 Gary Burgess, and other contributors--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>, Gary Burgess <gary.burgess@gmail.com>--- Stability : experimental--- Portability :------ | CoreFn traversal helpers+-- |+-- CoreFn traversal helpers --------------------------------------------------------------------------------- module Language.PureScript.CoreFn.Traversals where +import Prelude+ import Control.Arrow (second, (***), (+++))+import Data.Bitraversable (bitraverse) -import Language.PureScript.CoreFn.Binders-import Language.PureScript.CoreFn.Expr-import Language.PureScript.CoreFn.Literals+import Language.PureScript.AST.Literals (Literal(..))+import Language.PureScript.CoreFn.Binders (Binder(..))+import Language.PureScript.CoreFn.Expr (Bind(..), CaseAlternative(..), Expr(..)) everywhereOnValues :: (Bind a -> Bind a) -> (Expr a -> Expr a) ->@@ -26,12 +18,12 @@ (Bind a -> Bind a, Expr a -> Expr a, Binder a -> Binder a) everywhereOnValues f g h = (f', g', h') where- f' (NonRec name e) = f (NonRec name (g' e))+ f' (NonRec a name e) = f (NonRec a name (g' e)) f' (Rec es) = f (Rec (map (second g') es)) g' (Literal ann e) = g (Literal ann (handleLiteral g' e)) g' (Accessor ann prop e) = g (Accessor ann prop (g' e))- g' (ObjectUpdate ann obj vs) = g (ObjectUpdate ann (g' obj) (map (fmap g') vs))+ g' (ObjectUpdate ann obj copy vs) = g (ObjectUpdate ann (g' obj) copy (map (fmap g') vs)) g' (Abs ann name e) = g (Abs ann name (g' e)) g' (App ann v1 v2) = g (App ann (g' v1) (g' v2)) g' (Case ann vs alts) = g (Case ann (map g' vs) (map handleCaseAlternative alts))@@ -40,6 +32,7 @@ h' (LiteralBinder a b) = h (LiteralBinder a (handleLiteral h' b)) h' (NamedBinder a name b) = h (NamedBinder a name (h' b))+ h' (ConstructorBinder a q1 q2 bs) = h (ConstructorBinder a q1 q2 (map h' bs)) h' b = h b handleCaseAlternative ca =@@ -52,34 +45,42 @@ handleLiteral i (ObjectLiteral ls) = ObjectLiteral (map (fmap i) ls) handleLiteral _ other = other -everythingOnValues :: (r -> r -> r) ->- (Bind a -> r) ->- (Expr a -> r) ->- (Binder a -> r) ->- (CaseAlternative a -> r) ->- (Bind a -> r, Expr a -> r, Binder a -> r, CaseAlternative a -> r)-everythingOnValues (<>) f g h i = (f', g', h', i')+-- |+-- Apply the provided functions to the top level of AST nodes.+--+-- This function is useful as a building block for recursive functions, but+-- doesn't actually recurse itself.+--+traverseCoreFn+ :: forall f a+ . Applicative f+ => (Bind a -> f (Bind a))+ -> (Expr a -> f (Expr a))+ -> (Binder a -> f (Binder a))+ -> (CaseAlternative a -> f (CaseAlternative a))+ -> (Bind a -> f (Bind a), Expr a -> f (Expr a), Binder a -> f (Binder a), CaseAlternative a -> f (CaseAlternative a))+traverseCoreFn f g h i = (f', g', h', i') where- f' b@(NonRec _ e) = f b <> g' e- f' b@(Rec es) = foldl (<>) (f b) (map (g' . snd) es)+ f' (NonRec a name e) = NonRec a name <$> g e+ f' (Rec es) = Rec <$> traverse (traverse g) es - g' v@(Literal _ l) = foldl (<>) (g v) (map g' (extractLiteral l))- g' v@(Accessor _ _ e1) = g v <> g' e1- g' v@(ObjectUpdate _ obj vs) = foldl (<>) (g v <> g' obj) (map (g' . snd) vs)- g' v@(Abs _ _ e1) = g v <> g' e1- g' v@(App _ e1 e2) = g v <> g' e1 <> g' e2- g' v@(Case _ vs alts) = foldl (<>) (foldl (<>) (g v) (map g' vs)) (map i' alts)- g' v@(Let _ ds e1) = foldl (<>) (g v) (map f' ds) <> g' e1- g' v = g v+ g' (Literal ann e) = Literal ann <$> handleLiteral g e+ g' (Accessor ann prop e) = Accessor ann prop <$> g e+ g' (ObjectUpdate ann obj copy vs) = (\obj' -> ObjectUpdate ann obj' copy) <$> g obj <*> traverse (traverse g) vs+ g' (Abs ann name e) = Abs ann name <$> g e+ g' (App ann v1 v2) = App ann <$> g v1 <*> g v2+ g' (Case ann vs alts) = Case ann <$> traverse g vs <*> traverse i alts+ g' (Let ann ds e) = Let ann <$> traverse f ds <*> g' e+ g' e = pure e - h' b@(LiteralBinder _ l) = foldl (<>) (h b) (map h' (extractLiteral l))- h' b@(ConstructorBinder _ _ _ bs) = foldl (<>) (h b) (map h' bs)- h' b@(NamedBinder _ _ b1) = h b <> h' b1- h' b = h b+ h' (LiteralBinder a b) = LiteralBinder a <$> handleLiteral h b+ h' (NamedBinder a name b) = NamedBinder a name <$> h b+ h' (ConstructorBinder a q1 q2 bs) = ConstructorBinder a q1 q2 <$> traverse h bs+ h' b = pure b - i' ca@(CaseAlternative bs (Right val)) = foldl (<>) (i ca) (map h' bs) <> g' val- i' ca@(CaseAlternative bs (Left gs)) = foldl (<>) (i ca) (map h' bs ++ concatMap (\(grd, val) -> [g' grd, g' val]) gs)+ i' ca = CaseAlternative <$> traverse h (caseAlternativeBinders ca) <*> bitraverse (traverse $ bitraverse g g) g (caseAlternativeResult ca) - extractLiteral (ArrayLiteral xs) = xs- extractLiteral (ObjectLiteral xs) = map snd xs- extractLiteral _ = []+ handleLiteral withItem = \case+ ArrayLiteral ls -> ArrayLiteral <$> traverse withItem ls+ ObjectLiteral ls -> ObjectLiteral <$> traverse (traverse withItem) ls+ other -> pure other
+ src/Language/PureScript/CoreImp.hs view
@@ -0,0 +1,13 @@+-- | The imperative core language+module Language.PureScript.CoreImp (+ module C+) where++import Language.PureScript.CoreImp.AST as C+import Language.PureScript.CoreImp.Optimizer as C+import Language.PureScript.CoreImp.Optimizer.Blocks as C+import Language.PureScript.CoreImp.Optimizer.Common as C+import Language.PureScript.CoreImp.Optimizer.Inliner as C+import Language.PureScript.CoreImp.Optimizer.MagicDo as C+import Language.PureScript.CoreImp.Optimizer.TCO as C+import Language.PureScript.CoreImp.Optimizer.Unused as C
+ src/Language/PureScript/CoreImp/AST.hs view
@@ -0,0 +1,242 @@+-- | Data types for the imperative core AST+module Language.PureScript.CoreImp.AST where++import Prelude++import Control.Monad ((>=>))+import Control.Monad.Identity (Identity(..), runIdentity)+import Data.Text (Text)++import Language.PureScript.AST (SourceSpan(..))+import Language.PureScript.Comments (Comment)+import Language.PureScript.Names (ModuleName)+import Language.PureScript.PSString (PSString)+import Language.PureScript.Traversals (sndM)++-- | Built-in unary operators+data UnaryOperator+ = Negate+ | Not+ | BitwiseNot+ | Positive+ | New+ deriving (Show, Eq)++-- | Built-in binary operators+data BinaryOperator+ = Add+ | Subtract+ | Multiply+ | Divide+ | Modulus+ | EqualTo+ | NotEqualTo+ | LessThan+ | LessThanOrEqualTo+ | GreaterThan+ | GreaterThanOrEqualTo+ | And+ | Or+ | BitwiseAnd+ | BitwiseOr+ | BitwiseXor+ | ShiftLeft+ | ShiftRight+ | ZeroFillShiftRight+ deriving (Show, Eq)++-- | Data type for CoreImp comments, which can come from either the PureScript+-- source or internal transformations.+data CIComments+ = SourceComments [Comment]+ | PureAnnotation+ deriving (Show, Eq)++-- |+-- Indicates whether the initializer of a variable is known not to have side+-- effects, and thus can be inlined if needed or removed if unneeded.+--+data InitializerEffects = NoEffects | UnknownEffects deriving (Show, Eq)++-- | Data type for simplified JavaScript expressions+data AST+ = NumericLiteral (Maybe SourceSpan) (Either Integer Double)+ -- ^ A numeric literal+ | StringLiteral (Maybe SourceSpan) PSString+ -- ^ A string literal+ | BooleanLiteral (Maybe SourceSpan) Bool+ -- ^ A boolean literal+ | Unary (Maybe SourceSpan) UnaryOperator AST+ -- ^ A unary operator application+ | Binary (Maybe SourceSpan) BinaryOperator AST AST+ -- ^ A binary operator application+ | ArrayLiteral (Maybe SourceSpan) [AST]+ -- ^ An array literal+ | Indexer (Maybe SourceSpan) AST AST+ -- ^ An array indexer expression+ | ObjectLiteral (Maybe SourceSpan) [(PSString, AST)]+ -- ^ An object literal+ | Function (Maybe SourceSpan) (Maybe Text) [Text] AST+ -- ^ A function introduction (optional name, arguments, body)+ | App (Maybe SourceSpan) AST [AST]+ -- ^ Function application+ | Var (Maybe SourceSpan) Text+ -- ^ Variable+ | ModuleAccessor (Maybe SourceSpan) ModuleName PSString+ -- ^ Value from another module+ | Block (Maybe SourceSpan) [AST]+ -- ^ A block of expressions in braces+ | VariableIntroduction (Maybe SourceSpan) Text (Maybe (InitializerEffects, AST))+ -- ^ A variable introduction and optional initialization+ | Assignment (Maybe SourceSpan) AST AST+ -- ^ A variable assignment+ | While (Maybe SourceSpan) AST AST+ -- ^ While loop+ | For (Maybe SourceSpan) Text AST AST AST+ -- ^ For loop+ | ForIn (Maybe SourceSpan) Text AST AST+ -- ^ ForIn loop+ | IfElse (Maybe SourceSpan) AST AST (Maybe AST)+ -- ^ If-then-else statement+ | Return (Maybe SourceSpan) AST+ -- ^ Return statement+ | ReturnNoResult (Maybe SourceSpan)+ -- ^ Return statement with no return value+ | Throw (Maybe SourceSpan) AST+ -- ^ Throw statement+ | InstanceOf (Maybe SourceSpan) AST AST+ -- ^ instanceof check+ | Comment CIComments AST+ -- ^ Commented JavaScript+ deriving (Show, Eq)++withSourceSpan :: SourceSpan -> AST -> AST+withSourceSpan withSpan = go where+ ss :: Maybe SourceSpan+ ss = Just withSpan++ go :: AST -> AST+ go (NumericLiteral _ n) = NumericLiteral ss n+ go (StringLiteral _ s) = StringLiteral ss s+ go (BooleanLiteral _ b) = BooleanLiteral ss b+ go (Unary _ op j) = Unary ss op j+ go (Binary _ op j1 j2) = Binary ss op j1 j2+ go (ArrayLiteral _ js) = ArrayLiteral ss js+ go (Indexer _ j1 j2) = Indexer ss j1 j2+ go (ObjectLiteral _ js) = ObjectLiteral ss js+ go (Function _ name args j) = Function ss name args j+ go (App _ j js) = App ss j js+ go (Var _ s) = Var ss s+ go (ModuleAccessor _ s1 s2) = ModuleAccessor ss s1 s2+ go (Block _ js) = Block ss js+ go (VariableIntroduction _ name j) = VariableIntroduction ss name j+ go (Assignment _ j1 j2) = Assignment ss j1 j2+ go (While _ j1 j2) = While ss j1 j2+ go (For _ name j1 j2 j3) = For ss name j1 j2 j3+ go (ForIn _ name j1 j2) = ForIn ss name j1 j2+ go (IfElse _ j1 j2 j3) = IfElse ss j1 j2 j3+ go (Return _ js) = Return ss js+ go (ReturnNoResult _) = ReturnNoResult ss+ go (Throw _ js) = Throw ss js+ go (InstanceOf _ j1 j2) = InstanceOf ss j1 j2+ go c@Comment{} = c++getSourceSpan :: AST -> Maybe SourceSpan+getSourceSpan = go where+ go :: AST -> Maybe SourceSpan+ go (NumericLiteral ss _) = ss+ go (StringLiteral ss _) = ss+ go (BooleanLiteral ss _) = ss+ go (Unary ss _ _) = ss+ go (Binary ss _ _ _) = ss+ go (ArrayLiteral ss _) = ss+ go (Indexer ss _ _) = ss+ go (ObjectLiteral ss _) = ss+ go (Function ss _ _ _) = ss+ go (App ss _ _) = ss+ go (Var ss _) = ss+ go (ModuleAccessor ss _ _) = ss+ go (Block ss _) = ss+ go (VariableIntroduction ss _ _) = ss+ go (Assignment ss _ _) = ss+ go (While ss _ _) = ss+ go (For ss _ _ _ _) = ss+ go (ForIn ss _ _ _) = ss+ go (IfElse ss _ _ _) = ss+ go (Return ss _) = ss+ go (ReturnNoResult ss) = ss+ go (Throw ss _) = ss+ go (InstanceOf ss _ _) = ss+ go (Comment _ _) = Nothing++everywhere :: (AST -> AST) -> AST -> AST+everywhere f = go where+ go :: AST -> AST+ go (Unary ss op j) = f (Unary ss op (go j))+ go (Binary ss op j1 j2) = f (Binary ss op (go j1) (go j2))+ go (ArrayLiteral ss js) = f (ArrayLiteral ss (map go js))+ go (Indexer ss j1 j2) = f (Indexer ss (go j1) (go j2))+ go (ObjectLiteral ss js) = f (ObjectLiteral ss (map (fmap go) js))+ go (Function ss name args j) = f (Function ss name args (go j))+ go (App ss j js) = f (App ss (go j) (map go js))+ go (Block ss js) = f (Block ss (map go js))+ go (VariableIntroduction ss name j) = f (VariableIntroduction ss name (fmap (fmap go) j))+ go (Assignment ss j1 j2) = f (Assignment ss (go j1) (go j2))+ go (While ss j1 j2) = f (While ss (go j1) (go j2))+ go (For ss name j1 j2 j3) = f (For ss name (go j1) (go j2) (go j3))+ go (ForIn ss name j1 j2) = f (ForIn ss name (go j1) (go j2))+ go (IfElse ss j1 j2 j3) = f (IfElse ss (go j1) (go j2) (fmap go j3))+ go (Return ss js) = f (Return ss (go js))+ go (Throw ss js) = f (Throw ss (go js))+ go (InstanceOf ss j1 j2) = f (InstanceOf ss (go j1) (go j2))+ go (Comment com j) = f (Comment com (go j))+ go other = f other++everywhereTopDown :: (AST -> AST) -> AST -> AST+everywhereTopDown f = runIdentity . everywhereTopDownM (Identity . f)++everywhereTopDownM :: (Monad m) => (AST -> m AST) -> AST -> m AST+everywhereTopDownM f = f >=> go where+ f' = f >=> go+ go (Unary ss op j) = Unary ss op <$> f' j+ go (Binary ss op j1 j2) = Binary ss op <$> f' j1 <*> f' j2+ go (ArrayLiteral ss js) = ArrayLiteral ss <$> traverse f' js+ go (Indexer ss j1 j2) = Indexer ss <$> f' j1 <*> f' j2+ go (ObjectLiteral ss js) = ObjectLiteral ss <$> traverse (sndM f') js+ go (Function ss name args j) = Function ss name args <$> f' j+ go (App ss j js) = App ss <$> f' j <*> traverse f' js+ go (Block ss js) = Block ss <$> traverse f' js+ go (VariableIntroduction ss name j) = VariableIntroduction ss name <$> traverse (traverse f') j+ go (Assignment ss j1 j2) = Assignment ss <$> f' j1 <*> f' j2+ go (While ss j1 j2) = While ss <$> f' j1 <*> f' j2+ go (For ss name j1 j2 j3) = For ss name <$> f' j1 <*> f' j2 <*> f' j3+ go (ForIn ss name j1 j2) = ForIn ss name <$> f' j1 <*> f' j2+ go (IfElse ss j1 j2 j3) = IfElse ss <$> f' j1 <*> f' j2 <*> traverse f' j3+ go (Return ss j) = Return ss <$> f' j+ go (Throw ss j) = Throw ss <$> f' j+ go (InstanceOf ss j1 j2) = InstanceOf ss <$> f' j1 <*> f' j2+ go (Comment com j) = Comment com <$> f' j+ go other = f other++everything :: (r -> r -> r) -> (AST -> r) -> AST -> r+everything (<>.) f = go where+ go j@(Unary _ _ j1) = f j <>. go j1+ go j@(Binary _ _ j1 j2) = f j <>. go j1 <>. go j2+ go j@(ArrayLiteral _ js) = foldl (<>.) (f j) (map go js)+ go j@(Indexer _ j1 j2) = f j <>. go j1 <>. go j2+ go j@(ObjectLiteral _ js) = foldl (<>.) (f j) (map (go . snd) js)+ go j@(Function _ _ _ j1) = f j <>. go j1+ go j@(App _ j1 js) = foldl (<>.) (f j <>. go j1) (map go js)+ go j@(Block _ js) = foldl (<>.) (f j) (map go js)+ go j@(VariableIntroduction _ _ (Just (_, j1))) = f j <>. go j1+ go j@(Assignment _ j1 j2) = f j <>. go j1 <>. go j2+ go j@(While _ j1 j2) = f j <>. go j1 <>. go j2+ go j@(For _ _ j1 j2 j3) = f j <>. go j1 <>. go j2 <>. go j3+ go j@(ForIn _ _ j1 j2) = f j <>. go j1 <>. go j2+ go j@(IfElse _ j1 j2 Nothing) = f j <>. go j1 <>. go j2+ go j@(IfElse _ j1 j2 (Just j3)) = f j <>. go j1 <>. go j2 <>. go j3+ go j@(Return _ j1) = f j <>. go j1+ go j@(Throw _ j1) = f j <>. go j1+ go j@(InstanceOf _ j1 j2) = f j <>. go j1 <>. go j2+ go j@(Comment _ j1) = f j <>. go j1+ go other = f other
+ src/Language/PureScript/CoreImp/Module.hs view
@@ -0,0 +1,19 @@+module Language.PureScript.CoreImp.Module where++import Protolude+import Data.List.NonEmpty qualified as NEL (NonEmpty)++import Language.PureScript.Comments (Comment)+import Language.PureScript.CoreImp.AST (AST)+import Language.PureScript.PSString (PSString)++data Module = Module+ { modHeader :: [Comment]+ , modImports :: [Import]+ , modBody :: [AST]+ , modExports :: [Export]+ }++data Import = Import Text PSString++data Export = Export (NEL.NonEmpty Text) (Maybe PSString)
+ src/Language/PureScript/CoreImp/Optimizer.hs view
@@ -0,0 +1,85 @@+-- | This module optimizes code in the simplified-JavaScript intermediate representation.+--+-- The following optimizations are supported:+--+-- * Collapsing nested blocks+--+-- * Tail call elimination+--+-- * Inlining of (>>=) and ret for the Eff monad+--+-- * Removal of unnecessary thunks+--+-- * Eta conversion+--+-- * Inlining variables+--+-- * Inline Prelude.($), Prelude.(#), Prelude.(++), Prelude.(!!)+--+-- * Inlining primitive JavaScript operators+module Language.PureScript.CoreImp.Optimizer (optimize) where++import Prelude++import Data.Text (Text)++import Control.Monad.Supply.Class (MonadSupply)+import Language.PureScript.CoreImp.AST (AST(..), InitializerEffects(..))+import Language.PureScript.CoreImp.Optimizer.Blocks (collapseNestedBlocks, collapseNestedIfs)+import Language.PureScript.CoreImp.Optimizer.Common (applyAll, replaceIdents)+import Language.PureScript.CoreImp.Optimizer.Inliner (etaConvert, evaluateIifes, inlineCommonOperators, inlineCommonValues, inlineFnComposition, inlineFnIdentity, inlineUnsafeCoerce, inlineUnsafePartial, inlineVariables, unThunk)+import Language.PureScript.CoreImp.Optimizer.MagicDo (inlineST, magicDoEff, magicDoEffect, magicDoST)+import Language.PureScript.CoreImp.Optimizer.TCO (tco)+import Language.PureScript.CoreImp.Optimizer.Unused (removeCodeAfterReturnStatements, removeUndefinedApp, removeUnusedEffectFreeVars)++-- | Apply a series of optimizer passes to simplified JavaScript code+optimize :: forall m. MonadSupply m => [Text] -> [[AST]] -> m [[AST]]+optimize exps jsDecls = removeUnusedEffectFreeVars exps <$> traverse (traverse go) jsDecls+ where+ go :: AST -> m AST+ go js = do+ js' <- untilFixedPoint (inlineFnComposition expander . inlineFnIdentity expander . inlineUnsafeCoerce . inlineUnsafePartial . tidyUp . applyAll+ [ inlineCommonValues expander+ , inlineCommonOperators expander+ ]) js+ untilFixedPoint (return . tidyUp) . tco . inlineST+ =<< untilFixedPoint (return . magicDoST expander)+ =<< untilFixedPoint (return . magicDoEff expander)+ =<< untilFixedPoint (return . magicDoEffect expander) js'++ tidyUp :: AST -> AST+ tidyUp = applyAll+ [ collapseNestedBlocks+ , collapseNestedIfs+ , removeCodeAfterReturnStatements+ , removeUndefinedApp+ , unThunk+ , etaConvert+ , evaluateIifes+ , inlineVariables+ ]++ expander = buildExpander (concat jsDecls)++untilFixedPoint :: (Monad m, Eq a) => (a -> m a) -> a -> m a+untilFixedPoint f = go+ where+ go a = do+ a' <- f a+ if a' == a then return a' else go a'++-- |+-- Take all top-level ASTs and return a function for expanding top-level+-- variables during the various inlining steps in `optimize`.+--+-- Everything that gets inlined as an optimization is of a form that would+-- have been lifted to a top-level binding during CSE, so for purposes of+-- inlining we can save some time by only expanding variables bound at that+-- level and not worrying about any inner scopes.+--+buildExpander :: [AST] -> AST -> AST+buildExpander = replaceIdents . foldr go []+ where+ go = \case+ VariableIntroduction _ name (Just (NoEffects, e)) -> ((name, e) :)+ _ -> id
+ src/Language/PureScript/CoreImp/Optimizer/Blocks.hs view
@@ -0,0 +1,28 @@+-- | Optimizer steps for simplifying JavaScript blocks+module Language.PureScript.CoreImp.Optimizer.Blocks+ ( collapseNestedBlocks+ , collapseNestedIfs+ ) where++import Prelude++import Language.PureScript.CoreImp.AST (AST(..), BinaryOperator(..), everywhere)++-- | Collapse blocks which appear nested directly below another block+collapseNestedBlocks :: AST -> AST+collapseNestedBlocks = everywhere collapse where+ collapse :: AST -> AST+ collapse (Block ss sts) = Block ss (concatMap go sts)+ collapse js = js+ + go :: AST -> [AST]+ go (Block _ sts) = sts+ go s = [s]++collapseNestedIfs :: AST -> AST+collapseNestedIfs = everywhere collapse where+ collapse :: AST -> AST+ collapse (IfElse _ (BooleanLiteral _ True) (Block _ [js]) _) = js+ collapse (IfElse s1 cond1 (Block _ [IfElse s2 cond2 body Nothing]) Nothing) =+ IfElse s1 (Binary s2 And cond1 cond2) body Nothing+ collapse js = js
+ src/Language/PureScript/CoreImp/Optimizer/Common.hs view
@@ -0,0 +1,72 @@+-- | Common functions used by the various optimizer phases+module Language.PureScript.CoreImp.Optimizer.Common where++import Prelude++import Data.Text (Text)+import Data.List (foldl')+import Data.Maybe (fromMaybe)++import Language.PureScript.Crash (internalError)+import Language.PureScript.CoreImp.AST (AST(..), everything, everywhere)+import Language.PureScript.Names (ModuleName)+import Language.PureScript.PSString (PSString)++applyAll :: [a -> a] -> a -> a+applyAll = foldl' (.) id++replaceIdent :: Text -> AST -> AST -> AST+replaceIdent var1 js = everywhere replace+ where+ replace (Var _ var2) | var1 == var2 = js+ replace other = other++replaceIdents :: [(Text, AST)] -> AST -> AST+replaceIdents vars = everywhere replace+ where+ replace v@(Var _ var) = fromMaybe v $ lookup var vars+ replace other = other++isReassigned :: Text -> AST -> Bool+isReassigned var1 = everything (||) check+ where+ check :: AST -> Bool+ check (Function _ _ args _) | var1 `elem` args = True+ check (VariableIntroduction _ arg _) | var1 == arg = True+ check (Assignment _ (Var _ arg) _) | var1 == arg = True+ check (For _ arg _ _ _) | var1 == arg = True+ check (ForIn _ arg _ _) | var1 == arg = True+ check _ = False++isRebound :: AST -> AST -> Bool+isRebound js d = any (\v -> isReassigned v d || isUpdated v d) (everything (++) variablesOf js)+ where+ variablesOf (Var _ var) = [var]+ variablesOf _ = []++targetVariable :: AST -> Text+targetVariable (Var _ var) = var+targetVariable (Indexer _ _ tgt) = targetVariable tgt+targetVariable _ = internalError "Invalid argument to targetVariable"++isUpdated :: Text -> AST -> Bool+isUpdated var1 = everything (||) check+ where+ check :: AST -> Bool+ check (Assignment _ target _) | var1 == targetVariable target = True+ check _ = False++removeFromBlock :: ([AST] -> [AST]) -> AST -> AST+removeFromBlock go (Block ss sts) = Block ss (go sts)+removeFromBlock _ js = js++pattern Ref :: (ModuleName, PSString) -> AST+pattern Ref pair <- (refPatternHelper -> Just pair)+-- ideally: pattern Ref (moduleName, refName) <- ModuleAccessor _ moduleName refName+-- but: https://gitlab.haskell.org/ghc/ghc/-/issues/12203+-- https://github.com/ghc-proposals/ghc-proposals/pull/138++refPatternHelper :: AST -> Maybe (ModuleName, PSString)+refPatternHelper = \case+ ModuleAccessor _ moduleName refName -> Just (moduleName, refName)+ _ -> Nothing
+ src/Language/PureScript/CoreImp/Optimizer/Inliner.hs view
@@ -0,0 +1,294 @@+-- | This module performs basic inlining of known functions+module Language.PureScript.CoreImp.Optimizer.Inliner+ ( inlineVariables+ , inlineCommonValues+ , inlineCommonOperators+ , inlineFnComposition+ , inlineFnIdentity+ , inlineUnsafeCoerce+ , inlineUnsafePartial+ , etaConvert+ , unThunk+ , evaluateIifes+ ) where++import Prelude++import Control.Monad.Supply.Class (MonadSupply, freshName)++import Data.Either (rights)+import Data.Maybe (fromMaybe)+import Data.Text (Text)+import Data.Text qualified as T++import Language.PureScript.Names (ModuleName)+import Language.PureScript.PSString (PSString, mkString)+import Language.PureScript.CoreImp.AST (AST(..), BinaryOperator(..), InitializerEffects(..), UnaryOperator(..), everywhere, everywhereTopDown, everywhereTopDownM, getSourceSpan)+import Language.PureScript.CoreImp.Optimizer.Common (pattern Ref, applyAll, isReassigned, isRebound, isUpdated, removeFromBlock, replaceIdent, replaceIdents)+import Language.PureScript.AST (SourceSpan(..))+import Language.PureScript.Constants.Libs qualified as C+import Language.PureScript.Constants.Prim qualified as C++-- TODO: Potential bug:+-- Shouldn't just inline this case: { var x = 0; x.toFixed(10); }+-- Needs to be: { 0..toFixed(10); }+-- Probably needs to be fixed in pretty-printer instead.+shouldInline :: AST -> Bool+shouldInline (Var _ _) = True+shouldInline (ModuleAccessor _ _ _) = True+shouldInline (NumericLiteral _ _) = True+shouldInline (StringLiteral _ _) = True+shouldInline (BooleanLiteral _ _) = True+shouldInline (Indexer _ index val) = shouldInline index && shouldInline val+shouldInline _ = False++etaConvert :: AST -> AST+etaConvert = everywhere convert+ where+ convert :: AST -> AST+ convert (Block ss [Return _ (App _ (Function _ Nothing idents block@(Block _ body)) args)])+ | all shouldInline args &&+ not (any ((`isRebound` block) . Var Nothing) idents) &&+ not (any (`isRebound` block) args)+ = Block ss (map (replaceIdents (zip idents args)) body)+ convert (Function _ Nothing [] (Block _ [Return _ (App _ fn [])])) = fn+ convert js = js++unThunk :: AST -> AST+unThunk = everywhere convert+ where+ convert :: AST -> AST+ convert (Block ss []) = Block ss []+ convert (Block ss jss) =+ case last jss of+ Return _ (App _ (Function _ Nothing [] (Block _ body)) []) -> Block ss $ init jss ++ body+ _ -> Block ss jss+ convert js = js++evaluateIifes :: AST -> AST+evaluateIifes = everywhere convert+ where+ convert :: AST -> AST+ convert (App _ (Function _ Nothing [] (Block _ [Return _ ret])) []) = ret+ convert (App _ (Function _ Nothing idents (Block _ [Return ss ret])) [])+ | not (any (`isReassigned` ret) idents) = replaceIdents (map (, Var ss C.S_undefined) idents) ret+ convert js = js++inlineVariables :: AST -> AST+inlineVariables = everywhere $ removeFromBlock go+ where+ go :: [AST] -> [AST]+ go [] = []+ go (VariableIntroduction _ var (Just (_, js)) : sts)+ | shouldInline js && not (any (isReassigned var) sts) && not (any (isRebound js) sts) && not (any (isUpdated var) sts) =+ go (map (replaceIdent var js) sts)+ go (s:sts) = s : go sts++inlineCommonValues :: (AST -> AST) -> AST -> AST+inlineCommonValues expander = everywhere convert+ where+ convert :: AST -> AST+ convert (expander -> App ss (Ref fn) [Ref dict])+ | dict `elem` [C.P_semiringNumber, C.P_semiringInt], C.P_zero <- fn = NumericLiteral ss (Left 0)+ | dict `elem` [C.P_semiringNumber, C.P_semiringInt], C.P_one <- fn = NumericLiteral ss (Left 1)+ | C.P_boundedBoolean <- dict, C.P_bottom <- fn = BooleanLiteral ss False+ | C.P_boundedBoolean <- dict, C.P_top <- fn = BooleanLiteral ss True+ convert (App ss (expander -> App _ (Ref C.P_negate) [Ref C.P_ringInt]) [x])+ = Binary ss BitwiseOr (Unary ss Negate x) (NumericLiteral ss (Left 0))+ convert (App ss (App _ (expander -> App _ (Ref fn) [Ref dict]) [x]) [y])+ | C.P_semiringInt <- dict, C.P_add <- fn = intOp ss Add x y+ | C.P_semiringInt <- dict, C.P_mul <- fn = intOp ss Multiply x y+ | C.P_ringInt <- dict, C.P_sub <- fn = intOp ss Subtract x y+ convert other = other+ intOp ss op x y = Binary ss BitwiseOr (Binary ss op x y) (NumericLiteral ss (Left 0))++inlineCommonOperators :: (AST -> AST) -> AST -> AST+inlineCommonOperators expander = everywhereTopDown $ applyAll $+ [ binary C.P_semiringNumber C.P_add Add+ , binary C.P_semiringNumber C.P_mul Multiply++ , binary C.P_ringNumber C.P_sub Subtract+ , unary C.P_ringNumber C.P_negate Negate++ , binary C.P_euclideanRingNumber C.P_div Divide++ , binary C.P_eqNumber C.P_eq EqualTo+ , binary C.P_eqNumber C.P_notEq NotEqualTo+ , binary C.P_eqInt C.P_eq EqualTo+ , binary C.P_eqInt C.P_notEq NotEqualTo+ , binary C.P_eqString C.P_eq EqualTo+ , binary C.P_eqString C.P_notEq NotEqualTo+ , binary C.P_eqChar C.P_eq EqualTo+ , binary C.P_eqChar C.P_notEq NotEqualTo+ , binary C.P_eqBoolean C.P_eq EqualTo+ , binary C.P_eqBoolean C.P_notEq NotEqualTo++ , binary C.P_ordBoolean C.P_lessThan LessThan+ , binary C.P_ordBoolean C.P_lessThanOrEq LessThanOrEqualTo+ , binary C.P_ordBoolean C.P_greaterThan GreaterThan+ , binary C.P_ordBoolean C.P_greaterThanOrEq GreaterThanOrEqualTo+ , binary C.P_ordChar C.P_lessThan LessThan+ , binary C.P_ordChar C.P_lessThanOrEq LessThanOrEqualTo+ , binary C.P_ordChar C.P_greaterThan GreaterThan+ , binary C.P_ordChar C.P_greaterThanOrEq GreaterThanOrEqualTo+ , binary C.P_ordInt C.P_lessThan LessThan+ , binary C.P_ordInt C.P_lessThanOrEq LessThanOrEqualTo+ , binary C.P_ordInt C.P_greaterThan GreaterThan+ , binary C.P_ordInt C.P_greaterThanOrEq GreaterThanOrEqualTo+ , binary C.P_ordNumber C.P_lessThan LessThan+ , binary C.P_ordNumber C.P_lessThanOrEq LessThanOrEqualTo+ , binary C.P_ordNumber C.P_greaterThan GreaterThan+ , binary C.P_ordNumber C.P_greaterThanOrEq GreaterThanOrEqualTo+ , binary C.P_ordString C.P_lessThan LessThan+ , binary C.P_ordString C.P_lessThanOrEq LessThanOrEqualTo+ , binary C.P_ordString C.P_greaterThan GreaterThan+ , binary C.P_ordString C.P_greaterThanOrEq GreaterThanOrEqualTo++ , binary C.P_semigroupString C.P_append Add++ , binary C.P_heytingAlgebraBoolean C.P_conj And+ , binary C.P_heytingAlgebraBoolean C.P_disj Or+ , unary C.P_heytingAlgebraBoolean C.P_not Not++ , binary' C.P_or BitwiseOr+ , binary' C.P_and BitwiseAnd+ , binary' C.P_xor BitwiseXor+ , binary' C.P_shl ShiftLeft+ , binary' C.P_shr ShiftRight+ , binary' C.P_zshr ZeroFillShiftRight+ , unary' C.P_complement BitwiseNot++ , inlineNonClassFunction (isModFnWithDict C.P_unsafeIndex) $ flip (Indexer Nothing)+ ] +++ [ fn | i <- [0..10], fn <- [ mkFn i, runFn i ] ] +++ [ fn | i <- [0..10], fn <- [ mkEffFn C.P_mkEffFn i, runEffFn C.P_runEffFn i ] ] +++ [ fn | i <- [0..10], fn <- [ mkEffFn C.P_mkEffectFn i, runEffFn C.P_runEffectFn i ] ] +++ [ fn | i <- [0..10], fn <- [ mkEffFn C.P_mkSTFn i, runEffFn C.P_runSTFn i ] ]+ where+ binary :: (ModuleName, PSString) -> (ModuleName, PSString) -> BinaryOperator -> AST -> AST+ binary dict fn op = convert where+ convert :: AST -> AST+ convert (App ss (App _ (expander -> App _ (Ref fn') [Ref dict']) [x]) [y]) | dict == dict', fn == fn' = Binary ss op x y+ convert other = other+ binary' :: (ModuleName, PSString) -> BinaryOperator -> AST -> AST+ binary' fn op = convert where+ convert :: AST -> AST+ convert (App ss (App _ (Ref fn') [x]) [y]) | fn == fn' = Binary ss op x y+ convert other = other+ unary :: (ModuleName, PSString) -> (ModuleName, PSString) -> UnaryOperator -> AST -> AST+ unary dict fn op = convert where+ convert :: AST -> AST+ convert (App ss (expander -> App _ (Ref fn') [Ref dict']) [x]) | dict == dict', fn == fn' = Unary ss op x+ convert other = other+ unary' :: (ModuleName, PSString) -> UnaryOperator -> AST -> AST+ unary' fn op = convert where+ convert :: AST -> AST+ convert (App ss (Ref fn') [x]) | fn == fn' = Unary ss op x+ convert other = other++ mkFn :: Int -> AST -> AST+ mkFn = mkFn' C.P_mkFn $ \ss1 ss2 ss3 args js ->+ Function ss1 Nothing args (Block ss2 [Return ss3 js])++ mkEffFn :: (ModuleName, PSString) -> Int -> AST -> AST+ mkEffFn mkFn_ = mkFn' mkFn_ $ \ss1 ss2 ss3 args js ->+ Function ss1 Nothing args (Block ss2 [Return ss3 (App ss3 js [])])++ mkFn' :: (ModuleName, PSString) -> (Maybe SourceSpan -> Maybe SourceSpan -> Maybe SourceSpan -> [Text] -> AST -> AST) -> Int -> AST -> AST+ mkFn' mkFn_ res 0 = convert where+ convert :: AST -> AST+ convert (App _ (Ref mkFnN) [Function s1 Nothing [_] (Block s2 [Return s3 js])]) | isNFn mkFn_ 0 mkFnN =+ res s1 s2 s3 [] js+ convert other = other+ mkFn' mkFn_ res n = convert where+ convert :: AST -> AST+ convert orig@(App ss (Ref mkFnN) [fn]) | isNFn mkFn_ n mkFnN =+ case collectArgs n [] fn of+ Just (args, [Return ss' ret]) -> res ss ss ss' args ret+ _ -> orig+ convert other = other+ collectArgs :: Int -> [Text] -> AST -> Maybe ([Text], [AST])+ collectArgs 1 acc (Function _ Nothing [oneArg] (Block _ js)) | length acc == n - 1 = Just (reverse (oneArg : acc), js)+ collectArgs m acc (Function _ Nothing [oneArg] (Block _ [Return _ ret])) = collectArgs (m - 1) (oneArg : acc) ret+ collectArgs _ _ _ = Nothing++ isNFn :: (ModuleName, PSString) -> Int -> (ModuleName, PSString) -> Bool+ isNFn prefix n fn = fmap (<> mkString (T.pack $ show n)) prefix == fn++ runFn :: Int -> AST -> AST+ runFn = runFn' C.P_runFn App++ runEffFn :: (ModuleName, PSString) -> Int -> AST -> AST+ runEffFn runFn_ = runFn' runFn_ $ \ss fn acc ->+ Function ss Nothing [] (Block ss [Return ss (App ss fn acc)])++ runFn' :: (ModuleName, PSString) -> (Maybe SourceSpan -> AST -> [AST] -> AST) -> Int -> AST -> AST+ runFn' runFn_ res n = convert where+ convert :: AST -> AST+ convert js = fromMaybe js $ go n [] js++ go :: Int -> [AST] -> AST -> Maybe AST+ go 0 acc (App ss (Ref runFnN) [fn]) | isNFn runFn_ n runFnN && length acc == n =+ Just $ res ss fn acc+ go m acc (App _ lhs [arg]) = go (m - 1) (arg : acc) lhs+ go _ _ _ = Nothing++ inlineNonClassFunction :: (AST -> Bool) -> (AST -> AST -> AST) -> AST -> AST+ inlineNonClassFunction p f = convert where+ convert :: AST -> AST+ convert (App _ (App _ op' [x]) [y]) | p op' = f x y+ convert other = other++ isModFnWithDict :: (ModuleName, PSString) -> AST -> Bool+ isModFnWithDict fn (App _ (Ref fn') [Var _ _]) = fn == fn'+ isModFnWithDict _ _ = False++-- (f <<< g $ x) = f (g x)+-- (f <<< g) = \x -> f (g x)+inlineFnComposition :: forall m. MonadSupply m => (AST -> AST) -> AST -> m AST+inlineFnComposition expander = everywhereTopDownM convert+ where+ convert :: AST -> m AST+ convert (App s1 (App s2 (App _ (expander -> App _ (Ref fn) [Ref C.P_semigroupoidFn]) [x]) [y]) [z])+ | C.P_compose <- fn = return $ App s1 x [App s2 y [z]]+ | C.P_composeFlipped <- fn = return $ App s2 y [App s1 x [z]]+ convert app@(App ss (App _ (expander -> App _ (Ref fn) [Ref C.P_semigroupoidFn]) _) _)+ | fn `elem` [C.P_compose, C.P_composeFlipped] = mkApps ss <$> goApps app <*> freshName+ convert other = return other++ mkApps :: Maybe SourceSpan -> [Either AST (Text, AST)] -> Text -> AST+ mkApps ss fns a = App ss (Function ss Nothing [] (Block ss $ vars <> [Return Nothing comp])) []+ where+ vars = uncurry (VariableIntroduction ss) . fmap (Just . (UnknownEffects, )) <$> rights fns+ comp = Function ss Nothing [a] (Block ss [Return Nothing apps])+ apps = foldr (\fn acc -> App ss (mkApp fn) [acc]) (Var ss a) fns++ mkApp :: Either AST (Text, AST) -> AST+ mkApp = either id $ \(name, arg) -> Var (getSourceSpan arg) name++ goApps :: AST -> m [Either AST (Text, AST)]+ goApps (App _ (App _ (expander -> App _ (Ref fn) [Ref C.P_semigroupoidFn]) [x]) [y])+ | C.P_compose <- fn = mappend <$> goApps x <*> goApps y+ | C.P_composeFlipped <- fn = mappend <$> goApps y <*> goApps x+ goApps app@App {} = pure . Right . (,app) <$> freshName+ goApps other = pure [Left other]++inlineFnIdentity :: (AST -> AST) -> AST -> AST+inlineFnIdentity expander = everywhereTopDown convert+ where+ convert :: AST -> AST+ convert (App _ (expander -> App _ (Ref C.P_identity) [Ref C.P_categoryFn]) [x]) = x+ convert other = other++inlineUnsafeCoerce :: AST -> AST+inlineUnsafeCoerce = everywhereTopDown convert where+ convert (App _ (Ref C.P_unsafeCoerce) [ comp ]) = comp+ convert other = other++inlineUnsafePartial :: AST -> AST+inlineUnsafePartial = everywhereTopDown convert where+ convert (App ss (Ref C.P_unsafePartial) [ comp ])+ -- Apply to undefined here, the application should be optimized away+ -- if it is safe to do so+ = App ss comp [ Var ss C.S_undefined ]+ convert other = other
+ src/Language/PureScript/CoreImp/Optimizer/MagicDo.hs view
@@ -0,0 +1,136 @@+-- | This module implements the "Magic Do" optimization, which inlines calls to return+-- and bind for the Eff monad, as well as some of its actions.+module Language.PureScript.CoreImp.Optimizer.MagicDo (magicDoEffect, magicDoEff, magicDoST, inlineST) where++import Prelude+import Protolude (ordNub)++import Data.Maybe (fromJust, isJust)++import Language.PureScript.CoreImp.AST (AST(..), InitializerEffects(..), UnaryOperator(..), everything, everywhere, everywhereTopDown)+import Language.PureScript.CoreImp.Optimizer.Common (pattern Ref)+import Language.PureScript.Names (ModuleName)+import Language.PureScript.PSString (mkString)+import Language.PureScript.Constants.Libs qualified as C++-- | Inline type class dictionaries for >>= and return for the Eff monad+--+-- E.g.+--+-- Prelude[">>="](dict)(m1)(function(x) {+-- return ...;+-- })+--+-- becomes+--+-- function __do {+-- var x = m1();+-- ...+-- }+magicDoEff :: (AST -> AST) -> AST -> AST+magicDoEff = magicDo C.M_Control_Monad_Eff C.effDictionaries++magicDoEffect :: (AST -> AST) -> AST -> AST+magicDoEffect = magicDo C.M_Effect C.effectDictionaries++magicDoST :: (AST -> AST) -> AST -> AST+magicDoST = magicDo C.M_Control_Monad_ST_Internal C.stDictionaries++magicDo :: ModuleName -> C.EffectDictionaries -> (AST -> AST) -> AST -> AST+magicDo effectModule C.EffectDictionaries{..} expander = everywhereTopDown convert+ where+ -- The name of the function block which is added to denote a do block+ fnName = "__do"+ -- Desugar monomorphic calls to >>= and return for the Eff monad+ convert :: AST -> AST+ -- Desugar pure+ convert (App _ (App _ pure' [val]) []) | isPure pure' = val+ -- Desugar discard+ convert (App _ (App _ bind [m]) [Function s1 Nothing [] (Block s2 js)]) | isDiscard bind =+ Function s1 (Just fnName) [] $ Block s2 (App s2 m [] : map applyReturns js )+ -- Desugar bind to wildcard+ convert (App _ (App _ bind [m]) [Function s1 Nothing [] (Block s2 js)])+ | isBind bind =+ Function s1 (Just fnName) [] $ Block s2 (App s2 m [] : map applyReturns js )+ -- Desugar bind+ convert (App _ (App _ bind [m]) [Function s1 Nothing [arg] (Block s2 js)]) | isBind bind =+ Function s1 (Just fnName) [] $ Block s2 (VariableIntroduction s2 arg (Just (UnknownEffects, App s2 m [])) : map applyReturns js)+ -- Desugar untilE+ convert (App s1 (App _ f [arg]) []) | isEffFunc edUntil f =+ App s1 (Function s1 Nothing [] (Block s1 [ While s1 (Unary s1 Not (App s1 arg [])) (Block s1 []), Return s1 $ ObjectLiteral s1 []])) []+ -- Desugar whileE+ convert (App _ (App _ (App s1 f [arg1]) [arg2]) []) | isEffFunc edWhile f =+ App s1 (Function s1 Nothing [] (Block s1 [ While s1 (App s1 arg1 []) (Block s1 [ App s1 arg2 [] ]), Return s1 $ ObjectLiteral s1 []])) []+ -- Inline __do returns+ convert (Return _ (App _ (Function _ (Just ident) [] body) [])) | ident == fnName = body+ -- Inline double applications+ convert (App _ (App s1 (Function s2 Nothing [] (Block ss body)) []) []) =+ App s1 (Function s2 Nothing [] (Block ss (applyReturns `fmap` body))) []+ convert other = other+ -- Check if an expression represents a monomorphic call to >>= for the Eff monad+ isBind (expander -> App _ (Ref C.P_bind) [Ref dict]) = (effectModule, edBindDict) == dict+ isBind _ = False+ -- Check if an expression represents a call to @discard@+ isDiscard (expander -> App _ (expander -> App _ (Ref C.P_discard) [Ref C.P_discardUnit]) [Ref dict]) = (effectModule, edBindDict) == dict+ isDiscard _ = False+ -- Check if an expression represents a monomorphic call to pure or return for the Eff applicative+ isPure (expander -> App _ (Ref C.P_pure) [Ref dict]) = (effectModule, edApplicativeDict) == dict+ isPure _ = False+ -- Check if an expression represents a function in the Effect module+ isEffFunc name (Ref fn) = (effectModule, name) == fn+ isEffFunc _ _ = False++ applyReturns :: AST -> AST+ applyReturns (Return ss ret) = Return ss (App ss ret [])+ applyReturns (Block ss jss) = Block ss (map applyReturns jss)+ applyReturns (While ss cond js) = While ss cond (applyReturns js)+ applyReturns (For ss v lo hi js) = For ss v lo hi (applyReturns js)+ applyReturns (ForIn ss v xs js) = ForIn ss v xs (applyReturns js)+ applyReturns (IfElse ss cond t f) = IfElse ss cond (applyReturns t) (applyReturns `fmap` f)+ applyReturns other = other++-- | Inline functions in the ST module+inlineST :: AST -> AST+inlineST = everywhere convertBlock+ where+ -- Look for run blocks and inline the STRefs there.+ -- If all STRefs are used in the scope of the same run, only using { read, write, modify } then+ -- we can be more aggressive about inlining, and actually turn STRefs into local variables.+ convertBlock (App s1 (Ref C.P_run) [arg]) =+ let refs = ordNub . findSTRefsIn $ arg+ usages = findAllSTUsagesIn arg+ allUsagesAreLocalVars = all (\u -> let v = toVar u in isJust v && fromJust v `elem` refs) usages+ localVarsDoNotEscape = all (\r -> length (r `appearingIn` arg) == length (filter (\u -> let v = toVar u in v == Just r) usages)) refs+ in App s1 (everywhere (convert (allUsagesAreLocalVars && localVarsDoNotEscape)) arg) []+ convertBlock other = other+ -- Convert a block in a safe way, preserving object wrappers of references,+ -- or in a more aggressive way, turning wrappers into local variables depending on the+ -- agg(ressive) parameter.+ convert agg (App s1 (Ref C.P_new) [arg]) =+ Function s1 Nothing [] (Block s1 [Return s1 $ if agg then arg else ObjectLiteral s1 [(mkString C.stRefValue, arg)]])+ convert agg (App _ (App s1 (Ref C.P_read) [ref]) []) =+ if agg then ref else Indexer s1 (StringLiteral s1 C.stRefValue) ref+ convert agg (App _ (App _ (App s1 (Ref C.P_write) [arg]) [ref]) []) =+ if agg then Assignment s1 ref arg else Assignment s1 (Indexer s1 (StringLiteral s1 C.stRefValue) ref) arg+ convert agg (App _ (App _ (App s1 (Ref C.P_modify) [func]) [ref]) []) =+ if agg then Assignment s1 ref (App s1 func [ref]) else Assignment s1 (Indexer s1 (StringLiteral s1 C.stRefValue) ref) (App s1 func [Indexer s1 (StringLiteral s1 C.stRefValue) ref])+ convert _ other = other+ -- Find all ST Refs initialized in this block+ findSTRefsIn = everything (++) isSTRef+ where+ isSTRef (VariableIntroduction _ ident (Just (_, App _ (App _ (Ref C.P_new) [_]) []))) = [ident]+ isSTRef _ = []+ -- Find all STRefs used as arguments to read, write, modify+ findAllSTUsagesIn = everything (++) isSTUsage+ where+ isSTUsage (App _ (App _ (Ref C.P_read) [ref]) []) = [ref]+ isSTUsage (App _ (App _ (App _ (Ref f) [_]) [ref]) []) | f `elem` [C.P_write, C.P_modify] = [ref]+ isSTUsage _ = []+ -- Find all uses of a variable+ appearingIn ref = everything (++) isVar+ where+ isVar e@(Var _ v) | v == ref = [e]+ isVar _ = []+ -- Convert a AST value to a String if it is a Var+ toVar (Var _ v) = Just v+ toVar _ = Nothing
+ src/Language/PureScript/CoreImp/Optimizer/TCO.hs view
@@ -0,0 +1,191 @@+-- | This module implements tail call elimination.+module Language.PureScript.CoreImp.Optimizer.TCO (tco) where++import Prelude++import Control.Applicative (empty, liftA2)+import Control.Monad (guard)+import Control.Monad.State (State, evalState, get, modify)+import Data.Functor (($>), (<&>))+import Data.Set qualified as S+import Data.Text (Text, pack)+import Language.PureScript.CoreImp.AST (AST(..), InitializerEffects(..), UnaryOperator(..), everything, everywhereTopDownM)+import Language.PureScript.AST.SourcePos (SourceSpan)+import Safe (headDef, tailSafe)++-- | Eliminate tail calls+tco :: AST -> AST+tco = flip evalState 0 . everywhereTopDownM convert where+ tcoVar :: Text -> Text+ tcoVar arg = "$tco_var_" <> arg++ copyVar :: Text -> Text+ copyVar arg = "$copy_" <> arg++ tcoDoneM :: State Int Text+ tcoDoneM = get <&> \count -> "$tco_done" <>+ if count == 0 then "" else pack . show $ count++ tcoLoop :: Text+ tcoLoop = "$tco_loop"++ tcoResult :: Text+ tcoResult = "$tco_result"++ convert :: AST -> State Int AST+ convert (VariableIntroduction ss name (Just (p, fn@Function {})))+ | Just trFns <- findTailRecursiveFns name arity body'+ = VariableIntroduction ss name . Just . (p,) . replace <$> toLoop trFns name arity outerArgs innerArgs body'+ where+ innerArgs = headDef [] argss+ outerArgs = concat . reverse $ tailSafe argss+ arity = length argss+ -- this is the number of calls, not the number of arguments, if there's+ -- ever a practical difference.+ (argss, body', replace) = topCollectAllFunctionArgs [] id fn+ convert js = pure js++ rewriteFunctionsWith :: ([Text] -> [Text]) -> [[Text]] -> (AST -> AST) -> AST -> ([[Text]], AST, AST -> AST)+ rewriteFunctionsWith argMapper = collectAllFunctionArgs+ where+ collectAllFunctionArgs allArgs f (Function s1 ident args (Block s2 (body@(Return _ _):_))) =+ collectAllFunctionArgs (args : allArgs) (\b -> f (Function s1 ident (argMapper args) (Block s2 [b]))) body+ collectAllFunctionArgs allArgs f (Function ss ident args body@(Block _ _)) =+ (args : allArgs, body, f . Function ss ident (argMapper args))+ collectAllFunctionArgs allArgs f (Return s1 (Function s2 ident args (Block s3 [body]))) =+ collectAllFunctionArgs (args : allArgs) (\b -> f (Return s1 (Function s2 ident (argMapper args) (Block s3 [b])))) body+ collectAllFunctionArgs allArgs f (Return s1 (Function s2 ident args body@(Block _ _))) =+ (args : allArgs, body, f . Return s1 . Function s2 ident (argMapper args))+ collectAllFunctionArgs allArgs f body = (allArgs, body, f)++ topCollectAllFunctionArgs :: [[Text]] -> (AST -> AST) -> AST -> ([[Text]], AST, AST -> AST)+ topCollectAllFunctionArgs = rewriteFunctionsWith (map copyVar)++ innerCollectAllFunctionArgs :: [[Text]] -> (AST -> AST) -> AST -> ([[Text]], AST, AST -> AST)+ innerCollectAllFunctionArgs = rewriteFunctionsWith id++ countReferences :: Text -> AST -> Int+ countReferences ident = everything (+) match where+ match :: AST -> Int+ match (Var _ ident') | ident == ident' = 1+ match _ = 0++ -- If `ident` is a tail-recursive function, returns a set of identifiers+ -- that are locally bound to functions participating in the tail recursion.+ -- Otherwise, returns Nothing.+ findTailRecursiveFns :: Text -> Int -> AST -> Maybe (S.Set Text)+ findTailRecursiveFns ident arity js = guard (countReferences ident js > 0) *> go (S.empty, S.singleton (ident, arity))+ where++ go :: (S.Set Text, S.Set (Text, Int)) -> Maybe (S.Set Text)+ go (known, required) =+ case S.minView required of+ Just (r, required') -> do+ required'' <- findTailPositionDeps r js+ go (S.insert (fst r) known, required' <> S.filter (not . (`S.member` known) . fst) required'')+ Nothing ->+ pure known++ -- Returns set of identifiers (with their arities) that need to be used+ -- exclusively in tail calls using their full arity in order for this+ -- identifier to be considered in tail position (or Nothing if this+ -- identifier is used somewhere not as a tail call with full arity).+ findTailPositionDeps :: (Text, Int) -> AST -> Maybe (S.Set (Text, Int))+ findTailPositionDeps (ident, arity) = allInTailPosition where+ countSelfReferences = countReferences ident++ allInTailPosition (Return _ expr)+ | isSelfCall ident arity expr = guard (countSelfReferences expr == 1) $> S.empty+ | otherwise = guard (countSelfReferences expr == 0) $> S.empty+ allInTailPosition (While _ js1 body)+ = guard (countSelfReferences js1 == 0) *> allInTailPosition body+ allInTailPosition (For _ _ js1 js2 body)+ = guard (countSelfReferences js1 == 0 && countSelfReferences js2 == 0) *> allInTailPosition body+ allInTailPosition (ForIn _ _ js1 body)+ = guard (countSelfReferences js1 == 0) *> allInTailPosition body+ allInTailPosition (IfElse _ js1 body el)+ = guard (countSelfReferences js1 == 0) *> liftA2 mappend (allInTailPosition body) (foldMapA allInTailPosition el)+ allInTailPosition (Block _ body)+ = foldMapA allInTailPosition body+ allInTailPosition (Throw _ js1)+ = guard (countSelfReferences js1 == 0) $> S.empty+ allInTailPosition (ReturnNoResult _)+ = pure S.empty+ allInTailPosition (VariableIntroduction _ _ Nothing)+ = pure S.empty+ allInTailPosition (VariableIntroduction _ ident' (Just (_, js1)))+ | countSelfReferences js1 == 0 = pure S.empty+ | Function _ Nothing _ _ <- js1+ , (argss, body, _) <- innerCollectAllFunctionArgs [] id js1+ = S.insert (ident', length argss) <$> allInTailPosition body+ | otherwise = empty+ allInTailPosition (Assignment _ _ js1)+ = guard (countSelfReferences js1 == 0) $> S.empty+ allInTailPosition (Comment _ js1)+ = allInTailPosition js1+ allInTailPosition _+ = empty++ toLoop :: S.Set Text -> Text -> Int -> [Text] -> [Text] -> AST -> State Int AST+ toLoop trFns ident arity outerArgs innerArgs js = do+ tcoDone <- tcoDoneM+ modify (+ 1)++ let+ markDone :: Maybe SourceSpan -> AST+ markDone ss = Assignment ss (Var ss tcoDone) (BooleanLiteral ss True)++ loopify :: AST -> AST+ loopify (Return ss ret)+ | isSelfCall ident arity ret =+ let+ allArgumentValues = concat $ collectArgs [] ret+ in+ Block ss $+ zipWith (\val arg ->+ Assignment ss (Var ss (tcoVar arg)) val) allArgumentValues outerArgs+ ++ zipWith (\val arg ->+ Assignment ss (Var ss (copyVar arg)) val) (drop (length outerArgs) allArgumentValues) innerArgs+ ++ [ ReturnNoResult ss ]+ | isIndirectSelfCall ret = Return ss ret+ | otherwise = Block ss [ markDone ss, Return ss ret ]+ loopify (ReturnNoResult ss) = Block ss [ markDone ss, ReturnNoResult ss ]+ loopify (While ss cond body) = While ss cond (loopify body)+ loopify (For ss i js1 js2 body) = For ss i js1 js2 (loopify body)+ loopify (ForIn ss i js1 body) = ForIn ss i js1 (loopify body)+ loopify (IfElse ss cond body el) = IfElse ss cond (loopify body) (fmap loopify el)+ loopify (Block ss body) = Block ss (map loopify body)+ loopify (VariableIntroduction ss f (Just (p, fn@(Function _ Nothing _ _))))+ | (_, body, replace) <- innerCollectAllFunctionArgs [] id fn+ , f `S.member` trFns = VariableIntroduction ss f (Just (p, replace (loopify body)))+ loopify other = other++ pure $ Block rootSS $+ map (\arg -> VariableIntroduction rootSS (tcoVar arg) (Just (UnknownEffects, Var rootSS (copyVar arg)))) outerArgs +++ [ VariableIntroduction rootSS tcoDone (Just (UnknownEffects, BooleanLiteral rootSS False))+ , VariableIntroduction rootSS tcoResult Nothing+ , Function rootSS (Just tcoLoop) (outerArgs ++ innerArgs) (Block rootSS [loopify js])+ , While rootSS (Unary rootSS Not (Var rootSS tcoDone))+ (Block rootSS+ [Assignment rootSS (Var rootSS tcoResult) (App rootSS (Var rootSS tcoLoop) (map (Var rootSS . tcoVar) outerArgs ++ map (Var rootSS . copyVar) innerArgs))])+ , Return rootSS (Var rootSS tcoResult)+ ]+ where+ rootSS = Nothing++ collectArgs :: [[AST]] -> AST -> [[AST]]+ collectArgs acc (App _ fn args') = collectArgs (args' : acc) fn+ collectArgs acc _ = acc++ isIndirectSelfCall :: AST -> Bool+ isIndirectSelfCall (App _ (Var _ ident') _) = ident' `S.member` trFns+ isIndirectSelfCall (App _ fn _) = isIndirectSelfCall fn+ isIndirectSelfCall _ = False++ isSelfCall :: Text -> Int -> AST -> Bool+ isSelfCall ident 1 (App _ (Var _ ident') _) = ident == ident'+ isSelfCall ident arity (App _ fn _) = isSelfCall ident (arity - 1) fn+ isSelfCall _ _ _ = False++foldMapA :: (Applicative f, Monoid w, Foldable t) => (a -> f w) -> t a -> f w+foldMapA f = foldr (liftA2 mappend . f) (pure mempty)
+ src/Language/PureScript/CoreImp/Optimizer/Unused.hs view
@@ -0,0 +1,55 @@+-- | Removes unused variables+module Language.PureScript.CoreImp.Optimizer.Unused+ ( removeCodeAfterReturnStatements+ , removeUndefinedApp+ , removeUnusedEffectFreeVars+ ) where++import Prelude++import Control.Monad (filterM)+import Data.Monoid (Any(..))+import Data.Set qualified as S+import Data.Text (Text)++import Language.PureScript.CoreImp.AST (AST(..), InitializerEffects(..), everything, everywhere)+import Language.PureScript.CoreImp.Optimizer.Common (removeFromBlock)+import Language.PureScript.Constants.Prim qualified as C++removeCodeAfterReturnStatements :: AST -> AST+removeCodeAfterReturnStatements = everywhere (removeFromBlock go)+ where+ go :: [AST] -> [AST]+ go jss =+ case break isReturn jss of+ (_, []) -> jss+ (body, ret : _ ) -> body ++ [ret]++ isReturn (Return _ _) = True+ isReturn (ReturnNoResult _) = True+ isReturn _ = False++removeUndefinedApp :: AST -> AST+removeUndefinedApp = everywhere convert+ where+ convert (App ss fn [Var _ C.S_undefined]) = App ss fn []+ convert js = js++removeUnusedEffectFreeVars :: [Text] -> [[AST]] -> [[AST]]+removeUnusedEffectFreeVars exps = loop+ where+ expsSet = S.fromList exps++ loop :: [[AST]] -> [[AST]]+ loop asts = if changed then loop (filter (not . null) asts') else asts+ where+ used = expsSet <> foldMap (foldMap (everything (<>) (\case Var _ x -> S.singleton x; _ -> S.empty))) asts+ (Any changed, asts') = traverse (filterM (anyFalses . isInUsedSet used)) asts++ isInUsedSet :: S.Set Text -> AST -> Bool+ isInUsedSet used = \case+ VariableIntroduction _ var (Just (NoEffects, _)) -> var `S.member` used+ _ -> True++ anyFalses :: Bool -> (Any, Bool)+ anyFalses x = (Any (not x), x)
+ src/Language/PureScript/Crash.hs view
@@ -0,0 +1,12 @@+module Language.PureScript.Crash (HasCallStack, internalError) where++import Prelude++import GHC.Stack (HasCallStack)++-- | Exit with an error message and a crash report link.+internalError :: HasCallStack => String -> a+internalError =+ error+ . ("An internal error occurred during compilation: " ++)+ . (++ "\nPlease report this at https://github.com/purescript/purescript/issues")
− src/Language/PureScript/DeadCodeElimination.hs
@@ -1,102 +0,0 @@------------------------------------------------------------------------------------ Module : Language.PureScript.DeadCodeElimination--- Copyright : (c) 2014 Phil Freeman--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ | Dead code elimination.-----------------------------------------------------------------------------------module Language.PureScript.DeadCodeElimination (- eliminateDeadCode-) where--import Data.Graph-import Data.List-import Data.Maybe (mapMaybe)--import Language.PureScript.CoreFn-import Language.PureScript.Names---- |--- Eliminate all declarations which are not a transitive dependency of the entry point module----eliminateDeadCode :: [ModuleName] -> [Module a] -> [Module a]-eliminateDeadCode entryPoints ms = map go ms- where- go (Module coms mn imps exps foreigns ds) = Module coms mn imps exps' foreigns' ds'- where- ds' = filter (isUsed mn graph vertexFor entryPointVertices) ds- foreigns' = filter (isUsed' mn graph vertexFor entryPointVertices . foreignIdent) foreigns- names = concatMap bindIdents ds' ++ map foreignIdent foreigns'- exps' = filter (`elem` names) exps- declarations = concatMap declarationsByModule ms- (graph, _, vertexFor) = graphFromEdges $ map (\(key, deps) -> (key, key, deps)) declarations- entryPointVertices = mapMaybe (vertexFor . fst) . filter (\((mn, _), _) -> mn `elem` entryPoints) $ declarations---- |--- Extract declaration names for a binding group.----bindIdents :: Bind a -> [Ident]-bindIdents (NonRec name _) = [name]-bindIdents (Rec names) = map fst names---- |--- Extract the ident for a foreign declaration.----foreignIdent :: ForeignDecl -> Ident-foreignIdent (name, _, _) = name---- |--- Key type to use in graph----type Key = (ModuleName, Ident)---- |--- Find dependencies for each member in a module.----declarationsByModule :: Module a -> [(Key, [Key])]-declarationsByModule (Module _ mn _ _ fs ds) =- let fs' = map ((\name -> ((mn, name), [])) . foreignIdent) fs- in fs' ++ concatMap go ds- where- go :: Bind a -> [(Key, [Key])]- go d@(NonRec name _) = [((mn, name), dependencies d)]- go d@(Rec names') = map (\(name, _) -> ((mn, name), dependencies d)) names'---- |--- Find all referenced values within a binding group.----dependencies :: Bind a -> [Key]-dependencies =- let (f, _, _, _) = everythingOnValues (++) (const []) values binders (const [])- in nub . f- where- values :: Expr a -> [Key]- values (Var _ (Qualified (Just mn) ident)) = [(mn, ident)]- values _ = []- binders :: Binder a -> [Key]- binders (ConstructorBinder _ _ (Qualified (Just mn) ident) _) = [(mn, Ident $ runProperName ident)]- binders _ = []---- |--- Check whether a binding group is used.----isUsed :: ModuleName -> Graph -> (Key -> Maybe Vertex) -> [Vertex] -> Bind a -> Bool-isUsed mn graph vertexFor entryPointVertices (NonRec name _) =- isUsed' mn graph vertexFor entryPointVertices name-isUsed mn graph vertexFor entryPointVertices (Rec ds) =- any (isUsed' mn graph vertexFor entryPointVertices . fst) ds---- |--- Check whether a named declaration is used.----isUsed' :: ModuleName -> Graph -> (Key -> Maybe Vertex) -> [Vertex] -> Ident -> Bool-isUsed' mn graph vertexFor entryPointVertices name =- let Just v' = vertexFor (mn, name)- in any (\v -> path graph v v') entryPointVertices
+ src/Language/PureScript/Docs.hs view
@@ -0,0 +1,16 @@++-- | Data types and functions for rendering generated documentation from+-- PureScript code, in a variety of formats.++module Language.PureScript.Docs+ ( module Docs+ ) where++import Language.PureScript.Docs.Collect as Docs+import Language.PureScript.Docs.Convert as Docs+import Language.PureScript.Docs.Prim as Docs+import Language.PureScript.Docs.Render as Docs+import Language.PureScript.Docs.RenderedCode as Docs+import Language.PureScript.Docs.Tags as Docs+import Language.PureScript.Docs.Types as Docs+import Language.PureScript.Docs.Css as Docs
+ src/Language/PureScript/Docs/AsHtml.hs view
@@ -0,0 +1,355 @@++-- | Functions for rendering generated documentation from PureScript code as+-- HTML.++module Language.PureScript.Docs.AsHtml (+ HtmlOutput(..),+ HtmlOutputModule(..),+ HtmlRenderContext(..),+ nullRenderContext,+ packageAsHtml,+ moduleAsHtml,+ makeFragment,+ renderMarkdown+) where++import Prelude+import Control.Category ((>>>))+import Control.Monad (unless)+import Data.Bifunctor (bimap)+import Data.Char (isUpper)+import Data.Either (isRight)+import Data.List.NonEmpty qualified as NE+import Data.Maybe (fromMaybe)+import Data.Foldable (for_)+import Data.String (fromString)++import Data.Text (Text)+import Data.Text qualified as T++import Text.Blaze.Html5 as H hiding (map)+import Text.Blaze.Html5.Attributes qualified as A+import Cheapskate qualified++import Language.PureScript qualified as P++import Language.PureScript.Docs.Types+import Language.PureScript.Docs.RenderedCode (Link(..), outputWith)+import Language.PureScript.Docs.Render qualified as Render+import Language.PureScript.CST qualified as CST++data HtmlOutput a = HtmlOutput+ { htmlIndex :: [(Maybe Char, a)]+ , htmlModules :: [(P.ModuleName, HtmlOutputModule a)]+ }+ deriving (Show, Functor)++data HtmlOutputModule a = HtmlOutputModule+ { htmlOutputModuleLocals :: a+ , htmlOutputModuleReExports :: [(InPackage P.ModuleName, a)]+ }+ deriving (Show, Functor)++data HtmlRenderContext = HtmlRenderContext+ { buildDocLink :: Namespace -> Text -> ContainingModule -> Maybe DocLink+ , renderDocLink :: DocLink -> Text+ , renderSourceLink :: P.SourceSpan -> Maybe Text+ }++-- |+-- An HtmlRenderContext for when you don't want to render any links.+nullRenderContext :: HtmlRenderContext+nullRenderContext = HtmlRenderContext+ { buildDocLink = const (const (const Nothing))+ , renderDocLink = const ""+ , renderSourceLink = const Nothing+ }++packageAsHtml+ :: (InPackage P.ModuleName -> Maybe HtmlRenderContext)+ -> Package a+ -> HtmlOutput Html+packageAsHtml getHtmlCtx Package{..} =+ HtmlOutput indexFile modules+ where+ indexFile = []+ modules = moduleAsHtml getHtmlCtx <$> pkgModules++moduleAsHtml+ :: (InPackage P.ModuleName -> Maybe HtmlRenderContext)+ -> Module+ -> (P.ModuleName, HtmlOutputModule Html)+moduleAsHtml getHtmlCtx Module{..} = (modName, HtmlOutputModule modHtml reexports)+ where+ modHtml = do+ let r = fromMaybe nullRenderContext $ getHtmlCtx (Local modName)+ in do+ for_ modComments renderMarkdown+ for_ modDeclarations (declAsHtml r)+ reexports =+ flip map modReExports $ \(pkg, decls) ->+ let r = fromMaybe nullRenderContext $ getHtmlCtx pkg+ in (pkg, foldMap (declAsHtml r) decls)++-- renderIndex :: LinksContext -> [(Maybe Char, Html)]+-- renderIndex LinksContext{..} = go ctxBookmarks+-- where+-- go = takeLocals+-- >>> groupIndex getIndex renderEntry+-- >>> map (second (ul . mconcat))+--+-- getIndex (_, title_) = do+-- c <- textHeadMay title_+-- guard (toUpper c `elem` ['A'..'Z'])+-- pure c+--+-- textHeadMay t =+-- case T.length t of+-- 0 -> Nothing+-- _ -> Just (T.index t 0)+--+-- renderEntry (mn, title_) =+-- li $ do+-- let url = T.pack (filePathFor mn `relativeTo` "index") <> "#" <> title_+-- code $+-- a ! A.href (v url) $ text title_+-- sp+-- text ("(" <> P.runModuleName mn <> ")")+--+-- groupIndex :: Ord i => (a -> Maybe i) -> (a -> b) -> [a] -> [(Maybe i, [b])]+-- groupIndex f g =+-- map (second DList.toList) . M.toList . foldr go' M.empty . sortBy (comparing f)+-- where+-- go' x = insertOrAppend (f x) (g x)+-- insertOrAppend idx val m =+-- let cur = M.findWithDefault DList.empty idx m+-- new = DList.snoc cur val+-- in M.insert idx new m++declAsHtml :: HtmlRenderContext -> Declaration -> Html+declAsHtml r d@Declaration{..} = do+ let declFragment = makeFragment (declInfoNamespace declInfo) declTitle+ H.div ! A.class_ "decl" ! A.id (v (T.drop 1 declFragment)) $ do+ h3 ! A.class_ "decl__title clearfix" $ do+ a ! A.class_ "decl__anchor" ! A.href (v declFragment) $ "#"+ H.span $ text declTitle+ text " " -- prevent browser from treating+ -- declTitle + linkToSource as one word+ for_ declSourceSpan (linkToSource r)++ H.div ! A.class_ "decl__body" $ do+ case declInfo of+ AliasDeclaration fixity alias_ ->+ renderAlias fixity alias_+ _ -> do+ pre ! A.class_ "decl__signature" $ do+ for_ declKind $ \kindInfo -> do+ code ! A.class_ "decl__kind" $ do+ codeAsHtml r (Render.renderKindSig declTitle kindInfo)+ code $ codeAsHtml r (Render.renderDeclaration d)++ for_ declComments renderMarkdown++ let (instances, dctors, members) = partitionChildren declChildren++ unless (null dctors) $ do+ h4 "Constructors"+ renderChildren r dctors++ unless (null members) $ do+ h4 "Members"+ renderChildren r members++ unless (null instances) $ do+ h4 "Instances"+ renderChildren r instances+ where+ linkToSource :: HtmlRenderContext -> P.SourceSpan -> Html+ linkToSource ctx srcspan =+ maybe (return ()) go (renderSourceLink ctx srcspan)+ where+ go href =+ H.span ! A.class_ "decl__source" $+ a ! A.href (v href) $ text "Source"++renderChildren :: HtmlRenderContext -> [ChildDeclaration] -> Html+renderChildren _ [] = return ()+renderChildren r xs = ul $ mapM_ item xs+ where+ item decl =+ li ! A.id (v (T.drop 1 (fragment decl))) $ do+ renderCode decl+ for_ (cdeclComments decl) $ \coms ->+ H.div ! A.class_ "decl__child_comments" $ renderMarkdown coms++ fragment decl = makeFragment (childDeclInfoNamespace (cdeclInfo decl)) (cdeclTitle decl)+ renderCode = code . codeAsHtml r . Render.renderChildDeclaration++codeAsHtml :: HtmlRenderContext -> RenderedCode -> Html+codeAsHtml r = outputWith elemAsHtml+ where+ elemAsHtml e = case e of+ Syntax x ->+ withClass "syntax" (text x)+ Keyword x ->+ withClass "keyword" (text x)+ Space ->+ text " "+ Symbol ns name link_ ->+ case link_ of+ Link mn ->+ let+ class_ =+ if startsWithUpper name then "ctor" else "ident"+ target+ | isOp name =+ if ns == TypeLevel+ then "type (" <> name <> ")"+ else "(" <> name <> ")"+ | otherwise = name+ in+ linkToDecl ns target mn (withClass class_ (text name))+ NoLink ->+ text name+ Role role ->+ case role of+ "nominal" -> renderRole describeNominal "decl__role_nominal"+ "phantom" -> renderRole describePhantom "decl__role_phantom"++ -- representational is intentionally not rendered+ "representational" -> toHtml ("" :: Text)++ x -> P.internalError $ "codeAsHtml: unknown value for role annotation: '" <> T.unpack x <> "'"+ where+ renderRole hoverTextContent className =+ H.a ! A.href (v docRepoRolePage) ! A.target (v "_blank") ! A.class_ "decl__role" $ do+ H.abbr ! A.class_ "decl__role_hover" ! A.title (v hoverTextContent) $ do+ H.sub ! A.class_ className $ do+ toHtml ("" :: Text)++ docRepoRolePage =+ "https://github.com/purescript/documentation/blob/master/language/Roles.md"++ describeNominal =+ "The 'nominal' role means this argument may not change when coercing the type."+ describePhantom =+ "The 'phantom' role means this argument can change freely when coercing the type."++ linkToDecl = linkToDeclaration r++ startsWithUpper :: Text -> Bool+ startsWithUpper str = not (T.null str) && isUpper (T.index str 0)++ isOp = isRight . runParser CST.parseOperator++ runParser :: CST.Parser a -> Text -> Either String a+ runParser p' =+ bimap (CST.prettyPrintError . NE.head) snd+ . CST.runTokenParser p'+ . CST.lex++renderLink :: HtmlRenderContext -> DocLink -> Html -> Html+renderLink r link_@DocLink{..} =+ a ! A.href (v (renderDocLink r link_ <> fragmentFor link_))+ ! A.title (v fullyQualifiedName)+ where+ fullyQualifiedName =+ P.runModuleName modName <> "." <> linkTitle++ modName = case linkLocation of+ LocalModule m -> m+ DepsModule _ _ m -> m+ BuiltinModule m -> m++makeFragment :: Namespace -> Text -> Text+makeFragment ns = (prefix <>) . escape+ where+ prefix = case ns of+ TypeLevel -> "#t:"+ ValueLevel -> "#v:"++ -- TODO+ escape = id++fragmentFor :: DocLink -> Text+fragmentFor l = makeFragment (linkNamespace l) (linkTitle l)++linkToDeclaration ::+ HtmlRenderContext ->+ Namespace ->+ Text ->+ ContainingModule ->+ Html ->+ Html+linkToDeclaration r ns target containMn =+ maybe id (renderLink r) (buildDocLink r ns target containMn)++renderAlias :: P.Fixity -> FixityAlias -> Html+renderAlias (P.Fixity associativity precedence) alias_ =+ p $ do+ -- TODO: Render a link+ toHtml $ "Operator alias for " <> P.showQualified showAliasName alias_ <> " "+ em $+ text ("(" <> associativityStr <> " / precedence " <> T.pack (show precedence) <> ")")+ where+ showAliasName (Left valueAlias) = P.runProperName valueAlias+ showAliasName (Right typeAlias) = case typeAlias of+ (Left identifier) -> P.runIdent identifier+ (Right properName) -> P.runProperName properName+ associativityStr = case associativity of+ P.Infixl -> "left-associative"+ P.Infixr -> "right-associative"+ P.Infix -> "non-associative"++-- | Render Markdown to HTML. Safe for untrusted input. Relative links are+-- | removed.+renderMarkdown :: Text -> H.Html+renderMarkdown =+ H.toMarkup . removeRelativeLinks . Cheapskate.markdown opts+ where+ opts = Cheapskate.def { Cheapskate.allowRawHtml = False }++removeRelativeLinks :: Cheapskate.Doc -> Cheapskate.Doc+removeRelativeLinks = Cheapskate.walk go+ where+ go :: Cheapskate.Inlines -> Cheapskate.Inlines+ go = (>>= stripRelatives)++ stripRelatives :: Cheapskate.Inline -> Cheapskate.Inlines+ stripRelatives (Cheapskate.Link contents_ href _)+ | isRelativeURI href = contents_+ stripRelatives other = pure other++ -- Tests for a ':' character in the first segment of a URI.+ --+ -- See Section 4.2 of RFC 3986:+ -- https://tools.ietf.org/html/rfc3986#section-4.2+ --+ -- >>> isRelativeURI "http://example.com/" == False+ -- >>> isRelativeURI "mailto:me@example.com" == False+ -- >>> isRelativeURI "foo/bar" == True+ -- >>> isRelativeURI "/bar" == True+ -- >>> isRelativeURI "./bar" == True+ isRelativeURI :: Text -> Bool+ isRelativeURI =+ T.takeWhile (/= '/') >>> T.all (/= ':')++v :: Text -> AttributeValue+v = toValue++withClass :: String -> Html -> Html+withClass className = H.span ! A.class_ (fromString className)++partitionChildren ::+ [ChildDeclaration] ->+ ([ChildDeclaration], [ChildDeclaration], [ChildDeclaration])+partitionChildren =+ reverseAll . foldl go ([], [], [])+ where+ go (instances, dctors, members) rcd =+ case cdeclInfo rcd of+ ChildInstance _ _ -> (rcd : instances, dctors, members)+ ChildDataConstructor _ -> (instances, rcd : dctors, members)+ ChildTypeClassMember _ -> (instances, dctors, rcd : members)++ reverseAll (xs, ys, zs) = (reverse xs, reverse ys, reverse zs)
+ src/Language/PureScript/Docs/AsMarkdown.hs view
@@ -0,0 +1,122 @@+module Language.PureScript.Docs.AsMarkdown+ ( Docs+ , runDocs+ , moduleAsMarkdown+ , codeToString+ ) where++import Prelude++import Control.Monad (unless, zipWithM_)+import Control.Monad.Writer (Writer, tell, execWriter)++import Data.Foldable (for_)+import Data.List (partition)+import Data.Text (Text)+import Data.Text qualified as T++import Language.PureScript.Docs.RenderedCode (RenderedCode, RenderedCodeElement(..), outputWith)+import Language.PureScript.Docs.Types (ChildDeclaration(..), ChildDeclarationInfo(..), Declaration(..), Module(..), ignorePackage)+import Language.PureScript qualified as P+import Language.PureScript.Docs.Render qualified as Render++moduleAsMarkdown :: Module -> Docs+moduleAsMarkdown Module{..} = do+ headerLevel 2 $ "Module " <> P.runModuleName modName+ spacer+ for_ modComments tell'+ mapM_ declAsMarkdown modDeclarations+ spacer+ for_ modReExports $ \(mn', decls) -> do+ let mn = ignorePackage mn'+ headerLevel 3 $ "Re-exported from " <> P.runModuleName mn <> ":"+ spacer+ mapM_ declAsMarkdown decls++declAsMarkdown :: Declaration -> Docs+declAsMarkdown decl@Declaration{..} = do+ headerLevel 4 (ticks declTitle)+ spacer++ let (instances, children) = partition (isChildInstance . cdeclInfo) declChildren+ fencedBlock $ do+ tell' (codeToString $ Render.renderDeclaration decl)+ zipWithM_ (\f c -> tell' (childToString f c)) (First : repeat NotFirst) children+ spacer++ for_ declComments tell'++ unless (null instances) $ do+ headerLevel 5 "Instances"+ fencedBlock $ mapM_ (tell' . childToString NotFirst) instances+ spacer++ where+ isChildInstance (ChildInstance _ _) = True+ isChildInstance _ = False++codeToString :: RenderedCode -> Text+codeToString = outputWith elemAsMarkdown+ where+ elemAsMarkdown (Syntax x) = x+ elemAsMarkdown (Keyword x) = x+ elemAsMarkdown Space = " "+ elemAsMarkdown (Symbol _ x _) = x++ -- roles aren't rendered in markdown+ elemAsMarkdown (Role _) = ""++-- fixityAsMarkdown :: P.Fixity -> Docs+-- fixityAsMarkdown (P.Fixity associativity precedence) =+-- tell' $ concat [ "_"+-- , associativityStr+-- , " / precedence "+-- , show precedence+-- , "_"+-- ]+-- where+-- associativityStr = case associativity of+-- P.Infixl -> "left-associative"+-- P.Infixr -> "right-associative"+-- P.Infix -> "non-associative"++childToString :: First -> ChildDeclaration -> Text+childToString f decl@ChildDeclaration{..} =+ case cdeclInfo of+ ChildDataConstructor _ ->+ let c = if f == First then "=" else "|"+ in " " <> c <> " " <> str+ ChildTypeClassMember _ ->+ " " <> str+ ChildInstance _ _ ->+ str+ where+ str = codeToString $ Render.renderChildDeclaration decl++data First+ = First+ | NotFirst+ deriving (Show, Eq, Ord)++type Docs = Writer [Text] ()++runDocs :: Docs -> Text+runDocs = T.unlines . execWriter++tell' :: Text -> Docs+tell' = tell . (:[])++spacer :: Docs+spacer = tell' ""++headerLevel :: Int -> Text -> Docs+headerLevel level hdr = tell' (T.replicate level "#" <> " " <> hdr)++fencedBlock :: Docs -> Docs+fencedBlock inner = do+ tell' "``` purescript"+ inner+ tell' "```"++ticks :: Text -> Text+ticks = ("`" <>) . (<> "`")
+ src/Language/PureScript/Docs/Collect.hs view
@@ -0,0 +1,225 @@++module Language.PureScript.Docs.Collect+ ( collectDocs+ ) where++import Protolude hiding (check)++import Control.Arrow ((&&&))+import Data.Aeson.BetterErrors qualified as ABE+import Data.ByteString qualified as BS+import Data.Map qualified as Map+import Data.Set qualified as Set+import Data.Text qualified as T+import Data.Text.IO qualified as TIO+import System.FilePath ((</>))+import System.IO.UTF8 (readUTF8FileT, readUTF8FilesT)++import Language.PureScript.Docs.Convert.ReExports (updateReExports)+import Language.PureScript.Docs.Prim (primModules)+import Language.PureScript.Docs.Types (InPackage(..), Module(..), asModule, displayPackageError, ignorePackage)++import Language.PureScript.AST qualified as P+import Language.PureScript.CST qualified as P+import Language.PureScript.Crash qualified as P+import Language.PureScript.Errors qualified as P+import Language.PureScript.Externs qualified as P+import Language.PureScript.Make qualified as P+import Language.PureScript.Names qualified as P+import Language.PureScript.Options qualified as P++import Web.Bower.PackageMeta (PackageName)++-- |+-- Given a compiler output directory, a list of input PureScript source files,+-- and a list of dependency PureScript source files, produce documentation for+-- the input files in the intermediate documentation format. Note that+-- dependency files are not included in the result.+--+-- If the output directory is not up to date with respect to the provided input+-- and dependency files, the files will be built as if with just the "docs"+-- codegen target, i.e. "purs compile --codegen docs".+--+collectDocs ::+ forall m.+ (MonadError P.MultipleErrors m, MonadIO m) =>+ FilePath ->+ [FilePath] ->+ [(PackageName, FilePath)] ->+ m ([(FilePath, Module)], Map P.ModuleName PackageName)+collectDocs outputDir inputFiles depsFiles = do+ (modulePaths, modulesDeps) <- getModulePackageInfo inputFiles depsFiles+ externs <- compileForDocs outputDir (map fst modulePaths)++ let (withPackage, shouldKeep) =+ packageDiscriminators modulesDeps+ let go =+ operateAndRetag identity modName $ \mns -> do+ docsModules <- traverse (liftIO . parseDocsJsonFile outputDir) mns+ addReExports withPackage docsModules externs++ docsModules <- go modulePaths+ pure (filter (shouldKeep . modName . snd) docsModules, modulesDeps)++ where+ packageDiscriminators modulesDeps =+ let+ shouldKeep mn = isLocal mn && not (P.isBuiltinModuleName mn)++ withPackage :: P.ModuleName -> InPackage P.ModuleName+ withPackage mn =+ case Map.lookup mn modulesDeps of+ Just pkgName -> FromDep pkgName mn+ Nothing -> Local mn++ isLocal :: P.ModuleName -> Bool+ isLocal = not . flip Map.member modulesDeps+ in+ (withPackage, shouldKeep)++-- |+-- Compile with just the 'docs' codegen target, writing results into the given+-- output directory.+--+compileForDocs ::+ forall m.+ (MonadError P.MultipleErrors m, MonadIO m) =>+ FilePath ->+ [FilePath] ->+ m [P.ExternsFile]+compileForDocs outputDir inputFiles = do+ result <- liftIO $ do+ moduleFiles <- readUTF8FilesT inputFiles+ fmap fst $ P.runMake testOptions $ do+ ms <- P.parseModulesFromFiles identity moduleFiles+ let filePathMap = Map.fromList $ map (\(fp, pm) -> (P.getModuleName $ P.resPartial pm, Right fp)) ms+ foreigns <- P.inferForeignModules filePathMap+ let makeActions =+ (P.buildMakeActions outputDir filePathMap foreigns False)+ { P.progress = liftIO . TIO.hPutStr stdout . (<> "\n") . P.renderProgressMessage "Compiling documentation for "+ }+ P.make makeActions (map snd ms)+ either throwError return result++ where+ testOptions :: P.Options+ testOptions = P.defaultOptions { P.optionsCodegenTargets = Set.singleton P.Docs }++parseDocsJsonFile :: FilePath -> P.ModuleName -> IO Module+parseDocsJsonFile outputDir mn =+ let+ filePath = outputDir </> T.unpack (P.runModuleName mn) </> "docs.json"+ in do+ str <- BS.readFile filePath+ case ABE.parseStrict asModule str of+ Right m -> pure m+ Left err -> P.internalError $+ "Failed to decode: " ++ filePath +++ intercalate "\n" (map T.unpack (ABE.displayError displayPackageError err))++addReExports ::+ (MonadError P.MultipleErrors m) =>+ (P.ModuleName -> InPackage P.ModuleName) ->+ [Module] ->+ [P.ExternsFile] ->+ m [Module]+addReExports withPackage docsModules externs = do+ -- We add the Prim docs modules here, so that docs generation is still+ -- possible if the modules we are generating docs for re-export things from+ -- Prim submodules. Note that the Prim modules do not exist as+ -- @Language.PureScript.Module@ values because they do not contain anything+ -- that exists at runtime. However, we have pre-constructed+ -- @Language.PureScript.Docs.Types.Module@ values for them, which we use+ -- here.+ let moduleMap =+ Map.fromList+ (map (modName &&& identity)+ (docsModules ++ primModules))++ let withReExports = updateReExports externs withPackage moduleMap+ pure (Map.elems withReExports)++-- |+-- Perform an operation on a list of things which are tagged, and reassociate+-- the things with their tags afterwards.+--+operateAndRetag ::+ forall m a b key tag.+ Monad m =>+ Ord key =>+ Show key =>+ (a -> key) ->+ (b -> key) ->+ ([a] -> m [b]) ->+ [(tag, a)] ->+ m [(tag, b)]+operateAndRetag keyA keyB operation input =+ map retag <$> operation (map snd input)+ where+ tags :: Map key tag+ tags = Map.fromList $ map (\(tag, a) -> (keyA a, tag)) input++ findTag :: key -> tag+ findTag key =+ case Map.lookup key tags of+ Just tag -> tag+ Nothing -> P.internalError ("Missing tag for: " ++ show key)++ retag :: b -> (tag, b)+ retag b = (findTag (keyB b), b)++-- |+-- Given:+--+-- * A list of local source files+-- * A list of source files from external dependencies, together with their+-- package names+--+-- This function does the following:+--+-- * Partially parse all of the input and dependency source files to get+-- the module name of each module+-- * Associate each dependency module with its package name, thereby+-- distinguishing these from local modules+-- * Return the file paths paired with the names of the modules they+-- contain, and a Map of module names to package names for modules which+-- come from dependencies. If a module does not exist in the map, it can+-- safely be+-- assumed to be local.+getModulePackageInfo ::+ (MonadError P.MultipleErrors m, MonadIO m) =>+ [FilePath]+ -> [(PackageName, FilePath)]+ -> m ([(FilePath, P.ModuleName)], Map P.ModuleName PackageName)+getModulePackageInfo inputFiles depsFiles = do+ inputFiles' <- traverse (readFileAs . Local) inputFiles+ depsFiles' <- traverse (readFileAs . uncurry FromDep) depsFiles++ moduleNames <- getModuleNames (inputFiles' ++ depsFiles')++ let mnMap =+ Map.fromList $+ mapMaybe (\(pkgPath, mn) -> (mn,) <$> getPkgName pkgPath) moduleNames++ pure (map (first ignorePackage) moduleNames, mnMap)++ where+ getModuleNames ::+ (MonadError P.MultipleErrors m) =>+ [(InPackage FilePath, Text)]+ -> m [(InPackage FilePath, P.ModuleName)]+ getModuleNames =+ fmap (map (second (P.getModuleName . P.resPartial)))+ . either throwError return+ . P.parseModulesFromFiles ignorePackage++ getPkgName = \case+ Local _ -> Nothing+ FromDep pkgName _ -> Just pkgName++ readFileAs ::+ (MonadIO m) =>+ InPackage FilePath ->+ m (InPackage FilePath, Text)+ readFileAs fi =+ liftIO . fmap (fi,) $ readUTF8FileT (ignorePackage fi)
+ src/Language/PureScript/Docs/Convert.hs view
@@ -0,0 +1,273 @@+-- | Functions for converting PureScript ASTs into values of the data types+-- from Language.PureScript.Docs.++module Language.PureScript.Docs.Convert+ ( convertModule+ ) where++import Protolude hiding (check)++import Control.Category ((>>>))+import Control.Monad.Writer.Strict (runWriterT)+import Control.Monad.Supply (evalSupplyT)+import Data.List.NonEmpty qualified as NE+import Data.Map qualified as Map+import Data.String (String)+import Data.Text qualified as T++import Language.PureScript.Docs.Convert.Single (convertSingleModule)+import Language.PureScript.Docs.Types (Declaration(..), DeclarationInfo(..), KindInfo(..), Module(..), Type')+import Language.PureScript.CST qualified as CST+import Language.PureScript.AST qualified as P+import Language.PureScript.Crash qualified as P+import Language.PureScript.Errors qualified as P+import Language.PureScript.Externs qualified as P+import Language.PureScript.Environment qualified as P+import Language.PureScript.Names qualified as P+import Language.PureScript.Roles qualified as P+import Language.PureScript.Sugar qualified as P+import Language.PureScript.Types qualified as P+import Language.PureScript.Constants.Prim qualified as Prim+import Language.PureScript.Sugar (RebracketCaller(CalledByDocs))++-- |+-- Convert a single module to a Docs.Module, making use of a pre-existing+-- type-checking environment in order to fill in any missing types. Note that+-- re-exports will not be included.+--+convertModule ::+ MonadError P.MultipleErrors m =>+ [P.ExternsFile] ->+ P.Env ->+ P.Environment ->+ P.Module ->+ m Module+convertModule externs env checkEnv =+ fmap (insertValueTypesAndAdjustKinds checkEnv . convertSingleModule) . partiallyDesugar externs env++-- |+-- Convert FFI declarations into `DataDeclaration` so that the declaration's+-- roles (if any) can annotate the generated type parameter names.+--+-- Inserts all data declarations inferred roles if none were specified+-- explicitly.+--+-- Updates all the types of the ValueDeclarations inside the module based on+-- their types inside the given Environment.+--+-- Removes explicit kind signatures if they are "uninteresting."+--+-- Inserts inferred kind signatures into the corresponding declarations+-- if no kind signature was declared explicitly and the kind+-- signature is "interesting."+--+insertValueTypesAndAdjustKinds ::+ P.Environment -> Module -> Module+insertValueTypesAndAdjustKinds env m =+ m { modDeclarations = map (go . insertInferredRoles . convertFFIDecl) (modDeclarations m) }+ where+ -- Convert FFI declarations into data declaration+ -- by generating the type parameters' names based on its kind signature.+ -- Note: `Prim` modules' docs don't go through this conversion process+ -- so `ExternDataDeclaration` values will still exist beyond this point.+ convertFFIDecl d@Declaration { declInfo = ExternDataDeclaration kind roles } =+ d { declInfo = DataDeclaration P.Data (genTypeParams kind) roles+ , declKind = Just (KindInfo P.DataSig kind)+ }++ convertFFIDecl other = other++ insertInferredRoles d@Declaration { declInfo = DataDeclaration dataDeclType args [] } =+ d { declInfo = DataDeclaration dataDeclType args inferredRoles }++ where+ inferredRoles :: [P.Role]+ inferredRoles = do+ let key = P.Qualified (P.ByModuleName (modName m)) (P.ProperName (declTitle d))+ case Map.lookup key (P.types env) of+ Just (_, tyKind) -> case tyKind of+ P.DataType _ tySourceTyRole _ ->+ map (\(_,_,r) -> r) tySourceTyRole+ P.ExternData rs ->+ rs+ _ ->+ []+ Nothing ->+ err $ "type not found: " <> show key++ insertInferredRoles other =+ other++ -- Given an FFI declaration like this+ -- ```+ -- foreign import data Foo+ -- :: forall a b c d+ -- . MyKind a b+ -- -> OtherKind c d+ -- -> Symbol+ -- -> (Type -> Type)+ -- -> (Type) -- unneeded parens a developer typo+ -- -> Type+ -- ```+ -- Return a list of values, one for each implicit type parameter+ -- of `(tX, Nothing)` where `X` refers to the index of he parameter+ -- in that list, matching the values expected by `Render.toTypeVar`+ genTypeParams :: Type' -> [(Text, Maybe Type')]+ genTypeParams kind = do+ let n = countParams 0 kind+ map (\(i :: Int) -> ("t" <> T.pack (show i), Nothing)) $ take n [0..]+ where+ countParams :: Int -> Type' -> Int+ countParams acc = \case+ P.ForAll _ _ _ _ rest _ ->+ countParams acc rest++ P.TypeApp _ f a | isFunctionApplication f ->+ countParams (acc + 1) a++ P.ParensInType _ ty ->+ countParams acc ty++ _ ->+ acc++ isFunctionApplication = \case+ P.TypeApp _ (P.TypeConstructor () Prim.Function) _ -> True+ P.ParensInType _ ty -> isFunctionApplication ty+ _ -> False++ -- insert value types+ go d@Declaration { declInfo = ValueDeclaration P.TypeWildcard{} } =+ let+ ident = P.Ident . CST.getIdent . CST.nameValue . parseIdent $ declTitle d+ ty = lookupName ident+ in+ d { declInfo = ValueDeclaration (ty $> ()) }++ go d@Declaration{..} | Just keyword <- extractKeyword declInfo =+ case declKind of+ Just ks ->+ -- hide explicit kind signatures that are "uninteresting"+ if isUninteresting keyword $ kiKind ks+ then d { declKind = Nothing }+ else d+ Nothing ->+ -- insert inferred kinds so long as they are "interesting"+ insertInferredKind d declTitle keyword++ go other =+ other++ parseIdent =+ either (err . ("failed to parse Ident: " ++)) identity . runParser CST.parseIdent++ lookupName name =+ let key = P.Qualified (P.ByModuleName (modName m)) name+ in case Map.lookup key (P.names env) of+ Just (ty, _, _) ->+ ty+ Nothing ->+ err ("name not found: " ++ show key)++ -- Extracts the keyword for a declaration (if there is one)+ extractKeyword :: DeclarationInfo -> Maybe P.KindSignatureFor+ extractKeyword = \case+ DataDeclaration dataDeclType _ _ -> Just $ case dataDeclType of+ P.Data -> P.DataSig+ P.Newtype -> P.NewtypeSig+ TypeSynonymDeclaration _ _ -> Just P.TypeSynonymSig+ TypeClassDeclaration _ _ _ -> Just P.ClassSig+ _ -> Nothing++ -- Returns True if the kind signature is "uninteresting", which+ -- is a kind that follows this form:+ -- - `Type`+ -- - `Constraint` (class declaration only)+ -- - `Type -> K` where `K` is an "uninteresting" kind+ isUninteresting+ :: P.KindSignatureFor -> Type' -> Bool+ isUninteresting keyword = \case+ -- `Type -> ...`+ P.TypeApp _ f a | isTypeAppFunctionType f -> isUninteresting keyword a+ P.ParensInType _ ty -> isUninteresting keyword ty+ x -> isKindPrimType x || (isClassKeyword && isKindPrimConstraint x)+ where+ isClassKeyword = case keyword of+ P.ClassSig -> True+ _ -> False++ isTypeAppFunctionType = \case+ P.TypeApp _ f a -> isKindFunction f && isKindPrimType a+ P.ParensInType _ ty -> isTypeAppFunctionType ty+ _ -> False++ isKindFunction = isTypeConstructor Prim.Function+ isKindPrimType = isTypeConstructor Prim.Type+ isKindPrimConstraint = isTypeConstructor Prim.Constraint++ isTypeConstructor k = \case+ P.TypeConstructor _ k' -> k' == k+ P.ParensInType _ ty -> isTypeConstructor k ty+ _ -> False++ insertInferredKind :: Declaration -> Text -> P.KindSignatureFor -> Declaration+ insertInferredKind d name keyword =+ let+ key = P.Qualified (P.ByModuleName (modName m)) (P.ProperName name)+ in case Map.lookup key (P.types env) of+ Just (inferredKind, _) ->+ if isUninteresting keyword inferredKind'+ then d+ else d { declKind = Just $ KindInfo+ { kiKeyword = keyword+ , kiKind = dropTypeSortAnnotation inferredKind'+ }+ }+ where+ inferredKind' = inferredKind $> ()++ -- Note: the below change to the final kind used is intentionally+ -- NOT being done for explicit kind signatures:+ --+ -- changes `forall (k :: Type). k -> ...`+ -- to `forall k . k -> ...`+ dropTypeSortAnnotation = \case+ P.ForAll sa vis txt (Just (P.TypeConstructor _ Prim.Type)) rest skol ->+ P.ForAll sa vis txt Nothing (dropTypeSortAnnotation rest) skol+ rest -> rest++ Nothing ->+ err ("type not found: " ++ show key)++ err msg =+ P.internalError ("Docs.Convert.insertValueTypes: " ++ msg)++runParser :: CST.Parser a -> Text -> Either String a+runParser p =+ bimap (CST.prettyPrintError . NE.head) snd+ . CST.runTokenParser p+ . CST.lex++-- |+-- Partially desugar modules so that they are suitable for extracting+-- documentation information from.+--+partiallyDesugar ::+ (MonadError P.MultipleErrors m) =>+ [P.ExternsFile] ->+ P.Env ->+ P.Module ->+ m P.Module+partiallyDesugar externs env = evalSupplyT 0 . desugar'+ where+ desugar' =+ P.desugarDoModule+ >=> P.desugarAdoModule+ >=> P.desugarLetPatternModule+ >>> P.desugarCasesModule+ >=> P.desugarTypeDeclarationsModule+ >=> fmap fst . runWriterT . flip evalStateT (env, mempty) . P.desugarImports+ >=> P.rebracketFiltered CalledByDocs isInstanceDecl externs++ isInstanceDecl P.TypeInstanceDeclaration {} = True+ isInstanceDecl _ = False
+ src/Language/PureScript/Docs/Convert/ReExports.hs view
@@ -0,0 +1,518 @@+module Language.PureScript.Docs.Convert.ReExports+ ( updateReExports+ ) where++import Prelude++import Control.Arrow ((&&&), first, second)+import Control.Monad (foldM, (<=<))+import Control.Monad.Reader.Class (MonadReader, ask)+import Control.Monad.State.Class (MonadState, gets, modify)+import Control.Monad.Trans.Reader (runReaderT)+import Control.Monad.Trans.State.Strict (execState)++import Data.Either (partitionEithers)+import Data.Foldable (fold, traverse_)+import Data.Map (Map)+import Data.Maybe (mapMaybe)+import Data.Map qualified as Map+import Data.Text (Text)+import Data.Text qualified as T++import Language.PureScript.Docs.Types++import Language.PureScript.AST qualified as P+import Language.PureScript.Crash qualified as P+import Language.PureScript.Errors qualified as P+import Language.PureScript.Externs qualified as P+import Language.PureScript.ModuleDependencies qualified as P+import Language.PureScript.Names qualified as P+import Language.PureScript.Types qualified as P+++-- |+-- Given:+--+-- * A list of externs files+-- * A function for tagging a module with the package it comes from+-- * A map of modules, indexed by their names, which are assumed to not+-- have their re-exports listed yet+--+-- This function adds all the missing re-exports.+--+updateReExports ::+ [P.ExternsFile] ->+ (P.ModuleName -> InPackage P.ModuleName) ->+ Map P.ModuleName Module ->+ Map P.ModuleName Module+updateReExports externs withPackage = execState action+ where+ action =+ traverse_ go traversalOrder++ go mn = do+ mdl <- lookup' mn+ reExports <- getReExports externsEnv mn+ let mdl' = mdl { modReExports = map (first withPackage) reExports }+ modify (Map.insert mn mdl')++ lookup' mn = do+ v <- gets (Map.lookup mn)+ case v of+ Just v' ->+ pure v'+ Nothing ->+ internalError ("Module missing: " ++ T.unpack (P.runModuleName mn))++ externsEnv :: Map P.ModuleName P.ExternsFile+ externsEnv = Map.fromList $ map (P.efModuleName &&& id) externs++ traversalOrder :: [P.ModuleName]+ traversalOrder =+ case P.sortModules P.Transitive externsSignature externs of+ Right (es, _) -> map P.efModuleName es+ Left errs -> internalError $+ "failed to sortModules: " +++ P.prettyPrintMultipleErrors P.defaultPPEOptions errs++ externsSignature :: P.ExternsFile -> P.ModuleSignature+ externsSignature ef =+ P.ModuleSignature+ { P.sigSourceSpan = P.efSourceSpan ef+ , P.sigModuleName = P.efModuleName ef+ , P.sigImports = map (\ei -> (P.eiModule ei, P.nullSourceSpan)) (P.efImports ef)+ }++-- |+-- Collect all of the re-exported declarations for a single module.+--+-- We require that modules have already been sorted (P.sortModules) in order to+-- ensure that by the time we convert a particular module, all its dependencies+-- have already been converted.+--+getReExports ::+ (MonadState (Map P.ModuleName Module) m) =>+ Map P.ModuleName P.ExternsFile ->+ P.ModuleName ->+ m [(P.ModuleName, [Declaration])]+getReExports externsEnv mn =+ case Map.lookup mn externsEnv of+ Nothing ->+ internalError ("Module missing: " ++ T.unpack (P.runModuleName mn))+ Just P.ExternsFile { P.efExports = refs } -> do+ let reExpRefs = mapMaybe toReExportRef refs+ runReaderT (collectDeclarations reExpRefs) mn++toReExportRef :: P.DeclarationRef -> Maybe (P.ExportSource, P.DeclarationRef)+toReExportRef (P.ReExportRef _ source ref) = Just (source, ref)+toReExportRef _ = Nothing++-- |+-- Assemble a list of declarations re-exported from a particular module, based+-- on the Imports and Exports value for that module, and by extracting the+-- declarations from the current state.+--+-- This function works by searching through the lists of exported declarations+-- in the Exports, and looking them up in the associated Imports value to find+-- the module they were imported from.+--+-- Additionally:+--+-- * Attempts to move re-exported type class members under their parent+-- type classes, if possible, or otherwise, "promote" them from+-- ChildDeclarations to proper Declarations.+-- * Filters data declarations to ensure that only re-exported data+-- constructors are listed.+-- * Filters type class declarations to ensure that only re-exported type+-- class members are listed.+--+collectDeclarations :: forall m.+ (MonadState (Map P.ModuleName Module) m, MonadReader P.ModuleName m) =>+ [(P.ExportSource, P.DeclarationRef)] ->+ m [(P.ModuleName, [Declaration])]+collectDeclarations reExports = do+ valsAndMembers <- collect lookupValueDeclaration expVals+ valOps <- collect lookupValueOpDeclaration expValOps+ typeClasses <- collect lookupTypeClassDeclaration expTCs+ types <- collect lookupTypeDeclaration expTypes+ typeOps <- collect lookupTypeOpDeclaration expTypeOps++ (vals, classes) <- handleTypeClassMembers valsAndMembers typeClasses++ let filteredTypes = filterDataConstructors expCtors types+ let filteredClasses = filterTypeClassMembers (Map.keys expVals) classes++ pure (Map.toList (Map.unionsWith (<>) [filteredTypes, filteredClasses, vals, valOps, typeOps]))++ where++ collect+ :: (P.ModuleName -> a -> m (P.ModuleName, [b]))+ -> Map a P.ExportSource+ -> m (Map P.ModuleName [b])+ collect lookup' exps = do+ let reExps = Map.toList $ Map.mapMaybe P.exportSourceImportedFrom exps+ decls <- traverse (uncurry (flip lookup')) reExps+ return $ Map.fromListWith (<>) decls++ expVals :: Map P.Ident P.ExportSource+ expVals = mkExportMap P.getValueRef++ expValOps :: Map (P.OpName 'P.ValueOpName) P.ExportSource+ expValOps = mkExportMap P.getValueOpRef++ expTCs :: Map (P.ProperName 'P.ClassName) P.ExportSource+ expTCs = mkExportMap P.getTypeClassRef++ expTypes :: Map (P.ProperName 'P.TypeName) P.ExportSource+ expTypes = mkExportMap (fmap fst . P.getTypeRef)++ expTypeOps :: Map (P.OpName 'P.TypeOpName) P.ExportSource+ expTypeOps = mkExportMap P.getTypeOpRef++ mkExportMap :: Ord name => (P.DeclarationRef -> Maybe name) -> Map name P.ExportSource+ mkExportMap f =+ Map.fromList $+ mapMaybe (\(exportSrc, ref) -> (,exportSrc) <$> f ref) reExports++ expCtors :: [P.ProperName 'P.ConstructorName]+ expCtors = concatMap (fold . (snd <=< P.getTypeRef . snd)) reExports++lookupValueDeclaration ::+ forall m.+ (MonadState (Map P.ModuleName Module) m,+ MonadReader P.ModuleName m) =>+ P.ModuleName ->+ P.Ident ->+ m (P.ModuleName, [Either (Text, Constraint', ChildDeclaration) Declaration])+lookupValueDeclaration importedFrom ident = do+ decls <- lookupModuleDeclarations "lookupValueDeclaration" importedFrom+ let+ rs =+ filter (\d -> declTitle d == P.showIdent ident+ && (isValue d || isValueAlias d)) decls+ errOther :: Show a => a -> m b+ errOther other =+ internalErrorInModule+ ("lookupValueDeclaration: unexpected result:\n" +++ "other: " ++ show other ++ "\n" +++ "ident: " ++ show ident ++ "\n" +++ "decls: " ++ show decls)++ case rs of+ [r] ->+ pure (importedFrom, [Right r])+ [] ->+ -- It's a type class member.+ -- Note that we need to filter based on the child declaration info using+ -- `isTypeClassMember` anyway, because child declarations of type classes+ -- are not necessarily members; they could also be instances.+ let+ allTypeClassChildDecls =+ decls+ |> mapMaybe (\d -> (d,) <$> typeClassConstraintFor d)+ |> concatMap (\(d, constr) ->+ map (declTitle d, constr,)+ (declChildren d))++ matchesIdent cdecl =+ cdeclTitle cdecl == P.showIdent ident++ matchesAndIsTypeClassMember =+ uncurry (&&) . (matchesIdent &&& isTypeClassMember)++ in+ case filter (matchesAndIsTypeClassMember . thd) allTypeClassChildDecls of+ [r'] ->+ pure (importedFrom, [Left r'])+ other ->+ errOther other+ other -> errOther other++ where+ thd :: (a, b, c) -> c+ thd (_, _, x) = x++lookupValueOpDeclaration+ :: (MonadState (Map P.ModuleName Module) m, MonadReader P.ModuleName m)+ => P.ModuleName+ -> P.OpName 'P.ValueOpName+ -> m (P.ModuleName, [Declaration])+lookupValueOpDeclaration importedFrom op = do+ decls <- lookupModuleDeclarations "lookupValueOpDeclaration" importedFrom+ case filter (\d -> declTitle d == P.showOp op && isValueAlias d) decls of+ [d] ->+ pure (importedFrom, [d])+ other ->+ internalErrorInModule+ ("lookupValueOpDeclaration: unexpected result for: " ++ show other)++-- |+-- Extract a particular type declaration. For data declarations, constructors+-- are only included in the output if they are listed in the arguments.+--+lookupTypeDeclaration ::+ (MonadState (Map P.ModuleName Module) m,+ MonadReader P.ModuleName m) =>+ P.ModuleName ->+ P.ProperName 'P.TypeName ->+ m (P.ModuleName, [Declaration])+lookupTypeDeclaration importedFrom ty = do+ decls <- lookupModuleDeclarations "lookupTypeDeclaration" importedFrom+ let+ ds = filter (\d -> declTitle d == P.runProperName ty && isType d) decls+ case ds of+ [d] ->+ pure (importedFrom, [d])+ [] | P.isBuiltinModuleName importedFrom ->+ -- Type classes in builtin modules (i.e. submodules of Prim) also have+ -- corresponding pseudo-types in the primEnv, but since these are an+ -- implementation detail they do not exist in the Modules, and hence in+ -- this case, `ds` will be empty.+ pure (importedFrom, [])+ other ->+ internalErrorInModule+ ("lookupTypeDeclaration: unexpected result for " ++ show ty ++ ": " ++ show other)++lookupTypeOpDeclaration+ :: (MonadState (Map P.ModuleName Module) m,MonadReader P.ModuleName m)+ => P.ModuleName+ -> P.OpName 'P.TypeOpName+ -> m (P.ModuleName, [Declaration])+lookupTypeOpDeclaration importedFrom tyOp = do+ decls <- lookupModuleDeclarations "lookupTypeOpDeclaration" importedFrom+ let+ ds = filter (\d -> declTitle d == ("type " <> P.showOp tyOp) && isTypeAlias d) decls+ case ds of+ [d] ->+ pure (importedFrom, [d])+ other ->+ internalErrorInModule+ ("lookupTypeOpDeclaration: unexpected result: " ++ show other)++lookupTypeClassDeclaration+ :: (MonadState (Map P.ModuleName Module) m, MonadReader P.ModuleName m)+ => P.ModuleName+ -> P.ProperName 'P.ClassName+ -> m (P.ModuleName, [Declaration])+lookupTypeClassDeclaration importedFrom tyClass = do+ decls <- lookupModuleDeclarations "lookupTypeClassDeclaration" importedFrom+ let+ ds = filter (\d -> declTitle d == P.runProperName tyClass+ && isTypeClass d)+ decls+ case ds of+ [d] ->+ pure (importedFrom, [d])+ other ->+ internalErrorInModule+ ("lookupTypeClassDeclaration: unexpected result for "+ ++ show tyClass ++ ": "+ ++ (unlines . map show) other)++-- |+-- Get the full list of declarations for a particular module out of the+-- state, or raise an internal error if it is not there.+--+lookupModuleDeclarations ::+ (MonadState (Map P.ModuleName Module) m,+ MonadReader P.ModuleName m) =>+ String ->+ P.ModuleName ->+ m [Declaration]+lookupModuleDeclarations definedIn moduleName = do+ mmdl <- gets (Map.lookup moduleName)+ case mmdl of+ Nothing ->+ internalErrorInModule+ (definedIn ++ ": module missing: "+ ++ T.unpack (P.runModuleName moduleName))+ Just mdl ->+ pure (allDeclarations mdl)++handleTypeClassMembers ::+ (MonadReader P.ModuleName m) =>+ Map P.ModuleName [Either (Text, Constraint', ChildDeclaration) Declaration] ->+ Map P.ModuleName [Declaration] ->+ m (Map P.ModuleName [Declaration], Map P.ModuleName [Declaration])+handleTypeClassMembers valsAndMembers typeClasses =+ let+ moduleEnvs =+ Map.unionWith (<>)+ (fmap valsAndMembersToEnv valsAndMembers)+ (fmap typeClassesToEnv typeClasses)+ in+ moduleEnvs+ |> traverse handleEnv+ |> fmap splitMap++valsAndMembersToEnv ::+ [Either (Text, Constraint', ChildDeclaration) Declaration] -> TypeClassEnv+valsAndMembersToEnv xs =+ let (envUnhandledMembers, envValues) = partitionEithers xs+ envTypeClasses = []+ in TypeClassEnv{..}++typeClassesToEnv :: [Declaration] -> TypeClassEnv+typeClassesToEnv classes =+ TypeClassEnv+ { envUnhandledMembers = []+ , envValues = []+ , envTypeClasses = classes+ }++-- |+-- An intermediate data type, used for either moving type class members under+-- their parent type classes, or promoting them to normal Declaration values+-- if their parent type class has not been re-exported.+--+data TypeClassEnv = TypeClassEnv+ { -- |+ -- Type class members which have not yet been dealt with. The Text is the+ -- name of the type class they belong to, and the constraint is used to+ -- make sure that they have the correct type if they get promoted.+ --+ envUnhandledMembers :: [(Text, Constraint', ChildDeclaration)]+ -- |+ -- A list of normal value declarations. Type class members will be added to+ -- this list if their parent type class is not available.+ --+ , envValues :: [Declaration]+ -- |+ -- A list of type class declarations. Type class members will be added to+ -- their parents in this list, if they exist.+ --+ , envTypeClasses :: [Declaration]+ }+ deriving (Show)++instance Semigroup TypeClassEnv where+ (TypeClassEnv a1 b1 c1) <> (TypeClassEnv a2 b2 c2) =+ TypeClassEnv (a1 <> a2) (b1 <> b2) (c1 <> c2)++instance Monoid TypeClassEnv where+ mempty =+ TypeClassEnv mempty mempty mempty++-- |+-- Take a TypeClassEnv and handle all of the type class members in it, either+-- adding them to their parent classes, or promoting them to normal Declaration+-- values.+--+-- Returns a tuple of (values, type classes).+--+handleEnv+ :: (MonadReader P.ModuleName m)+ => TypeClassEnv+ -> m ([Declaration], [Declaration])+handleEnv TypeClassEnv{..} =+ envUnhandledMembers+ |> foldM go (envValues, mkMap envTypeClasses)+ |> fmap (second Map.elems)++ where+ mkMap =+ Map.fromList . map (declTitle &&& id)++ go (values, tcs) (title, constraint, childDecl) =+ case Map.lookup title tcs of+ Just _ ->+ -- Leave the state unchanged; if the type class is there, the child+ -- will be too.+ pure (values, tcs)+ Nothing -> do+ c <- promoteChild constraint childDecl+ pure (c : values, tcs)++ promoteChild constraint ChildDeclaration{..} =+ case cdeclInfo of+ ChildTypeClassMember typ ->+ pure Declaration+ { declTitle = cdeclTitle+ , declComments = cdeclComments+ , declSourceSpan = cdeclSourceSpan+ , declChildren = []+ , declInfo = ValueDeclaration (addConstraint constraint typ)+ , declKind = Nothing+ }+ _ ->+ internalErrorInModule+ ("handleEnv: Bad child declaration passed to promoteChild: "+ ++ T.unpack cdeclTitle)++ addConstraint constraint =+ P.quantify . P.moveQuantifiersToFront () . P.ConstrainedType () constraint++splitMap :: Map k (v1, v2) -> (Map k v1, Map k v2)+splitMap = fmap fst &&& fmap snd++-- |+-- Given a list of exported constructor names, remove any data constructor+-- names in the provided Map of declarations which are not in the list.+--+filterDataConstructors+ :: [P.ProperName 'P.ConstructorName]+ -> Map P.ModuleName [Declaration]+ -> Map P.ModuleName [Declaration]+filterDataConstructors =+ filterExportedChildren isDataConstructor P.runProperName++-- |+-- Given a list of exported type class member names, remove any data+-- type class member names in the provided Map of declarations which are not in+-- the list.+--+filterTypeClassMembers+ :: [P.Ident]+ -> Map P.ModuleName [Declaration]+ -> Map P.ModuleName [Declaration]+filterTypeClassMembers =+ filterExportedChildren isTypeClassMember P.showIdent++filterExportedChildren+ :: (Functor f)+ => (ChildDeclaration -> Bool)+ -> (name -> Text)+ -> [name]+ -> f [Declaration]+ -> f [Declaration]+filterExportedChildren isTargetedKind runName expNames = fmap filterDecls+ where+ filterDecls =+ map $ filterChildren $ \c ->+ not (isTargetedKind c) || cdeclTitle c `elem` expNames'+ expNames' = map runName expNames++allDeclarations :: Module -> [Declaration]+allDeclarations Module{..} =+ modDeclarations ++ concatMap snd modReExports++(|>) :: a -> (a -> b) -> b+x |> f = f x++internalError :: String -> a+internalError = P.internalError . ("Docs.Convert.ReExports: " ++)++internalErrorInModule+ :: (MonadReader P.ModuleName m)+ => String+ -> m a+internalErrorInModule msg = do+ mn <- ask+ internalError+ ("while collecting re-exports for module: " ++ T.unpack (P.runModuleName mn) +++ ", " ++ msg)++-- |+-- If the provided Declaration is a TypeClassDeclaration, construct an+-- appropriate Constraint for use with the types of its members.+--+typeClassConstraintFor :: Declaration -> Maybe Constraint'+typeClassConstraintFor Declaration{..} =+ case declInfo of+ TypeClassDeclaration tyArgs _ _ ->+ Just (P.Constraint () (P.Qualified P.ByNullSourcePos (P.ProperName declTitle)) [] (mkConstraint tyArgs) Nothing)+ _ ->+ Nothing+ where+ mkConstraint = map (P.TypeVar () . fst)
+ src/Language/PureScript/Docs/Convert/Single.hs view
@@ -0,0 +1,235 @@+module Language.PureScript.Docs.Convert.Single+ ( convertSingleModule+ , convertComments+ ) where++import Protolude hiding (moduleName)++import Control.Category ((>>>))++import Data.Text qualified as T++import Language.PureScript.Docs.Types (ChildDeclaration(..), ChildDeclarationInfo(..), Declaration(..), DeclarationInfo(..), KindInfo(..), Module(..), Type', convertFundepsToStrings, isType, isTypeClass)++import Language.PureScript.AST qualified as P+import Language.PureScript.Comments qualified as P+import Language.PureScript.Crash qualified as P+import Language.PureScript.Names qualified as P+import Language.PureScript.Roles qualified as P+import Language.PureScript.Types qualified as P++-- |+-- Convert a single Module, but ignore re-exports; any re-exported types or+-- values will not appear in the result.+--+convertSingleModule :: P.Module -> Module+convertSingleModule m@(P.Module _ coms moduleName _ _) =+ Module moduleName comments (declarations m) []+ where+ comments = convertComments coms+ declarations =+ P.exportedDeclarations+ >>> mapMaybe (\d -> getDeclarationTitle d >>= convertDeclaration d)+ >>> augmentDeclarations++-- | Different declarations we can augment+data AugmentType+ = AugmentClass+ -- ^ Augment documentation for a type class+ | AugmentType+ -- ^ Augment documentation for a type constructor++-- | The data type for an intermediate stage which we go through during+-- converting.+--+-- In the first pass, we take all top level declarations in the module, and+-- collect other information which will later be used to augment the top level+-- declarations. These two situation correspond to the Right and Left+-- constructors, respectively.+--+-- In the second pass, we go over all of the Left values and augment the+-- relevant declarations, leaving only the augmented Right values.+--+-- Note that in the Left case, we provide a [Text] as well as augment+-- information. The [Text] value should be a list of titles of declarations+-- that the augmentation should apply to. For example, for a type instance+-- declaration, that would be any types or type classes mentioned in the+-- instance. For a fixity declaration, it would be just the relevant operator's+-- name.+type IntermediateDeclaration+ = Either ([(Text, AugmentType)], DeclarationAugment) Declaration++-- | Some data which will be used to augment a Declaration in the+-- output.+--+-- The AugmentChild constructor allows us to move all children under their+-- respective parents. It is only necessary for type instance declarations,+-- since they appear at the top level in the AST, and since they might need to+-- appear as children in two places (for example, if a data type defined in a+-- module is an instance of a type class also defined in that module).+--+-- The AugmentKindSig constructor allows us to add a kind signature+-- to its corresponding declaration. Comments for both declarations+-- are also merged together.+data DeclarationAugment+ = AugmentChild ChildDeclaration+ | AugmentKindSig KindSignatureInfo+ | AugmentRole (Maybe Text) [P.Role]++data KindSignatureInfo = KindSignatureInfo+ { ksiComments :: Maybe Text+ , ksiKeyword :: P.KindSignatureFor+ , ksiKind :: Type'+ }++-- | Augment top-level declarations; the second pass. See the comments under+-- the type synonym IntermediateDeclaration for more information.+augmentDeclarations :: [IntermediateDeclaration] -> [Declaration]+augmentDeclarations (partitionEithers -> (augments, toplevels)) =+ foldl' go toplevels augments+ where+ go ds (parentTitles, a) =+ map (\d ->+ if any (matches d) parentTitles+ then augmentWith a d+ else d) ds++ matches d (name, AugmentType) = isType d && declTitle d == name+ matches d (name, AugmentClass) = isTypeClass d && declTitle d == name++ augmentWith (AugmentChild child) d =+ d { declChildren = declChildren d ++ [child] }+ augmentWith (AugmentKindSig KindSignatureInfo{..}) d =+ d { declComments = mergeComments ksiComments $ declComments d+ , declKind = Just $ KindInfo { kiKeyword = ksiKeyword, kiKind = ksiKind }+ }+ augmentWith (AugmentRole comms roles) d =+ d { declComments = mergeComments (declComments d) comms+ , declInfo = insertRoles+ }+ where+ insertRoles = case declInfo d of+ DataDeclaration dataDeclType args [] ->+ DataDeclaration dataDeclType args roles+ DataDeclaration _ _ _ ->+ P.internalError "augmentWith: could not add a second role declaration to a data declaration"++ ExternDataDeclaration kind [] ->+ ExternDataDeclaration kind roles+ ExternDataDeclaration _ _ ->+ P.internalError "augmentWith: could not add a second role declaration to an FFI declaration"++ _ -> P.internalError "augmentWith: could not add role to declaration"++ mergeComments :: Maybe Text -> Maybe Text -> Maybe Text+ mergeComments Nothing bot = bot+ mergeComments top Nothing = top+ mergeComments (Just topComs) (Just bottomComs) =+ Just $ topComs <> "\n" <> bottomComs++getDeclarationTitle :: P.Declaration -> Maybe Text+getDeclarationTitle (P.ValueDeclaration vd) = Just (P.showIdent (P.valdeclIdent vd))+getDeclarationTitle (P.ExternDeclaration _ name _) = Just (P.showIdent name)+getDeclarationTitle (P.DataDeclaration _ _ name _ _) = Just (P.runProperName name)+getDeclarationTitle (P.ExternDataDeclaration _ name _) = Just (P.runProperName name)+getDeclarationTitle (P.TypeSynonymDeclaration _ name _ _) = Just (P.runProperName name)+getDeclarationTitle (P.TypeClassDeclaration _ name _ _ _ _) = Just (P.runProperName name)+getDeclarationTitle (P.TypeInstanceDeclaration _ _ _ _ name _ _ _ _) = Just $ either (const "<anonymous>") P.showIdent name+getDeclarationTitle (P.TypeFixityDeclaration _ _ _ op) = Just ("type " <> P.showOp op)+getDeclarationTitle (P.ValueFixityDeclaration _ _ _ op) = Just (P.showOp op)+getDeclarationTitle (P.KindDeclaration _ _ n _) = Just (P.runProperName n)+getDeclarationTitle (P.RoleDeclaration P.RoleDeclarationData{..}) = Just (P.runProperName rdeclIdent)+getDeclarationTitle _ = Nothing++-- | Create a basic Declaration value.+mkDeclaration :: P.SourceAnn -> Text -> DeclarationInfo -> Declaration+mkDeclaration (ss, com) title info =+ Declaration { declTitle = title+ , declComments = convertComments com+ , declSourceSpan = Just ss -- TODO: make this non-optional when we next break the format+ , declChildren = []+ , declInfo = info+ , declKind = Nothing -- kind sigs are added in augment pass+ }++basicDeclaration :: P.SourceAnn -> Text -> DeclarationInfo -> Maybe IntermediateDeclaration+basicDeclaration sa title = Just . Right . mkDeclaration sa title++convertDeclaration :: P.Declaration -> Text -> Maybe IntermediateDeclaration+convertDeclaration (P.ValueDecl sa _ _ _ [P.MkUnguarded (P.TypedValue _ _ ty)]) title =+ basicDeclaration sa title (ValueDeclaration (ty $> ()))+convertDeclaration (P.ValueDecl sa _ _ _ _) title =+ -- If no explicit type declaration was provided, insert a wildcard, so that+ -- the actual type will be added during type checking.+ basicDeclaration sa title (ValueDeclaration (P.TypeWildcard () P.UnnamedWildcard))+convertDeclaration (P.ExternDeclaration sa _ ty) title =+ basicDeclaration sa title (ValueDeclaration (ty $> ()))+convertDeclaration (P.DataDeclaration sa dtype _ args ctors) title =+ Just (Right (mkDeclaration sa title info) { declChildren = children })+ where+ info = DataDeclaration dtype (fmap (fmap (fmap ($> ()))) args) []+ children = map convertCtor ctors+ convertCtor :: P.DataConstructorDeclaration -> ChildDeclaration+ convertCtor P.DataConstructorDeclaration{..} =+ let (sourceSpan, comments) = dataCtorAnn+ in ChildDeclaration (P.runProperName dataCtorName) (convertComments comments) (Just sourceSpan) (ChildDataConstructor (fmap (($> ()) . snd) dataCtorFields))+convertDeclaration (P.ExternDataDeclaration sa _ kind') title =+ basicDeclaration sa title (ExternDataDeclaration (kind' $> ()) [])+convertDeclaration (P.TypeSynonymDeclaration sa _ args ty) title =+ basicDeclaration sa title (TypeSynonymDeclaration (fmap (fmap (fmap ($> ()))) args) (ty $> ()))+convertDeclaration (P.TypeClassDeclaration sa _ args implies fundeps ds) title =+ Just (Right (mkDeclaration sa title info) { declChildren = children })+ where+ args' = fmap (fmap (fmap ($> ()))) args+ info = TypeClassDeclaration args' (fmap ($> ()) implies) (convertFundepsToStrings args' fundeps)+ children = map convertClassMember ds+ convertClassMember (P.TypeDeclaration (P.TypeDeclarationData (ss, com) ident' ty)) =+ ChildDeclaration (P.showIdent ident') (convertComments com) (Just ss) (ChildTypeClassMember (ty $> ()))+ convertClassMember _ =+ P.internalError "convertDeclaration: Invalid argument to convertClassMember."+convertDeclaration (P.TypeInstanceDeclaration (ss, com) _ _ _ _ constraints className tys _) title =+ Just (Left ((classNameString, AugmentClass) : map (, AugmentType) typeNameStrings, AugmentChild childDecl))+ where+ classNameString = unQual className+ typeNameStrings = ordNub (concatMap (P.everythingOnTypes (++) extractProperNames) tys)+ unQual x = let (P.Qualified _ y) = x in P.runProperName y++ extractProperNames (P.TypeConstructor _ n) = [unQual n]+ extractProperNames _ = []++ childDecl = ChildDeclaration title (convertComments com) (Just ss) (ChildInstance (fmap ($> ()) constraints) (classApp $> ()))+ classApp = foldl' P.srcTypeApp (P.srcTypeConstructor (fmap P.coerceProperName className)) tys+convertDeclaration (P.ValueFixityDeclaration sa fixity (P.Qualified mn alias) _) title =+ Just . Right $ mkDeclaration sa title (AliasDeclaration fixity (P.Qualified mn (Right alias)))+convertDeclaration (P.TypeFixityDeclaration sa fixity (P.Qualified mn alias) _) title =+ Just . Right $ mkDeclaration sa title (AliasDeclaration fixity (P.Qualified mn (Left alias)))+convertDeclaration (P.KindDeclaration sa keyword _ kind) title =+ Just $ Left ([(title, AugmentType), (title, AugmentClass)], AugmentKindSig ksi)+ where+ comms = convertComments $ snd sa+ ksi = KindSignatureInfo { ksiComments = comms, ksiKeyword = keyword, ksiKind = kind $> () }+convertDeclaration (P.RoleDeclaration P.RoleDeclarationData{..}) title =+ Just $ Left ([(title, AugmentType)], AugmentRole comms rdeclRoles)+ where+ comms = convertComments $ snd rdeclSourceAnn++convertDeclaration _ _ = Nothing++convertComments :: [P.Comment] -> Maybe Text+convertComments cs = do+ let raw = concatMap toLines cs+ let docs = mapMaybe stripPipe raw+ guard (not (null docs))+ pure (T.unlines docs)++ where+ toLines (P.LineComment s) = [s]+ toLines (P.BlockComment s) = T.lines s++ stripPipe =+ T.dropWhile (== ' ')+ >>> T.stripPrefix "|"+ >>> fmap (dropPrefix " ")++ dropPrefix prefix str =+ fromMaybe str (T.stripPrefix prefix str)
+ src/Language/PureScript/Docs/Css.hs view
@@ -0,0 +1,31 @@+{-# LANGUAGE TemplateHaskell #-}+module Language.PureScript.Docs.Css where++import Data.ByteString (ByteString)+import Data.Text (Text)+import Data.Text.Encoding (decodeUtf8)+import Data.FileEmbed (embedFile)++-- |+-- An embedded copy of normalize.css as a UTF-8 encoded ByteString; this should+-- be included before pursuit.css in any HTML page using pursuit.css.+--+normalizeCss :: ByteString+normalizeCss = $(embedFile "app/static/normalize.css")++-- |+-- Like 'normalizeCss', but as a 'Text'.+normalizeCssT :: Text+normalizeCssT = decodeUtf8 normalizeCss++-- |+-- CSS for use with generated HTML docs, as a UTF-8 encoded ByteString.+--+pursuitCss :: ByteString+pursuitCss = $(embedFile "app/static/pursuit.css")++-- |+-- Like 'pursuitCss', but as a 'Text'.+--+pursuitCssT :: Text+pursuitCssT = decodeUtf8 pursuitCss
+ src/Language/PureScript/Docs/Prim.hs view
@@ -0,0 +1,666 @@+-- | This module provides documentation for the builtin Prim modules.+module Language.PureScript.Docs.Prim+ ( primDocsModule+ , primRowDocsModule+ , primTypeErrorDocsModule+ , primModules+ ) where++import Prelude hiding (fail)+import Data.Functor (($>))+import Data.Text (Text)+import Data.Text qualified as T+import Data.Map qualified as Map+import Language.PureScript.Docs.Types (Declaration(..), DeclarationInfo(..), Module(..), Type', convertFundepsToStrings)++import Language.PureScript.Constants.Prim qualified as P+import Language.PureScript.Crash qualified as P+import Language.PureScript.Environment qualified as P+import Language.PureScript.Names qualified as P++primModules :: [Module]+primModules =+ [ primDocsModule+ , primBooleanDocsModule+ , primCoerceDocsModule+ , primOrderingDocsModule+ , primRowDocsModule+ , primRowListDocsModule+ , primSymbolDocsModule+ , primIntDocsModule+ , primTypeErrorDocsModule+ ]++primDocsModule :: Module+primDocsModule = Module+ { modName = P.moduleNameFromString "Prim"+ , modComments = Just $ T.unlines+ [ "The `Prim` module is embedded in the PureScript compiler in order to provide compiler support for certain types — for example, value literals, or syntax sugar. It is implicitly imported unqualified in every module except those that list it as a qualified import."+ , ""+ , "`Prim` does not include additional built-in types and kinds that are defined deeper in the compiler such as Type wildcards (e.g. `f :: _ -> Int`) and Quantified Types. Rather, these are documented in [the PureScript language reference](https://github.com/purescript/documentation/blob/master/language/Types.md)."+ ]+ , modDeclarations =+ [ function+ , array+ , record+ , number+ , int+ , string+ , char+ , boolean+ , partial+ , kindType+ , kindConstraint+ , kindSymbol+ , kindRow+ ]+ , modReExports = []+ }++primBooleanDocsModule :: Module+primBooleanDocsModule = Module+ { modName = P.moduleNameFromString "Prim.Boolean"+ , modComments = Just "The Prim.Boolean module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains a type level `Boolean` data structure."+ , modDeclarations =+ [ booleanTrue+ , booleanFalse+ ]+ , modReExports = []+ }++primCoerceDocsModule :: Module+primCoerceDocsModule = Module+ { modName = P.moduleNameFromString "Prim.Coerce"+ , modComments = Just "The Prim.Coerce module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains an automatically solved type class for coercing types that have provably-identical runtime representations with [purescript-safe-coerce](https://pursuit.purescript.org/packages/purescript-safe-coerce)."+ , modDeclarations =+ [ coercible+ ]+ , modReExports = []+ }++primOrderingDocsModule :: Module+primOrderingDocsModule = Module+ { modName = P.moduleNameFromString "Prim.Ordering"+ , modComments = Just "The Prim.Ordering module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains a type level `Ordering` data structure."+ , modDeclarations =+ [ kindOrdering+ , orderingLT+ , orderingEQ+ , orderingGT+ ]+ , modReExports = []+ }++primRowDocsModule :: Module+primRowDocsModule = Module+ { modName = P.moduleNameFromString "Prim.Row"+ , modComments = Just "The Prim.Row module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains automatically solved type classes for working with row types."+ , modDeclarations =+ [ union+ , nub+ , lacks+ , rowCons+ ]+ , modReExports = []+ }++primRowListDocsModule :: Module+primRowListDocsModule = Module+ { modName = P.moduleNameFromString "Prim.RowList"+ , modComments = Just "The Prim.RowList module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains a type level list (`RowList`) that represents an ordered view of a row of types."+ , modDeclarations =+ [ kindRowList+ , rowListCons+ , rowListNil+ , rowToList+ ]+ , modReExports = []+ }++primSymbolDocsModule :: Module+primSymbolDocsModule = Module+ { modName = P.moduleNameFromString "Prim.Symbol"+ , modComments = Just "The Prim.Symbol module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains automatically solved type classes for working with `Symbols`."+ , modDeclarations =+ [ symbolAppend+ , symbolCompare+ , symbolCons+ ]+ , modReExports = []+ }++primIntDocsModule :: Module+primIntDocsModule = Module+ { modName = P.moduleNameFromString "Prim.Int"+ , modComments = Just "The Prim.Int module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains automatically solved type classes for working with type-level intural numbers."+ , modDeclarations =+ [ intAdd+ , intCompare+ , intMul+ , intToString+ ]+ , modReExports = []+ }++primTypeErrorDocsModule :: Module+primTypeErrorDocsModule = Module+ { modName = P.moduleNameFromString "Prim.TypeError"+ , modComments = Just "The Prim.TypeError module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains type classes that provide custom type error and warning functionality."+ , modDeclarations =+ [ warn+ , fail+ , kindDoc+ , textDoc+ , quoteDoc+ , quoteLabelDoc+ , besideDoc+ , aboveDoc+ ]+ , modReExports = []+ }++unsafeLookup+ :: forall v (a :: P.ProperNameType)+ . Map.Map (P.Qualified (P.ProperName a)) v+ -> String+ -> P.Qualified (P.ProperName a)+ -> v+unsafeLookup m errorMsg name = go name+ where+ go = fromJust' . flip Map.lookup m++ fromJust' (Just x) = x+ fromJust' _ = P.internalError $ errorMsg ++ show (P.runProperName $ P.disqualify name)++lookupPrimTypeKind+ :: P.Qualified (P.ProperName 'P.TypeName)+ -> Type'+lookupPrimTypeKind = ($> ()) . fst . unsafeLookup+ ( P.primTypes <>+ P.primBooleanTypes <>+ P.primOrderingTypes <>+ P.primRowTypes <>+ P.primRowListTypes <>+ P.primTypeErrorTypes+ ) "Docs.Prim: No such Prim type: "++primType :: P.Qualified (P.ProperName 'P.TypeName) -> Text -> Declaration+primType tn comments = Declaration+ { declTitle = P.runProperName $ P.disqualify tn+ , declComments = Just comments+ , declSourceSpan = Nothing+ , declChildren = []+ , declInfo = ExternDataDeclaration (lookupPrimTypeKind tn) []+ , declKind = Nothing+ }++-- | Lookup the TypeClassData of a Prim class. This function is specifically+-- not exported because it is partial.+lookupPrimClass :: P.Qualified (P.ProperName 'P.ClassName) -> P.TypeClassData+lookupPrimClass = unsafeLookup+ ( P.primClasses <>+ P.primCoerceClasses <>+ P.primRowClasses <>+ P.primRowListClasses <>+ P.primSymbolClasses <>+ P.primIntClasses <>+ P.primTypeErrorClasses+ ) "Docs.Prim: No such Prim class: "++primClass :: P.Qualified (P.ProperName 'P.ClassName) -> Text -> Declaration+primClass cn comments = Declaration+ { declTitle = P.runProperName $ P.disqualify cn+ , declComments = Just comments+ , declSourceSpan = Nothing+ , declChildren = []+ , declInfo =+ let+ tcd = lookupPrimClass cn+ args = fmap (fmap ($> ())) <$> P.typeClassArguments tcd+ superclasses = ($> ()) <$> P.typeClassSuperclasses tcd+ fundeps = convertFundepsToStrings args (P.typeClassDependencies tcd)+ in+ TypeClassDeclaration args superclasses fundeps+ , declKind = Nothing+ }++kindType :: Declaration+kindType = primType P.Type $ T.unlines+ [ "`Type` is the kind of all proper types: those that classify value-level terms."+ , "For example the type `Boolean` has kind `Type`; denoted by `Boolean :: Type`."+ ]++kindConstraint :: Declaration+kindConstraint = primType P.Constraint $ T.unlines+ [ "`Constraint` is the kind of type class constraints."+ , "For example, a type class declaration like this:"+ , ""+ , " class Semigroup a where"+ , " append :: a -> a -> a"+ , ""+ , "has the kind signature:"+ , ""+ , " class Semigroup :: Type -> Constraint"+ ]++kindSymbol :: Declaration+kindSymbol = primType P.Symbol $ T.unlines+ [ "`Symbol` is the kind of type-level strings."+ , ""+ , "Construct types of this kind using the same literal syntax as documented"+ , "for strings."+ , ""+ , " type Hello :: Symbol"+ , " type Hello = \"Hello, world\""+ , ""+ ]++kindRow :: Declaration+kindRow = primType P.Row $ T.unlines+ [ "`Row` is the kind constructor of label-indexed types which map type-level strings to other types."+ , "The most common use of `Row` is `Row Type`, a row mapping labels to basic (of kind `Type`) types:"+ , ""+ , " type ExampleRow :: Row Type"+ , " type ExampleRow = ( name :: String, values :: Array Int )"+ , ""+ , "This is the kind of `Row` expected by the `Record` type constructor."+ , "More advanced row kinds like `Row (Type -> Type)` are used much less frequently."+ ]++function :: Declaration+function = primType P.Function $ T.unlines+ [ "A function, which takes values of the type specified by the first type"+ , "parameter, and returns values of the type specified by the second."+ , "In the JavaScript backend, this is a standard JavaScript Function."+ , ""+ , "The type constructor `(->)` is syntactic sugar for this type constructor."+ , "It is recommended to use `(->)` rather than `Function`, where possible."+ , ""+ , "That is, prefer this:"+ , ""+ , " f :: Number -> Number"+ , ""+ , "to either of these:"+ , ""+ , " f :: Function Number Number"+ , " f :: (->) Number Number"+ ]++array :: Declaration+array = primType P.Array $ T.unlines+ [ "An Array: a data structure supporting efficient random access. In"+ , "the JavaScript backend, values of this type are represented as JavaScript"+ , "Arrays at runtime."+ , ""+ , "Construct values using literals:"+ , ""+ , " x = [1,2,3,4,5] :: Array Int"+ ]++record :: Declaration+record = primType P.Record $ T.unlines+ [ "The type of records whose fields are known at compile time. In the"+ , "JavaScript backend, values of this type are represented as JavaScript"+ , "Objects at runtime."+ , ""+ , "The type signature here means that the `Record` type constructor takes"+ , "a row of concrete types. For example:"+ , ""+ , " type Person = Record (name :: String, age :: Number)"+ , ""+ , "The syntactic sugar with curly braces `{ }` is generally preferred, though:"+ , ""+ , " type Person = { name :: String, age :: Number }"+ , ""+ , "The row associates a type to each label which appears in the record."+ , ""+ , "_Technical note_: PureScript allows duplicate labels in rows, and the"+ , "meaning of `Record r` is based on the _first_ occurrence of each label in"+ , "the row `r`."+ ]++number :: Declaration+number = primType P.Number $ T.unlines+ [ "A double precision floating point number (IEEE 754)."+ , ""+ , "Construct values of this type with literals."+ , "Negative literals must be wrapped in parentheses if the negation sign could be mistaken"+ , "for an infix operator:"+ , ""+ , " x = 35.23 :: Number"+ , " y = -1.224e6 :: Number"+ , " z = exp (-1.0) :: Number"+ ]++int :: Declaration+int = primType P.Int $ T.unlines+ [ "A 32-bit signed integer. See the `purescript-integers` package for details"+ , "of how this is accomplished when compiling to JavaScript."+ , ""+ , "Construct values of this type with literals. Hexadecimal syntax is supported."+ , "Negative literals must be wrapped in parentheses if the negation sign could be mistaken"+ , "for an infix operator:"+ , ""+ , " x = -23 :: Int"+ , " y = 0x17 :: Int"+ , " z = complement (-24) :: Int"+ , ""+ , "Integers used as types are considered to have kind `Int`."+ , "Unlike value-level `Int`s, which must be representable as a 32-bit signed integer,"+ , "type-level `Int`s are unbounded. Hexadecimal support is also supported at the type level."+ , ""+ , " type One :: Int"+ , " type One = 1"+ , " "+ , " type Beyond32BitSignedInt :: Int"+ , " type Beyond32BitSignedInt = 2147483648"+ , " "+ , " type HexInt :: Int"+ , " type HexInt = 0x17"+ , ""+ , "Negative integer literals at the type level must be"+ , "wrapped in parentheses if the negation sign could be mistaken for an infix operator."+ , ""+ , " type NegativeOne = -1"+ , " foo :: Proxy (-1) -> ..."+ ]++string :: Declaration+string = primType P.String $ T.unlines+ [ "A String. As in JavaScript, String values represent sequences of UTF-16"+ , "code units, which are not required to form a valid encoding of Unicode"+ , "text (for example, lone surrogates are permitted)."+ , ""+ , "Construct values of this type with literals, using double quotes `\"`:"+ , ""+ , " x = \"hello, world\" :: String"+ , ""+ , "Multi-line string literals are also supported with triple quotes (`\"\"\"`):"+ , ""+ , " x = \"\"\"multi"+ , " line\"\"\""+ , ""+ , "At the type level, string literals represent types with kind `Symbol`."+ , "These types will have kind `String` in a future release:"+ , ""+ , " type Hello :: Symbol"+ , " type Hello = \"Hello, world\""+ ]++char :: Declaration+char = primType P.Char $ T.unlines+ [ "A single character (UTF-16 code unit). The JavaScript representation is a"+ , "normal `String`, which is guaranteed to contain one code unit. This means"+ , "that astral plane characters (i.e. those with code point values greater"+ , "than `0xFFFF`) cannot be represented as `Char` values."+ , ""+ , "Construct values of this type with literals, using single quotes `'`:"+ , ""+ , " x = 'a' :: Char"+ ]++boolean :: Declaration+boolean = primType P.Boolean $ T.unlines+ [ "A JavaScript Boolean value."+ , ""+ , "Construct values of this type with the literals `true` and `false`."+ , ""+ , "The `True` and `False` types defined in `Prim.Boolean` have this type as their kind."+ ]++partial :: Declaration+partial = primClass P.Partial $ T.unlines+ [ "The Partial type class is used to indicate that a function is *partial,*"+ , "that is, it is not defined for all inputs. In practice, attempting to use"+ , "a partial function with a bad input will usually cause an error to be"+ , "thrown, although it is not safe to assume that this will happen in all"+ , "cases. For more information, see"+ , "[purescript-partial](https://pursuit.purescript.org/packages/purescript-partial/)."+ ]++booleanTrue :: Declaration+booleanTrue = primType P.True $ T.unlines+ [ "The 'True' boolean type."+ ]++booleanFalse :: Declaration+booleanFalse = primType P.False $ T.unlines+ [ "The 'False' boolean type."+ ]++coercible :: Declaration+coercible = primClass P.Coercible $ T.unlines+ [ "Coercible is a two-parameter type class that has instances for types `a`"+ , "and `b` if the compiler can infer that they have the same representation."+ , "Coercible constraints are solved according to the following rules:"+ , ""+ , "* _reflexivity_, any type has the same representation as itself:"+ , "`Coercible a a` holds."+ , ""+ , "* _symmetry_, if a type `a` can be coerced to some other type `b`, then `b`"+ , "can also be coerced back to `a`: `Coercible a b` implies `Coercible b a`."+ , ""+ , "* _transitivity_, if a type `a` can be coerced to some other type `b` which"+ , "can be coerced to some other type `c`, then `a` can also be coerced to `c`:"+ , "`Coercible a b` and `Coercible b c` imply `Coercible a c`."+ , ""+ , "* Newtypes can be freely wrapped and unwrapped when their constructor is"+ , "in scope:"+ , ""+ , " newtype Age = Age Int"+ , ""+ , "`Coercible Int Age` and `Coercible Age Int` hold since `Age` has the same"+ , "runtime representation than `Int`."+ , ""+ , "Newtype constructors have to be in scope to preserve abstraction. It's"+ , "common to declare a newtype to encode some invariants (non emptiness of"+ , "arrays with `Data.Array.NonEmpty.NonEmptyArray` for example), hide its"+ , "constructor and export smart constructors instead. Without this restriction,"+ , "the guarantees provided by such newtypes would be void."+ , ""+ , "* If none of the above are applicable, two types of kind `Type` may be"+ , "coercible, but only if their heads are the same. For example,"+ , "`Coercible (Maybe a) (Either a b)` does not hold because `Maybe` and"+ , "`Either` are different. Those types don't share a common runtime"+ , "representation so coercing between them would be unsafe. In addition their"+ , "arguments may need to be identical or coercible, depending on the _roles_"+ , "of the head's type parameters. Roles are documented in [the PureScript"+ , "language reference](https://github.com/purescript/documentation/blob/master/language/Roles.md)."+ , ""+ , "Coercible being polykinded, we can also coerce more than types of kind `Type`:"+ , ""+ , "* Rows are coercible when they have the same labels, when the corresponding"+ , "pairs of types are coercible and when their tails are coercible:"+ , "`Coercible ( label :: a | r ) ( label :: b | s )` holds when"+ , "`Coercible a b` and `Coercible r s` do. Closed rows cannot be coerced to"+ , "open rows."+ , ""+ , "* Higher kinded types are coercible if they are coercible when fully"+ , "saturated: `Coercible (f :: _ -> Type) (g :: _ -> Type)` holds when"+ , "`Coercible (f a) (g a)` does."+ , ""+ , "This rule may seem puzzling since there is no term of type `_ -> Type` to"+ , "apply `coerce` to, but it is necessary when coercing types with higher"+ , "kinded parameters."+ ]++kindOrdering :: Declaration+kindOrdering = primType P.TypeOrdering $ T.unlines+ [ "The `Ordering` kind represents the three possibilities of comparing two"+ , "types of the same kind: `LT` (less than), `EQ` (equal to), and"+ , "`GT` (greater than)."+ ]++orderingLT :: Declaration+orderingLT = primType P.LT $ T.unlines+ [ "The 'less than' ordering type."+ ]++orderingEQ :: Declaration+orderingEQ = primType P.EQ $ T.unlines+ [ "The 'equal to' ordering type."+ ]++orderingGT :: Declaration+orderingGT = primType P.GT $ T.unlines+ [ "The 'greater than' ordering type."+ ]++union :: Declaration+union = primClass P.RowUnion $ T.unlines+ [ "The Union type class is used to compute the union of two rows of types"+ , "(left-biased, including duplicates)."+ , ""+ , "The third type argument represents the union of the first two."+ ]++nub :: Declaration+nub = primClass P.RowNub $ T.unlines+ [ "The Nub type class is used to remove duplicate labels from rows."+ ]++lacks :: Declaration+lacks = primClass P.RowLacks $ T.unlines+ [ "The Lacks type class asserts that a label does not occur in a given row."+ ]++rowCons :: Declaration+rowCons = primClass P.RowCons $ T.unlines+ [ "The Cons type class is a 4-way relation which asserts that one row of"+ , "types can be obtained from another by inserting a new label/type pair on"+ , "the left."+ ]++kindRowList :: Declaration+kindRowList = primType P.RowList $ T.unlines+ [ "A type level list representation of a row of types."+ ]++rowListCons :: Declaration+rowListCons = primType P.RowListCons $ T.unlines+ [ "Constructs a new `RowList` from a label, a type, and an existing tail"+ , "`RowList`. E.g: `Cons \"x\" Int (Cons \"y\" Int Nil)`."+ ]++rowListNil :: Declaration+rowListNil = primType P.RowListNil $ T.unlines+ [ "The empty `RowList`."+ ]++rowToList :: Declaration+rowToList = primClass P.RowToList $ T.unlines+ [ "Compiler solved type class for generating a `RowList` from a closed row"+ , "of types. Entries are sorted by label and duplicates are preserved in"+ , "the order they appeared in the row."+ ]++symbolAppend :: Declaration+symbolAppend = primClass P.SymbolAppend $ T.unlines+ [ "Compiler solved type class for appending `Symbol`s together."+ ]++symbolCompare :: Declaration+symbolCompare = primClass P.SymbolCompare $ T.unlines+ [ "Compiler solved type class for comparing two `Symbol`s."+ , "Produces an `Ordering`."+ ]++symbolCons :: Declaration+symbolCons = primClass P.SymbolCons $ T.unlines+ [ "Compiler solved type class for either splitting up a symbol into its"+ , "head and tail or for combining a head and tail into a new symbol."+ , "Requires the head to be a single character and the combined string"+ , "cannot be empty."+ ]++intAdd :: Declaration+intAdd = primClass P.IntAdd $ T.unlines+ [ "Compiler solved type class for adding type-level `Int`s."+ ]++intCompare :: Declaration+intCompare = primClass P.IntCompare $ T.unlines+ [ "Compiler solved type class for comparing two type-level `Int`s."+ , "Produces an `Ordering`."+ ]++intMul :: Declaration+intMul = primClass P.IntMul $ T.unlines+ [ "Compiler solved type class for multiplying type-level `Int`s."+ ]++intToString :: Declaration+intToString = primClass P.IntToString $ T.unlines+ [ "Compiler solved type class for converting a type-level `Int` into a type-level `String` (i.e. `Symbol`)."+ ]++fail :: Declaration+fail = primClass P.Fail $ T.unlines+ [ "The Fail type class is part of the custom type errors feature. To provide"+ , "a custom type error when someone tries to use a particular instance,"+ , "write that instance out with a Fail constraint."+ , ""+ , "For more information, see"+ , "[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md)."+ ]++warn :: Declaration+warn = primClass P.Warn $ T.unlines+ [ "The Warn type class allows a custom compiler warning to be displayed."+ , ""+ , "For more information, see"+ , "[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md)."+ ]++kindDoc :: Declaration+kindDoc = primType P.Doc $ T.unlines+ [ "`Doc` is the kind of type-level documents."+ , ""+ , "This kind is used with the `Fail` and `Warn` type classes."+ , "Build up a `Doc` with `Text`, `Quote`, `QuoteLabel`, `Beside`, and `Above`."+ ]++textDoc :: Declaration+textDoc = primType P.Text $ T.unlines+ [ "The Text type constructor makes a Doc from a Symbol"+ , "to be used in a custom type error."+ , ""+ , "For more information, see"+ , "[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md)."+ ]++quoteDoc :: Declaration+quoteDoc = primType P.Quote $ T.unlines+ [ "The Quote type constructor renders any concrete type as a Doc"+ , "to be used in a custom type error."+ , ""+ , "For more information, see"+ , "[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md)."+ ]++quoteLabelDoc :: Declaration+quoteLabelDoc = primType P.QuoteLabel $ T.unlines+ [ "The `QuoteLabel` type constructor will produce a `Doc` when given a `Symbol`. When the resulting `Doc` is rendered"+ , "for a `Warn` or `Fail` constraint, a syntactically valid label will be produced, escaping with quotes as needed."+ , ""+ , "For more information, see"+ , "[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md)."+ ]++besideDoc :: Declaration+besideDoc = primType P.Beside $ T.unlines+ [ "The Beside type constructor combines two Docs horizontally"+ , "to be used in a custom type error."+ , ""+ , "For more information, see"+ , "[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md)."+ ]++aboveDoc :: Declaration+aboveDoc = primType P.Above $ T.unlines+ [ "The Above type constructor combines two Docs vertically"+ , "in a custom type error."+ , ""+ , "For more information, see"+ , "[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md)."+ ]
+ src/Language/PureScript/Docs/Render.hs view
@@ -0,0 +1,142 @@+-- |+-- Functions for creating `RenderedCode` values from data types in+-- Language.PureScript.Docs.Types.+--+-- These functions are the ones that are used in markdown/html documentation+-- generation, but the intention is that you are able to supply your own+-- instead if necessary. For example, the Hoogle input file generator+-- substitutes some of these++module Language.PureScript.Docs.Render where++import Prelude++import Data.Maybe (maybeToList)+import Data.Text (Text)+import Data.Text qualified as T++import Language.PureScript.Docs.RenderedCode+import Language.PureScript.Docs.Types (ChildDeclaration(..), ChildDeclarationInfo(..), Constraint', Declaration(..), DeclarationInfo(..), KindInfo(..), Type', isTypeClassMember, kindSignatureForKeyword)+import Language.PureScript.Docs.Utils.MonoidExtras (mintersperse)++import Language.PureScript.AST qualified as P+import Language.PureScript.Environment qualified as P+import Language.PureScript.Names qualified as P+import Language.PureScript.Types qualified as P++renderKindSig :: Text -> KindInfo -> RenderedCode+renderKindSig declTitle KindInfo{..} =+ mintersperse sp+ [ keyword $ kindSignatureForKeyword kiKeyword+ , renderType (P.TypeConstructor () (notQualified declTitle))+ , syntax "::"+ , renderType kiKind+ ]++renderDeclaration :: Declaration -> RenderedCode+renderDeclaration Declaration{..} =+ mintersperse sp $ case declInfo of+ ValueDeclaration ty ->+ [ ident' declTitle+ , syntax "::"+ , renderType ty+ ]+ DataDeclaration dtype args roles ->+ [ keyword (P.showDataDeclType dtype)+ , renderTypeWithRole roles (typeApp declTitle args)+ ]++ -- All FFI declarations, except for `Prim` modules' doc declarations,+ -- will have been converted to `DataDeclaration`s by this point.+ ExternDataDeclaration kind' _ ->+ [ keywordData+ , renderType (P.TypeConstructor () (notQualified declTitle))+ , syntax "::"+ , renderType kind'+ ]+ TypeSynonymDeclaration args ty ->+ [ keywordType+ , renderType (typeApp declTitle args)+ , syntax "="+ , renderType ty+ ]+ TypeClassDeclaration args implies fundeps ->+ [ keywordClass ]+ ++ maybeToList superclasses+ ++ [renderType (typeApp declTitle args)]+ ++ fundepsList+ ++ [keywordWhere | any isTypeClassMember declChildren]++ where+ superclasses+ | null implies = Nothing+ | otherwise = Just $+ syntax "("+ <> mintersperse (syntax "," <> sp) (map renderConstraint implies)+ <> syntax ")" <> sp <> syntax "<="++ fundepsList =+ [syntax "|" | not (null fundeps)]+ ++ [mintersperse+ (syntax "," <> sp)+ [typeVars from <> sp <> syntax "->" <> sp <> typeVars to | (from, to) <- fundeps ]+ ]+ where+ typeVars = mintersperse sp . map typeVar++ AliasDeclaration (P.Fixity associativity precedence) for ->+ [ keywordFixity associativity+ , syntax $ T.pack $ show precedence+ , alias for+ , keywordAs+ , aliasName for declTitle+ ]++renderChildDeclaration :: ChildDeclaration -> RenderedCode+renderChildDeclaration ChildDeclaration{..} =+ mintersperse sp $ case cdeclInfo of+ ChildInstance constraints ty ->+ maybeToList (renderConstraints constraints) ++ [ renderType ty ]+ ChildDataConstructor args ->+ dataCtor' cdeclTitle : map renderTypeAtom args++ ChildTypeClassMember ty ->+ [ ident' cdeclTitle+ , syntax "::"+ , renderType ty+ ]++renderConstraint :: Constraint' -> RenderedCode+renderConstraint (P.Constraint ann pn kinds tys _) =+ renderType $ foldl (P.TypeApp ann) (foldl (P.KindApp ann) (P.TypeConstructor ann (fmap P.coerceProperName pn)) kinds) tys++renderConstraints :: [Constraint'] -> Maybe RenderedCode+renderConstraints constraints+ | null constraints = Nothing+ | otherwise = Just $+ syntax "("+ <> renderedConstraints+ <> syntax ")" <> sp <> syntax "=>"+ where+ renderedConstraints =+ mintersperse (syntax "," <> sp)+ (map renderConstraint constraints)++notQualified :: Text -> P.Qualified (P.ProperName a)+notQualified = P.Qualified P.ByNullSourcePos . P.ProperName++ident' :: Text -> RenderedCode+ident' = ident . P.Qualified P.ByNullSourcePos . P.Ident++dataCtor' :: Text -> RenderedCode+dataCtor' = dataCtor . notQualified++typeApp :: Text -> [(Text, Maybe Type')] -> Type'+typeApp title typeArgs =+ foldl (P.TypeApp ())+ (P.TypeConstructor () (notQualified title))+ (map toTypeVar typeArgs)++toTypeVar :: (Text, Maybe Type') -> Type'+toTypeVar (s, Nothing) = P.TypeVar () s+toTypeVar (s, Just k) = P.KindedType () (P.TypeVar () s) k
+ src/Language/PureScript/Docs/RenderedCode.hs view
@@ -0,0 +1,8 @@++-- | Data types and functions for representing a simplified form of PureScript+-- code, intended for use in e.g. HTML documentation.++module Language.PureScript.Docs.RenderedCode (module RenderedCode) where++import Language.PureScript.Docs.RenderedCode.Types as RenderedCode+import Language.PureScript.Docs.RenderedCode.RenderType as RenderedCode
+ src/Language/PureScript/Docs/RenderedCode/RenderType.hs view
@@ -0,0 +1,255 @@+-- HLint is confused by the identifier `pattern` if PatternSynonyms is enabled.+{-# LANGUAGE NoPatternSynonyms #-}++-- | Functions for producing RenderedCode values from PureScript Type values.++module Language.PureScript.Docs.RenderedCode.RenderType+ ( renderType+ , renderTypeWithRole+ , renderType'+ , renderTypeAtom+ , renderTypeAtom'+ , renderRow+ ) where++import Prelude++import Data.Maybe (fromMaybe)+import Data.Text (Text, pack)+import Data.List (uncons)++import Control.Arrow ((<+>))+import Control.PatternArrows as PA++import Language.PureScript.Crash (internalError)+import Language.PureScript.Label (Label)+import Language.PureScript.Names (coerceProperName)+import Language.PureScript.Pretty.Types (PrettyPrintConstraint, PrettyPrintType(..), convertPrettyPrintType, prettyPrintLabel)+import Language.PureScript.Roles (Role, displayRole)+import Language.PureScript.Types (Type, TypeVarVisibility, typeVarVisibilityPrefix)+import Language.PureScript.PSString (prettyPrintString)++import Language.PureScript.Docs.RenderedCode.Types (RenderedCode, keywordForall, roleAnn, sp, syntax, typeCtor, typeOp, typeVar)+import Language.PureScript.Docs.Utils.MonoidExtras (mintersperse)++typeLiterals :: Pattern () PrettyPrintType RenderedCode+typeLiterals = mkPattern match+ where+ match (PPTypeWildcard name) =+ Just $ syntax $ maybe "_" ("?" <>) name+ match (PPTypeVar var role) =+ Just $ typeVar var <> roleAnn role+ match (PPRecord labels tail_) =+ Just $ mintersperse sp+ [ syntax "{"+ , renderRow labels tail_+ , syntax "}"+ ]+ match (PPTypeConstructor n) =+ Just (typeCtor n)+ match (PPRow labels tail_) =+ Just (syntax "(" <> renderRow labels tail_ <> syntax ")")+ match (PPBinaryNoParensType op l r) =+ Just $ renderTypeAtom' l <> sp <> renderTypeAtom' op <> sp <> renderTypeAtom' r+ match (PPTypeOp n) =+ Just (typeOp n)+ match (PPTypeLevelString str) =+ Just (syntax (prettyPrintString str))+ match (PPTypeLevelInt nat) =+ Just (syntax $ pack $ show nat)+ match _ =+ Nothing++renderConstraint :: PrettyPrintConstraint -> RenderedCode+renderConstraint (pn, ks, tys) =+ let instApp = foldl PPTypeApp (foldl (\a b -> PPTypeApp a (PPKindArg b)) (PPTypeConstructor (fmap coerceProperName pn)) ks) tys+ in renderType' instApp++renderConstraints :: PrettyPrintConstraint -> RenderedCode -> RenderedCode+renderConstraints con ty =+ mintersperse sp+ [ renderConstraint con+ , syntax "=>"+ , ty+ ]++-- |+-- Render code representing a Row+--+renderRow :: [(Label, PrettyPrintType)] -> Maybe PrettyPrintType -> RenderedCode+renderRow h t = renderHead h <> renderTail t++renderHead :: [(Label, PrettyPrintType)] -> RenderedCode+renderHead = mintersperse (syntax "," <> sp) . map renderLabel++renderLabel :: (Label, PrettyPrintType) -> RenderedCode+renderLabel (label, ty) =+ mintersperse sp+ [ typeVar $ prettyPrintLabel label+ , syntax "::"+ , renderType' ty+ ]++renderTail :: Maybe PrettyPrintType -> RenderedCode+renderTail Nothing = mempty+renderTail (Just other) = sp <> syntax "|" <> sp <> renderType' other++typeApp :: Pattern () PrettyPrintType (PrettyPrintType, PrettyPrintType)+typeApp = mkPattern match+ where+ match (PPTypeApp f x) = Just (f, x)+ match _ = Nothing++kindArg :: Pattern () PrettyPrintType ((), PrettyPrintType)+kindArg = mkPattern match+ where+ match (PPKindArg ty) = Just ((), ty)+ match _ = Nothing++appliedFunction :: Pattern () PrettyPrintType (PrettyPrintType, PrettyPrintType)+appliedFunction = mkPattern match+ where+ match (PPFunction arg ret) = Just (arg, ret)+ match _ = Nothing++kinded :: Pattern () PrettyPrintType (PrettyPrintType, PrettyPrintType)+kinded = mkPattern match+ where+ match (PPKindedType t k) = Just (t, k)+ match _ = Nothing++constrained :: Pattern () PrettyPrintType (PrettyPrintConstraint, PrettyPrintType)+constrained = mkPattern match+ where+ match (PPConstrainedType con ty) = Just (con, ty)+ match _ = Nothing++explicitParens :: Pattern () PrettyPrintType ((), PrettyPrintType)+explicitParens = mkPattern match+ where+ match (PPParensInType ty) = Just ((), ty)+ match _ = Nothing++matchTypeAtom :: Pattern () PrettyPrintType RenderedCode+matchTypeAtom = typeLiterals <+> fmap parens_ matchType+ where+ parens_ x = syntax "(" <> x <> syntax ")"++matchType :: Pattern () PrettyPrintType RenderedCode+matchType = buildPrettyPrinter operators matchTypeAtom+ where+ operators :: OperatorTable () PrettyPrintType RenderedCode+ operators =+ OperatorTable [ [ Wrap kindArg $ \_ ty -> syntax "@" <> ty ]+ , [ AssocL typeApp $ \f x -> f <> sp <> x ]+ , [ AssocR appliedFunction $ \arg ret -> mintersperse sp [arg, syntax "->", ret] ]+ , [ Wrap constrained $ \deps ty -> renderConstraints deps ty ]+ , [ Wrap forall_ $ \tyVars ty -> mconcat [ keywordForall, sp, renderTypeVars tyVars, syntax ".", sp, ty ] ]+ , [ Wrap kinded $ \ty k -> mintersperse sp [renderType' ty, syntax "::", k] ]+ , [ Wrap explicitParens $ \_ ty -> ty ]+ ]++forall_ :: Pattern () PrettyPrintType ([(TypeVarVisibility, Text, Maybe PrettyPrintType)], PrettyPrintType)+forall_ = mkPattern match+ where+ match (PPForAll mbKindedIdents ty) = Just (mbKindedIdents, ty)+ match _ = Nothing++renderTypeInternal :: (PrettyPrintType -> PrettyPrintType) -> Type a -> RenderedCode+renderTypeInternal insertRolesIfAny =+ renderType' . insertRolesIfAny . convertPrettyPrintType maxBound++-- |+-- Render code representing a Type+--+renderType :: Type a -> RenderedCode+renderType = renderTypeInternal id++-- |+-- Render code representing a Type+-- but augment the `TypeVar`s with their `Role` if they have one+--+renderTypeWithRole :: [Role] -> Type a -> RenderedCode+renderTypeWithRole = \case+ [] -> renderType+ roleList -> renderTypeInternal (addRole roleList [] . Left)+ where+ -- `data Foo first second = Foo` will produce+ -- ```+ -- PPTypeApp+ -- (PPTypeApp (PPTypeConstructor fooName) (PPTypeVar "first" Nothing))+ -- (PPTypeVar "second" Nothing)+ -- ```+ -- So, we recurse down the left side of `TypeApp` first before+ -- recursing down the right side. To make this stack-safe,+ -- we use a tail-recursive function with its own stack.+ -- - Left = values that have not yet been examined and need+ -- a role added to them (if any). There's still work "left" to do.+ -- - Right = values that have been examined and now need to be+ -- reassembled into their original value+ addRole+ :: [Role]+ -> [Either PrettyPrintType PrettyPrintType]+ -> Either PrettyPrintType PrettyPrintType+ -> PrettyPrintType+ addRole roles stack pp = case pp of+ Left next -> case next of+ PPTypeVar t Nothing+ | Just (x, xs) <- uncons roles ->+ addRole xs stack (Right $ PPTypeVar t (Just $ displayRole x))+ | otherwise ->+ internalError "addRole: invalid arguments - number of roles doesn't match number of type parameters"++ PPTypeVar _ (Just _) ->+ internalError "addRole: attempted to add a second role to a type parameter that already has one"++ PPTypeApp leftSide rightSide -> do+ -- push right-side to stack and continue recursing on left-side+ addRole roles (Left rightSide : stack) (Left leftSide)++ other ->+ -- nothing to check, so move on+ addRole roles stack (Right other)+++ pendingAssembly@(Right rightSideOrFinalValue) -> case stack of+ (unfinishedRightSide@(Left _) : remaining) ->+ -- We've finished recursing through the left-side of a `TypeApp`.+ -- Now we'll recurse through the right-side.+ -- We push `pendingAssembly` onto the stack so we can assemble+ -- the `PPTypeApp` together once it's right-side is done.+ addRole roles (pendingAssembly : remaining) unfinishedRightSide++ (Right leftSide : remaining) ->+ -- We've finished recursing through the right-side of a `TypeApp`+ -- We'll rebulid it and wrap it in `Right` so any other higher-level+ -- `TypeApp`s can be reassembled now, too.+ addRole roles remaining (Right (PPTypeApp leftSide rightSideOrFinalValue))++ [] ->+ -- We've reassembled everything. It's time to return.+ rightSideOrFinalValue++renderType' :: PrettyPrintType -> RenderedCode+renderType'+ = fromMaybe (internalError "Incomplete pattern")+ . PA.pattern matchType ()++renderTypeVars :: [(TypeVarVisibility, Text, Maybe PrettyPrintType)] -> RenderedCode+renderTypeVars tyVars = mintersperse sp (map renderTypeVar tyVars)++renderTypeVar :: (TypeVarVisibility, Text, Maybe PrettyPrintType) -> RenderedCode+renderTypeVar (vis, v, mbK) = case mbK of+ Nothing -> syntax (typeVarVisibilityPrefix vis) <> typeVar v+ Just k -> mintersperse sp [ mconcat [syntax "(", syntax $ typeVarVisibilityPrefix vis, typeVar v], syntax "::", mconcat [renderType' k, syntax ")"] ]++-- |+-- Render code representing a Type, as it should appear inside parentheses+--+renderTypeAtom :: Type a -> RenderedCode+renderTypeAtom = renderTypeAtom' . convertPrettyPrintType maxBound++renderTypeAtom' :: PrettyPrintType -> RenderedCode+renderTypeAtom'+ = fromMaybe (internalError "Incomplete pattern")+ . PA.pattern matchTypeAtom ()
+ src/Language/PureScript/Docs/RenderedCode/Types.hs view
@@ -0,0 +1,315 @@+-- | Data types and functions for representing a simplified form of PureScript+-- code, intended for use in e.g. HTML documentation.++module Language.PureScript.Docs.RenderedCode.Types+ ( RenderedCodeElement(..)+ , ContainingModule(..)+ , asContainingModule+ , maybeToContainingModule+ , fromQualified+ , Namespace(..)+ , Link(..)+ , FixityAlias+ , RenderedCode+ , outputWith+ , sp+ , syntax+ , keyword+ , keywordForall+ , keywordData+ , keywordType+ , keywordClass+ , keywordWhere+ , keywordFixity+ , keywordAs+ , ident+ , dataCtor+ , typeCtor+ , typeOp+ , typeVar+ , roleAnn+ , alias+ , aliasName+ ) where++import Prelude+import GHC.Generics (Generic)++import Control.DeepSeq (NFData)+import Control.Monad.Error.Class (MonadError(..))++import Data.Aeson.BetterErrors (Parse, nth, withText, withValue, toAesonParser, perhaps, asText)+import Data.Aeson qualified as A+import Data.Text (Text)+import Data.Text qualified as T+import Data.ByteString.Lazy qualified as BS+import Data.Text.Encoding qualified as TE++import Language.PureScript.Names (pattern ByNullSourcePos, Ident(..), ModuleName, OpName(..), OpNameType(..), ProperName(..), ProperNameType(..), Qualified(..), QualifiedBy(..), moduleNameFromString, runIdent, runModuleName)+import Language.PureScript.AST (Associativity(..))++-- | Given a list of actions, attempt them all, returning the first success.+-- If all the actions fail, 'tryAll' returns the first argument.+tryAll :: MonadError e m => m a -> [m a] -> m a+tryAll = foldr $ \x y -> catchError x (const y)++firstEq :: Text -> Parse Text a -> Parse Text a+firstEq str p = nth 0 (withText (eq str)) *> p+ where+ eq s s' = if s == s' then Right () else Left ""++-- |+-- Try the given parsers in sequence. If all fail, fail with the given message,+-- and include the JSON in the error.+--+tryParse :: Text -> [Parse Text a] -> Parse Text a+tryParse msg =+ tryAll (withValue (Left . (fullMsg <>) . showJSON))++ where+ fullMsg = "Invalid " <> msg <> ": "++ showJSON :: A.Value -> Text+ showJSON = TE.decodeUtf8 . BS.toStrict . A.encode++-- |+-- This type is isomorphic to 'Maybe' 'ModuleName'. It makes code a bit+-- easier to read, as the meaning is more explicit.+--+data ContainingModule+ = ThisModule+ | OtherModule ModuleName+ deriving (Show, Eq, Ord)++instance A.ToJSON ContainingModule where+ toJSON = A.toJSON . go+ where+ go = \case+ ThisModule -> ["ThisModule"]+ OtherModule mn -> ["OtherModule", runModuleName mn]++instance A.FromJSON ContainingModule where+ parseJSON = toAesonParser id asContainingModule++asContainingModule :: Parse Text ContainingModule+asContainingModule =+ tryParse "containing module" $+ current ++ backwardsCompat+ where+ current =+ [ firstEq "ThisModule" (pure ThisModule)+ , firstEq "OtherModule" (OtherModule <$> nth 1 asModuleName)+ ]++ -- For JSON produced by compilers up to 0.10.5.+ backwardsCompat =+ [ maybeToContainingModule <$> perhaps asModuleName+ ]++ asModuleName = moduleNameFromString <$> asText++-- |+-- Convert a 'Maybe' 'ModuleName' to a 'ContainingModule', using the obvious+-- isomorphism.+--+maybeToContainingModule :: Maybe ModuleName -> ContainingModule+maybeToContainingModule Nothing = ThisModule+maybeToContainingModule (Just mn) = OtherModule mn++fromQualified :: Qualified a -> (ContainingModule, a)+fromQualified (Qualified (ByModuleName mn) x) = (OtherModule mn, x)+fromQualified (Qualified _ x) = (ThisModule, x)++data Link+ = NoLink+ | Link ContainingModule+ deriving (Show, Eq, Ord)++instance A.ToJSON Link where+ toJSON = \case+ NoLink -> A.toJSON ["NoLink" :: Text]+ Link mn -> A.toJSON ["Link", A.toJSON mn]++asLink :: Parse Text Link+asLink =+ tryParse "link"+ [ firstEq "NoLink" (pure NoLink)+ , firstEq "Link" (Link <$> nth 1 asContainingModule)+ ]++instance A.FromJSON Link where+ parseJSON = toAesonParser id asLink++data Namespace+ = ValueLevel+ | TypeLevel+ deriving (Show, Eq, Ord, Generic)++instance NFData Namespace++instance A.ToJSON Namespace where+ toJSON = A.toJSON . show++asNamespace :: Parse Text Namespace+asNamespace =+ tryParse "namespace"+ [ withText $ \case+ "ValueLevel" -> Right ValueLevel+ "TypeLevel" -> Right TypeLevel+ _ -> Left ""+ ]++instance A.FromJSON Namespace where+ parseJSON = toAesonParser id asNamespace++-- |+-- A single element in a rendered code fragment. The intention is to support+-- multiple output formats. For example, plain text, or highlighted HTML.+--+data RenderedCodeElement+ = Syntax Text+ | Keyword Text+ | Space+ -- | Any symbol which you might or might not want to link to, in any+ -- namespace (value, type, or kind). Note that this is not related to the+ -- kind called Symbol for type-level strings.+ | Symbol Namespace Text Link+ | Role Text+ deriving (Show, Eq, Ord)++instance A.ToJSON RenderedCodeElement where+ toJSON (Syntax str) =+ A.toJSON ["syntax", str]+ toJSON (Keyword str) =+ A.toJSON ["keyword", str]+ toJSON Space =+ A.toJSON ["space" :: Text]+ toJSON (Symbol ns str link) =+ A.toJSON ["symbol", A.toJSON ns, A.toJSON str, A.toJSON link]+ toJSON (Role role) =+ A.toJSON ["role", role]++-- |+-- A type representing a highly simplified version of PureScript code, intended+-- for use in output formats like plain text or HTML.+--+newtype RenderedCode+ = RC { unRC :: [RenderedCodeElement] }+ deriving (Show, Eq, Ord, Semigroup, Monoid)++instance A.ToJSON RenderedCode where+ toJSON (RC elems) = A.toJSON elems++-- |+-- This function allows conversion of a 'RenderedCode' value into a value of+-- some other type (for example, plain text, or HTML). The first argument+-- is a function specifying how each individual 'RenderedCodeElement' should be+-- rendered.+--+outputWith :: Monoid a => (RenderedCodeElement -> a) -> RenderedCode -> a+outputWith f = foldMap f . unRC++-- |+-- A 'RenderedCode' fragment representing a space.+--+sp :: RenderedCode+sp = RC [Space]++-- possible TODO: instead of this function, export RenderedCode values for+-- each syntax element, eg syntaxArr (== syntax "->"), syntaxLBrace,+-- syntaxRBrace, etc.+syntax :: Text -> RenderedCode+syntax x = RC [Syntax x]++keyword :: Text -> RenderedCode+keyword kw = RC [Keyword kw]++keywordForall :: RenderedCode+keywordForall = keyword "forall"++keywordData :: RenderedCode+keywordData = keyword "data"++keywordType :: RenderedCode+keywordType = keyword "type"++keywordClass :: RenderedCode+keywordClass = keyword "class"++keywordWhere :: RenderedCode+keywordWhere = keyword "where"++keywordFixity :: Associativity -> RenderedCode+keywordFixity Infixl = keyword "infixl"+keywordFixity Infixr = keyword "infixr"+keywordFixity Infix = keyword "infix"++keywordAs :: RenderedCode+keywordAs = keyword "as"++ident :: Qualified Ident -> RenderedCode+ident (fromQualified -> (mn, name)) =+ RC [Symbol ValueLevel (runIdent name) (Link mn)]++dataCtor :: Qualified (ProperName 'ConstructorName) -> RenderedCode+dataCtor (fromQualified -> (mn, name)) =+ RC [Symbol ValueLevel (runProperName name) (Link mn)]++typeCtor :: Qualified (ProperName 'TypeName) -> RenderedCode+typeCtor (fromQualified -> (mn, name)) =+ RC [Symbol TypeLevel (runProperName name) (Link mn)]++typeOp :: Qualified (OpName 'TypeOpName) -> RenderedCode+typeOp (fromQualified -> (mn, name)) =+ RC [Symbol TypeLevel (runOpName name) (Link mn)]++typeVar :: Text -> RenderedCode+typeVar x = RC [Symbol TypeLevel x NoLink]++roleAnn :: Maybe Text -> RenderedCode+roleAnn = RC . maybe [] renderRole+ where+ renderRole = \case+ "nominal" -> [Role "nominal"]+ "phantom" -> [Role "phantom"]+ _ -> []++type FixityAlias = Qualified (Either (ProperName 'TypeName) (Either Ident (ProperName 'ConstructorName)))++alias :: FixityAlias -> RenderedCode+alias for =+ prefix <> RC [Symbol ns name (Link mn)]+ where+ (ns, name, mn) = unpackFixityAlias for+ prefix = case ns of+ TypeLevel ->+ keywordType <> sp+ _ ->+ mempty++aliasName :: FixityAlias -> Text -> RenderedCode+aliasName for name' =+ let+ (ns, _, _) = unpackFixityAlias for+ unParen = T.tail . T.init+ name = unParen name'+ in+ case ns of+ ValueLevel ->+ ident (Qualified ByNullSourcePos (Ident name))+ TypeLevel ->+ typeCtor (Qualified ByNullSourcePos (ProperName name))++-- | Converts a FixityAlias into a different representation which is more+-- useful to other functions in this module.+unpackFixityAlias :: FixityAlias -> (Namespace, Text, ContainingModule)+unpackFixityAlias (fromQualified -> (mn, x)) =+ case x of+ -- We add some seemingly superfluous type signatures here just to be extra+ -- sure we are not mixing up our namespaces.+ Left (n :: ProperName 'TypeName) ->+ (TypeLevel, runProperName n, mn)+ Right (Left n) ->+ (ValueLevel, runIdent n, mn)+ Right (Right (n :: ProperName 'ConstructorName)) ->+ (ValueLevel, runProperName n, mn)
+ src/Language/PureScript/Docs/Tags.hs view
@@ -0,0 +1,53 @@+module Language.PureScript.Docs.Tags+ ( tags+ , dumpCtags+ , dumpEtags+ ) where++import Prelude++import Control.Arrow (first)+import Data.List (sort)+import Data.Maybe (mapMaybe)+import Data.Text qualified as T+import Language.PureScript.AST (SourceSpan, sourcePosLine, spanStart)+import Language.PureScript.Docs.Types (ChildDeclaration(..), Declaration(..), Module(..))++tags :: Module -> [(String, Int)]+tags = map (first T.unpack) . concatMap dtags . modDeclarations+ where+ dtags :: Declaration -> [(T.Text, Int)]+ dtags decl = case declSourceSpan decl of+ Just ss -> (declTitle decl, pos ss):mapMaybe subtag (declChildren decl)+ Nothing -> mapMaybe subtag $ declChildren decl++ subtag :: ChildDeclaration -> Maybe (T.Text, Int)+ subtag cdecl = case cdeclSourceSpan cdecl of+ Just ss -> Just (cdeclTitle cdecl, pos ss)+ Nothing -> Nothing++ pos :: SourceSpan -> Int+ pos = sourcePosLine . spanStart++-- etags files appear to be sorted on module file name:+-- from emacs source, `emacs/lib-src/etags.c`:+-- "In etags mode, sort by file name."+dumpEtags :: [(String, Module)] -> [String]+dumpEtags = concatMap renderModEtags . sort++renderModEtags :: (String, Module) -> [String]+renderModEtags (path, mdl) = ["\x0c", path ++ "," ++ show tagsLen] ++ tagLines+ where tagsLen = sum $ map length tagLines+ tagLines = map tagLine $ tags mdl+ tagLine (name, line) = "\x7f" ++ name ++ "\x01" ++ show line ++ ","++-- ctags files are required to be sorted: http://ctags.sourceforge.net/FORMAT+-- "The tags file is sorted on {tagname}. This allows for a binary search in+-- the file."+dumpCtags :: [(String, Module)] -> [String]+dumpCtags = sort . concatMap renderModCtags++renderModCtags :: (String, Module) -> [String]+renderModCtags (path, mdl) = sort tagLines+ where tagLines = map tagLine $ tags mdl+ tagLine (name, line) = name ++ "\t" ++ path ++ "\t" ++ show line
+ src/Language/PureScript/Docs/Types.hs view
@@ -0,0 +1,882 @@+module Language.PureScript.Docs.Types+ ( module Language.PureScript.Docs.Types+ , module ReExports+ )+ where++import Protolude hiding (to, from, unlines)+import Prelude (String, unlines, lookup)++import Control.Arrow ((***))++import Data.Aeson ((.=))+import Data.Aeson.Key qualified as A.Key+import Data.Aeson.BetterErrors+ (Parse, keyOrDefault, throwCustomError, key, asText,+ keyMay, withString, eachInArray, asNull, (.!), toAesonParser, toAesonParser',+ fromAesonParser, perhaps, withText, asIntegral, nth, eachInObjectWithKey,+ asString)+import Data.Map qualified as Map+import Data.Time.Clock (UTCTime)+import Data.Time.Format qualified as TimeFormat+import Data.Version (Version(..), showVersion)+import Data.Aeson qualified as A+import Data.Text qualified as T+import Data.Vector qualified as V++import Language.PureScript.AST qualified as P+import Language.PureScript.CoreFn.FromJSON qualified as P+import Language.PureScript.Crash qualified as P+import Language.PureScript.Environment qualified as P+import Language.PureScript.Names qualified as P+import Language.PureScript.Roles qualified as P+import Language.PureScript.Types qualified as P+import Paths_purescript qualified as Paths++import Web.Bower.PackageMeta (BowerError, PackageMeta(..), PackageName, asPackageMeta, parsePackageName, runPackageName, showBowerError)++import Language.PureScript.Docs.RenderedCode as ReExports+ (RenderedCode,+ ContainingModule(..), asContainingModule,+ RenderedCodeElement(..),+ Namespace(..), FixityAlias)+import Language.PureScript.Publish.Registry.Compat (PursJsonError, showPursJsonError)++type Type' = P.Type ()+type Constraint' = P.Constraint ()++--------------------+-- Types++data Package a = Package+ { pkgMeta :: PackageMeta+ , pkgVersion :: Version+ , pkgVersionTag :: Text+ -- TODO: When this field was introduced, it was given the Maybe type for the+ -- sake of backwards compatibility, as older JSON blobs will not include the+ -- field. It should eventually be changed to just UTCTime.+ , pkgTagTime :: Maybe UTCTime+ , pkgModules :: [Module]+ , pkgModuleMap :: Map P.ModuleName PackageName+ , pkgResolvedDependencies :: [(PackageName, Version)]+ , pkgGithub :: (GithubUser, GithubRepo)+ , pkgUploader :: a+ , pkgCompilerVersion :: Version+ -- ^ The version of the PureScript compiler which was used to generate+ -- this data. We store this in order to reject packages which are too old.+ }+ deriving (Show, Eq, Ord, Generic)++instance NFData a => NFData (Package a)++data NotYetKnown = NotYetKnown+ deriving (Show, Eq, Ord, Generic)++instance NFData NotYetKnown++type UploadedPackage = Package NotYetKnown+type VerifiedPackage = Package GithubUser++data ManifestError+ = BowerManifest BowerError+ | PursManifest PursJsonError+ deriving (Show, Eq, Ord, Generic)++instance NFData ManifestError++showManifestError :: ManifestError -> Text+showManifestError = \case+ BowerManifest err -> showBowerError err+ PursManifest err -> showPursJsonError err++verifyPackage :: GithubUser -> UploadedPackage -> VerifiedPackage+verifyPackage verifiedUser Package{..} =+ Package pkgMeta+ pkgVersion+ pkgVersionTag+ pkgTagTime+ pkgModules+ pkgModuleMap+ pkgResolvedDependencies+ pkgGithub+ verifiedUser+ pkgCompilerVersion++packageName :: Package a -> PackageName+packageName = bowerName . pkgMeta++-- |+-- The time format used for serializing package tag times in the JSON format.+-- This is the ISO 8601 date format which includes a time and a timezone.+--+jsonTimeFormat :: String+jsonTimeFormat = "%Y-%m-%dT%H:%M:%S%z"++-- |+-- Convenience function for formatting a time in the format expected by this+-- module.+--+formatTime :: UTCTime -> String+formatTime =+ TimeFormat.formatTime TimeFormat.defaultTimeLocale jsonTimeFormat++-- |+-- Convenience function for parsing a time in the format expected by this+-- module.+--+parseTime :: String -> Maybe UTCTime+parseTime =+ TimeFormat.parseTimeM False TimeFormat.defaultTimeLocale jsonTimeFormat++data Module = Module+ { modName :: P.ModuleName+ , modComments :: Maybe Text+ , modDeclarations :: [Declaration]+ -- Re-exported values from other modules+ , modReExports :: [(InPackage P.ModuleName, [Declaration])]+ }+ deriving (Show, Eq, Ord, Generic)++instance NFData Module++data Declaration = Declaration+ { declTitle :: Text+ , declComments :: Maybe Text+ , declSourceSpan :: Maybe P.SourceSpan+ , declChildren :: [ChildDeclaration]+ , declInfo :: DeclarationInfo+ , declKind :: Maybe KindInfo+ }+ deriving (Show, Eq, Ord, Generic)++instance NFData Declaration++-- |+-- A value of this type contains information that is specific to a particular+-- kind of declaration (as opposed to information which exists in all kinds of+-- declarations, which goes into the 'Declaration' type directly).+--+-- Many of the constructors are very similar to their equivalents in the real+-- PureScript AST, except that they have their name elided, since this is+-- already available via the rdTitle field of 'Declaration'.+--+data DeclarationInfo+ -- |+ -- A value declaration, with its type.+ --+ = ValueDeclaration Type'++ -- |+ -- A data/newtype declaration, with the kind of declaration (data or+ -- newtype) and its type arguments. Constructors are represented as child+ -- declarations.+ --+ | DataDeclaration P.DataDeclType [(Text, Maybe Type')] [P.Role]++ -- |+ -- A data type foreign import, with its kind.+ --+ | ExternDataDeclaration Type' [P.Role]++ -- |+ -- A type synonym, with its type arguments and its type.+ --+ | TypeSynonymDeclaration [(Text, Maybe Type')] Type'++ -- |+ -- A type class, with its type arguments, its superclasses and functional+ -- dependencies. Instances and members are represented as child declarations.+ --+ | TypeClassDeclaration [(Text, Maybe Type')] [Constraint'] [([Text], [Text])]++ -- |+ -- An operator alias declaration, with the member the alias is for and the+ -- operator's fixity.+ --+ | AliasDeclaration P.Fixity FixityAlias+ deriving (Show, Eq, Ord, Generic)++instance NFData DeclarationInfo++-- |+-- Wraps enough information to properly render the kind signature+-- of a data/newtype/type/class declaration.+data KindInfo = KindInfo+ { kiKeyword :: P.KindSignatureFor+ , kiKind :: Type'+ }+ deriving (Show, Eq, Ord, Generic)++instance NFData KindInfo++convertFundepsToStrings :: [(Text, Maybe Type')] -> [P.FunctionalDependency] -> [([Text], [Text])]+convertFundepsToStrings args fundeps =+ map (\(P.FunctionalDependency from to) -> toArgs from to) fundeps+ where+ argsVec = V.fromList (map fst args)+ getArg i =+ fromMaybe+ (P.internalError $ unlines+ [ "convertDeclaration: Functional dependency index"+ , show i+ , "is bigger than arguments list"+ , show (map fst args)+ , "Functional dependencies are"+ , show fundeps+ ]+ ) $ argsVec V.!? i+ toArgs from to = (map getArg from, map getArg to)++declInfoToString :: DeclarationInfo -> Text+declInfoToString (ValueDeclaration _) = "value"+declInfoToString (DataDeclaration _ _ _) = "data"+declInfoToString (ExternDataDeclaration _ _) = "externData"+declInfoToString (TypeSynonymDeclaration _ _) = "typeSynonym"+declInfoToString (TypeClassDeclaration _ _ _) = "typeClass"+declInfoToString (AliasDeclaration _ _) = "alias"++declInfoNamespace :: DeclarationInfo -> Namespace+declInfoNamespace = \case+ ValueDeclaration{} ->+ ValueLevel+ DataDeclaration{} ->+ TypeLevel+ ExternDataDeclaration{} ->+ TypeLevel+ TypeSynonymDeclaration{} ->+ TypeLevel+ TypeClassDeclaration{} ->+ TypeLevel+ AliasDeclaration _ alias ->+ either (const TypeLevel) (const ValueLevel) (P.disqualify alias)++isTypeClass :: Declaration -> Bool+isTypeClass Declaration{..} =+ case declInfo of+ TypeClassDeclaration{} -> True+ _ -> False++isValue :: Declaration -> Bool+isValue Declaration{..} =+ case declInfo of+ ValueDeclaration{} -> True+ _ -> False++isType :: Declaration -> Bool+isType Declaration{..} =+ case declInfo of+ TypeSynonymDeclaration{} -> True+ DataDeclaration{} -> True+ ExternDataDeclaration{} -> True+ _ -> False++isValueAlias :: Declaration -> Bool+isValueAlias Declaration{..} =+ case declInfo of+ AliasDeclaration _ (P.Qualified _ d) -> isRight d+ _ -> False++isTypeAlias :: Declaration -> Bool+isTypeAlias Declaration{..} =+ case declInfo of+ AliasDeclaration _ (P.Qualified _ d) -> isLeft d+ _ -> False++-- | Discard any children which do not satisfy the given predicate.+filterChildren :: (ChildDeclaration -> Bool) -> Declaration -> Declaration+filterChildren p decl =+ decl { declChildren = filter p (declChildren decl) }++data ChildDeclaration = ChildDeclaration+ { cdeclTitle :: Text+ , cdeclComments :: Maybe Text+ , cdeclSourceSpan :: Maybe P.SourceSpan+ , cdeclInfo :: ChildDeclarationInfo+ }+ deriving (Show, Eq, Ord, Generic)++instance NFData ChildDeclaration++data ChildDeclarationInfo+ -- |+ -- A type instance declaration, with its dependencies and its type.+ --+ = ChildInstance [Constraint'] Type'++ -- |+ -- A data constructor, with its type arguments.+ --+ | ChildDataConstructor [Type']++ -- |+ -- A type class member, with its type. Note that the type does not include+ -- the type class constraint; this may be added manually if desired. For+ -- example, `pure` from `Applicative` would be `forall a. a -> f a`.+ --+ | ChildTypeClassMember Type'+ deriving (Show, Eq, Ord, Generic)++instance NFData ChildDeclarationInfo++childDeclInfoToString :: ChildDeclarationInfo -> Text+childDeclInfoToString (ChildInstance _ _) = "instance"+childDeclInfoToString (ChildDataConstructor _) = "dataConstructor"+childDeclInfoToString (ChildTypeClassMember _) = "typeClassMember"++childDeclInfoNamespace :: ChildDeclarationInfo -> Namespace+childDeclInfoNamespace =+ -- We could just write this as `const ValueLevel` but by doing it this way,+ -- if another constructor is added, we get a warning which acts as a prompt+ -- to update this, instead of having this function (possibly incorrectly)+ -- just return ValueLevel for the new constructor.+ \case+ ChildInstance{} ->+ ValueLevel+ ChildDataConstructor{} ->+ ValueLevel+ ChildTypeClassMember{} ->+ ValueLevel++isTypeClassMember :: ChildDeclaration -> Bool+isTypeClassMember ChildDeclaration{..} =+ case cdeclInfo of+ ChildTypeClassMember{} -> True+ _ -> False++isDataConstructor :: ChildDeclaration -> Bool+isDataConstructor ChildDeclaration{..} =+ case cdeclInfo of+ ChildDataConstructor{} -> True+ _ -> False++newtype GithubUser+ = GithubUser { runGithubUser :: Text }+ deriving (Show, Eq, Ord, Generic)++instance NFData GithubUser++newtype GithubRepo+ = GithubRepo { runGithubRepo :: Text }+ deriving (Show, Eq, Ord, Generic)++instance NFData GithubRepo++data PackageError+ = CompilerTooOld Version Version+ -- ^ Minimum allowable version for generating data with the current+ -- parser, and actual version used.+ | ErrorInPackageMeta ManifestError+ | InvalidVersion+ | InvalidDeclarationType Text+ | InvalidChildDeclarationType Text+ | InvalidFixity+ | InvalidKind Text+ | InvalidDataDeclType Text+ | InvalidKindSignatureFor Text+ | InvalidTime+ | InvalidRole Text+ deriving (Show, Eq, Ord, Generic)++instance NFData PackageError++data InPackage a+ = Local a+ | FromDep PackageName a+ deriving (Show, Eq, Ord, Generic)++instance NFData a => NFData (InPackage a)++instance Functor InPackage where+ fmap f (Local x) = Local (f x)+ fmap f (FromDep pkgName x) = FromDep pkgName (f x)++ignorePackage :: InPackage a -> a+ignorePackage (Local x) = x+ignorePackage (FromDep _ x) = x++----------------------------------------------------+-- Types for links between declarations++data LinksContext = LinksContext+ { ctxGithub :: (GithubUser, GithubRepo)+ , ctxModuleMap :: Map P.ModuleName PackageName+ , ctxResolvedDependencies :: [(PackageName, Version)]+ , ctxPackageName :: PackageName+ , ctxVersion :: Version+ , ctxVersionTag :: Text+ }+ deriving (Show, Eq, Ord, Generic)++instance NFData LinksContext++data DocLink = DocLink+ { linkLocation :: LinkLocation+ , linkTitle :: Text+ , linkNamespace :: Namespace+ }+ deriving (Show, Eq, Ord, Generic)++instance NFData DocLink++data LinkLocation+ -- | A link to a declaration in the current package.+ = LocalModule P.ModuleName++ -- | A link to a declaration in a different package. The arguments represent+ -- the name of the other package, the version of the other package, and the+ -- name of the module in the other package that the declaration is in.+ | DepsModule PackageName Version P.ModuleName++ -- | A link to a declaration that is built in to the compiler, e.g. the Prim+ -- module. In this case we only need to store the module that the builtin+ -- comes from. Note that all builtin modules begin with "Prim", and that the+ -- compiler rejects attempts to define modules whose names start with "Prim".+ | BuiltinModule P.ModuleName+ deriving (Show, Eq, Ord, Generic)++instance NFData LinkLocation++-- | Given a links context, the current module name, the namespace of a thing+-- to link to, its title, and its containing module, attempt to create a+-- DocLink.+getLink :: LinksContext -> P.ModuleName -> Namespace -> Text -> ContainingModule -> Maybe DocLink+getLink LinksContext{..} curMn namespace target containingMod = do+ location <- getLinkLocation+ return DocLink+ { linkLocation = location+ , linkTitle = target+ , linkNamespace = namespace+ }++ where+ getLinkLocation = builtinLinkLocation <|> normalLinkLocation++ normalLinkLocation = do+ case containingMod of+ ThisModule ->+ return $ LocalModule curMn+ OtherModule destMn ->+ case Map.lookup destMn ctxModuleMap of+ Nothing ->+ return $ LocalModule destMn+ Just pkgName -> do+ pkgVersion <- lookup pkgName ctxResolvedDependencies+ return $ DepsModule pkgName pkgVersion destMn++ builtinLinkLocation =+ case containingMod of+ OtherModule mn | P.isBuiltinModuleName mn ->+ pure $ BuiltinModule mn+ _ ->+ empty++getLinksContext :: Package a -> LinksContext+getLinksContext Package{..} =+ LinksContext+ { ctxGithub = pkgGithub+ , ctxModuleMap = pkgModuleMap+ , ctxResolvedDependencies = pkgResolvedDependencies+ , ctxPackageName = bowerName pkgMeta+ , ctxVersion = pkgVersion+ , ctxVersionTag = pkgVersionTag+ }++----------------------+-- Parsing++asPackage :: Version -> (forall e. Parse e a) -> Parse PackageError (Package a)+asPackage minimumVersion uploader = do+ -- If the compilerVersion key is missing, we can be sure that it was produced+ -- with 0.7.0.0, since that is the only released version that included the+ -- `psc-publish` tool (now `purs publish`) before this key was added.+ compilerVersion <- keyOrDefault "compilerVersion" (Version [0,7,0,0] []) asVersion+ when (compilerVersion < minimumVersion)+ (throwCustomError $ CompilerTooOld minimumVersion compilerVersion)++ Package <$> key "packageMeta" asPackageMeta .! (ErrorInPackageMeta . BowerManifest)+ <*> key "version" asVersion+ <*> key "versionTag" asText+ <*> keyMay "tagTime" (withString parseTimeEither)+ <*> key "modules" (eachInArray asModule)+ <*> moduleMap+ <*> key "resolvedDependencies" asResolvedDependencies+ <*> key "github" asGithub+ <*> key "uploader" uploader+ <*> pure compilerVersion+ where+ moduleMap =+ key "moduleMap" asModuleMap+ `pOr` (key "bookmarks" bookmarksAsModuleMap .! ErrorInPackageMeta)++parseTimeEither :: String -> Either PackageError UTCTime+parseTimeEither =+ maybe (Left InvalidTime) Right . parseTime++asUploadedPackage :: Version -> Parse PackageError UploadedPackage+asUploadedPackage minVersion = asPackage minVersion asNotYetKnown++asNotYetKnown :: Parse e NotYetKnown+asNotYetKnown = NotYetKnown <$ asNull++instance A.FromJSON NotYetKnown where+ parseJSON = toAesonParser' asNotYetKnown++displayPackageError :: PackageError -> Text+displayPackageError e = case e of+ CompilerTooOld minV usedV ->+ "Expecting data produced by at least version " <> T.pack (showVersion minV)+ <> " of the compiler, but it appears that " <> T.pack (showVersion usedV)+ <> " was used."+ ErrorInPackageMeta err ->+ "Error in package metadata: " <> showManifestError err+ InvalidVersion ->+ "Invalid version"+ InvalidDeclarationType str ->+ "Invalid declaration type: \"" <> str <> "\""+ InvalidChildDeclarationType str ->+ "Invalid child declaration type: \"" <> str <> "\""+ InvalidFixity ->+ "Invalid fixity"+ InvalidKind str ->+ "Invalid kind: \"" <> str <> "\""+ InvalidDataDeclType str ->+ "Invalid data declaration type: \"" <> str <> "\""+ InvalidKindSignatureFor str ->+ "Invalid kind signature keyword: \"" <> str <> "\""+ InvalidTime ->+ "Invalid time"+ InvalidRole str ->+ "Invalid role keyword: \"" <> str <> "\""++instance A.FromJSON a => A.FromJSON (Package a) where+ parseJSON = toAesonParser displayPackageError+ (asPackage (Version [0,0,0,0] []) fromAesonParser)++asGithubUser :: Parse e GithubUser+asGithubUser = GithubUser <$> asText++instance A.FromJSON GithubUser where+ parseJSON = toAesonParser' asGithubUser++asVersion :: Parse PackageError Version+asVersion = withString (maybe (Left InvalidVersion) Right . P.parseVersion')++asModule :: Parse PackageError Module+asModule =+ Module <$> key "name" (P.moduleNameFromString <$> asText)+ <*> key "comments" (perhaps asText)+ <*> key "declarations" (eachInArray asDeclaration)+ <*> key "reExports" (eachInArray asReExport)++asDeclaration :: Parse PackageError Declaration+asDeclaration =+ Declaration <$> key "title" asText+ <*> key "comments" (perhaps asText)+ <*> key "sourceSpan" (perhaps asSourceSpan)+ <*> key "children" (eachInArray asChildDeclaration)+ <*> key "info" asDeclarationInfo+ <*> keyOrDefault "kind" Nothing (perhaps asKindInfo)++asReExport :: Parse PackageError (InPackage P.ModuleName, [Declaration])+asReExport =+ (,) <$> key "moduleName" asReExportModuleName+ <*> key "declarations" (eachInArray asDeclaration)+ where+ -- This is to preserve backwards compatibility with 0.10.3 and earlier versions+ -- of the compiler, where the modReExports field had the type+ -- [(P.ModuleName, [Declaration])]. This should eventually be removed,+ -- possibly at the same time as the next breaking change to this JSON format.+ asReExportModuleName :: Parse PackageError (InPackage P.ModuleName)+ asReExportModuleName =+ asInPackage fromAesonParser .! ErrorInPackageMeta+ `pOr` fmap Local fromAesonParser++pOr :: Parse e a -> Parse e a -> Parse e a+p `pOr` q = catchError p (const q)++asInPackage :: Parse ManifestError a -> Parse ManifestError (InPackage a)+asInPackage inner =+ build <$> key "package" (perhaps (withText (mapLeft BowerManifest . parsePackageName)))+ <*> key "item" inner+ where+ build Nothing = Local+ build (Just pn) = FromDep pn++asFixity :: Parse PackageError P.Fixity+asFixity =+ P.Fixity <$> key "associativity" asAssociativity+ <*> key "precedence" asIntegral++asFixityAlias :: Parse PackageError FixityAlias+asFixityAlias = fromAesonParser++parseAssociativity :: String -> Maybe P.Associativity+parseAssociativity str = case str of+ "infix" -> Just P.Infix+ "infixl" -> Just P.Infixl+ "infixr" -> Just P.Infixr+ _ -> Nothing++asAssociativity :: Parse PackageError P.Associativity+asAssociativity = withString (maybe (Left InvalidFixity) Right . parseAssociativity)++asDeclarationInfo :: Parse PackageError DeclarationInfo+asDeclarationInfo = do+ ty <- key "declType" asText+ case ty of+ "value" ->+ ValueDeclaration <$> key "type" asType+ "data" ->+ DataDeclaration <$> key "dataDeclType" asDataDeclType+ <*> key "typeArguments" asTypeArguments+ <*> keyOrDefault "roles" [] (eachInArray asRole)+ "externData" ->+ ExternDataDeclaration <$> key "kind" asType+ <*> keyOrDefault "roles" [] (eachInArray asRole)+ "typeSynonym" ->+ TypeSynonymDeclaration <$> key "arguments" asTypeArguments+ <*> key "type" asType+ "typeClass" ->+ TypeClassDeclaration <$> key "arguments" asTypeArguments+ <*> key "superclasses" (eachInArray asConstraint)+ <*> keyOrDefault "fundeps" [] asFunDeps+ "alias" ->+ AliasDeclaration <$> key "fixity" asFixity+ <*> key "alias" asFixityAlias+ -- Backwards compat: kinds are extern data+ "kind" ->+ pure $ ExternDataDeclaration (P.kindType $> ()) []+ other ->+ throwCustomError (InvalidDeclarationType other)++asKindInfo :: Parse PackageError KindInfo+asKindInfo =+ KindInfo <$> key "keyword" asKindSignatureFor+ <*> key "kind" asType++asKindSignatureFor :: Parse PackageError P.KindSignatureFor+asKindSignatureFor =+ withText $ \case+ "data" -> Right P.DataSig+ "newtype" -> Right P.NewtypeSig+ "class" -> Right P.ClassSig+ "type" -> Right P.TypeSynonymSig+ x -> Left (InvalidKindSignatureFor x)++asTypeArguments :: Parse PackageError [(Text, Maybe Type')]+asTypeArguments = eachInArray asTypeArgument+ where+ asTypeArgument = (,) <$> nth 0 asText <*> nth 1 (perhaps asType)++asRole :: Parse PackageError P.Role+asRole =+ withText $ \case+ "Representational" -> Right P.Representational+ "Nominal" -> Right P.Nominal+ "Phantom" -> Right P.Phantom+ other -> Left (InvalidRole other)++asType :: Parse e Type'+asType = fromAesonParser++asFunDeps :: Parse PackageError [([Text], [Text])]+asFunDeps = eachInArray asFunDep+ where+ asFunDep = (,) <$> nth 0 (eachInArray asText) <*> nth 1 (eachInArray asText)++asDataDeclType :: Parse PackageError P.DataDeclType+asDataDeclType =+ withText $ \case+ "data" -> Right P.Data+ "newtype" -> Right P.Newtype+ other -> Left (InvalidDataDeclType other)++asChildDeclaration :: Parse PackageError ChildDeclaration+asChildDeclaration =+ ChildDeclaration <$> key "title" asText+ <*> key "comments" (perhaps asText)+ <*> key "sourceSpan" (perhaps asSourceSpan)+ <*> key "info" asChildDeclarationInfo++asChildDeclarationInfo :: Parse PackageError ChildDeclarationInfo+asChildDeclarationInfo = do+ ty <- key "declType" asText+ case ty of+ "instance" ->+ ChildInstance <$> key "dependencies" (eachInArray asConstraint)+ <*> key "type" asType+ "dataConstructor" ->+ ChildDataConstructor <$> key "arguments" (eachInArray asType)+ "typeClassMember" ->+ ChildTypeClassMember <$> key "type" asType+ other ->+ throwCustomError $ InvalidChildDeclarationType other++asSourcePos :: Parse e P.SourcePos+asSourcePos = P.SourcePos <$> nth 0 asIntegral+ <*> nth 1 asIntegral++asConstraint :: Parse PackageError Constraint'+asConstraint = P.Constraint () <$> key "constraintClass" asQualifiedProperName+ <*> keyOrDefault "constraintKindArgs" [] (eachInArray asType)+ <*> key "constraintArgs" (eachInArray asType)+ <*> pure Nothing++asQualifiedProperName :: Parse e (P.Qualified (P.ProperName a))+asQualifiedProperName = fromAesonParser++asModuleMap :: Parse PackageError (Map P.ModuleName PackageName)+asModuleMap =+ Map.fromList <$>+ eachInObjectWithKey (Right . P.moduleNameFromString)+ (withText parsePackageName')++-- This is here to preserve backwards compatibility with compilers which used+-- to generate a 'bookmarks' field in the JSON (i.e. up to 0.10.5). We should+-- remove this after the next breaking change to the JSON.+bookmarksAsModuleMap :: Parse ManifestError (Map P.ModuleName PackageName)+bookmarksAsModuleMap =+ convert <$>+ eachInArray (asInPackage (nth 0 (P.moduleNameFromString <$> asText)))++ where+ convert :: [InPackage P.ModuleName] -> Map P.ModuleName PackageName+ convert = Map.fromList . mapMaybe toTuple++ toTuple (Local _) = Nothing+ toTuple (FromDep pkgName mn) = Just (mn, pkgName)++asResolvedDependencies :: Parse PackageError [(PackageName, Version)]+asResolvedDependencies =+ eachInObjectWithKey parsePackageName' asVersion++parsePackageName' :: Text -> Either PackageError PackageName+parsePackageName' =+ mapLeft ErrorInPackageMeta . (mapLeft BowerManifest . parsePackageName)++mapLeft :: (a -> a') -> Either a b -> Either a' b+mapLeft f (Left x) = Left (f x)+mapLeft _ (Right x) = Right x++asGithub :: Parse e (GithubUser, GithubRepo)+asGithub = (,) <$> nth 0 (GithubUser <$> asText)+ <*> nth 1 (GithubRepo <$> asText)++asSourceSpan :: Parse e P.SourceSpan+asSourceSpan = P.SourceSpan <$> key "name" asString+ <*> key "start" asSourcePos+ <*> key "end" asSourcePos++---------------------+-- ToJSON instances++instance A.ToJSON a => A.ToJSON (Package a) where+ toJSON Package{..} =+ A.object $+ [ "packageMeta" .= pkgMeta+ , "version" .= showVersion pkgVersion+ , "versionTag" .= pkgVersionTag+ , "modules" .= pkgModules+ , "moduleMap" .= assocListToJSON (A.Key.fromText . P.runModuleName)+ runPackageName+ (Map.toList pkgModuleMap)+ , "resolvedDependencies" .= assocListToJSON (A.Key.fromText . runPackageName)+ (T.pack . showVersion)+ pkgResolvedDependencies+ , "github" .= pkgGithub+ , "uploader" .= pkgUploader+ , "compilerVersion" .= showVersion Paths.version+ ] +++ fmap (\t -> "tagTime" .= formatTime t) (maybeToList pkgTagTime)++instance A.ToJSON NotYetKnown where+ toJSON _ = A.Null++instance A.ToJSON Module where+ toJSON Module{..} =+ A.object [ "name" .= P.runModuleName modName+ , "comments" .= modComments+ , "declarations" .= modDeclarations+ , "reExports" .= map toObj modReExports+ ]+ where+ toObj (mn, decls) = A.object [ "moduleName" .= mn+ , "declarations" .= decls+ ]++instance A.ToJSON Declaration where+ toJSON Declaration{..} =+ A.object [ "title" .= declTitle+ , "comments" .= declComments+ , "sourceSpan" .= declSourceSpan+ , "children" .= declChildren+ , "info" .= declInfo+ , "kind" .= declKind+ ]++instance A.ToJSON KindInfo where+ toJSON KindInfo{..} =+ A.object [ "keyword" .= kindSignatureForKeyword kiKeyword+ , "kind" .= kiKind+ ]++kindSignatureForKeyword :: P.KindSignatureFor -> Text+kindSignatureForKeyword = \case+ P.DataSig -> "data"+ P.NewtypeSig -> "newtype"+ P.TypeSynonymSig -> "type"+ P.ClassSig -> "class"++instance A.ToJSON ChildDeclaration where+ toJSON ChildDeclaration{..} =+ A.object [ "title" .= cdeclTitle+ , "comments" .= cdeclComments+ , "sourceSpan" .= cdeclSourceSpan+ , "info" .= cdeclInfo+ ]++instance A.ToJSON DeclarationInfo where+ toJSON info = A.object $ "declType" .= declInfoToString info : props+ where+ props = case info of+ ValueDeclaration ty -> ["type" .= ty]+ DataDeclaration ty args roles -> ["dataDeclType" .= ty, "typeArguments" .= args, "roles" .= roles]+ ExternDataDeclaration kind roles -> ["kind" .= kind, "roles" .= roles]+ TypeSynonymDeclaration args ty -> ["arguments" .= args, "type" .= ty]+ TypeClassDeclaration args super fundeps -> ["arguments" .= args, "superclasses" .= super, "fundeps" .= fundeps]+ AliasDeclaration fixity alias -> ["fixity" .= fixity, "alias" .= alias]++instance A.ToJSON ChildDeclarationInfo where+ toJSON info = A.object $ "declType" .= childDeclInfoToString info : props+ where+ props = case info of+ ChildInstance deps ty -> ["dependencies" .= deps, "type" .= ty]+ ChildDataConstructor args -> ["arguments" .= args]+ ChildTypeClassMember ty -> ["type" .= ty]++instance A.ToJSON GithubUser where+ toJSON = A.toJSON . runGithubUser++instance A.ToJSON GithubRepo where+ toJSON = A.toJSON . runGithubRepo++-- | Given a function for turning association list keys into JSON object keys,+-- and a function for turning association list values to JSON string values,+-- turns an association list into a JSON object.+--+-- For example:+-- @assocListToJSON T.pack T.pack [("a", "b")]@ will give @{"a": "b"}@.+assocListToJSON :: (a -> A.Key) -> (b -> Text) -> [(a, b)] -> A.Value+assocListToJSON f g xs = A.object (map (uncurry (.=) . (f *** g)) xs)++instance A.ToJSON a => A.ToJSON (InPackage a) where+ toJSON x =+ case x of+ Local y -> withPackage (Nothing :: Maybe ()) y+ FromDep pn y -> withPackage (Just pn) y+ where+ withPackage :: (A.ToJSON p, A.ToJSON x) => p -> x -> A.Value+ withPackage p y =+ A.object [ "package" .= p+ , "item" .= y+ ]
+ src/Language/PureScript/Docs/Utils/MonoidExtras.hs view
@@ -0,0 +1,8 @@+module Language.PureScript.Docs.Utils.MonoidExtras where++import Data.Monoid (Monoid(..), (<>))++mintersperse :: (Monoid m) => m -> [m] -> m+mintersperse _ [] = mempty+mintersperse _ [x] = x+mintersperse sep (x:xs) = x <> sep <> mintersperse sep xs
src/Language/PureScript/Environment.hs view
@@ -1,241 +1,687 @@------------------------------------------------------------------------------------ Module : Language.PureScript.Environment--- Copyright : (c) 2013-14 Phil Freeman, (c) 2014 Gary Burgess, and other contributors--- License : MIT+module Language.PureScript.Environment where++import Prelude++import GHC.Generics (Generic)+import Control.DeepSeq (NFData)+import Control.Monad (unless)+import Codec.Serialise (Serialise)+import Data.Aeson ((.=), (.:))+import Data.Aeson qualified as A+import Data.Foldable (find, fold)+import Data.Functor ((<&>))+import Data.IntMap qualified as IM+import Data.IntSet qualified as IS+import Data.Map qualified as M+import Data.Set qualified as S+import Data.Maybe (fromMaybe, mapMaybe)+import Data.Semigroup (First(..))+import Data.Text (Text)+import Data.Text qualified as T+import Data.List.NonEmpty qualified as NEL++import Language.PureScript.AST.SourcePos (nullSourceAnn)+import Language.PureScript.Crash (internalError)+import Language.PureScript.Names (Ident, ProperName(..), ProperNameType(..), Qualified, QualifiedBy, coerceProperName)+import Language.PureScript.Roles (Role(..))+import Language.PureScript.TypeClassDictionaries (NamedDict)+import Language.PureScript.Types (SourceConstraint, SourceType, Type(..), TypeVarVisibility(..), eqType, srcTypeConstructor, freeTypeVariables)+import Language.PureScript.Constants.Prim qualified as C++-- | The @Environment@ defines all values and types which are currently in scope:+data Environment = Environment+ { names :: M.Map (Qualified Ident) (SourceType, NameKind, NameVisibility)+ -- ^ Values currently in scope+ , types :: M.Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind)+ -- ^ Type names currently in scope+ , dataConstructors :: M.Map (Qualified (ProperName 'ConstructorName)) (DataDeclType, ProperName 'TypeName, SourceType, [Ident])+ -- ^ Data constructors currently in scope, along with their associated type+ -- constructor name, argument types and return type.+ , typeSynonyms :: M.Map (Qualified (ProperName 'TypeName)) ([(Text, Maybe SourceType)], SourceType)+ -- ^ Type synonyms currently in scope+ , typeClassDictionaries :: M.Map QualifiedBy (M.Map (Qualified (ProperName 'ClassName)) (M.Map (Qualified Ident) (NEL.NonEmpty NamedDict)))+ -- ^ Available type class dictionaries. When looking up 'Nothing' in the+ -- outer map, this returns the map of type class dictionaries in local+ -- scope (ie dictionaries brought in by a constrained type).+ , typeClasses :: M.Map (Qualified (ProperName 'ClassName)) TypeClassData+ -- ^ Type classes+ } deriving (Show, Generic)++instance NFData Environment++-- | Information about a type class+data TypeClassData = TypeClassData+ { typeClassArguments :: [(Text, Maybe SourceType)]+ -- ^ A list of type argument names, and their kinds, where kind annotations+ -- were provided.+ , typeClassMembers :: [(Ident, SourceType, Maybe (S.Set (NEL.NonEmpty Int)))]+ -- ^ A list of type class members and their types and whether or not+ -- they have type variables that must be defined using Visible Type Applications.+ -- Type arguments listed above are considered bound in these types.+ , typeClassSuperclasses :: [SourceConstraint]+ -- ^ A list of superclasses of this type class. Type arguments listed above+ -- are considered bound in the types appearing in these constraints.+ , typeClassDependencies :: [FunctionalDependency]+ -- ^ A list of functional dependencies for the type arguments of this class.+ , typeClassDeterminedArguments :: S.Set Int+ -- ^ A set of indexes of type argument that are fully determined by other+ -- arguments via functional dependencies. This can be computed from both+ -- typeClassArguments and typeClassDependencies.+ , typeClassCoveringSets :: S.Set (S.Set Int)+ -- ^ A sets of arguments that can be used to infer all other arguments.+ , typeClassIsEmpty :: Bool+ -- ^ Whether or not dictionaries for this type class are necessarily empty.+ } deriving (Show, Generic)++instance NFData TypeClassData++-- | A functional dependency indicates a relationship between two sets of+-- type arguments in a class declaration.+data FunctionalDependency = FunctionalDependency+ { fdDeterminers :: [Int]+ -- ^ the type arguments which determine the determined type arguments+ , fdDetermined :: [Int]+ -- ^ the determined type arguments+ } deriving (Show, Generic)++instance NFData FunctionalDependency+instance Serialise FunctionalDependency++instance A.FromJSON FunctionalDependency where+ parseJSON = A.withObject "FunctionalDependency" $ \o ->+ FunctionalDependency+ <$> o .: "determiners"+ <*> o .: "determined"++instance A.ToJSON FunctionalDependency where+ toJSON FunctionalDependency{..} =+ A.object [ "determiners" .= fdDeterminers+ , "determined" .= fdDetermined+ ]++-- | The initial environment with no values and only the default javascript types defined+initEnvironment :: Environment+initEnvironment = Environment M.empty allPrimTypes M.empty M.empty M.empty allPrimClasses++-- | A constructor for TypeClassData that computes which type class arguments are fully determined+-- and argument covering sets.+-- Fully determined means that this argument cannot be used when selecting a type class instance.+-- A covering set is a minimal collection of arguments that can be used to find an instance and+-- therefore determine all other type arguments. ----- Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :+-- An example of the difference between determined and fully determined would be with the class:+-- ```class C a b c | a -> b, b -> a, b -> c```+-- In this case, `a` must differ when `b` differs, and vice versa - each is determined by the other.+-- Both `a` and `b` can be used in selecting a type class instance. However, `c` cannot - it is+-- fully determined by `a` and `b`. ----- |+-- Define a graph of type class arguments with edges being fundep determiners to determined. Each+-- argument also has a self looping edge.+-- An argument is fully determined if doesn't appear at the start of a path of strongly connected components.+-- An argument is not fully determined otherwise. --------------------------------------------------------------------------------+-- The way we compute this is by saying: an argument X is fully determined if there are arguments that+-- determine X that X does not determine. This is the same thing: everything X determines includes everything+-- in its SCC, and everything determining X is either before it in an SCC path, or in the same SCC.+makeTypeClassData+ :: [(Text, Maybe SourceType)]+ -> [(Ident, SourceType)]+ -> [SourceConstraint]+ -> [FunctionalDependency]+ -> Bool+ -> TypeClassData+makeTypeClassData args m s deps = TypeClassData args m' s deps determinedArgs coveringSets+ where+ ( determinedArgs, coveringSets ) = computeCoveringSets (length args) deps -{-# LANGUAGE DeriveDataTypeable #-}+ coveringSets' = S.toList coveringSets -module Language.PureScript.Environment where+ m' = map (\(a, b) -> (a, b, addVtaInfo b)) m+ + addVtaInfo :: SourceType -> Maybe (S.Set (NEL.NonEmpty Int))+ addVtaInfo memberTy = do+ let mentionedArgIndexes = S.fromList (mapMaybe argToIndex $ freeTypeVariables memberTy)+ let leftovers = map (`S.difference` mentionedArgIndexes) coveringSets'+ S.fromList <$> traverse (NEL.nonEmpty . S.toList) leftovers -import Data.Data-import Data.Maybe (fromMaybe)-import qualified Data.Map as M+ argToIndex :: Text -> Maybe Int+ argToIndex = flip M.lookup $ M.fromList (zipWith ((,) . fst) args [0..]) -import Language.PureScript.Kinds-import Language.PureScript.Names-import Language.PureScript.TypeClassDictionaries-import Language.PureScript.Types-import qualified Language.PureScript.Constants as C+-- A moving frontier of sets to consider, along with the fundeps that can be+-- applied in each case. At each stage, all sets in the frontier will be the+-- same size, decreasing by 1 each time.+type Frontier = M.Map IS.IntSet (First (IM.IntMap (NEL.NonEmpty IS.IntSet)))+-- ^ ^ ^ ^+-- when *these* parameters | | |+-- are still needed, | | |+-- *these* parameters | |+-- can be determined | |+-- from a non-zero |+-- number of fundeps, |+-- which accept *these*+-- parameters as inputs. --- |--- The @Environment@ defines all values and types which are currently in scope:----data Environment = Environment {- -- |- -- Value names currently in scope- --- names :: M.Map (ModuleName, Ident) (Type, NameKind, NameVisibility)- -- |- -- Type names currently in scope- --- , types :: M.Map (Qualified ProperName) (Kind, TypeKind)- -- |- -- Data constructors currently in scope, along with their associated data type constructors- --- , dataConstructors :: M.Map (Qualified ProperName) (DataDeclType, ProperName, Type, [Ident])- -- |- -- Type synonyms currently in scope- --- , typeSynonyms :: M.Map (Qualified ProperName) ([(String, Maybe Kind)], Type)- -- |- -- Available type class dictionaries- --- , typeClassDictionaries :: M.Map (Qualified Ident, Maybe ModuleName) TypeClassDictionaryInScope- -- |- -- Type classes- --- , typeClasses :: M.Map (Qualified ProperName) ([(String, Maybe Kind)], [(Ident, Type)], [Constraint])- } deriving (Show)+computeCoveringSets :: Int -> [FunctionalDependency] -> (S.Set Int, S.Set (S.Set Int))+computeCoveringSets nargs deps = ( determinedArgs, coveringSets )+ where+ argumentIndices = S.fromList [0 .. nargs - 1] --- |--- The initial environment with no values and only the default javascript types defined----initEnvironment :: Environment-initEnvironment = Environment M.empty primTypes M.empty M.empty M.empty M.empty+ -- Compute all sets of arguments that determine the remaining arguments via+ -- functional dependencies. This is done in stages, where each stage+ -- considers sets of the same size to share work.+ allCoveringSets :: S.Set (S.Set Int)+ allCoveringSets = S.map (S.fromDistinctAscList . IS.toAscList) $ fst $ search $+ -- The initial frontier consists of just the set of all parameters and all+ -- fundeps organized into the map structure.+ M.singleton+ (IS.fromList [0 .. nargs - 1]) $+ First $ IM.fromListWith (<>) $ do+ fd <- deps+ let srcs = pure (IS.fromList (fdDeterminers fd))+ tgt <- fdDetermined fd+ pure (tgt, srcs) --- |--- The type of a foreign import----data ForeignImportType- -- |- -- A regular foreign import- --- = ForeignImport- -- |- -- A foreign import which contains inline Javascript as a string literal- --- | InlineJavascript deriving (Show, Eq, Data, Typeable)+ where --- |--- The visibility of a name in scope---+ -- Recursively advance the frontier until all frontiers are exhausted+ -- and coverings sets found. The covering sets found during the process+ -- are locally-minimal, in that none can be reduced by a fundep, but+ -- there may be subsets found from other frontiers.+ search :: Frontier -> (S.Set IS.IntSet, ())+ search frontier = unless (null frontier) $ M.foldMapWithKey step frontier >>= search++ -- The input set from the frontier is known to cover all parameters, but+ -- it may be able to be reduced by more fundeps.+ step :: IS.IntSet -> First (IM.IntMap (NEL.NonEmpty IS.IntSet)) -> (S.Set IS.IntSet, Frontier)+ step needed (First inEdges)+ -- If there are no applicable fundeps, record it as a locally minimal+ -- covering set. This has already been reduced to only applicable fundeps+ | IM.null inEdges = (S.singleton needed, M.empty)+ | otherwise = (S.empty, foldMap removeParameter paramsToTry)++ where++ determined = IM.keys inEdges+ -- If there is an acyclically determined functional dependency, prefer+ -- it to reduce the number of cases to check. That is a dependency+ -- that does not help determine other parameters.+ acycDetermined = find (`IS.notMember` (IS.unions $ concatMap NEL.toList $ IM.elems inEdges)) determined+ paramsToTry = maybe determined pure acycDetermined++ -- For each parameter to be removed to build the next frontier,+ -- delete the fundeps that determine it and filter out the fundeps+ -- that make use of it. Of course, if it an acyclic fundep we already+ -- found that there are none that use it.+ removeParameter :: Int -> Frontier+ removeParameter y =+ M.singleton+ (IS.delete y needed) $+ case acycDetermined of+ Just _ -> First $ IM.delete y inEdges+ Nothing ->+ First $ IM.mapMaybe (NEL.nonEmpty . NEL.filter (y `IS.notMember`)) $ IM.delete y inEdges++ -- Reduce to the inclusion-minimal sets+ coveringSets = S.filter (\v -> not (any (\c -> c `S.isProperSubsetOf` v) allCoveringSets)) allCoveringSets++ -- An argument is determined if it is in no covering set+ determinedArgs = argumentIndices `S.difference` fold coveringSets++-- | The visibility of a name in scope data NameVisibility- -- |- -- The name is defined in the current binding group, but is not visible- -- = Undefined- -- |- -- The name is defined in the another binding group, or has been made visible by a function binder- --- | Defined deriving (Show, Eq)+ -- ^ The name is defined in the current binding group, but is not visible+ | Defined+ -- ^ The name is defined in the another binding group, or has been made visible by a function binder+ deriving (Show, Eq, Generic) --- |--- The kind of a name---+instance NFData NameVisibility+instance Serialise NameVisibility++-- | A flag for whether a name is for an private or public value - only public values will be+-- included in a generated externs file. data NameKind- -- |- -- A value introduced as a binding in a module- --- = Value- -- |- -- A type class dictionary member accessor import, generated during desugaring of type class declarations- --- | TypeClassAccessorImport- -- |- -- A foreign import- --- | Extern ForeignImportType- -- |- -- A local name introduced using a lambda abstraction, variable introduction or binder- --- | LocalVariable- -- |- -- A data constructor- --- | DataConstructor- -- |- -- A type class dictionary, generated during desugaring of type class declarations- --- | TypeInstanceDictionaryValue deriving (Show, Eq, Data, Typeable)+ = Private+ -- ^ A private value introduced as an artifact of code generation (class instances, class member+ -- accessors, etc.)+ | Public+ -- ^ A public value for a module member or foreign import declaration+ | External+ -- ^ A name for member introduced by foreign import+ deriving (Show, Eq, Generic) --- |--- The kinds of a type---+instance NFData NameKind+instance Serialise NameKind++-- | The kinds of a type data TypeKind- -- |- -- Data type- --- = DataType [(String, Maybe Kind)] [(ProperName, [Type])]- -- |- -- Type synonym- --+ = DataType DataDeclType [(Text, Maybe SourceType, Role)] [(ProperName 'ConstructorName, [SourceType])]+ -- ^ Data type | TypeSynonym- -- |- -- Foreign data- --- | ExternData- -- |- -- A local type variable- --+ -- ^ Type synonym+ | ExternData [Role]+ -- ^ Foreign data | LocalTypeVariable- -- |- -- A scoped type variable- --+ -- ^ A local type variable | ScopedTypeVar- deriving (Show, Eq, Data, Typeable)+ -- ^ A scoped type variable+ deriving (Show, Eq, Generic) --- |--- The type ('data' or 'newtype') of a data type declaration---+instance NFData TypeKind+instance Serialise TypeKind++-- | The type ('data' or 'newtype') of a data type declaration data DataDeclType- -- |- -- A standard data constructor- -- = Data- -- |- -- A newtype constructor- --- | Newtype deriving (Eq, Ord, Data, Typeable)+ -- ^ A standard data constructor+ | Newtype+ -- ^ A newtype constructor+ deriving (Show, Eq, Ord, Generic) -instance Show DataDeclType where- show Data = "data"- show Newtype = "newtype"+instance NFData DataDeclType+instance Serialise DataDeclType --- |--- Construct a ProperName in the Prim module----primName :: String -> Qualified ProperName-primName = Qualified (Just $ ModuleName [ProperName C.prim]) . ProperName+showDataDeclType :: DataDeclType -> Text+showDataDeclType Data = "data"+showDataDeclType Newtype = "newtype" --- |--- Construct a type in the Prim module----primTy :: String -> Type-primTy = TypeConstructor . primName+instance A.ToJSON DataDeclType where+ toJSON = A.toJSON . showDataDeclType --- |--- Type constructor for functions----tyFunction :: Type-tyFunction = primTy "Function"+instance A.FromJSON DataDeclType where+ parseJSON = A.withText "DataDeclType" $ \case+ "data" -> return Data+ "newtype" -> return Newtype+ other -> fail $ "invalid type: '" ++ T.unpack other ++ "'" --- |--- Type constructor for strings----tyString :: Type-tyString = primTy "String"+-- | Kind of ground types+kindType :: SourceType+kindType = srcTypeConstructor C.Type --- |--- Type constructor for numbers----tyNumber :: Type-tyNumber = primTy "Number"+kindConstraint :: SourceType+kindConstraint = srcTypeConstructor C.Constraint --- |--- Type constructor for booleans----tyBoolean :: Type-tyBoolean = primTy "Boolean"+kindSymbol :: SourceType+kindSymbol = srcTypeConstructor C.Symbol --- |--- Type constructor for arrays----tyArray :: Type-tyArray = primTy "Array"+kindDoc :: SourceType+kindDoc = srcTypeConstructor C.Doc --- |--- Type constructor for objects----tyObject :: Type-tyObject = primTy "Object"+kindOrdering :: SourceType+kindOrdering = srcTypeConstructor C.TypeOrdering --- |--- Smart constructor for function types----function :: Type -> Type -> Type-function t1 = TypeApp (TypeApp tyFunction t1)+kindRowList :: SourceType -> SourceType+kindRowList = TypeApp nullSourceAnn (srcTypeConstructor C.RowList) --- |--- The primitive types in the external javascript environment with their associated kinds.----primTypes :: M.Map (Qualified ProperName) (Kind, TypeKind)-primTypes = M.fromList [ (primName "Function" , (FunKind Star (FunKind Star Star), ExternData))- , (primName "Array" , (FunKind Star Star, ExternData))- , (primName "Object" , (FunKind (Row Star) Star, ExternData))- , (primName "String" , (Star, ExternData))- , (primName "Number" , (Star, ExternData))- , (primName "Boolean" , (Star, ExternData)) ]+kindRow :: SourceType -> SourceType+kindRow = TypeApp nullSourceAnn (srcTypeConstructor C.Row) --- |--- Finds information about data constructors from the current environment.----lookupConstructor :: Environment -> Qualified ProperName -> (DataDeclType, ProperName, Type, [Ident])+kindOfREmpty :: SourceType+kindOfREmpty = tyForall "k" kindType (kindRow (tyVar "k"))++-- | Type constructor for functions+tyFunction :: SourceType+tyFunction = srcTypeConstructor C.Function++-- | Type constructor for strings+tyString :: SourceType+tyString = srcTypeConstructor C.String++-- | Type constructor for strings+tyChar :: SourceType+tyChar = srcTypeConstructor C.Char++-- | Type constructor for numbers+tyNumber :: SourceType+tyNumber = srcTypeConstructor C.Number++-- | Type constructor for integers+tyInt :: SourceType+tyInt = srcTypeConstructor C.Int++-- | Type constructor for booleans+tyBoolean :: SourceType+tyBoolean = srcTypeConstructor C.Boolean++-- | Type constructor for arrays+tyArray :: SourceType+tyArray = srcTypeConstructor C.Array++-- | Type constructor for records+tyRecord :: SourceType+tyRecord = srcTypeConstructor C.Record++tyVar :: Text -> SourceType+tyVar = TypeVar nullSourceAnn++tyForall :: Text -> SourceType -> SourceType -> SourceType+tyForall var k ty = ForAll nullSourceAnn TypeVarInvisible var (Just k) ty Nothing++-- | Smart constructor for function types+function :: SourceType -> SourceType -> SourceType+function = TypeApp nullSourceAnn . TypeApp nullSourceAnn tyFunction++-- To make reading the kind signatures below easier+(-:>) :: SourceType -> SourceType -> SourceType+(-:>) = function+infixr 4 -:>++primClass :: Qualified (ProperName 'ClassName) -> (SourceType -> SourceType) -> [(Qualified (ProperName 'TypeName), (SourceType, TypeKind))]+primClass name mkKind =+ [ let k = mkKind kindConstraint+ in (coerceProperName <$> name, (k, ExternData (nominalRolesForKind k)))+ , let k = mkKind kindType+ in (dictTypeName . coerceProperName <$> name, (k, TypeSynonym))+ ]++-- | The primitive types in the external environment with their+-- associated kinds. There are also pseudo `Fail`, `Warn`, and `Partial` types+-- that correspond to the classes with the same names.+primTypes :: M.Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind)+primTypes =+ M.fromList+ [ (C.Type, (kindType, ExternData []))+ , (C.Constraint, (kindType, ExternData []))+ , (C.Symbol, (kindType, ExternData []))+ , (C.Row, (kindType -:> kindType, ExternData [Phantom]))+ , (C.Function, (kindType -:> kindType -:> kindType, ExternData [Representational, Representational]))+ , (C.Array, (kindType -:> kindType, ExternData [Representational]))+ , (C.Record, (kindRow kindType -:> kindType, ExternData [Representational]))+ , (C.String, (kindType, ExternData []))+ , (C.Char, (kindType, ExternData []))+ , (C.Number, (kindType, ExternData []))+ , (C.Int, (kindType, ExternData []))+ , (C.Boolean, (kindType, ExternData []))+ , (C.Partial <&> coerceProperName, (kindConstraint, ExternData []))+ ]++-- | This 'Map' contains all of the prim types from all Prim modules.+allPrimTypes :: M.Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind)+allPrimTypes = M.unions+ [ primTypes+ , primBooleanTypes+ , primCoerceTypes+ , primOrderingTypes+ , primRowTypes+ , primRowListTypes+ , primSymbolTypes+ , primIntTypes+ , primTypeErrorTypes+ ]++primBooleanTypes :: M.Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind)+primBooleanTypes =+ M.fromList+ [ (C.True, (tyBoolean, ExternData []))+ , (C.False, (tyBoolean, ExternData []))+ ]++primCoerceTypes :: M.Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind)+primCoerceTypes =+ M.fromList $ mconcat+ [ primClass C.Coercible (\kind -> tyForall "k" kindType $ tyVar "k" -:> tyVar "k" -:> kind)+ ]++primOrderingTypes :: M.Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind)+primOrderingTypes =+ M.fromList+ [ (C.TypeOrdering, (kindType, ExternData []))+ , (C.LT, (kindOrdering, ExternData []))+ , (C.EQ, (kindOrdering, ExternData []))+ , (C.GT, (kindOrdering, ExternData []))+ ]++primRowTypes :: M.Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind)+primRowTypes =+ M.fromList $ mconcat+ [ primClass C.RowUnion (\kind -> tyForall "k" kindType $ kindRow (tyVar "k") -:> kindRow (tyVar "k") -:> kindRow (tyVar "k") -:> kind)+ , primClass C.RowNub (\kind -> tyForall "k" kindType $ kindRow (tyVar "k") -:> kindRow (tyVar "k") -:> kind)+ , primClass C.RowLacks (\kind -> tyForall "k" kindType $ kindSymbol -:> kindRow (tyVar "k") -:> kind)+ , primClass C.RowCons (\kind -> tyForall "k" kindType $ kindSymbol -:> tyVar "k" -:> kindRow (tyVar "k") -:> kindRow (tyVar "k") -:> kind)+ ]++primRowListTypes :: M.Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind)+primRowListTypes =+ M.fromList $+ [ (C.RowList, (kindType -:> kindType, ExternData [Phantom]))+ , (C.RowListCons, (tyForall "k" kindType $ kindSymbol -:> tyVar "k" -:> kindRowList (tyVar "k") -:> kindRowList (tyVar "k"), ExternData [Phantom, Phantom, Phantom]))+ , (C.RowListNil, (tyForall "k" kindType $ kindRowList (tyVar "k"), ExternData []))+ ] <> mconcat+ [ primClass C.RowToList (\kind -> tyForall "k" kindType $ kindRow (tyVar "k") -:> kindRowList (tyVar "k") -:> kind)+ ]++primSymbolTypes :: M.Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind)+primSymbolTypes =+ M.fromList $ mconcat+ [ primClass C.SymbolAppend (\kind -> kindSymbol -:> kindSymbol -:> kindSymbol -:> kind)+ , primClass C.SymbolCompare (\kind -> kindSymbol -:> kindSymbol -:> kindOrdering -:> kind)+ , primClass C.SymbolCons (\kind -> kindSymbol -:> kindSymbol -:> kindSymbol -:> kind)+ ]++primIntTypes :: M.Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind)+primIntTypes =+ M.fromList $ mconcat+ [ primClass C.IntAdd (\kind -> tyInt -:> tyInt -:> tyInt -:> kind)+ , primClass C.IntCompare (\kind -> tyInt -:> tyInt -:> kindOrdering -:> kind)+ , primClass C.IntMul (\kind -> tyInt -:> tyInt -:> tyInt -:> kind)+ , primClass C.IntToString (\kind -> tyInt -:> kindSymbol -:> kind)+ ]++primTypeErrorTypes :: M.Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind)+primTypeErrorTypes =+ M.fromList $+ [ (C.Doc, (kindType, ExternData []))+ , (C.Fail <&> coerceProperName, (kindDoc -:> kindConstraint, ExternData [Nominal]))+ , (C.Warn <&> coerceProperName, (kindDoc -:> kindConstraint, ExternData [Nominal]))+ , (C.Text, (kindSymbol -:> kindDoc, ExternData [Phantom]))+ , (C.Quote, (tyForall "k" kindType $ tyVar "k" -:> kindDoc, ExternData [Phantom]))+ , (C.QuoteLabel, (kindSymbol -:> kindDoc, ExternData [Phantom]))+ , (C.Beside, (kindDoc -:> kindDoc -:> kindDoc, ExternData [Phantom, Phantom]))+ , (C.Above, (kindDoc -:> kindDoc -:> kindDoc, ExternData [Phantom, Phantom]))+ ] <> mconcat+ [ primClass C.Fail (\kind -> kindDoc -:> kind)+ , primClass C.Warn (\kind -> kindDoc -:> kind)+ ]++-- | The primitive class map. This just contains the `Partial` class.+-- `Partial` is used as a kind of magic constraint for partial functions.+primClasses :: M.Map (Qualified (ProperName 'ClassName)) TypeClassData+primClasses =+ M.fromList+ [ (C.Partial, makeTypeClassData [] [] [] [] True)+ ]++-- | This contains all of the type classes from all Prim modules.+allPrimClasses :: M.Map (Qualified (ProperName 'ClassName)) TypeClassData+allPrimClasses = M.unions+ [ primClasses+ , primCoerceClasses+ , primRowClasses+ , primRowListClasses+ , primSymbolClasses+ , primIntClasses+ , primTypeErrorClasses+ ]++primCoerceClasses :: M.Map (Qualified (ProperName 'ClassName)) TypeClassData+primCoerceClasses =+ M.fromList+ -- class Coercible (a :: k) (b :: k)+ [ (C.Coercible, makeTypeClassData+ [ ("a", Just (tyVar "k"))+ , ("b", Just (tyVar "k"))+ ] [] [] [] True)+ ]++primRowClasses :: M.Map (Qualified (ProperName 'ClassName)) TypeClassData+primRowClasses =+ M.fromList+ -- class Union (left :: Row k) (right :: Row k) (union :: Row k) | left right -> union, right union -> left, union left -> right+ [ (C.RowUnion, makeTypeClassData+ [ ("left", Just (kindRow (tyVar "k")))+ , ("right", Just (kindRow (tyVar "k")))+ , ("union", Just (kindRow (tyVar "k")))+ ] [] []+ [ FunctionalDependency [0, 1] [2]+ , FunctionalDependency [1, 2] [0]+ , FunctionalDependency [2, 0] [1]+ ] True)++ -- class Nub (original :: Row k) (nubbed :: Row k) | original -> nubbed+ , (C.RowNub, makeTypeClassData+ [ ("original", Just (kindRow (tyVar "k")))+ , ("nubbed", Just (kindRow (tyVar "k")))+ ] [] []+ [ FunctionalDependency [0] [1]+ ] True)++ -- class Lacks (label :: Symbol) (row :: Row k)+ , (C.RowLacks, makeTypeClassData+ [ ("label", Just kindSymbol)+ , ("row", Just (kindRow (tyVar "k")))+ ] [] [] [] True)++ -- class RowCons (label :: Symbol) (a :: k) (tail :: Row k) (row :: Row k) | label tail a -> row, label row -> tail a+ , (C.RowCons, makeTypeClassData+ [ ("label", Just kindSymbol)+ , ("a", Just (tyVar "k"))+ , ("tail", Just (kindRow (tyVar "k")))+ , ("row", Just (kindRow (tyVar "k")))+ ] [] []+ [ FunctionalDependency [0, 1, 2] [3]+ , FunctionalDependency [0, 3] [1, 2]+ ] True)+ ]++primRowListClasses :: M.Map (Qualified (ProperName 'ClassName)) TypeClassData+primRowListClasses =+ M.fromList+ -- class RowToList (row :: Row k) (list :: RowList k) | row -> list+ [ (C.RowToList, makeTypeClassData+ [ ("row", Just (kindRow (tyVar "k")))+ , ("list", Just (kindRowList (tyVar "k")))+ ] [] []+ [ FunctionalDependency [0] [1]+ ] True)+ ]++primSymbolClasses :: M.Map (Qualified (ProperName 'ClassName)) TypeClassData+primSymbolClasses =+ M.fromList+ -- class Append (left :: Symbol) (right :: Symbol) (appended :: Symbol) | left right -> appended, right appended -> left, appended left -> right+ [ (C.SymbolAppend, makeTypeClassData+ [ ("left", Just kindSymbol)+ , ("right", Just kindSymbol)+ , ("appended", Just kindSymbol)+ ] [] []+ [ FunctionalDependency [0, 1] [2]+ , FunctionalDependency [1, 2] [0]+ , FunctionalDependency [2, 0] [1]+ ] True)++ -- class Compare (left :: Symbol) (right :: Symbol) (ordering :: Ordering) | left right -> ordering+ , (C.SymbolCompare, makeTypeClassData+ [ ("left", Just kindSymbol)+ , ("right", Just kindSymbol)+ , ("ordering", Just kindOrdering)+ ] [] []+ [ FunctionalDependency [0, 1] [2]+ ] True)++ -- class Cons (head :: Symbol) (tail :: Symbol) (symbol :: Symbol) | head tail -> symbol, symbol -> head tail+ , (C.SymbolCons, makeTypeClassData+ [ ("head", Just kindSymbol)+ , ("tail", Just kindSymbol)+ , ("symbol", Just kindSymbol)+ ] [] []+ [ FunctionalDependency [0, 1] [2]+ , FunctionalDependency [2] [0, 1]+ ] True)+ ]++primIntClasses :: M.Map (Qualified (ProperName 'ClassName)) TypeClassData+primIntClasses =+ M.fromList+ -- class Add (left :: Int) (right :: Int) (sum :: Int) | left right -> sum, left sum -> right, right sum -> left+ [ (C.IntAdd, makeTypeClassData+ [ ("left", Just tyInt)+ , ("right", Just tyInt)+ , ("sum", Just tyInt)+ ] [] []+ [ FunctionalDependency [0, 1] [2]+ , FunctionalDependency [0, 2] [1]+ , FunctionalDependency [1, 2] [0]+ ] True)++ -- class Compare (left :: Int) (right :: Int) (ordering :: Ordering) | left right -> ordering+ , (C.IntCompare, makeTypeClassData+ [ ("left", Just tyInt)+ , ("right", Just tyInt)+ , ("ordering", Just kindOrdering)+ ] [] []+ [ FunctionalDependency [0, 1] [2]+ ] True)++ -- class Mul (left :: Int) (right :: Int) (product :: Int) | left right -> product+ , (C.IntMul, makeTypeClassData+ [ ("left", Just tyInt)+ , ("right", Just tyInt)+ , ("product", Just tyInt)+ ] [] []+ [ FunctionalDependency [0, 1] [2]+ ] True)++ -- class ToString (int :: Int) (string :: Symbol) | int -> string+ , (C.IntToString, makeTypeClassData+ [ ("int", Just tyInt)+ , ("string", Just kindSymbol)+ ] [] []+ [ FunctionalDependency [0] [1]+ ] True)+ ]++primTypeErrorClasses :: M.Map (Qualified (ProperName 'ClassName)) TypeClassData+primTypeErrorClasses =+ M.fromList+ -- class Fail (message :: Symbol)+ [ (C.Fail, makeTypeClassData+ [("message", Just kindDoc)] [] [] [] True)++ -- class Warn (message :: Symbol)+ , (C.Warn, makeTypeClassData+ [("message", Just kindDoc)] [] [] [] True)+ ]++-- | Finds information about data constructors from the current environment.+lookupConstructor :: Environment -> Qualified (ProperName 'ConstructorName) -> (DataDeclType, ProperName 'TypeName, SourceType, [Ident]) lookupConstructor env ctor =- fromMaybe (error "Data constructor not found") $ ctor `M.lookup` dataConstructors env+ fromMaybe (internalError "Data constructor not found") $ ctor `M.lookup` dataConstructors env +-- | Finds information about values from the current environment.+lookupValue :: Environment -> Qualified Ident -> Maybe (SourceType, NameKind, NameVisibility)+lookupValue env ident = ident `M.lookup` names env++dictTypeName' :: Text -> Text+dictTypeName' = (<> "$Dict")++dictTypeName :: ProperName a -> ProperName a+dictTypeName = ProperName . dictTypeName' . runProperName++isDictTypeName :: ProperName a -> Bool+isDictTypeName = T.isSuffixOf "$Dict" . runProperName+ -- |--- Checks whether a data constructor is for a newtype.----isNewtypeConstructor :: Environment -> Qualified ProperName -> Bool-isNewtypeConstructor e ctor = case lookupConstructor e ctor of- (Newtype, _, _, _) -> True- (Data, _, _, _) -> False+-- Given the kind of a type, generate a list @Nominal@ roles. This is used for+-- opaque foreign types as well as type classes.+nominalRolesForKind :: Type a -> [Role]+nominalRolesForKind k = replicate (kindArity k) Nominal++kindArity :: Type a -> Int+kindArity = length . fst . unapplyKinds++unapplyKinds :: Type a -> ([Type a], Type a)+unapplyKinds = go [] where+ go kinds (TypeApp _ (TypeApp _ fn k1) k2)+ | eqType fn tyFunction = go (k1 : kinds) k2+ go kinds (ForAll _ _ _ _ k _) = go kinds k+ go kinds k = (reverse kinds, k)
src/Language/PureScript/Errors.hs view
@@ -1,524 +1,2077 @@------------------------------------------------------------------------------------ Module : Language.PureScript.Error--- Copyright : (c) 2013-14 Phil Freeman, (c) 2014 Gary Burgess, and other contributors--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ |-----------------------------------------------------------------------------------{-# LANGUAGE GeneralizedNewtypeDeriving #-}-{-# LANGUAGE FlexibleContexts #-}-{-# LANGUAGE MultiParamTypeClasses #-}--module Language.PureScript.Errors where--import Data.Either (lefts, rights)-import Data.List (intercalate)-import Data.Monoid-import Data.Foldable (fold, foldMap)--import Control.Monad.Except-import Control.Monad.Unify-import Control.Applicative ((<$>))--import Language.PureScript.AST-import Language.PureScript.Pretty-import Language.PureScript.Types-import Language.PureScript.Names-import Language.PureScript.Kinds-import Language.PureScript.TypeClassDictionaries--import qualified Text.PrettyPrint.Boxes as Box---- |--- A type of error messages----data ErrorMessage - = InfiniteType Type- | InfiniteKind Kind- | CannotReorderOperators- | MultipleFixities Ident- | OrphanTypeDeclaration Ident- | OrphanFixityDeclaration String- | RedefinedModule ModuleName- | RedefinedIdent Ident- | OverlappingNamesInLet- | UnknownModule ModuleName- | UnknownType (Qualified ProperName)- | UnknownTypeClass (Qualified ProperName)- | UnknownValue (Qualified Ident)- | UnknownDataConstructor (Qualified ProperName) (Maybe (Qualified ProperName))- | UnknownTypeConstructor (Qualified ProperName)- | ConflictingImport String ModuleName- | ConflictingImports String ModuleName ModuleName - | ConflictingTypeDecls ProperName- | ConflictingCtorDecls ProperName- | TypeConflictsWithClass ProperName- | CtorConflictsWithClass ProperName- | ClassConflictsWithType ProperName- | ClassConflictsWithCtor ProperName- | DuplicateClassExport ProperName- | DuplicateValueExport Ident- | DuplicateTypeArgument String- | InvalidDoBind- | InvalidDoLet- | CycleInDeclaration Ident- | CycleInTypeSynonym (Maybe ProperName)- | NameIsUndefined Ident- | NameNotInScope Ident- | UndefinedTypeVariable ProperName- | PartiallyAppliedSynonym (Qualified ProperName)- | NotYetDefined [Ident] ErrorMessage- | EscapedSkolem (Maybe Expr)- | UnspecifiedSkolemScope- | TypesDoNotUnify Type Type- | KindsDoNotUnify Kind Kind- | ConstrainedTypeUnified Type Type- | OverlappingInstances (Qualified ProperName) [Type] [DictionaryValue]- | NoInstanceFound (Qualified ProperName) [Type]- | DuplicateLabel String (Maybe Expr)- | DuplicateValueDeclaration Ident- | ArgListLengthsDiffer Ident- | OverlappingArgNames (Maybe Ident)- | MissingClassMember Ident- | ExpectedType Kind- | IncorrectConstructorArity (Qualified ProperName)- | SubsumptionCheckFailed- | ExprDoesNotHaveType Expr Type- | PropertyIsMissing String Type- | ErrorUnifyingTypes Type Type ErrorMessage- | CannotApplyFunction Type Expr- | TypeSynonymInstance- | InvalidNewtype- | InvalidInstanceHead Type- | TransitiveExportError DeclarationRef [DeclarationRef]- | ErrorInExpression Expr ErrorMessage- | ErrorInModule ModuleName ErrorMessage- | ErrorInInstance (Qualified ProperName) [Type] ErrorMessage- | ErrorInSubsumption Type Type ErrorMessage- | ErrorCheckingType Expr Type ErrorMessage- | ErrorCheckingKind Type ErrorMessage- | ErrorInferringType Expr ErrorMessage- | ErrorInApplication Expr Type Expr ErrorMessage- | ErrorInDataConstructor ProperName ErrorMessage- | ErrorInTypeConstructor ProperName ErrorMessage- | ErrorInBindingGroup [Ident] ErrorMessage- | ErrorInDataBindingGroup ErrorMessage- | ErrorInTypeSynonym ProperName ErrorMessage- | ErrorInValueDeclaration Ident ErrorMessage- | ErrorInForeignImport Ident ErrorMessage- | PositionedError SourceSpan ErrorMessage- deriving (Show)- -instance UnificationError Type ErrorMessage where- occursCheckFailed = InfiniteType- -instance UnificationError Kind ErrorMessage where- occursCheckFailed = InfiniteKind---- |--- Get the error code for a particular error type----errorCode :: ErrorMessage -> String-errorCode (InfiniteType _) = "InfiniteType"-errorCode (InfiniteKind _) = "InfiniteKind"-errorCode CannotReorderOperators = "CannotReorderOperators"-errorCode (MultipleFixities _) = "MultipleFixities"-errorCode (OrphanTypeDeclaration _) = "OrphanTypeDeclaration"-errorCode (OrphanFixityDeclaration _) = "OrphanFixityDeclaration"-errorCode (RedefinedModule _) = "RedefinedModule"-errorCode (RedefinedIdent _) = "RedefinedIdent"-errorCode OverlappingNamesInLet = "OverlappingNamesInLet"-errorCode (UnknownModule _) = "UnknownModule"-errorCode (UnknownType _) = "UnknownType"-errorCode (UnknownTypeClass _) = "UnknownTypeClass"-errorCode (UnknownValue _) = "UnknownValue"-errorCode (UnknownDataConstructor _ _) = "UnknownDataConstructor"-errorCode (UnknownTypeConstructor _) = "UnknownTypeConstructor"-errorCode (ConflictingImport _ _) = "ConflictingImport"-errorCode (ConflictingImports _ _ _) = "ConflictingImports"-errorCode (ConflictingTypeDecls _) = "ConflictingTypeDecls"-errorCode (ConflictingCtorDecls _) = "ConflictingCtorDecls"-errorCode (TypeConflictsWithClass _) = "TypeConflictsWithClass"-errorCode (CtorConflictsWithClass _) = "CtorConflictsWithClass"-errorCode (ClassConflictsWithType _) = "ClassConflictsWithType"-errorCode (ClassConflictsWithCtor _) = "ClassConflictsWithCtor"-errorCode (DuplicateClassExport _) = "DuplicateClassExport"-errorCode (DuplicateValueExport _) = "DuplicateValueExport"-errorCode (DuplicateTypeArgument _) = "DuplicateTypeArgument"-errorCode InvalidDoBind = "InvalidDoBind"-errorCode InvalidDoLet = "InvalidDoLet"-errorCode (CycleInDeclaration _) = "CycleInDeclaration"-errorCode (CycleInTypeSynonym _) = "CycleInTypeSynonym"-errorCode (NameIsUndefined _) = "NameIsUndefined"-errorCode (NameNotInScope _) = "NameNotInScope"-errorCode (UndefinedTypeVariable _) = "UndefinedTypeVariable"-errorCode (PartiallyAppliedSynonym _) = "PartiallyAppliedSynonym"-errorCode (EscapedSkolem _) = "EscapedSkolem"-errorCode UnspecifiedSkolemScope = "UnspecifiedSkolemScope"-errorCode (TypesDoNotUnify _ _) = "TypesDoNotUnify"-errorCode (KindsDoNotUnify _ _) = "KindsDoNotUnify"-errorCode (ConstrainedTypeUnified _ _) = "ConstrainedTypeUnified"-errorCode (OverlappingInstances _ _ _) = "OverlappingInstances"-errorCode (NoInstanceFound _ _) = "NoInstanceFound"-errorCode (DuplicateLabel _ _) = "DuplicateLabel"-errorCode (DuplicateValueDeclaration _) = "DuplicateValueDeclaration"-errorCode (ArgListLengthsDiffer _) = "ArgListLengthsDiffer"-errorCode (OverlappingArgNames _) = "OverlappingArgNames"-errorCode (MissingClassMember _) = "MissingClassMember"-errorCode (ExpectedType _) = "ExpectedType"-errorCode (IncorrectConstructorArity _) = "IncorrectConstructorArity"-errorCode SubsumptionCheckFailed = "SubsumptionCheckFailed"-errorCode (ExprDoesNotHaveType _ _) = "ExprDoesNotHaveType"-errorCode (PropertyIsMissing _ _) = "PropertyIsMissing"-errorCode (ErrorUnifyingTypes _ _ _) = "ErrorUnifyingTypes"-errorCode (CannotApplyFunction _ _) = "CannotApplyFunction"-errorCode TypeSynonymInstance = "TypeSynonymInstance"-errorCode InvalidNewtype = "InvalidNewtype"-errorCode (InvalidInstanceHead _) = "InvalidInstanceHead"-errorCode (TransitiveExportError _ _) = "TransitiveExportError"-errorCode (NotYetDefined _ e) = errorCode e-errorCode (ErrorInExpression _ e) = errorCode e-errorCode (ErrorInModule _ e) = errorCode e-errorCode (ErrorInInstance _ _ e) = errorCode e-errorCode (ErrorInSubsumption _ _ e) = errorCode e-errorCode (ErrorCheckingType _ _ e) = errorCode e-errorCode (ErrorCheckingKind _ e) = errorCode e-errorCode (ErrorInferringType _ e) = errorCode e-errorCode (ErrorInApplication _ _ _ e) = errorCode e-errorCode (ErrorInDataConstructor _ e) = errorCode e-errorCode (ErrorInTypeConstructor _ e) = errorCode e-errorCode (ErrorInBindingGroup _ e) = errorCode e-errorCode (ErrorInDataBindingGroup e) = errorCode e-errorCode (ErrorInTypeSynonym _ e) = errorCode e-errorCode (ErrorInValueDeclaration _ e) = errorCode e-errorCode (ErrorInForeignImport _ e) = errorCode e-errorCode (PositionedError _ e) = errorCode e- --- |--- A stack trace for an error----newtype MultipleErrors = MultipleErrors - { runMultipleErrors :: [ErrorMessage] } deriving (Show, Monoid)- -instance UnificationError Type MultipleErrors where- occursCheckFailed = errorMessage . occursCheckFailed- -instance UnificationError Kind MultipleErrors where- occursCheckFailed = errorMessage . occursCheckFailed---- |--- Create an error set from a single error message----errorMessage :: ErrorMessage -> MultipleErrors-errorMessage err = MultipleErrors [err]---- |--- Lift a function on ErrorMessage to a function on MultipleErrors----onErrorMessages :: (ErrorMessage -> ErrorMessage) -> MultipleErrors -> MultipleErrors-onErrorMessages f = MultipleErrors . map f . runMultipleErrors---- |--- Pretty print a single error, simplifying if necessary----prettyPrintSingleError :: Bool -> ErrorMessage -> Box.Box-prettyPrintSingleError full e = prettyPrintErrorMessage (if full then e else simplifyErrorMessage e)- where- -- |- -- Pretty print an ErrorMessage- --- prettyPrintErrorMessage :: ErrorMessage -> Box.Box- prettyPrintErrorMessage em =- paras- [ go em- , line ("See " ++ wikiUri ++ " for more information, or to contribute content related to this error.") - ]- where- wikiUri :: String- wikiUri = "https://github.com/purescript/purescript/wiki/Error-Code-" ++ errorCode e- - go :: ErrorMessage -> Box.Box- go InvalidDoBind = line "Bind statement cannot be the last statement in a do block"- go InvalidDoLet = line "Let statement cannot be the last statement in a do block"- go CannotReorderOperators = line "Unable to reorder operators"- go UnspecifiedSkolemScope = line "Skolem variable scope is unspecified"- go OverlappingNamesInLet = line "Overlapping names in let binding."- go (InfiniteType ty) = paras [ line "Infinite type detected: "- , indent $ line $ prettyPrintType ty- ]- go (InfiniteKind ki) = paras [ line "Infinite kind detected: "- , indent $ line $ prettyPrintKind ki- ]- go (MultipleFixities name) = line $ "Multiple fixity declarations for " ++ show name- go (OrphanTypeDeclaration nm) = line $ "Orphan type declaration for " ++ show nm- go (OrphanFixityDeclaration op) = line $ "Orphan fixity declaration for " ++ show op- go (RedefinedModule name) = line $ "Module " ++ show name ++ " has been defined multiple times"- go (RedefinedIdent name) = line $ "Name " ++ show name ++ " has been defined multiple times"- go (UnknownModule mn) = line $ "Unknown module " ++ show mn- go (UnknownType name) = line $ "Unknown type " ++ show name- go (UnknownTypeClass name) = line $ "Unknown type class " ++ show name- go (UnknownValue name) = line $ "Unknown value " ++ show name- go (UnknownTypeConstructor name) = line $ "Unknown type constructor " ++ show name- go (UnknownDataConstructor dc tc) = line $ "Unknown data constructor " ++ show dc ++ foldMap ((" for type constructor " ++) . show) tc- go (ConflictingImport nm mn) = line $ "Declaration " ++ nm ++ " conflicts with import " ++ show mn - go (ConflictingImports nm m1 m2) = line $ "Conflicting imports for " ++ nm ++ " from modules " ++ show m1 ++ " and " ++ show m2- go (ConflictingTypeDecls nm) = line $ "Conflicting type declarations for " ++ show nm- go (ConflictingCtorDecls nm) = line $ "Conflicting data constructor declarations for " ++ show nm- go (TypeConflictsWithClass nm) = line $ "Type " ++ show nm ++ " conflicts with type class declaration of the same name"- go (CtorConflictsWithClass nm) = line $ "Data constructor " ++ show nm ++ " conflicts with type class declaration of the same name"- go (ClassConflictsWithType nm) = line $ "Type class " ++ show nm ++ " conflicts with type declaration of the same name"- go (ClassConflictsWithCtor nm) = line $ "Type class " ++ show nm ++ " conflicts with data constructor declaration of the same name"- go (DuplicateClassExport nm) = line $ "Duplicate export declaration for type class " ++ show nm- go (DuplicateValueExport nm) = line $ "Duplicate export declaration for value " ++ show nm- go (CycleInDeclaration nm) = line $ "Cycle in declaration of " ++ show nm- go (NotYetDefined names err) = paras [ line $ "The following are not yet defined here: " ++ intercalate ", " (map show names) ++ ":"- , indent $ go err- ]- go (CycleInTypeSynonym pn) = line $ "Cycle in type synonym" ++ foldMap ((" " ++) . show) pn- go (NameIsUndefined ident) = line $ show ident ++ " is undefined"- go (NameNotInScope ident) = line $ show ident ++ " may not be defined in the current scope"- go (UndefinedTypeVariable name) = line $ "Type variable " ++ show name ++ " is undefined"- go (PartiallyAppliedSynonym name) = line $ "Partially applied type synonym " ++ show name- go (EscapedSkolem binding) = paras $ [ line "Rigid/skolem type variable has escaped." ]- <> foldMap (\expr -> [ line "Relevant expression: "- , indent $ line $ prettyPrintValue expr - ]) binding- go (TypesDoNotUnify t1 t2) = paras [ line "Cannot unify type"- , indent $ line $ prettyPrintType t1- , line "with type"- , indent $ line $ prettyPrintType t2- ]- go (KindsDoNotUnify k1 k2) = paras [ line "Cannot unify kind"- , indent $ line $ prettyPrintKind k1- , line "with kind"- , indent $ line $ prettyPrintKind k2- ]- go (ConstrainedTypeUnified t1 t2) = paras [ line "Cannot unify constrained type"- , indent $ line $ prettyPrintType t1- , line "with type"- , indent $ line $ prettyPrintType t2- ]- go (OverlappingInstances nm ts ds) = paras [ line $ "Overlapping instances found for " ++ show nm ++ " " ++ unwords (map prettyPrintTypeAtom ts) ++ ":"- , paras $ map prettyPrintDictionaryValue ds- ]- go (NoInstanceFound nm ts) = line $ "No instance found for " ++ show nm ++ " " ++ unwords (map prettyPrintTypeAtom ts)- go (DuplicateLabel l expr) = paras $ [ line $ "Duplicate label " ++ show l ++ " in row." ]- <> foldMap (\expr' -> [ line "Relevant expression: "- , indent $ line $ prettyPrintValue expr' - ]) expr- go (DuplicateTypeArgument name) = line $ "Duplicate type argument " ++ show name- go (DuplicateValueDeclaration nm) = line $ "Duplicate value declaration for " ++ show nm- go (ArgListLengthsDiffer ident) = line $ "Argument list lengths differ in declaration " ++ show ident- go (OverlappingArgNames ident) = line $ "Overlapping names in function/binder" ++ foldMap ((" in declaration" ++) . show) ident- go (MissingClassMember ident) = line $ "Member " ++ show ident ++ " has not been implemented"- go (ExpectedType kind) = line $ "Expected type of kind *, was " ++ prettyPrintKind kind- go (IncorrectConstructorArity nm) = line $ "Wrong number of arguments to constructor " ++ show nm- go SubsumptionCheckFailed = line $ "Unable to check type subsumption"- go (ExprDoesNotHaveType expr ty) = paras [ line "Expression"- , indent $ line $ prettyPrintValue expr- , line "does not have type"- , indent $ line $ prettyPrintType ty- ]- go (PropertyIsMissing prop row) = line $ "Row " ++ prettyPrintRow row ++ " lacks required property " ++ show prop- go (CannotApplyFunction fn arg) = paras [ line "Cannot apply function of type"- , indent $ line $ prettyPrintType fn- , line "to argument"- , indent $ line $ prettyPrintValue arg- ]- go TypeSynonymInstance = line "Type synonym instances are disallowed"- go InvalidNewtype = line "Newtypes must define a single constructor with a single argument"- go (InvalidInstanceHead ty) = paras [ line "Invalid type in class instance head:"- , indent $ line $ prettyPrintType ty- ]- go (TransitiveExportError x ys) = paras $ (line $ "An export for " ++ prettyPrintExport x ++ " requires the following to also be exported: ")- : map (line . prettyPrintExport) ys- go (ErrorUnifyingTypes t1 t2 err) = paras [ line "Error unifying type "- , indent $ line $ prettyPrintType t1- , line "with type"- , indent $ line $ prettyPrintType t2- , go err- ]- go (ErrorInExpression expr err) = paras [ line "Error in expression:"- , indent $ line $ prettyPrintValue expr- , go err- ]- go (ErrorInModule mn err) = paras [ line $ "Error in module " ++ show mn ++ ":"- , go err- ]- go (ErrorInSubsumption t1 t2 err) = paras [ line "Error checking that type "- , indent $ line $ prettyPrintType t1- , line "subsumes type"- , indent $ line $ prettyPrintType t2- , go err- ]- go (ErrorInInstance name ts err) = paras [ line $ "Error in type class instance " ++ show name ++ " " ++ unwords (map prettyPrintTypeAtom ts) ++ ":"- , go err- ]- go (ErrorCheckingKind ty err) = paras [ line "Error checking kind of type "- , indent $ line $ prettyPrintType ty- , go err- ]- go (ErrorInferringType expr err) = paras [ line "Error inferring type of value "- , indent $ line $ prettyPrintValue expr- , go err- ]- go (ErrorCheckingType expr ty err) = paras [ line "Error checking that value "- , indent $ line $ prettyPrintValue expr- , line "has type"- , indent $ line $ prettyPrintType ty- , go err- ]- go (ErrorInApplication f t a err) = paras [ line "Error applying function"- , indent $ line $ prettyPrintValue f- , line "of type"- , indent $ line $ prettyPrintType t- , line "to argument"- , indent $ line $ prettyPrintValue a- , go err- ]- go (ErrorInDataConstructor nm err) = paras [ line $ "Error in data constructor " ++ show nm ++ ":"- , go err- ]- go (ErrorInTypeConstructor nm err) = paras [ line $ "Error in type constructor " ++ show nm ++ ":"- , go err- ]- go (ErrorInBindingGroup nms err) = paras [ line $ "Error in binding group " ++ intercalate ", " (map show nms) ++ ":"- , go err- ]- go (ErrorInDataBindingGroup err) = paras [ line $ "Error in data binding group:"- , go err- ]- go (ErrorInTypeSynonym name err) = paras [ line $ "Error in type synonym " ++ show name ++ ":"- , go err- ]- go (ErrorInValueDeclaration n err) = paras [ line $ "Error in value declaration " ++ show n ++ ":"- , go err- ]- go (ErrorInForeignImport nm err) = paras [ line $ "Error in foreign import " ++ show nm ++ ":"- , go err- ]- go (PositionedError pos err) = paras [ line $ "Error at " ++ show pos ++ ":"- , indent $ go err- ]-- line :: String -> Box.Box- line = Box.text-- paras :: [Box.Box] -> Box.Box- paras = Box.vcat Box.left-- indent :: Box.Box -> Box.Box- indent = Box.moveRight 2-- -- |- -- Render a DictionaryValue fit for human consumption in error messages- --- prettyPrintDictionaryValue :: DictionaryValue -> Box.Box- prettyPrintDictionaryValue (LocalDictionaryValue _) = line "Dictionary in scope"- prettyPrintDictionaryValue (GlobalDictionaryValue nm) = line (show nm)- prettyPrintDictionaryValue (DependentDictionaryValue nm args) = paras [ line $ (show nm) ++ " via"- , indent $ paras $ map prettyPrintDictionaryValue args- ]- prettyPrintDictionaryValue (SubclassDictionaryValue sup nm _) = paras [ line $ (show nm) ++ " via superclass"- , indent $ prettyPrintDictionaryValue sup- ]- - -- |- -- Pretty print and export declaration- -- - prettyPrintExport :: DeclarationRef -> String- prettyPrintExport (TypeRef pn _) = show pn- prettyPrintExport (ValueRef ident) = show ident- prettyPrintExport (TypeClassRef pn) = show pn- prettyPrintExport (TypeInstanceRef ident) = show ident- prettyPrintExport (PositionedDeclarationRef _ _ ref) = prettyPrintExport ref-- -- |- -- Simplify an error message- --- simplifyErrorMessage :: ErrorMessage -> ErrorMessage- simplifyErrorMessage = unwrap Nothing- where- unwrap :: Maybe SourceSpan -> ErrorMessage -> ErrorMessage- unwrap pos (ErrorInExpression _ err) = unwrap pos err- unwrap pos (ErrorInInstance name ts err) = ErrorInInstance name ts (unwrap pos err)- unwrap pos (ErrorInSubsumption t1 t2 err) = ErrorInSubsumption t1 t2 (unwrap pos err)- unwrap pos (ErrorUnifyingTypes _ _ err) = unwrap pos err- unwrap pos (ErrorInferringType _ err) = unwrap pos err- unwrap pos (ErrorCheckingType _ _ err) = unwrap pos err- unwrap pos (ErrorCheckingKind ty err) = ErrorCheckingKind ty (unwrap pos err)- unwrap pos (ErrorInModule mn err) = ErrorInModule mn (unwrap pos err)- unwrap pos (ErrorInApplication _ _ _ err) = unwrap pos err- unwrap pos (ErrorInDataConstructor nm err) = ErrorInDataConstructor nm (unwrap pos err)- unwrap pos (ErrorInTypeConstructor nm err) = ErrorInTypeConstructor nm (unwrap pos err)- unwrap pos (ErrorInBindingGroup nms err) = ErrorInBindingGroup nms (unwrap pos err)- unwrap pos (ErrorInDataBindingGroup err) = ErrorInDataBindingGroup (unwrap pos err)- unwrap pos (ErrorInTypeSynonym nm err) = ErrorInTypeSynonym nm (unwrap pos err)- unwrap pos (ErrorInValueDeclaration nm err) = ErrorInValueDeclaration nm (unwrap pos err)- unwrap pos (ErrorInForeignImport nm err) = ErrorInForeignImport nm (unwrap pos err)- unwrap pos (NotYetDefined ns err) = NotYetDefined ns (unwrap pos err)- unwrap _ (PositionedError pos err) = unwrap (Just pos) err- unwrap pos other = wrap pos other- - wrap :: Maybe SourceSpan -> ErrorMessage -> ErrorMessage- wrap Nothing = id- wrap (Just pos) = PositionedError pos---- |--- Pretty print multiple errors----prettyPrintMultipleErrors :: Bool -> MultipleErrors -> String-prettyPrintMultipleErrors full (MultipleErrors [e]) = renderBox $- prettyPrintSingleError full e -prettyPrintMultipleErrors full (MultipleErrors es) = renderBox $- Box.vcat Box.left [ Box.text "Multiple errors:"- , Box.vsep 1 Box.left $ map (Box.moveRight 2 . prettyPrintSingleError full) es- ]--renderBox :: Box.Box -> String-renderBox = unlines . map trimEnd . lines . Box.render- where- trimEnd = reverse . dropWhile (== ' ') . reverse---- |--- Interpret multiple errors in a monad supporting errors----interpretMultipleErrors :: (MonadError String m) => Bool -> Either MultipleErrors a -> m a-interpretMultipleErrors printFullStack = either (throwError . prettyPrintMultipleErrors printFullStack) return---- |--- Rethrow an error with a more detailed error message in the case of failure----rethrow :: (MonadError e m) => (e -> e) -> m a -> m a-rethrow f = flip catchError $ \e -> throwError (f e)---- |--- Rethrow an error with source position information----rethrowWithPosition :: (MonadError MultipleErrors m) => SourceSpan -> m a -> m a-rethrowWithPosition pos = rethrow (onErrorMessages withPosition)- where- withPosition :: ErrorMessage -> ErrorMessage- withPosition (PositionedError _ err) = withPosition err- withPosition err = PositionedError pos err---- |--- Collect errors in in parallel----parU :: (MonadError MultipleErrors m, Functor m) => [a] -> (a -> m b) -> m [b]-parU xs f = forM xs (withError . f) >>= collectErrors- where- withError :: (MonadError MultipleErrors m, Functor m) => m a -> m (Either MultipleErrors a)- withError u = catchError (Right <$> u) (return . Left)-- collectErrors :: (MonadError MultipleErrors m, Functor m) => [Either MultipleErrors a] -> m [a]- collectErrors es = case lefts es of- [] -> return $ rights es- errs -> throwError $ fold errs+{-# LANGUAGE DeriveAnyClass #-}+module Language.PureScript.Errors+ ( module Language.PureScript.AST+ , module Language.PureScript.Errors+ ) where++import Prelude+import Protolude (unsnoc)++import Control.Arrow ((&&&))+import Control.DeepSeq (NFData)+import Control.Lens (both, head1, over)+import Control.Monad (forM, unless)+import Control.Monad.Error.Class (MonadError(..))+import Control.Monad.Trans.State.Lazy (State, evalState, get, put)+import Control.Monad.Writer (Last(..), MonadWriter(..), censor)+import Data.Bifunctor (first, second)+import Data.Bitraversable (bitraverse)+import Data.Char (isSpace)+import Data.Containers.ListUtils (nubOrdOn)+import Data.Either (partitionEithers)+import Data.Foldable (fold)+import Data.Function (on)+import Data.Functor (($>))+import Data.Functor.Identity (Identity(..))+import Data.List (transpose, nubBy, partition, dropWhileEnd, sortOn, uncons)+import Data.List.NonEmpty qualified as NEL+import Data.List.NonEmpty (NonEmpty((:|)))+import Data.Maybe (maybeToList, fromMaybe, isJust, mapMaybe)+import Data.Map qualified as M+import Data.Ord (Down(..))+import Data.Set qualified as S+import Data.Text qualified as T+import Data.Text (Text)+import Data.Traversable (for)+import GHC.Generics (Generic)+import GHC.Stack qualified+import Language.PureScript.AST+import Language.PureScript.Bundle qualified as Bundle+import Language.PureScript.Constants.Libs qualified as C+import Language.PureScript.Constants.Prim qualified as C+import Language.PureScript.Crash (internalError)+import Language.PureScript.CST.Errors qualified as CST+import Language.PureScript.CST.Print qualified as CST+import Language.PureScript.Label (Label(..))+import Language.PureScript.Names+import Language.PureScript.Pretty (prettyPrintBinderAtom, prettyPrintLabel, prettyPrintObjectKey, prettyPrintSuggestedType, prettyPrintValue, typeAsBox, typeAtomAsBox, typeDiffAsBox)+import Language.PureScript.Pretty.Common (endWith)+import Language.PureScript.PSString (decodeStringWithReplacement)+import Language.PureScript.Roles (Role, displayRole)+import Language.PureScript.Traversals (sndM)+import Language.PureScript.Types (Constraint(..), ConstraintData(..), RowListItem(..), SourceConstraint, SourceType, Type(..), eraseForAllKindAnnotations, eraseKindApps, everywhereOnTypesTopDownM, getAnnForType, isMonoType, overConstraintArgs, rowFromList, rowToList, srcTUnknown)+import Language.PureScript.Publish.BoxesHelpers qualified as BoxHelpers+import System.Console.ANSI qualified as ANSI+import System.FilePath (makeRelative)+import Text.PrettyPrint.Boxes qualified as Box+import Witherable (wither)++-- | A type of error messages+data SimpleErrorMessage+ = InternalCompilerError Text Text+ | ModuleNotFound ModuleName+ | ErrorParsingFFIModule FilePath (Maybe Bundle.ErrorMessage)+ | ErrorParsingCSTModule CST.ParserError+ | WarningParsingCSTModule CST.ParserWarning+ | MissingFFIModule ModuleName+ | UnnecessaryFFIModule ModuleName FilePath+ | MissingFFIImplementations ModuleName [Ident]+ | UnusedFFIImplementations ModuleName [Ident]+ | InvalidFFIIdentifier ModuleName Text+ | DeprecatedFFIPrime ModuleName Text+ | DeprecatedFFICommonJSModule ModuleName FilePath+ | UnsupportedFFICommonJSExports ModuleName [Text]+ | UnsupportedFFICommonJSImports ModuleName [Text]+ | FileIOError Text Text -- ^ A description of what we were trying to do, and the error which occurred+ | InfiniteType SourceType+ | InfiniteKind SourceType+ | MultipleValueOpFixities (OpName 'ValueOpName)+ | MultipleTypeOpFixities (OpName 'TypeOpName)+ | OrphanTypeDeclaration Ident+ | OrphanKindDeclaration (ProperName 'TypeName)+ | OrphanRoleDeclaration (ProperName 'TypeName)+ | RedefinedIdent Ident+ | OverlappingNamesInLet Ident+ | UnknownName (Qualified Name)+ | UnknownImport ModuleName Name+ | UnknownImportDataConstructor ModuleName (ProperName 'TypeName) (ProperName 'ConstructorName)+ | UnknownExport Name+ | UnknownExportDataConstructor (ProperName 'TypeName) (ProperName 'ConstructorName)+ | ScopeConflict Name [ModuleName]+ | ScopeShadowing Name (Maybe ModuleName) [ModuleName]+ | DeclConflict Name Name+ | ExportConflict (Qualified Name) (Qualified Name)+ | DuplicateModule ModuleName+ | DuplicateTypeClass (ProperName 'ClassName) SourceSpan+ | DuplicateInstance Ident SourceSpan+ | DuplicateTypeArgument Text+ | InvalidDoBind+ | InvalidDoLet+ | CycleInDeclaration Ident+ | CycleInTypeSynonym (NEL.NonEmpty (ProperName 'TypeName))+ | CycleInTypeClassDeclaration (NEL.NonEmpty (Qualified (ProperName 'ClassName)))+ | CycleInKindDeclaration (NEL.NonEmpty (Qualified (ProperName 'TypeName)))+ | CycleInModules (NEL.NonEmpty ModuleName)+ | NameIsUndefined Ident+ | UndefinedTypeVariable (ProperName 'TypeName)+ | PartiallyAppliedSynonym (Qualified (ProperName 'TypeName))+ | EscapedSkolem Text (Maybe SourceSpan) SourceType+ | TypesDoNotUnify SourceType SourceType+ | KindsDoNotUnify SourceType SourceType+ | ConstrainedTypeUnified SourceType SourceType+ | OverlappingInstances (Qualified (ProperName 'ClassName)) [SourceType] [Qualified (Either SourceType Ident)]+ | NoInstanceFound+ SourceConstraint -- ^ constraint that could not be solved+ [Qualified (Either SourceType Ident)] -- ^ a list of instances that stopped further progress in instance chains due to ambiguity+ UnknownsHint -- ^ whether eliminating unknowns with annotations might help or if visible type applications are required+ | AmbiguousTypeVariables SourceType [(Text, Int)]+ | UnknownClass (Qualified (ProperName 'ClassName))+ | PossiblyInfiniteInstance (Qualified (ProperName 'ClassName)) [SourceType]+ | PossiblyInfiniteCoercibleInstance+ | CannotDerive (Qualified (ProperName 'ClassName)) [SourceType]+ | InvalidDerivedInstance (Qualified (ProperName 'ClassName)) [SourceType] Int+ | ExpectedTypeConstructor (Qualified (ProperName 'ClassName)) [SourceType] SourceType+ | InvalidNewtypeInstance (Qualified (ProperName 'ClassName)) [SourceType]+ | MissingNewtypeSuperclassInstance (Qualified (ProperName 'ClassName)) (Qualified (ProperName 'ClassName)) [SourceType]+ | UnverifiableSuperclassInstance (Qualified (ProperName 'ClassName)) (Qualified (ProperName 'ClassName)) [SourceType]+ | CannotFindDerivingType (ProperName 'TypeName)+ | DuplicateLabel Label (Maybe Expr)+ | DuplicateValueDeclaration Ident+ | ArgListLengthsDiffer Ident+ | OverlappingArgNames (Maybe Ident)+ | MissingClassMember (NEL.NonEmpty (Ident, SourceType))+ | ExtraneousClassMember Ident (Qualified (ProperName 'ClassName))+ | ExpectedType SourceType SourceType+ -- | constructor name, expected argument count, actual argument count+ | IncorrectConstructorArity (Qualified (ProperName 'ConstructorName)) Int Int+ | ExprDoesNotHaveType Expr SourceType+ | PropertyIsMissing Label+ | AdditionalProperty Label+ | OrphanInstance Ident (Qualified (ProperName 'ClassName)) (S.Set ModuleName) [SourceType]+ | InvalidNewtype (ProperName 'TypeName)+ | InvalidInstanceHead SourceType+ | TransitiveExportError DeclarationRef [DeclarationRef]+ | TransitiveDctorExportError DeclarationRef [ProperName 'ConstructorName]+ | HiddenConstructors DeclarationRef (Qualified (ProperName 'ClassName))+ | ShadowedName Ident+ | ShadowedTypeVar Text+ | UnusedTypeVar Text+ | UnusedName Ident+ | UnusedDeclaration Ident+ | WildcardInferredType SourceType Context+ | HoleInferredType Text SourceType Context (Maybe TypeSearch)+ | MissingTypeDeclaration Ident SourceType+ | MissingKindDeclaration KindSignatureFor (ProperName 'TypeName) SourceType+ | OverlappingPattern [[Binder]] Bool+ | IncompleteExhaustivityCheck+ | ImportHidingModule ModuleName+ | UnusedImport ModuleName (Maybe ModuleName)+ | UnusedExplicitImport ModuleName [Name] (Maybe ModuleName) [DeclarationRef]+ | UnusedDctorImport ModuleName (ProperName 'TypeName) (Maybe ModuleName) [DeclarationRef]+ | UnusedDctorExplicitImport ModuleName (ProperName 'TypeName) [ProperName 'ConstructorName] (Maybe ModuleName) [DeclarationRef]+ | DuplicateSelectiveImport ModuleName+ | DuplicateImport ModuleName ImportDeclarationType (Maybe ModuleName)+ | DuplicateImportRef Name+ | DuplicateExportRef Name+ | IntOutOfRange Integer Text Integer Integer+ | ImplicitQualifiedImport ModuleName ModuleName [DeclarationRef]+ | ImplicitQualifiedImportReExport ModuleName ModuleName [DeclarationRef]+ | ImplicitImport ModuleName [DeclarationRef]+ | HidingImport ModuleName [DeclarationRef]+ | CaseBinderLengthDiffers Int [Binder]+ | IncorrectAnonymousArgument+ | InvalidOperatorInBinder (Qualified (OpName 'ValueOpName)) (Qualified Ident)+ | CannotGeneralizeRecursiveFunction Ident SourceType+ | CannotDeriveNewtypeForData (ProperName 'TypeName)+ | ExpectedWildcard (ProperName 'TypeName)+ | CannotUseBindWithDo Ident+ -- | instance name, type class, expected argument count, actual argument count+ | ClassInstanceArityMismatch Ident (Qualified (ProperName 'ClassName)) Int Int+ -- | a user-defined warning raised by using the Warn type class+ | UserDefinedWarning SourceType+ | CannotDefinePrimModules ModuleName+ | MixedAssociativityError (NEL.NonEmpty (Qualified (OpName 'AnyOpName), Associativity))+ | NonAssociativeError (NEL.NonEmpty (Qualified (OpName 'AnyOpName)))+ | QuantificationCheckFailureInKind Text+ | QuantificationCheckFailureInType [Int] SourceType+ | VisibleQuantificationCheckFailureInType Text+ | UnsupportedTypeInKind SourceType+ -- | Declared role was more permissive than inferred.+ | RoleMismatch+ Text -- ^ Type variable in question+ Role -- ^ inferred role+ Role -- ^ declared role+ | InvalidCoercibleInstanceDeclaration [SourceType]+ | UnsupportedRoleDeclaration+ | RoleDeclarationArityMismatch (ProperName 'TypeName) Int Int+ | DuplicateRoleDeclaration (ProperName 'TypeName)+ | CannotDeriveInvalidConstructorArg (Qualified (ProperName 'ClassName)) [Qualified (ProperName 'ClassName)] Bool+ | CannotSkipTypeApplication SourceType+ | CannotApplyExpressionOfTypeOnType SourceType SourceType+ deriving (Show, Generic, NFData)++data ErrorMessage = ErrorMessage+ [ErrorMessageHint]+ SimpleErrorMessage+ deriving (Show, Generic, NFData)++newtype ErrorSuggestion = ErrorSuggestion Text++-- | Get the source span for an error+errorSpan :: ErrorMessage -> Maybe (NEL.NonEmpty SourceSpan)+errorSpan = findHint matchPE <> findHint matchRP+ where+ matchPE (PositionedError sss) = Just sss+ matchPE _ = Nothing+ matchRP (RelatedPositions sss) = Just sss+ matchRP _ = Nothing++-- | Get the module name for an error+errorModule :: ErrorMessage -> Maybe ModuleName+errorModule = findHint matchModule+ where+ matchModule (ErrorInModule mn) = Just mn+ matchModule _ = Nothing++findHint :: (ErrorMessageHint -> Maybe a) -> ErrorMessage -> Maybe a+findHint f (ErrorMessage hints _) = getLast . foldMap (Last . f) $ hints++-- | Remove the module name and span hints from an error+stripModuleAndSpan :: ErrorMessage -> ErrorMessage+stripModuleAndSpan (ErrorMessage hints e) = ErrorMessage (filter (not . shouldStrip) hints) e+ where+ shouldStrip (ErrorInModule _) = True+ shouldStrip (PositionedError _) = True+ shouldStrip _ = False++-- | Get the error code for a particular error type+errorCode :: ErrorMessage -> Text+errorCode em = case unwrapErrorMessage em of+ InternalCompilerError{} -> "InternalCompilerError"+ ModuleNotFound{} -> "ModuleNotFound"+ ErrorParsingFFIModule{} -> "ErrorParsingFFIModule"+ ErrorParsingCSTModule{} -> "ErrorParsingModule"+ WarningParsingCSTModule{} -> "WarningParsingModule"+ MissingFFIModule{} -> "MissingFFIModule"+ UnnecessaryFFIModule{} -> "UnnecessaryFFIModule"+ MissingFFIImplementations{} -> "MissingFFIImplementations"+ UnusedFFIImplementations{} -> "UnusedFFIImplementations"+ InvalidFFIIdentifier{} -> "InvalidFFIIdentifier"+ DeprecatedFFIPrime{} -> "DeprecatedFFIPrime"+ DeprecatedFFICommonJSModule {} -> "DeprecatedFFICommonJSModule"+ UnsupportedFFICommonJSExports {} -> "UnsupportedFFICommonJSExports"+ UnsupportedFFICommonJSImports {} -> "UnsupportedFFICommonJSImports"+ FileIOError{} -> "FileIOError"+ InfiniteType{} -> "InfiniteType"+ InfiniteKind{} -> "InfiniteKind"+ MultipleValueOpFixities{} -> "MultipleValueOpFixities"+ MultipleTypeOpFixities{} -> "MultipleTypeOpFixities"+ OrphanTypeDeclaration{} -> "OrphanTypeDeclaration"+ OrphanKindDeclaration{} -> "OrphanKindDeclaration"+ OrphanRoleDeclaration{} -> "OrphanRoleDeclaration"+ RedefinedIdent{} -> "RedefinedIdent"+ OverlappingNamesInLet{} -> "OverlappingNamesInLet"+ UnknownName{} -> "UnknownName"+ UnknownImport{} -> "UnknownImport"+ UnknownImportDataConstructor{} -> "UnknownImportDataConstructor"+ UnknownExport{} -> "UnknownExport"+ UnknownExportDataConstructor{} -> "UnknownExportDataConstructor"+ ScopeConflict{} -> "ScopeConflict"+ ScopeShadowing{} -> "ScopeShadowing"+ DeclConflict{} -> "DeclConflict"+ ExportConflict{} -> "ExportConflict"+ DuplicateModule{} -> "DuplicateModule"+ DuplicateTypeClass{} -> "DuplicateTypeClass"+ DuplicateInstance{} -> "DuplicateInstance"+ DuplicateTypeArgument{} -> "DuplicateTypeArgument"+ InvalidDoBind -> "InvalidDoBind"+ InvalidDoLet -> "InvalidDoLet"+ CycleInDeclaration{} -> "CycleInDeclaration"+ CycleInTypeSynonym{} -> "CycleInTypeSynonym"+ CycleInTypeClassDeclaration{} -> "CycleInTypeClassDeclaration"+ CycleInKindDeclaration{} -> "CycleInKindDeclaration"+ CycleInModules{} -> "CycleInModules"+ NameIsUndefined{} -> "NameIsUndefined"+ UndefinedTypeVariable{} -> "UndefinedTypeVariable"+ PartiallyAppliedSynonym{} -> "PartiallyAppliedSynonym"+ EscapedSkolem{} -> "EscapedSkolem"+ TypesDoNotUnify{} -> "TypesDoNotUnify"+ KindsDoNotUnify{} -> "KindsDoNotUnify"+ ConstrainedTypeUnified{} -> "ConstrainedTypeUnified"+ OverlappingInstances{} -> "OverlappingInstances"+ NoInstanceFound{} -> "NoInstanceFound"+ AmbiguousTypeVariables{} -> "AmbiguousTypeVariables"+ UnknownClass{} -> "UnknownClass"+ PossiblyInfiniteInstance{} -> "PossiblyInfiniteInstance"+ PossiblyInfiniteCoercibleInstance -> "PossiblyInfiniteCoercibleInstance"+ CannotDerive{} -> "CannotDerive"+ InvalidNewtypeInstance{} -> "InvalidNewtypeInstance"+ MissingNewtypeSuperclassInstance{} -> "MissingNewtypeSuperclassInstance"+ UnverifiableSuperclassInstance{} -> "UnverifiableSuperclassInstance"+ InvalidDerivedInstance{} -> "InvalidDerivedInstance"+ ExpectedTypeConstructor{} -> "ExpectedTypeConstructor"+ CannotFindDerivingType{} -> "CannotFindDerivingType"+ DuplicateLabel{} -> "DuplicateLabel"+ DuplicateValueDeclaration{} -> "DuplicateValueDeclaration"+ ArgListLengthsDiffer{} -> "ArgListLengthsDiffer"+ OverlappingArgNames{} -> "OverlappingArgNames"+ MissingClassMember{} -> "MissingClassMember"+ ExtraneousClassMember{} -> "ExtraneousClassMember"+ ExpectedType{} -> "ExpectedType"+ IncorrectConstructorArity{} -> "IncorrectConstructorArity"+ ExprDoesNotHaveType{} -> "ExprDoesNotHaveType"+ PropertyIsMissing{} -> "PropertyIsMissing"+ AdditionalProperty{} -> "AdditionalProperty"+ OrphanInstance{} -> "OrphanInstance"+ InvalidNewtype{} -> "InvalidNewtype"+ InvalidInstanceHead{} -> "InvalidInstanceHead"+ TransitiveExportError{} -> "TransitiveExportError"+ TransitiveDctorExportError{} -> "TransitiveDctorExportError"+ HiddenConstructors{} -> "HiddenConstructors"+ ShadowedName{} -> "ShadowedName"+ UnusedName{} -> "UnusedName"+ UnusedDeclaration{} -> "UnusedDeclaration"+ ShadowedTypeVar{} -> "ShadowedTypeVar"+ UnusedTypeVar{} -> "UnusedTypeVar"+ WildcardInferredType{} -> "WildcardInferredType"+ HoleInferredType{} -> "HoleInferredType"+ MissingTypeDeclaration{} -> "MissingTypeDeclaration"+ MissingKindDeclaration{} -> "MissingKindDeclaration"+ OverlappingPattern{} -> "OverlappingPattern"+ IncompleteExhaustivityCheck{} -> "IncompleteExhaustivityCheck"+ ImportHidingModule{} -> "ImportHidingModule"+ UnusedImport{} -> "UnusedImport"+ UnusedExplicitImport{} -> "UnusedExplicitImport"+ UnusedDctorImport{} -> "UnusedDctorImport"+ UnusedDctorExplicitImport{} -> "UnusedDctorExplicitImport"+ DuplicateSelectiveImport{} -> "DuplicateSelectiveImport"+ DuplicateImport{} -> "DuplicateImport"+ DuplicateImportRef{} -> "DuplicateImportRef"+ DuplicateExportRef{} -> "DuplicateExportRef"+ IntOutOfRange{} -> "IntOutOfRange"+ ImplicitQualifiedImport{} -> "ImplicitQualifiedImport"+ ImplicitQualifiedImportReExport{} -> "ImplicitQualifiedImportReExport"+ ImplicitImport{} -> "ImplicitImport"+ HidingImport{} -> "HidingImport"+ CaseBinderLengthDiffers{} -> "CaseBinderLengthDiffers"+ IncorrectAnonymousArgument -> "IncorrectAnonymousArgument"+ InvalidOperatorInBinder{} -> "InvalidOperatorInBinder"+ CannotGeneralizeRecursiveFunction{} -> "CannotGeneralizeRecursiveFunction"+ CannotDeriveNewtypeForData{} -> "CannotDeriveNewtypeForData"+ ExpectedWildcard{} -> "ExpectedWildcard"+ CannotUseBindWithDo{} -> "CannotUseBindWithDo"+ ClassInstanceArityMismatch{} -> "ClassInstanceArityMismatch"+ UserDefinedWarning{} -> "UserDefinedWarning"+ CannotDefinePrimModules{} -> "CannotDefinePrimModules"+ MixedAssociativityError{} -> "MixedAssociativityError"+ NonAssociativeError{} -> "NonAssociativeError"+ QuantificationCheckFailureInKind {} -> "QuantificationCheckFailureInKind"+ QuantificationCheckFailureInType {} -> "QuantificationCheckFailureInType"+ VisibleQuantificationCheckFailureInType {} -> "VisibleQuantificationCheckFailureInType"+ UnsupportedTypeInKind {} -> "UnsupportedTypeInKind"+ RoleMismatch {} -> "RoleMismatch"+ InvalidCoercibleInstanceDeclaration {} -> "InvalidCoercibleInstanceDeclaration"+ UnsupportedRoleDeclaration {} -> "UnsupportedRoleDeclaration"+ RoleDeclarationArityMismatch {} -> "RoleDeclarationArityMismatch"+ DuplicateRoleDeclaration {} -> "DuplicateRoleDeclaration"+ CannotDeriveInvalidConstructorArg{} -> "CannotDeriveInvalidConstructorArg"+ CannotSkipTypeApplication{} -> "CannotSkipTypeApplication"+ CannotApplyExpressionOfTypeOnType{} -> "CannotApplyExpressionOfTypeOnType"++-- | A stack trace for an error+newtype MultipleErrors = MultipleErrors+ { runMultipleErrors :: [ErrorMessage]+ }+ deriving stock (Show)+ deriving newtype (Semigroup, Monoid, NFData)++-- | Check whether a collection of errors is empty or not.+nonEmpty :: MultipleErrors -> Bool+nonEmpty = not . null . runMultipleErrors++-- | Create an error set from a single simple error message+errorMessage :: SimpleErrorMessage -> MultipleErrors+errorMessage err = MultipleErrors [ErrorMessage [] err]++-- | Create an error set from a single simple error message and source annotation+errorMessage' :: SourceSpan -> SimpleErrorMessage -> MultipleErrors+errorMessage' ss err = MultipleErrors [ErrorMessage [positionedError ss] err]++-- | Create an error set from a single simple error message and source annotations+errorMessage'' :: NEL.NonEmpty SourceSpan -> SimpleErrorMessage -> MultipleErrors+errorMessage'' sss err = MultipleErrors [ErrorMessage [PositionedError sss] err]++-- | Create an error from multiple (possibly empty) source spans, reversed sorted.+errorMessage''' :: [SourceSpan] -> SimpleErrorMessage -> MultipleErrors+errorMessage''' sss err =+ maybe (errorMessage err) (flip errorMessage'' err)+ . NEL.nonEmpty+ . sortOn Down+ $ filter (/= NullSourceSpan) sss++-- | Create an error set from a single error message+singleError :: ErrorMessage -> MultipleErrors+singleError = MultipleErrors . pure++-- | Lift a function on ErrorMessage to a function on MultipleErrors+onErrorMessages :: (ErrorMessage -> ErrorMessage) -> MultipleErrors -> MultipleErrors+onErrorMessages f = MultipleErrors . map f . runMultipleErrors++-- | Add a hint to an error message+addHint :: ErrorMessageHint -> MultipleErrors -> MultipleErrors+addHint hint = addHints [hint]++-- | Add hints to an error message+addHints :: [ErrorMessageHint] -> MultipleErrors -> MultipleErrors+addHints hints = onErrorMessages $ \(ErrorMessage hints' se) -> ErrorMessage (hints ++ hints') se++-- | A map from rigid type variable name/unknown variable pairs to new variables.+data TypeMap = TypeMap+ { umSkolemMap :: M.Map Int (String, Int, Maybe SourceSpan)+ -- ^ a map from skolems to their new names, including source and naming info+ , umUnknownMap :: M.Map Int Int+ -- ^ a map from unification variables to their new names+ , umNextIndex :: Int+ -- ^ unknowns and skolems share a source of names during renaming, to+ -- avoid overlaps in error messages. This is the next label for either case.+ } deriving Show++defaultUnknownMap :: TypeMap+defaultUnknownMap = TypeMap M.empty M.empty 0++-- | How critical the issue is+data Level = Error | Warning deriving Show++-- | Extract nested error messages from wrapper errors+unwrapErrorMessage :: ErrorMessage -> SimpleErrorMessage+unwrapErrorMessage (ErrorMessage _ se) = se++replaceUnknowns :: SourceType -> State TypeMap SourceType+replaceUnknowns = everywhereOnTypesTopDownM replaceTypes where+ replaceTypes :: SourceType -> State TypeMap SourceType+ replaceTypes (TUnknown ann u) = do+ m <- get+ case M.lookup u (umUnknownMap m) of+ Nothing -> do+ let u' = umNextIndex m+ put $ m { umUnknownMap = M.insert u u' (umUnknownMap m), umNextIndex = u' + 1 }+ return (TUnknown ann u')+ Just u' -> return (TUnknown ann u')+ -- We intentionally remove the kinds from skolems, because they are never+ -- presented when pretty-printing. Any unknowns in those kinds shouldn't+ -- appear in the list of unknowns unless used somewhere else.+ replaceTypes (Skolem ann name _ s sko) = do+ m <- get+ case M.lookup s (umSkolemMap m) of+ Nothing -> do+ let s' = umNextIndex m+ put $ m { umSkolemMap = M.insert s (T.unpack name, s', Just (fst ann)) (umSkolemMap m), umNextIndex = s' + 1 }+ return (Skolem ann name Nothing s' sko)+ Just (_, s', _) -> return (Skolem ann name Nothing s' sko)+ replaceTypes other = return other++onTypesInErrorMessage :: (SourceType -> SourceType) -> ErrorMessage -> ErrorMessage+onTypesInErrorMessage f = runIdentity . onTypesInErrorMessageM (Identity . f)++onTypesInErrorMessageM :: Applicative m => (SourceType -> m SourceType) -> ErrorMessage -> m ErrorMessage+onTypesInErrorMessageM f (ErrorMessage hints simple) = ErrorMessage <$> traverse gHint hints <*> gSimple simple+ where+ gSimple (InfiniteType t) = InfiniteType <$> f t+ gSimple (TypesDoNotUnify t1 t2) = TypesDoNotUnify <$> f t1 <*> f t2+ gSimple (ConstrainedTypeUnified t1 t2) = ConstrainedTypeUnified <$> f t1 <*> f t2+ gSimple (ExprDoesNotHaveType e t) = ExprDoesNotHaveType e <$> f t+ gSimple (InvalidInstanceHead t) = InvalidInstanceHead <$> f t+ gSimple (NoInstanceFound con ambig unks) = NoInstanceFound <$> overConstraintArgs (traverse f) con <*> pure ambig <*> pure unks+ gSimple (AmbiguousTypeVariables t uis) = AmbiguousTypeVariables <$> f t <*> pure uis+ gSimple (OverlappingInstances cl ts insts) = OverlappingInstances cl <$> traverse f ts <*> traverse (traverse $ bitraverse f pure) insts+ gSimple (PossiblyInfiniteInstance cl ts) = PossiblyInfiniteInstance cl <$> traverse f ts+ gSimple (CannotDerive cl ts) = CannotDerive cl <$> traverse f ts+ gSimple (InvalidNewtypeInstance cl ts) = InvalidNewtypeInstance cl <$> traverse f ts+ gSimple (MissingNewtypeSuperclassInstance cl1 cl2 ts) = MissingNewtypeSuperclassInstance cl1 cl2 <$> traverse f ts+ gSimple (UnverifiableSuperclassInstance cl1 cl2 ts) = UnverifiableSuperclassInstance cl1 cl2 <$> traverse f ts+ gSimple (InvalidDerivedInstance cl ts n) = InvalidDerivedInstance cl <$> traverse f ts <*> pure n+ gSimple (ExpectedTypeConstructor cl ts ty) = ExpectedTypeConstructor cl <$> traverse f ts <*> f ty+ gSimple (ExpectedType ty k) = ExpectedType <$> f ty <*> pure k+ gSimple (OrphanInstance nm cl noms ts) = OrphanInstance nm cl noms <$> traverse f ts+ gSimple (WildcardInferredType ty ctx) = WildcardInferredType <$> f ty <*> traverse (sndM f) ctx+ gSimple (HoleInferredType name ty ctx env) = HoleInferredType name <$> f ty <*> traverse (sndM f) ctx <*> traverse (onTypeSearchTypesM f) env+ gSimple (MissingTypeDeclaration nm ty) = MissingTypeDeclaration nm <$> f ty+ gSimple (MissingKindDeclaration sig nm ty) = MissingKindDeclaration sig nm <$> f ty+ gSimple (CannotGeneralizeRecursiveFunction nm ty) = CannotGeneralizeRecursiveFunction nm <$> f ty+ gSimple (InvalidCoercibleInstanceDeclaration tys) = InvalidCoercibleInstanceDeclaration <$> traverse f tys+ gSimple other = pure other++ gHint (ErrorInSubsumption t1 t2) = ErrorInSubsumption <$> f t1 <*> f t2+ gHint (ErrorUnifyingTypes t1 t2) = ErrorUnifyingTypes <$> f t1 <*> f t2+ gHint (ErrorCheckingType e t) = ErrorCheckingType e <$> f t+ gHint (ErrorCheckingKind t k) = ErrorCheckingKind <$> f t <*> f k+ gHint (ErrorInferringKind t) = ErrorInferringKind <$> f t+ gHint (ErrorInApplication e1 t1 e2) = ErrorInApplication e1 <$> f t1 <*> pure e2+ gHint (ErrorInInstance cl ts) = ErrorInInstance cl <$> traverse f ts+ gHint (ErrorSolvingConstraint con) = ErrorSolvingConstraint <$> overConstraintArgs (traverse f) con+ gHint other = pure other++errorDocUri :: ErrorMessage -> Text+errorDocUri e = "https://github.com/purescript/documentation/blob/master/errors/" <> errorCode e <> ".md"++-- TODO Other possible suggestions:+-- WildcardInferredType - source span not small enough+-- DuplicateSelectiveImport - would require 2 ranges to remove and 1 insert+errorSuggestion :: SimpleErrorMessage -> Maybe ErrorSuggestion+errorSuggestion err =+ case err of+ UnusedImport{} -> emptySuggestion+ DuplicateImport{} -> emptySuggestion+ UnusedExplicitImport mn _ qual refs -> suggest $ importSuggestion mn refs qual+ UnusedDctorImport mn _ qual refs -> suggest $ importSuggestion mn refs qual+ UnusedDctorExplicitImport mn _ _ qual refs -> suggest $ importSuggestion mn refs qual+ ImplicitImport mn refs -> suggest $ importSuggestion mn refs Nothing+ ImplicitQualifiedImport mn asModule refs -> suggest $ importSuggestion mn refs (Just asModule)+ ImplicitQualifiedImportReExport mn asModule refs -> suggest $ importSuggestion mn refs (Just asModule)+ HidingImport mn refs -> suggest $ importSuggestion mn refs Nothing+ MissingTypeDeclaration ident ty -> suggest $ showIdent ident <> " :: " <> T.pack (prettyPrintSuggestedTypeSimplified ty) <> "\n"+ MissingKindDeclaration sig name ty -> suggest $ prettyPrintKindSignatureFor sig <> " " <> runProperName name <> " :: " <> T.pack (prettyPrintSuggestedTypeSimplified ty) <> "\n"+ WildcardInferredType ty _ -> suggest $ T.pack (prettyPrintSuggestedTypeSimplified ty)+ WarningParsingCSTModule pe -> do+ let toks = CST.errToks pe+ case CST.errType pe of+ CST.WarnDeprecatedRowSyntax -> do+ let kind = CST.printTokens $ drop 1 toks+ sugg | " " `T.isPrefixOf` kind = "Row" <> kind+ | otherwise = "Row " <> kind+ suggest sugg+ CST.WarnDeprecatedForeignKindSyntax -> suggest $ "data " <> CST.printTokens (drop 3 toks)+ CST.WarnDeprecatedKindImportSyntax -> suggest $ CST.printTokens $ drop 1 toks+ CST.WarnDeprecatedKindExportSyntax -> suggest $ CST.printTokens $ drop 1 toks+ CST.WarnDeprecatedCaseOfOffsideSyntax -> Nothing+ _ -> Nothing+ where+ emptySuggestion = Just $ ErrorSuggestion ""+ suggest = Just . ErrorSuggestion++ importSuggestion :: ModuleName -> [ DeclarationRef ] -> Maybe ModuleName -> Text+ importSuggestion mn refs qual =+ "import " <> runModuleName mn <> " (" <> T.intercalate ", " (mapMaybe prettyPrintRef refs) <> ")" <> qstr qual++ qstr :: Maybe ModuleName -> Text+ qstr (Just mn) = " as " <> runModuleName mn+ qstr Nothing = ""++suggestionSpan :: ErrorMessage -> Maybe SourceSpan+suggestionSpan e =+ -- The `NEL.head` is a bit arbitrary here, but I don't think we'll+ -- have errors-with-suggestions that also have multiple source+ -- spans. -garyb+ getSpan (unwrapErrorMessage e) . NEL.head <$> errorSpan e+ where+ startOnly SourceSpan{spanName, spanStart} = SourceSpan {spanName, spanStart, spanEnd = spanStart}++ getSpan simple ss =+ case simple of+ MissingTypeDeclaration{} -> startOnly ss+ MissingKindDeclaration{} -> startOnly ss+ _ -> ss++showSuggestion :: SimpleErrorMessage -> Text+showSuggestion suggestion = case errorSuggestion suggestion of+ Just (ErrorSuggestion x) -> x+ _ -> ""++ansiColor :: (ANSI.ColorIntensity, ANSI.Color) -> String+ansiColor (intensity, color) =+ ANSI.setSGRCode [ANSI.SetColor ANSI.Foreground intensity color]++ansiColorReset :: String+ansiColorReset =+ ANSI.setSGRCode [ANSI.Reset]++colorCode :: Maybe (ANSI.ColorIntensity, ANSI.Color) -> Text -> Text+colorCode codeColor code = case codeColor of+ Nothing -> code+ Just cc -> T.pack (ansiColor cc) <> code <> T.pack ansiColorReset++colorCodeBox :: Maybe (ANSI.ColorIntensity, ANSI.Color) -> Box.Box -> Box.Box+colorCodeBox codeColor b = case codeColor of+ Nothing -> b+ Just cc+ | Box.rows b == 1 ->+ Box.text (ansiColor cc) Box.<> b `endWith` Box.text ansiColorReset++ | otherwise -> Box.hcat Box.left -- making two boxes, one for each side of the box so that it will set each row it's own color and will reset it afterwards+ [ Box.vcat Box.top $ replicate (Box.rows b) $ Box.text $ ansiColor cc+ , b+ , Box.vcat Box.top $ replicate (Box.rows b) $ Box.text ansiColorReset+ ]++commasAndConjunction :: Text -> [Text] -> Text+commasAndConjunction conj = \case+ [x] -> x+ [x, y] -> x <> " " <> conj <> " " <> y+ (unsnoc -> Just (rest, z)) -> foldMap (<> ", ") rest <> conj <> " " <> z+ _ -> ""++-- | Default color intensity and color for code+defaultCodeColor :: (ANSI.ColorIntensity, ANSI.Color)+defaultCodeColor = (ANSI.Dull, ANSI.Yellow)++-- | `prettyPrintSingleError` Options+data PPEOptions = PPEOptions+ { ppeCodeColor :: Maybe (ANSI.ColorIntensity, ANSI.Color) -- ^ Color code with this color... or not+ , ppeFull :: Bool -- ^ Should write a full error message?+ , ppeLevel :: Level -- ^ Should this report an error or a warning?+ , ppeShowDocs :: Bool -- ^ Should show a link to error message's doc page?+ , ppeRelativeDirectory :: FilePath -- ^ FilePath to which the errors are relative+ , ppeFileContents :: [(FilePath, Text)] -- ^ Unparsed contents of source files+ }++-- | Default options for PPEOptions+defaultPPEOptions :: PPEOptions+defaultPPEOptions = PPEOptions+ { ppeCodeColor = Just defaultCodeColor+ , ppeFull = False+ , ppeLevel = Error+ , ppeShowDocs = True+ , ppeRelativeDirectory = mempty+ , ppeFileContents = []+ }++-- | Pretty print a single error, simplifying if necessary+prettyPrintSingleError :: PPEOptions -> ErrorMessage -> Box.Box+prettyPrintSingleError (PPEOptions codeColor full level showDocs relPath fileContents) e = flip evalState defaultUnknownMap $ do+ em <- onTypesInErrorMessageM replaceUnknowns (if full then e else simplifyErrorMessage e)+ um <- get+ return (prettyPrintErrorMessage um em)+ where+ (markCode, markCodeBox) = (colorCode &&& colorCodeBox) codeColor++ -- Pretty print an ErrorMessage+ prettyPrintErrorMessage :: TypeMap -> ErrorMessage -> Box.Box+ prettyPrintErrorMessage typeMap (ErrorMessage hints simple) =+ paras $+ [ foldr renderHint (indent (renderSimpleErrorMessage simple)) hints+ ] +++ maybe [] (return . Box.moveDown 1) typeInformation +++ [ Box.moveDown 1 $ paras+ [ line $ "See " <> errorDocUri e <> " for more information, "+ , line $ "or to contribute content related to this " <> levelText <> "."+ ]+ | showDocs+ ]+ where+ typeInformation :: Maybe Box.Box+ typeInformation | not (null types) = Just $ Box.hsep 1 Box.left [ line "where", paras types ]+ | otherwise = Nothing+ where+ types :: [Box.Box]+ types = map skolemInfo (M.elems (umSkolemMap typeMap)) +++ map unknownInfo (M.elems (umUnknownMap typeMap))++ skolemInfo :: (String, Int, Maybe SourceSpan) -> Box.Box+ skolemInfo (name, s, ss) =+ paras $+ line (markCode (T.pack (name <> show s)) <> " is a rigid type variable")+ : foldMap (return . line . (" bound at " <>) . displayStartEndPos) ss++ unknownInfo :: Int -> Box.Box+ unknownInfo u = line $ markCode ("t" <> T.pack (show u)) <> " is an unknown type"++ renderSimpleErrorMessage :: SimpleErrorMessage -> Box.Box+ renderSimpleErrorMessage (InternalCompilerError ctx err) =+ paras [ line "Internal compiler error:"+ , indent $ line err+ , line ctx+ , line "Please report this at https://github.com/purescript/purescript/issues"+ ]+ renderSimpleErrorMessage (ModuleNotFound mn) =+ paras [ line $ "Module " <> markCode (runModuleName mn) <> " was not found."+ , line $+ if isBuiltinModuleName mn+ then+ "Module names in the Prim namespace are reserved for built-in modules, but this version of the compiler does not provide module " <> markCode (runModuleName mn) <> ". You may be able to fix this by updating your compiler to a newer version."+ else+ "Make sure the source file exists, and that it has been provided as an input to the compiler."+ ]+ renderSimpleErrorMessage (FileIOError doWhat err) =+ paras [ line $ "I/O error while trying to " <> doWhat+ , indent . line $ err+ ]+ renderSimpleErrorMessage (ErrorParsingFFIModule path extra) =+ paras $ [ line "Unable to parse foreign module:"+ , indent . lineS $ path+ ] +++ map (indent . lineS) (concatMap Bundle.printErrorMessage (maybeToList extra))+ renderSimpleErrorMessage (ErrorParsingCSTModule err) =+ paras [ line "Unable to parse module: "+ , line $ T.pack $ CST.prettyPrintErrorMessage err+ ]+ renderSimpleErrorMessage (WarningParsingCSTModule err) =+ paras [ line $ T.pack $ CST.prettyPrintWarningMessage err+ ]+ renderSimpleErrorMessage (MissingFFIModule mn) =+ line $ "The foreign module implementation for module " <> markCode (runModuleName mn) <> " is missing."+ renderSimpleErrorMessage (UnnecessaryFFIModule mn path) =+ paras [ line $ "An unnecessary foreign module implementation was provided for module " <> markCode (runModuleName mn) <> ": "+ , indent . lineS $ path+ , line $ "Module " <> markCode (runModuleName mn) <> " does not contain any foreign import declarations, so a foreign module is not necessary."+ ]+ renderSimpleErrorMessage (MissingFFIImplementations mn idents) =+ paras [ line $ "The following values are not defined in the foreign module for module " <> markCode (runModuleName mn) <> ": "+ , indent . paras $ map (line . runIdent) idents+ ]+ renderSimpleErrorMessage (UnusedFFIImplementations mn idents) =+ paras [ line $ "The following definitions in the foreign module for module " <> markCode (runModuleName mn) <> " are unused: "+ , indent . paras $ map (line . runIdent) idents+ ]+ renderSimpleErrorMessage (InvalidFFIIdentifier mn ident) =+ paras [ line $ "In the FFI module for " <> markCode (runModuleName mn) <> ":"+ , indent . paras $+ [ line $ "The identifier " <> markCode ident <> " is not valid in PureScript."+ , line "Note that exported identifiers in FFI modules must be valid PureScript identifiers."+ ]+ ]+ renderSimpleErrorMessage (DeprecatedFFIPrime mn ident) =+ paras [ line $ "In the FFI module for " <> markCode (runModuleName mn) <> ":"+ , indent . paras $+ [ line $ "The identifier " <> markCode ident <> " contains a prime (" <> markCode "'" <> ")."+ , line "Primes are not allowed in identifiers exported from FFI modules."+ ]+ ]+ renderSimpleErrorMessage (DeprecatedFFICommonJSModule mn path) =+ paras [ line $ "A CommonJS foreign module implementation was provided for module " <> markCode (runModuleName mn) <> ": "+ , indent . lineS $ path+ , line "CommonJS foreign modules are no longer supported. Use native JavaScript/ECMAScript module syntax instead."+ ]+ renderSimpleErrorMessage (UnsupportedFFICommonJSExports mn idents) =+ paras [ line $ "The following CommonJS exports are not supported in the ES foreign module for module " <> markCode (runModuleName mn) <> ": "+ , indent . paras $ map line idents+ ]+ renderSimpleErrorMessage (UnsupportedFFICommonJSImports mn mids) =+ paras [ line $ "The following CommonJS imports are not supported in the ES foreign module for module " <> markCode (runModuleName mn) <> ": "+ , indent . paras $ map line mids+ ]+ renderSimpleErrorMessage InvalidDoBind =+ line "The last statement in a 'do' block must be an expression, but this block ends with a binder."+ renderSimpleErrorMessage InvalidDoLet =+ line "The last statement in a 'do' block must be an expression, but this block ends with a let binding."+ renderSimpleErrorMessage (OverlappingNamesInLet name) =+ line $ "The name " <> markCode (showIdent name) <> " was defined multiple times in a binding group"+ renderSimpleErrorMessage (InfiniteType ty) =+ paras [ line "An infinite type was inferred for an expression: "+ , markCodeBox $ indent $ prettyType ty+ ]+ renderSimpleErrorMessage (InfiniteKind ki) =+ paras [ line "An infinite kind was inferred for a type: "+ , markCodeBox $ indent $ prettyType ki+ ]+ renderSimpleErrorMessage (MultipleValueOpFixities op) =+ line $ "There are multiple fixity/precedence declarations for operator " <> markCode (showOp op)+ renderSimpleErrorMessage (MultipleTypeOpFixities op) =+ line $ "There are multiple fixity/precedence declarations for type operator " <> markCode (showOp op)+ renderSimpleErrorMessage (OrphanTypeDeclaration nm) =+ line $ "The type declaration for " <> markCode (showIdent nm) <> " should be followed by its definition."+ renderSimpleErrorMessage (OrphanKindDeclaration nm) =+ line $ "The kind declaration for " <> markCode (runProperName nm) <> " should be followed by its definition."+ renderSimpleErrorMessage (OrphanRoleDeclaration nm) =+ line $ "The role declaration for " <> markCode (runProperName nm) <> " should follow its definition."+ renderSimpleErrorMessage (RedefinedIdent name) =+ line $ "The value " <> markCode (showIdent name) <> " has been defined multiple times"+ renderSimpleErrorMessage (UnknownName name@(Qualified (BySourcePos _) (IdentName (Ident i)))) | i `elem` [ C.S_bind, C.S_discard ] =+ line $ "Unknown " <> printName name <> ". You're probably using do-notation, which the compiler replaces with calls to the " <> markCode "bind" <> " and " <> markCode "discard" <> " functions. Please import " <> markCode i <> " from module " <> markCode "Prelude"+ renderSimpleErrorMessage (UnknownName name@(Qualified (BySourcePos _) (IdentName (Ident C.S_negate)))) =+ line $ "Unknown " <> printName name <> ". You're probably using numeric negation (the unary " <> markCode "-" <> " operator), which the compiler replaces with calls to the " <> markCode C.S_negate <> " function. Please import " <> markCode C.S_negate <> " from module " <> markCode "Prelude"+ renderSimpleErrorMessage (UnknownName name) =+ line $ "Unknown " <> printName name+ renderSimpleErrorMessage (UnknownImport mn name) =+ paras [ line $ "Cannot import " <> printName (Qualified ByNullSourcePos name) <> " from module " <> markCode (runModuleName mn)+ , line "It either does not exist or the module does not export it."+ ]+ renderSimpleErrorMessage (UnknownImportDataConstructor mn tcon dcon) =+ line $ "Module " <> runModuleName mn <> " does not export data constructor " <> markCode (runProperName dcon) <> " for type " <> markCode (runProperName tcon)+ renderSimpleErrorMessage (UnknownExport name) =+ line $ "Cannot export unknown " <> printName (Qualified ByNullSourcePos name)+ renderSimpleErrorMessage (UnknownExportDataConstructor tcon dcon) =+ line $ "Cannot export data constructor " <> markCode (runProperName dcon) <> " for type " <> markCode (runProperName tcon) <> ", as it has not been declared."+ renderSimpleErrorMessage (ScopeConflict nm ms) =+ paras [ line $ "Conflicting definitions are in scope for " <> printName (Qualified ByNullSourcePos nm) <> " from the following modules:"+ , indent $ paras $ map (line . markCode . runModuleName) ms+ ]+ renderSimpleErrorMessage (ScopeShadowing nm exmn ms) =+ paras [ line $ "Shadowed definitions are in scope for " <> printName (Qualified ByNullSourcePos nm) <> " from the following open imports:"+ , indent $ paras $ map (line . markCode . ("import " <>) . runModuleName) ms+ , line $ "These will be ignored and the " <> case exmn of+ Just exmn' -> "declaration from " <> markCode (runModuleName exmn') <> " will be used."+ Nothing -> "local declaration will be used."+ ]+ renderSimpleErrorMessage (DeclConflict new existing) =+ line $ "Declaration for " <> printName (Qualified ByNullSourcePos new) <> " conflicts with an existing " <> nameType existing <> " of the same name."+ renderSimpleErrorMessage (ExportConflict new existing) =+ line $ "Export for " <> printName new <> " conflicts with " <> printName existing+ renderSimpleErrorMessage (DuplicateModule mn) =+ line $ "Module " <> markCode (runModuleName mn) <> " has been defined multiple times"+ renderSimpleErrorMessage (DuplicateTypeClass pn ss) =+ paras [ line ("Type class " <> markCode (runProperName pn) <> " has been defined multiple times:")+ , indent $ line $ displaySourceSpan relPath ss+ ]+ renderSimpleErrorMessage (DuplicateInstance pn ss) =+ paras [ line ("Instance " <> markCode (showIdent pn) <> " has been defined multiple times:")+ , indent $ line $ displaySourceSpan relPath ss+ ]+ renderSimpleErrorMessage (CycleInDeclaration nm) =+ line $ "The value of " <> markCode (showIdent nm) <> " is undefined here, so this reference is not allowed."+ renderSimpleErrorMessage (CycleInModules mns) =+ case mns of+ mn :| [] ->+ line $ "Module " <> markCode (runModuleName mn) <> " imports itself."+ _ ->+ paras [ line "There is a cycle in module dependencies in these modules: "+ , indent $ paras (line . markCode . runModuleName <$> NEL.toList mns)+ ]+ renderSimpleErrorMessage (CycleInTypeSynonym names) =+ paras $ cycleError <>+ [ line "Cycles are disallowed because they can lead to loops in the type checker."+ , line "Consider using a 'newtype' instead."+ ]+ where+ cycleError = case names of+ pn :| [] -> pure . line $ "A cycle appears in the definition of type synonym " <> markCode (runProperName pn)+ _ -> [ line " A cycle appears in a set of type synonym definitions:"+ , indent $ line $ "{" <> T.intercalate ", " (markCode . runProperName <$> NEL.toList names) <> "}"+ ]+ renderSimpleErrorMessage (CycleInTypeClassDeclaration (name :| [])) =+ paras [ line $ "A type class '" <> markCode (runProperName (disqualify name)) <> "' may not have itself as a superclass." ]+ renderSimpleErrorMessage (CycleInTypeClassDeclaration names) =+ paras [ line "A cycle appears in a set of type class definitions:"+ , indent $ line $ "{" <> T.intercalate ", " (markCode . runProperName . disqualify <$> NEL.toList names) <> "}"+ , line "Cycles are disallowed because they can lead to loops in the type checker."+ ]+ renderSimpleErrorMessage (CycleInKindDeclaration (name :| [])) =+ paras [ line $ "A kind declaration '" <> markCode (runProperName (disqualify name)) <> "' may not refer to itself in its own signature." ]+ renderSimpleErrorMessage (CycleInKindDeclaration names) =+ paras [ line "A cycle appears in a set of kind declarations:"+ , indent $ line $ "{" <> T.intercalate ", " (markCode . runProperName . disqualify <$> NEL.toList names) <> "}"+ , line "Kind declarations may not refer to themselves in their own signatures."+ ]+ renderSimpleErrorMessage (NameIsUndefined ident) =+ line $ "Value " <> markCode (showIdent ident) <> " is undefined."+ renderSimpleErrorMessage (UndefinedTypeVariable name) =+ line $ "Type variable " <> markCode (runProperName name) <> " is undefined."+ renderSimpleErrorMessage (PartiallyAppliedSynonym name) =+ paras [ line $ "Type synonym " <> markCode (showQualified runProperName name) <> " is partially applied."+ , line "Type synonyms must be applied to all of their type arguments."+ ]+ renderSimpleErrorMessage (EscapedSkolem name Nothing ty) =+ paras [ line $ "The type variable " <> markCode name <> " has escaped its scope, appearing in the type"+ , markCodeBox $ indent $ prettyType ty+ ]+ renderSimpleErrorMessage (EscapedSkolem name (Just srcSpan) ty) =+ paras [ line $ "The type variable " <> markCode name <> ", bound at"+ , indent $ line $ displaySourceSpan relPath srcSpan+ , line "has escaped its scope, appearing in the type"+ , markCodeBox $ indent $ prettyType ty+ ]+ renderSimpleErrorMessage (TypesDoNotUnify u1 u2)+ = let (row1Box, row2Box) = printRows u1 u2++ in paras [ line "Could not match type"+ , row1Box+ , line "with type"+ , row2Box+ ]++ renderSimpleErrorMessage (KindsDoNotUnify k1 k2) =+ paras [ line "Could not match kind"+ , markCodeBox $ indent $ prettyType k1+ , line "with kind"+ , markCodeBox $ indent $ prettyType k2+ ]+ renderSimpleErrorMessage (ConstrainedTypeUnified t1 t2) =+ paras [ line "Could not match constrained type"+ , markCodeBox $ indent $ prettyType t1+ , line "with type"+ , markCodeBox $ indent $ prettyType t2+ ]+ renderSimpleErrorMessage (OverlappingInstances _ _ []) = internalError "OverlappingInstances: empty instance list"+ renderSimpleErrorMessage (OverlappingInstances nm ts ds) =+ paras [ line "Overlapping type class instances found for"+ , markCodeBox $ indent $ Box.hsep 1 Box.left+ [ line (showQualified runProperName nm)+ , Box.vcat Box.left (map prettyTypeAtom ts)+ ]+ , line "The following instances were found:"+ , indent $ paras (map prettyInstanceName ds)+ ]+ renderSimpleErrorMessage (UnknownClass nm) =+ paras [ line "No type class instance was found for class"+ , markCodeBox $ indent $ line (showQualified runProperName nm)+ , line "because the class was not in scope. Perhaps it was not exported."+ ]+ renderSimpleErrorMessage (NoInstanceFound (Constraint _ C.Fail _ [ ty ] _) _ _) | Just box <- toTypelevelString ty =+ paras [ line "Custom error:"+ , indent box+ ]+ renderSimpleErrorMessage (NoInstanceFound (Constraint _ C.Partial+ _+ _+ (Just (PartialConstraintData bs b))) _ _) =+ paras [ line "A case expression could not be determined to cover all inputs."+ , line "The following additional cases are required to cover all inputs:"+ , indent $ paras $+ Box.hsep 1 Box.left+ (map (paras . map (line . markCode)) (transpose bs))+ : [line "..." | not b]+ , line "Alternatively, add a Partial constraint to the type of the enclosing value."+ ]+ renderSimpleErrorMessage (NoInstanceFound (Constraint _ C.Discard _ [ty] _) _ _) =+ paras [ line "A result of type"+ , markCodeBox $ indent $ prettyType ty+ , line "was implicitly discarded in a do notation block."+ , line ("You can use " <> markCode "_ <- ..." <> " to explicitly discard the result.")+ ]+ renderSimpleErrorMessage (NoInstanceFound (Constraint _ nm _ ts _) ambiguous unks) =+ paras $+ [ line "No type class instance was found for"+ , markCodeBox $ indent $ Box.hsep 1 Box.left+ [ line (showQualified runProperName nm)+ , Box.vcat Box.left (map prettyTypeAtom ts)+ ]+ , paras $ let useMessage msg =+ [ line msg+ , indent $ paras (map prettyInstanceName ambiguous)+ ]+ in case ambiguous of+ [] -> []+ [_] -> useMessage "The following instance partially overlaps the above constraint, which means the rest of its instance chain will not be considered:"+ _ -> useMessage "The following instances partially overlap the above constraint, which means the rest of their instance chains will not be considered:"+ ] <> case unks of+ NoUnknowns ->+ []+ Unknowns ->+ [ line "The instance head contains unknown type variables. Consider adding a type annotation." ]+ UnknownsWithVtaRequiringArgs tyClassMembersRequiringVtas ->+ let+ renderSingleTyClassMember (tyClassMember, argsRequiringVtas) =+ Box.moveRight 2 $ paras $+ [ line $ markCode (showQualified showIdent tyClassMember) ]+ <> case argsRequiringVtas of+ [required] ->+ [ Box.moveRight 2 $ line $ T.intercalate ", " required ]+ options ->+ [ Box.moveRight 2 $ line "One of the following sets of type variables:"+ , Box.moveRight 2 $ paras $+ map (\set -> Box.moveRight 2 $ line $ T.intercalate ", " set) options+ ]+ in+ [ paras+ [ line "The instance head contains unknown type variables."+ , Box.moveDown 1 $ paras $+ [ line $ "Note: The following type class members found in the expression require visible type applications to be unambiguous (e.g. " <> markCode "tyClassMember @Int" <> ")."]+ <> map renderSingleTyClassMember (NEL.toList tyClassMembersRequiringVtas)+ ]+ ]+ renderSimpleErrorMessage (AmbiguousTypeVariables t uis) =+ paras [ line "The inferred type"+ , markCodeBox $ indent $ prettyType t+ , line "has type variables which are not determined by those mentioned in the body of the type:"+ , indent $ Box.hsep 1 Box.left+ [ Box.vcat Box.left+ [ line $ markCode (u <> T.pack (show i)) <> " could not be determined"+ | (u, i) <- uis ]+ ]+ , line "Consider adding a type annotation."+ ]+ renderSimpleErrorMessage (PossiblyInfiniteInstance nm ts) =+ paras [ line "Type class instance for"+ , markCodeBox $ indent $ Box.hsep 1 Box.left+ [ line (showQualified runProperName nm)+ , Box.vcat Box.left (map prettyTypeAtom ts)+ ]+ , line "is possibly infinite."+ ]+ renderSimpleErrorMessage PossiblyInfiniteCoercibleInstance =+ line $ "A " <> markCode "Coercible" <> " instance is possibly infinite."+ renderSimpleErrorMessage (CannotDerive nm ts) =+ paras [ line "Cannot derive a type class instance for"+ , markCodeBox $ indent $ Box.hsep 1 Box.left+ [ line (showQualified runProperName nm)+ , Box.vcat Box.left (map prettyTypeAtom ts)+ ]+ , line "since instances of this type class are not derivable."+ ]+ renderSimpleErrorMessage (InvalidNewtypeInstance nm ts) =+ paras [ line "Cannot derive newtype instance for"+ , markCodeBox $ indent $ Box.hsep 1 Box.left+ [ line (showQualified runProperName nm)+ , Box.vcat Box.left (map prettyTypeAtom ts)+ ]+ , line "Make sure this is a newtype."+ ]+ renderSimpleErrorMessage (MissingNewtypeSuperclassInstance su cl ts) =+ paras [ line "The derived newtype instance for"+ , markCodeBox $ indent $ Box.hsep 1 Box.left+ [ line (showQualified runProperName cl)+ , Box.vcat Box.left (map prettyTypeAtom ts)+ ]+ , line $ "does not include a derived superclass instance for " <> markCode (showQualified runProperName su) <> "."+ ]+ renderSimpleErrorMessage (UnverifiableSuperclassInstance su cl ts) =+ paras [ line "The derived newtype instance for"+ , markCodeBox $ indent $ Box.hsep 1 Box.left+ [ line (showQualified runProperName cl)+ , Box.vcat Box.left (map prettyTypeAtom ts)+ ]+ , line $ "implies an superclass instance for " <> markCode (showQualified runProperName su) <> " which could not be verified."+ ]+ renderSimpleErrorMessage (InvalidDerivedInstance nm ts argCount) =+ paras [ line "Cannot derive the type class instance"+ , markCodeBox $ indent $ Box.hsep 1 Box.left+ [ line (showQualified runProperName nm)+ , Box.vcat Box.left (map prettyTypeAtom ts)+ ]+ , line $ fold+ [ "because the "+ , markCode (showQualified runProperName nm)+ , " type class has "+ , T.pack (show argCount)+ , " type "+ , if argCount == 1 then "argument" else "arguments"+ , ", but the declaration specifies " <> T.pack (show (length ts)) <> "."+ ]+ ]+ renderSimpleErrorMessage (ExpectedTypeConstructor nm ts ty) =+ paras [ line "Cannot derive the type class instance"+ , markCodeBox $ indent $ Box.hsep 1 Box.left+ [ line (showQualified runProperName nm)+ , Box.vcat Box.left (map prettyTypeAtom ts)+ ]+ , "because the type"+ , markCodeBox $ indent $ prettyType ty+ , line "is not of the required form T a_1 ... a_n, where T is a type constructor defined in the same module."+ ]+ renderSimpleErrorMessage (CannotFindDerivingType nm) =+ line $ "Cannot derive a type class instance, because the type declaration for " <> markCode (runProperName nm) <> " could not be found."+ renderSimpleErrorMessage (DuplicateLabel l expr) =+ paras $ [ line $ "Label " <> markCode (prettyPrintLabel l) <> " appears more than once in a row type." ]+ <> foldMap (\expr' -> [ line "Relevant expression: "+ , markCodeBox $ indent $ prettyPrintValue prettyDepth expr'+ ]) expr+ renderSimpleErrorMessage (DuplicateTypeArgument name) =+ line $ "Type argument " <> markCode name <> " appears more than once."+ renderSimpleErrorMessage (DuplicateValueDeclaration nm) =+ line $ "Multiple value declarations exist for " <> markCode (showIdent nm) <> "."+ renderSimpleErrorMessage (ArgListLengthsDiffer ident) =+ line $ "Argument list lengths differ in declaration " <> markCode (showIdent ident)+ renderSimpleErrorMessage (OverlappingArgNames ident) =+ line $ "Overlapping names in function/binder" <> foldMap ((" in declaration " <>) . showIdent) ident+ renderSimpleErrorMessage (MissingClassMember identsAndTypes) =+ paras [ line "The following type class members have not been implemented:"+ , Box.vcat Box.left+ [ markCodeBox $ Box.text (T.unpack (showIdent ident)) Box.<> " :: " Box.<> prettyType ty+ | (ident, ty) <- NEL.toList identsAndTypes ]+ ]+ renderSimpleErrorMessage (ExtraneousClassMember ident className) =+ line $ "" <> markCode (showIdent ident) <> " is not a member of type class " <> markCode (showQualified runProperName className)+ renderSimpleErrorMessage (ExpectedType ty kind) =+ paras [ line $ "In a type-annotated expression " <> markCode "x :: t" <> ", the type " <> markCode "t" <> " must have kind " <> markCode (runProperName . disqualify $ C.Type) <> "."+ , line "The error arises from the type"+ , markCodeBox $ indent $ prettyType ty+ , line "having the kind"+ , markCodeBox $ indent $ prettyType kind+ , line "instead."+ ]+ renderSimpleErrorMessage (IncorrectConstructorArity nm expected actual) =+ paras [ line $ "Data constructor " <> markCode (showQualified runProperName nm) <> " was given " <> T.pack (show actual) <> " arguments in a case expression, but expected " <> T.pack (show expected) <> " arguments."+ , line $ "This problem can be fixed by giving " <> markCode (showQualified runProperName nm) <> " " <> T.pack (show expected) <> " arguments."+ ]+ renderSimpleErrorMessage (ExprDoesNotHaveType expr ty) =+ paras [ line "Expression"+ , markCodeBox $ indent $ prettyPrintValue prettyDepth expr+ , line "does not have type"+ , markCodeBox $ indent $ prettyType ty+ ]+ renderSimpleErrorMessage (PropertyIsMissing prop) =+ line $ "Type of expression lacks required label " <> markCode (prettyPrintLabel prop) <> "."+ renderSimpleErrorMessage (AdditionalProperty prop) =+ line $ "Type of expression contains additional label " <> markCode (prettyPrintLabel prop) <> "."+ renderSimpleErrorMessage (OrphanInstance nm cnm nonOrphanModules ts) =+ paras [ line $ "Orphan instance" <> prettyPrintPlainIdent nm <> " found for "+ , markCodeBox $ indent $ Box.hsep 1 Box.left+ [ line (showQualified runProperName cnm)+ , Box.vcat Box.left (map prettyTypeAtom ts)+ ]+ , Box.vcat Box.left $ case modulesToList of+ [] -> [ line "There is nowhere this instance can be placed without being an orphan."+ , line "A newtype wrapper can be used to avoid this problem."+ ]+ _ -> [ Box.text $ "This problem can be resolved by declaring the instance in "+ <> T.unpack formattedModules+ <> ", or by defining the instance on a newtype wrapper."+ ]+ ]+ where+ modulesToList = S.toList $ S.delete (moduleNameFromString "Prim") nonOrphanModules+ formattedModules = T.intercalate " or " (markCode . runModuleName <$> modulesToList)+ renderSimpleErrorMessage (InvalidNewtype name) =+ paras [ line $ "Newtype " <> markCode (runProperName name) <> " is invalid."+ , line "Newtypes must define a single constructor with a single argument."+ ]+ renderSimpleErrorMessage (InvalidInstanceHead ty) =+ paras [ line "Type class instance head is invalid due to use of type"+ , markCodeBox $ indent $ prettyType ty+ , line "All types appearing in instance declarations must be of the form T a_1 .. a_n, where each type a_i is of the same form, unless the type is fully determined by other type class arguments via functional dependencies."+ ]+ renderSimpleErrorMessage (TransitiveExportError x ys) =+ paras [ line $ "An export for " <> markCode (prettyPrintExport x) <> " requires the following to also be exported: "+ , indent $ paras $ map (line . markCode . prettyPrintExport) ys+ ]+ renderSimpleErrorMessage (TransitiveDctorExportError x ctors) =+ paras [ line $ "An export for " <> markCode (prettyPrintExport x) <> " requires the following data constructor" <> (if length ctors == 1 then "" else "s") <> " to also be exported: "+ , indent $ paras $ map (line . markCode . runProperName) ctors+ ]+ renderSimpleErrorMessage (HiddenConstructors x className) =+ paras [ line $ "An export for " <> markCode (prettyPrintExport x) <> " hides data constructors but the type declares an instance of " <> markCode (showQualified runProperName className) <> "."+ , line "Such instance allows to match and construct values of this type, effectively making the constructors public."+ ]+ renderSimpleErrorMessage (ShadowedName nm) =+ line $ "Name " <> markCode (showIdent nm) <> " was shadowed."+ renderSimpleErrorMessage (ShadowedTypeVar tv) =+ line $ "Type variable " <> markCode tv <> " was shadowed."+ renderSimpleErrorMessage (UnusedName nm) =+ line $ "Name " <> markCode (showIdent nm) <> " was introduced but not used."+ renderSimpleErrorMessage (UnusedDeclaration nm) =+ line $ "Declaration " <> markCode (showIdent nm) <> " was not used, and is not exported."+ renderSimpleErrorMessage (UnusedTypeVar tv) =+ line $ "Type variable " <> markCode tv <> " is ambiguous, since it is unused in the polymorphic type which introduces it."+ renderSimpleErrorMessage (ImportHidingModule name) =+ paras [ line "hiding imports cannot be used to hide modules."+ , line $ "An attempt was made to hide the import of " <> markCode (runModuleName name)+ ]+ renderSimpleErrorMessage (WildcardInferredType ty ctx) =+ paras $ [ line "Wildcard type definition has the inferred type "+ , markCodeBox $ indent $ prettyType ty+ ] <> renderContext ctx+ renderSimpleErrorMessage (HoleInferredType name ty ctx ts) =+ let+ maxTSResults = 15+ tsResult = case ts of+ Just TSAfter{tsAfterIdentifiers=idents} | not (null idents) ->+ let+ formatTS (names, types) =+ let+ idBoxes = Box.text . T.unpack . showQualified id <$> names+ tyBoxes = (\t -> BoxHelpers.indented+ (Box.text ":: " Box.<> prettyType t)) <$> types+ longestId = maximum (map Box.cols idBoxes)+ in+ Box.vcat Box.top $+ zipWith (Box.<>)+ (Box.alignHoriz Box.left longestId <$> idBoxes)+ tyBoxes+ in [ line "You could substitute the hole with one of these values:"+ , markCodeBox (indent (formatTS (unzip (take maxTSResults idents))))+ ]+ _ -> []+ in+ paras $ [ line $ "Hole '" <> markCode name <> "' has the inferred type "+ , markCodeBox (indent (prettyTypeWithDepth maxBound ty))+ ] ++ tsResult ++ renderContext ctx+ renderSimpleErrorMessage (MissingTypeDeclaration ident ty) =+ paras [ line $ "No type declaration was provided for the top-level declaration of " <> markCode (showIdent ident) <> "."+ , line "It is good practice to provide type declarations as a form of documentation."+ , line $ "The inferred type of " <> markCode (showIdent ident) <> " was:"+ , markCodeBox $ indent $ prettyTypeWithDepth maxBound ty+ ]+ renderSimpleErrorMessage (MissingKindDeclaration sig name ty) =+ let sigKw = prettyPrintKindSignatureFor sig in+ paras [ line $ "The inferred kind for the " <> sigKw <> " declaration " <> markCode (runProperName name) <> " contains polymorphic kinds."+ , line "Consider adding a top-level kind signature as a form of documentation."+ , markCodeBox $ indent $ Box.hsep 1 Box.left+ [ line $ sigKw <> " " <> runProperName name <> " ::"+ , prettyTypeWithDepth maxBound ty+ ]+ ]+ renderSimpleErrorMessage (OverlappingPattern bs b) =+ paras $ [ line "A case expression contains unreachable cases:\n"+ , Box.hsep 1 Box.left (map (paras . map (line . prettyPrintBinderAtom)) (transpose bs))+ ] +++ [ line "..." | not b ]+ renderSimpleErrorMessage IncompleteExhaustivityCheck =+ paras [ line "An exhaustivity check was abandoned due to too many possible cases."+ , line "You may want to decompose your data types into smaller types."+ ]++ renderSimpleErrorMessage (UnusedImport mn qualifier) =+ let+ mark = markCode . runModuleName+ unqualified = "The import of " <> mark mn <> " is redundant"+ msg' q = "The qualified import of " <> mark mn <> " as " <> mark q <> " is redundant"+ msg = maybe unqualified msg'+ in line $ msg qualifier++ renderSimpleErrorMessage msg@(UnusedExplicitImport mn names _ _) =+ paras [ line $ "The import of module " <> markCode (runModuleName mn) <> " contains the following unused references:"+ , indent $ paras $ map (line . markCode . runName . Qualified ByNullSourcePos) names+ , line "It could be replaced with:"+ , indent $ line $ markCode $ showSuggestion msg ]++ renderSimpleErrorMessage msg@(UnusedDctorImport mn name _ _) =+ paras [line $ "The import of type " <> markCode (runProperName name)+ <> " from module " <> markCode (runModuleName mn) <> " includes data constructors but only the type is used"+ , line "It could be replaced with:"+ , indent $ line $ markCode $ showSuggestion msg ]++ renderSimpleErrorMessage msg@(UnusedDctorExplicitImport mn name names _ _) =+ paras [ line $ "The import of type " <> markCode (runProperName name)+ <> " from module " <> markCode (runModuleName mn) <> " includes the following unused data constructors:"+ , indent $ paras $ map (line . markCode . runProperName) names+ , line "It could be replaced with:"+ , indent $ line $ markCode $ showSuggestion msg ]++ renderSimpleErrorMessage (DuplicateSelectiveImport name) =+ line $ "There is an existing import of " <> markCode (runModuleName name) <> ", consider merging the import lists"++ renderSimpleErrorMessage (DuplicateImport name imp qual) =+ line $ "Duplicate import of " <> markCode (prettyPrintImport name imp qual)++ renderSimpleErrorMessage (DuplicateImportRef name) =+ line $ "Import list contains multiple references to " <> printName (Qualified ByNullSourcePos name)++ renderSimpleErrorMessage (DuplicateExportRef name) =+ line $ "Export list contains multiple references to " <> printName (Qualified ByNullSourcePos name)++ renderSimpleErrorMessage (IntOutOfRange value backend lo hi) =+ paras [ line $ "Integer value " <> markCode (T.pack (show value)) <> " is out of range for the " <> backend <> " backend."+ , line $ "Acceptable values fall within the range " <> markCode (T.pack (show lo)) <> " to " <> markCode (T.pack (show hi)) <> " (inclusive)." ]++ renderSimpleErrorMessage msg@(ImplicitQualifiedImport importedModule asModule _) =+ paras [ line $ "Module " <> markCode (runModuleName importedModule) <> " was imported as " <> markCode (runModuleName asModule) <> " with unspecified imports."+ , line $ "As there are multiple modules being imported as " <> markCode (runModuleName asModule) <> ", consider using the explicit form:"+ , indent $ line $ markCode $ showSuggestion msg+ ]+ renderSimpleErrorMessage msg@(ImplicitQualifiedImportReExport importedModule asModule _) =+ paras [ line $ "Module " <> markCode (runModuleName importedModule) <> " was imported as " <> markCode (runModuleName asModule) <> " with unspecified imports."+ , line "As this module is being re-exported, consider using the explicit form:"+ , indent $ line $ markCode $ showSuggestion msg+ ]++ renderSimpleErrorMessage msg@(ImplicitImport mn _) =+ paras [ line $ "Module " <> markCode (runModuleName mn) <> " has unspecified imports, consider using the explicit form: "+ , indent $ line $ markCode $ showSuggestion msg+ ]++ renderSimpleErrorMessage msg@(HidingImport mn _) =+ paras [ line $ "Module " <> markCode (runModuleName mn) <> " has unspecified imports, consider using the inclusive form: "+ , indent $ line $ markCode $ showSuggestion msg+ ]++ renderSimpleErrorMessage (CaseBinderLengthDiffers l bs) =+ paras [ line "Binder list length differs in case alternative:"+ , indent $ line $ T.intercalate ", " $ fmap prettyPrintBinderAtom bs+ , line $ "Expecting " <> T.pack (show l) <> " binder" <> (if l == 1 then "" else "s") <> "."+ ]++ renderSimpleErrorMessage IncorrectAnonymousArgument =+ line "An anonymous function argument appears in an invalid context."++ renderSimpleErrorMessage (InvalidOperatorInBinder op fn) =+ paras [ line $ "Operator " <> markCode (showQualified showOp op) <> " cannot be used in a pattern as it is an alias for function " <> showQualified showIdent fn <> "."+ , line "Only aliases for data constructors may be used in patterns."+ ]++ renderSimpleErrorMessage (CannotGeneralizeRecursiveFunction ident ty) =+ paras [ line $ "Unable to generalize the type of the recursive function " <> markCode (showIdent ident) <> "."+ , line $ "The inferred type of " <> markCode (showIdent ident) <> " was:"+ , markCodeBox $ indent $ prettyType ty+ , line "Try adding a type signature."+ ]++ renderSimpleErrorMessage (CannotDeriveNewtypeForData tyName) =+ paras [ line $ "Cannot derive an instance of the " <> markCode "Newtype" <> " class for non-newtype " <> markCode (runProperName tyName) <> "."+ ]++ renderSimpleErrorMessage (ExpectedWildcard tyName) =+ paras [ line $ "Expected a type wildcard (_) when deriving an instance for " <> markCode (runProperName tyName) <> "."+ ]++ renderSimpleErrorMessage (CannotUseBindWithDo name) =+ paras [ line $ "The name " <> markCode (showIdent name) <> " cannot be brought into scope in a do notation block, since do notation uses the same name."+ ]++ renderSimpleErrorMessage (ClassInstanceArityMismatch dictName className expected actual) =+ paras [ line $ "The type class " <> markCode (showQualified runProperName className) <>+ " expects " <> T.pack (show expected) <> " " <> argsMsg <> "."+ , line $ "But the instance" <> prettyPrintPlainIdent dictName <> mismatchMsg <> T.pack (show actual) <> "."+ ]+ where+ mismatchMsg = if actual > expected then " provided " else " only provided "+ argsMsg = if expected > 1 then "arguments" else "argument"++ renderSimpleErrorMessage (UserDefinedWarning msgTy) =+ let msg = fromMaybe (prettyType msgTy) (toTypelevelString msgTy) in+ paras [ line "A custom warning occurred while solving type class constraints:"+ , indent msg+ ]++ renderSimpleErrorMessage (CannotDefinePrimModules mn) =+ paras+ [ line $ "The module name " <> markCode (runModuleName mn) <> " is in the Prim namespace."+ , line "The Prim namespace is reserved for compiler-defined terms."+ ]++ renderSimpleErrorMessage (MixedAssociativityError opsWithAssoc) =+ paras+ [ line "Cannot parse an expression that uses operators of the same precedence but mixed associativity:"+ , indent $ paras $ map (\(name, assoc) -> line $ markCode (showQualified showOp name) <> " is " <> markCode (T.pack (showAssoc assoc))) (NEL.toList opsWithAssoc)+ , line "Use parentheses to resolve this ambiguity."+ ]++ renderSimpleErrorMessage (NonAssociativeError ops) =+ if NEL.length ops == 1+ then+ paras+ [ line $ "Cannot parse an expression that uses multiple instances of the non-associative operator " <> markCode (showQualified showOp (NEL.head ops)) <> "."+ , line "Use parentheses to resolve this ambiguity."+ ]+ else+ paras+ [ line "Cannot parse an expression that uses multiple non-associative operators of the same precedence:"+ , indent $ paras $ map (line . markCode . showQualified showOp) (NEL.toList ops)+ , line "Use parentheses to resolve this ambiguity."+ ]++ renderSimpleErrorMessage (QuantificationCheckFailureInKind var) =+ paras+ [ line $ "Cannot generalize the kind of type variable " <> markCode var <> " since it would not be well-scoped."+ , line "Try adding a kind annotation."+ ]++ renderSimpleErrorMessage (QuantificationCheckFailureInType us ty) =+ let unks =+ fmap (\u -> Box.hsep 1 Box.top [ "where"+ , markCodeBox (prettyType (srcTUnknown u))+ , "is an unknown kind."+ ]) us+ in paras+ [ line "Cannot unambiguously generalize kinds appearing in the elaborated type:"+ , indent $ markCodeBox $ typeAsBox prettyDepth ty+ , paras unks+ , line "Try adding additional kind signatures or polymorphic kind variables."+ ]++ renderSimpleErrorMessage (VisibleQuantificationCheckFailureInType var) =+ paras+ [ line $ "Visible dependent quantification of type variable " <> markCode var <> " is not supported."+ , line "If you would like this feature supported, please bother Liam Goodacre (@LiamGoodacre)."+ ]++ renderSimpleErrorMessage (UnsupportedTypeInKind ty) =+ paras+ [ line "The type:"+ , indent $ markCodeBox $ prettyType ty+ , line "is not supported in kinds."+ ]++ renderSimpleErrorMessage (RoleMismatch var inferred declared) =+ paras+ [ line $ "Role mismatch for the type parameter " <> markCode var <> ":"+ , indent . line $+ "The annotation says " <> markCode (displayRole declared) <>+ " but the role " <> markCode (displayRole inferred) <>+ " is required."+ ]++ renderSimpleErrorMessage (InvalidCoercibleInstanceDeclaration tys) =+ paras+ [ line "Invalid type class instance declaration for"+ , markCodeBox $ indent $ Box.hsep 1 Box.left+ [ line (showQualified runProperName C.Coercible)+ , Box.vcat Box.left (map prettyTypeAtom tys)+ ]+ , line "Instance declarations of this type class are disallowed."+ ]++ renderSimpleErrorMessage UnsupportedRoleDeclaration =+ line "Role declarations are only supported for data types, not for type synonyms nor type classes."++ renderSimpleErrorMessage (RoleDeclarationArityMismatch name expected actual) =+ line $ T.intercalate " "+ [ "The type"+ , markCode (runProperName name)+ , "expects"+ , T.pack (show expected)+ , if expected == 1 then "argument" else "arguments"+ , "but its role declaration lists"+ <> if actual > expected then "" else " only"+ , T.pack (show actual)+ , if actual > 1 then "roles" else "role"+ ] <> "."++ renderSimpleErrorMessage (DuplicateRoleDeclaration name) =+ line $ "Duplicate role declaration for " <> markCode (runProperName name) <> "."++ renderSimpleErrorMessage (CannotDeriveInvalidConstructorArg className relatedClasses checkVariance) =+ paras+ [ line $ "One or more type variables are in positions that prevent " <> markCode (runProperName $ disqualify className) <> " from being derived."+ , line $ "To derive this class, make sure that these variables are only used as the final arguments to type constructors, "+ <> (if checkVariance then "that their variance matches the variance of " <> markCode (runProperName $ disqualify className) <> ", " else "")+ <> "and that those type constructors themselves have instances of " <> commasAndConjunction "or" (markCode . showQualified runProperName <$> relatedClasses) <> "."+ ]++ renderSimpleErrorMessage (CannotSkipTypeApplication tyFn) =+ paras+ [ "An expression of type:"+ , markCodeBox $ indent $ prettyType tyFn+ , "cannot be skipped."+ ]++ renderSimpleErrorMessage (CannotApplyExpressionOfTypeOnType tyFn tyAr) =+ paras $ infoLine <>+ [ markCodeBox $ indent $ prettyType tyFn+ , "cannot be applied to:"+ , markCodeBox $ indent $ prettyType tyAr+ ]+ where+ infoLine =+ if isMonoType tyFn then+ [ "An expression of monomorphic type:" ]+ else+ [ "An expression of polymorphic type"+ , line $ "with the invisible type variable " <> markCode typeVariable <> ":"+ ]++ typeVariable = case tyFn of+ ForAll _ _ v _ _ _ -> v+ _ -> internalError "renderSimpleErrorMessage: Impossible!"++ renderHint :: ErrorMessageHint -> Box.Box -> Box.Box+ renderHint (ErrorUnifyingTypes t1@RCons{} t2@RCons{}) detail =+ let (row1Box, row2Box) = printRows t1 t2+ in paras [ detail+ , Box.hsep 1 Box.top [ line "while trying to match type"+ , row1Box+ ]+ , Box.moveRight 2 $ Box.hsep 1 Box.top [ line "with type"+ , row2Box+ ]+ ]+ renderHint (ErrorUnifyingTypes t1 t2) detail =+ paras [ detail+ , Box.hsep 1 Box.top [ line "while trying to match type"+ , markCodeBox $ typeAsBox prettyDepth t1+ ]+ , Box.moveRight 2 $ Box.hsep 1 Box.top [ line "with type"+ , markCodeBox $ typeAsBox prettyDepth t2+ ]+ ]+ renderHint (ErrorInExpression expr) detail =+ paras [ detail+ , Box.hsep 1 Box.top [ Box.text "in the expression"+ , markCodeBox $ markCodeBox $ prettyPrintValue prettyDepth expr+ ]+ ]+ renderHint (ErrorInModule mn) detail =+ paras [ line $ "in module " <> markCode (runModuleName mn)+ , detail+ ]+ renderHint (ErrorInSubsumption t1 t2) detail =+ paras [ detail+ , Box.hsep 1 Box.top [ line "while checking that type"+ , markCodeBox $ typeAsBox prettyDepth t1+ ]+ , Box.moveRight 2 $ Box.hsep 1 Box.top [ line "is at least as general as type"+ , markCodeBox $ typeAsBox prettyDepth t2+ ]+ ]+ renderHint (ErrorInRowLabel lb) detail =+ paras [ detail+ , Box.hsep 1 Box.top [ line "while matching label"+ , markCodeBox $ line $ prettyPrintObjectKey (runLabel lb)+ ]+ ]+ renderHint (ErrorInInstance nm ts) detail =+ paras [ detail+ , line "in type class instance"+ , markCodeBox $ indent $ Box.hsep 1 Box.top+ [ line $ showQualified runProperName nm+ , Box.vcat Box.left (map (typeAtomAsBox prettyDepth) ts)+ ]+ ]+ renderHint (ErrorCheckingKind ty kd) detail =+ paras [ detail+ , Box.hsep 1 Box.top [ line "while checking that type"+ , markCodeBox $ typeAsBox prettyDepth ty+ ]+ , Box.moveRight 2 $ Box.hsep 1 Box.top [ line "has kind"+ , markCodeBox $ typeAsBox prettyDepth kd+ ]+ ]+ renderHint (ErrorInferringKind ty) detail =+ paras [ detail+ , Box.hsep 1 Box.top [ line "while inferring the kind of"+ , markCodeBox $ typeAsBox prettyDepth ty+ ]+ ]+ renderHint ErrorCheckingGuard detail =+ paras [ detail+ , line "while checking the type of a guard clause"+ ]+ renderHint (ErrorInferringType expr) detail =+ paras [ detail+ , Box.hsep 1 Box.top [ line "while inferring the type of"+ , markCodeBox $ prettyPrintValue prettyDepth expr+ ]+ ]+ renderHint (ErrorCheckingType expr ty) detail =+ paras [ detail+ , Box.hsep 1 Box.top [ line "while checking that expression"+ , markCodeBox $ prettyPrintValue prettyDepth expr+ ]+ , Box.moveRight 2 $ Box.hsep 1 Box.top [ line "has type"+ , markCodeBox $ typeAsBox prettyDepth ty+ ]+ ]+ renderHint (ErrorCheckingAccessor expr prop) detail =+ paras [ detail+ , Box.hsep 1 Box.top [ line "while checking type of property accessor"+ , markCodeBox $ prettyPrintValue prettyDepth (Accessor prop expr)+ ]+ ]+ renderHint (ErrorInApplication f t a) detail =+ paras [ detail+ , Box.hsep 1 Box.top [ line "while applying a function"+ , markCodeBox $ prettyPrintValue prettyDepth f+ ]+ , Box.moveRight 2 $ Box.hsep 1 Box.top [ line "of type"+ , markCodeBox $ typeAsBox prettyDepth t+ ]+ , Box.moveRight 2 $ Box.hsep 1 Box.top [ line "to argument"+ , markCodeBox $ prettyPrintValue prettyDepth a+ ]+ ]+ renderHint (ErrorInDataConstructor nm) detail =+ paras [ detail+ , line $ "in data constructor " <> markCode (runProperName nm)+ ]+ renderHint (ErrorInTypeConstructor nm) detail =+ paras [ detail+ , line $ "in type constructor " <> markCode (runProperName nm)+ ]+ renderHint (ErrorInBindingGroup nms) detail =+ paras [ detail+ , line $ "in binding group " <> T.intercalate ", " (NEL.toList (fmap showIdent nms))+ ]+ renderHint (ErrorInDataBindingGroup nms) detail =+ paras [ detail+ , line $ "in data binding group " <> T.intercalate ", " (map runProperName nms)+ ]+ renderHint (ErrorInTypeSynonym name) detail =+ paras [ detail+ , line $ "in type synonym " <> markCode (runProperName name)+ ]+ renderHint (ErrorInValueDeclaration n) detail =+ paras [ detail+ , line $ "in value declaration " <> markCode (showIdent n)+ ]+ renderHint (ErrorInTypeDeclaration n) detail =+ paras [ detail+ , line $ "in type declaration for " <> markCode (showIdent n)+ ]+ renderHint (ErrorInTypeClassDeclaration name) detail =+ paras [ detail+ , line $ "in type class declaration for " <> markCode (runProperName name)+ ]+ renderHint (ErrorInKindDeclaration name) detail =+ paras [ detail+ , line $ "in kind declaration for " <> markCode (runProperName name)+ ]+ renderHint (ErrorInRoleDeclaration name) detail =+ paras [ detail+ , line $ "in role declaration for " <> markCode (runProperName name)+ ]+ renderHint (ErrorInForeignImport nm) detail =+ paras [ detail+ , line $ "in foreign import " <> markCode (showIdent nm)+ ]+ renderHint (ErrorInForeignImportData nm) detail =+ paras [ detail+ , line $ "in foreign data type declaration for " <> markCode (runProperName nm)+ ]+ renderHint (ErrorSolvingConstraint (Constraint _ nm _ ts _)) detail =+ paras [ detail+ , line "while solving type class constraint"+ , markCodeBox $ indent $ Box.hsep 1 Box.left+ [ line (showQualified runProperName nm)+ , Box.vcat Box.left (map (typeAtomAsBox prettyDepth) ts)+ ]+ ]+ renderHint (MissingConstructorImportForCoercible name) detail =+ paras+ [ detail+ , Box.moveUp 1 $ Box.moveRight 2 $ line $ "Solving this instance requires the newtype constructor " <> markCode (showQualified runProperName name) <> " to be in scope."+ ]+ renderHint (PositionedError srcSpan) detail =+ paras [ line $ "at " <> displaySourceSpan relPath (NEL.head srcSpan)+ , detail+ ]+ renderHint (RelatedPositions srcSpans) detail =+ paras+ [ detail+ , Box.moveRight 2 $ showSourceSpansInContext srcSpans+ ]++ printRow :: (Int -> Type a -> Box.Box) -> Type a -> Box.Box+ printRow f = markCodeBox . indent . f prettyDepth .+ if full then id else eraseForAllKindAnnotations . eraseKindApps++ -- If both rows are not empty, print them as diffs+ -- If verbose print all rows else only print unique rows+ printRows :: Type a -> Type a -> (Box.Box, Box.Box)+ printRows r1 r2 = case (full, r1, r2) of+ (True, _ , _) -> (printRow typeAsBox r1, printRow typeAsBox r2)++ (_, RCons{}, RCons{}) ->+ let (sorted1, sorted2) = filterRows (rowToList r1) (rowToList r2)+ in (printRow typeDiffAsBox sorted1, printRow typeDiffAsBox sorted2)++ (_, _, _) -> (printRow typeAsBox r1, printRow typeAsBox r2)+++ -- Keep the unique labels only+ filterRows :: ([RowListItem a], Type a) -> ([RowListItem a], Type a) -> (Type a, Type a)+ filterRows (s1, r1) (s2, r2) =+ let sort' = sortOn $ \(RowListItem _ name ty) -> (name, ty)+ (unique1, unique2) = diffSortedRowLists (sort' s1, sort' s2)+ in ( rowFromList (unique1, r1)+ , rowFromList (unique2, r2)+ )++ -- Importantly, this removes exactly the same number of elements from+ -- both lists, even if there are repeated (name, ty) keys. It requires+ -- the inputs to be sorted but ensures that the outputs remain sorted.+ diffSortedRowLists :: ([RowListItem a], [RowListItem a]) -> ([RowListItem a], [RowListItem a])+ diffSortedRowLists = go where+ go = \case+ (s1@(h1@(RowListItem _ name1 ty1) : t1), s2@(h2@(RowListItem _ name2 ty2) : t2)) ->+ case (name1, ty1) `compare` (name2, ty2) of+ EQ -> go (t1, t2)+ LT -> first (h1:) $ go (t1, s2)+ GT -> second (h2:) $ go (s1, t2)+ other -> other++ renderContext :: Context -> [Box.Box]+ renderContext [] = []+ renderContext ctx =+ [ line "in the following context:"+ , indent $ paras+ [ Box.hcat Box.left [ Box.text (T.unpack (showIdent ident) ++ " :: ")+ , markCodeBox $ typeAsBox prettyDepth ty'+ ]+ | (ident, ty') <- take 30 ctx+ ]+ ]++ printName :: Qualified Name -> Text+ printName qn = nameType (disqualify qn) <> " " <> markCode (runName qn)++ nameType :: Name -> Text+ nameType (IdentName _) = "value"+ nameType (ValOpName _) = "operator"+ nameType (TyName _) = "type"+ nameType (TyOpName _) = "type operator"+ nameType (DctorName _) = "data constructor"+ nameType (TyClassName _) = "type class"+ nameType (ModName _) = "module"++ runName :: Qualified Name -> Text+ runName (Qualified qb (IdentName name)) =+ showQualified showIdent (Qualified qb name)+ runName (Qualified qb (ValOpName op)) =+ showQualified showOp (Qualified qb op)+ runName (Qualified qb (TyName name)) =+ showQualified runProperName (Qualified qb name)+ runName (Qualified qb (TyOpName op)) =+ showQualified showOp (Qualified qb op)+ runName (Qualified qb (DctorName name)) =+ showQualified runProperName (Qualified qb name)+ runName (Qualified qb (TyClassName name)) =+ showQualified runProperName (Qualified qb name)+ runName (Qualified (BySourcePos _) (ModName name)) =+ runModuleName name+ runName (Qualified _ ModName{}) =+ internalError "qualified ModName in runName"++ prettyDepth :: Int+ prettyDepth | full = 1000+ | otherwise = 3++ prettyType :: Type a -> Box.Box+ prettyType = prettyTypeWithDepth prettyDepth++ prettyTypeWithDepth :: Int -> Type a -> Box.Box+ prettyTypeWithDepth depth+ | full = typeAsBox depth+ | otherwise = typeAsBox depth . eraseForAllKindAnnotations . eraseKindApps++ prettyTypeAtom :: Type a -> Box.Box+ prettyTypeAtom+ | full = typeAtomAsBox prettyDepth+ | otherwise = typeAtomAsBox prettyDepth . eraseForAllKindAnnotations . eraseKindApps++ levelText :: Text+ levelText = case level of+ Error -> "error"+ Warning -> "warning"++ paras :: forall f. Foldable f => f Box.Box -> Box.Box+ paras = Box.vcat Box.left++ -- Simplify an error message+ simplifyErrorMessage :: ErrorMessage -> ErrorMessage+ simplifyErrorMessage (ErrorMessage hints simple) = ErrorMessage (simplifyHints hints) simple+ where+ -- Take the last instance of each "hint category"+ simplifyHints :: [ErrorMessageHint] -> [ErrorMessageHint]+ simplifyHints = reverse . nubBy categoriesEqual . stripRedundantHints simple . reverse++ -- Don't remove hints in the "other" category+ categoriesEqual :: ErrorMessageHint -> ErrorMessageHint -> Bool+ categoriesEqual x y =+ case (hintCategory x, hintCategory y) of+ (OtherHint, _) -> False+ (_, OtherHint) -> False+ (c1, c2) -> c1 == c2++ -- See https://github.com/purescript/purescript/issues/1802+ stripRedundantHints :: SimpleErrorMessage -> [ErrorMessageHint] -> [ErrorMessageHint]+ stripRedundantHints ExprDoesNotHaveType{} = stripFirst isCheckHint+ where+ isCheckHint ErrorCheckingType{} = True+ isCheckHint _ = False+ stripRedundantHints TypesDoNotUnify{} = stripFirst isUnifyHint+ where+ isUnifyHint ErrorUnifyingTypes{} = True+ isUnifyHint _ = False+ stripRedundantHints (NoInstanceFound (Constraint _ C.Coercible _ args _) _ _) = filter (not . isSolverHint)+ where+ isSolverHint (ErrorSolvingConstraint (Constraint _ C.Coercible _ args' _)) = args == args'+ isSolverHint _ = False+ stripRedundantHints NoInstanceFound{} = stripFirst isSolverHint+ where+ isSolverHint ErrorSolvingConstraint{} = True+ isSolverHint _ = False+ stripRedundantHints _ = id++ stripFirst :: (ErrorMessageHint -> Bool) -> [ErrorMessageHint] -> [ErrorMessageHint]+ stripFirst p (PositionedError pos : hs) = PositionedError pos : stripFirst p hs+ stripFirst p (ErrorInModule mn : hs) = ErrorInModule mn : stripFirst p hs+ stripFirst p (hint : hs)+ | p hint = hs+ | otherwise = hint : hs+ stripFirst _ [] = []++ hintCategory :: ErrorMessageHint -> HintCategory+ hintCategory ErrorCheckingType{} = ExprHint+ hintCategory ErrorInferringType{} = ExprHint+ hintCategory ErrorInExpression{} = ExprHint+ hintCategory ErrorUnifyingTypes{} = CheckHint+ hintCategory ErrorInSubsumption{} = CheckHint+ hintCategory ErrorInApplication{} = CheckHint+ hintCategory ErrorCheckingKind{} = CheckHint+ hintCategory ErrorSolvingConstraint{} = SolverHint+ hintCategory PositionedError{} = PositionHint+ hintCategory ErrorInDataConstructor{} = DeclarationHint+ hintCategory ErrorInTypeConstructor{} = DeclarationHint+ hintCategory ErrorInBindingGroup{} = DeclarationHint+ hintCategory ErrorInDataBindingGroup{} = DeclarationHint+ hintCategory ErrorInTypeSynonym{} = DeclarationHint+ hintCategory ErrorInValueDeclaration{} = DeclarationHint+ hintCategory ErrorInTypeDeclaration{} = DeclarationHint+ hintCategory ErrorInTypeClassDeclaration{} = DeclarationHint+ hintCategory ErrorInKindDeclaration{} = DeclarationHint+ hintCategory ErrorInRoleDeclaration{} = DeclarationHint+ hintCategory ErrorInForeignImport{} = DeclarationHint+ hintCategory _ = OtherHint++ prettyPrintPlainIdent :: Ident -> Text+ prettyPrintPlainIdent ident =+ if isPlainIdent ident+ then " " <> markCode (showIdent ident)+ else ""++ prettyInstanceName :: Qualified (Either SourceType Ident) -> Box.Box+ prettyInstanceName = \case+ Qualified qb (Left ty) ->+ "instance "+ Box.<> (case qb of+ ByModuleName mn -> "in module "+ Box.<> line (markCode $ runModuleName mn)+ Box.<> " "+ _ -> Box.nullBox)+ Box.<> "with type "+ Box.<> markCodeBox (prettyType ty)+ Box.<> " "+ Box.<> (line . displayStartEndPos . fst $ getAnnForType ty)+ Qualified mn (Right inst) -> line . markCode . showQualified showIdent $ Qualified mn inst++ -- As of this writing, this function assumes that all provided SourceSpans+ -- are non-overlapping (except for exact duplicates) and span no line breaks. A+ -- more sophisticated implementation without this limitation would be possible+ -- but isn't yet needed.+ showSourceSpansInContext :: NonEmpty SourceSpan -> Box.Box+ showSourceSpansInContext+ = maybe Box.nullBox (paras . fmap renderFile . NEL.groupWith1 spanName . NEL.sort)+ . NEL.nonEmpty+ . NEL.filter ((> 0) . sourcePosLine . spanStart)+ where+ renderFile :: NonEmpty SourceSpan -> Box.Box+ renderFile sss = maybe Box.nullBox (linesToBox . T.lines) $ lookup fileName fileContents+ where+ fileName = spanName $ NEL.head sss+ header = lineS . (<> ":") . makeRelative relPath $ fileName+ lineBlocks = makeLineBlocks $ NEL.groupWith1 (sourcePosLine . spanStart) sss++ linesToBox fileLines = Box.moveUp 1 $ header Box.// body+ where+ body+ = Box.punctuateV Box.left (lineNumberStyle "...")+ . map (paras . fmap renderLine)+ . flip evalState (fileLines, 1)+ . traverse (wither (\(i, x) -> fmap (i, , x) <$> ascLookupInState i) . NEL.toList)+ $ NEL.toList lineBlocks++ makeLineBlocks :: NonEmpty (NonEmpty SourceSpan) -> NonEmpty (NonEmpty (Int, [SourceSpan]))+ makeLineBlocks = startBlock+ where+ startBlock (h :| t) = over head1 (NEL.cons (pred $ headLineNumber h, [])) $ continueBlock h t++ continueBlock :: NonEmpty SourceSpan -> [NonEmpty SourceSpan] -> NonEmpty (NonEmpty (Int, [SourceSpan]))+ continueBlock lineGroup = \case+ [] ->+ endBlock lineGroup []+ nextGroup : groups -> case pred $ ((-) `on` headLineNumber) nextGroup lineGroup of+ n | n <= 3 ->+ over head1 (appendExtraLines n lineGroup <>) $ continueBlock nextGroup groups+ _ ->+ endBlock lineGroup . NEL.toList . startBlock $ nextGroup :| groups++ endBlock :: NonEmpty SourceSpan -> [NonEmpty (Int, [SourceSpan])] -> NonEmpty (NonEmpty (Int, [SourceSpan]))+ endBlock h t = appendExtraLines 1 h :| t++ headLineNumber = sourcePosLine . spanStart . NEL.head++ appendExtraLines :: Int -> NonEmpty SourceSpan -> NonEmpty (Int, [SourceSpan])+ appendExtraLines n lineGroup = (lineNum, NEL.toList lineGroup) :| [(lineNum + i, []) | i <- [1..n]]+ where+ lineNum = headLineNumber lineGroup++ renderLine :: (Int, Text, [SourceSpan]) -> Box.Box+ renderLine (lineNum, text, sss) = numBox Box.<+> lineBox+ where+ colSpans = nubOrdOn fst $ map (over both (pred . sourcePosColumn) . (spanStart &&& spanEnd)) sss+ numBox = lineNumberStyle $ show lineNum+ lineBox =+ if isJust codeColor+ then colorCodeBox codeColor $ line $ foldr highlightSpan text colSpans+ else line text Box.// line (finishUnderline $ foldr underlineSpan (T.length text, "") colSpans)++ highlightSpan :: (Int, Int) -> Text -> Text+ highlightSpan (startCol, endCol) text+ = prefix+ <> T.pack (ANSI.setSGRCode [ANSI.SetSwapForegroundBackground True])+ <> spanText+ <> T.pack (ANSI.setSGRCode [ANSI.SetSwapForegroundBackground False])+ <> suffix+ where+ (prefix, rest) = T.splitAt startCol text+ (spanText, suffix) = T.splitAt (endCol - startCol) rest++ underlineSpan :: (Int, Int) -> (Int, Text) -> (Int, Text)+ underlineSpan (startCol, endCol) (len, accum) = (startCol, T.replicate (endCol - startCol) "^" <> T.replicate (len - endCol) " " <> accum)++ finishUnderline :: (Int, Text) -> Text+ finishUnderline (len, accum) = T.replicate len " " <> accum++ lineNumberStyle :: String -> Box.Box+ lineNumberStyle = colorCodeBox (codeColor $> (ANSI.Vivid, ANSI.Black)) . Box.alignHoriz Box.right 5 . lineS++ -- Lookup the nth element of a list, but without retraversing the list every+ -- time, by instead keeping a tail of the list and the current element number+ -- in State. Only works if the argument provided is strictly ascending over+ -- the life of the State.+ ascLookupInState :: forall a. Int -> State ([a], Int) (Maybe a)+ ascLookupInState j = get >>= \(as, i) -> for (uncons $ drop (j - i) as) $ \(a, as') -> put (as', succ j) $> a++-- Pretty print and export declaration+prettyPrintExport :: DeclarationRef -> Text+prettyPrintExport (TypeRef _ pn _) = runProperName pn+prettyPrintExport ref =+ fromMaybe+ (internalError "prettyPrintRef returned Nothing in prettyPrintExport")+ (prettyPrintRef ref)++prettyPrintImport :: ModuleName -> ImportDeclarationType -> Maybe ModuleName -> Text+prettyPrintImport mn idt qual =+ let i = case idt of+ Implicit -> runModuleName mn+ Explicit refs -> runModuleName mn <> " (" <> T.intercalate ", " (mapMaybe prettyPrintRef refs) <> ")"+ Hiding refs -> runModuleName mn <> " hiding (" <> T.intercalate ", " (mapMaybe prettyPrintRef refs) <> ")"+ in i <> maybe "" (\q -> " as " <> runModuleName q) qual++prettyPrintRef :: DeclarationRef -> Maybe Text+prettyPrintRef (TypeRef _ pn Nothing) =+ Just $ runProperName pn <> "(..)"+prettyPrintRef (TypeRef _ pn (Just [])) =+ Just $ runProperName pn+prettyPrintRef (TypeRef _ pn (Just dctors)) =+ Just $ runProperName pn <> "(" <> T.intercalate ", " (map runProperName dctors) <> ")"+prettyPrintRef (TypeOpRef _ op) =+ Just $ "type " <> showOp op+prettyPrintRef (ValueRef _ ident) =+ Just $ showIdent ident+prettyPrintRef (ValueOpRef _ op) =+ Just $ showOp op+prettyPrintRef (TypeClassRef _ pn) =+ Just $ "class " <> runProperName pn+prettyPrintRef (TypeInstanceRef _ ident UserNamed) =+ Just $ showIdent ident+prettyPrintRef (TypeInstanceRef _ _ CompilerNamed) =+ Nothing+prettyPrintRef (ModuleRef _ name) =+ Just $ "module " <> runModuleName name+prettyPrintRef ReExportRef{} =+ Nothing++prettyPrintKindSignatureFor :: KindSignatureFor -> Text+prettyPrintKindSignatureFor DataSig = "data"+prettyPrintKindSignatureFor NewtypeSig = "newtype"+prettyPrintKindSignatureFor TypeSynonymSig = "type"+prettyPrintKindSignatureFor ClassSig = "class"++prettyPrintSuggestedTypeSimplified :: Type a -> String+prettyPrintSuggestedTypeSimplified = prettyPrintSuggestedType . eraseForAllKindAnnotations . eraseKindApps++-- | Pretty print multiple errors+prettyPrintMultipleErrors :: PPEOptions -> MultipleErrors -> String+prettyPrintMultipleErrors ppeOptions = unlines . map renderBox . prettyPrintMultipleErrorsBox ppeOptions++-- | Pretty print multiple warnings+prettyPrintMultipleWarnings :: PPEOptions -> MultipleErrors -> String+prettyPrintMultipleWarnings ppeOptions = unlines . map renderBox . prettyPrintMultipleWarningsBox ppeOptions++-- | Pretty print warnings as a Box+prettyPrintMultipleWarningsBox :: PPEOptions -> MultipleErrors -> [Box.Box]+prettyPrintMultipleWarningsBox ppeOptions = prettyPrintMultipleErrorsWith (ppeOptions { ppeLevel = Warning }) "Warning found:" "Warning"++-- | Pretty print errors as a Box+prettyPrintMultipleErrorsBox :: PPEOptions -> MultipleErrors -> [Box.Box]+prettyPrintMultipleErrorsBox ppeOptions = prettyPrintMultipleErrorsWith (ppeOptions { ppeLevel = Error }) "Error found:" "Error"++prettyPrintMultipleErrorsWith :: PPEOptions -> String -> String -> MultipleErrors -> [Box.Box]+prettyPrintMultipleErrorsWith ppeOptions intro _ (MultipleErrors [e]) =+ let result = prettyPrintSingleError ppeOptions e+ in [ Box.vcat Box.left [ Box.text intro+ , result+ ]+ ]+prettyPrintMultipleErrorsWith ppeOptions _ intro (MultipleErrors es) =+ let result = map (prettyPrintSingleError ppeOptions) es+ in concat $ zipWith withIntro [1 :: Int ..] result+ where+ withIntro i err = [ Box.text (intro ++ " " ++ show i ++ " of " ++ show (length es) ++ ":")+ , Box.moveRight 2 err+ ]++-- | Indent to the right, and pad on top and bottom.+indent :: Box.Box -> Box.Box+indent = Box.moveUp 1 . Box.moveDown 1 . Box.moveRight 2++line :: Text -> Box.Box+line = Box.text . T.unpack++lineS :: String -> Box.Box+lineS = Box.text++renderBox :: Box.Box -> String+renderBox = unlines+ . map (dropWhileEnd isSpace)+ . dropWhile whiteSpace+ . dropWhileEnd whiteSpace+ . lines+ . Box.render+ where+ whiteSpace = all isSpace++toTypelevelString :: Type a -> Maybe Box.Box+toTypelevelString (TypeLevelString _ s) =+ Just . Box.text $ decodeStringWithReplacement s+toTypelevelString (TypeApp _ (TypeConstructor _ C.Text) x) =+ toTypelevelString x+toTypelevelString (TypeApp _ (KindApp _ (TypeConstructor _ C.Quote) _) x) =+ Just (typeAsBox maxBound x)+toTypelevelString (TypeApp _ (TypeConstructor _ C.QuoteLabel) (TypeLevelString _ x)) =+ Just . line . prettyPrintLabel . Label $ x+toTypelevelString (TypeApp _ (TypeApp _ (TypeConstructor _ C.Beside) x) ret) =+ (Box.<>) <$> toTypelevelString x <*> toTypelevelString ret+toTypelevelString (TypeApp _ (TypeApp _ (TypeConstructor _ C.Above) x) ret) =+ (Box.//) <$> toTypelevelString x <*> toTypelevelString ret+toTypelevelString _ = Nothing++-- | Rethrow an error with a more detailed error message in the case of failure+rethrow :: (MonadError e m) => (e -> e) -> m a -> m a+rethrow f = flip catchError (throwError . f)++warnAndRethrow :: (MonadError e m, MonadWriter e m) => (e -> e) -> m a -> m a+warnAndRethrow f = rethrow f . censor f++-- | Rethrow an error with source position information+rethrowWithPosition :: (MonadError MultipleErrors m) => SourceSpan -> m a -> m a+rethrowWithPosition pos = rethrow (onErrorMessages (withPosition pos))++warnWithPosition :: (MonadWriter MultipleErrors m) => SourceSpan -> m a -> m a+warnWithPosition pos = censor (onErrorMessages (withPosition pos))++warnAndRethrowWithPosition :: (MonadError MultipleErrors m, MonadWriter MultipleErrors m) => SourceSpan -> m a -> m a+warnAndRethrowWithPosition pos = rethrowWithPosition pos . warnWithPosition pos++withPosition :: SourceSpan -> ErrorMessage -> ErrorMessage+withPosition NullSourceSpan err = err+withPosition pos (ErrorMessage hints se) = ErrorMessage (positionedError pos : hints) se++withoutPosition :: ErrorMessage -> ErrorMessage+withoutPosition (ErrorMessage hints se) = ErrorMessage (filter go hints) se+ where+ go (PositionedError _) = False+ go _ = True++positionedError :: SourceSpan -> ErrorMessageHint+positionedError = PositionedError . pure++-- | Runs a computation listening for warnings and then escalating any warnings+-- that match the predicate to error status.+escalateWarningWhen+ :: (MonadWriter MultipleErrors m, MonadError MultipleErrors m)+ => (ErrorMessage -> Bool)+ -> m a+ -> m a+escalateWarningWhen isError ma = do+ (a, w) <- censor (const mempty) $ listen ma+ let (errors, warnings) = partition isError (runMultipleErrors w)+ tell $ MultipleErrors warnings+ unless (null errors) $ throwError $ MultipleErrors errors+ return a++-- | Collect errors in in parallel+parU+ :: forall m a b+ . MonadError MultipleErrors m+ => [a]+ -> (a -> m b)+ -> m [b]+parU xs f =+ forM xs (withError . f) >>= collectErrors+ where+ withError :: m b -> m (Either MultipleErrors b)+ withError u = catchError (Right <$> u) (return . Left)++ collectErrors :: [Either MultipleErrors b] -> m [b]+ collectErrors es = case partitionEithers es of+ ([], rs) -> return rs+ (errs, _) -> throwError $ fold errs++internalCompilerError+ :: (MonadError MultipleErrors m, GHC.Stack.HasCallStack)+ => Text+ -> m a+internalCompilerError =+ throwError+ . errorMessage+ . InternalCompilerError (T.pack (GHC.Stack.prettyCallStack GHC.Stack.callStack))
+ src/Language/PureScript/Errors/JSON.hs view
@@ -0,0 +1,75 @@+{-# LANGUAGE TemplateHaskell #-}++module Language.PureScript.Errors.JSON where++import Prelude++import Data.Aeson.TH qualified as A+import Data.List.NonEmpty qualified as NEL+import Data.Text (Text)++import Language.PureScript qualified as P++data ErrorPosition = ErrorPosition+ { startLine :: Int+ , startColumn :: Int+ , endLine :: Int+ , endColumn :: Int+ } deriving (Show, Eq, Ord)++data ErrorSuggestion = ErrorSuggestion+ { replacement :: Text+ , replaceRange :: Maybe ErrorPosition+ } deriving (Show, Eq)++data JSONError = JSONError+ { position :: Maybe ErrorPosition+ , message :: String+ , errorCode :: Text+ , errorLink :: Text+ , filename :: Maybe String+ , moduleName :: Maybe Text+ , suggestion :: Maybe ErrorSuggestion+ , allSpans :: [P.SourceSpan]+ } deriving (Show, Eq)++data JSONResult = JSONResult+ { warnings :: [JSONError]+ , errors :: [JSONError]+ } deriving (Show, Eq)++$(A.deriveJSON A.defaultOptions ''ErrorPosition)+$(A.deriveJSON A.defaultOptions ''ErrorSuggestion)+$(A.deriveJSON A.defaultOptions ''JSONError)+$(A.deriveJSON A.defaultOptions ''JSONResult)++toJSONErrors :: Bool -> P.Level -> [(FilePath, Text)] -> P.MultipleErrors -> [JSONError]+toJSONErrors verbose level files = map (toJSONError verbose level files) . P.runMultipleErrors++toJSONError :: Bool -> P.Level -> [(FilePath, Text)] -> P.ErrorMessage -> JSONError+toJSONError verbose level files e =+ JSONError (toErrorPosition <$> fmap NEL.head spans)+ (P.renderBox (P.prettyPrintSingleError (P.PPEOptions Nothing verbose level False mempty files) (P.stripModuleAndSpan e)))+ (P.errorCode e)+ (P.errorDocUri e)+ (P.spanName <$> fmap NEL.head spans)+ (P.runModuleName <$> P.errorModule e)+ (toSuggestion e)+ (maybe [] NEL.toList spans)+ where+ spans :: Maybe (NEL.NonEmpty P.SourceSpan)+ spans = P.errorSpan e++ toErrorPosition :: P.SourceSpan -> ErrorPosition+ toErrorPosition ss =+ ErrorPosition (P.sourcePosLine (P.spanStart ss))+ (P.sourcePosColumn (P.spanStart ss))+ (P.sourcePosLine (P.spanEnd ss))+ (P.sourcePosColumn (P.spanEnd ss))+ toSuggestion :: P.ErrorMessage -> Maybe ErrorSuggestion+ toSuggestion em =+ case P.errorSuggestion $ P.unwrapErrorMessage em of+ Nothing -> Nothing+ Just s -> Just $ ErrorSuggestion (suggestionText s) (toErrorPosition <$> P.suggestionSpan em)++ suggestionText (P.ErrorSuggestion s) = s
+ src/Language/PureScript/Externs.hs view
@@ -0,0 +1,280 @@+{-# Language DeriveAnyClass #-}+-- |+-- This module generates code for \"externs\" files, i.e. files containing only+-- foreign import declarations.+--+module Language.PureScript.Externs+ ( ExternsFile(..)+ , ExternsImport(..)+ , ExternsFixity(..)+ , ExternsTypeFixity(..)+ , ExternsDeclaration(..)+ , externsIsCurrentVersion+ , moduleToExternsFile+ , applyExternsFileToEnvironment+ , externsFileName+ ) where++import Prelude++import Codec.Serialise (Serialise)+import Control.DeepSeq (NFData)+import Control.Monad (join)+import Data.Maybe (fromMaybe, mapMaybe, maybeToList)+import Data.List (foldl', find)+import Data.Foldable (fold)+import Data.Text (Text)+import Data.Text qualified as T+import Data.Version (showVersion)+import Data.Map qualified as M+import Data.List.NonEmpty qualified as NEL+import GHC.Generics (Generic)++import Language.PureScript.AST (Associativity, Declaration(..), DeclarationRef(..), Fixity(..), ImportDeclarationType, Module(..), NameSource(..), Precedence, SourceSpan, pattern TypeFixityDeclaration, pattern ValueFixityDeclaration, getTypeOpRef, getValueOpRef)+import Language.PureScript.AST.Declarations.ChainId (ChainId)+import Language.PureScript.Crash (internalError)+import Language.PureScript.Environment (DataDeclType, Environment(..), FunctionalDependency, NameKind(..), NameVisibility(..), TypeClassData(..), TypeKind(..), dictTypeName, makeTypeClassData)+import Language.PureScript.Names (Ident, ModuleName, OpName, OpNameType(..), ProperName, ProperNameType(..), Qualified(..), QualifiedBy(..), coerceProperName, isPlainIdent)+import Language.PureScript.TypeClassDictionaries (NamedDict, TypeClassDictionaryInScope(..))+import Language.PureScript.Types (SourceConstraint, SourceType, srcInstanceType)++import Paths_purescript as Paths++-- | The data which will be serialized to an externs file+data ExternsFile = ExternsFile+ -- NOTE: Make sure to keep `efVersion` as the first field in this+ -- record, so the derived Serialise instance produces CBOR that can+ -- be checked for its version independent of the remaining format+ { efVersion :: Text+ -- ^ The externs version+ , efModuleName :: ModuleName+ -- ^ Module name+ , efExports :: [DeclarationRef]+ -- ^ List of module exports+ , efImports :: [ExternsImport]+ -- ^ List of module imports+ , efFixities :: [ExternsFixity]+ -- ^ List of operators and their fixities+ , efTypeFixities :: [ExternsTypeFixity]+ -- ^ List of type operators and their fixities+ , efDeclarations :: [ExternsDeclaration]+ -- ^ List of type and value declaration+ , efSourceSpan :: SourceSpan+ -- ^ Source span for error reporting+ } deriving (Show, Generic, NFData)++instance Serialise ExternsFile++-- | A module import in an externs file+data ExternsImport = ExternsImport+ {+ -- | The imported module+ eiModule :: ModuleName+ -- | The import type: regular, qualified or hiding+ , eiImportType :: ImportDeclarationType+ -- | The imported-as name, for qualified imports+ , eiImportedAs :: Maybe ModuleName+ } deriving (Show, Generic, NFData)++instance Serialise ExternsImport++-- | A fixity declaration in an externs file+data ExternsFixity = ExternsFixity+ {+ -- | The associativity of the operator+ efAssociativity :: Associativity+ -- | The precedence level of the operator+ , efPrecedence :: Precedence+ -- | The operator symbol+ , efOperator :: OpName 'ValueOpName+ -- | The value the operator is an alias for+ , efAlias :: Qualified (Either Ident (ProperName 'ConstructorName))+ } deriving (Show, Generic, NFData)++instance Serialise ExternsFixity++-- | A type fixity declaration in an externs file+data ExternsTypeFixity = ExternsTypeFixity+ {+ -- | The associativity of the operator+ efTypeAssociativity :: Associativity+ -- | The precedence level of the operator+ , efTypePrecedence :: Precedence+ -- | The operator symbol+ , efTypeOperator :: OpName 'TypeOpName+ -- | The value the operator is an alias for+ , efTypeAlias :: Qualified (ProperName 'TypeName)+ } deriving (Show, Generic, NFData)++instance Serialise ExternsTypeFixity++-- | A type or value declaration appearing in an externs file+data ExternsDeclaration =+ -- | A type declaration+ EDType+ { edTypeName :: ProperName 'TypeName+ , edTypeKind :: SourceType+ , edTypeDeclarationKind :: TypeKind+ }+ -- | A type synonym+ | EDTypeSynonym+ { edTypeSynonymName :: ProperName 'TypeName+ , edTypeSynonymArguments :: [(Text, Maybe SourceType)]+ , edTypeSynonymType :: SourceType+ }+ -- | A data constructor+ | EDDataConstructor+ { edDataCtorName :: ProperName 'ConstructorName+ , edDataCtorOrigin :: DataDeclType+ , edDataCtorTypeCtor :: ProperName 'TypeName+ , edDataCtorType :: SourceType+ , edDataCtorFields :: [Ident]+ }+ -- | A value declaration+ | EDValue+ { edValueName :: Ident+ , edValueType :: SourceType+ }+ -- | A type class declaration+ | EDClass+ { edClassName :: ProperName 'ClassName+ , edClassTypeArguments :: [(Text, Maybe SourceType)]+ , edClassMembers :: [(Ident, SourceType)]+ , edClassConstraints :: [SourceConstraint]+ , edFunctionalDependencies :: [FunctionalDependency]+ , edIsEmpty :: Bool+ }+ -- | An instance declaration+ | EDInstance+ { edInstanceClassName :: Qualified (ProperName 'ClassName)+ , edInstanceName :: Ident+ , edInstanceForAll :: [(Text, SourceType)]+ , edInstanceKinds :: [SourceType]+ , edInstanceTypes :: [SourceType]+ , edInstanceConstraints :: Maybe [SourceConstraint]+ , edInstanceChain :: Maybe ChainId+ , edInstanceChainIndex :: Integer+ , edInstanceNameSource :: NameSource+ , edInstanceSourceSpan :: SourceSpan+ }+ deriving (Show, Generic, NFData)++instance Serialise ExternsDeclaration++-- | Check whether the version in an externs file matches the currently running+-- version.+externsIsCurrentVersion :: ExternsFile -> Bool+externsIsCurrentVersion ef =+ T.unpack (efVersion ef) == showVersion Paths.version++-- | Convert an externs file back into a module+applyExternsFileToEnvironment :: ExternsFile -> Environment -> Environment+applyExternsFileToEnvironment ExternsFile{..} = flip (foldl' applyDecl) efDeclarations+ where+ applyDecl :: Environment -> ExternsDeclaration -> Environment+ applyDecl env (EDType pn kind tyKind) = env { types = M.insert (qual pn) (kind, tyKind) (types env) }+ applyDecl env (EDTypeSynonym pn args ty) = env { typeSynonyms = M.insert (qual pn) (args, ty) (typeSynonyms env) }+ applyDecl env (EDDataConstructor pn dTy tNm ty nms) = env { dataConstructors = M.insert (qual pn) (dTy, tNm, ty, nms) (dataConstructors env) }+ applyDecl env (EDValue ident ty) = env { names = M.insert (Qualified (ByModuleName efModuleName) ident) (ty, External, Defined) (names env) }+ applyDecl env (EDClass pn args members cs deps tcIsEmpty) = env { typeClasses = M.insert (qual pn) (makeTypeClassData args members cs deps tcIsEmpty) (typeClasses env) }+ applyDecl env (EDInstance className ident vars kinds tys cs ch idx ns ss) =+ env { typeClassDictionaries =+ updateMap+ (updateMap (M.insertWith (<>) (qual ident) (pure dict)) className)+ (ByModuleName efModuleName) (typeClassDictionaries env) }+ where+ dict :: NamedDict+ dict = TypeClassDictionaryInScope ch idx (qual ident) [] className vars kinds tys cs instTy++ updateMap :: (Ord k, Monoid a) => (a -> a) -> k -> M.Map k a -> M.Map k a+ updateMap f = M.alter (Just . f . fold)++ instTy :: Maybe SourceType+ instTy = case ns of+ CompilerNamed -> Just $ srcInstanceType ss vars className tys+ UserNamed -> Nothing++ qual :: a -> Qualified a+ qual = Qualified (ByModuleName efModuleName)++-- | Generate an externs file for all declarations in a module.+--+-- The `Map Ident Ident` argument should contain any top-level `GenIdent`s that+-- were rewritten to `Ident`s when the module was compiled; this rewrite only+-- happens in the CoreFn, not the original module AST, so it needs to be+-- applied to the exported names here also. (The appropriate map is returned by+-- `L.P.Renamer.renameInModule`.)+moduleToExternsFile :: Module -> Environment -> M.Map Ident Ident -> ExternsFile+moduleToExternsFile (Module _ _ _ _ Nothing) _ _ = internalError "moduleToExternsFile: module exports were not elaborated"+moduleToExternsFile (Module ss _ mn ds (Just exps)) env renamedIdents = ExternsFile{..}+ where+ efVersion = T.pack (showVersion Paths.version)+ efModuleName = mn+ efExports = map renameRef exps+ efImports = mapMaybe importDecl ds+ efFixities = mapMaybe fixityDecl ds+ efTypeFixities = mapMaybe typeFixityDecl ds+ efDeclarations = concatMap toExternsDeclaration exps+ efSourceSpan = ss++ fixityDecl :: Declaration -> Maybe ExternsFixity+ fixityDecl (ValueFixityDeclaration _ (Fixity assoc prec) name op) =+ fmap (const (ExternsFixity assoc prec op name)) (find ((== Just op) . getValueOpRef) exps)+ fixityDecl _ = Nothing++ typeFixityDecl :: Declaration -> Maybe ExternsTypeFixity+ typeFixityDecl (TypeFixityDeclaration _ (Fixity assoc prec) name op) =+ fmap (const (ExternsTypeFixity assoc prec op name)) (find ((== Just op) . getTypeOpRef) exps)+ typeFixityDecl _ = Nothing++ importDecl :: Declaration -> Maybe ExternsImport+ importDecl (ImportDeclaration _ m mt qmn) = Just (ExternsImport m mt qmn)+ importDecl _ = Nothing++ toExternsDeclaration :: DeclarationRef -> [ExternsDeclaration]+ toExternsDeclaration (TypeRef _ pn dctors) =+ case Qualified (ByModuleName mn) pn `M.lookup` types env of+ Nothing -> internalError "toExternsDeclaration: no kind in toExternsDeclaration"+ Just (kind, TypeSynonym)+ | Just (args, synTy) <- Qualified (ByModuleName mn) pn `M.lookup` typeSynonyms env -> [ EDType pn kind TypeSynonym, EDTypeSynonym pn args synTy ]+ Just (kind, ExternData rs) -> [ EDType pn kind (ExternData rs) ]+ Just (kind, tk@(DataType _ _ tys)) ->+ EDType pn kind tk : [ EDDataConstructor dctor dty pn ty args+ | dctor <- fromMaybe (map fst tys) dctors+ , (dty, _, ty, args) <- maybeToList (Qualified (ByModuleName mn) dctor `M.lookup` dataConstructors env)+ ]+ _ -> internalError "toExternsDeclaration: Invalid input"+ toExternsDeclaration (ValueRef _ ident)+ | Just (ty, _, _) <- Qualified (ByModuleName mn) ident `M.lookup` names env+ = [ EDValue (lookupRenamedIdent ident) ty ]+ toExternsDeclaration (TypeClassRef _ className)+ | let dictName = dictTypeName . coerceProperName $ className+ , Just TypeClassData{..} <- Qualified (ByModuleName mn) className `M.lookup` typeClasses env+ , Just (kind, tk) <- Qualified (ByModuleName mn) (coerceProperName className) `M.lookup` types env+ , Just (dictKind, dictData@(DataType _ _ [(dctor, _)])) <- Qualified (ByModuleName mn) dictName `M.lookup` types env+ , Just (dty, _, ty, args) <- Qualified (ByModuleName mn) dctor `M.lookup` dataConstructors env+ = [ EDType (coerceProperName className) kind tk+ , EDType dictName dictKind dictData+ , EDDataConstructor dctor dty dictName ty args+ , EDClass className typeClassArguments ((\(a, b, _) -> (a, b)) <$> typeClassMembers) typeClassSuperclasses typeClassDependencies typeClassIsEmpty+ ]+ toExternsDeclaration (TypeInstanceRef ss' ident ns)+ = [ EDInstance tcdClassName (lookupRenamedIdent ident) tcdForAll tcdInstanceKinds tcdInstanceTypes tcdDependencies tcdChain tcdIndex ns ss'+ | m1 <- maybeToList (M.lookup (ByModuleName mn) (typeClassDictionaries env))+ , m2 <- M.elems m1+ , nel <- maybeToList (M.lookup (Qualified (ByModuleName mn) ident) m2)+ , TypeClassDictionaryInScope{..} <- NEL.toList nel+ ]+ toExternsDeclaration _ = []++ renameRef :: DeclarationRef -> DeclarationRef+ renameRef = \case+ ValueRef ss' ident -> ValueRef ss' $ lookupRenamedIdent ident+ TypeInstanceRef ss' ident _ | not $ isPlainIdent ident -> TypeInstanceRef ss' (lookupRenamedIdent ident) CompilerNamed+ other -> other++ lookupRenamedIdent :: Ident -> Ident+ lookupRenamedIdent = flip (join M.findWithDefault) renamedIdents++externsFileName :: FilePath+externsFileName = "externs.cbor"
+ src/Language/PureScript/Glob.hs view
@@ -0,0 +1,44 @@+module Language.PureScript.Glob where++import Prelude++import Control.Monad (when)+import Data.List (nub, (\\))+import Data.Text qualified as T+import System.FilePath.Glob (glob)+import System.IO (hPutStrLn, stderr)+import System.IO.UTF8 (readUTF8FileT)++data PSCGlobs = PSCGlobs+ { pscInputGlobs :: [FilePath]+ , pscInputGlobsFromFile :: Maybe FilePath+ , pscExcludeGlobs :: [FilePath]+ , pscWarnFileTypeNotFound :: FilePath -> IO ()+ }++toInputGlobs :: PSCGlobs -> IO [FilePath]+toInputGlobs (PSCGlobs {..}) = do+ globsFromFile <- inputGlobsFromFile pscInputGlobsFromFile+ included <- globWarningOnMisses pscWarnFileTypeNotFound $ nub $ pscInputGlobs <> globsFromFile+ excluded <- globWarningOnMisses pscWarnFileTypeNotFound pscExcludeGlobs+ pure $ included \\ excluded++inputGlobsFromFile :: Maybe FilePath -> IO [FilePath]+inputGlobsFromFile globsFromFile = do+ mbInputsFromFile <- traverse readUTF8FileT globsFromFile+ let+ excludeBlankLines = not . T.null . T.strip+ excludeComments = not . T.isPrefixOf "#"+ toInputs = map (T.unpack . T.strip) . filter (\x -> excludeBlankLines x && excludeComments x) . T.lines+ pure $ foldMap toInputs mbInputsFromFile++globWarningOnMisses :: (String -> IO ()) -> [FilePath] -> IO [FilePath]+globWarningOnMisses warn = foldMap globWithWarning+ where+ globWithWarning pattern' = do+ paths <- glob pattern'+ when (null paths) $ warn pattern'+ return paths++warnFileTypeNotFound :: String -> String -> IO ()+warnFileTypeNotFound pursCmd = hPutStrLn stderr . ("purs " <> pursCmd <> ": No files found using pattern: " ++)
+ src/Language/PureScript/Graph.hs view
@@ -0,0 +1,58 @@+module Language.PureScript.Graph (graph) where++import Prelude++import Data.Aeson qualified as Json+import Data.Aeson.Key qualified as Json.Key+import Data.Aeson.KeyMap qualified as Json.Map+import Data.Map qualified as Map++import Control.Monad (forM)+import Data.Aeson ((.=))+import Data.Foldable (foldl')+import Data.Map (Map)+import Data.Maybe (fromMaybe)+import Data.Text (Text)+import System.IO.UTF8 (readUTF8FileT)++import Language.PureScript.Crash qualified as Crash+import Language.PureScript.CST qualified as CST+import Language.PureScript.Make qualified as Make+import Language.PureScript.ModuleDependencies qualified as Dependencies+import Language.PureScript.Options qualified as Options++import Language.PureScript.Errors (MultipleErrors)+import Language.PureScript.Names (ModuleName, runModuleName)+++-- | Given a set of filepaths, try to build the dependency graph and return+-- that as its JSON representation (or a bunch of errors, if any)+graph :: [FilePath] -> IO (Either MultipleErrors Json.Value, MultipleErrors)+graph input = do+ moduleFiles <- readInput input+ Make.runMake Options.defaultOptions $ do+ ms <- CST.parseModulesFromFiles id moduleFiles+ let parsedModuleSig = Dependencies.moduleSignature . CST.resPartial+ (_sorted, moduleGraph) <- Dependencies.sortModules Dependencies.Direct (parsedModuleSig . snd) ms+ let pathMap = Map.fromList $+ map (\(p, m) -> (Dependencies.sigModuleName (parsedModuleSig m), p)) ms+ pure (moduleGraphToJSON pathMap moduleGraph)++moduleGraphToJSON+ :: Map ModuleName FilePath+ -> Dependencies.ModuleGraph+ -> Json.Value+moduleGraphToJSON paths = Json.Object . foldl' insert mempty+ where+ insert :: Json.Object -> (ModuleName, [ModuleName]) -> Json.Object+ insert obj (mn, depends) = Json.Map.insert (Json.Key.fromText (runModuleName mn)) value obj+ where+ path = fromMaybe (Crash.internalError "missing module name in graph") $ Map.lookup mn paths+ value = Json.object+ [ "path" .= path+ , "depends" .= fmap runModuleName depends+ ]++readInput :: [FilePath] -> IO [(FilePath, Text)]+readInput inputFiles =+ forM inputFiles $ \inFile -> (inFile, ) <$> readUTF8FileT inFile
+ src/Language/PureScript/Hierarchy.hs view
@@ -0,0 +1,85 @@+-----------------------------------------------------------------------------+--+-- Module : Language.PureScript.Hierarchy+-- Copyright : (c) Hardy Jones 2014+-- License : MIT (http://opensource.org/licenses/MIT)+--+-- Maintainer : Hardy Jones <jones3.hardy@gmail.com>+-- Stability : experimental+-- Portability :+--+-- |+-- Generate Directed Graphs of PureScript TypeClasses+--+-----------------------------------------------------------------------------++module Language.PureScript.Hierarchy where++import Prelude+import Protolude (ordNub)++import Data.List (sort)+import Data.Text qualified as T+import Language.PureScript qualified as P++newtype SuperMap = SuperMap+ { _unSuperMap :: Either (P.ProperName 'P.ClassName) (P.ProperName 'P.ClassName, P.ProperName 'P.ClassName)+ }+ deriving Eq++instance Ord SuperMap where+ compare (SuperMap s) (SuperMap s') = getCls s `compare` getCls s'+ where+ getCls = either id snd++data Graph = Graph+ { graphName :: GraphName+ , digraph :: Digraph+ }+ deriving (Eq, Show)++newtype GraphName = GraphName+ { _unGraphName :: T.Text+ }+ deriving (Eq, Show)++newtype Digraph = Digraph+ { _unDigraph :: T.Text+ }+ deriving (Eq, Show)++prettyPrint :: SuperMap -> T.Text+prettyPrint (SuperMap (Left sub)) = " " <> P.runProperName sub <> ";"+prettyPrint (SuperMap (Right (super, sub))) =+ " " <> P.runProperName super <> " -> " <> P.runProperName sub <> ";"++runModuleName :: P.ModuleName -> GraphName+runModuleName (P.ModuleName name) =+ GraphName $ T.replace "." "_" name++typeClasses :: Functor f => f P.Module -> f (Maybe Graph)+typeClasses =+ fmap typeClassGraph++typeClassGraph :: P.Module -> Maybe Graph+typeClassGraph (P.Module _ _ moduleName decls _) =+ if null supers then Nothing else Just (Graph name graph)+ where+ name = runModuleName moduleName+ supers = sort . ordNub $ concatMap superClasses decls+ graph = Digraph $ typeClassPrologue name <> typeClassBody supers <> typeClassEpilogue++typeClassPrologue :: GraphName -> T.Text+typeClassPrologue (GraphName name) = "digraph " <> name <> " {\n"++typeClassBody :: [SuperMap] -> T.Text+typeClassBody supers = T.intercalate "\n" (prettyPrint <$> supers)++typeClassEpilogue :: T.Text+typeClassEpilogue = "\n}"++superClasses :: P.Declaration -> [SuperMap]+superClasses (P.TypeClassDeclaration _ sub _ supers@(_:_) _ _) =+ fmap (\(P.Constraint _ (P.Qualified _ super) _ _ _) -> SuperMap (Right (super, sub))) supers+superClasses (P.TypeClassDeclaration _ sub _ _ _ _) = [SuperMap (Left sub)]+superClasses _ = []
+ src/Language/PureScript/Ide.hs view
@@ -0,0 +1,234 @@+-----------------------------------------------------------------------------+--+-- Module : Language.PureScript.Ide+-- Description : Interface for the psc-ide-server+-- Copyright : Christoph Hegemann 2016+-- License : MIT (http://opensource.org/licenses/MIT)+--+-- Maintainer : Christoph Hegemann <christoph.hegemann1337@gmail.com>+-- Stability : experimental+--+-- |+-- Interface for the psc-ide-server+-----------------------------------------------------------------------------++{-# LANGUAGE PackageImports #-}++module Language.PureScript.Ide+ ( handleCommand+ ) where++import Protolude hiding (moduleName)++import "monad-logger" Control.Monad.Logger (MonadLogger, logWarnN)+import Data.Map qualified as Map+import Data.Text qualified as T+import Language.PureScript qualified as P+import Language.PureScript.Glob (toInputGlobs, PSCGlobs(..))+import Language.PureScript.Ide.CaseSplit qualified as CS+import Language.PureScript.Ide.Command (Command(..), ImportCommand(..), ListType(..))+import Language.PureScript.Ide.Completion (CompletionOptions, completionFromMatch, getCompletions, getExactCompletions, simpleExport)+import Language.PureScript.Ide.Error (IdeError(..))+import Language.PureScript.Ide.Externs (readExternFile)+import Language.PureScript.Ide.Filter (Filter)+import Language.PureScript.Ide.Imports (parseImportsFromFile)+import Language.PureScript.Ide.Imports.Actions (addImplicitImport, addImportForIdentifier, addQualifiedImport, answerRequest)+import Language.PureScript.Ide.Matcher (Matcher)+import Language.PureScript.Ide.Prim (idePrimDeclarations)+import Language.PureScript.Ide.Rebuild (rebuildFileAsync, rebuildFileSync)+import Language.PureScript.Ide.SourceFile (parseModulesFromFiles)+import Language.PureScript.Ide.State (getAllModules, getLoadedModulenames, insertExterns, insertModule, populateVolatileState, populateVolatileStateSync, resetIdeState)+import Language.PureScript.Ide.Types (Annotation(..), Ide, IdeConfiguration(..), IdeDeclarationAnn(..), IdeEnvironment(..), Success(..))+import Language.PureScript.Ide.Util (discardAnn, identifierFromIdeDeclaration, namespaceForDeclaration, withEmptyAnn)+import Language.PureScript.Ide.Usage (findUsages)+import System.Directory (getCurrentDirectory, getDirectoryContents, doesDirectoryExist, doesFileExist)+import System.FilePath ((</>), normalise)++-- | Accepts a Command and runs it against psc-ide's State. This is the main+-- entry point for the server.+handleCommand+ :: (Ide m, MonadLogger m, MonadError IdeError m)+ => Command+ -> m Success+handleCommand c = case c of+ Load [] ->+ -- Clearing the State before populating it to avoid a space leak+ resetIdeState *> findAvailableExterns >>= loadModulesAsync+ Load modules ->+ loadModulesAsync modules+ LoadSync [] ->+ findAvailableExterns >>= loadModulesSync+ LoadSync modules ->+ loadModulesSync modules+ Type search filters currentModule ->+ findType search filters currentModule+ Complete filters matcher currentModule complOptions ->+ findCompletions filters matcher currentModule complOptions+ List LoadedModules -> do+ logWarnN+ "Listing the loaded modules command is DEPRECATED, use the completion command and filter it to modules instead"+ printModules+ List AvailableModules ->+ listAvailableModules+ List (Imports fp) ->+ ImportList <$> parseImportsFromFile fp+ CaseSplit l b e wca t ->+ caseSplit l b e wca t+ AddClause l wca ->+ MultilineTextResult <$> CS.addClause l wca+ FindUsages moduleName ident namespace -> do+ Map.lookup moduleName <$> getAllModules Nothing >>= \case+ Nothing -> throwError (GeneralError "Module not found")+ Just decls -> do+ case find (\d -> namespaceForDeclaration (discardAnn d) == namespace+ && identifierFromIdeDeclaration (discardAnn d) == ident) decls of+ Nothing -> throwError (GeneralError "Declaration not found")+ Just declaration -> do+ let sourceModule = fromMaybe moduleName (declaration & _idaAnnotation & _annExportedFrom)+ UsagesResult . foldMap toList <$> findUsages (discardAnn declaration) sourceModule+ Import fp outfp _ (AddImplicitImport mn) -> do+ rs <- addImplicitImport fp mn+ answerRequest outfp rs+ Import fp outfp _ (AddQualifiedImport mn qual) -> do+ rs <- addQualifiedImport fp mn qual+ answerRequest outfp rs+ Import fp outfp filters (AddImportForIdentifier ident qual) -> do+ rs <- addImportForIdentifier fp ident qual filters+ case rs of+ Right rs' -> answerRequest outfp rs'+ Left question ->+ pure (CompletionResult (map (completionFromMatch . simpleExport . map withEmptyAnn) question))+ Rebuild file actualFile targets ->+ rebuildFileAsync file actualFile targets+ RebuildSync file actualFile targets ->+ rebuildFileSync file actualFile targets+ Cwd ->+ TextResult . T.pack <$> liftIO getCurrentDirectory+ Reset ->+ resetIdeState $> TextResult "State has been reset."+ Quit ->+ liftIO exitSuccess++findCompletions+ :: Ide m+ => [Filter]+ -> Matcher IdeDeclarationAnn+ -> Maybe P.ModuleName+ -> CompletionOptions+ -> m Success+findCompletions filters matcher currentModule complOptions = do+ modules <- getAllModules currentModule+ let insertPrim = Map.union idePrimDeclarations+ pure (CompletionResult (getCompletions filters matcher complOptions (insertPrim modules)))++findType+ :: Ide m+ => Text+ -> [Filter]+ -> Maybe P.ModuleName+ -> m Success+findType search filters currentModule = do+ modules <- getAllModules currentModule+ let insertPrim = Map.union idePrimDeclarations+ pure (CompletionResult (getExactCompletions search filters (insertPrim modules)))++printModules :: Ide m => m Success+printModules = ModuleList . map P.runModuleName <$> getLoadedModulenames++outputDirectory :: Ide m => m FilePath+outputDirectory = do+ outputPath <- confOutputPath . ideConfiguration <$> ask+ cwd <- liftIO getCurrentDirectory+ pure (cwd </> outputPath)++listAvailableModules :: Ide m => m Success+listAvailableModules = do+ oDir <- outputDirectory+ liftIO $ do+ contents <- getDirectoryContents oDir+ let cleaned = filter (`notElem` [".", ".."]) contents+ return (ModuleList (map toS cleaned))++caseSplit :: (Ide m, MonadError IdeError m) =>+ Text -> Int -> Int -> CS.WildcardAnnotations -> Text -> m Success+caseSplit l b e csa t = do+ patterns <- CS.makePattern l b e csa <$> CS.caseSplit t+ pure (MultilineTextResult patterns)++-- | Finds all the externs inside the output folder and returns the+-- corresponding module names+findAvailableExterns :: (Ide m, MonadError IdeError m) => m [P.ModuleName]+findAvailableExterns = do+ oDir <- outputDirectory+ unlessM (liftIO (doesDirectoryExist oDir))+ (throwError (GeneralError $ "Couldn't locate your output directory at: " <> T.pack (normalise oDir)))+ liftIO $ do+ directories <- getDirectoryContents oDir+ moduleNames <- filterM (containsExterns oDir) directories+ pure (P.moduleNameFromString . toS <$> moduleNames)+ where+ -- Takes the output directory and a filepath like "Data.Array" and+ -- looks up, whether that folder contains an externs file+ containsExterns :: FilePath -> FilePath -> IO Bool+ containsExterns oDir d+ | d `elem` [".", ".."] = pure False+ | otherwise = do+ let file = oDir </> d </> P.externsFileName+ doesFileExist file++-- | Finds all matches for the globs specified at the commandline+findAllSourceFiles :: Ide m => m [FilePath]+findAllSourceFiles = do+ IdeConfiguration{..} <- ideConfiguration <$> ask+ liftIO $ toInputGlobs $ PSCGlobs+ { pscInputGlobs = confGlobs+ , pscInputGlobsFromFile = confGlobsFromFile+ , pscExcludeGlobs = confGlobsExclude+ , pscWarnFileTypeNotFound = const $ pure ()+ }+++-- | Looks up the ExternsFiles for the given Modulenames and loads them into the+-- server state. Then proceeds to parse all the specified sourcefiles and+-- inserts their ASTs into the state. Finally kicks off an async worker, which+-- populates the VolatileState.+loadModulesAsync+ :: (Ide m, MonadError IdeError m, MonadLogger m)+ => [P.ModuleName]+ -> m Success+loadModulesAsync moduleNames = do+ tr <- loadModules moduleNames+ _ <- populateVolatileState+ pure tr++loadModulesSync+ :: (Ide m, MonadError IdeError m, MonadLogger m)+ => [P.ModuleName]+ -> m Success+loadModulesSync moduleNames = do+ tr <- loadModules moduleNames+ populateVolatileStateSync+ pure tr++loadModules+ :: (Ide m, MonadError IdeError m, MonadLogger m)+ => [P.ModuleName]+ -> m Success+loadModules moduleNames = do+ -- We resolve all the modulenames to externs files and load these into memory.+ oDir <- outputDirectory+ let efPaths =+ map (\mn -> oDir </> toS (P.runModuleName mn) </> P.externsFileName) moduleNames+ efiles <- traverse readExternFile efPaths+ traverse_ insertExterns efiles++ -- We parse all source files, log eventual parse failures and insert the+ -- successful parses into the state.+ (failures, allModules) <-+ partitionEithers <$> (parseModulesFromFiles =<< findAllSourceFiles)+ unless (null failures) $+ logWarnN ("Failed to parse: " <> show failures)+ traverse_ insertModule allModules++ pure (TextResult ("Loaded " <> show (length efiles) <> " modules and "+ <> show (length allModules) <> " source files."))
+ src/Language/PureScript/Ide/CaseSplit.hs view
@@ -0,0 +1,155 @@+-----------------------------------------------------------------------------+--+-- Module : Language.PureScript.Ide.CaseSplit+-- Description : Casesplitting and adding function clauses+-- Copyright : Christoph Hegemann 2016+-- License : MIT (http://opensource.org/licenses/MIT)+--+-- Maintainer : Christoph Hegemann <christoph.hegemann1337@gmail.com>+-- Stability : experimental+--+-- |+-- Casesplitting and adding function clauses+-----------------------------------------------------------------------------++module Language.PureScript.Ide.CaseSplit+ ( WildcardAnnotations()+ , explicitAnnotations+ , noAnnotations+ , makePattern+ , addClause+ , caseSplit+ ) where++import Protolude hiding (Constructor)++import Data.List.NonEmpty qualified as NE+import Data.Map qualified as M+import Data.Text qualified as T+import Language.PureScript qualified as P+import Language.PureScript.CST qualified as CST++import Language.PureScript.Externs (ExternsDeclaration(..), ExternsFile(..))+import Language.PureScript.Ide.Error (IdeError(..))+import Language.PureScript.Ide.State (cachedRebuild, getExternFiles)+import Language.PureScript.Ide.Types (Ide)++type Constructor = (P.ProperName 'P.ConstructorName, [P.SourceType])++newtype WildcardAnnotations = WildcardAnnotations Bool++explicitAnnotations :: WildcardAnnotations+explicitAnnotations = WildcardAnnotations True++noAnnotations :: WildcardAnnotations+noAnnotations = WildcardAnnotations False++type DataType = ([(Text, Maybe P.SourceType, P.Role)], [(P.ProperName 'P.ConstructorName, [P.SourceType])])++caseSplit+ :: (Ide m, MonadError IdeError m)+ => Text+ -> m [Constructor]+caseSplit q = do+ type' <- parseType' q+ (tc, args) <- splitTypeConstructor type'+ (typeVars, ctors) <- findTypeDeclaration tc+ let applyTypeVars = P.everywhereOnTypes (P.replaceAllTypeVars (zip (map (\(name, _, _) -> name) typeVars) args))+ let appliedCtors = map (second (map applyTypeVars)) ctors+ pure appliedCtors++findTypeDeclaration+ :: (Ide m, MonadError IdeError m)+ => P.ProperName 'P.TypeName+ -> m DataType+findTypeDeclaration q = do+ efs <- getExternFiles+ efs' <- maybe efs (flip (uncurry M.insert) efs) <$> cachedRebuild+ let m = getFirst $ foldMap (findTypeDeclaration' q) efs'+ case m of+ Just mn -> pure mn+ Nothing -> throwError (GeneralError "Not Found")++findTypeDeclaration'+ :: P.ProperName 'P.TypeName+ -> ExternsFile+ -> First DataType+findTypeDeclaration' t ExternsFile{..} =+ First $ head $ mapMaybe (\case+ EDType tn _ (P.DataType _ typeVars ctors)+ | tn == t -> Just (typeVars, ctors)+ _ -> Nothing) efDeclarations++splitTypeConstructor :: (MonadError IdeError m) =>+ P.Type a -> m (P.ProperName 'P.TypeName, [P.Type a])+splitTypeConstructor = go []+ where+ go acc (P.TypeApp _ ty arg) = go (arg : acc) ty+ go acc (P.TypeConstructor _ tc) = pure (P.disqualify tc, acc)+ go _ _ = throwError (GeneralError "Failed to read TypeConstructor")++prettyCtor :: WildcardAnnotations -> Constructor -> Text+prettyCtor _ (ctorName, []) = P.runProperName ctorName+prettyCtor wsa (ctorName, ctorArgs) =+ "(" <> P.runProperName ctorName <> " "+ <> T.unwords (map (prettyPrintWildcard wsa) ctorArgs) <> ")"++prettyPrintWildcard :: WildcardAnnotations -> P.Type a -> Text+prettyPrintWildcard (WildcardAnnotations True) = prettyWildcard+prettyPrintWildcard (WildcardAnnotations False) = const "_"++prettyWildcard :: P.Type a -> Text+prettyWildcard t = "( _ :: " <> T.strip (T.pack (P.prettyPrintTypeAtom maxBound t)) <> ")"++-- | Constructs Patterns to insert into a sourcefile+makePattern :: Text -- ^ Current line+ -> Int -- ^ Begin of the split+ -> Int -- ^ End of the split+ -> WildcardAnnotations -- ^ Whether to explicitly type the splits+ -> [Constructor] -- ^ Constructors to split+ -> [Text]+makePattern t x y wsa = makePattern' (T.take x t) (T.drop y t)+ where+ makePattern' lhs rhs = map (\ctor -> lhs <> prettyCtor wsa ctor <> rhs)++addClause :: (MonadError IdeError m) => Text -> WildcardAnnotations -> m [Text]+addClause s wca = do+ (fName, fType) <- parseTypeDeclaration' s+ let args = splitFunctionType fType+ template = P.runIdent fName <> " " <>+ T.unwords (map (prettyPrintWildcard wca) args) <>+ " = ?" <> (T.strip . P.runIdent $ fName)+ pure [s, template]++parseType' :: (MonadError IdeError m) =>+ Text -> m P.SourceType+parseType' s =+ case CST.runTokenParser CST.parseType $ CST.lex s of+ Right type' -> pure $ CST.convertType "<purs-ide>" $ snd type'+ Left err ->+ throwError (GeneralError ("Parsing the splittype failed with:"+ <> show err))++parseTypeDeclaration' :: (MonadError IdeError m) => Text -> m (P.Ident, P.SourceType)+parseTypeDeclaration' s =+ let x = fmap (CST.convertDeclaration "<purs-ide>" . snd)+ $ CST.runTokenParser CST.parseDecl+ $ CST.lex s+ in+ case x of+ Right [P.TypeDeclaration td] -> pure (P.unwrapTypeDeclaration td)+ Right _ -> throwError (GeneralError "Found a non-type-declaration")+ Left errs ->+ throwError (GeneralError ("Parsing the type signature failed with: "+ <> toS (CST.prettyPrintErrorMessage $ NE.head errs)))++splitFunctionType :: P.Type a -> [P.Type a]+splitFunctionType t = fromMaybe [] arguments+ where+ arguments = initMay splitted+ splitted = splitType' t+ splitType' (P.ForAll _ _ _ _ t' _) = splitType' t'+ splitType' (P.ConstrainedType _ _ t') = splitType' t'+ splitType' (P.TypeApp _ (P.TypeApp _ t' lhs) rhs)+ | P.eqType t' P.tyFunction = lhs : splitType' rhs+ splitType' t' = [t']
+ src/Language/PureScript/Ide/Command.hs view
@@ -0,0 +1,189 @@+-----------------------------------------------------------------------------+--+-- Module : Language.PureScript.Ide.Command+-- Description : Datatypes for the commands psc-ide accepts+-- Copyright : Christoph Hegemann 2016+-- License : MIT (http://opensource.org/licenses/MIT)+--+-- Maintainer : Christoph Hegemann <christoph.hegemann1337@gmail.com>+-- Stability : experimental+--+-- |+-- Datatypes for the commands psc-ide accepts+-----------------------------------------------------------------------------++module Language.PureScript.Ide.Command where++import Protolude++import Control.Monad.Fail (fail)+import Data.Aeson (FromJSON(..), withObject, (.!=), (.:), (.:?))+import Data.Map qualified as Map+import Data.Set qualified as Set+import Language.PureScript qualified as P+import Language.PureScript.Ide.CaseSplit (WildcardAnnotations, explicitAnnotations, noAnnotations)+import Language.PureScript.Ide.Completion (CompletionOptions, defaultCompletionOptions)+import Language.PureScript.Ide.Filter (Filter)+import Language.PureScript.Ide.Matcher (Matcher)+import Language.PureScript.Ide.Types (IdeDeclarationAnn, IdeNamespace)++data Command+ = Load [P.ModuleName]+ | LoadSync [P.ModuleName] -- used in tests+ | Type+ { typeSearch :: Text+ , typeFilters :: [Filter]+ , typeCurrentModule :: Maybe P.ModuleName+ }+ | Complete+ { completeFilters :: [Filter]+ , completeMatcher :: Matcher IdeDeclarationAnn+ , completeCurrentModule :: Maybe P.ModuleName+ , completeOptions :: CompletionOptions+ }+ | CaseSplit+ { caseSplitLine :: Text+ , caseSplitBegin :: Int+ , caseSplitEnd :: Int+ , caseSplitAnnotations :: WildcardAnnotations+ , caseSplitType :: Text+ }+ | AddClause+ { addClauseLine :: Text+ , addClauseAnnotations :: WildcardAnnotations+ }+ | FindUsages+ { usagesModule :: P.ModuleName+ , usagesIdentifier :: Text+ , usagesNamespace :: IdeNamespace+ }+ -- Import InputFile OutputFile+ | Import FilePath (Maybe FilePath) [Filter] ImportCommand+ | List { listType :: ListType }+ | Rebuild FilePath (Maybe FilePath) (Set P.CodegenTarget)+ | RebuildSync FilePath (Maybe FilePath) (Set P.CodegenTarget)+ | Cwd+ | Reset+ | Quit++commandName :: Command -> Text+commandName c = case c of+ Load{} -> "Load"+ LoadSync{} -> "LoadSync"+ Type{} -> "Type"+ Complete{} -> "Complete"+ CaseSplit{} -> "CaseSplit"+ AddClause{} -> "AddClause"+ FindUsages{} -> "FindUsages"+ Import{} -> "Import"+ List{} -> "List"+ Rebuild{} -> "Rebuild"+ RebuildSync{} -> "RebuildSync"+ Cwd{} -> "Cwd"+ Reset{} -> "Reset"+ Quit{} -> "Quit"++data ImportCommand+ = AddImplicitImport P.ModuleName+ | AddQualifiedImport P.ModuleName P.ModuleName+ | AddImportForIdentifier Text (Maybe P.ModuleName)+ deriving (Show, Eq)++instance FromJSON ImportCommand where+ parseJSON = withObject "ImportCommand" $ \o -> do+ (command :: Text) <- o .: "importCommand"+ case command of+ "addImplicitImport" ->+ AddImplicitImport <$> (P.moduleNameFromString <$> o .: "module")+ "addQualifiedImport" ->+ AddQualifiedImport+ <$> (P.moduleNameFromString <$> o .: "module")+ <*> (P.moduleNameFromString <$> o .: "qualifier")+ "addImport" ->+ AddImportForIdentifier+ <$> (o .: "identifier")+ <*> (fmap P.moduleNameFromString <$> o .:? "qualifier")++ s -> fail ("Unknown import command: " <> show s)++data ListType = LoadedModules | Imports FilePath | AvailableModules++instance FromJSON ListType where+ parseJSON = withObject "ListType" $ \o -> do+ (listType' :: Text) <- o .: "type"+ case listType' of+ "import" -> Imports <$> o .: "file"+ "loadedModules" -> pure LoadedModules+ "availableModules" -> pure AvailableModules+ s -> fail ("Unknown list type: " <> show s)++instance FromJSON Command where+ parseJSON = withObject "command" $ \o -> do+ (command :: Text) <- o .: "command"+ case command of+ "list" -> List <$> o .:? "params" .!= LoadedModules+ "cwd" -> pure Cwd+ "quit" -> pure Quit+ "reset" -> pure Reset+ "load" -> do+ params' <- o .:? "params"+ case params' of+ Nothing -> pure (Load [])+ Just params ->+ Load <$> (map P.moduleNameFromString <$> params .:? "modules" .!= [])+ "type" -> do+ params <- o .: "params"+ Type+ <$> params .: "search"+ <*> params .:? "filters" .!= []+ <*> (fmap P.moduleNameFromString <$> params .:? "currentModule")+ "complete" -> do+ params <- o .: "params"+ Complete+ <$> params .:? "filters" .!= []+ <*> params .:? "matcher" .!= mempty+ <*> (fmap P.moduleNameFromString <$> params .:? "currentModule")+ <*> params .:? "options" .!= defaultCompletionOptions+ "caseSplit" -> do+ params <- o .: "params"+ CaseSplit+ <$> params .: "line"+ <*> params .: "begin"+ <*> params .: "end"+ <*> (mkAnnotations <$> params .: "annotations")+ <*> params .: "type"+ "addClause" -> do+ params <- o .: "params"+ AddClause+ <$> params .: "line"+ <*> (mkAnnotations <$> params .: "annotations")+ "usages" -> do+ params <- o .: "params"+ FindUsages+ <$> map P.moduleNameFromString (params .: "module")+ <*> params .: "identifier"+ <*> params .: "namespace"+ "import" -> do+ params <- o .: "params"+ Import+ <$> params .: "file"+ <*> params .:? "outfile"+ <*> params .:? "filters" .!= []+ <*> params .: "importCommand"+ "rebuild" -> do+ params <- o .: "params"+ Rebuild+ <$> params .: "file"+ <*> params .:? "actualFile"+ <*> (parseCodegenTargets =<< params .:? "codegen" .!= [ "js" ])+ c -> fail ("Unknown command: " <> show c)+ where+ parseCodegenTargets ts =+ case traverse (\t -> Map.lookup t P.codegenTargets) ts of+ Nothing ->+ fail ("Failed to parse codegen targets: " <> show ts)+ Just ts' ->+ pure (Set.fromList ts')++ mkAnnotations True = explicitAnnotations+ mkAnnotations False = noAnnotations
+ src/Language/PureScript/Ide/Completion.hs view
@@ -0,0 +1,141 @@+module Language.PureScript.Ide.Completion+ ( getCompletions+ , getExactMatches+ , getExactCompletions+ , simpleExport+ , completionFromMatch+ , CompletionOptions(..)+ , defaultCompletionOptions+ , applyCompletionOptions+ ) where++import Protolude hiding ((<&>), moduleName)++import Control.Lens ((.~), (<&>), (^.))+import Data.Aeson (FromJSON(..), withObject, (.!=), (.:?))+import Data.Map qualified as Map+import Data.Text qualified as T+import Language.PureScript qualified as P+import Language.PureScript.Ide.Error (prettyPrintTypeSingleLine)+import Language.PureScript.Ide.Filter (Filter, applyFilters, exactFilter)+import Language.PureScript.Ide.Matcher (Matcher, runMatcher)+import Language.PureScript.Ide.Types+import Language.PureScript.Ide.Util (identT, identifierFromIdeDeclaration, namespaceForDeclaration, properNameT, typeOperatorAliasT, valueOperatorAliasT)++-- | Applies the CompletionFilters and the Matcher to the given Modules+-- and sorts the found Completions according to the Matching Score+getCompletions+ :: [Filter]+ -> Matcher IdeDeclarationAnn+ -> CompletionOptions+ -> ModuleMap [IdeDeclarationAnn]+ -> [Completion]+getCompletions filters matcher options modules =+ modules+ & applyFilters filters+ & matchesFromModules+ & runMatcher matcher+ & applyCompletionOptions options+ <&> completionFromMatch++getExactMatches :: Text -> [Filter] -> ModuleMap [IdeDeclarationAnn] -> [Match IdeDeclarationAnn]+getExactMatches search filters modules =+ modules+ & applyFilters (exactFilter search : filters)+ & matchesFromModules++getExactCompletions :: Text -> [Filter] -> ModuleMap [IdeDeclarationAnn] -> [Completion]+getExactCompletions search filters modules =+ modules+ & getExactMatches search filters+ <&> simpleExport+ <&> completionFromMatch++matchesFromModules :: ModuleMap [IdeDeclarationAnn] -> [Match IdeDeclarationAnn]+matchesFromModules = Map.foldMapWithKey completionFromModule+ where+ completionFromModule moduleName =+ map $ \x -> Match (moduleName, x)++data CompletionOptions = CompletionOptions+ { coMaxResults :: Maybe Int+ , coGroupReexports :: Bool+ }++instance FromJSON CompletionOptions where+ parseJSON = withObject "CompletionOptions" $ \o -> do+ maxResults <- o .:? "maxResults"+ groupReexports <- o .:? "groupReexports" .!= False+ pure (CompletionOptions { coMaxResults = maxResults+ , coGroupReexports = groupReexports+ })++defaultCompletionOptions :: CompletionOptions+defaultCompletionOptions = CompletionOptions { coMaxResults = Nothing, coGroupReexports = False }++applyCompletionOptions :: CompletionOptions -> [Match IdeDeclarationAnn] -> [(Match IdeDeclarationAnn, [P.ModuleName])]+applyCompletionOptions co decls = decls+ & (if coGroupReexports co+ then groupCompletionReexports+ else map simpleExport)+ & maybe identity take (coMaxResults co)++simpleExport :: Match a -> (Match a, [P.ModuleName])+simpleExport match@(Match (moduleName, _)) = (match, [moduleName])++groupCompletionReexports :: [Match IdeDeclarationAnn] -> [(Match IdeDeclarationAnn, [P.ModuleName])]+groupCompletionReexports initial =+ Map.elems (foldr go Map.empty initial)+ where+ go (Match (moduleName, d@(IdeDeclarationAnn ann decl))) =+ let+ origin = fromMaybe moduleName (ann ^. annExportedFrom)+ in+ Map.alter+ (insertDeclaration moduleName origin d)+ (Namespaced (namespaceForDeclaration decl)+ (P.runModuleName origin <> "." <> identifierFromIdeDeclaration decl))+ insertDeclaration moduleName origin d old = case old of+ Nothing -> Just ( Match (origin, d & idaAnnotation . annExportedFrom .~ Nothing)+ , [moduleName]+ )+ Just x -> Just (second (moduleName :) x)++data Namespaced a = Namespaced IdeNamespace a+ deriving (Show, Eq, Ord)++completionFromMatch :: (Match IdeDeclarationAnn, [P.ModuleName]) -> Completion+completionFromMatch (Match (m, IdeDeclarationAnn ann decl), mns) =+ Completion {..}+ where+ (complIdentifier, complExpandedType) = case decl of+ IdeDeclValue v -> (v ^. ideValueIdent . identT, v ^. ideValueType & prettyPrintTypeSingleLine)+ IdeDeclType t -> (t ^. ideTypeName . properNameT, t ^. ideTypeKind & prettyPrintTypeSingleLine)+ IdeDeclTypeSynonym s -> (s ^. ideSynonymName . properNameT, s ^. ideSynonymType & prettyPrintTypeSingleLine)+ IdeDeclDataConstructor d -> (d ^. ideDtorName . properNameT, d ^. ideDtorType & prettyPrintTypeSingleLine)+ IdeDeclTypeClass d -> (d ^. ideTCName . properNameT, d ^. ideTCKind & prettyPrintTypeSingleLine)+ IdeDeclValueOperator (IdeValueOperator op ref precedence associativity typeP) ->+ (P.runOpName op, maybe (showFixity precedence associativity (valueOperatorAliasT ref) op) prettyPrintTypeSingleLine typeP)+ IdeDeclTypeOperator (IdeTypeOperator op ref precedence associativity kind) ->+ (P.runOpName op, maybe (showFixity precedence associativity (typeOperatorAliasT ref) op) prettyPrintTypeSingleLine kind)+ IdeDeclModule mn -> (P.runModuleName mn, "module")++ complExportedFrom = mns++ complModule = P.runModuleName m++ complType = maybe complExpandedType prettyPrintTypeSingleLine (_annTypeAnnotation ann)++ complLocation = _annLocation ann++ complDocumentation = _annDocumentation ann++ complDeclarationType = Just (declarationType decl)++ showFixity p a r o =+ let asso = case a of+ P.Infix -> "infix"+ P.Infixl -> "infixl"+ P.Infixr -> "infixr"+ in T.unwords [asso, show p, r, "as", P.runOpName o]+
+ src/Language/PureScript/Ide/Error.hs view
@@ -0,0 +1,97 @@+-----------------------------------------------------------------------------+--+-- Module : Language.PureScript.Ide.Error+-- Description : Error types for psc-ide+-- Copyright : Christoph Hegemann 2016+-- License : MIT (http://opensource.org/licenses/MIT)+--+-- Maintainer : Christoph Hegemann <christoph.hegemann1337@gmail.com>+-- Stability : experimental+--+-- |+-- Error types for psc-ide+-----------------------------------------------------------------------------++module Language.PureScript.Ide.Error+ ( IdeError(..)+ , prettyPrintTypeSingleLine+ ) where++import Data.Aeson (KeyValue(..), ToJSON(..), Value, object)+import Data.Aeson.Types qualified as Aeson+import Data.Aeson.KeyMap qualified as KM+import Data.Text qualified as T+import Language.PureScript qualified as P+import Language.PureScript.Errors.JSON (toJSONError)+import Language.PureScript.Ide.Types (ModuleIdent, Completion(..))+import Protolude++data IdeError+ = GeneralError Text+ | NotFound Text+ | ModuleNotFound ModuleIdent+ | ModuleFileNotFound ModuleIdent+ | RebuildError [(FilePath, Text)] P.MultipleErrors+ deriving (Show)++instance ToJSON IdeError where+ toJSON (RebuildError files errs) = object+ [ "resultType" .= ("error" :: Text)+ , "result" .= encodeRebuildErrors files errs+ ]+ toJSON err = object+ [ "resultType" .= ("error" :: Text)+ , "result" .= textError err+ ]++encodeRebuildErrors :: [(FilePath, Text)] -> P.MultipleErrors -> Value+encodeRebuildErrors files = toJSON . map encodeRebuildError . P.runMultipleErrors+ where+ encodeRebuildError err = case err of+ (P.ErrorMessage _+ ((P.HoleInferredType name _ _+ (Just P.TSAfter{tsAfterIdentifiers=idents, tsAfterRecordFields=fields})))) ->+ insertTSCompletions name idents (fromMaybe [] fields) (toJSON (toJSONError False P.Error files err))+ _ ->+ (toJSON . toJSONError False P.Error files) err++ insertTSCompletions name idents fields (Aeson.Object value) =+ Aeson.Object+ (KM.insert "pursIde"+ (object [ "name" .= name+ , "completions" .= ordNub (map identCompletion idents ++ map fieldCompletion fields)+ ]) value)+ insertTSCompletions _ _ _ v = v++ identCompletion (P.Qualified mn i, ty) =+ Completion + { complModule = maybe "" P.runModuleName $ P.toMaybeModuleName mn+ , complIdentifier = i+ , complType = prettyPrintTypeSingleLine ty+ , complExpandedType = prettyPrintTypeSingleLine ty+ , complLocation = Nothing+ , complDocumentation = Nothing+ , complExportedFrom = toList $ P.toMaybeModuleName mn+ , complDeclarationType = Nothing+ }+ fieldCompletion (label, ty) =+ Completion + { complModule = ""+ , complIdentifier = "_." <> P.prettyPrintLabel label+ , complType = prettyPrintTypeSingleLine ty+ , complExpandedType = prettyPrintTypeSingleLine ty+ , complLocation = Nothing+ , complDocumentation = Nothing+ , complExportedFrom = []+ , complDeclarationType = Nothing+ }++textError :: IdeError -> Text+textError (GeneralError msg) = msg+textError (NotFound ident) = "Symbol '" <> ident <> "' not found."+textError (ModuleNotFound ident) = "Module '" <> ident <> "' not found."+textError (ModuleFileNotFound ident) = "Extern file for module " <> ident <> " could not be found"+textError (RebuildError _ err) = show err++prettyPrintTypeSingleLine :: P.Type a -> Text+prettyPrintTypeSingleLine = T.unwords . map T.strip . T.lines . T.pack . P.prettyPrintTypeWithUnicode maxBound
+ src/Language/PureScript/Ide/Externs.hs view
@@ -0,0 +1,142 @@+{-# language PackageImports, BlockArguments #-}++module Language.PureScript.Ide.Externs+ ( readExternFile+ , convertExterns+ ) where++import Protolude hiding (to, from, (&))++import Codec.CBOR.Term as Term+import Control.Lens (preview, view, (&), (^.))+import "monad-logger" Control.Monad.Logger (MonadLogger, logErrorN)+import Data.Version (showVersion)+import Data.Text qualified as Text+import Language.PureScript qualified as P+import Language.PureScript.Make.Monad qualified as Make+import Language.PureScript.Ide.Error (IdeError (..))+import Language.PureScript.Ide.Types (IdeDataConstructor(..), IdeDeclaration(..), IdeDeclarationAnn(..), IdeType(..), IdeTypeClass(..), IdeTypeOperator(..), IdeTypeSynonym(..), IdeValue(..), IdeValueOperator(..), _IdeDeclType, anyOf, emptyAnn, ideTypeKind, ideTypeName)+import Language.PureScript.Ide.Util (properNameT)++readExternFile+ :: (MonadIO m, MonadError IdeError m, MonadLogger m)+ => FilePath+ -> m P.ExternsFile+readExternFile fp = do+ externsFile <- liftIO (Make.readCborFileIO fp)+ case externsFile of+ Just externs | version == P.efVersion externs ->+ pure externs+ _ ->+ liftIO (Make.readCborFileIO fp) >>= \case+ Just (Term.TList (_tag : Term.TString efVersion : _rest)) -> do+ let errMsg =+ "Version mismatch for the externs at: "+ <> toS fp+ <> " Expected: " <> version+ <> " Found: " <> efVersion+ logErrorN errMsg+ throwError (GeneralError errMsg)+ _ ->+ throwError (GeneralError ("Parsing the extern at: " <> toS fp <> " failed"))+ where+ version = toS (showVersion P.version)++convertExterns :: P.ExternsFile -> ([IdeDeclarationAnn], [(P.ModuleName, P.DeclarationRef)])+convertExterns ef =+ (decls, exportDecls)+ where+ decls = moduleDecl : map+ (IdeDeclarationAnn emptyAnn)+ (resolvedDeclarations <> operatorDecls <> tyOperatorDecls)+ exportDecls = mapMaybe convertExport (P.efExports ef)+ operatorDecls = convertOperator <$> P.efFixities ef+ tyOperatorDecls = convertTypeOperator <$> P.efTypeFixities ef+ moduleDecl = IdeDeclarationAnn emptyAnn (IdeDeclModule (P.efModuleName ef))+ (toResolve, declarations) =+ second catMaybes (partitionEithers (map convertDecl (P.efDeclarations ef)))+ resolvedDeclarations = resolveSynonymsAndClasses toResolve declarations++resolveSynonymsAndClasses+ :: [ToResolve]+ -> [IdeDeclaration]+ -> [IdeDeclaration]+resolveSynonymsAndClasses trs decls = foldr go decls trs+ where+ go tr acc = case tr of+ TypeClassToResolve tcn ->+ case findType (P.coerceProperName tcn) acc of+ Nothing ->+ acc+ Just tyDecl -> IdeDeclTypeClass+ (IdeTypeClass tcn (tyDecl ^. ideTypeKind) [])+ : filter (not . anyOf (_IdeDeclType . ideTypeName) (== P.coerceProperName tcn)) acc+ SynonymToResolve tn ty ->+ case findType tn acc of+ Nothing ->+ acc+ Just tyDecl ->+ IdeDeclTypeSynonym (IdeTypeSynonym tn ty (tyDecl ^. ideTypeKind))+ : filter (not . anyOf (_IdeDeclType . ideTypeName) (== tn)) acc++findType :: P.ProperName 'P.TypeName -> [IdeDeclaration] -> Maybe IdeType+findType tn decls =+ decls+ & mapMaybe (preview _IdeDeclType)+ & find ((==) tn . view ideTypeName)++-- The Externs format splits information about synonyms across EDType+-- and EDTypeSynonym declarations. For type classes it split them+-- across an EDType and an EDClass . We collect these and resolve them+-- at the end of the conversion process.+data ToResolve+ = TypeClassToResolve (P.ProperName 'P.ClassName)+ | SynonymToResolve (P.ProperName 'P.TypeName) P.SourceType++convertExport :: P.DeclarationRef -> Maybe (P.ModuleName, P.DeclarationRef)+convertExport (P.ReExportRef _ src r) = Just (P.exportSourceDefinedIn src, r)+convertExport _ = Nothing++convertDecl :: P.ExternsDeclaration -> Either ToResolve (Maybe IdeDeclaration)+convertDecl ed = case ed of+ -- We need to filter all types and synonyms that contain a '$'+ -- because those are typechecker internal definitions that shouldn't+ -- be user facing+ P.EDType{..} -> Right do+ guard (isNothing (Text.find (== '$') (edTypeName ^. properNameT)))+ Just (IdeDeclType (IdeType edTypeName edTypeKind []))+ P.EDTypeSynonym{..} ->+ if isNothing (Text.find (== '$') (edTypeSynonymName ^. properNameT))+ then Left (SynonymToResolve edTypeSynonymName edTypeSynonymType)+ else Right Nothing+ P.EDDataConstructor{..} -> Right do+ guard (isNothing (Text.find (== '$') (edDataCtorName ^. properNameT)))+ Just+ (IdeDeclDataConstructor+ (IdeDataConstructor edDataCtorName edDataCtorTypeCtor edDataCtorType))+ P.EDValue{..} ->+ Right (Just (IdeDeclValue (IdeValue edValueName edValueType)))+ P.EDClass{..} ->+ Left (TypeClassToResolve edClassName)+ P.EDInstance{} ->+ Right Nothing++convertOperator :: P.ExternsFixity -> IdeDeclaration+convertOperator P.ExternsFixity{..} =+ IdeDeclValueOperator+ (IdeValueOperator+ efOperator+ efAlias+ efPrecedence+ efAssociativity+ Nothing)++convertTypeOperator :: P.ExternsTypeFixity -> IdeDeclaration+convertTypeOperator P.ExternsTypeFixity{..} =+ IdeDeclTypeOperator+ (IdeTypeOperator+ efTypeOperator+ efTypeAlias+ efTypePrecedence+ efTypeAssociativity+ Nothing)
+ src/Language/PureScript/Ide/Filter.hs view
@@ -0,0 +1,168 @@+-----------------------------------------------------------------------------+--+-- Module : Language.PureScript.Ide.Filter+-- Description : Filters for psc-ide commands+-- Copyright : Christoph Hegemann 2016+-- License : MIT (http://opensource.org/licenses/MIT)+--+-- Maintainer : Christoph Hegemann <christoph.hegemann1337@gmail.com>+-- Stability : experimental+--+-- |+-- Filters for psc-ide commands+-----------------------------------------------------------------------------++module Language.PureScript.Ide.Filter+ ( Filter+ , moduleFilter+ , namespaceFilter+ , exactFilter+ , prefixFilter+ , declarationTypeFilter+ , dependencyFilter+ , applyFilters+ ) where++import Protolude hiding (isPrefixOf, Prefix)++import Control.Monad.Fail (fail)+import Data.Aeson (FromJSON(..), withObject, (.:), (.:?))+import Data.Text (isPrefixOf)+import Data.Set qualified as Set+import Data.Map qualified as Map+import Language.PureScript.Ide.Filter.Declaration (DeclarationType)+import Language.PureScript.Ide.Types (IdeDeclarationAnn, IdeNamespace, ModuleMap, declarationType)+import Language.PureScript.Ide.Imports (Import, sliceImportSection)+import Language.PureScript.Ide.Util (discardAnn, identifierFromIdeDeclaration, namespaceForDeclaration)++import Language.PureScript qualified as P+import Data.Text qualified as T++import Language.PureScript.Ide.Filter.Imports (matchImport)++newtype Filter = Filter (Either (Set P.ModuleName) DeclarationFilter)+ deriving Show++unFilter :: Filter -> Either (Set P.ModuleName) DeclarationFilter+unFilter (Filter f) = f++data DeclarationFilter+ = Prefix Text+ | Exact Text+ | Namespace (Set IdeNamespace)+ | DeclType (Set DeclarationType)+ | Dependencies { qualifier :: Maybe P.ModuleName, currentModuleName :: P.ModuleName, dependencyImports :: [Import] }+ deriving Show++-- | Only keeps Declarations in the given modules+moduleFilter :: Set P.ModuleName -> Filter+moduleFilter = Filter . Left++-- | Only keeps Identifiers in the given Namespaces+namespaceFilter :: Set IdeNamespace -> Filter+namespaceFilter nss = Filter (Right (Namespace nss))++-- | Only keeps Identifiers that are equal to the search string+exactFilter :: Text -> Filter+exactFilter t = Filter (Right (Exact t))++-- | Only keeps Identifiers that start with the given prefix+prefixFilter :: Text -> Filter+prefixFilter t = Filter (Right (Prefix t))++-- | Only keeps Identifiers in the given type declarations+declarationTypeFilter :: Set DeclarationType -> Filter+declarationTypeFilter dts = Filter (Right (DeclType dts))++dependencyFilter :: Maybe P.ModuleName -> P.ModuleName -> [Import] -> Filter+dependencyFilter q m f = Filter (Right (Dependencies q m f))++optimizeFilters :: [Filter] -> (Maybe (Set P.ModuleName), [DeclarationFilter])+optimizeFilters = first smashModuleFilters . partitionEithers . map unFilter+ where+ smashModuleFilters [] =+ Nothing+ smashModuleFilters (x:xs) =+ Just (foldr Set.intersection x xs)++applyFilters :: [Filter] -> ModuleMap [IdeDeclarationAnn] -> ModuleMap [IdeDeclarationAnn]+applyFilters fs modules = case optimizeFilters fs of+ (Nothing, declarationFilters) ->+ applyDeclarationFilters declarationFilters modules+ (Just moduleFilter', declarationFilters) ->+ applyDeclarationFilters declarationFilters (Map.restrictKeys modules moduleFilter')++applyDeclarationFilters+ :: [DeclarationFilter]+ -> ModuleMap [IdeDeclarationAnn]+ -> ModuleMap [IdeDeclarationAnn]+applyDeclarationFilters fs =+ Map.filter (not . null)+ . Map.mapWithKey (\modl decls -> foldr (.) identity (map (applyDeclarationFilter modl) fs) decls)++applyDeclarationFilter+ :: P.ModuleName+ -> DeclarationFilter+ -> [IdeDeclarationAnn]+ -> [IdeDeclarationAnn]+applyDeclarationFilter modl f = case f of+ Prefix prefix -> prefixFilter' prefix+ Exact t -> exactFilter' t+ Namespace namespaces -> namespaceFilter' namespaces+ DeclType dts -> declarationTypeFilter' dts+ Dependencies qual currentModuleName imps -> dependencyFilter' modl qual currentModuleName imps++namespaceFilter' :: Set IdeNamespace -> [IdeDeclarationAnn] -> [IdeDeclarationAnn]+namespaceFilter' namespaces =+ filter (\decl -> namespaceForDeclaration (discardAnn decl) `elem` namespaces)++exactFilter' :: Text -> [IdeDeclarationAnn] -> [IdeDeclarationAnn]+exactFilter' search =+ filter (\decl -> identifierFromIdeDeclaration (discardAnn decl) == search)++prefixFilter' :: Text -> [IdeDeclarationAnn] -> [IdeDeclarationAnn]+prefixFilter' prefix =+ filter (\decl -> prefix `isPrefixOf` identifierFromIdeDeclaration (discardAnn decl))++declarationTypeFilter' :: Set DeclarationType -> [IdeDeclarationAnn] -> [IdeDeclarationAnn]+declarationTypeFilter' declTypes =+ filter (\decl -> declarationType (discardAnn decl) `Set.member` declTypes)++dependencyFilter' :: P.ModuleName -> Maybe P.ModuleName -> P.ModuleName -> [Import] -> [IdeDeclarationAnn] -> [IdeDeclarationAnn]+dependencyFilter' modl qual currentModuleName imports =+ if modl == currentModuleName && isNothing qual then+ identity+ else+ filter (\decl -> any (matchImport qual modl decl) imports)++instance FromJSON Filter where+ parseJSON = withObject "filter" $ \o -> do+ (filter' :: Text) <- o .: "filter"+ case filter' of+ "modules" -> do+ params <- o .: "params"+ modules <- map P.moduleNameFromString <$> params .: "modules"+ pure (moduleFilter (Set.fromList modules))+ "exact" -> do+ params <- o .: "params"+ search <- params .: "search"+ pure (exactFilter search)+ "prefix" -> do+ params <- o .: "params"+ search <- params .: "search"+ pure (prefixFilter search)+ "namespace" -> do+ params <- o .: "params"+ namespaces <- params .: "namespaces"+ pure (namespaceFilter (Set.fromList namespaces))+ "declarations" -> do+ declarations <- o .: "params"+ pure (declarationTypeFilter (Set.fromList declarations))+ "dependencies" -> do+ params <- o .: "params"+ moduleText <- params .: "moduleText"+ qualifier <- fmap P.moduleNameFromString <$> params .:? "qualifier"+ case sliceImportSection (T.lines moduleText) of+ Left err -> fail ("Couldn't parse module imports: " <> T.unpack err)+ Right (currentModuleName, _, imports, _ ) -> pure (dependencyFilter qualifier currentModuleName imports)+ s -> fail ("Unknown filter: " <> show s)
+ src/Language/PureScript/Ide/Filter/Declaration.hs view
@@ -0,0 +1,42 @@+module Language.PureScript.Ide.Filter.Declaration+ ( DeclarationType(..)+ ) where++import Protolude hiding (isPrefixOf)++import Control.Monad.Fail (fail)+import Data.Aeson (FromJSON(..), ToJSON(..), withText)++data DeclarationType+ = Value+ | Type+ | Synonym+ | DataConstructor+ | TypeClass+ | ValueOperator+ | TypeOperator+ | Module+ deriving (Show, Eq, Ord)++instance FromJSON DeclarationType where+ parseJSON = withText "Declaration type tag" $ \case+ "value" -> pure Value+ "type" -> pure Type+ "synonym" -> pure Synonym+ "dataconstructor" -> pure DataConstructor+ "typeclass" -> pure TypeClass+ "valueoperator" -> pure ValueOperator+ "typeoperator" -> pure TypeOperator+ "module" -> pure Module+ s -> fail ("Unknown declaration type: " <> show s)++instance ToJSON DeclarationType where+ toJSON = toJSON . \case+ Value -> "value" :: Text+ Type -> "type"+ Synonym -> "synonym"+ DataConstructor -> "dataconstructor"+ TypeClass -> "typeclass"+ ValueOperator -> "valueoperator"+ TypeOperator -> "typeoperator"+ Module -> "module"
+ src/Language/PureScript/Ide/Filter/Imports.hs view
@@ -0,0 +1,31 @@+module Language.PureScript.Ide.Filter.Imports where+++import Protolude hiding (isPrefixOf)++import Language.PureScript.Ide.Types (IdeDataConstructor(..), IdeDeclaration(..), IdeDeclarationAnn(..), IdeType(..), IdeTypeClass(..), IdeTypeOperator(..), IdeTypeSynonym(..), IdeValue(..), IdeValueOperator(..))+import Language.PureScript.Ide.Imports (Import(..))++import Language.PureScript qualified as P++matchImport :: Maybe P.ModuleName -> P.ModuleName -> IdeDeclarationAnn -> Import -> Bool+matchImport matchQualifier declMod (IdeDeclarationAnn _ decl) (Import importMod declTy qualifier) | declMod == importMod && matchQualifier == qualifier =+ case declTy of + P.Implicit -> True+ P.Explicit refs -> any (matchRef decl) refs+ P.Hiding refs -> not $ any (matchRef decl) refs+ where+ matchRef (IdeDeclValue (IdeValue ident _)) (P.ValueRef _ ident') = ident == ident'+ matchRef (IdeDeclType (IdeType tname _kind _dctors)) (P.TypeRef _ tname' _dctors') = tname == tname'+ matchRef (IdeDeclTypeSynonym (IdeTypeSynonym tname _type _kind)) (P.TypeRef _ tname' _dctors) = tname == tname' -- Can this occur?+ + matchRef (IdeDeclDataConstructor (IdeDataConstructor dcname tname _type)) (P.TypeRef _ tname' dctors) =+ tname == tname'+ && maybe True (dcname `elem`) dctors -- (..) or explicitly lists constructor+ + matchRef (IdeDeclTypeClass (IdeTypeClass tcname _kind _instances)) (P.TypeClassRef _ tcname') = tcname == tcname'+ matchRef (IdeDeclValueOperator (IdeValueOperator{ _ideValueOpName })) (P.ValueOpRef _ opname) = _ideValueOpName == opname+ matchRef (IdeDeclTypeOperator (IdeTypeOperator{ _ideTypeOpName })) (P.TypeOpRef _ opname) = _ideTypeOpName == opname+ matchRef _ _ = False++matchImport _ _ _ _ = False
+ src/Language/PureScript/Ide/Imports.hs view
@@ -0,0 +1,154 @@+-----------------------------------------------------------------------------+--+-- Module : Language.PureScript.Ide.Imports+-- Description : Provides functionality to manage imports+-- Copyright : Christoph Hegemann 2016+-- License : MIT (http://opensource.org/licenses/MIT)+--+-- Maintainer : Christoph Hegemann <christoph.hegemann1337@gmail.com>+-- Stability : experimental+--+-- |+-- Provides functionality to manage imports+-----------------------------------------------------------------------------++module Language.PureScript.Ide.Imports+ ( parseImportsFromFile+ , parseImportsFromFile'+ -- for tests+ , parseImport+ , prettyPrintImportSection+ , sliceImportSection+ , prettyPrintImport'+ , Import(Import)+ )+ where++import Protolude hiding (moduleName)++import Control.Lens ((^.), (%~), ix)+import Data.List (partition)+import Data.List.NonEmpty qualified as NE+import Data.Text qualified as T+import Language.PureScript qualified as P+import Language.PureScript.CST qualified as CST+import Language.PureScript.Ide.Error (IdeError(..))+import Language.PureScript.Ide.Util (ideReadFile)++data Import = Import P.ModuleName P.ImportDeclarationType (Maybe P.ModuleName)+ deriving (Eq, Show)++-- | Reads a file and returns the parsed module name as well as the parsed+-- imports, while ignoring eventual parse errors that aren't relevant to the+-- import section+parseImportsFromFile+ :: (MonadIO m, MonadError IdeError m)+ => FilePath+ -> m (P.ModuleName, [(P.ModuleName, P.ImportDeclarationType, Maybe P.ModuleName)])+parseImportsFromFile file = do+ (mn, _, imports, _) <- parseImportsFromFile' file+ pure (mn, unwrapImport <$> imports)+ where+ unwrapImport (Import a b c) = (a, b, c)++-- | Reads a file and returns the (lines before the imports, the imports, the+-- lines after the imports)+parseImportsFromFile'+ :: (MonadIO m, MonadError IdeError m)+ => FilePath+ -> m (P.ModuleName, [Text], [Import], [Text])+parseImportsFromFile' fp = do+ (_, file) <- ideReadFile fp+ case sliceImportSection (T.lines file) of+ Right res -> pure res+ Left err -> throwError (GeneralError err)++-- | @ImportParse@ holds the data we extract out of a partial parse of the+-- sourcefile+data ImportParse = ImportParse+ { ipModuleName :: P.ModuleName+ -- ^ the module name we parse+ , ipStart :: P.SourcePos+ -- ^ the beginning of the import section. If `import Prelude` was the first+ -- import, this would point at `i`+ , ipEnd :: P.SourcePos+ -- ^ the end of the import section+ , ipImports :: [Import]+ -- ^ the extracted import declarations+ }++parseModuleHeader :: Text -> Either (NE.NonEmpty CST.ParserError) ImportParse+parseModuleHeader src = do+ CST.PartialResult md _ <- CST.parseModule $ CST.lenient $ CST.lexModule src+ let+ mn = CST.nameValue $ CST.modNamespace md+ decls = flip fmap (CST.modImports md) $ \decl -> do+ let ((ss, _), mn', it, qual) = CST.convertImportDecl "<purs-ide>" decl+ (ss, Import mn' it qual)+ case (head decls, lastMay decls) of+ (Just hd, Just ls) -> do+ let+ ipStart = P.spanStart $ fst hd+ ipEnd = P.spanEnd $ fst ls+ pure $ ImportParse mn ipStart ipEnd $ snd <$> decls+ _ -> do+ let pos = CST.sourcePos . CST.srcEnd . CST.tokRange . CST.tokAnn $ CST.modWhere md+ pure $ ImportParse mn pos pos []++sliceImportSection :: [Text] -> Either Text (P.ModuleName, [Text], [Import], [Text])+sliceImportSection fileLines = first (toS . CST.prettyPrintError . NE.head) $ do+ ImportParse{..} <- parseModuleHeader file+ pure+ ( ipModuleName+ , sliceFile (P.SourcePos 1 1) (prevPos ipStart)+ , ipImports+ -- Not sure why I need to drop 1 here, but it makes the tests pass+ , drop 1 (sliceFile (nextPos ipEnd) (P.SourcePos (length fileLines) (lineLength (length fileLines))))+ )+ where+ prevPos (P.SourcePos l c)+ | l == 1 && c == 1 = P.SourcePos l c+ | c == 1 = P.SourcePos (l - 1) (lineLength (l - 1))+ | otherwise = P.SourcePos l (c - 1)+ nextPos (P.SourcePos l c)+ | c == lineLength l = P.SourcePos (l + 1) 1+ | otherwise = P.SourcePos l (c + 1)+ file = T.unlines fileLines+ lineLength l = T.length (fileLines ^. ix (l - 1))+ sliceFile (P.SourcePos l1 c1) (P.SourcePos l2 c2) =+ fileLines+ & drop (l1 - 1)+ & take (l2 - l1 + 1)+ & ix 0 %~ T.drop (c1 - 1)+ & ix (l2 - l1) %~ T.take c2++prettyPrintImport' :: Import -> Text+prettyPrintImport' (Import mn idt qual) =+ "import " <> P.prettyPrintImport mn idt qual++prettyPrintImportSection :: [Import] -> [Text]+prettyPrintImportSection imports =+ let+ (implicitImports, explicitImports) = partition isImplicitImport imports+ in+ sort (map prettyPrintImport' implicitImports)+ -- Only add the extra spacing if both implicit as well as+ -- explicit/qualified imports exist+ <> (guard (not (null explicitImports || null implicitImports)) $> "")+ <> sort (map prettyPrintImport' explicitImports)+ where+ isImplicitImport :: Import -> Bool+ isImplicitImport i = case i of+ Import _ P.Implicit Nothing -> True+ Import _ (P.Hiding _) Nothing -> True+ _ -> False++-- | Test and ghci helper+parseImport :: Text -> Maybe Import+parseImport t =+ case fmap (CST.convertImportDecl "<purs-ide>" . snd)+ $ CST.runTokenParser CST.parseImportDeclP+ $ CST.lex t of+ Right (_, mn, idt, mmn) ->+ Just (Import mn idt mmn)+ _ -> Nothing
+ src/Language/PureScript/Ide/Imports/Actions.hs view
@@ -0,0 +1,251 @@+module Language.PureScript.Ide.Imports.Actions + ( addImplicitImport+ , addQualifiedImport+ , addImportForIdentifier+ , answerRequest++ -- for tests+ , addImplicitImport'+ , addQualifiedImport'+ , addExplicitImport'+ )+where++import Protolude hiding (moduleName)++import Control.Lens ((^.), has)+import Data.List (nubBy)+import Data.Map qualified as Map+import Data.Text qualified as T+import Language.PureScript qualified as P+import Language.PureScript.Constants.Prim qualified as C+import Language.PureScript.Ide.Completion (getExactMatches)+import Language.PureScript.Ide.Error (IdeError(..))+import Language.PureScript.Ide.Filter (Filter)+import Language.PureScript.Ide.Imports (Import(..), parseImportsFromFile', prettyPrintImportSection)+import Language.PureScript.Ide.State (getAllModules)+import Language.PureScript.Ide.Prim (idePrimDeclarations)+import Language.PureScript.Ide.Types (Ide, IdeDeclaration(..), IdeType(..), Match(..), Success(..), _IdeDeclModule, ideDtorName, ideDtorTypeName, ideTCName, ideTypeName, ideTypeOpName, ideValueOpName)+import Language.PureScript.Ide.Util (discardAnn, identifierFromIdeDeclaration)+import System.IO.UTF8 (writeUTF8FileT)++-- | Adds an implicit import like @import Prelude@ to a Sourcefile.+addImplicitImport+ :: (MonadIO m, MonadError IdeError m)+ => FilePath -- ^ The source file read from+ -> P.ModuleName -- ^ The module to import+ -> m [Text]+addImplicitImport fp mn = do+ (_, pre, imports, post) <- parseImportsFromFile' fp+ let newImportSection = addImplicitImport' imports mn+ pure $ joinSections (pre, newImportSection, post)++addImplicitImport' :: [Import] -> P.ModuleName -> [Text]+addImplicitImport' imports mn =+ prettyPrintImportSection (Import mn P.Implicit Nothing : imports)++-- | Adds a qualified import like @import Data.Map as Map@ to a source file.+addQualifiedImport+ :: (MonadIO m, MonadError IdeError m)+ => FilePath+ -- ^ The sourcefile read from+ -> P.ModuleName+ -- ^ The module to import+ -> P.ModuleName+ -- ^ The qualifier under which to import+ -> m [Text]+addQualifiedImport fp mn qualifier = do+ (_, pre, imports, post) <- parseImportsFromFile' fp+ let newImportSection = addQualifiedImport' imports mn qualifier+ pure $ joinSections (pre, newImportSection, post)++addQualifiedImport' :: [Import] -> P.ModuleName -> P.ModuleName -> [Text]+addQualifiedImport' imports mn qualifier =+ prettyPrintImportSection (Import mn P.Implicit (Just qualifier) : imports)++-- | Adds an explicit import like @import Prelude (unit)@ to a Sourcefile. If an+-- explicit import already exists for the given module, it adds the identifier+-- to that imports list.+--+-- So @addExplicitImport "/File.purs" "bind" "Prelude"@ with an already existing+-- @import Prelude (bind)@ in the file File.purs returns @["import Prelude+-- (bind, unit)"]@+addExplicitImport :: (MonadIO m, MonadError IdeError m) =>+ FilePath -> IdeDeclaration -> P.ModuleName -> Maybe P.ModuleName -> m [Text]+addExplicitImport fp decl moduleName qualifier = do+ (mn, pre, imports, post) <- parseImportsFromFile' fp+ let newImportSection =+ -- TODO: Open an issue when this PR is merged, we should optimise this+ -- so that this case does not write to disc+ if mn == moduleName+ then imports+ else addExplicitImport' decl moduleName qualifier imports+ pure $ joinSections (pre, prettyPrintImportSection newImportSection, post)++addExplicitImport' :: IdeDeclaration -> P.ModuleName -> Maybe P.ModuleName -> [Import] -> [Import]+addExplicitImport' decl moduleName qualifier imports =+ let+ isImplicitlyImported =+ any (\case+ Import mn P.Implicit qualifier' -> mn == moduleName && qualifier == qualifier'+ _ -> False) imports+ isNotExplicitlyImportedFromPrim =+ moduleName == C.M_Prim &&+ not (any (\case+ Import C.M_Prim (P.Explicit _) Nothing -> True+ _ -> False) imports)+ -- We can't import Modules from other modules+ isModule = has _IdeDeclModule decl++ matches (Import mn (P.Explicit _) qualifier') = mn == moduleName && qualifier == qualifier'+ matches _ = False+ freshImport = Import moduleName (P.Explicit [refFromDeclaration decl]) qualifier+ in+ if isImplicitlyImported || isNotExplicitlyImportedFromPrim || isModule+ then imports+ else updateAtFirstOrPrepend matches (insertDeclIntoImport decl) freshImport imports+ where+ refFromDeclaration (IdeDeclTypeClass tc) =+ P.TypeClassRef ideSpan (tc ^. ideTCName)+ refFromDeclaration (IdeDeclDataConstructor dtor) =+ P.TypeRef ideSpan (dtor ^. ideDtorTypeName) Nothing+ refFromDeclaration (IdeDeclType t) =+ P.TypeRef ideSpan (t ^. ideTypeName) (Just [])+ refFromDeclaration (IdeDeclValueOperator op) =+ P.ValueOpRef ideSpan (op ^. ideValueOpName)+ refFromDeclaration (IdeDeclTypeOperator op) =+ P.TypeOpRef ideSpan (op ^. ideTypeOpName)+ refFromDeclaration d =+ P.ValueRef ideSpan (P.Ident (identifierFromIdeDeclaration d))++ -- Adds a declaration to an import:+ -- TypeDeclaration "Maybe" + Data.Maybe (maybe) -> Data.Maybe(Maybe, maybe)+ insertDeclIntoImport :: IdeDeclaration -> Import -> Import+ insertDeclIntoImport decl' (Import mn (P.Explicit refs) qual) =+ Import mn (P.Explicit (sort (insertDeclIntoRefs decl' refs))) qual+ insertDeclIntoImport _ is = is++ insertDeclIntoRefs :: IdeDeclaration -> [P.DeclarationRef] -> [P.DeclarationRef]+ insertDeclIntoRefs d@(IdeDeclDataConstructor dtor) refs =+ updateAtFirstOrPrepend+ (matchType (dtor ^. ideDtorTypeName))+ (insertDtor (dtor ^. ideDtorName))+ (refFromDeclaration d)+ refs+ insertDeclIntoRefs (IdeDeclType t) refs+ | any matches refs = refs+ where+ matches (P.TypeRef _ typeName _) = _ideTypeName t == typeName+ matches _ = False+ insertDeclIntoRefs dr refs = nubBy ((==) `on` P.prettyPrintRef) (refFromDeclaration dr : refs)++ insertDtor _ (P.TypeRef ss tn' _) = P.TypeRef ss tn' Nothing+ insertDtor _ refs = refs++ matchType :: P.ProperName 'P.TypeName -> P.DeclarationRef -> Bool+ matchType tn (P.TypeRef _ n _) = tn == n+ matchType _ _ = False+++-- | Looks up the given identifier in the currently loaded modules.+--+-- * Throws an error if the identifier cannot be found.+--+-- * If exactly one match is found, adds an explicit import to the importsection+--+-- * If more than one possible imports are found, reports the possibilities as a+-- list of completions.+addImportForIdentifier+ :: (Ide m, MonadError IdeError m)+ => FilePath -- ^ The Sourcefile to read from+ -> Text -- ^ The identifier to import+ -> Maybe P.ModuleName -- ^ The optional qualifier under which to import+ -> [Filter] -- ^ Filters to apply before searching for the identifier+ -> m (Either [Match IdeDeclaration] [Text])+addImportForIdentifier fp ident qual filters = do+ let addPrim = Map.union idePrimDeclarations+ modules <- getAllModules Nothing+ let+ matches =+ getExactMatches ident filters (addPrim modules)+ & map (fmap discardAnn)+ & filter (\(Match (_, d)) -> not (has _IdeDeclModule d))++ case matches of+ [] ->+ throwError (NotFound "Couldn't find the given identifier. \+ \Have you loaded the corresponding module?")++ -- Only one match was found for the given identifier, so we can insert it+ -- right away+ [Match (m, decl)] ->+ Right <$> addExplicitImport fp decl m qual++ -- This case comes up for newtypes and dataconstructors. Because values and+ -- types don't share a namespace we can get multiple matches from the same+ -- module. This also happens for parameterized types, as these generate both+ -- a type as well as a type synonym.++ ms@[Match (m1, d1), Match (m2, d2)] ->+ if m1 /= m2+ -- If the modules don't line up we just ask the user to specify the+ -- module+ then pure (Left ms)+ else case decideRedundantCase d1 d2 <|> decideRedundantCase d2 d1 of+ -- If dataconstructor and type line up we just import the+ -- dataconstructor as that will give us an unnecessary import warning at+ -- worst+ Just decl ->+ Right <$> addExplicitImport fp decl m1 qual+ -- Here we need the user to specify whether they wanted a + -- dataconstructor or a type+ Nothing ->+ throwError (GeneralError "Undecidable between type and dataconstructor")++ -- Multiple matches were found so we need to ask the user to clarify which+ -- module they meant+ xs ->+ pure (Left xs)+ where+ decideRedundantCase d@(IdeDeclDataConstructor dtor) (IdeDeclType t) =+ if dtor ^. ideDtorTypeName == t ^. ideTypeName then Just d else Nothing+ decideRedundantCase IdeDeclType{} ts@IdeDeclTypeSynonym{} =+ Just ts+ decideRedundantCase _ _ = Nothing++-- | Writes a list of lines to @Just filepath@ and responds with a @TextResult@,+-- or returns the lines as a @MultilineTextResult@ if @Nothing@ was given as the+-- first argument.+answerRequest :: (MonadIO m) => Maybe FilePath -> [Text] -> m Success+answerRequest outfp rs =+ case outfp of+ Nothing -> pure (MultilineTextResult rs)+ Just outfp' -> do+ liftIO (writeUTF8FileT outfp' (T.unlines rs))+ pure (TextResult ("Written to " <> T.pack outfp'))+++-- | If none of the elements of the list satisfy the given predicate 'predicate', then prepend the default value 'def'+-- to the given list. Otherwise, update the first element of the list that satisfies 'predicate' with the updating+-- function 'update'.+updateAtFirstOrPrepend :: (a -> Bool) -> (a -> a) -> a -> [a] -> [a]+updateAtFirstOrPrepend predicate update def xs =+ case break predicate xs of+ (before, []) -> def : before+ (before, x : after) -> before ++ [update x] ++ after+++ideSpan :: P.SourceSpan+ideSpan = P.internalModuleSourceSpan "<psc-ide>"++joinSections :: ([Text], [Text], [Text]) -> [Text]+joinSections (pre, decls, post) = pre `joinLine` (decls `joinLine` post)+ where+ isBlank = T.all (== ' ')+ joinLine as bs+ | Just ln1 <- lastMay as+ , Just ln2 <- head bs+ , not (isBlank ln1) && not (isBlank ln2) =+ as ++ [""] ++ bs+ | otherwise =+ as ++ bs
+ src/Language/PureScript/Ide/Logging.hs view
@@ -0,0 +1,41 @@+{-# LANGUAGE PackageImports #-}++module Language.PureScript.Ide.Logging+ ( runLogger+ , logPerf+ , displayTimeSpec+ , labelTimespec+ ) where++import Protolude++import "monad-logger" Control.Monad.Logger (LogLevel(..), LoggingT, MonadLogger, filterLogger, logOtherN, runStdoutLoggingT)+import Data.Text qualified as T+import Language.PureScript.Ide.Types (IdeLogLevel(..))+import System.Clock (Clock(..), TimeSpec, diffTimeSpec, getTime, toNanoSecs)+import Text.Printf (printf)++runLogger :: MonadIO m => IdeLogLevel -> LoggingT m a -> m a+runLogger logLevel' =+ runStdoutLoggingT . filterLogger (\_ logLevel ->+ case logLevel' of+ LogAll -> True+ LogDefault -> not (logLevel == LevelOther "perf" || logLevel == LevelDebug)+ LogNone -> False+ LogDebug -> logLevel /= LevelOther "perf"+ LogPerf -> logLevel == LevelOther "perf")++labelTimespec :: Text -> TimeSpec -> Text+labelTimespec label duration = label <> ": " <> displayTimeSpec duration++logPerf :: (MonadIO m, MonadLogger m) => (TimeSpec -> Text) -> m t -> m t+logPerf format f = do+ start <- liftIO (getTime Monotonic)+ result <- f+ end <- liftIO (getTime Monotonic)+ logOtherN (LevelOther "perf") (format (diffTimeSpec start end))+ pure result++displayTimeSpec :: TimeSpec -> Text+displayTimeSpec ts =+ T.pack (printf "%0.2f" (fromIntegral (toNanoSecs ts) / 1000000 :: Double)) <> "ms"
+ src/Language/PureScript/Ide/Matcher.hs view
@@ -0,0 +1,121 @@+-----------------------------------------------------------------------------+--+-- Module : Language.PureScript.Ide.Matcher+-- Description : Matchers for psc-ide commands+-- Copyright : Christoph Hegemann 2016+-- License : MIT (http://opensource.org/licenses/MIT)+--+-- Maintainer : Christoph Hegemann <christoph.hegemann1337@gmail.com>+-- Stability : experimental+--+-- |+-- Matchers for psc-ide commands+-----------------------------------------------------------------------------++module Language.PureScript.Ide.Matcher+ ( Matcher+ , runMatcher+ -- for tests+ , flexMatcher+ ) where++import Protolude++import Control.Monad.Fail (fail)+import Data.Aeson (FromJSON(..), withObject, (.:), (.:?))+import Data.Text qualified as T+import Data.Text.Encoding qualified as TE+import Language.PureScript.Ide.Types (IdeDeclarationAnn, Match)+import Language.PureScript.Ide.Util (discardAnn, identifierFromIdeDeclaration, unwrapMatch)+import Text.EditDistance (defaultEditCosts, levenshteinDistance)+import Text.Regex.TDFA ((=~))+++type ScoredMatch a = (Match a, Double)++newtype Matcher a = Matcher (Endo [Match a]) deriving (Semigroup, Monoid)++instance FromJSON (Matcher IdeDeclarationAnn) where+ parseJSON = withObject "matcher" $ \o -> do+ (matcher :: Maybe Text) <- o .:? "matcher"+ case matcher of+ Just "flex" -> do+ params <- o .: "params"+ flexMatcher <$> params .: "search"+ Just "distance" -> do+ params <- o .: "params"+ distanceMatcher+ <$> params .: "search"+ <*> params .: "maximumDistance"+ Just s -> fail ("Unknown matcher: " <> show s)+ Nothing -> return mempty++-- | Matches any occurrence of the search string with intersections+--+-- The scoring measures how far the matches span the string where+-- closer is better.+-- Examples:+-- flMa matches flexMatcher. Score: 14.28+-- sons matches sortCompletions. Score: 6.25+flexMatcher :: Text -> Matcher IdeDeclarationAnn+flexMatcher p = mkMatcher (flexMatch p)++distanceMatcher :: Text -> Int -> Matcher IdeDeclarationAnn+distanceMatcher q maxDist = mkMatcher (distanceMatcher' q maxDist)++distanceMatcher' :: Text -> Int -> [Match IdeDeclarationAnn] -> [ScoredMatch IdeDeclarationAnn]+distanceMatcher' q maxDist = mapMaybe go+ where+ go m = let d = dist (T.unpack y)+ y = identifierFromIdeDeclaration (discardAnn (unwrapMatch m))+ in if d <= maxDist+ then Just (m, 1 / fromIntegral d)+ else Nothing+ dist = levenshteinDistance defaultEditCosts (T.unpack q)++mkMatcher :: ([Match a] -> [ScoredMatch a]) -> Matcher a+mkMatcher matcher = Matcher . Endo $ fmap fst . sortCompletions . matcher++runMatcher :: Matcher a -> [Match a] -> [Match a]+runMatcher (Matcher m)= appEndo m++sortCompletions :: [ScoredMatch a] -> [ScoredMatch a]+sortCompletions = sortOn (Down . snd)++flexMatch :: Text -> [Match IdeDeclarationAnn] -> [ScoredMatch IdeDeclarationAnn]+flexMatch = mapMaybe . flexRate++flexRate :: Text -> Match IdeDeclarationAnn -> Maybe (ScoredMatch IdeDeclarationAnn)+flexRate p c = do+ score <- flexScore p (identifierFromIdeDeclaration (discardAnn (unwrapMatch c)))+ return (c, score)++-- FlexMatching ala Sublime.+-- Borrowed from: http://cdewaka.com/2013/06/fuzzy-pattern-matching-in-haskell/+--+-- By string =~ pattern we'll get the start of the match and the length of+-- the matches a (start, length) tuple if there's a match.+-- If match fails then it would be (-1,0)+flexScore :: Text -> Text -> Maybe Double+flexScore pat str =+ case T.uncons pat of+ Nothing -> Nothing+ Just (first', p) ->+ case TE.encodeUtf8 str =~ TE.encodeUtf8 pat' :: (Int, Int) of+ (-1,0) -> Nothing+ (start,len) -> Just $ calcScore start (start + len)+ where+ escapedPattern :: [Text]+ escapedPattern = map escape (T.unpack p)++ -- escape prepends a backslash to "regexy" characters to prevent the+ -- matcher from crashing when trying to build the regex+ escape :: Char -> Text+ escape c = if c `elem` T.unpack "[\\^$.|?*+(){}"+ then T.pack ['\\', c]+ else T.singleton c+ -- This just interleaves the search pattern with .*+ -- abcd[*] -> a.*b.*c.*d.*[*]+ pat' = escape first' <> foldMap (<> ".*") escapedPattern+ calcScore start end =+ 100.0 / fromIntegral ((1 + start) * (end - start + 1))
+ src/Language/PureScript/Ide/Prim.hs view
@@ -0,0 +1,69 @@+module Language.PureScript.Ide.Prim (idePrimDeclarations) where++import Protolude++import Data.Text qualified as T+import Data.Map qualified as Map+import Language.PureScript qualified as P+import Language.PureScript.Constants.Prim qualified as C+import Language.PureScript.Environment qualified as PEnv+import Language.PureScript.Ide.Types (IdeDeclaration(..), IdeDeclarationAnn(..), IdeType(..), IdeTypeClass(..), ModuleMap, emptyAnn)++idePrimDeclarations :: ModuleMap [IdeDeclarationAnn]+idePrimDeclarations = Map.fromList+ [ ( C.M_Prim+ , mconcat [primTypes, primClasses]+ )+ , ( C.M_Prim_Boolean+ , mconcat [primBooleanTypes]+ )+ , ( C.M_Prim_Ordering+ , mconcat [primOrderingTypes]+ )+ , ( C.M_Prim_Row+ , mconcat [primRowTypes, primRowClasses]+ )+ , ( C.M_Prim_RowList+ , mconcat [primRowListTypes, primRowListClasses]+ )+ , ( C.M_Prim_Symbol+ , mconcat [primSymbolTypes, primSymbolClasses]+ )+ , ( C.M_Prim_Int+ , mconcat [primIntTypes, primIntClasses]+ )+ , ( C.M_Prim_TypeError+ , mconcat [primTypeErrorTypes, primTypeErrorClasses]+ )+ ]+ where+ annType tys = flip mapMaybe (Map.toList tys) $ \(tn, (kind, _)) -> do+ let name = P.disqualify tn+ -- We need to remove the ClassName$Dict synonyms, because we+ -- don't want them to show up in completions+ guard (isNothing (T.find (== '$') (P.runProperName name)))+ Just (IdeDeclarationAnn emptyAnn (IdeDeclType (IdeType name kind [])))+ annClass cls = foreach (Map.toList cls) $ \(cn, _) ->+ -- Dummy kind and instances here, but we primarily care about the name completion+ IdeDeclarationAnn emptyAnn (IdeDeclTypeClass (IdeTypeClass (P.disqualify cn) P.kindType []) )+ -- The Environment for typechecking holds both a type class as well as a+ -- type declaration for every class, but we filter the types out when we+ -- load the Externs, so we do the same here+ removeClasses types classes =+ Map.difference types (Map.mapKeys (map P.coerceProperName) classes)++ primTypes = annType (removeClasses PEnv.primTypes PEnv.primClasses)+ primBooleanTypes = annType PEnv.primBooleanTypes+ primOrderingTypes = annType PEnv.primOrderingTypes+ primRowTypes = annType (removeClasses PEnv.primRowTypes PEnv.primRowClasses)+ primRowListTypes = annType (removeClasses PEnv.primRowListTypes PEnv.primRowListClasses)+ primSymbolTypes = annType (removeClasses PEnv.primSymbolTypes PEnv.primSymbolClasses)+ primIntTypes = annType (removeClasses PEnv.primIntTypes PEnv.primIntClasses)+ primTypeErrorTypes = annType (removeClasses PEnv.primTypeErrorTypes PEnv.primTypeErrorClasses)++ primClasses = annClass PEnv.primClasses+ primRowClasses = annClass PEnv.primRowClasses+ primRowListClasses = annClass PEnv.primRowListClasses+ primSymbolClasses = annClass PEnv.primSymbolClasses+ primIntClasses = annClass PEnv.primIntClasses+ primTypeErrorClasses = annClass PEnv.primTypeErrorClasses
+ src/Language/PureScript/Ide/Rebuild.hs view
@@ -0,0 +1,233 @@+{-# language PackageImports, TemplateHaskell, BlockArguments #-}++module Language.PureScript.Ide.Rebuild+ ( rebuildFileSync+ , rebuildFileAsync+ , rebuildFile+ ) where++import Protolude hiding (moduleName)++import "monad-logger" Control.Monad.Logger (LoggingT, MonadLogger, logDebug)+import Data.List qualified as List+import Data.Map.Lazy qualified as M+import Data.Maybe (fromJust)+import Data.Set qualified as S+import Data.Time qualified as Time+import Data.Text qualified as Text+import Language.PureScript qualified as P+import Language.PureScript.Make (ffiCodegen')+import Language.PureScript.Make.Cache (CacheInfo(..), normaliseForCache)+import Language.PureScript.CST qualified as CST++import Language.PureScript.Ide.Error (IdeError(..))+import Language.PureScript.Ide.Logging (labelTimespec, logPerf, runLogger)+import Language.PureScript.Ide.State (cacheRebuild, getExternFiles, insertExterns, insertModule, populateVolatileState, updateCacheTimestamp)+import Language.PureScript.Ide.Types (Ide, IdeConfiguration(..), IdeEnvironment(..), ModuleMap, Success(..))+import Language.PureScript.Ide.Util (ideReadFile)+import System.Directory (getCurrentDirectory)++-- | Given a filepath performs the following steps:+--+-- * Reads and parses a PureScript module from the filepath.+--+-- * Builds a dependency graph for the parsed module from the already loaded+-- ExternsFiles.+--+-- * Attempts to find an FFI definition file for the module by looking+-- for a file with the same filepath except for a .js extension.+--+-- * Passes all the created artifacts to @rebuildModule@.+--+-- * If the rebuilding succeeds, returns a @RebuildSuccess@ with the generated+-- warnings, and if rebuilding fails, returns a @RebuildError@ with the+-- generated errors.+rebuildFile+ :: (Ide m, MonadLogger m, MonadError IdeError m)+ => FilePath+ -- ^ The file to rebuild+ -> Maybe FilePath+ -- ^ The file to use as the location for parsing and errors+ -> Set P.CodegenTarget+ -- ^ The targets to codegen+ -> (ReaderT IdeEnvironment (LoggingT IO) () -> m ())+ -- ^ A runner for the second build with open exports+ -> m Success+rebuildFile file actualFile codegenTargets runOpenBuild = do+ (fp, input) <-+ case List.stripPrefix "data:" file of+ Just source -> pure ("", Text.pack source)+ _ -> ideReadFile file+ let fp' = fromMaybe fp actualFile+ (pwarnings, m) <- case sequence $ CST.parseFromFile fp' input of+ Left parseError ->+ throwError $ RebuildError [(fp', input)] $ CST.toMultipleErrors fp' parseError+ Right m -> pure m+ let moduleName = P.getModuleName m+ -- Externs files must be sorted ahead of time, so that they get applied+ -- in the right order (bottom up) to the 'Environment'.+ externs <- logPerf (labelTimespec "Sorting externs") (sortExterns m =<< getExternFiles)+ outputDirectory <- confOutputPath . ideConfiguration <$> ask+ -- For rebuilding, we want to 'RebuildAlways', but for inferring foreign+ -- modules using their file paths, we need to specify the path in the 'Map'.+ let filePathMap = M.singleton moduleName (Left P.RebuildAlways)+ let pureRebuild = fp == ""+ let modulePath = if pureRebuild then fp' else file+ foreigns <- P.inferForeignModules (M.singleton moduleName (Right modulePath))+ let makeEnv = P.buildMakeActions outputDirectory filePathMap foreigns False+ & (if pureRebuild then enableForeignCheck foreigns codegenTargets . shushCodegen else identity)+ & shushProgress+ -- Rebuild the single module using the cached externs+ (result, warnings) <- logPerf (labelTimespec "Rebuilding Module") $+ liftIO $ P.runMake (P.defaultOptions { P.optionsCodegenTargets = codegenTargets }) do+ newExterns <- P.rebuildModule makeEnv externs m+ unless pureRebuild+ $ updateCacheDb codegenTargets outputDirectory file actualFile moduleName+ pure newExterns+ case result of+ Left errors ->+ throwError (RebuildError [(fp', input)] errors)+ Right newExterns -> do+ insertModule (fromMaybe file actualFile, m)+ insertExterns newExterns+ void populateVolatileState+ _ <- updateCacheTimestamp+ runOpenBuild (rebuildModuleOpen makeEnv externs m)+ pure (RebuildSuccess (CST.toMultipleWarnings fp pwarnings <> warnings))++-- | When adjusting the cache db file after a rebuild we always pick a+-- non-sensical timestamp ("1858-11-17T00:00:00Z"), and rely on the+-- content hash to tell whether the module needs rebuilding. This is+-- because IDE rebuilds may be triggered on temporary files to not+-- force editors to save the actual source file to get at diagnostics+dayZero :: Time.UTCTime+dayZero = Time.UTCTime (Time.ModifiedJulianDay 0) 0++updateCacheDb+ :: MonadIO m+ => MonadError P.MultipleErrors m+ => Set P.CodegenTarget+ -> FilePath+ -- ^ The output directory+ -> FilePath+ -- ^ The file to read the content hash from+ -> Maybe FilePath+ -- ^ The file name to update in the cache+ -> P.ModuleName+ -- ^ The module name to update in the cache+ -> m ()+updateCacheDb codegenTargets outputDirectory file actualFile moduleName = do+ cwd <- liftIO getCurrentDirectory+ contentHash <- P.hashFile file+ let moduleCacheInfo = (normaliseForCache cwd (fromMaybe file actualFile), (dayZero, contentHash))++ foreignCacheInfo <-+ if S.member P.JS codegenTargets then do+ foreigns' <- P.inferForeignModules (M.singleton moduleName (Right (fromMaybe file actualFile)))+ for (M.lookup moduleName foreigns') \foreignPath -> do+ foreignHash <- P.hashFile foreignPath+ pure (normaliseForCache cwd foreignPath, (dayZero, foreignHash))+ else+ pure Nothing++ let cacheInfo = M.fromList (moduleCacheInfo : maybeToList foreignCacheInfo)+ cacheDb <- P.readCacheDb' outputDirectory+ P.writeCacheDb' outputDirectory (M.insert moduleName (CacheInfo cacheInfo) cacheDb)++rebuildFileAsync+ :: forall m. (Ide m, MonadLogger m, MonadError IdeError m)+ => FilePath -> Maybe FilePath -> Set P.CodegenTarget -> m Success+rebuildFileAsync fp fp' ts = rebuildFile fp fp' ts asyncRun+ where+ asyncRun :: ReaderT IdeEnvironment (LoggingT IO) () -> m ()+ asyncRun action = do+ env <- ask+ let ll = confLogLevel (ideConfiguration env)+ void (liftIO (async (runLogger ll (runReaderT action env))))++rebuildFileSync+ :: forall m. (Ide m, MonadLogger m, MonadError IdeError m)+ => FilePath -> Maybe FilePath -> Set P.CodegenTarget -> m Success+rebuildFileSync fp fp' ts = rebuildFile fp fp' ts syncRun+ where+ syncRun :: ReaderT IdeEnvironment (LoggingT IO) () -> m ()+ syncRun action = do+ env <- ask+ let ll = confLogLevel (ideConfiguration env)+ void (liftIO (runLogger ll (runReaderT action env)))++-- | Rebuilds a module but opens up its export list first and stores the result+-- inside the rebuild cache+rebuildModuleOpen+ :: (Ide m, MonadLogger m)+ => P.MakeActions P.Make+ -> [P.ExternsFile]+ -> P.Module+ -> m ()+rebuildModuleOpen makeEnv externs m = void $ runExceptT do+ (openResult, _) <- liftIO $ P.runMake P.defaultOptions $+ P.rebuildModule (shushProgress (shushCodegen makeEnv)) externs (openModuleExports m)+ case openResult of+ Left _ ->+ throwError (GeneralError "Failed when rebuilding with open exports")+ Right result -> do+ $(logDebug)+ ("Setting Rebuild cache: " <> P.runModuleName (P.efModuleName result))+ cacheRebuild result++-- | Shuts the compiler up about progress messages+shushProgress :: Monad m => P.MakeActions m -> P.MakeActions m+shushProgress ma =+ ma { P.progress = \_ -> pure () }++-- | Stops any kind of codegen+shushCodegen :: Monad m => P.MakeActions m -> P.MakeActions m+shushCodegen ma =+ ma { P.codegen = \_ _ _ -> pure ()+ , P.ffiCodegen = \_ -> pure ()+ }++-- | Enables foreign module check without actual codegen.+enableForeignCheck+ :: M.Map P.ModuleName FilePath+ -> S.Set P.CodegenTarget+ -> P.MakeActions P.Make+ -> P.MakeActions P.Make+enableForeignCheck foreigns codegenTargets ma =+ ma { P.ffiCodegen = ffiCodegen' foreigns codegenTargets Nothing+ }++-- | Returns a topologically sorted list of dependent ExternsFiles for the given+-- module. Throws an error if there is a cyclic dependency within the+-- ExternsFiles+sortExterns+ :: (Ide m, MonadError IdeError m)+ => P.Module+ -> ModuleMap P.ExternsFile+ -> m [P.ExternsFile]+sortExterns m ex = do+ sorted' <- runExceptT+ . P.sortModules P.Transitive P.moduleSignature+ . (:) m+ . map mkShallowModule+ . M.elems+ . M.delete (P.getModuleName m) $ ex+ case sorted' of+ Left err ->+ throwError (RebuildError [] err)+ Right (sorted, graph) -> do+ let deps = fromJust (List.lookup (P.getModuleName m) graph)+ pure $ mapMaybe getExtern (deps `inOrderOf` map P.getModuleName sorted)+ where+ mkShallowModule P.ExternsFile{..} =+ P.Module (P.internalModuleSourceSpan "<rebuild>") [] efModuleName (map mkImport efImports) Nothing+ mkImport (P.ExternsImport mn it iq) =+ P.ImportDeclaration (P.internalModuleSourceSpan "<rebuild>", []) mn it iq+ getExtern mn = M.lookup mn ex+ -- Sort a list so its elements appear in the same order as in another list.+ inOrderOf :: (Ord a) => [a] -> [a] -> [a]+ inOrderOf xs ys = let s = S.fromList xs in filter (`S.member` s) ys++-- | Removes a modules export list.+openModuleExports :: P.Module -> P.Module+openModuleExports (P.Module ss cs mn decls _) = P.Module ss cs mn decls Nothing
+ src/Language/PureScript/Ide/Reexports.hs view
@@ -0,0 +1,129 @@+-----------------------------------------------------------------------------+--+-- Module : Language.PureScript.Ide.Reexports+-- Description : Resolves reexports for psc-ide+-- Copyright : Christoph Hegemann 2016+-- Brian Sermons 2016+-- License : MIT (http://opensource.org/licenses/MIT)+--+-- Maintainer : Christoph Hegemann <christoph.hegemann1337@gmail.com>+-- Stability : experimental+--+-- |+-- Resolves reexports for psc-ide+-----------------------------------------------------------------------------++module Language.PureScript.Ide.Reexports+ ( resolveReexports+ , prettyPrintReexportResult+ , reexportHasFailures+ , ReexportResult(..)+ -- for tests+ , resolveReexports'+ ) where++import Protolude hiding (moduleName)++import Control.Lens (set)+import Data.Map qualified as Map+import Language.PureScript qualified as P+import Language.PureScript.Ide.Types+import Language.PureScript.Ide.Util (discardAnn)++-- | Contains the module with resolved reexports, and possible failures+data ReexportResult a+ = ReexportResult+ { reResolved :: a+ , reFailed :: [(P.ModuleName, P.DeclarationRef)]+ } deriving (Show, Eq, Functor, Generic)++instance NFData a => NFData (ReexportResult a)++-- | Uses the passed formatter to format the resolved module, and adds possible+-- failures+prettyPrintReexportResult+ :: (a -> Text)+ -- ^ Formatter for the resolved result+ -> ReexportResult a+ -- ^ The Result to be pretty printed+ -> Text+prettyPrintReexportResult f ReexportResult{..}+ | null reFailed =+ "Successfully resolved reexports for " <> f reResolved+ | otherwise =+ "Failed to resolve reexports for "+ <> f reResolved+ <> foldMap (\(mn, ref) -> P.runModuleName mn <> show ref) reFailed++-- | Whether any Refs couldn't be resolved+reexportHasFailures :: ReexportResult a -> Bool+reexportHasFailures = not . null . reFailed++-- | Resolves Reexports for the given Modules, by looking up the reexported+-- values from the passed in DeclarationRefs+resolveReexports+ :: ModuleMap [(P.ModuleName, P.DeclarationRef)]+ -- ^ the references to resolve+ -> ModuleMap [IdeDeclarationAnn]+ -- ^ Modules to search for the reexported declarations+ -> ModuleMap (ReexportResult [IdeDeclarationAnn])+resolveReexports reexportRefs modules =+ Map.mapWithKey (\moduleName decls ->+ maybe (ReexportResult decls [])+ (map (decls <>) . resolveReexports' modules)+ (Map.lookup moduleName reexportRefs)) modules++resolveReexports'+ :: ModuleMap [IdeDeclarationAnn]+ -> [(P.ModuleName, P.DeclarationRef)]+ -> ReexportResult [IdeDeclarationAnn]+resolveReexports' modules refs =+ ReexportResult (concat resolvedRefs) failedRefs+ where+ (failedRefs, resolvedRefs) = partitionEithers (resolveRef' <$> refs)+ resolveRef' x@(mn, r) = case Map.lookup mn modules of+ Nothing -> Left x+ Just decls' ->+ let+ setExportedFrom = set (idaAnnotation . annExportedFrom) . Just+ in+ bimap (mn,) (map (setExportedFrom mn)) (resolveRef decls' r)++resolveRef+ :: [IdeDeclarationAnn]+ -> P.DeclarationRef+ -> Either P.DeclarationRef [IdeDeclarationAnn]+resolveRef decls ref = case ref of+ P.TypeRef _ tn mdtors ->+ case findRef (anyOf (_IdeDeclType . ideTypeName) (== tn))+ <|> findRef (anyOf (_IdeDeclTypeSynonym . ideSynonymName) (== tn)) of+ Nothing ->+ Left ref+ Just d -> Right $ d : case mdtors of+ Nothing ->+ -- If the dataconstructor field inside the TypeRef is Nothing, that+ -- means that all data constructors are exported, so we need to look+ -- those up ourselves+ findDtors tn+ Just dtors -> mapMaybe lookupDtor dtors+ P.ValueRef _ i ->+ findWrapped (anyOf (_IdeDeclValue . ideValueIdent) (== i))+ P.ValueOpRef _ name ->+ findWrapped (anyOf (_IdeDeclValueOperator . ideValueOpName) (== name))+ P.TypeOpRef _ name ->+ findWrapped (anyOf (_IdeDeclTypeOperator . ideTypeOpName) (== name))+ P.TypeClassRef _ name ->+ findWrapped (anyOf (_IdeDeclTypeClass . ideTCName) (== name))+ _ ->+ Left ref+ where+ findWrapped = maybe (Left ref) (Right . pure) . findRef+ findRef f = find (f . discardAnn) decls++ lookupDtor name =+ findRef (anyOf (_IdeDeclDataConstructor . ideDtorName) (== name))++ findDtors tn = filter (anyOf+ (idaDeclaration+ . _IdeDeclDataConstructor+ . ideDtorTypeName) (== tn)) decls
+ src/Language/PureScript/Ide/SourceFile.hs view
@@ -0,0 +1,102 @@+-----------------------------------------------------------------------------+--+-- Module : Language.PureScript.Ide.SourceFile+-- Description : Getting declarations from PureScript sourcefiles+-- Copyright : Christoph Hegemann 2016+-- License : MIT (http://opensource.org/licenses/MIT)+--+-- Maintainer : Christoph Hegemann <christoph.hegemann1337@gmail.com>+-- Stability : experimental+--+-- |+-- Getting declarations from PureScript sourcefiles+-----------------------------------------------------------------------------++module Language.PureScript.Ide.SourceFile+ ( parseModulesFromFiles+ , extractAstInformation+ -- for tests+ , extractSpans+ , extractTypeAnnotations+ ) where++import Protolude++import Control.Parallel.Strategies (withStrategy, parList, rseq)+import Data.Map qualified as Map+import Language.PureScript qualified as P+import Language.PureScript.CST qualified as CST+import Language.PureScript.Ide.Error (IdeError)+import Language.PureScript.Ide.Types (DefinitionSites, IdeNamespace(..), IdeNamespaced(..), TypeAnnotations)+import Language.PureScript.Ide.Util (ideReadFile)++parseModule :: FilePath -> Text -> Either FilePath (FilePath, P.Module)+parseModule path file =+ case snd $ CST.parseFromFile path file of+ Left _ -> Left path+ Right m -> Right (path, m)++parseModulesFromFiles+ :: (MonadIO m, MonadError IdeError m)+ => [FilePath]+ -> m [Either FilePath (FilePath, P.Module)]+parseModulesFromFiles paths = do+ files <- traverse ideReadFile paths+ pure (inParallel (map (uncurry parseModule) files))+ where+ inParallel :: [Either e (k, a)] -> [Either e (k, a)]+ inParallel = withStrategy (parList rseq)++-- | Extracts AST information from a parsed module+extractAstInformation+ :: P.Module+ -> (DefinitionSites P.SourceSpan, TypeAnnotations)+extractAstInformation (P.Module moduleSpan _ mn decls _) =+ let definitions =+ Map.insert+ (IdeNamespaced IdeNSModule (P.runModuleName mn)) moduleSpan+ (Map.fromList (concatMap extractSpans decls))+ typeAnnotations = Map.fromList (extractTypeAnnotations decls)+ in (definitions, typeAnnotations)++-- | Extracts type annotations for functions from a given Module+extractTypeAnnotations :: [P.Declaration] -> [(P.Ident, P.SourceType)]+extractTypeAnnotations = mapMaybe (map P.unwrapTypeDeclaration . P.getTypeDeclaration)++-- | Given a surrounding Sourcespan and a Declaration from the PS AST, extracts+-- definition sites inside that Declaration.+extractSpans+ :: P.Declaration+ -- ^ The declaration to extract spans from+ -> [(IdeNamespaced, P.SourceSpan)]+ -- ^ Declarations and their source locations+extractSpans d = case d of+ P.ValueDecl (ss, _) i _ _ _ ->+ [(IdeNamespaced IdeNSValue (P.runIdent i), ss)]+ P.TypeSynonymDeclaration (ss, _) name _ _ ->+ [(IdeNamespaced IdeNSType (P.runProperName name), ss)]+ P.TypeClassDeclaration (ss, _) name _ _ _ members ->+ (IdeNamespaced IdeNSType (P.runProperName name), ss) : concatMap extractSpans' members+ P.DataDeclaration (ss, _) _ name _ ctors ->+ (IdeNamespaced IdeNSType (P.runProperName name), ss) : map dtorSpan ctors+ P.FixityDeclaration (ss, _) (Left (P.ValueFixity _ _ opName)) ->+ [(IdeNamespaced IdeNSValue (P.runOpName opName), ss)]+ P.FixityDeclaration (ss, _) (Right (P.TypeFixity _ _ opName)) ->+ [(IdeNamespaced IdeNSType (P.runOpName opName), ss)]+ P.ExternDeclaration (ss, _) ident _ ->+ [(IdeNamespaced IdeNSValue (P.runIdent ident), ss)]+ P.ExternDataDeclaration (ss, _) name _ ->+ [(IdeNamespaced IdeNSType (P.runProperName name), ss)]+ _ -> []+ where+ dtorSpan :: P.DataConstructorDeclaration -> (IdeNamespaced, P.SourceSpan)+ dtorSpan P.DataConstructorDeclaration{ P.dataCtorName = name, P.dataCtorAnn = (ss, _) } =+ (IdeNamespaced IdeNSValue (P.runProperName name), ss)+ -- We need this special case to be able to also get the position info for+ -- typeclass member functions. Typedeclarations would clash with value+ -- declarations for non-typeclass members, which is why we can't handle them+ -- in extractSpans.+ extractSpans' dP = case dP of+ P.TypeDeclaration (P.TypeDeclarationData (ss', _) ident _) ->+ [(IdeNamespaced IdeNSValue (P.runIdent ident), ss')]+ _ -> []
+ src/Language/PureScript/Ide/State.hs view
@@ -0,0 +1,452 @@+-----------------------------------------------------------------------------+--+-- Module : Language.PureScript.Ide.State+-- Description : Functions to access psc-ide's state+-- Copyright : Christoph Hegemann 2016+-- License : MIT (http://opensource.org/licenses/MIT)+--+-- Maintainer : Christoph Hegemann <christoph.hegemann1337@gmail.com>+-- Stability : experimental+--+-- |+-- Functions to access psc-ide's state+-----------------------------------------------------------------------------++{-# LANGUAGE PackageImports #-}+{-# LANGUAGE TypeApplications #-}++module Language.PureScript.Ide.State+ ( getLoadedModulenames+ , getExternFiles+ , getFileState+ , resetIdeState+ , cacheRebuild+ , cachedRebuild+ , insertExterns+ , insertModule+ , insertExternsSTM+ , getAllModules+ , populateVolatileState+ , populateVolatileStateSync+ , populateVolatileStateSTM+ , getOutputDirectory+ , updateCacheTimestamp+ -- for tests+ , resolveOperatorsForModule+ , resolveInstances+ , resolveDataConstructorsForModule+ ) where++import Protolude hiding (moduleName, unzip)++import Control.Concurrent.STM (TVar, modifyTVar, readTVar, readTVarIO, writeTVar)+import Control.Lens (Ixed(..), preview, view, (%~), (.~), (^.))+import "monad-logger" Control.Monad.Logger (MonadLogger, logWarnN)+import Data.IORef (readIORef, writeIORef)+import Data.Map.Lazy qualified as Map+import Data.Time.Clock (UTCTime)+import Data.Zip (unzip)+import Language.PureScript qualified as P+import Language.PureScript.Docs.Convert.Single (convertComments)+import Language.PureScript.Externs (ExternsDeclaration(..), ExternsFile(..))+import Language.PureScript.Make.Actions (cacheDbFile)+import Language.PureScript.Ide.Externs (convertExterns)+import Language.PureScript.Ide.Reexports (ReexportResult(..), prettyPrintReexportResult, reexportHasFailures, resolveReexports)+import Language.PureScript.Ide.SourceFile (extractAstInformation)+import Language.PureScript.Ide.Types+import Language.PureScript.Ide.Util (discardAnn, displayTimeSpec, logPerf, opNameT, properNameT, runLogger)+import System.Directory (getModificationTime)++-- | Resets all State inside psc-ide+resetIdeState :: Ide m => m ()+resetIdeState = do+ ideVar <- ideStateVar <$> ask+ liftIO (atomically (writeTVar ideVar emptyIdeState))++getOutputDirectory :: Ide m => m FilePath+getOutputDirectory = do+ confOutputPath . ideConfiguration <$> ask++getCacheTimestamp :: Ide m => m (Maybe UTCTime)+getCacheTimestamp = do+ x <- ideCacheDbTimestamp <$> ask+ liftIO (readIORef x)++readCacheTimestamp :: Ide m => m (Maybe UTCTime)+readCacheTimestamp = do+ cacheDb <- cacheDbFile <$> getOutputDirectory+ liftIO (hush <$> try @SomeException (getModificationTime cacheDb))++updateCacheTimestamp :: Ide m => m (Maybe (Maybe UTCTime, Maybe UTCTime))+updateCacheTimestamp = do+ old <- getCacheTimestamp+ new <- readCacheTimestamp+ if old == new+ then pure Nothing+ else do+ ts <- ideCacheDbTimestamp <$> ask+ liftIO (writeIORef ts new)+ pure (Just (old, new))++-- | Gets the loaded Modulenames+getLoadedModulenames :: Ide m => m [P.ModuleName]+getLoadedModulenames = Map.keys <$> getExternFiles++-- | Gets all loaded ExternFiles+getExternFiles :: Ide m => m (ModuleMap ExternsFile)+getExternFiles = fsExterns <$> getFileState++-- | Insert a Module into Stage1 of the State+insertModule :: Ide m => (FilePath, P.Module) -> m ()+insertModule module' = do+ stateVar <- ideStateVar <$> ask+ liftIO . atomically $ insertModuleSTM stateVar module'++-- | STM version of insertModule+insertModuleSTM :: TVar IdeState -> (FilePath, P.Module) -> STM ()+insertModuleSTM ref (fp, module') =+ modifyTVar ref $ \x ->+ x { ideFileState = (ideFileState x) {+ fsModules = Map.insert+ (P.getModuleName module')+ (module', fp)+ (fsModules (ideFileState x))}}++-- | Retrieves the FileState from the State. This includes loaded Externfiles+-- and parsed Modules+getFileState :: Ide m => m IdeFileState+getFileState = do+ st <- ideStateVar <$> ask+ ideFileState <$> liftIO (readTVarIO st)++-- | STM version of getFileState+getFileStateSTM :: TVar IdeState -> STM IdeFileState+getFileStateSTM ref = ideFileState <$> readTVar ref++-- | Retrieves VolatileState from the State.+-- This includes the denormalized Declarations and cached rebuilds+getVolatileState :: Ide m => m IdeVolatileState+getVolatileState = do+ st <- ideStateVar <$> ask+ liftIO (atomically (getVolatileStateSTM st))++-- | STM version of getVolatileState+getVolatileStateSTM :: TVar IdeState -> STM IdeVolatileState+getVolatileStateSTM st = ideVolatileState <$> readTVar st++-- | Sets the VolatileState inside Ide's state+setVolatileStateSTM :: TVar IdeState -> IdeVolatileState -> STM ()+setVolatileStateSTM ref vs = do+ modifyTVar ref $ \x ->+ x {ideVolatileState = vs}+ pure ()++-- | Checks if the given ModuleName matches the last rebuild cache and if it+-- does returns all loaded definitions + the definitions inside the rebuild+-- cache+getAllModules :: Ide m => Maybe P.ModuleName -> m (ModuleMap [IdeDeclarationAnn])+getAllModules mmoduleName = do+ declarations <- vsDeclarations <$> getVolatileState+ rebuild <- cachedRebuild+ case mmoduleName of+ Nothing -> pure declarations+ Just moduleName ->+ case rebuild of+ Just (cachedModulename, ef)+ | cachedModulename == moduleName -> do+ AstData asts <- vsAstData <$> getVolatileState+ let+ ast =+ fromMaybe (Map.empty, Map.empty) (Map.lookup moduleName asts)+ cachedModule =+ resolveLocationsForModule ast (fst (convertExterns ef))+ tmp =+ Map.insert moduleName cachedModule declarations+ resolved =+ Map.adjust (resolveOperatorsForModule tmp) moduleName tmp++ pure resolved+ _ -> pure declarations++-- | Adds an ExternsFile into psc-ide's FileState. This does not populate the+-- VolatileState, which needs to be done after all the necessary Externs and+-- SourceFiles have been loaded.+insertExterns :: Ide m => ExternsFile -> m ()+insertExterns ef = do+ st <- ideStateVar <$> ask+ liftIO (atomically (insertExternsSTM st ef))++-- | STM version of insertExterns+insertExternsSTM :: TVar IdeState -> ExternsFile -> STM ()+insertExternsSTM ref ef =+ modifyTVar ref $ \x ->+ x { ideFileState = (ideFileState x) {+ fsExterns = Map.insert (efModuleName ef) ef (fsExterns (ideFileState x))}}++-- | Sets rebuild cache to the given ExternsFile+cacheRebuild :: Ide m => ExternsFile -> m ()+cacheRebuild ef = do+ st <- ideStateVar <$> ask+ liftIO . atomically . modifyTVar st $ \x ->+ x { ideVolatileState = (ideVolatileState x) {+ vsCachedRebuild = Just (efModuleName ef, ef)}}++-- | Retrieves the rebuild cache+cachedRebuild :: Ide m => m (Maybe (P.ModuleName, ExternsFile))+cachedRebuild = vsCachedRebuild <$> getVolatileState++-- | Resolves reexports and populates VolatileState with data to be used in queries.+populateVolatileStateSync :: (Ide m, MonadLogger m) => m ()+populateVolatileStateSync = do+ st <- ideStateVar <$> ask+ let message duration = "Finished populating volatile state in: " <> displayTimeSpec duration+ results <- logPerf message $ do+ !r <- liftIO (atomically (populateVolatileStateSTM st))+ pure r+ void $ Map.traverseWithKey+ (\mn -> logWarnN . prettyPrintReexportResult (const (P.runModuleName mn)))+ (Map.filter reexportHasFailures results)++populateVolatileState :: Ide m => m (Async ())+populateVolatileState = do+ env <- ask+ let ll = confLogLevel (ideConfiguration env)+ -- populateVolatileState return Unit for now, so it's fine to discard this+ -- result. We might want to block on this in a benchmarking situation.+ liftIO (async (runLogger ll (runReaderT populateVolatileStateSync env)))++-- | STM version of populateVolatileState+populateVolatileStateSTM+ :: TVar IdeState+ -> STM (ModuleMap (ReexportResult [IdeDeclarationAnn]))+populateVolatileStateSTM ref = do+ IdeFileState{fsExterns = externs, fsModules = modules} <- getFileStateSTM ref+ -- We're not using the cached rebuild for anything other than preserving it+ -- through the repopulation+ rebuildCache <- vsCachedRebuild <$> getVolatileStateSTM ref+ let asts = map (extractAstInformation . fst) modules+ let (moduleDeclarations, reexportRefs) = unzip (Map.map convertExterns externs)+ results =+ moduleDeclarations+ & map resolveDataConstructorsForModule+ & resolveLocations asts+ & resolveDocumentation (map fst modules)+ & resolveInstances externs+ & resolveOperators+ & resolveReexports reexportRefs+ setVolatileStateSTM ref (IdeVolatileState (AstData asts) (map reResolved results) rebuildCache)+ pure (force results)++resolveLocations+ :: ModuleMap (DefinitionSites P.SourceSpan, TypeAnnotations)+ -> ModuleMap [IdeDeclarationAnn]+ -> ModuleMap [IdeDeclarationAnn]+resolveLocations asts =+ Map.mapWithKey (\mn decls ->+ maybe decls (flip resolveLocationsForModule decls) (Map.lookup mn asts))++resolveLocationsForModule+ :: (DefinitionSites P.SourceSpan, TypeAnnotations)+ -> [IdeDeclarationAnn]+ -> [IdeDeclarationAnn]+resolveLocationsForModule (defs, types) =+ map convertDeclaration+ where+ convertDeclaration :: IdeDeclarationAnn -> IdeDeclarationAnn+ convertDeclaration (IdeDeclarationAnn ann d) = convertDeclaration'+ annotateFunction+ annotateValue+ annotateDataConstructor+ annotateType+ annotateType -- type classes live in the type namespace+ annotateModule+ d+ where+ annotateFunction x = IdeDeclarationAnn (ann { _annLocation = Map.lookup (IdeNamespaced IdeNSValue (P.runIdent x)) defs+ , _annTypeAnnotation = Map.lookup x types+ })+ annotateValue x = IdeDeclarationAnn (ann {_annLocation = Map.lookup (IdeNamespaced IdeNSValue x) defs})+ annotateDataConstructor x = IdeDeclarationAnn (ann {_annLocation = Map.lookup (IdeNamespaced IdeNSValue x) defs})+ annotateType x = IdeDeclarationAnn (ann {_annLocation = Map.lookup (IdeNamespaced IdeNSType x) defs})+ annotateModule x = IdeDeclarationAnn (ann {_annLocation = Map.lookup (IdeNamespaced IdeNSModule x) defs})++convertDeclaration'+ :: (P.Ident -> IdeDeclaration -> IdeDeclarationAnn)+ -> (Text -> IdeDeclaration -> IdeDeclarationAnn)+ -> (Text -> IdeDeclaration -> IdeDeclarationAnn)+ -> (Text -> IdeDeclaration -> IdeDeclarationAnn)+ -> (Text -> IdeDeclaration -> IdeDeclarationAnn)+ -> (Text -> IdeDeclaration -> IdeDeclarationAnn)+ -> IdeDeclaration+ -> IdeDeclarationAnn+convertDeclaration' annotateFunction annotateValue annotateDataConstructor annotateType annotateClass annotateModule d =+ case d of+ IdeDeclValue v ->+ annotateFunction (v ^. ideValueIdent) d+ IdeDeclType t ->+ annotateType (t ^. ideTypeName . properNameT) d+ IdeDeclTypeSynonym s ->+ annotateType (s ^. ideSynonymName . properNameT) d+ IdeDeclDataConstructor dtor ->+ annotateDataConstructor (dtor ^. ideDtorName . properNameT) d+ IdeDeclTypeClass tc ->+ annotateClass (tc ^. ideTCName . properNameT) d+ IdeDeclValueOperator operator ->+ annotateValue (operator ^. ideValueOpName . opNameT) d+ IdeDeclTypeOperator operator ->+ annotateType (operator ^. ideTypeOpName . opNameT) d+ IdeDeclModule mn ->+ annotateModule (P.runModuleName mn) d++resolveDocumentation+ :: ModuleMap P.Module+ -> ModuleMap [IdeDeclarationAnn]+ -> ModuleMap [IdeDeclarationAnn]+resolveDocumentation modules =+ Map.mapWithKey (\mn decls ->+ maybe decls (flip resolveDocumentationForModule decls) (Map.lookup mn modules))++resolveDocumentationForModule+ :: P.Module+ -> [IdeDeclarationAnn]+ -> [IdeDeclarationAnn]+resolveDocumentationForModule (P.Module _ moduleComments moduleName sdecls _) =+ map convertDecl+ where+ extractDeclComments :: P.Declaration -> [(P.Name, [P.Comment])]+ extractDeclComments = \case+ P.DataDeclaration (_, cs) _ ctorName _ ctors ->+ (P.TyName ctorName, cs) : map dtorComments ctors+ P.TypeClassDeclaration (_, cs) tyClassName _ _ _ members ->+ (P.TyClassName tyClassName, cs) : concatMap extractDeclComments members+ decl ->+ maybe [] (\name' -> [(name', snd (P.declSourceAnn decl))]) (name decl)++ comments :: Map P.Name [P.Comment]+ comments = Map.insert (P.ModName moduleName) moduleComments $+ Map.fromListWith (flip (<>)) $ concatMap extractDeclComments sdecls++ dtorComments :: P.DataConstructorDeclaration -> (P.Name, [P.Comment])+ dtorComments dcd = (P.DctorName (P.dataCtorName dcd), snd (P.dataCtorAnn dcd))++ name :: P.Declaration -> Maybe P.Name+ name (P.TypeDeclaration d) = Just $ P.IdentName $ P.tydeclIdent d+ name decl = P.declName decl++ convertDecl :: IdeDeclarationAnn -> IdeDeclarationAnn+ convertDecl (IdeDeclarationAnn ann d) =+ convertDeclaration'+ (annotateValue . P.IdentName)+ (annotateValue . P.IdentName . P.Ident)+ (annotateValue . P.DctorName . P.ProperName)+ (annotateValue . P.TyName . P.ProperName)+ (annotateValue . P.TyClassName . P.ProperName)+ (annotateValue . P.ModName . P.moduleNameFromString)+ d+ where+ docs :: P.Name -> Text+ docs ident = fromMaybe "" $ convertComments =<< Map.lookup ident comments++ annotateValue ident = IdeDeclarationAnn (ann { _annDocumentation = Just $ docs ident })++resolveInstances+ :: ModuleMap P.ExternsFile+ -> ModuleMap [IdeDeclarationAnn]+ -> ModuleMap [IdeDeclarationAnn]+resolveInstances externs declarations =+ Map.foldr (flip (foldr go)) declarations+ . Map.mapWithKey (\mn ef -> mapMaybe (extractInstances mn) (efDeclarations ef))+ $ externs+ where+ extractInstances mn P.EDInstance{..} =+ case edInstanceClassName of+ P.Qualified (P.ByModuleName classModule) className ->+ Just (IdeInstance mn+ edInstanceName+ edInstanceTypes+ edInstanceConstraints, classModule, className)+ _ -> Nothing+ extractInstances _ _ = Nothing++ go+ :: (IdeInstance, P.ModuleName, P.ProperName 'P.ClassName)+ -> ModuleMap [IdeDeclarationAnn]+ -> ModuleMap [IdeDeclarationAnn]+ go (ideInstance, classModule, className) acc' =+ let+ matchTC =+ anyOf (idaDeclaration . _IdeDeclTypeClass . ideTCName) (== className)+ updateDeclaration =+ mapIf matchTC (idaDeclaration+ . _IdeDeclTypeClass+ . ideTCInstances+ %~ (ideInstance :))+ in+ acc' & ix classModule %~ updateDeclaration++resolveOperators+ :: ModuleMap [IdeDeclarationAnn]+ -> ModuleMap [IdeDeclarationAnn]+resolveOperators modules =+ map (resolveOperatorsForModule modules) modules++-- | Looks up the types and kinds for operators and assigns them to their+-- declarations+resolveOperatorsForModule+ :: ModuleMap [IdeDeclarationAnn]+ -> [IdeDeclarationAnn]+ -> [IdeDeclarationAnn]+resolveOperatorsForModule modules = map (idaDeclaration %~ resolveOperator)+ where+ getDeclarations :: P.ModuleName -> [IdeDeclaration]+ getDeclarations moduleName =+ Map.lookup moduleName modules+ & foldMap (map discardAnn)++ resolveOperator (IdeDeclValueOperator op)+ | (P.Qualified (P.ByModuleName mn) (Left ident)) <- op ^. ideValueOpAlias =+ let t = getDeclarations mn+ & mapMaybe (preview _IdeDeclValue)+ & filter (anyOf ideValueIdent (== ident))+ & map (view ideValueType)+ & listToMaybe+ in IdeDeclValueOperator (op & ideValueOpType .~ t)+ | (P.Qualified (P.ByModuleName mn) (Right dtor)) <- op ^. ideValueOpAlias =+ let t = getDeclarations mn+ & mapMaybe (preview _IdeDeclDataConstructor)+ & filter (anyOf ideDtorName (== dtor))+ & map (view ideDtorType)+ & listToMaybe+ in IdeDeclValueOperator (op & ideValueOpType .~ t)+ resolveOperator (IdeDeclTypeOperator op)+ | P.Qualified (P.ByModuleName mn) properName <- op ^. ideTypeOpAlias =+ let k = getDeclarations mn+ & mapMaybe (preview _IdeDeclType)+ & filter (anyOf ideTypeName (== properName))+ & map (view ideTypeKind)+ & listToMaybe+ in IdeDeclTypeOperator (op & ideTypeOpKind .~ k)+ resolveOperator x = x+++mapIf :: Functor f => (b -> Bool) -> (b -> b) -> f b -> f b+mapIf p f = map (\x -> if p x then f x else x)++resolveDataConstructorsForModule+ :: [IdeDeclarationAnn]+ -> [IdeDeclarationAnn]+resolveDataConstructorsForModule decls =+ map (idaDeclaration %~ resolveDataConstructors) decls+ where+ resolveDataConstructors :: IdeDeclaration -> IdeDeclaration+ resolveDataConstructors decl = case decl of+ IdeDeclType ty ->+ IdeDeclType (ty & ideTypeDtors .~ fromMaybe [] (Map.lookup (ty ^. ideTypeName) dtors))+ _ ->+ decl++ dtors =+ decls+ & mapMaybe (preview (idaDeclaration . _IdeDeclDataConstructor))+ & foldr (\(IdeDataConstructor name typeName type') ->+ Map.insertWith (<>) typeName [(name, type')]) Map.empty
+ src/Language/PureScript/Ide/Types.hs view
@@ -0,0 +1,327 @@+-- |+-- Type definitions for psc-ide++{-# language DeriveAnyClass, NoGeneralizedNewtypeDeriving, TemplateHaskell #-}++module Language.PureScript.Ide.Types where++import Protolude hiding (moduleName)++import Control.Concurrent.STM (TVar)+import Control.Lens (Getting, Traversal', makeLenses)+import Control.Monad.Fail (fail)+import Data.Aeson (ToJSON, FromJSON, (.=))+import Data.Aeson qualified as Aeson+import Data.IORef (IORef)+import Data.Time.Clock (UTCTime)+import Data.Map.Lazy qualified as M+import Language.PureScript qualified as P+import Language.PureScript.Errors.JSON qualified as P+import Language.PureScript.Ide.Filter.Declaration (DeclarationType(..))++type ModuleIdent = Text+type ModuleMap a = Map P.ModuleName a++data IdeDeclaration+ = IdeDeclValue IdeValue+ | IdeDeclType IdeType+ | IdeDeclTypeSynonym IdeTypeSynonym+ | IdeDeclDataConstructor IdeDataConstructor+ | IdeDeclTypeClass IdeTypeClass+ | IdeDeclValueOperator IdeValueOperator+ | IdeDeclTypeOperator IdeTypeOperator+ | IdeDeclModule P.ModuleName+ deriving (Show, Eq, Ord, Generic, NFData)++data IdeValue = IdeValue+ { _ideValueIdent :: P.Ident+ , _ideValueType :: P.SourceType+ } deriving (Show, Eq, Ord, Generic, NFData)++data IdeType = IdeType+ { _ideTypeName :: P.ProperName 'P.TypeName+ , _ideTypeKind :: P.SourceType+ , _ideTypeDtors :: [(P.ProperName 'P.ConstructorName, P.SourceType)]+ } deriving (Show, Eq, Ord, Generic, NFData)++data IdeTypeSynonym = IdeTypeSynonym+ { _ideSynonymName :: P.ProperName 'P.TypeName+ , _ideSynonymType :: P.SourceType+ , _ideSynonymKind :: P.SourceType+ } deriving (Show, Eq, Ord, Generic, NFData)++data IdeDataConstructor = IdeDataConstructor+ { _ideDtorName :: P.ProperName 'P.ConstructorName+ , _ideDtorTypeName :: P.ProperName 'P.TypeName+ , _ideDtorType :: P.SourceType+ } deriving (Show, Eq, Ord, Generic, NFData)++data IdeTypeClass = IdeTypeClass+ { _ideTCName :: P.ProperName 'P.ClassName+ , _ideTCKind :: P.SourceType+ , _ideTCInstances :: [IdeInstance]+ } deriving (Show, Eq, Ord, Generic, NFData)++data IdeInstance = IdeInstance+ { _ideInstanceModule :: P.ModuleName+ , _ideInstanceName :: P.Ident+ , _ideInstanceTypes :: [P.SourceType]+ , _ideInstanceConstraints :: Maybe [P.SourceConstraint]+ } deriving (Show, Eq, Ord, Generic, NFData)++data IdeValueOperator = IdeValueOperator+ { _ideValueOpName :: P.OpName 'P.ValueOpName+ , _ideValueOpAlias :: P.Qualified (Either P.Ident (P.ProperName 'P.ConstructorName))+ , _ideValueOpPrecedence :: P.Precedence+ , _ideValueOpAssociativity :: P.Associativity+ , _ideValueOpType :: Maybe P.SourceType+ } deriving (Show, Eq, Ord, Generic, NFData)++data IdeTypeOperator = IdeTypeOperator+ { _ideTypeOpName :: P.OpName 'P.TypeOpName+ , _ideTypeOpAlias :: P.Qualified (P.ProperName 'P.TypeName)+ , _ideTypeOpPrecedence :: P.Precedence+ , _ideTypeOpAssociativity :: P.Associativity+ , _ideTypeOpKind :: Maybe P.SourceType+ } deriving (Show, Eq, Ord, Generic, NFData)++_IdeDeclValue :: Traversal' IdeDeclaration IdeValue+_IdeDeclValue f (IdeDeclValue x) = map IdeDeclValue (f x)+_IdeDeclValue _ x = pure x++_IdeDeclType :: Traversal' IdeDeclaration IdeType+_IdeDeclType f (IdeDeclType x) = map IdeDeclType (f x)+_IdeDeclType _ x = pure x++_IdeDeclTypeSynonym :: Traversal' IdeDeclaration IdeTypeSynonym+_IdeDeclTypeSynonym f (IdeDeclTypeSynonym x) = map IdeDeclTypeSynonym (f x)+_IdeDeclTypeSynonym _ x = pure x++_IdeDeclDataConstructor :: Traversal' IdeDeclaration IdeDataConstructor+_IdeDeclDataConstructor f (IdeDeclDataConstructor x) = map IdeDeclDataConstructor (f x)+_IdeDeclDataConstructor _ x = pure x++_IdeDeclTypeClass :: Traversal' IdeDeclaration IdeTypeClass+_IdeDeclTypeClass f (IdeDeclTypeClass x) = map IdeDeclTypeClass (f x)+_IdeDeclTypeClass _ x = pure x++_IdeDeclValueOperator :: Traversal' IdeDeclaration IdeValueOperator+_IdeDeclValueOperator f (IdeDeclValueOperator x) = map IdeDeclValueOperator (f x)+_IdeDeclValueOperator _ x = pure x++_IdeDeclTypeOperator :: Traversal' IdeDeclaration IdeTypeOperator+_IdeDeclTypeOperator f (IdeDeclTypeOperator x) = map IdeDeclTypeOperator (f x)+_IdeDeclTypeOperator _ x = pure x++_IdeDeclModule :: Traversal' IdeDeclaration P.ModuleName+_IdeDeclModule f (IdeDeclModule x) = map IdeDeclModule (f x)+_IdeDeclModule _ x = pure x++anyOf :: Getting Any s a -> (a -> Bool) -> s -> Bool+anyOf g p = getAny . getConst . g (Const . Any . p)++makeLenses ''IdeValue+makeLenses ''IdeType+makeLenses ''IdeTypeSynonym+makeLenses ''IdeDataConstructor+makeLenses ''IdeTypeClass+makeLenses ''IdeValueOperator+makeLenses ''IdeTypeOperator++data IdeDeclarationAnn = IdeDeclarationAnn+ { _idaAnnotation :: Annotation+ , _idaDeclaration :: IdeDeclaration+ } deriving (Show, Eq, Ord, Generic, NFData)++data Annotation+ = Annotation+ { _annLocation :: Maybe P.SourceSpan+ , _annExportedFrom :: Maybe P.ModuleName+ , _annTypeAnnotation :: Maybe P.SourceType+ , _annDocumentation :: Maybe Text+ } deriving (Show, Eq, Ord, Generic, NFData)++makeLenses ''Annotation+makeLenses ''IdeDeclarationAnn++emptyAnn :: Annotation+emptyAnn = Annotation Nothing Nothing Nothing Nothing++type DefinitionSites a = Map IdeNamespaced a+type TypeAnnotations = Map P.Ident P.SourceType+newtype AstData a = AstData (ModuleMap (DefinitionSites a, TypeAnnotations))+ -- ^ SourceSpans for the definition sites of values and types as well as type+ -- annotations found in a module+ deriving (Show, Eq, Ord, Generic, NFData, Functor, Foldable)++data IdeLogLevel = LogDebug | LogPerf | LogAll | LogDefault | LogNone+ deriving (Show, Eq)++data IdeConfiguration =+ IdeConfiguration+ { confOutputPath :: FilePath+ , confLogLevel :: IdeLogLevel+ , confGlobs :: [FilePath]+ , confGlobsFromFile :: Maybe FilePath+ , confGlobsExclude :: [FilePath]+ }++data IdeEnvironment =+ IdeEnvironment+ { ideStateVar :: TVar IdeState+ , ideConfiguration :: IdeConfiguration+ , ideCacheDbTimestamp :: IORef (Maybe UTCTime)+ }++type Ide m = (MonadIO m, MonadReader IdeEnvironment m)++data IdeState = IdeState+ { ideFileState :: IdeFileState+ , ideVolatileState :: IdeVolatileState+ } deriving (Show)++emptyIdeState :: IdeState+emptyIdeState = IdeState emptyFileState emptyVolatileState++emptyFileState :: IdeFileState+emptyFileState = IdeFileState M.empty M.empty++emptyVolatileState :: IdeVolatileState+emptyVolatileState = IdeVolatileState (AstData M.empty) M.empty Nothing+++-- | @IdeFileState@ holds data that corresponds 1-to-1 to an entity on the+-- filesystem. Externs correspond to the ExternsFiles the compiler emits into+-- the output folder, and modules are parsed ASTs from source files. This means,+-- that we can update single modules or ExternsFiles inside this state whenever+-- the corresponding entity changes on the file system.+data IdeFileState = IdeFileState+ { fsExterns :: ModuleMap P.ExternsFile+ , fsModules :: ModuleMap (P.Module, FilePath)+ } deriving (Show)++-- | @IdeVolatileState@ is derived from the @IdeFileState@ and needs to be+-- invalidated and refreshed carefully. It holds @AstData@, which is the data we+-- extract from the parsed ASTs, as well as the IdeDeclarations, which contain+-- lots of denormalized data, so they need to fully rebuilt whenever+-- @IdeFileState@ changes. The vsCachedRebuild field can hold a rebuild result+-- with open imports which is used to provide completions for module private+-- declarations+data IdeVolatileState = IdeVolatileState+ { vsAstData :: AstData P.SourceSpan+ , vsDeclarations :: ModuleMap [IdeDeclarationAnn]+ , vsCachedRebuild :: Maybe (P.ModuleName, P.ExternsFile)+ } deriving (Show)++newtype Match a = Match (P.ModuleName, a)+ deriving (Show, Eq, Functor)++-- | A completion as it gets sent to the editors+data Completion = Completion+ { complModule :: Text+ , complIdentifier :: Text+ , complType :: Text+ , complExpandedType :: Text+ , complLocation :: Maybe P.SourceSpan+ , complDocumentation :: Maybe Text+ , complExportedFrom :: [P.ModuleName]+ , complDeclarationType :: Maybe DeclarationType+ } deriving (Show, Eq, Ord)++instance ToJSON Completion where+ toJSON Completion {..} =+ Aeson.object+ [ "module" .= complModule+ , "identifier" .= complIdentifier+ , "type" .= complType+ , "expandedType" .= complExpandedType+ , "definedAt" .= complLocation+ , "documentation" .= complDocumentation+ , "exportedFrom" .= map P.runModuleName complExportedFrom+ , "declarationType" .= complDeclarationType+ ]++identifierFromDeclarationRef :: P.DeclarationRef -> Text+identifierFromDeclarationRef = \case+ P.TypeRef _ name _ -> P.runProperName name+ P.ValueRef _ ident -> P.runIdent ident+ P.TypeClassRef _ name -> P.runProperName name+ P.ValueOpRef _ op -> P.showOp op+ P.TypeOpRef _ op -> P.showOp op+ _ -> ""++declarationType :: IdeDeclaration -> DeclarationType+declarationType decl = case decl of+ IdeDeclValue _ -> Value+ IdeDeclType _ -> Type+ IdeDeclTypeSynonym _ -> Synonym+ IdeDeclDataConstructor _ -> DataConstructor+ IdeDeclTypeClass _ -> TypeClass+ IdeDeclValueOperator _ -> ValueOperator+ IdeDeclTypeOperator _ -> TypeOperator+ IdeDeclModule _ -> Module+data Success =+ CompletionResult [Completion]+ | TextResult Text+ | UsagesResult [P.SourceSpan]+ | MultilineTextResult [Text]+ | ImportList (P.ModuleName, [(P.ModuleName, P.ImportDeclarationType, Maybe P.ModuleName)])+ | ModuleList [ModuleIdent]+ | RebuildSuccess P.MultipleErrors+ deriving (Show)++encodeSuccess :: ToJSON a => a -> Aeson.Value+encodeSuccess res =+ Aeson.object ["resultType" .= ("success" :: Text), "result" .= res]++instance ToJSON Success where+ toJSON = \case+ CompletionResult cs -> encodeSuccess cs+ TextResult t -> encodeSuccess t+ UsagesResult ssp -> encodeSuccess ssp+ MultilineTextResult ts -> encodeSuccess ts+ ImportList (moduleName, imports) ->+ Aeson.object+ [ "resultType" .= ("success" :: Text)+ , "result" .= Aeson.object+ [ "imports" .= map encodeImport imports+ , "moduleName" .= P.runModuleName moduleName+ ]+ ]+ ModuleList modules -> encodeSuccess modules+ RebuildSuccess warnings -> encodeSuccess (P.toJSONErrors False P.Warning [] warnings)++encodeImport :: (P.ModuleName, P.ImportDeclarationType, Maybe P.ModuleName) -> Aeson.Value+encodeImport (P.runModuleName -> mn, importType, map P.runModuleName -> qualifier) = case importType of+ P.Implicit ->+ Aeson.object $+ [ "module" .= mn+ , "importType" .= ("implicit" :: Text)+ ] ++ map ("qualifier" .=) (maybeToList qualifier)+ P.Explicit refs ->+ Aeson.object $+ [ "module" .= mn+ , "importType" .= ("explicit" :: Text)+ , "identifiers" .= (identifierFromDeclarationRef <$> refs)+ ] ++ map ("qualifier" .=) (maybeToList qualifier)+ P.Hiding refs ->+ Aeson.object $+ [ "module" .= mn+ , "importType" .= ("hiding" :: Text)+ , "identifiers" .= (identifierFromDeclarationRef <$> refs)+ ] ++ map ("qualifier" .=) (maybeToList qualifier)++-- | Denotes the different namespaces a name in PureScript can reside in.+data IdeNamespace = IdeNSValue | IdeNSType | IdeNSModule+ deriving (Show, Eq, Ord, Generic, NFData)++instance FromJSON IdeNamespace where+ parseJSON = Aeson.withText "Namespace" $ \case+ "value" -> pure IdeNSValue+ "type" -> pure IdeNSType+ "module" -> pure IdeNSModule+ s -> fail ("Unknown namespace: " <> show s)++-- | A name tagged with a namespace+data IdeNamespaced = IdeNamespaced IdeNamespace Text+ deriving (Show, Eq, Ord, Generic, NFData)
+ src/Language/PureScript/Ide/Usage.hs view
@@ -0,0 +1,161 @@+module Language.PureScript.Ide.Usage+ ( findReexportingModules+ , directDependants+ , eligibleModules+ , applySearch+ , findUsages+ ) where++import Protolude hiding (moduleName)++import Control.Lens (preview)+import Data.Map qualified as Map+import Data.Set qualified as Set+import Language.PureScript qualified as P+import Language.PureScript.Ide.State (getAllModules, getFileState)+import Language.PureScript.Ide.Types+import Language.PureScript.Ide.Util (identifierFromIdeDeclaration, namespaceForDeclaration)++-- |+-- How we find usages, given an IdeDeclaration and the module it was defined in:+--+-- 1. Find all modules that reexport the given declaration+-- 2. Find all modules that import from those modules, and while traversing the+-- imports build a specification for how the identifier can be found in the+-- module.+-- 3. Apply the collected search specifications and collect the results+findUsages+ :: Ide m+ => IdeDeclaration+ -> P.ModuleName+ -> m (ModuleMap (NonEmpty P.SourceSpan))+findUsages declaration moduleName = do+ ms <- getAllModules Nothing+ asts <- Map.map fst . fsModules <$> getFileState+ let elig = eligibleModules (moduleName, declaration) ms asts+ pure+ $ Map.mapMaybe nonEmpty+ $ Map.mapWithKey (\mn searches ->+ foldMap (\m -> foldMap (applySearch m) searches) (Map.lookup mn asts)) elig++-- | A declaration can either be imported qualified, or unqualified. All the+-- information we need to find usages through a Traversal is thus captured in+-- the `Search` type.+type Search = P.Qualified IdeDeclaration++findReexportingModules+ :: (P.ModuleName, IdeDeclaration)+ -- ^ The declaration and the module it is defined in for which we are+ -- searching usages+ -> ModuleMap [IdeDeclarationAnn]+ -- ^ Our declaration cache. Needs to have reexports resolved+ -> [P.ModuleName]+ -- ^ All the modules that reexport the declaration. This does NOT include+ -- the defining module+findReexportingModules (moduleName, declaration) decls =+ Map.keys (Map.filter (any hasReexport) decls)+ where+ hasReexport d =+ (d & _idaDeclaration & identifierFromIdeDeclaration) == identifierFromIdeDeclaration declaration+ && (d & _idaAnnotation & _annExportedFrom) == Just moduleName+ && (d & _idaDeclaration & namespaceForDeclaration) == namespaceForDeclaration declaration++directDependants :: IdeDeclaration -> ModuleMap P.Module -> P.ModuleName -> ModuleMap (NonEmpty Search)+directDependants declaration modules mn = Map.mapMaybe (nonEmpty . go) modules+ where+ go :: P.Module -> [Search]+ go = foldMap isImporting . P.getModuleDeclarations++ isImporting d = case d of+ P.ImportDeclaration _ mn' it qual | mn == mn' -> P.Qualified (P.byMaybeModuleName qual) <$> case it of+ P.Implicit -> pure declaration+ P.Explicit refs+ | any (declaration `matchesRef`) refs -> pure declaration+ P.Explicit _ -> []+ P.Hiding refs+ | not (any (declaration `matchesRef`) refs) -> pure declaration+ P.Hiding _ -> []+ _ -> []++-- | Determines whether an IdeDeclaration is referenced by a DeclarationRef.+--+-- TODO(Christoph): We should also extract the spans of matching refs here,+-- since they also count as a usage (at least for rename refactorings)+matchesRef :: IdeDeclaration -> P.DeclarationRef -> Bool+matchesRef declaration ref = case declaration of+ IdeDeclValue valueDecl -> case ref of+ P.ValueRef _ i -> i == _ideValueIdent valueDecl+ _ -> False+ IdeDeclType typeDecl -> case ref of+ P.TypeRef _ tn _ -> tn == _ideTypeName typeDecl+ _ -> False+ IdeDeclTypeSynonym synonym -> case ref of+ P.TypeRef _ tn _ -> tn == _ideSynonymName synonym+ _ -> False+ IdeDeclDataConstructor dtor -> case ref of+ P.TypeRef _ tn dtors+ -- We check if the given data constructor constructs the type imported+ -- here.+ -- This way we match `Just` with an import like `import Data.Maybe (Maybe(..))`+ | _ideDtorTypeName dtor == tn ->+ maybe True (elem (_ideDtorName dtor)) dtors+ _ -> False+ IdeDeclTypeClass typeClass -> case ref of+ P.TypeClassRef _ name -> name == _ideTCName typeClass+ _ -> False+ IdeDeclValueOperator valueOperator -> case ref of+ P.ValueOpRef _ opName -> opName == _ideValueOpName valueOperator+ _ -> False+ IdeDeclTypeOperator typeOperator -> case ref of+ P.TypeOpRef _ opName -> opName == _ideTypeOpName typeOperator+ _ -> False+ IdeDeclModule m -> case ref of+ P.ModuleRef _ mn -> m == mn+ _ -> False++eligibleModules+ :: (P.ModuleName, IdeDeclaration)+ -> ModuleMap [IdeDeclarationAnn]+ -> ModuleMap P.Module+ -> ModuleMap (NonEmpty Search)+eligibleModules query@(moduleName, declaration) decls modules =+ let+ searchDefiningModule = P.Qualified P.ByNullSourcePos declaration :| []+ in+ Map.insert moduleName searchDefiningModule $+ foldMap (directDependants declaration modules) (moduleName :| findReexportingModules query decls)++-- | Finds all usages for a given `Search` throughout a module+applySearch :: P.Module -> Search -> [P.SourceSpan]+applySearch module_ search =+ foldMap findUsageInDeclaration decls+ where+ decls = P.getModuleDeclarations module_+ findUsageInDeclaration =+ let+ (extr, _, _, _, _) = P.everythingWithScope mempty goExpr goBinder mempty mempty+ in+ extr mempty++ goExpr scope expr = case expr of+ P.Var sp i+ | Just ideValue <- preview _IdeDeclValue (P.disqualify search)+ , P.isQualified search+ || not (P.LocalIdent (_ideValueIdent ideValue) `Set.member` scope) ->+ [sp | map P.runIdent i == map identifierFromIdeDeclaration search]+ P.Constructor sp name+ | Just ideDtor <- traverse (preview _IdeDeclDataConstructor) search ->+ [sp | name == map _ideDtorName ideDtor]+ P.Op sp opName+ | Just ideOp <- traverse (preview _IdeDeclValueOperator) search ->+ [sp | opName == map _ideValueOpName ideOp]+ _ -> []++ goBinder _ binder = case binder of+ P.ConstructorBinder sp ctorName _+ | Just ideDtor <- traverse (preview _IdeDeclDataConstructor) search ->+ [sp | ctorName == map _ideDtorName ideDtor]+ P.OpBinder sp opName+ | Just op <- traverse (preview _IdeDeclValueOperator) search ->+ [sp | opName == map _ideValueOpName op]+ _ -> []
+ src/Language/PureScript/Ide/Util.hs view
@@ -0,0 +1,125 @@+-----------------------------------------------------------------------------+--+-- Module : Language.PureScript.Ide.Util+-- Description : Generally useful functions and conversions+-- Copyright : Christoph Hegemann 2016+-- License : MIT (http://opensource.org/licenses/MIT)+--+-- Maintainer : Christoph Hegemann <christoph.hegemann1337@gmail.com>+-- Stability : experimental+--+-- |+-- Generally useful functions+-----------------------------------------------------------------------------++module Language.PureScript.Ide.Util+ ( identifierFromIdeDeclaration+ , unwrapMatch+ , namespaceForDeclaration+ , encodeT+ , decodeT+ , discardAnn+ , withEmptyAnn+ , valueOperatorAliasT+ , typeOperatorAliasT+ , properNameT+ , identT+ , opNameT+ , ideReadFile+ , module Language.PureScript.Ide.Logging+ ) where++import Protolude hiding (decodeUtf8,+ encodeUtf8, to)++import Control.Lens (Getting, to, (^.))+import Data.Aeson (FromJSON, ToJSON, eitherDecode, encode)+import Data.Text qualified as T+import Data.Text.Lazy qualified as TL+import Data.Text.Lazy.Encoding as TLE+import Language.PureScript qualified as P+import Language.PureScript.Ide.Error (IdeError(..))+import Language.PureScript.Ide.Logging+import Language.PureScript.Ide.Types (IdeDeclaration(..), IdeDeclarationAnn(..), IdeNamespace(..), Match(..), emptyAnn, ideDtorName, ideSynonymName, ideTCName, ideTypeName, ideTypeOpName, ideValueIdent, ideValueOpName)+import System.IO.UTF8 (readUTF8FileT)+import System.Directory (makeAbsolute)++identifierFromIdeDeclaration :: IdeDeclaration -> Text+identifierFromIdeDeclaration d = case d of+ IdeDeclValue v -> v ^. ideValueIdent . identT+ IdeDeclType t -> t ^. ideTypeName . properNameT+ IdeDeclTypeSynonym s -> s ^. ideSynonymName . properNameT+ IdeDeclDataConstructor dtor -> dtor ^. ideDtorName . properNameT+ IdeDeclTypeClass tc -> tc ^. ideTCName . properNameT+ IdeDeclValueOperator op -> op ^. ideValueOpName & P.runOpName+ IdeDeclTypeOperator op -> op ^. ideTypeOpName & P.runOpName+ IdeDeclModule name -> P.runModuleName name++namespaceForDeclaration :: IdeDeclaration -> IdeNamespace+namespaceForDeclaration d = case d of+ IdeDeclValue _ -> IdeNSValue+ IdeDeclType _ -> IdeNSType+ IdeDeclTypeSynonym _ -> IdeNSType+ IdeDeclDataConstructor _ -> IdeNSValue+ IdeDeclTypeClass _ -> IdeNSType+ IdeDeclValueOperator _ -> IdeNSValue+ IdeDeclTypeOperator _ -> IdeNSType+ IdeDeclModule _ -> IdeNSModule++discardAnn :: IdeDeclarationAnn -> IdeDeclaration+discardAnn (IdeDeclarationAnn _ d) = d++withEmptyAnn :: IdeDeclaration -> IdeDeclarationAnn+withEmptyAnn = IdeDeclarationAnn emptyAnn++unwrapMatch :: Match a -> a+unwrapMatch (Match (_, ed)) = ed++valueOperatorAliasT+ :: P.Qualified (Either P.Ident (P.ProperName 'P.ConstructorName)) -> Text+valueOperatorAliasT =+ P.showQualified $ either P.runIdent P.runProperName++typeOperatorAliasT+ :: P.Qualified (P.ProperName 'P.TypeName) -> Text+typeOperatorAliasT =+ P.showQualified P.runProperName++encodeT :: (ToJSON a) => a -> Text+encodeT = TL.toStrict . TLE.decodeUtf8 . encode++decodeT :: (FromJSON a) => Text -> Either Text a+decodeT = first T.pack . eitherDecode . TLE.encodeUtf8 . TL.fromStrict++properNameT :: Getting r (P.ProperName a) Text+properNameT = to P.runProperName++identT :: Getting r P.Ident Text+identT = to P.runIdent++opNameT :: Getting r (P.OpName a) Text+opNameT = to P.runOpName++ideReadFile'+ :: (MonadIO m, MonadError IdeError m)+ => (FilePath -> IO Text)+ -> FilePath+ -> m (FilePath, Text)+ideReadFile' fileReader fp = do+ absPath <- liftIO (try (makeAbsolute fp)) >>= \case+ Left (err :: IOException) ->+ throwError+ (GeneralError+ ("Couldn't resolve path for: " <> show fp <> ", Error: " <> show err))+ Right absPath -> pure absPath+ contents <- liftIO (try (fileReader absPath)) >>= \case+ Left (err :: IOException) ->+ throwError+ (GeneralError+ ("Couldn't find file at: " <> show absPath <> ", Error: " <> show err))+ Right contents ->+ pure contents+ pure (absPath, contents)++ideReadFile :: (MonadIO m, MonadError IdeError m) => FilePath -> m (FilePath, Text)+ideReadFile = ideReadFile' readUTF8FileT
+ src/Language/PureScript/Interactive.hs view
@@ -0,0 +1,363 @@+{-# LANGUAGE DoAndIfThenElse #-}++module Language.PureScript.Interactive+ ( handleCommand+ , module Interactive++ -- TODO: remove these exports+ , make+ , runMake+ ) where++import Prelude+import Protolude (ordNub)++import Data.List (sort, find, foldl')+import Data.Maybe (fromMaybe, mapMaybe)+import Data.Map qualified as M+import Data.Set qualified as S+import Data.Text (Text)+import Data.Text qualified as T++import Control.Monad.IO.Class (MonadIO, liftIO)+import Control.Monad.State.Class (MonadState(..), gets, modify)+import Control.Monad.Reader.Class (MonadReader, asks)+import Control.Monad.Trans.Except (ExceptT(..), runExceptT)+import Control.Monad.Trans.State.Strict (StateT, runStateT, evalStateT)+import Control.Monad.Writer.Strict (Writer(), runWriter)++import Language.PureScript qualified as P+import Language.PureScript.CST qualified as CST+import Language.PureScript.Names qualified as N+import Language.PureScript.Constants.Prim qualified as C++import Language.PureScript.Interactive.Completion as Interactive+import Language.PureScript.Interactive.IO as Interactive+import Language.PureScript.Interactive.Message as Interactive+import Language.PureScript.Interactive.Module as Interactive+import Language.PureScript.Interactive.Parser as Interactive+import Language.PureScript.Interactive.Printer as Interactive+import Language.PureScript.Interactive.Types as Interactive++import System.Directory (getCurrentDirectory)+import System.FilePath ((</>))+import System.FilePath.Glob (glob)++-- | Pretty-print errors+printErrors :: MonadIO m => P.MultipleErrors -> m ()+printErrors errs = liftIO $ do+ pwd <- getCurrentDirectory+ putStrLn $ P.prettyPrintMultipleErrors P.defaultPPEOptions {P.ppeRelativeDirectory = pwd} errs++-- | This is different than the runMake in 'Language.PureScript.Make' in that it specifies the+-- options and ignores the warning messages.+runMake :: P.Make a -> IO (Either P.MultipleErrors a)+runMake mk = fst <$> P.runMake P.defaultOptions mk++-- | Rebuild a module, using the cached externs data for dependencies.+rebuild+ :: [P.ExternsFile]+ -> P.Module+ -> P.Make (P.ExternsFile, P.Environment)+rebuild loadedExterns m = do+ externs <- P.rebuildModule buildActions loadedExterns m+ return (externs, foldl' (flip P.applyExternsFileToEnvironment) P.initEnvironment (loadedExterns ++ [externs]))+ where+ buildActions :: P.MakeActions P.Make+ buildActions =+ (P.buildMakeActions modulesDir+ filePathMap+ M.empty+ False) { P.progress = const (return ()) }++ filePathMap :: M.Map P.ModuleName (Either P.RebuildPolicy FilePath)+ filePathMap = M.singleton (P.getModuleName m) (Left P.RebuildAlways)++-- | Build the collection of modules from scratch. This is usually done on startup.+make+ :: [(FilePath, CST.PartialResult P.Module)]+ -> P.Make ([P.ExternsFile], P.Environment)+make ms = do+ foreignFiles <- P.inferForeignModules filePathMap+ externs <- P.make (buildActions foreignFiles) (map snd ms)+ return (externs, foldl' (flip P.applyExternsFileToEnvironment) P.initEnvironment externs)+ where+ buildActions :: M.Map P.ModuleName FilePath -> P.MakeActions P.Make+ buildActions foreignFiles =+ P.buildMakeActions modulesDir+ filePathMap+ foreignFiles+ False++ filePathMap :: M.Map P.ModuleName (Either P.RebuildPolicy FilePath)+ filePathMap = M.fromList $ map (\(fp, m) -> (P.getModuleName $ CST.resPartial m, Right fp)) ms++-- | Performs a PSCi command+handleCommand+ :: (MonadReader PSCiConfig m, MonadState PSCiState m, MonadIO m)+ => (String -> m ()) -- ^ evaluate JS+ -> m () -- ^ reload+ -> (String -> m ()) -- ^ print into console+ -> Command+ -> m ()+handleCommand _ _ p ShowHelp = p helpMessage+handleCommand _ r _ ReloadState = handleReloadState r+handleCommand _ r _ ClearState = handleClearState r+handleCommand e _ _ (Expression val) = handleExpression e val+handleCommand _ _ _ (Import im) = handleImport im+handleCommand _ _ _ (Decls l) = handleDecls l+handleCommand _ _ p (TypeOf val) = handleTypeOf p val+handleCommand _ _ p (KindOf typ) = handleKindOf p typ+handleCommand _ _ p (BrowseModule moduleName) = handleBrowse p moduleName+handleCommand _ _ p (ShowInfo QueryLoaded) = handleShowLoadedModules p+handleCommand _ _ p (ShowInfo QueryImport) = handleShowImportedModules p+handleCommand _ _ p (ShowInfo QueryPrint) = handleShowPrint p+handleCommand _ _ p (CompleteStr prefix) = handleComplete p prefix+handleCommand _ _ p (SetInteractivePrint ip) = handleSetInteractivePrint p ip+handleCommand _ _ _ _ = P.internalError "handleCommand: unexpected command"++-- | Reload the application state+handleReloadState+ :: (MonadReader PSCiConfig m, MonadState PSCiState m, MonadIO m)+ => m ()+ -> m ()+handleReloadState reload = do+ modify $ updateLets (const [])+ globs <- asks psciFileGlobs+ files <- liftIO $ concat <$> traverse glob globs+ e <- runExceptT $ do+ modules <- ExceptT . liftIO $ loadAllModules files+ (externs, _) <- ExceptT . liftIO . runMake . make $ fmap CST.pureResult <$> modules+ return (map snd modules, externs)+ case e of+ Left errs -> printErrors errs+ Right (modules, externs) -> do+ modify (updateLoadedExterns (const (zip modules externs)))+ reload++-- | Clear the application state+handleClearState+ :: (MonadReader PSCiConfig m, MonadState PSCiState m, MonadIO m)+ => m ()+ -> m ()+handleClearState reload = do+ modify $ updateImportedModules (const [])+ handleReloadState reload++-- | Takes a value expression and evaluates it with the current state.+handleExpression+ :: (MonadReader PSCiConfig m, MonadState PSCiState m, MonadIO m)+ => (String -> m ())+ -> P.Expr+ -> m ()+handleExpression evaluate val = do+ st <- get+ let m = createTemporaryModule True st val+ e <- liftIO . runMake $ rebuild (map snd (psciLoadedExterns st)) m+ case e of+ Left errs -> printErrors errs+ Right _ -> do+ js <- liftIO $ readFile (modulesDir </> "$PSCI" </> "index.js")+ evaluate js++-- |+-- Takes a list of declarations and updates the environment, then run a make. If the declaration fails,+-- restore the original environment.+--+handleDecls+ :: (MonadReader PSCiConfig m, MonadState PSCiState m, MonadIO m)+ => [P.Declaration]+ -> m ()+handleDecls ds = do+ st <- gets (updateLets (++ ds))+ let m = createTemporaryModule False st (P.Literal P.nullSourceSpan (P.ObjectLiteral []))+ e <- liftIO . runMake $ rebuild (map snd (psciLoadedExterns st)) m+ case e of+ Left err -> printErrors err+ Right _ -> put st++-- | Show actual loaded modules in psci.+handleShowLoadedModules+ :: MonadState PSCiState m+ => (String -> m ())+ -> m ()+handleShowLoadedModules print' = do+ loadedModules <- gets psciLoadedExterns+ print' $ readModules loadedModules+ where+ readModules = unlines . sort . ordNub . map (T.unpack . P.runModuleName . P.getModuleName . fst)++-- | Show the imported modules in psci.+handleShowImportedModules+ :: MonadState PSCiState m+ => (String -> m ())+ -> m ()+handleShowImportedModules print' = do+ importedModules <- psciImportedModules <$> get+ print' $ showModules importedModules+ where+ showModules = unlines . sort . map (T.unpack . showModule)+ showModule (mn, declType, asQ) =+ "import " <> N.runModuleName mn <> showDeclType declType <>+ foldMap (\mn' -> " as " <> N.runModuleName mn') asQ++ showDeclType P.Implicit = ""+ showDeclType (P.Explicit refs) = refsList refs+ showDeclType (P.Hiding refs) = " hiding " <> refsList refs+ refsList refs = " (" <> commaList (mapMaybe showRef refs) <> ")"++ showRef :: P.DeclarationRef -> Maybe Text+ showRef (P.TypeRef _ pn dctors) =+ Just $ N.runProperName pn <> "(" <> maybe ".." (commaList . map N.runProperName) dctors <> ")"+ showRef (P.TypeOpRef _ op) =+ Just $ "type " <> N.showOp op+ showRef (P.ValueRef _ ident) =+ Just $ N.runIdent ident+ showRef (P.ValueOpRef _ op) =+ Just $ N.showOp op+ showRef (P.TypeClassRef _ pn) =+ Just $ "class " <> N.runProperName pn+ showRef (P.TypeInstanceRef _ ident P.UserNamed) =+ Just $ N.runIdent ident+ showRef (P.TypeInstanceRef _ _ P.CompilerNamed) =+ Nothing+ showRef (P.ModuleRef _ name) =+ Just $ "module " <> N.runModuleName name+ showRef (P.ReExportRef _ _ _) =+ Nothing++ commaList :: [Text] -> Text+ commaList = T.intercalate ", "++handleShowPrint+ :: MonadState PSCiState m+ => (String -> m ())+ -> m ()+handleShowPrint print' = do+ current <- psciInteractivePrint <$> get+ if current == initialInteractivePrint+ then+ print' $+ "The interactive print function is currently set to the default (`" ++ showPrint current ++ "`)"+ else+ print' $+ "The interactive print function is currently set to `" ++ showPrint current ++ "`\n" +++ "The default can be restored with `:print " ++ showPrint initialInteractivePrint ++ "`"++ where+ showPrint (mn, ident) = T.unpack (N.runModuleName mn <> "." <> N.runIdent ident)++-- | Imports a module, preserving the initial state on failure.+handleImport+ :: (MonadReader PSCiConfig m, MonadState PSCiState m, MonadIO m)+ => ImportedModule+ -> m ()+handleImport im = do+ st <- gets (updateImportedModules (im :))+ let m = createTemporaryModuleForImports st+ e <- liftIO . runMake $ rebuild (map snd (psciLoadedExterns st)) m+ case e of+ Left errs -> printErrors errs+ Right _ -> put st++-- | Takes a value and prints its type+handleTypeOf+ :: (MonadReader PSCiConfig m, MonadState PSCiState m, MonadIO m)+ => (String -> m ())+ -> P.Expr+ -> m ()+handleTypeOf print' val = do+ st <- get+ let m = createTemporaryModule False st val+ e <- liftIO . runMake $ rebuild (map snd (psciLoadedExterns st)) m+ case e of+ Left errs -> printErrors errs+ Right (_, env') ->+ case M.lookup (P.mkQualified (P.Ident "it") (P.ModuleName "$PSCI")) (P.names env') of+ Just (ty, _, _) -> print' . P.prettyPrintType maxBound $ ty+ Nothing -> print' "Could not find type"++-- | Takes a type and prints its kind+handleKindOf+ :: (MonadReader PSCiConfig m, MonadState PSCiState m, MonadIO m)+ => (String -> m ())+ -> P.SourceType+ -> m ()+handleKindOf print' typ = do+ st <- get+ let m = createTemporaryModuleForKind st typ+ mName = P.ModuleName "$PSCI"+ e <- liftIO . runMake $ rebuild (map snd (psciLoadedExterns st)) m+ case e of+ Left errs -> printErrors errs+ Right (_, env') ->+ case M.lookup (P.Qualified (P.ByModuleName mName) $ P.ProperName "IT") (P.typeSynonyms env') of+ Just (_, typ') -> do+ let chk = (P.emptyCheckState env') { P.checkCurrentModule = Just mName }+ k = check (snd <$> P.kindOf typ') chk++ check :: StateT P.CheckState (ExceptT P.MultipleErrors (Writer P.MultipleErrors)) a -> P.CheckState -> Either P.MultipleErrors (a, P.CheckState)+ check sew = fst . runWriter . runExceptT . runStateT sew+ case k of+ Left err -> printErrors err+ Right (kind, _) -> print' . P.prettyPrintType 1024 $ kind+ Nothing -> print' "Could not find kind"++-- | Browse a module and displays its signature+handleBrowse+ :: (MonadReader PSCiConfig m, MonadState PSCiState m)+ => (String -> m ())+ -> P.ModuleName+ -> m ()+handleBrowse print' moduleName = do+ st <- get+ let env = psciEnvironment st+ case findMod moduleName (psciLoadedExterns st) (psciImportedModules st) of+ Just qualName -> print' $ printModuleSignatures qualName env+ Nothing -> failNotInEnv moduleName+ where+ findMod needle externs imports =+ let qualMod = fromMaybe needle (lookupUnQualifiedModName needle imports)+ modules = S.fromList (C.primModules <> (P.getModuleName . fst <$> externs))+ in if qualMod `S.member` modules+ then Just qualMod+ else Nothing++ failNotInEnv modName = print' $ T.unpack $ "Module '" <> N.runModuleName modName <> "' is not valid."+ lookupUnQualifiedModName needle imports =+ (\(modName,_,_) -> modName) <$> find (\(_,_,mayQuaName) -> mayQuaName == Just needle) imports++-- | Return output as would be returned by tab completion, for tools integration etc.+handleComplete+ :: (MonadState PSCiState m, MonadIO m)+ => (String -> m ())+ -> String+ -> m ()+handleComplete print' prefix = do+ st <- get+ let act = liftCompletionM (completion' (reverse prefix, ""))+ results <- evalStateT act st+ print' $ unlines (formatCompletions results)++-- | Attempt to set the interactive print function. Note that the state will+-- only be updated if the interactive print function exists and appears to+-- work; we test it by attempting to evaluate '0'.+handleSetInteractivePrint+ :: (MonadState PSCiState m, MonadIO m)+ => (String -> m ())+ -> (P.ModuleName, P.Ident)+ -> m ()+handleSetInteractivePrint print' new = do+ current <- gets psciInteractivePrint+ modify (setInteractivePrint new)+ st <- get+ let expr = P.Literal internalSpan (P.NumericLiteral (Left 0))+ let m = createTemporaryModule True st expr+ e <- liftIO . runMake $ rebuild (map snd (psciLoadedExterns st)) m+ case e of+ Left errs -> do+ modify (setInteractivePrint current)+ print' "Unable to set the repl's printing function:"+ printErrors errs+ Right _ ->+ pure ()
+ src/Language/PureScript/Interactive/Completion.hs view
@@ -0,0 +1,193 @@+module Language.PureScript.Interactive.Completion+ ( CompletionM+ , liftCompletionM+ , completion+ , completion'+ , formatCompletions+ ) where++import Prelude+import Protolude (ordNub)++import Control.Monad.IO.Class (MonadIO(..))+import Control.Monad.State.Class (MonadState(..))+import Control.Monad.Trans.Reader (asks, runReaderT, ReaderT)+import Data.List (nub, isPrefixOf, isInfixOf, isSuffixOf, sortBy, stripPrefix)+import Data.Map (keys)+import Data.Maybe (mapMaybe)+import Data.Text qualified as T+import Language.PureScript qualified as P+import Language.PureScript.Interactive.Directive qualified as D+import Language.PureScript.Interactive.Types (Directive(..), PSCiState, psciExports, psciImports, psciLoadedExterns, replQueryStrings)+import System.Console.Haskeline (Completion(..), CompletionFunc, completeWordWithPrev, listFiles, simpleCompletion)++-- Completions may read the state, but not modify it.+type CompletionM = ReaderT PSCiState IO++-- Lift a `CompletionM` action into a state monad.+liftCompletionM+ :: (MonadState PSCiState m, MonadIO m)+ => CompletionM a+ -> m a+liftCompletionM act = do+ st <- get+ liftIO $ runReaderT act st++-- Haskeline completions++-- | Loads module, function, and file completions.+completion+ :: (MonadState PSCiState m, MonadIO m)+ => CompletionFunc m+completion = liftCompletionM . completion'++completion' :: CompletionFunc CompletionM+completion' = completeWordWithPrev Nothing " \t\n\r([" findCompletions++-- | Callback for Haskeline's `completeWordWithPrev`.+-- Expects:+-- * Line contents to the left of the word, reversed+-- * Word to be completed+findCompletions :: String -> String -> CompletionM [Completion]+findCompletions prev word = do+ let ctx = completionContext (words (reverse prev)) word+ completions <- concat <$> traverse getCompletions ctx+ return $ sortBy directivesFirst completions+ where+ getCompletions :: CompletionContext -> CompletionM [Completion]+ getCompletions = fmap (mapMaybe (either (prefixedBy word) Just)) . getCompletion++ getCompletion :: CompletionContext -> CompletionM [Either String Completion]+ getCompletion ctx =+ case ctx of+ CtxFilePath f -> map Right <$> listFiles f+ CtxModule -> map Left <$> getModuleNames+ CtxIdentifier -> map Left <$> ((++) <$> getIdentNames <*> getDctorNames)+ CtxType pre -> map (Left . (pre ++)) <$> getTypeNames+ CtxFixed str -> return [Left str]+ CtxDirective d -> return (map Left (completeDirectives d))++ completeDirectives :: String -> [String]+ completeDirectives = map (':' :) . D.directiveStringsFor++ prefixedBy :: String -> String -> Maybe Completion+ prefixedBy w cand = if w `isPrefixOf` cand+ then Just (simpleCompletion cand)+ else Nothing++ directivesFirst :: Completion -> Completion -> Ordering+ directivesFirst (Completion _ d1 _) (Completion _ d2 _) = go d1 d2+ where+ go (':' : xs) (':' : ys) = compare xs ys+ go (':' : _) _ = LT+ go _ (':' : _) = GT+ go xs ys = compare xs ys++-- |+-- Convert Haskeline completion result to results as they would be displayed+formatCompletions :: (String, [Completion]) -> [String]+formatCompletions (unusedR, completions) = actuals+ where+ unused = reverse unusedR+ actuals = map ((unused ++) . replacement) completions++data CompletionContext+ = CtxDirective String+ | CtxFilePath String+ | CtxModule+ | CtxIdentifier+ | CtxType String+ | CtxFixed String+ deriving (Show)++-- |+-- Decide what kind of completion we need based on input. This function expects+-- a list of complete words (to the left of the cursor) as the first argument,+-- and the current word as the second argument.+completionContext :: [String] -> String -> [CompletionContext]+completionContext _ w | "::" `isInfixOf` w = [CtxType (w `endingWith` "::")]+completionContext ws _ | lastSatisfies ("::" `isSuffixOf`) ws = [CtxType ""]+completionContext [] _ = [CtxDirective "", CtxIdentifier, CtxFixed "import"]+completionContext ws w | headSatisfies (":" `isPrefixOf`) ws = completeDirective ws w+completionContext ws w | headSatisfies (== "import") ws = completeImport ws w+completionContext _ _ = [CtxIdentifier]++endingWith :: String -> String -> String+endingWith str stop = aux "" str+ where+ aux acc s@(x:xs)+ | stop `isPrefixOf` s = reverse (stop ++ acc)+ | otherwise = aux (x:acc) xs+ aux acc [] = reverse (stop ++ acc)++completeDirective :: [String] -> String -> [CompletionContext]+completeDirective ws w =+ case ws of+ [] -> [CtxDirective w]+ (x:xs) -> case D.directivesFor <$> stripPrefix ":" x of+ -- only offer completions if the directive is unambiguous+ Just [dir] -> directiveArg xs dir+ _ -> []++directiveArg :: [String] -> Directive -> [CompletionContext]+directiveArg [] Browse = [CtxModule] -- only complete very next term+directiveArg [] Show = map CtxFixed replQueryStrings -- only complete very next term+directiveArg _ Type = [CtxIdentifier]+directiveArg _ Kind = [CtxType ""]+directiveArg _ _ = []++completeImport :: [String] -> String -> [CompletionContext]+completeImport ws w' =+ case (ws, w') of+ (["import"], _) -> [CtxModule]+ _ -> []++headSatisfies :: (a -> Bool) -> [a] -> Bool+headSatisfies p str =+ case str of+ (c:_) -> p c+ _ -> False++lastSatisfies :: (a -> Bool) -> [a] -> Bool+lastSatisfies _ [] = False+lastSatisfies p xs = p (last xs)++getLoadedModules :: CompletionM [P.Module]+getLoadedModules = asks (map fst . psciLoadedExterns)++getModuleNames :: CompletionM [String]+getModuleNames = moduleNames <$> getLoadedModules++getIdentNames :: CompletionM [String]+getIdentNames = do+ importedVals <- asks (keys . P.importedValues . psciImports)+ exportedVals <- asks (keys . P.exportedValues . psciExports)++ importedValOps <- asks (keys . P.importedValueOps . psciImports)+ exportedValOps <- asks (keys . P.exportedValueOps . psciExports)++ return . nub $ map (T.unpack . P.showQualified P.showIdent) importedVals+ ++ map (T.unpack . P.showQualified P.runOpName) importedValOps+ ++ map (T.unpack . P.showIdent) exportedVals+ ++ map (T.unpack . P.runOpName) exportedValOps++getDctorNames :: CompletionM [String]+getDctorNames = do+ imports <- asks (keys . P.importedDataConstructors . psciImports)+ return . nub $ map (T.unpack . P.showQualified P.runProperName) imports++getTypeNames :: CompletionM [String]+getTypeNames = do+ importedTypes <- asks (keys . P.importedTypes . psciImports)+ exportedTypes <- asks (keys . P.exportedTypes . psciExports)++ importedTypeOps <- asks (keys . P.importedTypeOps . psciImports)+ exportedTypeOps <- asks (keys . P.exportedTypeOps . psciExports)++ return . nub $ map (T.unpack . P.showQualified P.runProperName) importedTypes+ ++ map (T.unpack . P.showQualified P.runOpName) importedTypeOps+ ++ map (T.unpack . P.runProperName) exportedTypes+ ++ map (T.unpack . P.runOpName) exportedTypeOps++moduleNames :: [P.Module] -> [String]+moduleNames = ordNub . map (T.unpack . P.runModuleName . P.getModuleName)
+ src/Language/PureScript/Interactive/Directive.hs view
@@ -0,0 +1,87 @@+-- |+-- Directives for PSCI.+--+module Language.PureScript.Interactive.Directive where++import Prelude++import Data.Maybe (fromJust)+import Data.List (isPrefixOf)+import Data.Tuple (swap)++import Language.PureScript.Interactive.Types (Directive(..))++-- |+-- A mapping of directives to the different strings that can be used to invoke+-- them.+--+directiveStrings :: [(Directive, [String])]+directiveStrings =+ [ (Help , ["?", "help"])+ , (Quit , ["quit"])+ , (Reload , ["reload"])+ , (Clear , ["clear"])+ , (Browse , ["browse"])+ , (Type , ["type"])+ , (Kind , ["kind"])+ , (Show , ["show"])+ , (Paste , ["paste"])+ , (Complete , ["complete"])+ , (Print , ["print"])+ ]++-- |+-- Like directiveStrings, but the other way around.+--+directiveStrings' :: [(String, Directive)]+directiveStrings' = concatMap go directiveStrings+ where+ go (dir, strs) = map (, dir) strs++-- |+-- Returns all possible string representations of a directive.+--+stringsFor :: Directive -> [String]+stringsFor d = fromJust (lookup d directiveStrings)++-- |+-- Returns the default string representation of a directive.+--+stringFor :: Directive -> String+stringFor = head . stringsFor++-- |+-- Returns the list of directives which could be expanded from the string+-- argument, together with the string alias that matched.+--+directivesFor' :: String -> [(Directive, String)]+directivesFor' str = go directiveStrings'+ where+ go = map swap . filter ((str `isPrefixOf`) . fst)++directivesFor :: String -> [Directive]+directivesFor = map fst . directivesFor'++directiveStringsFor :: String -> [String]+directiveStringsFor = map snd . directivesFor'++-- |+-- The help menu.+--+help :: [(Directive, String, String)]+help =+ [ (Help, "", "Show this help menu")+ , (Quit, "", "Quit PSCi")+ , (Reload, "", "Reload all imported modules while discarding bindings")+ , (Clear, "", "Discard all imported modules and declared bindings")+ , (Browse, "<module>", "See all functions in <module>")+ , (Type, "<expr>", "Show the type of <expr>")+ , (Kind, "<type>", "Show the kind of <type>")+ , (Show, "import", "Show all imported modules")+ , (Show, "loaded", "Show all loaded modules")+ , (Show, "print", "Show the repl's current printing function")+ , (Paste, "paste", "Enter multiple lines, terminated by ^D")+ , (Complete, "<prefix>", "Show completions for <prefix> as if pressing tab")+ , (Print, "<fn>", "Set the repl's printing function to <fn> (which must be fully qualified)")+ ]+
+ src/Language/PureScript/Interactive/IO.hs view
@@ -0,0 +1,86 @@+{-# LANGUAGE TypeApplications #-}++module Language.PureScript.Interactive.IO (findNodeProcess, readNodeProcessWithExitCode, getHistoryFilename) where++import Prelude++import Control.Monad (msum, void)+import Control.Monad.Error.Class (throwError)+import Control.Monad.Trans.Class (lift)+import Control.Monad.Trans.Except (ExceptT(..), runExceptT)+import Control.Monad.Trans.Maybe (MaybeT(..), runMaybeT)+import Data.Functor ((<&>))+import Data.List (isInfixOf)+import System.Directory (XdgDirectory (..), createDirectoryIfMissing,+ getAppUserDataDirectory, getXdgDirectory,+ findExecutable, doesFileExist)+import System.Exit (ExitCode(ExitFailure, ExitSuccess))+import System.FilePath (takeDirectory, (</>))+import System.Process (readProcessWithExitCode)+import Text.Parsec ((<?>), many1, parse, sepBy)+import Text.Parsec.Char (char, digit)+import Protolude (note)++mkdirp :: FilePath -> IO ()+mkdirp = createDirectoryIfMissing True . takeDirectory++-- File helpers++onFirstFileMatching :: Monad m => (b -> m (Maybe a)) -> [b] -> m (Maybe a)+onFirstFileMatching f pathVariants = runMaybeT . msum $ map (MaybeT . f) pathVariants++-- |+-- Locates the node executable.+-- Checks for either @nodejs@ or @node@.+--+findNodeProcess :: IO (Either String String)+findNodeProcess = onFirstFileMatching findExecutable ["nodejs", "node"] <&>+ note "Could not find Node.js. Do you have Node.js installed and available in your PATH?"++findNodeVersion :: String -> IO (Maybe String)+findNodeVersion node = do+ result <- readProcessWithExitCode node ["--version"] ""+ return $ case result of+ (ExitSuccess, version, _) -> Just version+ (ExitFailure _, _, _) -> Nothing++readNodeProcessWithExitCode :: Maybe FilePath -> [String] -> String -> IO (Either String (ExitCode, String, String))+readNodeProcessWithExitCode nodePath nodeArgs stdin = runExceptT $ do+ process <- maybe (ExceptT findNodeProcess) pure nodePath+ (major, _, _) <- lift (findNodeVersion process) >>= \case+ Nothing -> throwError "Could not find Node.js version."+ Just version -> do+ let semver = do+ void $ char 'v'+ major : minor : patch : _ <- fmap (read @Int) (many1 digit) `sepBy` void (char '.')+ pure (major, minor, patch)+ case parse (semver <?> "Could not parse Node.js version.") "" version of+ Left err -> throwError $ show err+ Right (major, minor, patch)+ | major < 12 -> throwError $ "Unsupported Node.js version " <> show major <> ". Required Node.js version >=12."+ | otherwise -> pure (major, minor, patch)+ let nodeArgs' = if major < 13 then "--experimental-modules" : nodeArgs else nodeArgs+ lift (readProcessWithExitCode process nodeArgs' stdin) <&> \case+ (ExitSuccess, out, err) ->+ (ExitSuccess, out, censorExperimentalWarnings err)+ (ExitFailure code, out, err) ->+ (ExitFailure code, out, err)++censorExperimentalWarnings :: String -> String+censorExperimentalWarnings =+ unlines . filter (not . ("ExperimentalWarning" `isInfixOf`)) . lines++-- |+-- Grabs the filename where the history is stored.+--+getHistoryFilename :: IO FilePath+getHistoryFilename = do+ appuserdata <- getAppUserDataDirectory "purescript"+ olddirbool <- doesFileExist (appuserdata </> "psci_history")+ if olddirbool+ then return (appuserdata </> "psci_history")+ else do+ datadir <- getXdgDirectory XdgData "purescript"+ let filename = datadir </> "psci_history"+ mkdirp filename+ return filename
+ src/Language/PureScript/Interactive/Message.hs view
@@ -0,0 +1,59 @@+module Language.PureScript.Interactive.Message where++import Prelude++import Data.List (intercalate)+import Data.Version (showVersion)+import Paths_purescript qualified as Paths+import Language.PureScript.Interactive.Directive qualified as D+import Language.PureScript.Interactive.Types (Directive)++-- Messages++-- | The guide URL+guideURL :: String+guideURL = "https://github.com/purescript/documentation/blob/master/guides/PSCi.md"++-- | The help message.+helpMessage :: String+helpMessage = "The following commands are available:\n\n " +++ intercalate "\n " (map line D.help) +++ "\n\n" ++ extraHelp+ where+ line :: (Directive, String, String) -> String+ line (dir, arg, desc) =+ let cmd = ':' : D.stringFor dir+ in unwords [ cmd+ , replicate (11 - length cmd) ' '+ , arg+ , replicate (11 - length arg) ' '+ , desc+ ]++ extraHelp =+ "Further information is available on the PureScript documentation repository:\n" +++ " --> " ++ guideURL++-- | The welcome prologue.+prologueMessage :: String+prologueMessage = unlines+ [ "PSCi, version " ++ showVersion Paths.version+ , "Type :? for help"+ ]++noInputMessage :: String+noInputMessage = unlines+ [ "purs repl: No input files; try running `pulp psci` instead."+ , "For help getting started, visit " ++ guideURL+ , "Usage: For basic information, try the `--help' option."+ ]++supportModuleMessage :: String+supportModuleMessage = unlines+ [ "purs repl: PSCi requires the psci-support package."+ , "For help getting started, visit " ++ guideURL+ ]++-- | The quit message.+quitMessage :: String+quitMessage = "See ya!"
+ src/Language/PureScript/Interactive/Module.hs view
@@ -0,0 +1,95 @@+module Language.PureScript.Interactive.Module where++import Prelude++import Language.PureScript qualified as P+import Language.PureScript.CST qualified as CST+import Language.PureScript.Interactive.Types (ImportedModule, PSCiState, initialInteractivePrint, psciImportedModules, psciInteractivePrint, psciLetBindings)+import System.Directory (getCurrentDirectory)+import System.FilePath (pathSeparator, makeRelative)+import System.IO.UTF8 (readUTF8FilesT)++-- * Support Module++-- | The name of the PSCI support module+supportModuleName :: P.ModuleName+supportModuleName = fst initialInteractivePrint++-- | Checks if the Console module is defined+supportModuleIsDefined :: [P.ModuleName] -> Bool+supportModuleIsDefined = elem supportModuleName++-- * Module Management++-- | Load all modules.+loadAllModules :: [FilePath] -> IO (Either P.MultipleErrors [(FilePath, P.Module)])+loadAllModules files = do+ pwd <- getCurrentDirectory+ filesAndContent <- readUTF8FilesT files+ return $ fmap (fmap snd) <$> CST.parseFromFiles (makeRelative pwd) filesAndContent++-- |+-- Makes a volatile module to execute the current expression.+--+createTemporaryModule :: Bool -> PSCiState -> P.Expr -> P.Module+createTemporaryModule exec st val =+ let+ imports = psciImportedModules st+ lets = psciLetBindings st+ moduleName = P.ModuleName "$PSCI"+ effModuleName = P.ModuleName "Effect"+ effImport = (effModuleName, P.Implicit, Just (P.ModuleName "$Effect"))+ supportImport = (fst (psciInteractivePrint st), P.Implicit, Just (P.ModuleName "$Support"))+ eval = P.Var internalSpan (P.Qualified (P.ByModuleName (P.ModuleName "$Support")) (snd (psciInteractivePrint st)))+ mainValue = P.App eval (P.Var internalSpan (P.Qualified P.ByNullSourcePos (P.Ident "it")))+ itDecl = P.ValueDecl (internalSpan, []) (P.Ident "it") P.Public [] [P.MkUnguarded val]+ typeDecl = P.TypeDeclaration+ (P.TypeDeclarationData (internalSpan, []) (P.Ident "$main")+ (P.srcTypeApp+ (P.srcTypeConstructor+ (P.Qualified (P.ByModuleName (P.ModuleName "$Effect")) (P.ProperName "Effect")))+ P.srcTypeWildcard))+ mainDecl = P.ValueDecl (internalSpan, []) (P.Ident "$main") P.Public [] [P.MkUnguarded mainValue]+ decls = if exec then [itDecl, typeDecl, mainDecl] else [itDecl]+ in+ P.Module internalSpan+ [] moduleName+ ((importDecl `map` (effImport : supportImport : imports)) ++ lets ++ decls)+ Nothing+++-- |+-- Makes a volatile module to hold a non-qualified type synonym for a fully-qualified data type declaration.+--+createTemporaryModuleForKind :: PSCiState -> P.SourceType -> P.Module+createTemporaryModuleForKind st typ =+ let+ imports = psciImportedModules st+ lets = psciLetBindings st+ moduleName = P.ModuleName "$PSCI"+ itDecl = P.TypeSynonymDeclaration (internalSpan, []) (P.ProperName "IT") [] typ+ in+ P.Module internalSpan [] moduleName ((importDecl `map` imports) ++ lets ++ [itDecl]) Nothing++-- |+-- Makes a volatile module to execute the current imports.+--+createTemporaryModuleForImports :: PSCiState -> P.Module+createTemporaryModuleForImports st =+ let+ imports = psciImportedModules st+ moduleName = P.ModuleName "$PSCI"+ in+ P.Module internalSpan [] moduleName (importDecl `map` imports) Nothing++importDecl :: ImportedModule -> P.Declaration+importDecl (mn, declType, asQ) = P.ImportDeclaration (internalSpan, []) mn declType asQ++indexFile :: FilePath+indexFile = ".psci_modules" ++ pathSeparator : "index.js"++modulesDir :: FilePath+modulesDir = ".psci_modules"++internalSpan :: P.SourceSpan+internalSpan = P.internalModuleSourceSpan "<internal>"
+ src/Language/PureScript/Interactive/Parser.hs view
@@ -0,0 +1,147 @@+-- |+-- Parser for PSCI.+--+module Language.PureScript.Interactive.Parser+ ( parseDotFile+ , parseCommand+ ) where++import Prelude++import Control.Monad (join)+import Data.Bifunctor (bimap)+import Data.Char (isSpace)+import Data.List (intercalate)+import Data.List.NonEmpty qualified as NE+import Data.Text qualified as T+import Language.PureScript qualified as P+import Language.PureScript.CST qualified as CST+import Language.PureScript.CST.Monad qualified as CSTM+import Language.PureScript.Interactive.Directive qualified as D+import Language.PureScript.Interactive.Types (Command(..), Directive(..), ReplQuery(..), parseReplQuery, replQueryStrings)++-- |+-- Parses a limited set of commands from from .purs-repl+--+parseDotFile :: FilePath -> String -> Either String [Command]+parseDotFile filePath =+ bimap (CST.prettyPrintError . NE.head) snd+ . CST.runTokenParser (parseMany parser <* CSTM.token CST.TokEof)+ . CST.lexTopLevel+ . T.pack+ where+ parser = CSTM.oneOf $ NE.fromList+ [ psciImport filePath+ , do+ tok <- CSTM.munch+ CSTM.parseFail tok $ CST.ErrCustom "The .purs-repl file only supports import declarations"+ ]++-- |+-- Parses PSCI metacommands or expressions input from the user.+--+parseCommand :: String -> Either String [Command]+parseCommand cmdString =+ case cmdString of+ (':' : cmd) -> pure <$> parseDirective cmd+ _ -> parseRest (mergeDecls <$> parseMany psciCommand) cmdString+ where+ mergeDecls (Decls as : bs) =+ case mergeDecls bs of+ Decls bs' : cs' ->+ Decls (as <> bs') : cs'+ cs' ->+ Decls as : cs'+ mergeDecls (a : bs) =+ a : mergeDecls bs+ mergeDecls [] = []++parseMany :: CST.Parser a -> CST.Parser [a]+parseMany = CSTM.manyDelimited CST.TokLayoutStart CST.TokLayoutEnd CST.TokLayoutSep++parseOne :: CST.Parser a -> CST.Parser a+parseOne p = CSTM.token CST.TokLayoutStart *> p <* CSTM.token CST.TokLayoutEnd++parseRest :: CST.Parser a -> String -> Either String a+parseRest p =+ bimap (CST.prettyPrintError . NE.head) snd+ . CST.runTokenParser (p <* CSTM.token CST.TokEof)+ . CST.lexTopLevel+ . T.pack++psciCommand :: CST.Parser Command+psciCommand =+ CSTM.oneOf $ NE.fromList+ [ psciImport ""+ , psciDeclaration+ , psciExpression+ ]++trim :: String -> String+trim = trimEnd . trimStart++trimStart :: String -> String+trimStart = dropWhile isSpace++trimEnd :: String -> String+trimEnd = reverse . trimStart . reverse++parseDirective :: String -> Either String Command+parseDirective cmd =+ case D.directivesFor' dstr of+ [(d, _)] -> commandFor d+ [] -> Left "Unrecognized directive. Type :? for help."+ ds -> Left ("Ambiguous directive. Possible matches: " +++ intercalate ", " (map snd ds) ++ ". Type :? for help.")+ where+ (dstr, arg) = trim <$> break isSpace cmd++ commandFor d = case d of+ Help -> return ShowHelp+ Quit -> return QuitPSCi+ Reload -> return ReloadState+ Clear -> return ClearState+ Paste -> return PasteLines+ Browse -> BrowseModule . CST.nameValue <$> parseRest (parseOne CST.parseModuleNameP) arg+ Show -> ShowInfo <$> parseReplQuery' arg+ Type -> TypeOf . CST.convertExpr "" <$> parseRest (parseOne CST.parseExprP) arg+ Kind -> KindOf . CST.convertType "" <$> parseRest (parseOne CST.parseTypeP) arg+ Complete -> return (CompleteStr arg)+ Print+ | arg == "" -> return $ ShowInfo QueryPrint+ | otherwise -> SetInteractivePrint <$> parseRest (parseOne parseFullyQualifiedIdent) arg++-- |+-- Parses expressions entered at the PSCI repl.+--+psciExpression :: CST.Parser Command+psciExpression = Expression . CST.convertExpr "" <$> CST.parseExprP++-- | Imports must be handled separately from other declarations, so that+-- :show import works, for example.+psciImport :: FilePath -> CST.Parser Command+psciImport filePath = do+ (_, mn, declType, asQ) <- CST.convertImportDecl filePath <$> CST.parseImportDeclP+ pure $ Import (mn, declType, asQ)++-- | Any declaration that we don't need a 'special case' parser for+-- (like import declarations).+psciDeclaration :: CST.Parser Command+psciDeclaration = Decls . CST.convertDeclaration "" <$> CST.parseDeclP++parseReplQuery' :: String -> Either String ReplQuery+parseReplQuery' str =+ case parseReplQuery str of+ Nothing -> Left ("Don't know how to show " ++ str ++ ". Try one of: " +++ intercalate ", " replQueryStrings ++ ".")+ Just query -> Right query++parseFullyQualifiedIdent :: CST.Parser (P.ModuleName, P.Ident)+parseFullyQualifiedIdent = join $ CST.Parser $ \st _ ksucc ->+ case CST.runParser st CST.parseQualIdentP of+ (st', Right (CST.QualifiedName _ (Just mn) ident)) ->+ ksucc st' $ pure (mn, P.Ident $ CST.getIdent ident)+ _ ->+ ksucc st $ do+ tok <- CSTM.munch+ CSTM.parseFail tok $ CST.ErrCustom "Expected a fully-qualified name (eg: PSCI.Support.eval)"
+ src/Language/PureScript/Interactive/Printer.hs view
@@ -0,0 +1,132 @@+module Language.PureScript.Interactive.Printer where++import Prelude++import Data.List (intersperse)+import Data.Map qualified as M+import Data.Maybe (mapMaybe)+import Data.Text qualified as T+import Data.Text (Text)+import Language.PureScript qualified as P+import Text.PrettyPrint.Boxes qualified as Box++-- TODO (Christoph): Text version of boxes+textT :: Text -> Box.Box+textT = Box.text . T.unpack++-- Printers++-- |+-- Pretty print a module's signatures+--+printModuleSignatures :: P.ModuleName -> P.Environment -> String+printModuleSignatures moduleName P.Environment{..} =+ -- get relevant components of a module from environment+ let moduleNamesIdent = byModuleName names+ moduleTypeClasses = byModuleName typeClasses+ moduleTypes = byModuleName types++ byModuleName :: M.Map (P.Qualified a) b -> [P.Qualified a]+ byModuleName = filter ((== Just moduleName) . P.getQual) . M.keys++ in+ -- print each component+ (unlines . map trimEnd . lines . Box.render . Box.vsep 1 Box.left)+ [ printModule's (mapMaybe (showTypeClass . findTypeClass typeClasses)) moduleTypeClasses -- typeClasses+ , printModule's (mapMaybe (showType typeClasses dataConstructors typeSynonyms . findType types)) moduleTypes -- types+ , printModule's (map (showNameType . findNameType names)) moduleNamesIdent -- functions+ ]++ where printModule's showF = Box.vsep 1 Box.left . showF++ findNameType :: M.Map (P.Qualified P.Ident) (P.SourceType, P.NameKind, P.NameVisibility)+ -> P.Qualified P.Ident+ -> (P.Ident, Maybe (P.SourceType, P.NameKind, P.NameVisibility))+ findNameType envNames m = (P.disqualify m, M.lookup m envNames)++ showNameType :: (P.Ident, Maybe (P.SourceType, P.NameKind, P.NameVisibility)) -> Box.Box+ showNameType (mIdent, Just (mType, _, _)) = textT (P.showIdent mIdent <> " :: ") Box.<> P.typeAsBox maxBound mType+ showNameType _ = P.internalError "The impossible happened in printModuleSignatures."++ findTypeClass+ :: M.Map (P.Qualified (P.ProperName 'P.ClassName)) P.TypeClassData+ -> P.Qualified (P.ProperName 'P.ClassName)+ -> (P.Qualified (P.ProperName 'P.ClassName), Maybe P.TypeClassData)+ findTypeClass envTypeClasses name = (name, M.lookup name envTypeClasses)++ showTypeClass+ :: (P.Qualified (P.ProperName 'P.ClassName), Maybe P.TypeClassData)+ -> Maybe Box.Box+ showTypeClass (_, Nothing) = Nothing+ showTypeClass (P.Qualified _ name, Just P.TypeClassData{..}) =+ let constraints =+ if null typeClassSuperclasses+ then Box.text ""+ else Box.text "("+ Box.<> Box.hcat Box.left (intersperse (Box.text ", ") $ map (\(P.Constraint _ (P.Qualified _ pn) _ lt _) -> textT (P.runProperName pn) Box.<+> Box.hcat Box.left (map (P.typeAtomAsBox maxBound) lt)) typeClassSuperclasses)+ Box.<> Box.text ") <= "+ className =+ textT (P.runProperName name)+ Box.<> textT (foldMap ((" " <>) . fst) typeClassArguments)+ classBody =+ Box.vcat Box.top (map (\(i, t, _) -> textT (P.showIdent i <> " ::") Box.<+> P.typeAsBox maxBound t) typeClassMembers)++ in+ Just $+ (Box.text "class "+ Box.<> constraints+ Box.<> className+ Box.<+> if null typeClassMembers then Box.text "" else Box.text "where")+ Box.// Box.moveRight 2 classBody+++ findType+ :: M.Map (P.Qualified (P.ProperName 'P.TypeName)) (P.SourceType, P.TypeKind)+ -> P.Qualified (P.ProperName 'P.TypeName)+ -> (P.Qualified (P.ProperName 'P.TypeName), Maybe (P.SourceType, P.TypeKind))+ findType envTypes name = (name, M.lookup name envTypes)++ showType+ :: M.Map (P.Qualified (P.ProperName 'P.ClassName)) P.TypeClassData+ -> M.Map (P.Qualified (P.ProperName 'P.ConstructorName)) (P.DataDeclType, P.ProperName 'P.TypeName, P.SourceType, [P.Ident])+ -> M.Map (P.Qualified (P.ProperName 'P.TypeName)) ([(Text, Maybe P.SourceType)], P.SourceType)+ -> (P.Qualified (P.ProperName 'P.TypeName), Maybe (P.SourceType, P.TypeKind))+ -> Maybe Box.Box+ showType typeClassesEnv dataConstructorsEnv typeSynonymsEnv (n@(P.Qualified modul name), typ) =+ case (typ, M.lookup n typeSynonymsEnv) of+ (Just (_, P.TypeSynonym), Just (typevars, dtType)) ->+ if M.member (fmap P.coerceProperName n) typeClassesEnv+ then+ Nothing+ else+ Just $+ textT ("type " <> P.runProperName name <> foldMap ((" " <>) . fst) typevars)+ Box.// Box.moveRight 2 (Box.text "=" Box.<+> P.typeAsBox maxBound dtType)++ (Just (_, P.DataType _ typevars pt), _) ->+ let prefix =+ case pt of+ [(dtProperName,_)] ->+ case M.lookup (P.Qualified modul dtProperName) dataConstructorsEnv of+ Just (dataDeclType, _, _, _) -> P.showDataDeclType dataDeclType+ _ -> "data"+ _ -> "data"++ in+ Just $ textT (prefix <> " " <> P.runProperName name <> foldMap ((" " <>) . (\(v, _, _) -> v)) typevars) Box.// printCons pt++ _ ->+ Nothing++ where printCons pt =+ Box.moveRight 2 $+ Box.vcat Box.left $+ mapFirstRest (Box.text "=" Box.<+>) (Box.text "|" Box.<+>) $+ map (\(cons,idents) -> textT (P.runProperName cons) Box.<> Box.hcat Box.left (map prettyPrintType idents)) pt++ prettyPrintType t = Box.text " " Box.<> P.typeAtomAsBox maxBound t++ mapFirstRest _ _ [] = []+ mapFirstRest f g (x:xs) = f x : map g xs++ trimEnd = reverse . dropWhile (== ' ') . reverse
+ src/Language/PureScript/Interactive/Types.hs view
@@ -0,0 +1,242 @@+-- |+-- Type declarations and associated basic functions for PSCI.+--+module Language.PureScript.Interactive.Types+ ( PSCiConfig(..)+ , psciEnvironment+ , PSCiState -- constructor is not exported, to prevent psciImports and psciExports from+ -- becoming inconsistent with importedModules, letBindings and loadedExterns+ , ImportedModule+ , psciExports+ , psciImports+ , psciLoadedExterns+ , psciInteractivePrint+ , psciImportedModules+ , psciLetBindings+ , initialPSCiState+ , initialInteractivePrint+ , updateImportedModules+ , updateLoadedExterns+ , updateLets+ , setInteractivePrint+ , Command(..)+ , ReplQuery(..)+ , replQueries+ , replQueryStrings+ , showReplQuery+ , parseReplQuery+ , Directive(..)+ ) where++import Prelude++import Language.PureScript qualified as P+import Data.Map qualified as M+import Data.List (foldl')+import Language.PureScript.Sugar.Names.Env (nullImports, primExports)+import Control.Monad (foldM)+import Control.Monad.Trans.Except (runExceptT)+import Control.Monad.Trans.State (execStateT)+import Control.Monad.Writer.Strict (runWriterT)+++-- | The PSCI configuration.+--+-- These configuration values do not change during execution.+--+newtype PSCiConfig = PSCiConfig+ { psciFileGlobs :: [String]+ } deriving Show++-- | The PSCI state.+--+-- Holds a list of imported modules, loaded files, and partial let bindings,+-- plus the currently configured interactive printing function.+--+-- The let bindings are partial, because it makes more sense to apply the+-- binding to the final evaluated expression.+--+-- The last two fields are derived from the first three via updateImportExports+-- each time a module is imported, a let binding is added, or the session is+-- cleared or reloaded+data PSCiState = PSCiState+ [ImportedModule]+ [P.Declaration]+ [(P.Module, P.ExternsFile)]+ (P.ModuleName, P.Ident)+ P.Imports+ P.Exports+ deriving Show++psciImportedModules :: PSCiState -> [ImportedModule]+psciImportedModules (PSCiState x _ _ _ _ _) = x++psciLetBindings :: PSCiState -> [P.Declaration]+psciLetBindings (PSCiState _ x _ _ _ _) = x++psciLoadedExterns :: PSCiState -> [(P.Module, P.ExternsFile)]+psciLoadedExterns (PSCiState _ _ x _ _ _) = x++psciInteractivePrint :: PSCiState -> (P.ModuleName, P.Ident)+psciInteractivePrint (PSCiState _ _ _ x _ _) = x++psciImports :: PSCiState -> P.Imports+psciImports (PSCiState _ _ _ _ x _) = x++psciExports :: PSCiState -> P.Exports+psciExports (PSCiState _ _ _ _ _ x) = x++initialPSCiState :: PSCiState+initialPSCiState = PSCiState [] [] [] initialInteractivePrint nullImports primExports++-- | The default interactive print function.+initialInteractivePrint :: (P.ModuleName, P.Ident)+initialInteractivePrint = (P.moduleNameFromString "PSCI.Support", P.Ident "eval")++psciEnvironment :: PSCiState -> P.Environment+psciEnvironment st = foldl' (flip P.applyExternsFileToEnvironment) P.initEnvironment externs+ where externs = map snd (psciLoadedExterns st)++-- | All of the data that is contained by an ImportDeclaration in the AST.+-- That is:+--+-- * A module name, the name of the module which is being imported+-- * An ImportDeclarationType which specifies whether there is an explicit+-- import list, a hiding list, or neither.+-- * If the module is imported qualified, its qualified name in the importing+-- module. Otherwise, Nothing.+--+type ImportedModule = (P.ModuleName, P.ImportDeclarationType, Maybe P.ModuleName)++-- * State helpers++-- This function updates the Imports and Exports values in the PSCiState, which are used for+-- handling completions. This function must be called whenever the PSCiState is modified to+-- ensure that completions remain accurate.+updateImportExports :: PSCiState -> PSCiState+updateImportExports st@(PSCiState modules lets externs iprint _ _) =+ case createEnv (map snd externs) >>= flip desugarModule temporaryModule of+ Left _ -> st -- TODO: can this fail and what should we do?+ Right env ->+ case M.lookup temporaryName env of+ Just (_, is, es) -> PSCiState modules lets externs iprint is es+ _ -> st -- impossible+ where++ desugarModule :: P.Env -> P.Module -> Either P.MultipleErrors P.Env+ desugarModule e = runExceptT =<< fmap (fst . fst) . runWriterT . flip execStateT (e, mempty) . P.desugarImports++ createEnv :: [P.ExternsFile] -> Either P.MultipleErrors P.Env+ createEnv = runExceptT =<< fmap fst . runWriterT . foldM P.externsEnv P.primEnv++ temporaryName :: P.ModuleName+ temporaryName = P.ModuleName "$PSCI"++ temporaryModule :: P.Module+ temporaryModule =+ let+ prim = (P.ModuleName "Prim", P.Implicit, Nothing)+ decl = (importDecl `map` (prim : modules)) ++ lets+ in+ P.Module internalSpan [] temporaryName decl Nothing++ importDecl :: ImportedModule -> P.Declaration+ importDecl (mn, declType, asQ) = P.ImportDeclaration (internalSpan, []) mn declType asQ++ internalSpan :: P.SourceSpan+ internalSpan = P.internalModuleSourceSpan "<internal>"++-- | Updates the imported modules in the state record.+updateImportedModules :: ([ImportedModule] -> [ImportedModule]) -> PSCiState -> PSCiState+updateImportedModules f (PSCiState x a b c d e) =+ updateImportExports (PSCiState (f x) a b c d e)++-- | Updates the loaded externs files in the state record.+updateLoadedExterns :: ([(P.Module, P.ExternsFile)] -> [(P.Module, P.ExternsFile)]) -> PSCiState -> PSCiState+updateLoadedExterns f (PSCiState a b x c d e) =+ updateImportExports (PSCiState a b (f x) c d e)++-- | Updates the let bindings in the state record.+updateLets :: ([P.Declaration] -> [P.Declaration]) -> PSCiState -> PSCiState+updateLets f (PSCiState a x b c d e) =+ updateImportExports (PSCiState a (f x) b c d e)++-- | Replaces the interactive printing function in the state record with a new+-- one.+setInteractivePrint :: (P.ModuleName, P.Ident) -> PSCiState -> PSCiState+setInteractivePrint iprint (PSCiState a b c _ d e) =+ PSCiState a b c iprint d e++-- * Commands++-- |+-- Valid Meta-commands for PSCI+--+data Command+ -- | A purescript expression+ = Expression P.Expr+ -- | Show the help (ie, list of directives)+ | ShowHelp+ -- | Import a module from a loaded file+ | Import ImportedModule+ -- | Browse a module+ | BrowseModule P.ModuleName+ -- | Exit PSCI+ | QuitPSCi+ -- | Reload all the imported modules of the REPL+ | ReloadState+ -- | Clear the state of the REPL+ | ClearState+ -- | Add some declarations to the current evaluation context+ | Decls [P.Declaration]+ -- | Find the type of an expression+ | TypeOf P.Expr+ -- | Find the kind of an expression+ | KindOf P.SourceType+ -- | Shows information about the current state of the REPL+ | ShowInfo ReplQuery+ -- | Paste multiple lines+ | PasteLines+ -- | Return auto-completion output as if pressing <tab>+ | CompleteStr String+ -- | Set the interactive printing function+ | SetInteractivePrint (P.ModuleName, P.Ident)+ deriving Show++data ReplQuery+ = QueryLoaded+ | QueryImport+ | QueryPrint+ deriving (Eq, Show)++-- | A list of all ReplQuery values.+replQueries :: [ReplQuery]+replQueries = [QueryLoaded, QueryImport, QueryPrint]++replQueryStrings :: [String]+replQueryStrings = map showReplQuery replQueries++showReplQuery :: ReplQuery -> String+showReplQuery QueryLoaded = "loaded"+showReplQuery QueryImport = "import"+showReplQuery QueryPrint = "print"++parseReplQuery :: String -> Maybe ReplQuery+parseReplQuery "loaded" = Just QueryLoaded+parseReplQuery "import" = Just QueryImport+parseReplQuery "print" = Just QueryPrint+parseReplQuery _ = Nothing++data Directive+ = Help+ | Quit+ | Reload+ | Clear+ | Browse+ | Type+ | Kind+ | Show+ | Paste+ | Complete+ | Print+ deriving (Eq, Show)
− src/Language/PureScript/Kinds.hs
@@ -1,60 +0,0 @@------------------------------------------------------------------------------------ Module : Language.PureScript.Kinds--- Copyright : (c) Phil Freeman 2013--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ |-----------------------------------------------------------------------------------{-# LANGUAGE DeriveDataTypeable #-}--module Language.PureScript.Kinds where--import Data.Data--import Control.Monad.Unify (Unknown)---- |--- The data type of kinds----data Kind- -- |- -- Unification variable of type Kind- --- = KUnknown Unknown- -- |- -- The kind of types- --- | Star- -- |- -- The kind of effects- --- | Bang- -- |- -- Kinds for labelled, unordered rows without duplicates- --- | Row Kind- -- |- -- Function kinds- --- | FunKind Kind Kind deriving (Show, Eq, Data, Typeable)--everywhereOnKinds :: (Kind -> Kind) -> Kind -> Kind-everywhereOnKinds f = go- where- go (Row k1) = f (Row (go k1))- go (FunKind k1 k2) = f (FunKind (go k1) (go k2))- go other = f other--everythingOnKinds :: (r -> r -> r) -> (Kind -> r) -> Kind -> r-everythingOnKinds (<>) f = go- where- go k@(Row k1) = f k <> go k1- go k@(FunKind k1 k2) = f k <> go k1 <> go k2- go other = f other
+ src/Language/PureScript/Label.hs view
@@ -0,0 +1,21 @@+module Language.PureScript.Label (Label(..)) where++import Prelude+import GHC.Generics (Generic)+import Codec.Serialise (Serialise)+import Control.DeepSeq (NFData)+import Data.Monoid ()+import Data.String (IsString(..))+import Data.Aeson qualified as A++import Language.PureScript.PSString (PSString)++-- |+-- Labels are used as record keys and row entry names. Labels newtype PSString+-- because records are indexable by PureScript strings at runtime.+--+newtype Label = Label { runLabel :: PSString }+ deriving (Show, Eq, Ord, IsString, Semigroup, Monoid, A.ToJSON, A.FromJSON, Generic)++instance NFData Label+instance Serialise Label
+ src/Language/PureScript/Linter.hs view
@@ -0,0 +1,299 @@+-- |+-- This module implements a simple linting pass on the PureScript AST.+--+module Language.PureScript.Linter (lint, module L) where++import Prelude++import Control.Monad.Writer.Class (MonadWriter(..), censor)++import Data.Maybe (mapMaybe)+import Data.Set qualified as S+import Data.Text (Text)+import Data.Text qualified as Text+import Control.Monad ((<=<))++import Language.PureScript.AST+import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage(..), addHint, errorMessage')+import Language.PureScript.Linter.Exhaustive as L+import Language.PureScript.Linter.Imports as L+import Language.PureScript.Names (Ident(..), Qualified(..), QualifiedBy(..), getIdentName, runIdent)+import Language.PureScript.Types (Constraint(..), SourceType, Type(..), everythingWithContextOnTypes)+import Language.PureScript.Constants.Libs qualified as C++-- | Lint the PureScript AST.+-- |+-- | Right now, this pass performs a shadowing check and a check for unused bindings.+lint :: forall m. (MonadWriter MultipleErrors m) => Module -> m ()+lint modl@(Module _ _ mn ds _) = do+ lintUnused modl+ censor (addHint (ErrorInModule mn)) $ mapM_ lintDeclaration ds++ where+ moduleNames :: S.Set ScopedIdent+ moduleNames = S.fromList (map ToplevelIdent (mapMaybe getDeclIdent ds))++ getDeclIdent :: Declaration -> Maybe Ident+ getDeclIdent = getIdentName <=< declName++ lintDeclaration :: Declaration -> m ()+ lintDeclaration = tell . f+ where+ (warningsInDecl, _, _, _, _) = everythingWithScope (\_ _ -> mempty) stepE stepB (\_ _ -> mempty) stepDo++ f :: Declaration -> MultipleErrors+ f (TypeClassDeclaration _ name args _ _ decs) = addHint (ErrorInTypeClassDeclaration name) (foldMap (f' (S.fromList $ fst <$> args)) decs)+ f dec = f' S.empty dec++ f' :: S.Set Text -> Declaration -> MultipleErrors+ f' s dec@(ValueDeclaration vd) =+ addHint (ErrorInValueDeclaration (valdeclIdent vd)) (warningsInDecl moduleNames dec <> checkTypeVarsInDecl s dec)+ f' s (TypeDeclaration td@(TypeDeclarationData (ss, _) _ _)) =+ addHint (ErrorInTypeDeclaration (tydeclIdent td)) (checkTypeVars ss s (tydeclType td))+ f' s dec = warningsInDecl moduleNames dec <> checkTypeVarsInDecl s dec++ stepE :: S.Set ScopedIdent -> Expr -> MultipleErrors+ stepE s (Abs (VarBinder ss name) _) | name `inScope` s = errorMessage' ss (ShadowedName name)+ stepE s (Let _ ds' _) = foldMap go ds'+ where+ go d | Just i <- getDeclIdent d+ , inScope i s = errorMessage' (declSourceSpan d) (ShadowedName i)+ | otherwise = mempty+ stepE _ _ = mempty++ stepB :: S.Set ScopedIdent -> Binder -> MultipleErrors+ stepB s (VarBinder ss name)+ | name `inScope` s+ = errorMessage' ss (ShadowedName name)+ stepB s (NamedBinder ss name _)+ | inScope name s+ = errorMessage' ss (ShadowedName name)+ stepB _ _ = mempty++ stepDo :: S.Set ScopedIdent -> DoNotationElement -> MultipleErrors+ stepDo s (DoNotationLet ds') = foldMap go ds'+ where+ go d+ | Just i <- getDeclIdent d, i `inScope` s = errorMessage' (declSourceSpan d) (ShadowedName i)+ | otherwise = mempty+ stepDo _ _ = mempty++ checkTypeVarsInDecl :: S.Set Text -> Declaration -> MultipleErrors+ checkTypeVarsInDecl s d = let (f, _, _, _, _) = accumTypes (checkTypeVars (declSourceSpan d) s) in f d++ checkTypeVars :: SourceSpan -> S.Set Text -> SourceType -> MultipleErrors+ checkTypeVars ss set ty = everythingWithContextOnTypes set mempty mappend step ty <> snd (findUnused ty)+ where++ step :: S.Set Text -> SourceType -> (S.Set Text, MultipleErrors)+ step s (ForAll _ _ tv _ _ _) = bindVar s tv+ step s _ = (s, mempty)++ bindVar :: S.Set Text -> Text -> (S.Set Text, MultipleErrors)+ bindVar = bind ss ShadowedTypeVar++ findUnused :: SourceType -> (S.Set Text, MultipleErrors)+ findUnused = go set where+ -- Recursively walk the type and prune used variables from `unused`+ go :: S.Set Text -> SourceType -> (S.Set Text, MultipleErrors)+ go unused (TypeVar _ v) = (S.delete v unused, mempty)+ go unused (ForAll _ _ tv mbK t1 _) =+ let (nowUnused, errors)+ | Just k <- mbK = go unused k `combine` go (S.insert tv unused) t1+ | otherwise = go (S.insert tv unused) t1+ restoredUnused = if S.member tv unused then S.insert tv nowUnused else nowUnused+ combinedErrors = if S.member tv nowUnused then errors <> errorMessage' ss (UnusedTypeVar tv) else errors+ in (restoredUnused, combinedErrors)+ go unused (TypeApp _ f x) = go unused f `combine` go unused x+ go unused (KindApp _ f x) = go unused f `combine` go unused x+ go unused (ConstrainedType _ c t1) = foldl combine (unused, mempty) $ map (go unused) (constraintArgs c <> [t1])+ go unused (RCons _ _ t1 rest) = go unused t1 `combine` go unused rest+ go unused (KindedType _ t1 _) = go unused t1+ go unused (ParensInType _ t1) = go unused t1+ go unused (BinaryNoParensType _ t1 t2 t3) = go unused t1 `combine` go unused t2 `combine` go unused t3+ go unused TUnknown{} = (unused, mempty)+ go unused TypeLevelString{} = (unused, mempty)+ go unused TypeLevelInt{} = (unused, mempty)+ go unused TypeWildcard{} = (unused, mempty)+ go unused TypeConstructor{} = (unused, mempty)+ go unused TypeOp{} = (unused, mempty)+ go unused Skolem{} = (unused, mempty)+ go unused REmpty{} = (unused, mempty)++ combine ::+ (S.Set Text, MultipleErrors) ->+ (S.Set Text, MultipleErrors) ->+ (S.Set Text, MultipleErrors)+ combine (a, b) (c, d) = (S.intersection a c, b <> d)++ bind :: (Ord a) => SourceSpan -> (a -> SimpleErrorMessage) -> S.Set a -> a -> (S.Set a, MultipleErrors)+ bind ss mkError s name+ | name `S.member` s = (s, errorMessage' ss (mkError name))+ | otherwise = (S.insert name s, mempty)++++lintUnused :: forall m. (MonadWriter MultipleErrors m) => Module -> m ()+lintUnused (Module modSS _ mn modDecls exports) =+ censor (addHint (ErrorInModule mn)) $ do+ topVars <- traverse lintDeclaration modDecls+ let allVars = S.unions topVars+ case exports of+ Nothing ->+ pure ()+ Just exports'+ | any thisModuleRef exports' -> pure ()+ | otherwise -> do+ let exportIds = S.fromList $ mapMaybe getValueRef exports'+ expectedUsedDecls = S.fromList (mapMaybe getDeclIdent $ filter isValueDecl modDecls) `S.difference` exportIds+ unused = (expectedUsedDecls `S.difference` allVars) `S.difference` rebindable+ newErrs = mconcat $ map unusedDeclError $ S.toList unused+ tell newErrs+ pure ()+ where+ unusedDeclError ident = errorMessage' ss $ UnusedDeclaration ident+ where+ ss = case filter ((== Just ident) . getDeclIdent) modDecls of+ decl:_ -> declSourceSpan decl+ _ -> modSS++ thisModuleRef :: DeclarationRef -> Bool+ thisModuleRef (ModuleRef _ mn') = mn == mn'+ thisModuleRef _ = False++ rebindable :: S.Set Ident+ rebindable = S.fromList [ Ident C.S_bind, Ident C.S_discard ]++ getDeclIdent :: Declaration -> Maybe Ident+ getDeclIdent = getIdentName <=< declName++ lintDeclaration :: Declaration -> m (S.Set Ident)+ lintDeclaration declToLint = do+ let (vars, errs) = goDecl declToLint+ tell errs+ pure vars+ where++ goDecl :: Declaration -> (S.Set Ident, MultipleErrors)+ goDecl (ValueDeclaration vd) =+ let allExprs = concatMap unguard $ valdeclExpression vd+ bindNewNames = S.fromList (concatMap binderNamesWithSpans $ valdeclBinders vd)+ (vars, errs) = removeAndWarn bindNewNames $ mconcat $ map go allExprs+ errs' = addHint (ErrorInValueDeclaration $ valdeclIdent vd) errs+ in+ (vars, errs')++ goDecl (ValueFixityDeclaration _ _ (Qualified _ (Left v)) _) = (S.singleton v, mempty)++ goDecl (TypeInstanceDeclaration _ _ _ _ _ _ _ _ (ExplicitInstance decls)) = mconcat $ map goDecl decls+ goDecl _ = mempty++ go :: Expr -> (S.Set Ident, MultipleErrors)+ go (Var _ (Qualified (BySourcePos _) v)) = (S.singleton v, mempty)+ go (Var _ _) = (S.empty, mempty)++ go (Let _ ds e) = onDecls ds (go e)++ go (Abs binder v1) =+ let newNames = S.fromList (binderNamesWithSpans binder)+ in+ removeAndWarn newNames $ go v1++ go (UnaryMinus _ v1) = go v1+ go (BinaryNoParens v0 v1 v2) = go v0 <> go v1 <> go v2+ go (Parens v1) = go v1+ go (Accessor _ v1) = go v1++ go (ObjectUpdate obj vs) = mconcat (go obj : map (go . snd) vs)+ go (ObjectUpdateNested obj vs) = go obj <> goTree vs+ where+ goTree (PathTree tree) = mconcat $ map (goNode . snd) (runAssocList tree)+ goNode (Leaf val) = go val+ goNode (Branch val) = goTree val++ go (App v1 v2) = go v1 <> go v2+ go (VisibleTypeApp v _) = go v+ go (Unused v) = go v+ go (IfThenElse v1 v2 v3) = go v1 <> go v2 <> go v3+ go (Case vs alts) =+ let f (CaseAlternative binders gexprs) =+ let bindNewNames = S.fromList (concatMap binderNamesWithSpans binders)+ allExprs = concatMap unguard gexprs+ in+ removeAndWarn bindNewNames $ mconcat $ map go allExprs+ in+ mconcat $ map go vs ++ map f alts++ go (TypedValue _ v1 _) = go v1+ go (Do _ es) = doElts es Nothing+ go (Ado _ es v1) = doElts es (Just v1)++ go (Literal _ (ArrayLiteral es)) = mconcat $ map go es+ go (Literal _ (ObjectLiteral oo)) = mconcat $ map (go . snd) oo++ go (PositionedValue _ _ v1) = go v1++ go (Literal _ _) = mempty+ go (Op _ _) = mempty+ go (Constructor _ _) = mempty+ go (TypeClassDictionary _ _ _) = mempty+ go (DeferredDictionary _ _) = mempty+ go (DerivedInstancePlaceholder _ _) = mempty+ go AnonymousArgument = mempty+ go (Hole _) = mempty+++ doElts :: [DoNotationElement] -> Maybe Expr -> (S.Set Ident, MultipleErrors)+ doElts (DoNotationValue e : rest) v = go e <> doElts rest v+ doElts (DoNotationBind binder e : rest) v =+ let bindNewNames = S.fromList (binderNamesWithSpans binder)+ in go e <> removeAndWarn bindNewNames (doElts rest v)++ doElts (DoNotationLet ds : rest) v = onDecls ds (doElts rest v)++ doElts (PositionedDoNotationElement _ _ e : rest) v = doElts (e : rest) v+ doElts [] (Just e) = go e <> (rebindable, mempty)+ doElts [] Nothing = (rebindable, mempty)++ -- (non-recursively, recursively) bound idents in decl+ declIdents :: Declaration -> (S.Set (SourceSpan, Ident), S.Set (SourceSpan, Ident))+ declIdents (ValueDecl (ss,_) ident _ _ _) = (S.empty, S.singleton (ss, ident))+ declIdents (BoundValueDeclaration _ binders _) = (S.fromList $ binderNamesWithSpans binders, S.empty)+ declIdents _ = (S.empty, S.empty)++ onDecls :: [ Declaration ] -> (S.Set Ident, MultipleErrors) -> (S.Set Ident, MultipleErrors)+ onDecls ds errs = + let + onDecl d (accErrs, accLetNamesRec) = + let (letNames, recNames) = declIdents d+ dErrs = underDecl d+ errs' = dErrs <> removeAndWarn letNames accErrs+ in+ (errs', accLetNamesRec <> recNames)+ (errs'', letNamesRec) = foldr onDecl (errs, S.empty) ds+ in+ removeAndWarn letNamesRec errs''++ -- let f x = e -- check the x in e (but not the f)+ underDecl (ValueDecl _ _ _ binders gexprs) =+ let bindNewNames = S.fromList (concatMap binderNamesWithSpans binders)+ allExprs = concatMap unguard gexprs+ in+ removeAndWarn bindNewNames $ foldr1 (<>) $ map go allExprs+ -- let {x} = e -- no binding to check inside e+ underDecl (BoundValueDeclaration _ _ expr) = go expr+ underDecl _ = (mempty, mempty)++ unguard (GuardedExpr guards expr) = map unguard' guards ++ [expr]+ unguard' (ConditionGuard ee) = ee+ unguard' (PatternGuard _ ee) = ee++ removeAndWarn :: S.Set (SourceSpan, Ident) -> (S.Set Ident, MultipleErrors) -> (S.Set Ident, MultipleErrors)+ removeAndWarn newNamesWithSpans (used, errors) =+ let newNames = S.map snd newNamesWithSpans+ filteredUsed = used `S.difference` newNames+ warnUnused = S.filter (not . Text.isPrefixOf "_" . runIdent) (newNames `S.difference` used)+ warnUnusedSpans = S.filter (\(_,ident) -> ident `elem` warnUnused) newNamesWithSpans + combinedErrors = if not $ S.null warnUnusedSpans then errors <> mconcat (map (\(ss,ident) -> errorMessage' ss $ UnusedName ident) $ S.toList warnUnusedSpans) else errors+ in+ (filteredUsed, combinedErrors)
+ src/Language/PureScript/Linter/Exhaustive.hs view
@@ -0,0 +1,309 @@+-- |+-- Module for exhaustivity checking over pattern matching definitions+-- The algorithm analyses the clauses of a definition one by one from top+-- to bottom, where in each step it has the cases already missing (uncovered),+-- and it generates the new set of missing cases.+--+module Language.PureScript.Linter.Exhaustive+ ( checkExhaustiveExpr+ ) where++import Prelude+import Protolude (ordNub)++import Control.Applicative (Applicative(..))+import Control.Arrow (first, second)+import Control.Monad (unless)+import Control.Monad.Writer.Class (MonadWriter(..))++import Data.List (foldl', sortOn)+import Data.Maybe (fromMaybe)+import Data.Map qualified as M+import Data.Text qualified as T++import Language.PureScript.AST.Binders (Binder(..))+import Language.PureScript.AST.Declarations (CaseAlternative(..), Expr(..), Guard(..), GuardedExpr(..), pattern MkUnguarded, isTrueExpr)+import Language.PureScript.AST.Literals (Literal(..))+import Language.PureScript.AST.Traversals (everywhereOnValuesM)+import Language.PureScript.Crash (internalError)+import Language.PureScript.Environment (DataDeclType, Environment(..), TypeKind(..))+import Language.PureScript.Errors (MultipleErrors, pattern NullSourceAnn, SimpleErrorMessage(..), SourceSpan, errorMessage')+import Language.PureScript.Names as P+import Language.PureScript.Pretty.Values (prettyPrintBinderAtom)+import Language.PureScript.Types as P+import Language.PureScript.Constants.Prim qualified as C++-- | There are two modes of failure for the redundancy check:+--+-- 1. Exhaustivity was incomplete due to too many cases, so we couldn't determine redundancy.+-- 2. We didn't attempt to determine redundancy for a binder, e.g. an integer binder.+--+-- We want to warn the user in the first case.+data RedundancyError = Incomplete | Unknown++-- |+-- Qualifies a propername from a given qualified propername and a default module name+--+qualifyName+ :: ProperName a+ -> ModuleName+ -> Qualified (ProperName b)+ -> Qualified (ProperName a)+qualifyName n defmn qn = Qualified (ByModuleName mn) n+ where+ (mn, _) = qualify defmn qn++-- |+-- Given an environment and a datatype or newtype name,+-- this function returns the associated data constructors if it is the case of a datatype+-- where: - ProperName is the name of the constructor (for example, "Nothing" in Maybe)+-- - [Type] is the list of arguments, if it has (for example, "Just" has [TypeVar "a"])+--+getConstructors :: Environment -> ModuleName -> Qualified (ProperName 'ConstructorName) -> [(ProperName 'ConstructorName, [SourceType])]+getConstructors env defmn n = extractConstructors lnte+ where++ extractConstructors :: Maybe (SourceType, TypeKind) -> [(ProperName 'ConstructorName, [SourceType])]+ extractConstructors (Just (_, DataType _ _ pt)) = pt+ extractConstructors _ = internalError "Data name not in the scope of the current environment in extractConstructors"++ lnte :: Maybe (SourceType, TypeKind)+ lnte = M.lookup qpn (types env)++ qpn :: Qualified (ProperName 'TypeName)+ qpn = getConsDataName n++ getConsDataName :: Qualified (ProperName 'ConstructorName) -> Qualified (ProperName 'TypeName)+ getConsDataName con =+ case getConsInfo con of+ Nothing -> internalError $ "Constructor " ++ T.unpack (showQualified runProperName con) ++ " not in the scope of the current environment in getConsDataName."+ Just (_, pm, _, _) -> qualifyName pm defmn con++ getConsInfo :: Qualified (ProperName 'ConstructorName) -> Maybe (DataDeclType, ProperName 'TypeName, SourceType, [Ident])+ getConsInfo con = M.lookup con (dataConstructors env)++-- |+-- Replicates a wildcard binder+--+initialize :: Int -> [Binder]+initialize l = replicate l NullBinder++-- |+-- Applies a function over two lists of tuples that may lack elements+--+genericMerge :: Ord a =>+ (a -> Maybe b -> Maybe c -> d) ->+ [(a, b)] ->+ [(a, c)] ->+ [d]+genericMerge _ [] [] = []+genericMerge f bs [] = map (\(s, b) -> f s (Just b) Nothing) bs+genericMerge f [] bs = map (\(s, b) -> f s Nothing (Just b)) bs+genericMerge f bsl@((s, b):bs) bsr@((s', b'):bs')+ | s < s' = f s (Just b) Nothing : genericMerge f bs bsr+ | s > s' = f s' Nothing (Just b') : genericMerge f bsl bs'+ | otherwise = f s (Just b) (Just b') : genericMerge f bs bs'++-- |+-- Find the uncovered set between two binders:+-- the first binder is the case we are trying to cover, the second one is the matching binder+--+missingCasesSingle :: Environment -> ModuleName -> Binder -> Binder -> ([Binder], Either RedundancyError Bool)+missingCasesSingle _ _ _ NullBinder = ([], return True)+missingCasesSingle _ _ _ (VarBinder _ _) = ([], return True)+missingCasesSingle env mn (VarBinder _ _) b = missingCasesSingle env mn NullBinder b+missingCasesSingle env mn br (NamedBinder _ _ bl) = missingCasesSingle env mn br bl+missingCasesSingle env mn NullBinder cb@(ConstructorBinder ss con _) =+ (concatMap (\cp -> fst $ missingCasesSingle env mn cp cb) allPatterns, return True)+ where+ allPatterns = map (\(p, t) -> ConstructorBinder ss (qualifyName p mn con) (initialize $ length t))+ $ getConstructors env mn con+missingCasesSingle env mn cb@(ConstructorBinder ss con bs) (ConstructorBinder _ con' bs')+ | con == con' = let (bs'', pr) = missingCasesMultiple env mn bs bs' in (map (ConstructorBinder ss con) bs'', pr)+ | otherwise = ([cb], return False)+missingCasesSingle env mn NullBinder (LiteralBinder ss (ObjectLiteral bs)) =+ (map (LiteralBinder ss . ObjectLiteral . zip (map fst bs)) allMisses, pr)+ where+ (allMisses, pr) = missingCasesMultiple env mn (initialize $ length bs) (map snd bs)+missingCasesSingle env mn (LiteralBinder _ (ObjectLiteral bs)) (LiteralBinder ss (ObjectLiteral bs')) =+ (map (LiteralBinder ss . ObjectLiteral . zip sortedNames) allMisses, pr)+ where+ (allMisses, pr) = uncurry (missingCasesMultiple env mn) (unzip binders)++ sortNames = sortOn fst++ (sbs, sbs') = (sortNames bs, sortNames bs')++ compB :: a -> Maybe a -> Maybe a -> (a, a)+ compB e b b' = (fm b, fm b')+ where+ fm = fromMaybe e++ compBS :: b -> a -> Maybe b -> Maybe b -> (a, (b, b))+ compBS e s b b' = (s, compB e b b')++ (sortedNames, binders) = unzip $ genericMerge (compBS NullBinder) sbs sbs'+missingCasesSingle _ _ NullBinder (LiteralBinder ss (BooleanLiteral b)) = ([LiteralBinder ss . BooleanLiteral $ not b], return True)+missingCasesSingle _ _ (LiteralBinder ss (BooleanLiteral bl)) (LiteralBinder _ (BooleanLiteral br))+ | bl == br = ([], return True)+ | otherwise = ([LiteralBinder ss $ BooleanLiteral bl], return False)+missingCasesSingle env mn b (PositionedBinder _ _ cb) = missingCasesSingle env mn b cb+missingCasesSingle env mn b (TypedBinder _ cb) = missingCasesSingle env mn b cb+missingCasesSingle _ _ b _ = ([b], Left Unknown)++-- |+-- Returns the uncovered set of binders+-- the first argument is the list of uncovered binders at step i+-- the second argument is the (i+1)th clause of a pattern matching definition+--+-- The idea of the algorithm is as follows:+-- it processes each binder of the two lists (say, `x` and `y`) one by one+-- at each step two cases arises:+-- - there are no missing cases between `x` and `y`: this is very straightforward, it continues with the remaining cases+-- but keeps the uncovered binder in its position.+-- - there are missing cases, let us call it the set `U`: on the one hand, we mix each new uncovered case in `U`+-- with the current tail of uncovered set. On the other hand, it continues with the remaining cases: here we+-- can use `x` (but it will generate overlapping cases), or `y`, which will generate non-overlapping cases.+--+-- As an example, consider:+--+-- data N = Z | S N+-- f Z Z = Z --> {[S _, _], [Z, S _]} which are the right non-overlapping cases (GHC uses this).+--+-- if we use `x` instead of `y` (in this case, `y` stands for `Z` and `x` for `_`) we obtain:+-- f Z Z = Z --> {[S _, _], [_, S _]} you can see that both cases overlaps each other.+--+-- Up to now, we've decided to use `x` just because we expect to generate uncovered cases which might be+-- redundant or not, but uncovered at least. If we use `y` instead, we'll need to have a redundancy checker+-- (which ought to be available soon), or increase the complexity of the algorithm.+--+missingCasesMultiple :: Environment -> ModuleName -> [Binder] -> [Binder] -> ([[Binder]], Either RedundancyError Bool)+missingCasesMultiple env mn = go+ where+ go (x:xs) (y:ys) = (map (: xs) miss1 ++ map (x :) miss2, liftA2 (&&) pr1 pr2)+ where+ (miss1, pr1) = missingCasesSingle env mn x y+ (miss2, pr2) = go xs ys+ go _ _ = ([], pure True)++-- |+-- Guard handling+--+-- We say a guard is exhaustive iff it has an `otherwise` (or `true`) expression.+-- Example:+-- f x | x < 0 = 0+-- | otherwise = 1+-- is exhaustive, whereas `f x | x < 0` is not+--+-- or in case of a pattern guard if the pattern is exhaustive.+--+-- The function below say whether or not a guard has an `otherwise` expression+-- It is considered that `otherwise` is defined in Prelude+--+isExhaustiveGuard :: Environment -> ModuleName -> [GuardedExpr] -> Bool+isExhaustiveGuard _ _ [MkUnguarded _] = True+isExhaustiveGuard env moduleName gs =+ any (\(GuardedExpr grd _) -> isExhaustive grd) gs+ where+ isExhaustive :: [Guard] -> Bool+ isExhaustive = all checkGuard++ checkGuard :: Guard -> Bool+ checkGuard (ConditionGuard cond) = isTrueExpr cond+ checkGuard (PatternGuard binder _) =+ case missingCasesMultiple env moduleName [NullBinder] [binder] of+ ([], _) -> True -- there are no missing pattern for this guard+ _ -> False++-- |+-- Returns the uncovered set of case alternatives+--+missingCases :: Environment -> ModuleName -> [Binder] -> CaseAlternative -> ([[Binder]], Either RedundancyError Bool)+missingCases env mn uncovered ca = missingCasesMultiple env mn uncovered (caseAlternativeBinders ca)++missingAlternative :: Environment -> ModuleName -> CaseAlternative -> [Binder] -> ([[Binder]], Either RedundancyError Bool)+missingAlternative env mn ca uncovered+ | isExhaustiveGuard env mn (caseAlternativeResult ca) = mcases+ | otherwise = ([uncovered], snd mcases)+ where+ mcases = missingCases env mn uncovered ca++-- |+-- Main exhaustivity checking function+-- Starting with the set `uncovered = { _ }` (nothing covered, one `_` for each function argument),+-- it partitions that set with the new uncovered cases, until it consumes the whole set of clauses.+-- Then, returns the uncovered set of case alternatives.+--+checkExhaustive+ :: forall m+ . MonadWriter MultipleErrors m+ => SourceSpan+ -> Environment+ -> ModuleName+ -> Int+ -> [CaseAlternative]+ -> Expr+ -> m Expr+checkExhaustive ss env mn numArgs cas expr = makeResult . first ordNub $ foldl' step ([initialize numArgs], (pure True, [])) cas+ where+ step :: ([[Binder]], (Either RedundancyError Bool, [[Binder]])) -> CaseAlternative -> ([[Binder]], (Either RedundancyError Bool, [[Binder]]))+ step (uncovered, (nec, redundant)) ca =+ let (missed, pr) = unzip (map (missingAlternative env mn ca) uncovered)+ (missed', approx) = splitAt 10000 (ordNub (concat missed))+ cond = or <$> sequenceA pr+ in (missed', ( if null approx+ then liftA2 (&&) cond nec+ else Left Incomplete+ , if and cond+ then redundant+ else caseAlternativeBinders ca : redundant+ )+ )++ makeResult :: ([[Binder]], (Either RedundancyError Bool, [[Binder]])) -> m Expr+ makeResult (bss, (rr, bss')) =+ do unless (null bss') tellRedundant+ case rr of+ Left Incomplete -> tellIncomplete+ _ -> return ()+ return $ if null bss+ then expr+ else addPartialConstraint (second null (splitAt 5 bss)) expr+ where+ tellRedundant = tell . errorMessage' ss . uncurry OverlappingPattern . second null . splitAt 5 $ bss'+ tellIncomplete = tell . errorMessage' ss $ IncompleteExhaustivityCheck++ -- We add a Partial constraint by annotating the expression to have type `Partial => _`.+ --+ -- The binder information is provided so that it can be embedded in the constraint,+ -- and then included in the error message.+ addPartialConstraint :: ([[Binder]], Bool) -> Expr -> Expr+ addPartialConstraint (bss, complete) e =+ TypedValue True e $+ srcConstrainedType (srcConstraint C.Partial [] [] (Just constraintData)) $ TypeWildcard NullSourceAnn IgnoredWildcard+ where+ constraintData :: ConstraintData+ constraintData =+ PartialConstraintData (map (map prettyPrintBinderAtom) bss) complete++-- |+-- Exhaustivity checking+--+checkExhaustiveExpr+ :: forall m+ . MonadWriter MultipleErrors m+ => SourceSpan+ -> Environment+ -> ModuleName+ -> Expr+ -> m Expr+checkExhaustiveExpr ss env mn = onExpr'+ where+ (_, onExpr', _) = everywhereOnValuesM pure onExpr pure++ onExpr :: Expr -> m Expr+ onExpr e = case e of+ Case es cas ->+ checkExhaustive ss env mn (length es) cas e+ _ ->+ pure e
+ src/Language/PureScript/Linter/Imports.hs view
@@ -0,0 +1,388 @@+module Language.PureScript.Linter.Imports+ ( lintImports+ , Name(..)+ , UsedImports()+ ) where++import Prelude+import Protolude (ordNub)++import Control.Monad (join, unless, foldM, (<=<))+import Control.Monad.Writer.Class (MonadWriter(..))++import Data.Function (on)+import Data.Foldable (for_)+import Data.List (find, intersect, groupBy, sort, sortOn, (\\))+import Data.Maybe (mapMaybe)+import Data.Monoid (Sum(..))+import Data.Traversable (forM)+import Data.Text qualified as T+import Data.Map qualified as M++import Language.PureScript.AST.Declarations (Declaration(..), DeclarationRef(..), ExportSource, ImportDeclarationType(..), Module(..), getTypeRef, isExplicit)+import Language.PureScript.AST.SourcePos (SourceSpan)+import Language.PureScript.Crash (internalError)+import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage(..), errorMessage')+import Language.PureScript.Names+import Language.PureScript.Sugar.Names.Common (warnDuplicateRefs)+import Language.PureScript.Sugar.Names.Env (Env, Exports(..), ImportRecord(..), Imports(..), envModuleExports, nullImports)+import Language.PureScript.Sugar.Names.Imports (ImportDef, findImports)+import Language.PureScript.Constants.Prim qualified as C++-- |+-- Map of module name to list of imported names from that module which have+-- been used.+--+type UsedImports = M.Map ModuleName [Qualified Name]++-- |+-- Find and warn on:+--+-- * Unused import statements (qualified or unqualified)+--+-- * Unused references in an explicit import list+--+-- * Implicit imports of modules+--+-- * Implicit imports into a virtual module (unless the virtual module only has+-- members from one module imported)+--+-- * Imports using `hiding` (this is another form of implicit importing)+--+lintImports+ :: forall m+ . MonadWriter MultipleErrors m+ => Module+ -> Env+ -> UsedImports+ -> m ()+lintImports (Module _ _ _ _ Nothing) _ _ =+ internalError "lintImports needs desugared exports"+lintImports (Module _ _ mn mdecls (Just mexports)) env usedImps = do++ -- TODO: this needs some work to be easier to understand++ let scope = maybe nullImports (\(_, imps', _) -> imps') (M.lookup mn env)+ usedImps' = foldr (elaborateUsed scope) usedImps exportedModules+ numOpenImports = getSum $ foldMap (Sum . countOpenImports) mdecls+ allowImplicit = numOpenImports == 1+ imports = M.toAscList (findImports mdecls)++ for_ imports $ \(mni, decls) ->+ unless (isPrim mni) .+ for_ decls $ \(ss, declType, qualifierName) -> do+ let names = ordNub $ M.findWithDefault [] mni usedImps'+ lintImportDecl env mni qualifierName names ss declType allowImplicit++ for_ (M.toAscList (byQual imports)) $ \(mnq, entries) -> do+ let mnis = ordNub $ map (\(_, _, mni) -> mni) entries+ unless (length mnis == 1) $ do+ let implicits = filter (\(_, declType, _) -> not $ isExplicit declType) entries+ for_ implicits $ \(ss, _, mni) -> do+ let names = ordNub $ M.findWithDefault [] mni usedImps'+ usedRefs = findUsedRefs ss env mni (Just mnq) names+ unless (null usedRefs) .+ tell . errorMessage' ss $ ImplicitQualifiedImport mni mnq $ map (simplifyTypeRef $ const True) usedRefs++ for_ imports $ \(mnq, imps) -> do++ warned <- foldM (checkDuplicateImports mnq) [] (selfCartesianSubset imps)++ let unwarned = imps \\ warned+ duplicates+ = join+ . map tail+ . filter ((> 1) . length)+ . groupBy ((==) `on` defQual)+ . sortOn defQual+ $ unwarned++ for_ duplicates $ \(pos, _, _) ->+ tell . errorMessage' pos $ DuplicateSelectiveImport mnq++ for_ (imps \\ (warned ++ duplicates)) $ \(pos, typ, _) ->+ warnDuplicateRefs pos DuplicateImportRef $ case typ of+ Explicit refs -> refs+ Hiding refs -> refs+ _ -> []++ -- Check re-exported modules to see if we are re-exporting a qualified module+ -- that has unspecified imports.+ for_ mexports $ \case+ ModuleRef _ mnq ->+ case M.lookup mnq (byQual imports) of+ -- We only match the single-entry case here as otherwise there will be+ -- a different warning about implicit imports potentially colliding+ -- anyway+ Just [(ss, Implicit, mni)] -> do+ let names = ordNub $ M.findWithDefault [] mni usedImps'+ usedRefs = findUsedRefs ss env mni (Just mnq) names+ tell . errorMessage' ss $+ ImplicitQualifiedImportReExport mni mnq+ $ map (simplifyTypeRef $ const True) usedRefs+ _ -> pure ()+ _ -> pure ()++ where++ defQual :: ImportDef -> Maybe ModuleName+ defQual (_, _, q) = q++ selfCartesianSubset :: [a] -> [(a, a)]+ selfCartesianSubset (x : xs) = [(x, y) | y <- xs] ++ selfCartesianSubset xs+ selfCartesianSubset [] = []++ countOpenImports :: Declaration -> Int+ countOpenImports (ImportDeclaration _ mn' Implicit Nothing)+ | not (isPrim mn' || mn == mn') = 1+ countOpenImports (ImportDeclaration _ mn' (Hiding _) Nothing)+ | not (isPrim mn' || mn == mn') = 1+ countOpenImports _ = 0++ -- Checks whether a module is the Prim module - used to suppress any checks+ -- made, as Prim is always implicitly imported.+ isPrim :: ModuleName -> Bool+ isPrim = (== C.M_Prim)++ -- Creates a map of virtual modules mapped to all the declarations that+ -- import to that module, with the corresponding source span, import type,+ -- and module being imported+ byQual+ :: [(ModuleName, [(SourceSpan, ImportDeclarationType, Maybe ModuleName)])]+ -> M.Map ModuleName [(SourceSpan, ImportDeclarationType, ModuleName)]+ byQual = foldr goImp M.empty+ where+ goImp (mni, xs) acc = foldr (goDecl mni) acc xs+ goDecl mni (ss', declType, Just qmn) acc =+ let entry = (ss', declType, mni)+ in M.alter (Just . maybe [entry] (entry :)) qmn acc+ goDecl _ _ acc = acc++ -- The list of modules that are being re-exported by the current module. Any+ -- module that appears in this list is always considered to be used.+ exportedModules :: [ModuleName]+ exportedModules = ordNub $ mapMaybe extractModule mexports+ where+ extractModule (ModuleRef _ mne) = Just mne+ extractModule _ = Nothing++ -- Elaborates the UsedImports to include values from modules that are being+ -- re-exported. This ensures explicit export hints are printed for modules+ -- that are implicitly exported and then re-exported.+ elaborateUsed :: Imports -> ModuleName -> UsedImports -> UsedImports+ elaborateUsed scope mne used =+ foldr go used+ $ extractByQual mne (importedTypeClasses scope) TyClassName+ ++ extractByQual mne (importedTypeOps scope) TyOpName+ ++ extractByQual mne (importedTypes scope) TyName+ ++ extractByQual mne (importedDataConstructors scope) DctorName+ ++ extractByQual mne (importedValues scope) IdentName+ ++ extractByQual mne (importedValueOps scope) ValOpName+ where+ go :: (ModuleName, Qualified Name) -> UsedImports -> UsedImports+ go (q, name) = M.alter (Just . maybe [name] (name :)) q++ extractByQual+ :: ModuleName+ -> M.Map (Qualified a) [ImportRecord a]+ -> (a -> Name)+ -> [(ModuleName, Qualified Name)]+ extractByQual k m toName = mapMaybe go (M.toList m)+ where+ go (q@(Qualified mnq _), is)+ | isUnqualified q =+ case find (isQualifiedWith k) (map importName is) of+ Just (Qualified _ name) -> Just (k, Qualified mnq (toName name))+ _ -> Nothing+ | isQualifiedWith k q =+ case importName (head is) of+ Qualified (ByModuleName mn') name -> Just (mn', Qualified mnq (toName name))+ _ -> internalError "unqualified name in extractByQual"+ go _ = Nothing+++-- Replace explicit type refs with data constructor lists from listing the+-- used constructors explicitly `T(X, Y, [...])` to `T(..)` for suggestion+-- message.+-- Done everywhere when suggesting a completely new explicit imports list, otherwise+-- maintain the existing form.+simplifyTypeRef :: (ProperName 'TypeName -> Bool) -> DeclarationRef -> DeclarationRef+simplifyTypeRef shouldOpen (TypeRef ss name (Just dctors))+ | not (null dctors) && shouldOpen name = TypeRef ss name Nothing+simplifyTypeRef _ other = other++lintImportDecl+ :: forall m+ . MonadWriter MultipleErrors m+ => Env+ -> ModuleName+ -> Maybe ModuleName+ -> [Qualified Name]+ -> SourceSpan+ -> ImportDeclarationType+ -> Bool+ -> m Bool+lintImportDecl env mni qualifierName names ss declType allowImplicit =+ case declType of+ Implicit -> case qualifierName of+ Nothing ->+ if null allRefs+ then unused+ else unless' allowImplicit (checkImplicit ImplicitImport)+ Just q -> unless' (q `elem` mapMaybe getQual names) unused+ Hiding _ -> unless' allowImplicit (checkImplicit HidingImport)+ Explicit [] -> unused+ Explicit declrefs -> checkExplicit declrefs++ where++ checkImplicit+ :: (ModuleName -> [DeclarationRef] -> SimpleErrorMessage)+ -> m Bool+ checkImplicit warning =+ if null allRefs+ then unused+ else warn (warning mni (map (simplifyTypeRef $ const True) allRefs))++ checkExplicit+ :: [DeclarationRef]+ -> m Bool+ checkExplicit declrefs = do+ let idents = ordNub (mapMaybe runDeclRef declrefs)+ dctors = mapMaybe (getDctorName <=< disqualifyFor qualifierName) names+ usedNames = mapMaybe (matchName (typeForDCtor mni) <=< disqualifyFor qualifierName) names+ diff = idents \\ usedNames++ didWarn <- case (length diff, length idents) of+ (0, _) -> return False+ (n, m) | n == m -> unused+ _ -> warn (UnusedExplicitImport mni diff qualifierName $ map simplifyTypeRef' allRefs)++ didWarn' <- forM (mapMaybe getTypeRef declrefs) $ \(tn, c) -> do+ let allCtors = dctorsForType mni tn+ -- If we've not already warned a type is unused, check its data constructors+ unless' (TyName tn `notElem` usedNames) $+ case (c, dctors `intersect` allCtors) of+ (_, []) | c /= Just [] -> warn (UnusedDctorImport mni tn qualifierName $ map simplifyTypeRef' allRefs)+ (Just ctors, dctors') ->+ let ddiff = ctors \\ dctors'+ in unless' (null ddiff) . warn $ UnusedDctorExplicitImport mni tn ddiff qualifierName $ map simplifyTypeRef' allRefs+ _ -> return False++ return (didWarn || or didWarn')++ where+ simplifyTypeRef' :: DeclarationRef -> DeclarationRef+ simplifyTypeRef' = simplifyTypeRef (\name -> any (isMatch name) declrefs)+ where+ isMatch name (TypeRef _ name' Nothing) = name == name'+ isMatch _ _ = False++ unused :: m Bool+ unused = warn (UnusedImport mni qualifierName)++ warn :: SimpleErrorMessage -> m Bool+ warn err = tell (errorMessage' ss err) >> return True++ -- Unless the boolean is true, run the action. Return false when the action is+ -- not run, otherwise return whatever the action does.+ --+ -- The return value is intended for cases where we want to track whether some+ -- work was done, as there may be further conditions in the action that mean+ -- it ends up doing nothing.+ unless' :: Bool -> m Bool -> m Bool+ unless' False m = m+ unless' True _ = return False++ allRefs :: [DeclarationRef]+ allRefs = findUsedRefs ss env mni qualifierName names++ dtys+ :: ModuleName+ -> M.Map (ProperName 'TypeName) ([ProperName 'ConstructorName], ExportSource)+ dtys mn = foldMap (exportedTypes . envModuleExports) $ mn `M.lookup` env++ dctorsForType+ :: ModuleName+ -> ProperName 'TypeName+ -> [ProperName 'ConstructorName]+ dctorsForType mn tn = maybe [] fst $ tn `M.lookup` dtys mn++ typeForDCtor+ :: ModuleName+ -> ProperName 'ConstructorName+ -> Maybe (ProperName 'TypeName)+ typeForDCtor mn pn = fst <$> find (elem pn . fst . snd) (M.toList (dtys mn))++findUsedRefs+ :: SourceSpan+ -> Env+ -> ModuleName+ -> Maybe ModuleName+ -> [Qualified Name]+ -> [DeclarationRef]+findUsedRefs ss env mni qn names =+ let+ classRefs = TypeClassRef ss <$> mapMaybe (getClassName <=< disqualifyFor qn) names+ valueRefs = ValueRef ss <$> mapMaybe (getIdentName <=< disqualifyFor qn) names+ valueOpRefs = ValueOpRef ss <$> mapMaybe (getValOpName <=< disqualifyFor qn) names+ typeOpRefs = TypeOpRef ss <$> mapMaybe (getTypeOpName <=< disqualifyFor qn) names+ types = mapMaybe (getTypeName <=< disqualifyFor qn) names+ dctors = mapMaybe (getDctorName <=< disqualifyFor qn) names+ typesWithDctors = reconstructTypeRefs dctors+ typesWithoutDctors = filter (`M.notMember` typesWithDctors) types+ typesRefs+ = map (flip (TypeRef ss) (Just [])) typesWithoutDctors+ ++ map (\(ty, ds) -> TypeRef ss ty (Just ds)) (M.toList typesWithDctors)+ in sort $ classRefs ++ typeOpRefs ++ typesRefs ++ valueRefs ++ valueOpRefs++ where++ reconstructTypeRefs+ :: [ProperName 'ConstructorName]+ -> M.Map (ProperName 'TypeName) [ProperName 'ConstructorName]+ reconstructTypeRefs = foldr accumDctors M.empty+ where+ accumDctors dctor =+ M.alter (Just . maybe [dctor] (dctor :)) (findTypeForDctor mni dctor)++ findTypeForDctor+ :: ModuleName+ -> ProperName 'ConstructorName+ -> ProperName 'TypeName+ findTypeForDctor mn dctor =+ case mn `M.lookup` env of+ Just (_, _, exps) ->+ case find (elem dctor . fst . snd) (M.toList (exportedTypes exps)) of+ Just (ty, _) -> ty+ Nothing -> internalError $ "missing type for data constructor " ++ T.unpack (runProperName dctor) ++ " in findTypeForDctor"+ Nothing -> internalError $ "missing module " ++ T.unpack (runModuleName mn) ++ " in findTypeForDctor"++matchName+ :: (ProperName 'ConstructorName -> Maybe (ProperName 'TypeName))+ -> Name+ -> Maybe Name+matchName lookupDc (DctorName x) = TyName <$> lookupDc x+matchName _ ModName{} = Nothing+matchName _ name = Just name++runDeclRef :: DeclarationRef -> Maybe Name+runDeclRef (ValueRef _ ident) = Just $ IdentName ident+runDeclRef (ValueOpRef _ op) = Just $ ValOpName op+runDeclRef (TypeRef _ pn _) = Just $ TyName pn+runDeclRef (TypeOpRef _ op) = Just $ TyOpName op+runDeclRef (TypeClassRef _ pn) = Just $ TyClassName pn+runDeclRef _ = Nothing++checkDuplicateImports+ :: MonadWriter MultipleErrors m+ => ModuleName+ -> [ImportDef]+ -> (ImportDef, ImportDef)+ -> m [ImportDef]+checkDuplicateImports mn xs ((_, t1, q1), (pos, t2, q2)) =+ if t1 == t2 && q1 == q2+ then do+ tell . errorMessage' pos $ DuplicateImport mn t2 q2+ return $ (pos, t2, q2) : xs+ else return xs
+ src/Language/PureScript/Linter/Wildcards.hs view
@@ -0,0 +1,47 @@+module Language.PureScript.Linter.Wildcards+ ( ignoreWildcardsUnderCompleteTypeSignatures+ ) where++import Protolude hiding (Type)++import Language.PureScript.AST (Binder(..), Declaration, Expr(..), everywhereWithContextOnValues)+import Language.PureScript.Types (Type(..), WildcardData(..), everythingOnTypes, everywhereOnTypes)++-- |+-- Replaces `TypeWildcard _ UnnamedWildcard` with+-- `TypeWildcard _ IgnoredWildcard` in places where we don't want to emit a+-- warning about wildcards.+--+-- The guiding principle here is that a wildcard can be ignored if there is a+-- complete (wildcard-free) type signature on a binding somewhere between the+-- type in which the wildcard occurs and the top level of the module. In+-- particular, this means that top-level signatures containing wildcards are+-- always warnings, and a top-level signature always prevents wildcards on+-- inner bindings from emitting warnings.+--+ignoreWildcardsUnderCompleteTypeSignatures :: Declaration -> Declaration+ignoreWildcardsUnderCompleteTypeSignatures = onDecl+ where+ (onDecl, _, _, _, _, _) = everywhereWithContextOnValues False (,) handleExpr handleBinder (,) (,) (,)++ handleExpr isCovered = \case+ tv@(TypedValue chk v ty)+ | isCovered -> (True, TypedValue chk v $ ignoreWildcards ty)+ | otherwise -> (isComplete ty, tv)+ other -> (isCovered, other)++ handleBinder isCovered = \case+ tb@(TypedBinder ty b)+ | isCovered -> (True, TypedBinder (ignoreWildcards ty) b)+ | otherwise -> (isComplete ty, tb)+ other -> (isCovered, other)++ignoreWildcards :: Type a -> Type a+ignoreWildcards = everywhereOnTypes $ \case+ TypeWildcard a UnnamedWildcard -> TypeWildcard a IgnoredWildcard+ other -> other++isComplete :: Type a -> Bool+isComplete = everythingOnTypes (&&) $ \case+ TypeWildcard{} -> False+ _ -> True
+ src/Language/PureScript/Make.hs view
@@ -0,0 +1,302 @@+module Language.PureScript.Make+ (+ -- * Make API+ rebuildModule+ , rebuildModule'+ , make+ , inferForeignModules+ , module Monad+ , module Actions+ ) where++import Prelude++import Control.Concurrent.Lifted as C+import Control.DeepSeq (force)+import Control.Exception.Lifted (onException, bracket_, evaluate)+import Control.Monad (foldM, unless, when, (<=<))+import Control.Monad.Base (MonadBase(liftBase))+import Control.Monad.Error.Class (MonadError(..))+import Control.Monad.IO.Class (MonadIO(..))+import Control.Monad.Supply (evalSupplyT, runSupply, runSupplyT)+import Control.Monad.Trans.Control (MonadBaseControl(..))+import Control.Monad.Trans.State (runStateT)+import Control.Monad.Writer.Class (MonadWriter(..), censor)+import Control.Monad.Writer.Strict (runWriterT)+import Data.Function (on)+import Data.Foldable (fold, for_)+import Data.List (foldl', sortOn)+import Data.List.NonEmpty qualified as NEL+import Data.Maybe (fromMaybe)+import Data.Map qualified as M+import Data.Set qualified as S+import Data.Text qualified as T+import Debug.Trace (traceMarkerIO)+import Language.PureScript.AST (ErrorMessageHint(..), Module(..), SourceSpan(..), getModuleName, getModuleSourceSpan, importPrim)+import Language.PureScript.Crash (internalError)+import Language.PureScript.CST qualified as CST+import Language.PureScript.Docs.Convert qualified as Docs+import Language.PureScript.Environment (initEnvironment)+import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage(..), addHint, defaultPPEOptions, errorMessage', errorMessage'', prettyPrintMultipleErrors)+import Language.PureScript.Externs (ExternsFile, applyExternsFileToEnvironment, moduleToExternsFile)+import Language.PureScript.Linter (Name(..), lint, lintImports)+import Language.PureScript.ModuleDependencies (DependencyDepth(..), moduleSignature, sortModules)+import Language.PureScript.Names (ModuleName, isBuiltinModuleName, runModuleName)+import Language.PureScript.Renamer (renameInModule)+import Language.PureScript.Sugar (Env, collapseBindingGroups, createBindingGroups, desugar, desugarCaseGuards, externsEnv, primEnv)+import Language.PureScript.TypeChecker (CheckState(..), emptyCheckState, typeCheckModule)+import Language.PureScript.Make.BuildPlan (BuildJobResult(..), BuildPlan(..), getResult)+import Language.PureScript.Make.BuildPlan qualified as BuildPlan+import Language.PureScript.Make.Cache qualified as Cache+import Language.PureScript.Make.Actions as Actions+import Language.PureScript.Make.Monad as Monad+import Language.PureScript.CoreFn qualified as CF+import System.Directory (doesFileExist)+import System.FilePath (replaceExtension)++-- | Rebuild a single module.+--+-- This function is used for fast-rebuild workflows (PSCi and psc-ide are examples).+rebuildModule+ :: forall m+ . (MonadError MultipleErrors m, MonadWriter MultipleErrors m)+ => MakeActions m+ -> [ExternsFile]+ -> Module+ -> m ExternsFile+rebuildModule actions externs m = do+ env <- fmap fst . runWriterT $ foldM externsEnv primEnv externs+ rebuildModule' actions env externs m++rebuildModule'+ :: forall m+ . (MonadError MultipleErrors m, MonadWriter MultipleErrors m)+ => MakeActions m+ -> Env+ -> [ExternsFile]+ -> Module+ -> m ExternsFile+rebuildModule' act env ext mdl = rebuildModuleWithIndex act env ext mdl Nothing++rebuildModuleWithIndex+ :: forall m+ . (MonadError MultipleErrors m, MonadWriter MultipleErrors m)+ => MakeActions m+ -> Env+ -> [ExternsFile]+ -> Module+ -> Maybe (Int, Int)+ -> m ExternsFile+rebuildModuleWithIndex MakeActions{..} exEnv externs m@(Module _ _ moduleName _ _) moduleIndex = do+ progress $ CompilingModule moduleName moduleIndex+ let env = foldl' (flip applyExternsFileToEnvironment) initEnvironment externs+ withPrim = importPrim m+ lint withPrim++ ((Module ss coms _ elaborated exps, env'), nextVar) <- runSupplyT 0 $ do+ (desugared, (exEnv', usedImports)) <- runStateT (desugar externs withPrim) (exEnv, mempty)+ let modulesExports = (\(_, _, exports) -> exports) <$> exEnv'+ (checked, CheckState{..}) <- runStateT (typeCheckModule modulesExports desugared) $ emptyCheckState env+ let usedImports' = foldl' (flip $ \(fromModuleName, newtypeCtorName) ->+ M.alter (Just . (fmap DctorName newtypeCtorName :) . fold) fromModuleName) usedImports checkConstructorImportsForCoercible+ -- Imports cannot be linted before type checking because we need to+ -- known which newtype constructors are used to solve Coercible+ -- constraints in order to not report them as unused.+ censor (addHint (ErrorInModule moduleName)) $ lintImports checked exEnv' usedImports'+ return (checked, checkEnv)++ -- desugar case declarations *after* type- and exhaustiveness checking+ -- since pattern guards introduces cases which the exhaustiveness checker+ -- reports as not-exhaustive.+ (deguarded, nextVar') <- runSupplyT nextVar $ do+ desugarCaseGuards elaborated++ regrouped <- createBindingGroups moduleName . collapseBindingGroups $ deguarded+ let mod' = Module ss coms moduleName regrouped exps+ corefn = CF.moduleToCoreFn env' mod'+ (optimized, nextVar'') = runSupply nextVar' $ CF.optimizeCoreFn corefn+ (renamedIdents, renamed) = renameInModule optimized+ exts = moduleToExternsFile mod' env' renamedIdents+ ffiCodegen renamed++ -- It may seem more obvious to write `docs <- Docs.convertModule m env' here,+ -- but I have not done so for two reasons:+ -- 1. This should never fail; any genuine errors in the code should have been+ -- caught earlier in this function. Therefore if we do fail here it indicates+ -- a bug in the compiler, which should be reported as such.+ -- 2. We do not want to perform any extra work generating docs unless the+ -- user has asked for docs to be generated.+ let docs = case Docs.convertModule externs exEnv env' m of+ Left errs -> internalError $+ "Failed to produce docs for " ++ T.unpack (runModuleName moduleName)+ ++ "; details:\n" ++ prettyPrintMultipleErrors defaultPPEOptions errs+ Right d -> d++ evalSupplyT nextVar'' $ codegen renamed docs exts+ return exts++-- | Compiles in "make" mode, compiling each module separately to a @.js@ file and an @externs.cbor@ file.+--+-- If timestamps or hashes have not changed, existing externs files can be used to provide upstream modules' types without+-- having to typecheck those modules again.+make :: forall m. (MonadBaseControl IO m, MonadError MultipleErrors m, MonadWriter MultipleErrors m)+ => MakeActions m+ -> [CST.PartialResult Module]+ -> m [ExternsFile]+make ma@MakeActions{..} ms = do+ checkModuleNames+ cacheDb <- readCacheDb++ (sorted, graph) <- sortModules Transitive (moduleSignature . CST.resPartial) ms++ (buildPlan, newCacheDb) <- BuildPlan.construct ma cacheDb (sorted, graph)++ -- Limit concurrent module builds to the number of capabilities as+ -- (by default) inferred from `+RTS -N -RTS` or set explicitly like `-N4`.+ -- This is to ensure that modules complete fully before moving on, to avoid+ -- holding excess memory during compilation from modules that were paused+ -- by the Haskell runtime.+ capabilities <- getNumCapabilities+ let concurrency = max 1 capabilities+ lock <- C.newQSem concurrency++ let toBeRebuilt = filter (BuildPlan.needsRebuild buildPlan . getModuleName . CST.resPartial) sorted+ let totalModuleCount = length toBeRebuilt+ for_ toBeRebuilt $ \m -> fork $ do+ let moduleName = getModuleName . CST.resPartial $ m+ let deps = fromMaybe (internalError "make: module not found in dependency graph.") (lookup moduleName graph)+ buildModule lock buildPlan moduleName totalModuleCount+ (spanName . getModuleSourceSpan . CST.resPartial $ m)+ (fst $ CST.resFull m)+ (fmap importPrim . snd $ CST.resFull m)+ (deps `inOrderOf` map (getModuleName . CST.resPartial) sorted)++ -- Prevent hanging on other modules when there is an internal error+ -- (the exception is thrown, but other threads waiting on MVars are released)+ `onException` BuildPlan.markComplete buildPlan moduleName (BuildJobFailed mempty)++ -- Wait for all threads to complete, and collect results (and errors).+ (failures, successes) <-+ let+ splitResults = \case+ BuildJobSucceeded _ exts ->+ Right exts+ BuildJobFailed errs ->+ Left errs+ BuildJobSkipped ->+ Left mempty+ in+ M.mapEither splitResults <$> BuildPlan.collectResults buildPlan++ -- Write the updated build cache database to disk+ writeCacheDb $ Cache.removeModules (M.keysSet failures) newCacheDb++ writePackageJson++ -- If generating docs, also generate them for the Prim modules+ outputPrimDocs++ -- All threads have completed, rethrow any caught errors.+ let errors = M.elems failures+ unless (null errors) $ throwError (mconcat errors)++ -- Here we return all the ExternsFile in the ordering of the topological sort,+ -- so they can be folded into an Environment. This result is used in the tests+ -- and in PSCI.+ let lookupResult mn =+ fromMaybe (internalError "make: module not found in results")+ $ M.lookup mn successes+ return (map (lookupResult . getModuleName . CST.resPartial) sorted)++ where+ checkModuleNames :: m ()+ checkModuleNames = checkNoPrim *> checkModuleNamesAreUnique++ checkNoPrim :: m ()+ checkNoPrim =+ for_ ms $ \m ->+ let mn = getModuleName $ CST.resPartial m+ in when (isBuiltinModuleName mn) $+ throwError+ . errorMessage' (getModuleSourceSpan $ CST.resPartial m)+ $ CannotDefinePrimModules mn++ checkModuleNamesAreUnique :: m ()+ checkModuleNamesAreUnique =+ for_ (findDuplicates (getModuleName . CST.resPartial) ms) $ \mss ->+ throwError . flip foldMap mss $ \ms' ->+ let mn = getModuleName . CST.resPartial . NEL.head $ ms'+ in errorMessage'' (fmap (getModuleSourceSpan . CST.resPartial) ms') $ DuplicateModule mn++ -- Find all groups of duplicate values in a list based on a projection.+ findDuplicates :: Ord b => (a -> b) -> [a] -> Maybe [NEL.NonEmpty a]+ findDuplicates f xs =+ case filter ((> 1) . length) . NEL.groupBy ((==) `on` f) . sortOn f $ xs of+ [] -> Nothing+ xss -> Just xss++ -- Sort a list so its elements appear in the same order as in another list.+ inOrderOf :: (Ord a) => [a] -> [a] -> [a]+ inOrderOf xs ys = let s = S.fromList xs in filter (`S.member` s) ys++ buildModule :: QSem -> BuildPlan -> ModuleName -> Int -> FilePath -> [CST.ParserWarning] -> Either (NEL.NonEmpty CST.ParserError) Module -> [ModuleName] -> m ()+ buildModule lock buildPlan moduleName cnt fp pwarnings mres deps = do+ result <- flip catchError (return . BuildJobFailed) $ do+ let pwarnings' = CST.toMultipleWarnings fp pwarnings+ tell pwarnings'+ m <- CST.unwrapParserError fp mres+ -- We need to wait for dependencies to be built, before checking if the current+ -- module should be rebuilt, so the first thing to do is to wait on the+ -- MVars for the module's dependencies.+ mexterns <- fmap unzip . sequence <$> traverse (getResult buildPlan) deps++ case mexterns of+ Just (_, externs) -> do+ -- We need to ensure that all dependencies have been included in Env+ C.modifyMVar_ (bpEnv buildPlan) $ \env -> do+ let+ go :: Env -> ModuleName -> m Env+ go e dep = case lookup dep (zip deps externs) of+ Just exts+ | not (M.member dep e) -> externsEnv e exts+ _ -> return e+ foldM go env deps+ env <- C.readMVar (bpEnv buildPlan)+ idx <- C.takeMVar (bpIndex buildPlan)+ C.putMVar (bpIndex buildPlan) (idx + 1)++ -- Bracket all of the per-module work behind the semaphore, including+ -- forcing the result. This is done to limit concurrency and keep+ -- memory usage down; see comments above.+ (exts, warnings) <- bracket_ (C.waitQSem lock) (C.signalQSem lock) $ do+ -- Eventlog markers for profiling; see debug/eventlog.js+ liftBase $ traceMarkerIO $ T.unpack (runModuleName moduleName) <> " start"+ -- Force the externs and warnings to avoid retaining excess module+ -- data after the module is finished compiling.+ extsAndWarnings <- evaluate . force <=< listen $ do+ rebuildModuleWithIndex ma env externs m (Just (idx, cnt))+ liftBase $ traceMarkerIO $ T.unpack (runModuleName moduleName) <> " end"+ return extsAndWarnings+ return $ BuildJobSucceeded (pwarnings' <> warnings) exts+ Nothing -> return BuildJobSkipped++ BuildPlan.markComplete buildPlan moduleName result++-- | Infer the module name for a module by looking for the same filename with+-- a .js extension.+inferForeignModules+ :: forall m+ . MonadIO m+ => M.Map ModuleName (Either RebuildPolicy FilePath)+ -> m (M.Map ModuleName FilePath)+inferForeignModules =+ fmap (M.mapMaybe id) . traverse inferForeignModule+ where+ inferForeignModule :: Either RebuildPolicy FilePath -> m (Maybe FilePath)+ inferForeignModule (Left _) = return Nothing+ inferForeignModule (Right path) = do+ let jsFile = replaceExtension path "js"+ exists <- liftIO $ doesFileExist jsFile+ if exists+ then return (Just jsFile)+ else return Nothing
+ src/Language/PureScript/Make/Actions.hs view
@@ -0,0 +1,455 @@+module Language.PureScript.Make.Actions+ ( MakeActions(..)+ , RebuildPolicy(..)+ , ProgressMessage(..)+ , renderProgressMessage+ , buildMakeActions+ , checkForeignDecls+ , cacheDbFile+ , readCacheDb'+ , writeCacheDb'+ , ffiCodegen'+ ) where++import Prelude++import Control.Monad (unless, when)+import Control.Monad.Error.Class (MonadError(..))+import Control.Monad.IO.Class (MonadIO(..))+import Control.Monad.Reader (asks)+import Control.Monad.Supply (SupplyT)+import Control.Monad.Trans.Class (MonadTrans(..))+import Control.Monad.Writer.Class (MonadWriter(..))+import Data.Aeson (Value(String), (.=), object)+import Data.Bifunctor (bimap, first)+import Data.Either (partitionEithers)+import Data.Foldable (for_)+import Data.List.NonEmpty qualified as NEL+import Data.Map qualified as M+import Data.Maybe (fromMaybe, maybeToList)+import Data.Set qualified as S+import Data.Text qualified as T+import Data.Text.IO qualified as TIO+import Data.Text.Encoding qualified as TE+import Data.Time.Clock (UTCTime)+import Data.Version (showVersion)+import Language.JavaScript.Parser qualified as JS+import Language.PureScript.AST (SourcePos(..))+import Language.PureScript.Bundle qualified as Bundle+import Language.PureScript.CodeGen.JS qualified as J+import Language.PureScript.CodeGen.JS.Printer (prettyPrintJS, prettyPrintJSWithSourceMaps)+import Language.PureScript.CoreFn qualified as CF+import Language.PureScript.CoreFn.ToJSON qualified as CFJ+import Language.PureScript.Crash (internalError)+import Language.PureScript.CST qualified as CST+import Language.PureScript.Docs.Prim qualified as Docs.Prim+import Language.PureScript.Docs.Types qualified as Docs+import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage(..), errorMessage, errorMessage')+import Language.PureScript.Externs (ExternsFile, externsFileName)+import Language.PureScript.Make.Monad (Make, copyFile, getTimestamp, getTimestampMaybe, hashFile, makeIO, readExternsFile, readJSONFile, readTextFile, writeCborFile, writeJSONFile, writeTextFile)+import Language.PureScript.Make.Cache (CacheDb, ContentHash, normaliseForCache)+import Language.PureScript.Names (Ident(..), ModuleName, runModuleName)+import Language.PureScript.Options (CodegenTarget(..), Options(..))+import Language.PureScript.Pretty.Common (SMap(..))+import Paths_purescript qualified as Paths+import SourceMap (generate)+import SourceMap.Types (Mapping(..), Pos(..), SourceMapping(..))+import System.Directory (getCurrentDirectory)+import System.FilePath ((</>), makeRelative, splitPath, normalise, splitDirectories)+import System.FilePath.Posix qualified as Posix+import System.IO (stderr)++-- | Determines when to rebuild a module+data RebuildPolicy+ -- | Never rebuild this module+ = RebuildNever+ -- | Always rebuild this module+ | RebuildAlways+ deriving (Show, Eq, Ord)++-- | Progress messages from the make process+data ProgressMessage+ = CompilingModule ModuleName (Maybe (Int, Int))+ -- ^ Compilation started for the specified module+ deriving (Show, Eq, Ord)++-- | Render a progress message+renderProgressMessage :: T.Text -> ProgressMessage -> T.Text+renderProgressMessage infx (CompilingModule mn mi) =+ T.concat+ [ renderProgressIndex mi+ , infx+ , runModuleName mn+ ]+ where+ renderProgressIndex :: Maybe (Int, Int) -> T.Text+ renderProgressIndex = maybe "" $ \(start, end) ->+ let start' = T.pack (show start)+ end' = T.pack (show end)+ preSpace = T.replicate (T.length end' - T.length start') " "+ in "[" <> preSpace <> start' <> " of " <> end' <> "] "++-- | Actions that require implementations when running in "make" mode.+--+-- This type exists to make two things abstract:+--+-- * The particular backend being used (JavaScript, C++11, etc.)+--+-- * The details of how files are read/written etc.+data MakeActions m = MakeActions+ { getInputTimestampsAndHashes :: ModuleName -> m (Either RebuildPolicy (M.Map FilePath (UTCTime, m ContentHash)))+ -- ^ Get the timestamps and content hashes for the input files for a module.+ -- The content hash is returned as a monadic action so that the file does not+ -- have to be read if it's not necessary.+ , getOutputTimestamp :: ModuleName -> m (Maybe UTCTime)+ -- ^ Get the time this module was last compiled, provided that all of the+ -- requested codegen targets were also produced then. The defaultMakeActions+ -- implementation uses the modification time of the externs file, because the+ -- externs file is written first and we always write one. If there is no+ -- externs file, or if any of the requested codegen targets were not produced+ -- the last time this module was compiled, this function must return Nothing;+ -- this indicates that the module will have to be recompiled.+ , readExterns :: ModuleName -> m (FilePath, Maybe ExternsFile)+ -- ^ Read the externs file for a module as a string and also return the actual+ -- path for the file.+ , codegen :: CF.Module CF.Ann -> Docs.Module -> ExternsFile -> SupplyT m ()+ -- ^ Run the code generator for the module and write any required output files.+ , ffiCodegen :: CF.Module CF.Ann -> m ()+ -- ^ Check ffi and print it in the output directory.+ , progress :: ProgressMessage -> m ()+ -- ^ Respond to a progress update.+ , readCacheDb :: m CacheDb+ -- ^ Read the cache database (which contains timestamps and hashes for input+ -- files) from some external source, e.g. a file on disk.+ , writeCacheDb :: CacheDb -> m ()+ -- ^ Write the given cache database to some external source (e.g. a file on+ -- disk).+ , writePackageJson :: m ()+ -- ^ Write to the output directory the package.json file allowing Node.js to+ -- load .js files as ES modules.+ , outputPrimDocs :: m ()+ -- ^ If generating docs, output the documentation for the Prim modules+ }++-- | Given the output directory, determines the location for the+-- CacheDb file+cacheDbFile :: FilePath -> FilePath+cacheDbFile = (</> "cache-db.json")++readCacheDb'+ :: (MonadIO m, MonadError MultipleErrors m)+ => FilePath+ -- ^ The path to the output directory+ -> m CacheDb+readCacheDb' outputDir =+ fromMaybe mempty <$> readJSONFile (cacheDbFile outputDir)++writeCacheDb'+ :: (MonadIO m, MonadError MultipleErrors m)+ => FilePath+ -- ^ The path to the output directory+ -> CacheDb+ -- ^ The CacheDb to be written+ -> m ()+writeCacheDb' = writeJSONFile . cacheDbFile++writePackageJson'+ :: (MonadIO m, MonadError MultipleErrors m)+ => FilePath+ -- ^ The path to the output directory+ -> m ()+writePackageJson' outputDir = writeJSONFile (outputDir </> "package.json") $ object+ [ "type" .= String "module"+ ]++-- | A set of make actions that read and write modules from the given directory.+buildMakeActions+ :: FilePath+ -- ^ the output directory+ -> M.Map ModuleName (Either RebuildPolicy FilePath)+ -- ^ a map between module names and paths to the file containing the PureScript module+ -> M.Map ModuleName FilePath+ -- ^ a map between module name and the file containing the foreign javascript for the module+ -> Bool+ -- ^ Generate a prefix comment?+ -> MakeActions Make+buildMakeActions outputDir filePathMap foreigns usePrefix =+ MakeActions getInputTimestampsAndHashes getOutputTimestamp readExterns codegen ffiCodegen progress readCacheDb writeCacheDb writePackageJson outputPrimDocs+ where++ getInputTimestampsAndHashes+ :: ModuleName+ -> Make (Either RebuildPolicy (M.Map FilePath (UTCTime, Make ContentHash)))+ getInputTimestampsAndHashes mn = do+ let path = fromMaybe (internalError "Module has no filename in 'make'") $ M.lookup mn filePathMap+ case path of+ Left policy ->+ return (Left policy)+ Right filePath -> do+ cwd <- makeIO "Getting the current directory" getCurrentDirectory+ let inputPaths = map (normaliseForCache cwd) (filePath : maybeToList (M.lookup mn foreigns))+ getInfo fp = do+ ts <- getTimestamp fp+ return (ts, hashFile fp)+ pathsWithInfo <- traverse (\fp -> (fp,) <$> getInfo fp) inputPaths+ return $ Right $ M.fromList pathsWithInfo++ outputFilename :: ModuleName -> String -> FilePath+ outputFilename mn fn =+ let filePath = T.unpack (runModuleName mn)+ in outputDir </> filePath </> fn++ targetFilename :: ModuleName -> CodegenTarget -> FilePath+ targetFilename mn = \case+ JS -> outputFilename mn "index.js"+ JSSourceMap -> outputFilename mn "index.js.map"+ CoreFn -> outputFilename mn "corefn.json"+ Docs -> outputFilename mn "docs.json"++ getOutputTimestamp :: ModuleName -> Make (Maybe UTCTime)+ getOutputTimestamp mn = do+ codegenTargets <- asks optionsCodegenTargets+ mExternsTimestamp <- getTimestampMaybe (outputFilename mn externsFileName)+ case mExternsTimestamp of+ Nothing ->+ -- If there is no externs file, we will need to compile the module in+ -- order to produce one.+ pure Nothing+ Just externsTimestamp ->+ case NEL.nonEmpty (fmap (targetFilename mn) (S.toList codegenTargets)) of+ Nothing ->+ -- If the externs file exists and no other codegen targets have+ -- been requested, then we can consider the module up-to-date+ pure (Just externsTimestamp)+ Just outputPaths -> do+ -- If any of the other output paths are nonexistent or older than+ -- the externs file, then they should be considered outdated, and+ -- so the module will need rebuilding.+ mmodTimes <- traverse getTimestampMaybe outputPaths+ pure $ case sequence mmodTimes of+ Nothing ->+ Nothing+ Just modTimes ->+ if externsTimestamp <= minimum modTimes+ then Just externsTimestamp+ else Nothing++ readExterns :: ModuleName -> Make (FilePath, Maybe ExternsFile)+ readExterns mn = do+ let path = outputDir </> T.unpack (runModuleName mn) </> externsFileName+ (path, ) <$> readExternsFile path++ outputPrimDocs :: Make ()+ outputPrimDocs = do+ codegenTargets <- asks optionsCodegenTargets+ when (S.member Docs codegenTargets) $ for_ Docs.Prim.primModules $ \docsMod@Docs.Module{..} ->+ writeJSONFile (outputFilename modName "docs.json") docsMod++ codegen :: CF.Module CF.Ann -> Docs.Module -> ExternsFile -> SupplyT Make ()+ codegen m docs exts = do+ let mn = CF.moduleName m+ lift $ writeCborFile (outputFilename mn externsFileName) exts+ codegenTargets <- lift $ asks optionsCodegenTargets+ when (S.member CoreFn codegenTargets) $ do+ let coreFnFile = targetFilename mn CoreFn+ json = CFJ.moduleToJSON Paths.version m+ lift $ writeJSONFile coreFnFile json+ when (S.member JS codegenTargets) $ do+ foreignInclude <- case mn `M.lookup` foreigns of+ Just _+ | not $ requiresForeign m -> do+ return Nothing+ | otherwise -> do+ return $ Just "./foreign.js"+ Nothing | requiresForeign m -> throwError . errorMessage' (CF.moduleSourceSpan m) $ MissingFFIModule mn+ | otherwise -> return Nothing+ rawJs <- J.moduleToJs m foreignInclude+ dir <- lift $ makeIO "get the current directory" getCurrentDirectory+ let sourceMaps = S.member JSSourceMap codegenTargets+ (pjs, mappings) = if sourceMaps then prettyPrintJSWithSourceMaps rawJs else (prettyPrintJS rawJs, [])+ jsFile = targetFilename mn JS+ mapFile = targetFilename mn JSSourceMap+ prefix = ["Generated by purs version " <> T.pack (showVersion Paths.version) | usePrefix]+ js = T.unlines $ map ("// " <>) prefix ++ [pjs]+ mapRef = if sourceMaps then "//# sourceMappingURL=index.js.map\n" else ""+ lift $ do+ writeTextFile jsFile (TE.encodeUtf8 $ js <> mapRef)+ when sourceMaps $ genSourceMap dir mapFile (length prefix) mappings+ when (S.member Docs codegenTargets) $ do+ lift $ writeJSONFile (outputFilename mn "docs.json") docs++ ffiCodegen :: CF.Module CF.Ann -> Make ()+ ffiCodegen m = do+ codegenTargets <- asks optionsCodegenTargets+ ffiCodegen' foreigns codegenTargets (Just outputFilename) m++ genSourceMap :: String -> String -> Int -> [SMap] -> Make ()+ genSourceMap dir mapFile extraLines mappings = do+ let pathToDir = iterate (".." Posix.</>) ".." !! length (splitPath $ normalise outputDir)+ sourceFile = case mappings of+ (SMap file _ _ : _) -> Just $ pathToDir Posix.</> normalizeSMPath (makeRelative dir (T.unpack file))+ _ -> Nothing+ let rawMapping = SourceMapping { smFile = "index.js", smSourceRoot = Nothing, smMappings =+ map (\(SMap _ orig gen) -> Mapping {+ mapOriginal = Just $ convertPos $ add 0 (-1) orig+ , mapSourceFile = sourceFile+ , mapGenerated = convertPos $ add (extraLines + 1) 0 gen+ , mapName = Nothing+ }) mappings+ }+ let mapping = generate rawMapping+ writeJSONFile mapFile mapping+ where+ add :: Int -> Int -> SourcePos -> SourcePos+ add n m (SourcePos n' m') = SourcePos (n + n') (m + m')++ convertPos :: SourcePos -> Pos+ convertPos SourcePos { sourcePosLine = l, sourcePosColumn = c } =+ Pos { posLine = fromIntegral l, posColumn = fromIntegral c }++ normalizeSMPath :: FilePath -> FilePath+ normalizeSMPath = Posix.joinPath . splitDirectories++ requiresForeign :: CF.Module a -> Bool+ requiresForeign = not . null . CF.moduleForeign++ progress :: ProgressMessage -> Make ()+ progress = liftIO . TIO.hPutStr stderr . (<> "\n") . renderProgressMessage "Compiling "++ readCacheDb :: Make CacheDb+ readCacheDb = readCacheDb' outputDir++ writeCacheDb :: CacheDb -> Make ()+ writeCacheDb = writeCacheDb' outputDir++ writePackageJson :: Make ()+ writePackageJson = writePackageJson' outputDir++data ForeignModuleType = ESModule | CJSModule deriving (Show)++-- | Check that the declarations in a given PureScript module match with those+-- in its corresponding foreign module.+checkForeignDecls :: CF.Module ann -> FilePath -> Make (Either MultipleErrors (ForeignModuleType, S.Set Ident))+checkForeignDecls m path = do+ jsStr <- T.unpack <$> readTextFile path++ let+ parseResult :: Either MultipleErrors JS.JSAST+ parseResult = first (errorParsingModule . Bundle.UnableToParseModule) $ JS.parseModule jsStr path+ traverse checkFFI parseResult++ where+ mname = CF.moduleName m+ modSS = CF.moduleSourceSpan m++ checkFFI :: JS.JSAST -> Make (ForeignModuleType, S.Set Ident)+ checkFFI js = do+ (foreignModuleType, foreignIdentsStrs) <-+ case (,) <$> getForeignModuleExports js <*> getForeignModuleImports js of+ Left reason -> throwError $ errorParsingModule reason+ Right (Bundle.ForeignModuleExports{..}, Bundle.ForeignModuleImports{..})+ | not (null cjsExports && null cjsImports)+ , null esExports+ , null esImports -> do+ let deprecatedFFI = filter (elem '\'') cjsExports+ unless (null deprecatedFFI) $+ errorDeprecatedForeignPrimes deprecatedFFI++ pure (CJSModule, cjsExports)+ | otherwise -> do+ unless (null cjsImports) $+ errorUnsupportedFFICommonJSImports cjsImports++ unless (null cjsExports) $+ errorUnsupportedFFICommonJSExports cjsExports++ pure (ESModule, esExports)++ foreignIdents <- either+ errorInvalidForeignIdentifiers+ (pure . S.fromList)+ (parseIdents foreignIdentsStrs)+ let importedIdents = S.fromList (CF.moduleForeign m)++ let unusedFFI = foreignIdents S.\\ importedIdents+ unless (null unusedFFI) $+ tell . errorMessage' modSS . UnusedFFIImplementations mname $+ S.toList unusedFFI++ let missingFFI = importedIdents S.\\ foreignIdents+ unless (null missingFFI) $+ throwError . errorMessage' modSS . MissingFFIImplementations mname $+ S.toList missingFFI+ pure (foreignModuleType, foreignIdents)++ errorParsingModule :: Bundle.ErrorMessage -> MultipleErrors+ errorParsingModule = errorMessage' modSS . ErrorParsingFFIModule path . Just++ getForeignModuleExports :: JS.JSAST -> Either Bundle.ErrorMessage Bundle.ForeignModuleExports+ getForeignModuleExports = Bundle.getExportedIdentifiers (T.unpack (runModuleName mname))++ getForeignModuleImports :: JS.JSAST -> Either Bundle.ErrorMessage Bundle.ForeignModuleImports+ getForeignModuleImports = Bundle.getImportedModules (T.unpack (runModuleName mname))++ errorInvalidForeignIdentifiers :: [String] -> Make a+ errorInvalidForeignIdentifiers =+ throwError . mconcat . map (errorMessage . InvalidFFIIdentifier mname . T.pack)++ errorDeprecatedForeignPrimes :: [String] -> Make a+ errorDeprecatedForeignPrimes =+ throwError . mconcat . map (errorMessage' modSS . DeprecatedFFIPrime mname . T.pack)++ errorUnsupportedFFICommonJSExports :: [String] -> Make a+ errorUnsupportedFFICommonJSExports =+ throwError . errorMessage' modSS . UnsupportedFFICommonJSExports mname . map T.pack++ errorUnsupportedFFICommonJSImports :: [String] -> Make a+ errorUnsupportedFFICommonJSImports =+ throwError . errorMessage' modSS . UnsupportedFFICommonJSImports mname . map T.pack++ parseIdents :: [String] -> Either [String] [Ident]+ parseIdents strs =+ case partitionEithers (map parseIdent strs) of+ ([], idents) ->+ Right idents+ (errs, _) ->+ Left errs++ -- We ignore the error message here, just being told it's an invalid+ -- identifier should be enough.+ parseIdent :: String -> Either String Ident+ parseIdent str =+ bimap (const str) (Ident . CST.getIdent . CST.nameValue . snd)+ . CST.runTokenParser CST.parseIdent+ . CST.lex+ $ T.pack str++-- | FFI check and codegen action.+-- If path maker is supplied copies foreign module to the output.+ffiCodegen'+ :: M.Map ModuleName FilePath+ -> S.Set CodegenTarget+ -> Maybe (ModuleName -> String -> FilePath)+ -> CF.Module CF.Ann+ -> Make ()+ffiCodegen' foreigns codegenTargets makeOutputPath m = do+ when (S.member JS codegenTargets) $ do+ let mn = CF.moduleName m+ case mn `M.lookup` foreigns of+ Just path+ | not $ requiresForeign m ->+ tell $ errorMessage' (CF.moduleSourceSpan m) $ UnnecessaryFFIModule mn path+ | otherwise -> do+ checkResult <- checkForeignDecls m path+ case checkResult of+ Left _ -> copyForeign path mn+ Right (ESModule, _) -> copyForeign path mn+ Right (CJSModule, _) -> do+ throwError $ errorMessage' (CF.moduleSourceSpan m) $ DeprecatedFFICommonJSModule mn path+ Nothing | requiresForeign m -> throwError . errorMessage' (CF.moduleSourceSpan m) $ MissingFFIModule mn+ | otherwise -> return ()+ where+ requiresForeign = not . null . CF.moduleForeign++ copyForeign path mn =+ for_ makeOutputPath (\outputFilename -> copyFile path (outputFilename mn "foreign.js"))
+ src/Language/PureScript/Make/BuildPlan.hs view
@@ -0,0 +1,216 @@+module Language.PureScript.Make.BuildPlan+ ( BuildPlan(bpEnv, bpIndex)+ , BuildJobResult(..)+ , buildJobSuccess+ , construct+ , getResult+ , collectResults+ , markComplete+ , needsRebuild+ ) where++import Prelude++import Control.Concurrent.Async.Lifted as A+import Control.Concurrent.Lifted as C+import Control.Monad.Base (liftBase)+import Control.Monad (foldM)+import Control.Monad.Trans.Control (MonadBaseControl(..))+import Control.Monad.Trans.Maybe (MaybeT(..), runMaybeT)+import Data.Foldable (foldl')+import Data.Map qualified as M+import Data.Maybe (fromMaybe, mapMaybe)+import Data.Time.Clock (UTCTime)+import Language.PureScript.AST (Module, getModuleName)+import Language.PureScript.Crash (internalError)+import Language.PureScript.CST qualified as CST+import Language.PureScript.Errors (MultipleErrors(..))+import Language.PureScript.Externs (ExternsFile)+import Language.PureScript.Make.Actions as Actions+import Language.PureScript.Make.Cache (CacheDb, CacheInfo, checkChanged)+import Language.PureScript.Names (ModuleName)+import Language.PureScript.Sugar.Names.Env (Env, primEnv)+import System.Directory (getCurrentDirectory)++-- | The BuildPlan tracks information about our build progress, and holds all+-- prebuilt modules for incremental builds.+data BuildPlan = BuildPlan+ { bpPrebuilt :: M.Map ModuleName Prebuilt+ , bpBuildJobs :: M.Map ModuleName BuildJob+ , bpEnv :: C.MVar Env+ , bpIndex :: C.MVar Int+ }++data Prebuilt = Prebuilt+ { pbModificationTime :: UTCTime+ , pbExternsFile :: ExternsFile+ }++newtype BuildJob = BuildJob+ { bjResult :: C.MVar BuildJobResult+ -- ^ Note: an empty MVar indicates that the build job has not yet finished.+ }++data BuildJobResult+ = BuildJobSucceeded !MultipleErrors !ExternsFile+ -- ^ Succeeded, with warnings and externs+ --+ | BuildJobFailed !MultipleErrors+ -- ^ Failed, with errors++ | BuildJobSkipped+ -- ^ The build job was not run, because an upstream build job failed++buildJobSuccess :: BuildJobResult -> Maybe (MultipleErrors, ExternsFile)+buildJobSuccess (BuildJobSucceeded warnings externs) = Just (warnings, externs)+buildJobSuccess _ = Nothing++-- | Information obtained about a particular module while constructing a build+-- plan; used to decide whether a module needs rebuilding.+data RebuildStatus = RebuildStatus+ { statusModuleName :: ModuleName+ , statusRebuildNever :: Bool+ , statusNewCacheInfo :: Maybe CacheInfo+ -- ^ New cache info for this module which should be stored for subsequent+ -- incremental builds. A value of Nothing indicates that cache info for+ -- this module should not be stored in the build cache, because it is being+ -- rebuilt according to a RebuildPolicy instead.+ , statusPrebuilt :: Maybe Prebuilt+ -- ^ Prebuilt externs and timestamp for this module, if any.+ }++-- | Called when we finished compiling a module and want to report back the+-- compilation result, as well as any potential errors that were thrown.+markComplete+ :: (MonadBaseControl IO m)+ => BuildPlan+ -> ModuleName+ -> BuildJobResult+ -> m ()+markComplete buildPlan moduleName result = do+ let BuildJob rVar = fromMaybe (internalError "make: markComplete no barrier") $ M.lookup moduleName (bpBuildJobs buildPlan)+ putMVar rVar result++-- | Whether or not the module with the given ModuleName needs to be rebuilt+needsRebuild :: BuildPlan -> ModuleName -> Bool+needsRebuild bp moduleName = M.member moduleName (bpBuildJobs bp)++-- | Collects results for all prebuilt as well as rebuilt modules. This will+-- block until all build jobs are finished. Prebuilt modules always return no+-- warnings.+collectResults+ :: (MonadBaseControl IO m)+ => BuildPlan+ -> m (M.Map ModuleName BuildJobResult)+collectResults buildPlan = do+ let prebuiltResults = M.map (BuildJobSucceeded (MultipleErrors []) . pbExternsFile) (bpPrebuilt buildPlan)+ barrierResults <- traverse (readMVar . bjResult) $ bpBuildJobs buildPlan+ pure (M.union prebuiltResults barrierResults)++-- | Gets the the build result for a given module name independent of whether it+-- was rebuilt or prebuilt. Prebuilt modules always return no warnings.+getResult+ :: (MonadBaseControl IO m)+ => BuildPlan+ -> ModuleName+ -> m (Maybe (MultipleErrors, ExternsFile))+getResult buildPlan moduleName =+ case M.lookup moduleName (bpPrebuilt buildPlan) of+ Just es ->+ pure (Just (MultipleErrors [], pbExternsFile es))+ Nothing -> do+ r <- readMVar $ bjResult $ fromMaybe (internalError "make: no barrier") $ M.lookup moduleName (bpBuildJobs buildPlan)+ pure $ buildJobSuccess r++-- | Constructs a BuildPlan for the given module graph.+--+-- The given MakeActions are used to collect various timestamps in order to+-- determine whether a module needs rebuilding.+construct+ :: forall m. MonadBaseControl IO m+ => MakeActions m+ -> CacheDb+ -> ([CST.PartialResult Module], [(ModuleName, [ModuleName])])+ -> m (BuildPlan, CacheDb)+construct MakeActions{..} cacheDb (sorted, graph) = do+ let sortedModuleNames = map (getModuleName . CST.resPartial) sorted+ rebuildStatuses <- A.forConcurrently sortedModuleNames getRebuildStatus+ let prebuilt =+ foldl' collectPrebuiltModules M.empty $+ mapMaybe (\s -> (statusModuleName s, statusRebuildNever s,) <$> statusPrebuilt s) rebuildStatuses+ let toBeRebuilt = filter (not . flip M.member prebuilt) sortedModuleNames+ buildJobs <- foldM makeBuildJob M.empty toBeRebuilt+ env <- C.newMVar primEnv+ idx <- C.newMVar 1+ pure+ ( BuildPlan prebuilt buildJobs env idx+ , let+ update = flip $ \s ->+ M.alter (const (statusNewCacheInfo s)) (statusModuleName s)+ in+ foldl' update cacheDb rebuildStatuses+ )+ where+ makeBuildJob prev moduleName = do+ buildJob <- BuildJob <$> C.newEmptyMVar+ pure (M.insert moduleName buildJob prev)++ getRebuildStatus :: ModuleName -> m RebuildStatus+ getRebuildStatus moduleName = do+ inputInfo <- getInputTimestampsAndHashes moduleName+ case inputInfo of+ Left RebuildNever -> do+ prebuilt <- findExistingExtern moduleName+ pure (RebuildStatus+ { statusModuleName = moduleName+ , statusRebuildNever = True+ , statusPrebuilt = prebuilt+ , statusNewCacheInfo = Nothing+ })+ Left RebuildAlways -> do+ pure (RebuildStatus+ { statusModuleName = moduleName+ , statusRebuildNever = False+ , statusPrebuilt = Nothing+ , statusNewCacheInfo = Nothing+ })+ Right cacheInfo -> do+ cwd <- liftBase getCurrentDirectory+ (newCacheInfo, isUpToDate) <- checkChanged cacheDb moduleName cwd cacheInfo+ prebuilt <-+ if isUpToDate+ then findExistingExtern moduleName+ else pure Nothing+ pure (RebuildStatus+ { statusModuleName = moduleName+ , statusRebuildNever = False+ , statusPrebuilt = prebuilt+ , statusNewCacheInfo = Just newCacheInfo+ })++ findExistingExtern :: ModuleName -> m (Maybe Prebuilt)+ findExistingExtern moduleName = runMaybeT $ do+ timestamp <- MaybeT $ getOutputTimestamp moduleName+ externs <- MaybeT $ snd <$> readExterns moduleName+ pure (Prebuilt timestamp externs)++ collectPrebuiltModules :: M.Map ModuleName Prebuilt -> (ModuleName, Bool, Prebuilt) -> M.Map ModuleName Prebuilt+ collectPrebuiltModules prev (moduleName, rebuildNever, pb)+ | rebuildNever = M.insert moduleName pb prev+ | otherwise = do+ let deps = fromMaybe (internalError "make: module not found in dependency graph.") (lookup moduleName graph)+ case traverse (fmap pbModificationTime . flip M.lookup prev) deps of+ Nothing ->+ -- If we end up here, one of the dependencies didn't exist in the+ -- prebuilt map and so we know a dependency needs to be rebuilt, which+ -- means we need to be rebuilt in turn.+ prev+ Just modTimes ->+ case maximumMaybe modTimes of+ Just depModTime | pbModificationTime pb < depModTime ->+ prev+ _ -> M.insert moduleName pb prev++maximumMaybe :: Ord a => [a] -> Maybe a+maximumMaybe [] = Nothing+maximumMaybe xs = Just $ maximum xs
+ src/Language/PureScript/Make/Cache.hs view
@@ -0,0 +1,149 @@+module Language.PureScript.Make.Cache+ ( ContentHash+ , hash+ , CacheDb+ , CacheInfo(..)+ , checkChanged+ , removeModules+ , normaliseForCache+ ) where++import Prelude++import Control.Category ((>>>))+import Control.Monad ((>=>))+import Crypto.Hash (HashAlgorithm, Digest, SHA512)+import Crypto.Hash qualified as Hash+import Data.Aeson qualified as Aeson+import Data.Align (align)+import Data.ByteArray.Encoding (Base(Base16), convertToBase, convertFromBase)+import Data.ByteString qualified as BS+import Data.Map (Map)+import Data.Map qualified as Map+import Data.Maybe (fromMaybe)+import Data.Monoid (All(..))+import Data.Set (Set)+import Data.Text (Text)+import Data.Text.Encoding (encodeUtf8, decodeUtf8)+import Data.These (These(..))+import Data.Time.Clock (UTCTime)+import Data.Traversable (for)+import System.FilePath qualified as FilePath++import Language.PureScript.Names (ModuleName)++digestToHex :: Digest a -> Text+digestToHex = decodeUtf8 . convertToBase Base16++digestFromHex :: forall a. HashAlgorithm a => Text -> Maybe (Digest a)+digestFromHex =+ encodeUtf8+ >>> either (const Nothing) Just . convertFromBase Base16+ >=> (Hash.digestFromByteString :: BS.ByteString -> Maybe (Digest a))++-- | Defines the hash algorithm we use for cache invalidation of input files.+newtype ContentHash = ContentHash+ { unContentHash :: Digest SHA512 }+ deriving (Show, Eq, Ord)++instance Aeson.ToJSON ContentHash where+ toJSON = Aeson.toJSON . digestToHex . unContentHash++instance Aeson.FromJSON ContentHash where+ parseJSON x = do+ str <- Aeson.parseJSON x+ case digestFromHex str of+ Just digest ->+ pure $ ContentHash digest+ Nothing ->+ fail "Unable to decode ContentHash"++hash :: BS.ByteString -> ContentHash+hash = ContentHash . Hash.hash++type CacheDb = Map ModuleName CacheInfo++-- | A CacheInfo contains all of the information we need to store about a+-- particular module in the cache database.+newtype CacheInfo = CacheInfo+ { unCacheInfo :: Map FilePath (UTCTime, ContentHash) }+ deriving stock (Show)+ deriving newtype (Eq, Ord, Semigroup, Monoid, Aeson.FromJSON, Aeson.ToJSON)++-- | Given a module name, and a map containing the associated input files+-- together with current metadata i.e. timestamps and hashes, check whether the+-- input files have changed, based on comparing with the database stored in the+-- monadic state.+--+-- The CacheInfo in the return value should be stored in the cache for future+-- builds.+--+-- The Bool in the return value indicates whether it is safe to use existing+-- build artifacts for this module, at least based on the timestamps and hashes+-- of the module's input files.+--+-- If the timestamps are the same as those in the database, assume the file is+-- unchanged, and return True without checking hashes.+--+-- If any of the timestamps differ from what is in the database, check the+-- hashes of those files. In this case, update the database with any changed+-- timestamps and hashes, and return True if and only if all of the hashes are+-- unchanged.+checkChanged+ :: Monad m+ => CacheDb+ -> ModuleName+ -> FilePath+ -> Map FilePath (UTCTime, m ContentHash)+ -> m (CacheInfo, Bool)+checkChanged cacheDb mn basePath currentInfo = do++ let dbInfo = unCacheInfo $ fromMaybe mempty (Map.lookup mn cacheDb)+ (newInfo, isUpToDate) <-+ fmap mconcat $+ for (Map.toList (align dbInfo currentInfo)) $ \(normaliseForCache basePath -> fp, aligned) -> do+ case aligned of+ This _ -> do+ -- One of the input files listed in the cache no longer exists;+ -- remove that file from the cache and note that the module needs+ -- rebuilding+ pure (Map.empty, All False)+ That (timestamp, getHash) -> do+ -- The module has a new input file; add it to the cache and+ -- note that the module needs rebuilding.+ newHash <- getHash+ pure (Map.singleton fp (timestamp, newHash), All False)+ These db@(dbTimestamp, _) (newTimestamp, _) | dbTimestamp == newTimestamp -> do+ -- This file exists both currently and in the cache database,+ -- and the timestamp is unchanged, so we skip checking the+ -- hash.+ pure (Map.singleton fp db, mempty)+ These (_, dbHash) (newTimestamp, getHash) -> do+ -- This file exists both currently and in the cache database,+ -- but the timestamp has changed, so we need to check the hash.+ newHash <- getHash+ pure (Map.singleton fp (newTimestamp, newHash), All (dbHash == newHash))++ pure (CacheInfo newInfo, getAll isUpToDate)++-- | Remove any modules from the given set from the cache database; used when+-- they failed to build.+removeModules :: Set ModuleName -> CacheDb -> CacheDb+removeModules = flip Map.withoutKeys++-- | 1. Any path that is beneath our current working directory will be+-- stored as a normalised relative path+-- 2. Any path that isn't will be stored as an absolute path+normaliseForCache :: FilePath -> FilePath -> FilePath+normaliseForCache basePath fp =+ if FilePath.isRelative fp then+ FilePath.normalise fp+ else+ let relativePath = FilePath.makeRelative basePath fp in+ if FilePath.isRelative relativePath then+ FilePath.normalise relativePath+ else+ -- If the path is still absolute after trying to make it+ -- relative to the base that means it is not underneath+ -- the base path+ FilePath.normalise fp
+ src/Language/PureScript/Make/Monad.hs view
@@ -0,0 +1,187 @@+module Language.PureScript.Make.Monad+ ( -- * Implementation of Make API using files on disk+ Make(..)+ , runMake+ , makeIO+ , getTimestamp+ , getTimestampMaybe+ , readTextFile+ , readJSONFile+ , readJSONFileIO+ , readCborFile+ , readCborFileIO+ , readExternsFile+ , hashFile+ , writeTextFile+ , writeJSONFile+ , writeCborFile+ , writeCborFileIO+ , copyFile+ ) where++import Prelude++import Codec.Serialise (Serialise)+import Codec.Serialise qualified as Serialise+import Control.Exception (fromException, tryJust, Exception (displayException))+import Control.Monad (join, guard)+import Control.Monad.Base (MonadBase(..))+import Control.Monad.Error.Class (MonadError(..))+import Control.Monad.IO.Class (MonadIO(..))+import Control.Monad.Logger (Logger, runLogger')+import Control.Monad.Reader (MonadReader(..), ReaderT(..))+import Control.Monad.Trans.Control (MonadBaseControl(..))+import Control.Monad.Trans.Except (ExceptT, runExceptT)+import Control.Monad.Writer.Class (MonadWriter(..))+import Data.Aeson qualified as Aeson+import Data.ByteString qualified as B+import Data.Text (Text)+import Data.Text qualified as Text+import Data.Time.Clock (UTCTime)+import Language.PureScript.Errors (ErrorMessage(..), MultipleErrors, SimpleErrorMessage(..), singleError)+import Language.PureScript.Externs (ExternsFile, externsIsCurrentVersion)+import Language.PureScript.Make.Cache (ContentHash, hash)+import Language.PureScript.Options (Options)+import System.Directory (createDirectoryIfMissing, getModificationTime)+import System.Directory qualified as Directory+import System.FilePath (takeDirectory)+import System.IO.Error (tryIOError, isDoesNotExistError)+import System.IO.UTF8 (readUTF8FileT)++-- | A monad for running make actions+newtype Make a = Make+ { unMake :: ReaderT Options (ExceptT MultipleErrors (Logger MultipleErrors)) a+ } deriving (Functor, Applicative, Monad, MonadIO, MonadError MultipleErrors, MonadWriter MultipleErrors, MonadReader Options)++instance MonadBase IO Make where+ liftBase = liftIO++instance MonadBaseControl IO Make where+ type StM Make a = Either MultipleErrors a+ liftBaseWith f = Make $ liftBaseWith $ \q -> f (q . unMake)+ restoreM = Make . restoreM++-- | Execute a 'Make' monad, returning either errors, or the result of the compile plus any warnings.+runMake :: Options -> Make a -> IO (Either MultipleErrors a, MultipleErrors)+runMake opts = runLogger' . runExceptT . flip runReaderT opts . unMake++-- | Run an 'IO' action in the 'Make' monad. The 'String' argument should+-- describe what we were trying to do; it is used for rendering errors in the+-- case that an IOException is thrown.+makeIO :: (MonadIO m, MonadError MultipleErrors m) => Text -> IO a -> m a+makeIO description io = do+ res <- liftIO (tryIOError io)+ either (throwError . singleError . ErrorMessage [] . FileIOError description . Text.pack . displayException) pure res++-- | Get a file's modification time in the 'Make' monad, capturing any errors+-- using the 'MonadError' instance.+getTimestamp :: (MonadIO m, MonadError MultipleErrors m) => FilePath -> m UTCTime+getTimestamp path =+ makeIO ("get a timestamp for file: " <> Text.pack path) $ getModificationTime path++-- | Get a file's modification time in the 'Make' monad, returning Nothing if+-- the file does not exist.+getTimestampMaybe :: (MonadIO m, MonadError MultipleErrors m) => FilePath -> m (Maybe UTCTime)+getTimestampMaybe path =+ makeIO ("get a timestamp for file: " <> Text.pack path) $ catchDoesNotExist $ getModificationTime path++-- | Read a text file strictly in the 'Make' monad, capturing any errors using+-- the 'MonadError' instance.+readTextFile :: (MonadIO m, MonadError MultipleErrors m) => FilePath -> m Text+readTextFile path =+ makeIO ("read file: " <> Text.pack path) $+ readUTF8FileT path++-- | Read a JSON file in the 'Make' monad, returning 'Nothing' if the file does+-- not exist or could not be parsed. Errors are captured using the 'MonadError'+-- instance.+readJSONFile :: (MonadIO m, MonadError MultipleErrors m) => Aeson.FromJSON a => FilePath -> m (Maybe a)+readJSONFile path =+ makeIO ("read JSON file: " <> Text.pack path) (readJSONFileIO path)++readJSONFileIO :: Aeson.FromJSON a => FilePath -> IO (Maybe a)+readJSONFileIO path = do+ r <- catchDoesNotExist $ Aeson.decodeFileStrict' path+ return $ join r++-- | Read a Cbor encoded file in the 'Make' monad, returning+-- 'Nothing' if the file does not exist or could not be parsed. Errors+-- are captured using the 'MonadError' instance.+readCborFile :: (MonadIO m, MonadError MultipleErrors m) => Serialise a => FilePath -> m (Maybe a)+readCborFile path =+ makeIO ("read Binary file: " <> Text.pack path) (readCborFileIO path)++readCborFileIO :: Serialise a => FilePath -> IO (Maybe a)+readCborFileIO path = do+ r <- catchDoesNotExist $ catchDeserialiseFailure $ Serialise.readFileDeserialise path+ return (join r)++-- | Read an externs file, returning 'Nothing' if the file does not exist,+-- could not be parsed, or was generated by a different version of the+-- compiler.+readExternsFile :: (MonadIO m, MonadError MultipleErrors m) => FilePath -> m (Maybe ExternsFile)+readExternsFile path = do+ mexterns <- readCborFile path+ return $ do+ externs <- mexterns+ guard $ externsIsCurrentVersion externs+ return externs++hashFile :: (MonadIO m, MonadError MultipleErrors m) => FilePath -> m ContentHash+hashFile path = do+ makeIO ("hash file: " <> Text.pack path)+ (hash <$> B.readFile path)++-- | If the provided action threw an 'isDoesNotExist' error, catch it and+-- return Nothing. Otherwise return Just the result of the inner action.+catchDoesNotExist :: IO a -> IO (Maybe a)+catchDoesNotExist inner = do+ r <- tryJust (guard . isDoesNotExistError) inner+ case r of+ Left () ->+ return Nothing+ Right x ->+ return (Just x)++catchDeserialiseFailure :: IO a -> IO (Maybe a)+catchDeserialiseFailure inner = do+ r <- tryJust fromException inner+ case r of+ Left (_ :: Serialise.DeserialiseFailure) ->+ return Nothing+ Right x ->+ return (Just x)++-- | Write a text file in the 'Make' monad, capturing any errors using the+-- 'MonadError' instance.+writeTextFile :: FilePath -> B.ByteString -> Make ()+writeTextFile path text = makeIO ("write file: " <> Text.pack path) $ do+ createParentDirectory path+ B.writeFile path text++-- | Write a JSON file in the 'Make' monad, capturing any errors using the+-- 'MonadError' instance.+writeJSONFile :: (MonadIO m, MonadError MultipleErrors m) => Aeson.ToJSON a => FilePath -> a -> m ()+writeJSONFile path value = makeIO ("write JSON file: " <> Text.pack path) $ do+ createParentDirectory path+ Aeson.encodeFile path value++writeCborFile :: (MonadIO m, MonadError MultipleErrors m) => Serialise a => FilePath -> a -> m ()+writeCborFile path value =+ makeIO ("write Cbor file: " <> Text.pack path) (writeCborFileIO path value)++writeCborFileIO :: Serialise a => FilePath -> a -> IO ()+writeCborFileIO path value = do+ createParentDirectory path+ Serialise.writeFileSerialise path value++-- | Copy a file in the 'Make' monad, capturing any errors using the+-- 'MonadError' instance.+copyFile :: (MonadIO m, MonadError MultipleErrors m) => FilePath -> FilePath -> m ()+copyFile src dest =+ makeIO ("copy file: " <> Text.pack src <> " -> " <> Text.pack dest) $ do+ createParentDirectory dest+ Directory.copyFile src dest++createParentDirectory :: FilePath -> IO ()+createParentDirectory = createDirectoryIfMissing True . takeDirectory
src/Language/PureScript/ModuleDependencies.hs view
@@ -1,76 +1,89 @@------------------------------------------------------------------------------------ Module : Language.PureScript.ModuleDependencies--- Copyright : (c) Phil Freeman 2013--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :--- -- | Provides the ability to sort modules based on module dependencies-----------------------------------------------------------------------------------{-# LANGUAGE FlexibleContexts #-}+module Language.PureScript.ModuleDependencies+ ( DependencyDepth(..)+ , sortModules+ , ModuleGraph+ , ModuleSignature(..)+ , moduleSignature+ ) where -module Language.PureScript.ModuleDependencies (- sortModules,- ModuleGraph-) where+import Protolude hiding (head) -import Control.Monad.Except+import Data.Array ((!))+import Data.Graph (SCC(..), graphFromEdges, reachable, stronglyConnComp)+import Data.Set qualified as S+import Language.PureScript.AST (Declaration(..), ErrorMessageHint(..), Module(..), SourceSpan)+import Language.PureScript.Constants.Prim qualified as C+import Language.PureScript.Crash (internalError)+import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage(..), addHint, errorMessage', errorMessage'', parU)+import Language.PureScript.Names (ModuleName) -import Data.Graph-import Data.List (nub)-import Data.Maybe (mapMaybe)+-- | A list of modules with their transitive dependencies+type ModuleGraph = [(ModuleName, [ModuleName])] -import Language.PureScript.AST-import Language.PureScript.Names-import Language.PureScript.Types+-- | A module signature for sorting dependencies.+data ModuleSignature = ModuleSignature+ { sigSourceSpan :: SourceSpan+ , sigModuleName :: ModuleName+ , sigImports :: [(ModuleName, SourceSpan)]+ } --- |--- A list of modules with their dependencies----type ModuleGraph = [(ModuleName, [ModuleName])]+data DependencyDepth = Direct | Transitive --- |--- Sort a collection of modules based on module dependencies.+-- | Sort a collection of modules based on module dependencies. -- -- Reports an error if the module graph contains a cycle.----sortModules :: (MonadError String m) => [Module] -> m ([Module], ModuleGraph)-sortModules ms = do- let verts = map (\m@(Module _ _ ds _) -> (m, getModuleName m, nub (concatMap usedModules ds))) ms- ms' <- mapM toModule $ stronglyConnComp verts- let moduleGraph = map (\(_, mn, deps) -> (mn, deps)) verts- return (ms', moduleGraph)---- |--- Calculate a list of used modules based on explicit imports and qualified names----usedModules :: Declaration -> [ModuleName]-usedModules = let (f, _, _, _, _) = everythingOnValues (++) forDecls forValues (const []) (const []) (const []) in nub . f+sortModules+ :: forall m a+ . MonadError MultipleErrors m+ => DependencyDepth+ -> (a -> ModuleSignature)+ -> [a]+ -> m ([a], ModuleGraph)+sortModules dependencyDepth toSig ms = do+ let+ ms' = (\m -> (m, toSig m)) <$> ms+ mns = S.fromList $ map (sigModuleName . snd) ms'+ verts <- parU ms' (toGraphNode mns)+ ms'' <- parU (stronglyConnComp verts) toModule+ let (graph, fromVertex, toVertex) = graphFromEdges verts+ moduleGraph = do (_, mn, _) <- verts+ let v = fromMaybe (internalError "sortModules: vertex not found") (toVertex mn)+ deps = case dependencyDepth of+ Direct -> graph ! v+ Transitive -> reachable graph v+ toKey i = case fromVertex i of (_, key, _) -> key+ return (mn, filter (/= mn) (map toKey deps))+ return (fst <$> ms'', moduleGraph) where- forDecls :: Declaration -> [ModuleName]- forDecls (ImportDeclaration mn _ _) = [mn]- forDecls _ = []-- forValues :: Expr -> [ModuleName]- forValues (Var (Qualified (Just mn) _)) = [mn]- forValues (Constructor (Qualified (Just mn) _)) = [mn]- forValues (TypedValue _ _ ty) = forTypes ty- forValues _ = []+ toGraphNode :: S.Set ModuleName -> (a, ModuleSignature) -> m ((a, ModuleSignature), ModuleName, [ModuleName])+ toGraphNode mns m@(_, ModuleSignature _ mn deps) = do+ void . parU deps $ \(dep, pos) ->+ when (dep `notElem` C.primModules && S.notMember dep mns) .+ throwError+ . addHint (ErrorInModule mn)+ . errorMessage' pos+ $ ModuleNotFound dep+ pure (m, mn, map fst deps) - forTypes :: Type -> [ModuleName]- forTypes (TypeConstructor (Qualified (Just mn) _)) = [mn]- forTypes (ConstrainedType cs _) = mapMaybe (\(Qualified mn _, _) -> mn) cs- forTypes _ = []+-- | Calculate a list of used modules based on explicit imports and qualified names.+usedModules :: Declaration -> Maybe (ModuleName, SourceSpan)+-- Regardless of whether an imported module is qualified we still need to+-- take into account its import to build an accurate list of dependencies.+usedModules (ImportDeclaration (ss, _) mn _ _) = pure (mn, ss)+usedModules _ = Nothing --- |--- Convert a strongly connected component of the module graph to a module----toModule :: (MonadError String m) => SCC Module -> m Module+-- | Convert a strongly connected component of the module graph to a module+toModule :: MonadError MultipleErrors m => SCC (a, ModuleSignature) -> m (a, ModuleSignature) toModule (AcyclicSCC m) = return m-toModule (CyclicSCC [m]) = return m-toModule (CyclicSCC ms) = throwError $ "Cycle in module dependencies: " ++ show (map getModuleName ms)+toModule (CyclicSCC ms) =+ case nonEmpty ms of+ Nothing ->+ internalError "toModule: empty CyclicSCC"+ Just ms' ->+ throwError+ . errorMessage'' (fmap (sigSourceSpan . snd) ms')+ $ CycleInModules (map (sigModuleName . snd) ms')++moduleSignature :: Module -> ModuleSignature+moduleSignature (Module ss _ mn ds _) = ModuleSignature ss mn (ordNub (mapMaybe usedModules ds))
src/Language/PureScript/Names.hs view
@@ -1,85 +1,322 @@------------------------------------------------------------------------------------ Module : Language.PureScript.Names--- Copyright : (c) Phil Freeman 2013--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :---+{-# LANGUAGE TemplateHaskell #-}+ -- | -- Data types for names --------------------------------------------------------------------------------+module Language.PureScript.Names where -{-# LANGUAGE DeriveDataTypeable, DeriveFunctor #-}+import Prelude -module Language.PureScript.Names where+import Codec.Serialise (Serialise)+import Control.Applicative ((<|>))+import Control.Monad.Supply.Class (MonadSupply(..))+import Control.DeepSeq (NFData)+import Data.Functor.Contravariant (contramap)+import Data.Vector qualified as V -import Data.List-import Data.Data+import GHC.Generics (Generic)+import Data.Aeson (FromJSON(..), FromJSONKey(..), Options(..), SumEncoding(..), ToJSON(..), ToJSONKey(..), defaultOptions, parseJSON2, toJSON2, withArray)+import Data.Aeson.TH (deriveJSON)+import Data.Text (Text)+import Data.Text qualified as T +import Language.PureScript.AST.SourcePos (SourcePos, pattern SourcePos)++-- | A sum of the possible name types, useful for error and lint messages.+data Name+ = IdentName Ident+ | ValOpName (OpName 'ValueOpName)+ | TyName (ProperName 'TypeName)+ | TyOpName (OpName 'TypeOpName)+ | DctorName (ProperName 'ConstructorName)+ | TyClassName (ProperName 'ClassName)+ | ModName ModuleName+ deriving (Eq, Ord, Show, Generic)++instance NFData Name+instance Serialise Name++getIdentName :: Name -> Maybe Ident+getIdentName (IdentName name) = Just name+getIdentName _ = Nothing++getValOpName :: Name -> Maybe (OpName 'ValueOpName)+getValOpName (ValOpName name) = Just name+getValOpName _ = Nothing++getTypeName :: Name -> Maybe (ProperName 'TypeName)+getTypeName (TyName name) = Just name+getTypeName _ = Nothing++getTypeOpName :: Name -> Maybe (OpName 'TypeOpName)+getTypeOpName (TyOpName name) = Just name+getTypeOpName _ = Nothing++getDctorName :: Name -> Maybe (ProperName 'ConstructorName)+getDctorName (DctorName name) = Just name+getDctorName _ = Nothing++getClassName :: Name -> Maybe (ProperName 'ClassName)+getClassName (TyClassName name) = Just name+getClassName _ = Nothing+ -- |+-- This type is meant to be extended with any new uses for idents that come+-- along. Adding constructors to this type is cheaper than adding them to+-- `Ident` because functions that match on `Ident` can ignore all+-- `InternalIdent`s with a single pattern, and thus don't have to change if+-- a new `InternalIdentData` constructor is created.+--+data InternalIdentData+ -- Used by CoreFn.Laziness+ = RuntimeLazyFactory | Lazy !Text+ deriving (Show, Eq, Ord, Generic)++instance NFData InternalIdentData+instance Serialise InternalIdentData++-- | -- Names for value identifiers -- data Ident -- | -- An alphanumeric identifier --- = Ident String+ = Ident Text -- |- -- A symbolic name for an infix operator+ -- A generated name for an identifier --- | Op String deriving (Eq, Ord, Data, Typeable)+ | GenIdent (Maybe Text) Integer+ -- |+ -- A generated name used only for type-checking+ --+ | UnusedIdent+ -- |+ -- A generated name used only for internal transformations+ --+ | InternalIdent !InternalIdentData+ deriving (Show, Eq, Ord, Generic) -runIdent :: Ident -> String+instance NFData Ident+instance Serialise Ident++unusedIdent :: Text+unusedIdent = "$__unused"++runIdent :: Ident -> Text runIdent (Ident i) = i-runIdent (Op op) = op+runIdent (GenIdent Nothing n) = "$" <> T.pack (show n)+runIdent (GenIdent (Just name) n) = "$" <> name <> T.pack (show n)+runIdent UnusedIdent = unusedIdent+runIdent InternalIdent{} = error "unexpected InternalIdent" -instance Show Ident where- show (Ident s) = s- show (Op op) = '(':op ++ ")"+showIdent :: Ident -> Text+showIdent = runIdent +freshIdent :: MonadSupply m => Text -> m Ident+freshIdent name = GenIdent (Just name) <$> fresh++freshIdent' :: MonadSupply m => m Ident+freshIdent' = GenIdent Nothing <$> fresh++isPlainIdent :: Ident -> Bool+isPlainIdent Ident{} = True+isPlainIdent _ = False+ -- |+-- Operator alias names.+--+newtype OpName (a :: OpNameType) = OpName { runOpName :: Text }+ deriving (Show, Eq, Ord, Generic)++instance NFData (OpName a)+instance Serialise (OpName a)++instance ToJSON (OpName a) where+ toJSON = toJSON . runOpName++instance FromJSON (OpName a) where+ parseJSON = fmap OpName . parseJSON++showOp :: OpName a -> Text+showOp op = "(" <> runOpName op <> ")"++-- |+-- The closed set of operator alias types.+--+data OpNameType = ValueOpName | TypeOpName | AnyOpName++eraseOpName :: OpName a -> OpName 'AnyOpName+eraseOpName = OpName . runOpName++coerceOpName :: OpName a -> OpName b+coerceOpName = OpName . runOpName++-- | -- Proper names, i.e. capitalized names for e.g. module names, type//data constructors. ---newtype ProperName = ProperName { runProperName :: String } deriving (Eq, Ord, Data, Typeable)+newtype ProperName (a :: ProperNameType) = ProperName { runProperName :: Text }+ deriving (Show, Eq, Ord, Generic) -instance Show ProperName where- show = runProperName+instance NFData (ProperName a)+instance Serialise (ProperName a) +instance ToJSON (ProperName a) where+ toJSON = toJSON . runProperName++instance FromJSON (ProperName a) where+ parseJSON = fmap ProperName . parseJSON+ -- |+-- The closed set of proper name types.+--+data ProperNameType+ = TypeName+ | ConstructorName+ | ClassName+ | Namespace++-- |+-- Coerces a ProperName from one ProperNameType to another. This should be used+-- with care, and is primarily used to convert ClassNames into TypeNames after+-- classes have been desugared.+--+coerceProperName :: ProperName a -> ProperName b+coerceProperName = ProperName . runProperName++-- | -- Module names ---data ModuleName = ModuleName [ProperName] deriving (Eq, Ord, Data, Typeable)+newtype ModuleName = ModuleName Text+ deriving (Show, Eq, Ord, Generic)+ deriving newtype Serialise -runModuleName :: ModuleName -> String-runModuleName (ModuleName pns) = intercalate "." (runProperName `map` pns)+instance NFData ModuleName -moduleNameFromString :: String -> ModuleName-moduleNameFromString = ModuleName . splitProperNames- where- splitProperNames s = case dropWhile (== '.') s of- "" -> []- s' -> ProperName w : splitProperNames s''- where (w, s'') = break (== '.') s'+runModuleName :: ModuleName -> Text+runModuleName (ModuleName name) = name -instance Show ModuleName where- show = runModuleName+moduleNameFromString :: Text -> ModuleName+moduleNameFromString = ModuleName +isBuiltinModuleName :: ModuleName -> Bool+isBuiltinModuleName (ModuleName mn) = mn == "Prim" || "Prim." `T.isPrefixOf` mn++data QualifiedBy+ = BySourcePos SourcePos+ | ByModuleName ModuleName+ deriving (Show, Eq, Ord, Generic)++pattern ByNullSourcePos :: QualifiedBy+pattern ByNullSourcePos = BySourcePos (SourcePos 0 0)++instance NFData QualifiedBy+instance Serialise QualifiedBy++isBySourcePos :: QualifiedBy -> Bool+isBySourcePos (BySourcePos _) = True+isBySourcePos _ = False++byMaybeModuleName :: Maybe ModuleName -> QualifiedBy+byMaybeModuleName (Just mn) = ByModuleName mn+byMaybeModuleName Nothing = ByNullSourcePos++toMaybeModuleName :: QualifiedBy -> Maybe ModuleName+toMaybeModuleName (ByModuleName mn) = Just mn+toMaybeModuleName (BySourcePos _) = Nothing+ -- | -- A qualified name, i.e. a name with an optional module name ---data Qualified a = Qualified (Maybe ModuleName) a deriving (Eq, Ord, Data, Typeable, Functor)+data Qualified a = Qualified QualifiedBy a+ deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic) -instance (Show a) => Show (Qualified a) where- show (Qualified Nothing a) = show a- show (Qualified (Just name) a) = show name ++ "." ++ show a+instance NFData a => NFData (Qualified a)+instance Serialise a => Serialise (Qualified a) +showQualified :: (a -> Text) -> Qualified a -> Text+showQualified f (Qualified (BySourcePos _) a) = f a+showQualified f (Qualified (ByModuleName name) a) = runModuleName name <> "." <> f a++getQual :: Qualified a -> Maybe ModuleName+getQual (Qualified qb _) = toMaybeModuleName qb+ -- | -- Provide a default module name, if a name is unqualified -- qualify :: ModuleName -> Qualified a -> (ModuleName, a)-qualify m (Qualified Nothing a) = (m, a)-qualify _ (Qualified (Just m) a) = (m, a)+qualify m (Qualified (BySourcePos _) a) = (m, a)+qualify _ (Qualified (ByModuleName m) a) = (m, a)++-- |+-- Makes a qualified value from a name and module name.+--+mkQualified :: a -> ModuleName -> Qualified a+mkQualified name mn = Qualified (ByModuleName mn) name++-- | Remove the module name from a qualified name+disqualify :: Qualified a -> a+disqualify (Qualified _ a) = a++-- |+-- Remove the qualification from a value when it is qualified with a particular+-- module name.+--+disqualifyFor :: Maybe ModuleName -> Qualified a -> Maybe a+disqualifyFor mn (Qualified qb a) | mn == toMaybeModuleName qb = Just a+disqualifyFor _ _ = Nothing++-- |+-- Checks whether a qualified value is actually qualified with a module reference+--+isQualified :: Qualified a -> Bool+isQualified (Qualified (BySourcePos _) _) = False+isQualified _ = True++-- |+-- Checks whether a qualified value is not actually qualified with a module reference+--+isUnqualified :: Qualified a -> Bool+isUnqualified = not . isQualified++-- |+-- Checks whether a qualified value is qualified with a particular module+--+isQualifiedWith :: ModuleName -> Qualified a -> Bool+isQualifiedWith mn (Qualified (ByModuleName mn') _) = mn == mn'+isQualifiedWith _ _ = False++instance ToJSON a => ToJSON (Qualified a) where+ toJSON (Qualified qb a) = case qb of+ ByModuleName mn -> toJSON2 (mn, a)+ BySourcePos ss -> toJSON2 (ss, a)++instance FromJSON a => FromJSON (Qualified a) where+ parseJSON v = byModule <|> bySourcePos <|> byMaybeModuleName'+ where+ byModule = do+ (mn, a) <- parseJSON2 v+ pure $ Qualified (ByModuleName mn) a+ bySourcePos = do+ (ss, a) <- parseJSON2 v+ pure $ Qualified (BySourcePos ss) a+ byMaybeModuleName' = do+ (mn, a) <- parseJSON2 v+ pure $ Qualified (byMaybeModuleName mn) a++instance ToJSON ModuleName where+ toJSON (ModuleName name) = toJSON (T.splitOn "." name)++instance FromJSON ModuleName where+ parseJSON = withArray "ModuleName" $ \names -> do+ names' <- traverse parseJSON names+ pure (ModuleName (T.intercalate "." (V.toList names')))++instance ToJSONKey ModuleName where+ toJSONKey = contramap runModuleName toJSONKey++instance FromJSONKey ModuleName where+ fromJSONKey = fmap moduleNameFromString fromJSONKey++$(deriveJSON (defaultOptions { sumEncoding = ObjectWithSingleField }) ''InternalIdentData)+$(deriveJSON (defaultOptions { sumEncoding = ObjectWithSingleField }) ''Ident)
src/Language/PureScript/Options.hs view
@@ -1,92 +1,32 @@------------------------------------------------------------------------------------ Module : Language.PureScript.Options--- Copyright : (c) Phil Freeman 2013--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ |--- The data type of compiler options-----------------------------------------------------------------------------------{-# LANGUAGE GADTs, DataKinds, StandaloneDeriving #-}-+-- | The data type of compiler options module Language.PureScript.Options where --- |--- Indicates the mode of the compiler. Lifted using DataKinds to refine the Options type.----data Mode = Compile | Make---- |--- Per-mode options----data ModeOptions mode where- CompileOptions :: String -> [String] -> [String] -> ModeOptions Compile- MakeOptions :: ModeOptions Make--browserNamespace :: ModeOptions Compile -> String-browserNamespace (CompileOptions ns _ _) = ns--entryPointModules :: ModeOptions Compile -> [String]-entryPointModules (CompileOptions _ ms _) = ms--codeGenModules :: ModeOptions Compile -> [String]-codeGenModules (CompileOptions _ _ ms) = ms--deriving instance Show (ModeOptions mode)+import Prelude+import Data.Set qualified as S+import Data.Map (Map)+import Data.Map qualified as Map --- |--- The data type of compiler options----data Options mode = Options {- -- |- -- Disable inclusion of the built in Prelude- --- optionsNoPrelude :: Bool- -- |- -- Disable tail-call elimination- --- , optionsNoTco :: Bool- -- |- -- Disable inlining of calls to return and bind for the Eff monad- --- , optionsNoMagicDo :: Bool- -- |- -- When specified, checks the type of `main` in the module, and generate a call to run main- -- after the module definitions.- --- , optionsMain :: Maybe String- -- |- -- Skip all optimizations- --- , optionsNoOptimizations :: Bool- -- |- -- Verbose error message- --- , optionsVerboseErrors :: Bool- -- |- -- Remove the comments from the generated js+-- | The data type of compiler options+data Options = Options+ { optionsVerboseErrors :: Bool+ -- ^ Verbose error message , optionsNoComments :: Bool- -- |- -- Specify the namespace that PureScript modules will be exported to when running in the- -- browser.- --- , optionsAdditional :: ModeOptions mode+ -- ^ Remove the comments from the generated js+ , optionsCodegenTargets :: S.Set CodegenTarget+ -- ^ Codegen targets (JS, CoreFn, etc.) } deriving Show --- |--- Default compiler options----defaultCompileOptions :: Options Compile-defaultCompileOptions = Options False False False Nothing False False False (CompileOptions "PS" [] [])---- | -- Default make options----defaultMakeOptions :: Options Make-defaultMakeOptions = Options False False False Nothing False False False MakeOptions+defaultOptions :: Options+defaultOptions = Options False False (S.singleton JS)++data CodegenTarget = JS | JSSourceMap | CoreFn | Docs+ deriving (Eq, Ord, Show)++codegenTargets :: Map String CodegenTarget+codegenTargets = Map.fromList+ [ ("js", JS)+ , ("sourcemaps", JSSourceMap)+ , ("corefn", CoreFn)+ , ("docs", Docs)+ ]
+ src/Language/PureScript/PSString.hs view
@@ -0,0 +1,240 @@+module Language.PureScript.PSString+ ( PSString+ , toUTF16CodeUnits+ , decodeString+ , decodeStringEither+ , decodeStringWithReplacement+ , prettyPrintString+ , prettyPrintStringJS+ , mkString+ ) where++import Prelude+import GHC.Generics (Generic)+import Codec.Serialise (Serialise)+import Control.DeepSeq (NFData)+import Control.Exception (try, evaluate)+import Control.Applicative ((<|>))+import Data.Char qualified as Char+import Data.Bits (shiftR)+import Data.Either (fromRight)+import Data.List (unfoldr)+import Data.Scientific (toBoundedInteger)+import Data.String (IsString(..))+import Data.ByteString (ByteString)+import Data.ByteString qualified as BS+import Data.Text (Text)+import Data.Text qualified as T+import Data.Text.Encoding (decodeUtf16BE)+import Data.Text.Encoding.Error (UnicodeException)+import Data.Vector qualified as V+import Data.Word (Word16, Word8)+import Numeric (showHex)+import System.IO.Unsafe (unsafePerformIO)+import Data.Aeson qualified as A+import Data.Aeson.Types qualified as A++-- |+-- Strings in PureScript are sequences of UTF-16 code units, which do not+-- necessarily represent UTF-16 encoded text. For example, it is permissible+-- for a string to contain *lone surrogates,* i.e. characters in the range+-- U+D800 to U+DFFF which do not appear as a part of a surrogate pair.+--+-- The Show instance for PSString produces a string literal which would+-- represent the same data were it inserted into a PureScript source file.+--+-- Because JSON parsers vary wildly in terms of how they deal with lone+-- surrogates in JSON strings, the ToJSON instance for PSString produces JSON+-- strings where that would be safe (i.e. when there are no lone surrogates),+-- and arrays of UTF-16 code units (integers) otherwise.+--+newtype PSString = PSString { toUTF16CodeUnits :: [Word16] }+ deriving (Eq, Ord, Semigroup, Monoid, Generic)++instance NFData PSString+instance Serialise PSString++instance Show PSString where+ show = show . codePoints++-- |+-- Decode a PSString to a String, representing any lone surrogates as the+-- reserved code point with that index. Warning: if there are any lone+-- surrogates, converting the result to Text via Data.Text.pack will result in+-- loss of information as those lone surrogates will be replaced with U+FFFD+-- REPLACEMENT CHARACTER. Because this function requires care to use correctly,+-- we do not export it.+--+codePoints :: PSString -> String+codePoints = map (either (Char.chr . fromIntegral) id) . decodeStringEither++-- |+-- Decode a PSString as UTF-16 text. Lone surrogates will be replaced with+-- U+FFFD REPLACEMENT CHARACTER+--+decodeStringWithReplacement :: PSString -> String+decodeStringWithReplacement = map (fromRight '\xFFFD') . decodeStringEither++-- |+-- Decode a PSString as UTF-16. Lone surrogates in the input are represented in+-- the output with the Left constructor; characters which were successfully+-- decoded are represented with the Right constructor.+--+decodeStringEither :: PSString -> [Either Word16 Char]+decodeStringEither = unfoldr decode . toUTF16CodeUnits+ where+ decode :: [Word16] -> Maybe (Either Word16 Char, [Word16])+ decode (h:l:rest) | isLead h && isTrail l = Just (Right (unsurrogate h l), rest)+ decode (c:rest) | isSurrogate c = Just (Left c, rest)+ decode (c:rest) = Just (Right (toChar c), rest)+ decode [] = Nothing++ unsurrogate :: Word16 -> Word16 -> Char+ unsurrogate h l = toEnum ((toInt h - 0xD800) * 0x400 + (toInt l - 0xDC00) + 0x10000)++-- |+-- Attempt to decode a PSString as UTF-16 text. This will fail (returning+-- Nothing) if the argument contains lone surrogates.+--+decodeString :: PSString -> Maybe Text+decodeString = hush . decodeEither . BS.pack . concatMap unpair . toUTF16CodeUnits+ where+ unpair w = [highByte w, lowByte w]++ lowByte :: Word16 -> Word8+ lowByte = fromIntegral++ highByte :: Word16 -> Word8+ highByte = fromIntegral . (`shiftR` 8)++ -- Based on a similar function from Data.Text.Encoding for utf8. This is a+ -- safe usage of unsafePerformIO because there are no side effects after+ -- handling any thrown UnicodeExceptions.+ decodeEither :: ByteString -> Either UnicodeException Text+ decodeEither = unsafePerformIO . try . evaluate . decodeUtf16BE++ hush = either (const Nothing) Just++instance IsString PSString where+ fromString a = PSString $ concatMap encodeUTF16 a+ where+ surrogates :: Char -> (Word16, Word16)+ surrogates c = (toWord (h + 0xD800), toWord (l + 0xDC00))+ where (h, l) = divMod (fromEnum c - 0x10000) 0x400++ encodeUTF16 :: Char -> [Word16]+ encodeUTF16 c | fromEnum c > 0xFFFF = [high, low]+ where (high, low) = surrogates c+ encodeUTF16 c = [toWord $ fromEnum c]++instance A.ToJSON PSString where+ toJSON str =+ case decodeString str of+ Just t -> A.toJSON t+ Nothing -> A.toJSON (toUTF16CodeUnits str)++instance A.FromJSON PSString where+ parseJSON a = jsonString <|> arrayOfCodeUnits+ where+ jsonString = fromString <$> A.parseJSON a++ arrayOfCodeUnits = PSString <$> parseArrayOfCodeUnits a++ parseArrayOfCodeUnits :: A.Value -> A.Parser [Word16]+ parseArrayOfCodeUnits = A.withArray "array of UTF-16 code units" (traverse parseCodeUnit . V.toList)++ parseCodeUnit :: A.Value -> A.Parser Word16+ parseCodeUnit b = A.withScientific "two-byte non-negative integer" (maybe (A.typeMismatch "" b) return . toBoundedInteger) b++-- |+-- Pretty print a PSString, using PureScript escape sequences.+--+prettyPrintString :: PSString -> Text+prettyPrintString s = "\"" <> foldMap encodeChar (decodeStringEither s) <> "\""+ where+ encodeChar :: Either Word16 Char -> Text+ encodeChar (Left c) = "\\x" <> showHex' 6 c+ encodeChar (Right c)+ | c == '\t' = "\\t"+ | c == '\r' = "\\r"+ | c == '\n' = "\\n"+ | c == '"' = "\\\""+ | c == '\'' = "\\\'"+ | c == '\\' = "\\\\"+ | shouldPrint c = T.singleton c+ | otherwise = "\\x" <> showHex' 6 (Char.ord c)++ -- Note we do not use Data.Char.isPrint here because that includes things+ -- like zero-width spaces and combining punctuation marks, which could be+ -- confusing to print unescaped.+ shouldPrint :: Char -> Bool+ -- The standard space character, U+20 SPACE, is the only space char we should+ -- print without escaping+ shouldPrint ' ' = True+ shouldPrint c =+ Char.generalCategory c `elem`+ [ Char.UppercaseLetter+ , Char.LowercaseLetter+ , Char.TitlecaseLetter+ , Char.OtherLetter+ , Char.DecimalNumber+ , Char.LetterNumber+ , Char.OtherNumber+ , Char.ConnectorPunctuation+ , Char.DashPunctuation+ , Char.OpenPunctuation+ , Char.ClosePunctuation+ , Char.InitialQuote+ , Char.FinalQuote+ , Char.OtherPunctuation+ , Char.MathSymbol+ , Char.CurrencySymbol+ , Char.ModifierSymbol+ , Char.OtherSymbol+ ]++-- |+-- Pretty print a PSString, using JavaScript escape sequences. Intended for+-- use in compiled JS output.+--+prettyPrintStringJS :: PSString -> Text+prettyPrintStringJS s = "\"" <> foldMap encodeChar (toUTF16CodeUnits s) <> "\""+ where+ encodeChar :: Word16 -> Text+ encodeChar c | c > 0xFF = "\\u" <> showHex' 4 c+ encodeChar c | c > 0x7E || c < 0x20 = "\\x" <> showHex' 2 c+ encodeChar c | toChar c == '\b' = "\\b"+ encodeChar c | toChar c == '\t' = "\\t"+ encodeChar c | toChar c == '\n' = "\\n"+ encodeChar c | toChar c == '\v' = "\\v"+ encodeChar c | toChar c == '\f' = "\\f"+ encodeChar c | toChar c == '\r' = "\\r"+ encodeChar c | toChar c == '"' = "\\\""+ encodeChar c | toChar c == '\\' = "\\\\"+ encodeChar c = T.singleton $ toChar c++showHex' :: Enum a => Int -> a -> Text+showHex' width c =+ let hs = showHex (fromEnum c) "" in+ T.pack (replicate (width - length hs) '0' <> hs)++isLead :: Word16 -> Bool+isLead h = h >= 0xD800 && h <= 0xDBFF++isTrail :: Word16 -> Bool+isTrail l = l >= 0xDC00 && l <= 0xDFFF++isSurrogate :: Word16 -> Bool+isSurrogate c = isLead c || isTrail c++toChar :: Word16 -> Char+toChar = toEnum . fromIntegral++toWord :: Int -> Word16+toWord = fromIntegral++toInt :: Word16 -> Int+toInt = fromIntegral++mkString :: Text -> PSString+mkString = fromString . T.unpack
− src/Language/PureScript/Parser.hs
@@ -1,35 +0,0 @@------------------------------------------------------------------------------------ Module : Language.PureScript.Parser--- Copyright : (c) Phil Freeman 2013--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ |--- A collection of parsers for core data types:------ [@Language.PureScript.Parser.Kinds@] Parser for kinds------ [@Language.PureScript.Parser.Values@] Parser for values------ [@Language.PureScript.Parser.Types@] Parser for types------ [@Language.PureScript.Parser.Declaration@] Parsers for declarations and modules------ [@Language.PureScript.Parser.State@] Parser state, including indentation------ [@Language.PureScript.Parser.Common@] Common parsing utility functions-----------------------------------------------------------------------------------module Language.PureScript.Parser (module P) where--import Language.PureScript.Parser.Common as P-import Language.PureScript.Parser.Types as P-import Language.PureScript.Parser.State as P-import Language.PureScript.Parser.Kinds as P-import Language.PureScript.Parser.Lexer as P-import Language.PureScript.Parser.Declarations as P
− src/Language/PureScript/Parser/Common.hs
@@ -1,134 +0,0 @@------------------------------------------------------------------------------------ Module : Language.PureScript.Parser.Common--- Copyright : (c) Phil Freeman 2013--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ |--- Constants, and utility functions to be used when parsing-----------------------------------------------------------------------------------{-# LANGUAGE FlexibleContexts #-}--module Language.PureScript.Parser.Common where--import Control.Applicative-import Control.Monad (guard)--import Language.PureScript.Comments-import Language.PureScript.Parser.Lexer-import Language.PureScript.Parser.State-import Language.PureScript.Names--import qualified Text.Parsec as P--properName :: TokenParser ProperName-properName = ProperName <$> uname---- |--- Parse a module name----moduleName :: TokenParser ModuleName-moduleName = part []- where- part path = (do name <- ProperName <$> P.try qualifier- part (path `snoc` name))- <|> (ModuleName . snoc path . ProperName <$> mname)- snoc path name = path ++ [name]---- |--- Parse a qualified name, i.e. M.name or just name----parseQualified :: TokenParser a -> TokenParser (Qualified a)-parseQualified parser = part []- where- part path = (do name <- ProperName <$> P.try qualifier- part (updatePath path name))- <|> (Qualified (qual path) <$> P.try parser)- updatePath path name = path ++ [name]- qual path = if null path then Nothing else Just $ ModuleName path---- |--- Parse an identifier or parenthesized operator----parseIdent :: TokenParser Ident-parseIdent = (Ident <$> identifier) <|> (Op <$> parens symbol)---- |--- Run the first parser, then match the second if possible, applying the specified function on a successful match----augment :: P.Stream s m t => P.ParsecT s u m a -> P.ParsecT s u m b -> (a -> b -> a) -> P.ParsecT s u m a-augment p q f = flip (maybe id $ flip f) <$> p <*> P.optionMaybe q---- |--- Run the first parser, then match the second zero or more times, applying the specified function for each match----fold :: P.Stream s m t => P.ParsecT s u m a -> P.ParsecT s u m b -> (a -> b -> a) -> P.ParsecT s u m a-fold first more combine = do- a <- first- bs <- P.many more- return $ foldl combine a bs---- |--- Build a parser from a smaller parser and a list of parsers for postfix operators----buildPostfixParser :: P.Stream s m t => [a -> P.ParsecT s u m a] -> P.ParsecT s u m a -> P.ParsecT s u m a-buildPostfixParser fs first = do- a <- first- go a- where- go a = do- maybeA <- P.optionMaybe $ P.choice (map ($ a) fs)- case maybeA of- Nothing -> return a- Just a' -> go a'---- |--- Mark the current indentation level----mark :: P.Parsec s ParseState a -> P.Parsec s ParseState a-mark p = do- current <- indentationLevel <$> P.getState- pos <- P.sourceColumn <$> P.getPosition- P.modifyState $ \st -> st { indentationLevel = pos }- a <- p- P.modifyState $ \st -> st { indentationLevel = current }- return a---- |--- Check that the current identation level matches a predicate----checkIndentation :: (P.Column -> P.Column -> Bool) -> P.Parsec s ParseState ()-checkIndentation rel = do- col <- P.sourceColumn <$> P.getPosition- current <- indentationLevel <$> P.getState- guard (col `rel` current)---- |--- Check that the current indentation level is past the current mark----indented :: P.Parsec s ParseState ()-indented = checkIndentation (>) P.<?> "indentation"---- |--- Check that the current indentation level is at the same indentation as the current mark----same :: P.Parsec s ParseState ()-same = checkIndentation (==) P.<?> "no indentation"---- |--- Read the comments from the the next token, without consuming it----readComments :: P.Parsec [PositionedToken] u [Comment]-readComments = P.lookAhead $ ptComments <$> P.anyToken---- |--- Run a parser----runTokenParser :: FilePath -> TokenParser a -> [PositionedToken] -> Either P.ParseError a-runTokenParser filePath p = P.runParser p (ParseState 0) filePath
− src/Language/PureScript/Parser/Declarations.hs
@@ -1,526 +0,0 @@------------------------------------------------------------------------------------ Module : Language.PureScript.Parser.Declarations--- Copyright : (c) Phil Freeman 2013--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ |--- Parsers for module definitions and declarations-----------------------------------------------------------------------------------{-# LANGUAGE TupleSections #-}--module Language.PureScript.Parser.Declarations (- parseDeclaration,- parseModule,- parseModules,- parseModulesFromFiles,- parseValue,- parseGuard,- parseBinder,- parseBinderNoParens,- parseImportDeclaration',- parseLocalDeclaration-) where--import Prelude hiding (lex)--import Data.Maybe (isJust, fromMaybe)-import Data.Traversable (forM)--import Control.Applicative-import Control.Arrow ((+++))--import Language.PureScript.Kinds-import Language.PureScript.AST-import Language.PureScript.Comments-import Language.PureScript.Parser.Common-import Language.PureScript.Parser.Types-import Language.PureScript.Parser.Kinds-import Language.PureScript.Parser.Lexer-import Language.PureScript.Names-import Language.PureScript.CodeGen.JS.AST-import Language.PureScript.Environment--import qualified Language.PureScript.Parser.Common as C-import qualified Text.Parsec as P-import qualified Text.Parsec.Expr as P---- |--- Read source position information----withSourceSpan :: (SourceSpan -> [Comment] -> a -> a) -> P.Parsec [PositionedToken] u a -> P.Parsec [PositionedToken] u a-withSourceSpan f p = do- start <- P.getPosition- comments <- C.readComments- x <- p- end <- P.getPosition- let sp = SourceSpan (P.sourceName start) (toSourcePos start) (toSourcePos end)- return $ f sp comments x- where- toSourcePos pos = SourcePos (P.sourceLine pos) (P.sourceColumn pos)--kindedIdent :: TokenParser (String, Maybe Kind)-kindedIdent = (, Nothing) <$> identifier- <|> parens ((,) <$> identifier <*> (Just <$> (indented *> doubleColon *> indented *> parseKind)))--parseDataDeclaration :: TokenParser Declaration-parseDataDeclaration = do- dtype <- (reserved "data" *> return Data) <|> (reserved "newtype" *> return Newtype)- name <- indented *> properName- tyArgs <- many (indented *> kindedIdent)- ctors <- P.option [] $ do- indented *> equals- P.sepBy1 ((,) <$> properName <*> P.many (indented *> noWildcards parseTypeAtom)) pipe- return $ DataDeclaration dtype name tyArgs ctors--parseTypeDeclaration :: TokenParser Declaration-parseTypeDeclaration =- TypeDeclaration <$> P.try (parseIdent <* indented <* doubleColon)- <*> parsePolyType--parseTypeSynonymDeclaration :: TokenParser Declaration-parseTypeSynonymDeclaration =- TypeSynonymDeclaration <$> (P.try (reserved "type") *> indented *> properName)- <*> many (indented *> kindedIdent)- <*> (indented *> equals *> noWildcards parsePolyType)--parseValueDeclaration :: TokenParser Declaration-parseValueDeclaration = do- name <- parseIdent- binders <- P.many parseBinderNoParens- value <- Left <$> (C.indented *>- P.many1 ((,) <$> parseGuard- <*> (indented *> equals *> parseValueWithWhereClause)- ))- <|> Right <$> (indented *> equals *> parseValueWithWhereClause)- return $ ValueDeclaration name Value binders value- where- parseValueWithWhereClause :: TokenParser Expr- parseValueWithWhereClause = do- value <- parseValue- whereClause <- P.optionMaybe $ do- C.indented- reserved "where"- C.indented- C.mark $ P.many1 (C.same *> parseLocalDeclaration)- return $ maybe value (`Let` value) whereClause--parseExternDeclaration :: TokenParser Declaration-parseExternDeclaration = P.try (reserved "foreign") *> indented *> reserved "import" *> indented *>- (ExternDataDeclaration <$> (P.try (reserved "data") *> indented *> properName)- <*> (indented *> doubleColon *> parseKind)- <|> (do reserved "instance"- name <- parseIdent <* indented <* doubleColon- deps <- P.option [] $ do- deps <- parens (commaSep1 ((,) <$> parseQualified properName <*> P.many (noWildcards parseTypeAtom)))- indented- rfatArrow- return deps- className <- indented *> parseQualified properName- tys <- P.many (indented *> noWildcards parseTypeAtom)- return $ ExternInstanceDeclaration name deps className tys)- <|> (do ident <- parseIdent- js <- P.optionMaybe (JSRaw <$> stringLiteral)- ty <- indented *> doubleColon *> noWildcards parsePolyType- return $ ExternDeclaration (if isJust js then InlineJavascript else ForeignImport) ident js ty))--parseAssociativity :: TokenParser Associativity-parseAssociativity =- (P.try (reserved "infixl") >> return Infixl) <|>- (P.try (reserved "infixr") >> return Infixr) <|>- (P.try (reserved "infix") >> return Infix)--parseFixity :: TokenParser Fixity-parseFixity = Fixity <$> parseAssociativity <*> (indented *> natural)--parseFixityDeclaration :: TokenParser Declaration-parseFixityDeclaration = do- fixity <- parseFixity- indented- name <- symbol- return $ FixityDeclaration fixity name--parseImportDeclaration :: TokenParser Declaration-parseImportDeclaration = do- (mn, declType, asQ) <- parseImportDeclaration'- return $ ImportDeclaration mn declType asQ--parseImportDeclaration' :: TokenParser (ModuleName, ImportDeclarationType, (Maybe ModuleName))-parseImportDeclaration' = do- reserved "import"- indented- qualImport <|> stdImport- where- stdImport = do- moduleName' <- moduleName- stdImportHiding moduleName' <|> stdImportQualifying moduleName'- where- stdImportHiding mn = do- reserved "hiding"- declType <- importDeclarationType Hiding- return (mn, declType, Nothing)- stdImportQualifying mn = do- declType <- importDeclarationType Explicit- return (mn, declType, Nothing)- qualImport = do- reserved "qualified"- indented- moduleName' <- moduleName- declType <- importDeclarationType Explicit- reserved "as"- asQ <- moduleName- return (moduleName', declType, Just asQ)- importDeclarationType expectedType = do- idents <- P.optionMaybe $ indented *> (parens $ commaSep parseDeclarationRef)- return $ fromMaybe Implicit (expectedType <$> idents)---parseDeclarationRef :: TokenParser DeclarationRef-parseDeclarationRef = withSourceSpan PositionedDeclarationRef $- ValueRef <$> parseIdent- <|> do name <- properName- dctors <- P.optionMaybe $ parens (symbol' ".." *> pure Nothing <|> Just <$> commaSep properName)- return $ maybe (TypeClassRef name) (TypeRef name) dctors--parseTypeClassDeclaration :: TokenParser Declaration-parseTypeClassDeclaration = do- reserved "class"- implies <- P.option [] $ do- indented- implies <- parens (commaSep1 ((,) <$> parseQualified properName <*> P.many (noWildcards parseTypeAtom)))- lfatArrow- return implies- className <- indented *> properName- idents <- P.many (indented *> kindedIdent)- members <- P.option [] . P.try $ do- indented *> reserved "where"- mark (P.many (same *> positioned parseTypeDeclaration))- return $ TypeClassDeclaration className idents implies members--parseTypeInstanceDeclaration :: TokenParser Declaration-parseTypeInstanceDeclaration = do- reserved "instance"- name <- parseIdent <* indented <* doubleColon- deps <- P.optionMaybe $ do- deps <- parens (commaSep1 ((,) <$> parseQualified properName <*> P.many (noWildcards parseTypeAtom)))- indented- rfatArrow- return deps- className <- indented *> parseQualified properName- ty <- P.many (indented *> (noWildcards parseTypeAtom))- members <- P.option [] . P.try $ do- indented *> reserved "where"- mark (P.many (same *> positioned parseValueDeclaration))- return $ TypeInstanceDeclaration name (fromMaybe [] deps) className ty members--positioned :: TokenParser Declaration -> TokenParser Declaration-positioned d = withSourceSpan PositionedDeclaration d---- |--- Parse a single declaration----parseDeclaration :: TokenParser Declaration-parseDeclaration = positioned (P.choice- [ parseDataDeclaration- , parseTypeDeclaration- , parseTypeSynonymDeclaration- , parseValueDeclaration- , parseExternDeclaration- , parseFixityDeclaration- , parseImportDeclaration- , parseTypeClassDeclaration- , parseTypeInstanceDeclaration- ]) P.<?> "declaration"--parseLocalDeclaration :: TokenParser Declaration-parseLocalDeclaration = positioned (P.choice- [ parseTypeDeclaration- , parseValueDeclaration- ] P.<?> "local declaration")---- |--- Parse a module header and a collection of declarations----parseModule :: TokenParser Module-parseModule = do- comments <- C.readComments- reserved "module"- indented- name <- moduleName- exports <- P.optionMaybe $ parens $ commaSep1 parseDeclarationRef- reserved "where"- decls <- mark (P.many (same *> parseDeclaration))- return $ Module comments name decls exports---- |--- Parse a collection of modules----parseModulesFromFiles :: (k -> String) -> [(k, String)] -> Either P.ParseError [(k, Module)]-parseModulesFromFiles toFilePath input =- fmap collect . forM input $ \(k, content) -> do- let filename = toFilePath k- ts <- lex filename content- ms <- runTokenParser filename parseModules ts- return (k, ms)- where- collect :: [(k, [v])] -> [(k, v)]- collect vss = [ (k, v) | (k, vs) <- vss, v <- vs ]---- |--- Parse a collection of modules----parseModules :: TokenParser [Module]-parseModules = mark (P.many (same *> parseModule)) <* P.eof--booleanLiteral :: TokenParser Bool-booleanLiteral = (reserved "true" >> return True) P.<|> (reserved "false" >> return False)--parseNumericLiteral :: TokenParser Expr-parseNumericLiteral = NumericLiteral <$> number--parseStringLiteral :: TokenParser Expr-parseStringLiteral = StringLiteral <$> stringLiteral--parseBooleanLiteral :: TokenParser Expr-parseBooleanLiteral = BooleanLiteral <$> booleanLiteral--parseArrayLiteral :: TokenParser Expr-parseArrayLiteral = ArrayLiteral <$> squares (commaSep parseValue)--parseObjectLiteral :: TokenParser Expr-parseObjectLiteral = ObjectConstructor <$> braces (commaSep parseIdentifierAndValue)--parseIdentifierAndValue :: TokenParser (String, Maybe Expr)-parseIdentifierAndValue = (,) <$> (C.indented *> (lname <|> stringLiteral) <* C.indented <* colon)- <*> (C.indented *> val)- where- val = (Just <$> parseValue) <|> (underscore *> pure Nothing)--parseAbs :: TokenParser Expr-parseAbs = do- symbol' "\\"- args <- P.many1 (C.indented *> (Abs <$> (Left <$> P.try C.parseIdent <|> Right <$> parseBinderNoParens)))- C.indented *> rarrow- value <- parseValue- return $ toFunction args value- where- toFunction :: [Expr -> Expr] -> Expr -> Expr- toFunction args value = foldr ($) value args--parseVar :: TokenParser Expr-parseVar = Var <$> C.parseQualified C.parseIdent--parseConstructor :: TokenParser Expr-parseConstructor = Constructor <$> C.parseQualified C.properName--parseCase :: TokenParser Expr-parseCase = Case <$> P.between (P.try (reserved "case")) (C.indented *> reserved "of") (return <$> parseValue)- <*> (C.indented *> C.mark (P.many (C.same *> C.mark parseCaseAlternative)))--parseCaseAlternative :: TokenParser CaseAlternative-parseCaseAlternative = CaseAlternative <$> (return <$> parseBinder)- <*> (Left <$> (C.indented *>- P.many1 ((,) <$> parseGuard- <*> (indented *> rarrow *> parseValue)- ))- <|> Right <$> (indented *> rarrow *> parseValue))- P.<?> "case alternative"--parseIfThenElse :: TokenParser Expr-parseIfThenElse = IfThenElse <$> (P.try (reserved "if") *> C.indented *> parseValue)- <*> (C.indented *> reserved "then" *> C.indented *> parseValue)- <*> (C.indented *> reserved "else" *> C.indented *> parseValue)--parseLet :: TokenParser Expr-parseLet = do- reserved "let"- C.indented- ds <- C.mark $ P.many1 (C.same *> parseLocalDeclaration)- C.indented- reserved "in"- result <- parseValue- return $ Let ds result--parseValueAtom :: TokenParser Expr-parseValueAtom = P.choice- [ P.try parseNumericLiteral- , P.try parseStringLiteral- , P.try parseBooleanLiteral- , parseArrayLiteral- , P.try parseObjectLiteral- , P.try parseObjectGetter- , parseAbs- , P.try parseConstructor- , P.try parseVar- , parseCase- , parseIfThenElse- , parseDo- , parseLet- , P.try $ Parens <$> parens parseValue- , parseOperatorSection- , P.try parseObjectUpdaterWildcard ]---- |--- Parse an expression in backticks or an operator----parseInfixExpr :: TokenParser Expr-parseInfixExpr = P.between tick tick parseValue- <|> Var <$> parseQualified (Op <$> symbol)--parseOperatorSection :: TokenParser Expr-parseOperatorSection = parens $ left <|> right- where- right = OperatorSection <$> parseInfixExpr <* indented <*> (Right <$> parseValueAtom)- left = flip OperatorSection <$> (Left <$> parseValueAtom) <* indented <*> parseInfixExpr--parsePropertyUpdate :: TokenParser (String, Maybe Expr)-parsePropertyUpdate = do- name <- lname <|> stringLiteral- _ <- C.indented *> equals- value <- C.indented *> (underscore *> pure Nothing) <|> (Just <$> parseValue)- return (name, value)--parseAccessor :: Expr -> TokenParser Expr-parseAccessor (Constructor _) = P.unexpected "constructor"-parseAccessor obj = P.try $ Accessor <$> (C.indented *> dot *> C.indented *> (lname <|> stringLiteral)) <*> pure obj--parseDo :: TokenParser Expr-parseDo = do- reserved "do"- C.indented- Do <$> C.mark (P.many (C.same *> C.mark parseDoNotationElement))--parseDoNotationLet :: TokenParser DoNotationElement-parseDoNotationLet = DoNotationLet <$> (reserved "let" *> C.indented *> C.mark (P.many1 (C.same *> parseLocalDeclaration)))--parseDoNotationBind :: TokenParser DoNotationElement-parseDoNotationBind = DoNotationBind <$> parseBinder <*> (C.indented *> larrow *> parseValue)--parseDoNotationElement :: TokenParser DoNotationElement-parseDoNotationElement = P.choice- [ P.try parseDoNotationBind- , parseDoNotationLet- , P.try (DoNotationValue <$> parseValue) ]--parseObjectGetter :: TokenParser Expr-parseObjectGetter = ObjectGetter <$> (underscore *> C.indented *> dot *> C.indented *> (lname <|> stringLiteral))---- |--- Parse a value----parseValue :: TokenParser Expr-parseValue = withSourceSpan PositionedValue- (P.buildExpressionParser operators- . C.buildPostfixParser postfixTable2- $ indexersAndAccessors) P.<?> "expression"- where- indexersAndAccessors = C.buildPostfixParser postfixTable1 parseValueAtom- postfixTable1 = [ parseAccessor- , P.try . parseUpdaterBody . Just ]- postfixTable2 = [ \v -> P.try (flip App <$> (C.indented *> indexersAndAccessors)) <*> pure v- , \v -> flip (TypedValue True) <$> (P.try (C.indented *> doubleColon) *> parsePolyType) <*> pure v- ]- operators = [ [ P.Prefix (P.try (C.indented *> symbol' "-") >> return UnaryMinus)- ]- , [ P.Infix (P.try (C.indented *> parseInfixExpr P.<?> "infix expression") >>= \ident ->- return (BinaryNoParens ident)) P.AssocRight- ]- ]--parseUpdaterBody :: Maybe Expr -> TokenParser Expr-parseUpdaterBody v = ObjectUpdater v <$> (C.indented *> braces (commaSep1 (C.indented *> parsePropertyUpdate)))--parseObjectUpdaterWildcard :: TokenParser Expr-parseObjectUpdaterWildcard = underscore *> C.indented *> parseUpdaterBody Nothing--parseStringBinder :: TokenParser Binder-parseStringBinder = StringBinder <$> stringLiteral--parseBooleanBinder :: TokenParser Binder-parseBooleanBinder = BooleanBinder <$> booleanLiteral--parseNumberBinder :: TokenParser Binder-parseNumberBinder = NumberBinder <$> (sign <*> number)- where- sign :: TokenParser (Either Integer Double -> Either Integer Double)- sign = (symbol' "-" >> return (negate +++ negate))- <|> (symbol' "+" >> return id)- <|> return id--parseVarBinder :: TokenParser Binder-parseVarBinder = VarBinder <$> C.parseIdent--parseNullaryConstructorBinder :: TokenParser Binder-parseNullaryConstructorBinder = ConstructorBinder <$> C.parseQualified C.properName <*> pure []--parseConstructorBinder :: TokenParser Binder-parseConstructorBinder = ConstructorBinder <$> C.parseQualified C.properName <*> many (C.indented *> parseBinderNoParens)--parseObjectBinder :: TokenParser Binder-parseObjectBinder = ObjectBinder <$> braces (commaSep (C.indented *> parseIdentifierAndBinder))--parseArrayBinder :: TokenParser Binder-parseArrayBinder = squares $ ArrayBinder <$> commaSep (C.indented *> parseBinder)--parseNamedBinder :: TokenParser Binder-parseNamedBinder = NamedBinder <$> (C.parseIdent <* C.indented <* at)- <*> (C.indented *> parseBinder)--parseNullBinder :: TokenParser Binder-parseNullBinder = underscore *> return NullBinder--parseIdentifierAndBinder :: TokenParser (String, Binder)-parseIdentifierAndBinder = do- name <- lname <|> stringLiteral- C.indented *> (equals <|> colon)- binder <- C.indented *> parseBinder- return (name, binder)---- |--- Parse a binder----parseBinder :: TokenParser Binder-parseBinder = withSourceSpan PositionedBinder (P.buildExpressionParser operators parseBinderAtom P.<?> "expression")- where- operators = [ [ P.Infix (P.try $ C.indented *> colon *> return ConsBinder) P.AssocRight ] ]- parseBinderAtom :: TokenParser Binder- parseBinderAtom = P.choice (map P.try- [ parseNullBinder- , parseStringBinder- , parseBooleanBinder- , parseNumberBinder- , parseNamedBinder- , parseVarBinder- , parseConstructorBinder- , parseObjectBinder- , parseArrayBinder- , parens parseBinder ]) P.<?> "binder"---- |--- Parse a binder as it would appear in a top level declaration----parseBinderNoParens :: TokenParser Binder-parseBinderNoParens = P.choice (map P.try- [ parseNullBinder- , parseStringBinder- , parseBooleanBinder- , parseNumberBinder- , parseNamedBinder- , parseVarBinder- , parseNullaryConstructorBinder- , parseObjectBinder- , parseArrayBinder- , parens parseBinder ]) P.<?> "binder"--- |--- Parse a guard----parseGuard :: TokenParser Guard-parseGuard = pipe *> C.indented *> parseValue--
− src/Language/PureScript/Parser/Kinds.hs
@@ -1,45 +0,0 @@------------------------------------------------------------------------------------ Module : Language.PureScript.Parser.Kinds--- Copyright : (c) Phil Freeman 2013--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ |--- A parser for kinds-----------------------------------------------------------------------------------module Language.PureScript.Parser.Kinds (- parseKind-) where--import Language.PureScript.Kinds-import Language.PureScript.Parser.Common-import Language.PureScript.Parser.Lexer-import Control.Applicative-import qualified Text.Parsec as P-import qualified Text.Parsec.Expr as P--parseStar :: TokenParser Kind-parseStar = const Star <$> symbol' "*"--parseBang :: TokenParser Kind-parseBang = const Bang <$> symbol' "!"--parseTypeAtom :: TokenParser Kind-parseTypeAtom = indented *> P.choice (map P.try- [ parseStar- , parseBang- , parens parseKind ])--- |--- Parse a kind----parseKind :: TokenParser Kind-parseKind = P.buildExpressionParser operators parseTypeAtom P.<?> "kind"- where- operators = [ [ P.Prefix (symbol' "#" >> return Row) ]- , [ P.Infix ((P.try rarrow) >> return FunKind) P.AssocRight ] ]
− src/Language/PureScript/Parser/Lexer.hs
@@ -1,499 +0,0 @@------------------------------------------------------------------------------------ Module : Language.PureScript.Parser.Lexer--- Copyright : (c) Phil Freeman 2014--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ |--- The first step in the parsing process - turns source code into a list of lexemes-----------------------------------------------------------------------------------{-# LANGUAGE TupleSections #-}--module Language.PureScript.Parser.Lexer- ( PositionedToken(..)- , Token()- , TokenParser()- , lex- , anyToken- , token- , match- , lparen- , rparen- , parens- , lbrace- , rbrace- , braces- , lsquare- , rsquare- , squares- , indent- , indentAt- , larrow- , rarrow- , lfatArrow- , rfatArrow- , colon- , doubleColon- , equals- , pipe- , tick- , dot- , comma- , semi- , at- , underscore- , semiSep- , semiSep1- , commaSep- , commaSep1- , lname- , qualifier- , uname- , uname'- , mname- , reserved- , symbol- , symbol'- , identifier- , stringLiteral- , number- , natural- , reservedPsNames- , reservedTypeNames- , opChars- )- where--import Prelude hiding (lex)--import Data.Char (isSpace)--import Control.Monad (void, guard)-import Data.Functor.Identity--import Control.Applicative--import Language.PureScript.Parser.State-import Language.PureScript.Comments--import qualified Text.Parsec as P-import qualified Text.Parsec.Token as PT--data Token- = LParen- | RParen- | LBrace- | RBrace- | LSquare- | RSquare- | Indent Int- | LArrow- | RArrow- | LFatArrow- | RFatArrow- | Colon- | DoubleColon- | Equals- | Pipe- | Tick- | Dot- | Comma- | Semi- | At- | Underscore- | LName String- | UName String- | Qualifier String- | Symbol String- | StringLiteral String- | Number (Either Integer Double)- deriving (Show, Eq, Ord)--prettyPrintToken :: Token -> String-prettyPrintToken LParen = "("-prettyPrintToken RParen = ")"-prettyPrintToken LBrace = "{"-prettyPrintToken RBrace = "}"-prettyPrintToken LSquare = "["-prettyPrintToken RSquare = "]"-prettyPrintToken LArrow = "<-"-prettyPrintToken RArrow = "->"-prettyPrintToken LFatArrow = "<="-prettyPrintToken RFatArrow = "=>"-prettyPrintToken Colon = ":"-prettyPrintToken DoubleColon = "::"-prettyPrintToken Equals = "="-prettyPrintToken Pipe = "|"-prettyPrintToken Tick = "`"-prettyPrintToken Dot = "."-prettyPrintToken Comma = ","-prettyPrintToken Semi = ";"-prettyPrintToken At = "@"-prettyPrintToken Underscore = "_"-prettyPrintToken (Indent n) = "indentation at level " ++ show n-prettyPrintToken (LName s) = show s-prettyPrintToken (UName s) = show s-prettyPrintToken (Qualifier _) = "qualifier"-prettyPrintToken (Symbol s) = s-prettyPrintToken (StringLiteral s) = show s-prettyPrintToken (Number n) = either show show n--data PositionedToken = PositionedToken- { ptSourcePos :: P.SourcePos- , ptToken :: Token- , ptComments :: [Comment]- } deriving (Eq)--instance Show PositionedToken where- show = show . ptToken--lex :: FilePath -> String -> Either P.ParseError [PositionedToken]-lex filePath input = P.parse parseTokens filePath input--parseTokens :: P.Parsec String u [PositionedToken]-parseTokens = whitespace *> P.many parsePositionedToken <* P.skipMany parseComment <* P.eof--whitespace :: P.Parsec String u ()-whitespace = P.skipMany (P.satisfy isSpace)--parseComment :: P.Parsec String u Comment-parseComment = (BlockComment <$> blockComment <|> LineComment <$> lineComment) <* whitespace- where- blockComment :: P.Parsec String u String- blockComment = P.try $ P.string "{-" *> P.manyTill P.anyChar (P.try (P.string "-}"))-- lineComment :: P.Parsec String u String- lineComment = P.try $ P.string "--" *> P.manyTill P.anyChar (P.try (void (P.char '\n') <|> P.eof))--parsePositionedToken :: P.Parsec String u PositionedToken-parsePositionedToken = P.try $ do- comments <- P.many parseComment- pos <- P.getPosition- tok <- parseToken- return $ PositionedToken pos tok comments--parseToken :: P.Parsec String u Token-parseToken = P.choice- [ P.try $ P.string "<-" *> P.notFollowedBy symbolChar *> pure LArrow- , P.try $ P.string "<=" *> P.notFollowedBy symbolChar *> pure LFatArrow- , P.try $ P.string "->" *> P.notFollowedBy symbolChar *> pure RArrow- , P.try $ P.string "=>" *> P.notFollowedBy symbolChar *> pure RFatArrow- , P.try $ P.string "::" *> P.notFollowedBy symbolChar *> pure DoubleColon- , P.try $ P.char '(' *> pure LParen- , P.try $ P.char ')' *> pure RParen- , P.try $ P.char '{' *> pure LBrace- , P.try $ P.char '}' *> pure RBrace- , P.try $ P.char '[' *> pure LSquare- , P.try $ P.char ']' *> pure RSquare- , P.try $ P.char '`' *> pure Tick- , P.try $ P.char ',' *> pure Comma- , P.try $ P.char '=' *> P.notFollowedBy symbolChar *> pure Equals- , P.try $ P.char ':' *> P.notFollowedBy symbolChar *> pure Colon- , P.try $ P.char '|' *> P.notFollowedBy symbolChar *> pure Pipe- , P.try $ P.char '.' *> P.notFollowedBy symbolChar *> pure Dot- , P.try $ P.char ';' *> P.notFollowedBy symbolChar *> pure Semi- , P.try $ P.char '@' *> P.notFollowedBy symbolChar *> pure At- , P.try $ P.char '_' *> P.notFollowedBy identLetter *> pure Underscore- , LName <$> parseLName- , do uName <- parseUName- (guard (validModuleName uName) >> Qualifier uName <$ P.char '.') <|> pure (UName uName)- , Symbol <$> parseSymbol- , StringLiteral <$> parseStringLiteral- , Number <$> parseNumber- ] <* whitespace-- where- parseLName :: P.Parsec String u String- parseLName = (:) <$> identStart <*> P.many identLetter-- parseUName :: P.Parsec String u String- parseUName = (:) <$> P.upper <*> P.many uidentLetter-- parseSymbol :: P.Parsec String u String- parseSymbol = P.many1 symbolChar-- identStart :: P.Parsec String u Char- identStart = P.lower <|> P.oneOf "_"-- identLetter :: P.Parsec String u Char- identLetter = P.alphaNum <|> P.oneOf "_'"-- uidentLetter :: P.Parsec String u Char- uidentLetter = P.alphaNum <|> P.char '_'-- symbolChar :: P.Parsec String u Char- symbolChar = P.oneOf opChars-- parseStringLiteral :: P.Parsec String u String- parseStringLiteral = blockString <|> PT.stringLiteral tokenParser- where- delimeter = P.try (P.string "\"\"\"")- blockString = delimeter >> P.manyTill P.anyChar delimeter-- parseNumber :: P.Parsec String u (Either Integer Double)- parseNumber = (Right <$> P.try (PT.float tokenParser) <|>- Left <$> P.try (PT.natural tokenParser)) P.<?> "number"---- |--- We use Text.Parsec.Token to implement the string and number lexemes----langDef :: PT.GenLanguageDef String u Identity-langDef = PT.LanguageDef- { PT.reservedNames = []- , PT.reservedOpNames = []- , PT.commentStart = ""- , PT.commentEnd = ""- , PT.commentLine = ""- , PT.nestedComments = True- , PT.identStart = fail "Identifiers not supported"- , PT.identLetter = fail "Identifiers not supported"- , PT.opStart = fail "Operators not supported"- , PT.opLetter = fail "Operators not supported"- , PT.caseSensitive = True- }---- |--- A token parser based on the language definition----tokenParser :: PT.GenTokenParser String u Identity-tokenParser = PT.makeTokenParser langDef--type TokenParser a = P.Parsec [PositionedToken] ParseState a--anyToken :: TokenParser PositionedToken-anyToken = P.token (prettyPrintToken . ptToken) ptSourcePos Just--token :: (Token -> Maybe a) -> TokenParser a-token f = P.token (prettyPrintToken . ptToken) ptSourcePos (f . ptToken)--match :: Token -> TokenParser ()-match tok = token (\tok' -> if tok == tok' then Just () else Nothing) P.<?> prettyPrintToken tok--lparen :: TokenParser ()-lparen = match LParen--rparen :: TokenParser ()-rparen = match RParen--parens :: TokenParser a -> TokenParser a-parens = P.between lparen rparen--lbrace :: TokenParser ()-lbrace = match LBrace--rbrace :: TokenParser ()-rbrace = match RBrace--braces :: TokenParser a -> TokenParser a-braces = P.between lbrace rbrace--lsquare :: TokenParser ()-lsquare = match LSquare--rsquare :: TokenParser ()-rsquare = match RSquare--squares :: TokenParser a -> TokenParser a-squares = P.between lsquare rsquare--indent :: TokenParser Int-indent = token go P.<?> "indentation"- where- go (Indent n) = Just n- go _ = Nothing--indentAt :: P.Column -> TokenParser ()-indentAt n = token go P.<?> "indentation at level " ++ show n- where- go (Indent n') | n == n' = Just ()- go _ = Nothing--larrow :: TokenParser ()-larrow = match LArrow--rarrow :: TokenParser ()-rarrow = match RArrow--lfatArrow :: TokenParser ()-lfatArrow = match LFatArrow--rfatArrow :: TokenParser ()-rfatArrow = match RFatArrow--colon :: TokenParser ()-colon = match Colon--doubleColon :: TokenParser ()-doubleColon = match DoubleColon--equals :: TokenParser ()-equals = match Equals--pipe :: TokenParser ()-pipe = match Pipe--tick :: TokenParser ()-tick = match Tick--dot :: TokenParser ()-dot = match Dot--comma :: TokenParser ()-comma = match Comma--semi :: TokenParser ()-semi = match Semi--at :: TokenParser ()-at = match At--underscore :: TokenParser ()-underscore = match Underscore---- |--- Parse zero or more values separated by semicolons----semiSep :: TokenParser a -> TokenParser [a]-semiSep = flip P.sepBy semi---- |--- Parse one or more values separated by semicolons----semiSep1 :: TokenParser a -> TokenParser [a]-semiSep1 = flip P.sepBy1 semi---- |--- Parse zero or more values separated by commas----commaSep :: TokenParser a -> TokenParser [a]-commaSep = flip P.sepBy comma---- |--- Parse one or more values separated by commas----commaSep1 :: TokenParser a -> TokenParser [a]-commaSep1 = flip P.sepBy1 comma--lname :: TokenParser String-lname = token go P.<?> "identifier"- where- go (LName s) = Just s- go _ = Nothing--qualifier :: TokenParser String-qualifier = token go P.<?> "qualifier"- where- go (Qualifier s) = Just s- go _ = Nothing--reserved :: String -> TokenParser ()-reserved s = token go P.<?> show s- where- go (LName s') | s == s' = Just ()- go _ = Nothing--uname :: TokenParser String-uname = token go P.<?> "proper name"- where- go (UName s) = Just s- go _ = Nothing--mname :: TokenParser String-mname = token go P.<?> "module name"- where- go (UName s) | validModuleName s = Just s- go _ = Nothing--uname' :: String -> TokenParser ()-uname' s = token go P.<?> show s- where- go (UName s') | s == s' = Just ()- go _ = Nothing--symbol :: TokenParser String-symbol = token go P.<?> "symbol"- where- go (Symbol s) = Just s- go Colon = Just ":"- go LFatArrow = Just "<="- go At = Just "@"- go _ = Nothing--symbol' :: String -> TokenParser ()-symbol' s = token go P.<?> show s- where- go (Symbol s') | s == s' = Just ()- go Colon | s == ":" = Just ()- go LFatArrow | s == "<=" = Just ()- go _ = Nothing--stringLiteral :: TokenParser String-stringLiteral = token go P.<?> "string literal"- where- go (StringLiteral s) = Just s- go _ = Nothing--number :: TokenParser (Either Integer Double)-number = token go P.<?> "number"- where- go (Number n) = Just n- go _ = Nothing--natural :: TokenParser Integer-natural = token go P.<?> "natural"- where- go (Number (Left n)) = Just n- go _ = Nothing--identifier :: TokenParser String-identifier = token go P.<?> "identifier"- where- go (LName s) | s `notElem` reservedPsNames = Just s- go _ = Nothing--validModuleName :: String -> Bool-validModuleName s = not ('_' `elem` s)---- |--- A list of purescript reserved identifiers----reservedPsNames :: [String]-reservedPsNames = [ "data"- , "newtype"- , "type"- , "foreign"- , "import"- , "infixl"- , "infixr"- , "infix"- , "class"- , "instance"- , "module"- , "case"- , "of"- , "if"- , "then"- , "else"- , "do"- , "let"- , "true"- , "false"- , "in"- , "where"- ]--reservedTypeNames :: [String]-reservedTypeNames = [ "forall", "where" ]---- |--- The characters allowed for use in operators----opChars :: [Char]-opChars = ":!#$%&*+./<=>?@\\^|-~"-
− src/Language/PureScript/Parser/State.hs
@@ -1,30 +0,0 @@------------------------------------------------------------------------------------ Module : Language.PureScript.Parser.State--- Copyright : (c) Phil Freeman 2013--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ |--- State for the parser monad-----------------------------------------------------------------------------------module Language.PureScript.Parser.State where--import qualified Text.Parsec as P---- |--- State for the parser monad----data ParseState = ParseState {- -- |- -- The most recently marked indentation level- --- indentationLevel :: P.Column- } deriving Show--
− src/Language/PureScript/Parser/Types.hs
@@ -1,134 +0,0 @@------------------------------------------------------------------------------------ Module : Language.PureScript.Parser.Types--- Copyright : (c) Phil Freeman 2013--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ |--- Parsers for types-----------------------------------------------------------------------------------module Language.PureScript.Parser.Types (- parseType,- parsePolyType,- noWildcards,- parseTypeAtom-) where--import Control.Applicative-import Control.Monad (when, unless)--import Language.PureScript.Types-import Language.PureScript.Parser.Common-import Language.PureScript.Parser.Kinds-import Language.PureScript.Parser.Lexer-import Language.PureScript.Environment--import qualified Text.Parsec as P-import qualified Text.Parsec.Expr as P--parseArray :: TokenParser Type-parseArray = squares $ return tyArray--parseArrayOf :: TokenParser Type-parseArrayOf = squares $ TypeApp tyArray <$> parseType--parseFunction :: TokenParser Type-parseFunction = parens $ rarrow >> return tyFunction--parseObject :: TokenParser Type-parseObject = braces $ TypeApp tyObject <$> parseRow--parseTypeWildcard :: TokenParser Type-parseTypeWildcard = underscore >> return TypeWildcard--parseTypeVariable :: TokenParser Type-parseTypeVariable = do- ident <- identifier- when (ident `elem` reservedTypeNames) $ P.unexpected ident- return $ TypeVar ident--parseTypeConstructor :: TokenParser Type-parseTypeConstructor = TypeConstructor <$> parseQualified properName--parseForAll :: TokenParser Type-parseForAll = mkForAll <$> (P.try (reserved "forall") *> P.many1 (indented *> identifier) <* indented <* dot)- <*> parseConstrainedType---- |--- Parse a type as it appears in e.g. a data constructor----parseTypeAtom :: TokenParser Type-parseTypeAtom = indented *> P.choice (map P.try- [ parseArray- , parseArrayOf- , parseFunction- , parseObject- , parseTypeWildcard- , parseTypeVariable- , parseTypeConstructor- , parseForAll- , parens parseRow- , parens parsePolyType ])--parseConstrainedType :: TokenParser Type-parseConstrainedType = do- constraints <- P.optionMaybe . P.try $ do- constraints <- parens . commaSep1 $ do- className <- parseQualified properName- indented- ty <- P.many parseTypeAtom- return (className, ty)- _ <- rfatArrow- return constraints- indented- ty <- parseType- return $ maybe ty (flip ConstrainedType ty) constraints--parseAnyType :: TokenParser Type-parseAnyType = P.buildExpressionParser operators (buildPostfixParser postfixTable parseTypeAtom) P.<?> "type"- where- operators = [ [ P.Infix (return TypeApp) P.AssocLeft ]- , [ P.Infix (rarrow >> return function) P.AssocRight ] ]- postfixTable = [ \t -> KindedType t <$> (P.try (indented *> doubleColon) *> parseKind)- ]---- |--- Parse a monotype----parseType :: TokenParser Type-parseType = do- ty <- parseAnyType- unless (isMonoType ty) $ P.unexpected "polymorphic type"- return ty---- |--- Parse a polytype----parsePolyType :: TokenParser Type-parsePolyType = parseAnyType---- |--- Parse an atomic type with no wildcards----noWildcards :: TokenParser Type -> TokenParser Type-noWildcards p = do- ty <- p- when (containsWildcards ty) $ P.unexpected "type wildcard"- return ty--parseNameAndType :: TokenParser t -> TokenParser (String, t)-parseNameAndType p = (,) <$> (indented *> (lname <|> stringLiteral) <* indented <* doubleColon) <*> p--parseRowEnding :: TokenParser Type-parseRowEnding = P.option REmpty $ indented *> pipe *> indented *> P.choice (map P.try- [ parseTypeWildcard- , TypeVar <$> identifier ])--parseRow :: TokenParser Type-parseRow = (curry rowFromList <$> commaSep (parseNameAndType parsePolyType) <*> parseRowEnding) P.<?> "row"
src/Language/PureScript/Pretty.hs view
@@ -1,32 +1,12 @@------------------------------------------------------------------------------------ Module : Language.PureScript.Pretty--- Copyright : (c) Phil Freeman 2013--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ |--- A collection of pretty printers for core data types:------ [@Language.PureScript.Pretty.Kinds@] Pretty printer for kinds------ [@Language.PureScript.Pretty.Values@] Pretty printer for values+-- | A collection of pretty printers for core data types: ----- [@Language.PureScript.Pretty.Types@] Pretty printer for types+-- * [@Language.PureScript.Pretty.Kinds@] Pretty printer for kinds ----- [@Language.PureScript.Pretty.JS@] Pretty printer for values, used for code generation+-- * [@Language.PureScript.Pretty.Values@] Pretty printer for values ---------------------------------------------------------------------------------+-- * [@Language.PureScript.Pretty.Types@] Pretty printer for types module Language.PureScript.Pretty (module P) where -import Language.PureScript.Pretty.Kinds as P-import Language.PureScript.Pretty.Values as P import Language.PureScript.Pretty.Types as P-import Language.PureScript.Pretty.JS as P---+import Language.PureScript.Pretty.Values as P+import Language.PureScript.PSString as P (prettyPrintString)
src/Language/PureScript/Pretty/Common.hs view
@@ -1,42 +1,113 @@------------------------------------------------------------------------------------ Module : Language.PureScript.Pretty.Common--- Copyright : (c) Phil Freeman 2013--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :--- -- | -- Common pretty-printing utility functions --------------------------------------------------------------------------------- module Language.PureScript.Pretty.Common where -import Control.Monad.State-import Data.List (intercalate)-import Language.PureScript.Parser.Lexer (reservedPsNames, opChars)+import Prelude +import Control.Monad.State (StateT, modify, get)++import Data.List (elemIndices, intersperse)+import Data.Text (Text)+import Data.Text qualified as T++import Language.PureScript.AST (SourcePos(..), SourceSpan(..), nullSourceSpan)+import Language.PureScript.CST.Lexer (isUnquotedKey)++import Text.PrettyPrint.Boxes (Box(..), emptyBox, text, top, vcat, (//))+import Text.PrettyPrint.Boxes qualified as Box++parensT :: Text -> Text+parensT s = "(" <> s <> ")"++parensPos :: (Emit gen) => gen -> gen+parensPos s = emit "(" <> s <> emit ")"+ -- |--- Wrap a string in parentheses+-- Generalize intercalate slightly for monoids ---parens :: String -> String-parens s = ('(':s) ++ ")"+intercalate :: Monoid m => m -> [m] -> m+intercalate x xs = mconcat (intersperse x xs) -newtype PrinterState = PrinterState { indent :: Int } deriving (Show, Eq, Ord)+class (Monoid gen) => Emit gen where+ emit :: Text -> gen+ addMapping :: SourceSpan -> gen +data SMap = SMap Text SourcePos SourcePos+ -- |--- Number of characters per identation level+-- String with length and source-map entries --+newtype StrPos = StrPos (SourcePos, Text, [SMap])++-- |+-- Make a monoid where append consists of concatenating the string part, adding the lengths+-- appropriately and advancing source mappings on the right hand side to account for+-- the length of the left.+--+instance Semigroup StrPos where+ StrPos (a,b,c) <> StrPos (a',b',c') = StrPos (a `addPos` a', b <> b', c ++ (bumpPos a <$> c'))++instance Monoid StrPos where+ mempty = StrPos (SourcePos 0 0, "", [])++ mconcat ms =+ let s' = foldMap (\(StrPos(_, s, _)) -> s) ms+ (p, maps) = foldl plus (SourcePos 0 0, []) ms+ in+ StrPos (p, s', concat $ reverse maps)+ where+ plus :: (SourcePos, [[SMap]]) -> StrPos -> (SourcePos, [[SMap]])+ plus (a, c) (StrPos (a', _, c')) = (a `addPos` a', (bumpPos a <$> c') : c)++instance Emit StrPos where+ -- Augment a string with its length (rows/column)+ emit str =+ -- TODO(Christoph): get rid of T.unpack+ let newlines = elemIndices '\n' (T.unpack str)+ index = if null newlines then 0 else last newlines + 1+ in+ StrPos (SourcePos { sourcePosLine = length newlines, sourcePosColumn = T.length str - index }, str, [])++ -- Add a new mapping entry for given source position with initially zero generated position+ addMapping ss@SourceSpan { spanName = file, spanStart = startPos } = StrPos (zeroPos, mempty, [ mapping | ss /= nullSourceSpan ])+ where+ mapping = SMap (T.pack file) startPos zeroPos+ zeroPos = SourcePos 0 0++newtype PlainString = PlainString Text deriving (Semigroup, Monoid)++runPlainString :: PlainString -> Text+runPlainString (PlainString s) = s++instance Emit PlainString where+ emit = PlainString+ addMapping _ = mempty++addMapping' :: (Emit gen) => Maybe SourceSpan -> gen+addMapping' (Just ss) = addMapping ss+addMapping' Nothing = mempty++bumpPos :: SourcePos -> SMap -> SMap+bumpPos p (SMap f s g) = SMap f s $ p `addPos` g++addPos :: SourcePos -> SourcePos -> SourcePos+addPos (SourcePos n m) (SourcePos 0 m') = SourcePos n (m + m')+addPos (SourcePos n _) (SourcePos n' m') = SourcePos (n + n') m'+++data PrinterState = PrinterState { indent :: Int }++-- |+-- Number of characters per indentation level+-- blockIndent :: Int blockIndent = 4 -- | -- Pretty print with a new indentation level ---withIndent :: StateT PrinterState Maybe String -> StateT PrinterState Maybe String+withIndent :: StateT PrinterState Maybe gen -> StateT PrinterState Maybe gen withIndent action = do modify $ \st -> st { indent = indent st + blockIndent } result <- action@@ -46,24 +117,22 @@ -- | -- Get the current indentation level ---currentIndent :: StateT PrinterState Maybe String+currentIndent :: (Emit gen) => StateT PrinterState Maybe gen currentIndent = do current <- get- return $ replicate (indent current) ' '+ return $ emit $ T.replicate (indent current) " " --- |--- Print many lines----prettyPrintMany :: (a -> StateT PrinterState Maybe String) -> [a] -> StateT PrinterState Maybe String-prettyPrintMany f xs = do- ss <- mapM f xs- indentString <- currentIndent- return $ intercalate "\n" $ map (indentString ++) ss+objectKeyRequiresQuoting :: Text -> Bool+objectKeyRequiresQuoting = not . isUnquotedKey --- |--- Prints an object key, escaping reserved names.----prettyPrintObjectKey :: String -> String-prettyPrintObjectKey s | s `elem` reservedPsNames = show s- | any (`elem` opChars) s = show s- | otherwise = s+-- | Place a box before another, vertically when the first box takes up multiple lines.+before :: Box -> Box -> Box+before b1 b2 | rows b1 > 1 = b1 // b2+ | otherwise = b1 Box.<> b2++beforeWithSpace :: Box -> Box -> Box+beforeWithSpace b1 = before (b1 Box.<> text " ")++-- | Place a Box on the bottom right of another+endWith :: Box -> Box -> Box+endWith l r = l Box.<> vcat top [emptyBox (rows l - 1) (cols r), r]
− src/Language/PureScript/Pretty/JS.hs
@@ -1,301 +0,0 @@------------------------------------------------------------------------------------ Module : Language.PureScript.Pretty.JS--- Copyright : (c) Phil Freeman 2013--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ |--- Pretty printer for the Javascript AST-----------------------------------------------------------------------------------module Language.PureScript.Pretty.JS (- prettyPrintJS-) where--import Data.List-import Data.Maybe (fromMaybe)--import Control.Applicative-import Control.Arrow ((<+>))-import Control.Monad.State-import Control.PatternArrows-import qualified Control.Arrow as A--import Language.PureScript.CodeGen.JS.AST-import Language.PureScript.CodeGen.JS.Common-import Language.PureScript.Pretty.Common-import Language.PureScript.Comments--import Numeric--literals :: Pattern PrinterState JS String-literals = mkPattern' match- where- match :: JS -> StateT PrinterState Maybe String- match (JSNumericLiteral n) = return $ either show show n- match (JSStringLiteral s) = return $ string s- match (JSBooleanLiteral True) = return "true"- match (JSBooleanLiteral False) = return "false"- match (JSArrayLiteral xs) = fmap concat $ sequence- [ return "[ "- , fmap (intercalate ", ") $ forM xs prettyPrintJS'- , return " ]"- ]- match (JSObjectLiteral []) = return "{}"- match (JSObjectLiteral ps) = fmap concat $ sequence- [ return "{\n"- , withIndent $ do- jss <- forM ps $ \(key, value) -> fmap ((objectPropertyToString key ++ ": ") ++) . prettyPrintJS' $ value- indentString <- currentIndent- return $ intercalate ", \n" $ map (indentString ++) jss- , return "\n"- , currentIndent- , return "}"- ]- where- objectPropertyToString :: String -> String- objectPropertyToString s | identNeedsEscaping s = show s- | otherwise = s- match (JSBlock sts) = fmap concat $ sequence- [ return "{\n"- , withIndent $ prettyStatements sts- , return "\n"- , currentIndent- , return "}"- ]- match (JSVar ident) = return ident- match (JSVariableIntroduction ident value) = fmap concat $ sequence- [ return "var "- , return ident- , maybe (return "") (fmap (" = " ++) . prettyPrintJS') value- ]- match (JSAssignment target value) = fmap concat $ sequence- [ prettyPrintJS' target- , return " = "- , prettyPrintJS' value- ]- match (JSWhile cond sts) = fmap concat $ sequence- [ return "while ("- , prettyPrintJS' cond- , return ") "- , prettyPrintJS' sts- ]- match (JSFor ident start end sts) = fmap concat $ sequence- [ return $ "for (var " ++ ident ++ " = "- , prettyPrintJS' start- , return $ "; " ++ ident ++ " < "- , prettyPrintJS' end- , return $ "; " ++ ident ++ "++) "- , prettyPrintJS' sts- ]- match (JSForIn ident obj sts) = fmap concat $ sequence- [ return $ "for (var " ++ ident ++ " in "- , prettyPrintJS' obj- , return ") "- , prettyPrintJS' sts- ]- match (JSIfElse cond thens elses) = fmap concat $ sequence- [ return "if ("- , prettyPrintJS' cond- , return ") "- , prettyPrintJS' thens- , maybe (return "") (fmap (" else " ++) . prettyPrintJS') elses- ]- match (JSReturn value) = fmap concat $ sequence- [ return "return "- , prettyPrintJS' value- ]- match (JSThrow value) = fmap concat $ sequence- [ return "throw "- , prettyPrintJS' value- ]- match (JSBreak lbl) = return $ "break " ++ lbl- match (JSContinue lbl) = return $ "continue " ++ lbl- match (JSLabel lbl js) = fmap concat $ sequence- [ return $ lbl ++ ": "- , prettyPrintJS' js- ]- match (JSComment com js) = fmap concat $ sequence $- [ return "\n"- , currentIndent- , return "/**\n"- ] ++- map asLine (concatMap commentLines com) ++- [ currentIndent- , return " */\n"- , currentIndent- , prettyPrintJS' js- ]- where- commentLines :: Comment -> [String]- commentLines (LineComment s) = [s]- commentLines (BlockComment s) = lines s-- asLine :: String -> StateT PrinterState Maybe String- asLine s = do- i <- currentIndent- return $ i ++ " * " ++ removeComments s ++ "\n"-- removeComments :: String -> String- removeComments ('*' : '/' : s) = removeComments s- removeComments (c : s) = c : removeComments s-- removeComments [] = []- match (JSRaw js) = return js- match _ = mzero--string :: String -> String-string s = '"' : concatMap encodeChar s ++ "\""- where- encodeChar :: Char -> String- encodeChar '\b' = "\\b"- encodeChar '\t' = "\\t"- encodeChar '\n' = "\\n"- encodeChar '\v' = "\\v"- encodeChar '\f' = "\\f"- encodeChar '\r' = "\\r"- encodeChar '"' = "\\\""- encodeChar '\\' = "\\\\"- encodeChar c | fromEnum c > 0xFFF = "\\u" ++ showHex (fromEnum c) ""- encodeChar c | fromEnum c > 0xFF = "\\u0" ++ showHex (fromEnum c) ""- encodeChar c = [c]--conditional :: Pattern PrinterState JS ((JS, JS), JS)-conditional = mkPattern match- where- match (JSConditional cond th el) = Just ((th, el), cond)- match _ = Nothing--accessor :: Pattern PrinterState JS (String, JS)-accessor = mkPattern match- where- match (JSAccessor prop val) = Just (prop, val)- match _ = Nothing--indexer :: Pattern PrinterState JS (String, JS)-indexer = mkPattern' match- where- match (JSIndexer index val) = (,) <$> prettyPrintJS' index <*> pure val- match _ = mzero--lam :: Pattern PrinterState JS ((Maybe String, [String]), JS)-lam = mkPattern match- where- match (JSFunction name args ret) = Just ((name, args), ret)- match _ = Nothing--app :: Pattern PrinterState JS (String, JS)-app = mkPattern' match- where- match (JSApp val args) = do- jss <- mapM prettyPrintJS' args- return (intercalate ", " jss, val)- match _ = mzero--typeOf :: Pattern PrinterState JS ((), JS)-typeOf = mkPattern match- where- match (JSTypeOf val) = Just ((), val)- match _ = Nothing--instanceOf :: Pattern PrinterState JS (JS, JS)-instanceOf = mkPattern match- where- match (JSInstanceOf val ty) = Just (val, ty)- match _ = Nothing--unary' :: UnaryOperator -> (JS -> String) -> Operator PrinterState JS String-unary' op mkStr = Wrap match (++)- where- match :: Pattern PrinterState JS (String, JS)- match = mkPattern match'- where- match' (JSUnary op' val) | op' == op = Just (mkStr val, val)- match' _ = Nothing--unary :: UnaryOperator -> String -> Operator PrinterState JS String-unary op str = unary' op (const str)--negateOperator :: Operator PrinterState JS String-negateOperator = unary' Negate (\v -> if isNegate v then "- " else "-")- where- isNegate (JSUnary Negate _) = True- isNegate _ = False--binary :: BinaryOperator -> String -> Operator PrinterState JS String-binary op str = AssocL match (\v1 v2 -> v1 ++ " " ++ str ++ " " ++ v2)- where- match :: Pattern PrinterState JS (JS, JS)- match = mkPattern match'- where- match' (JSBinary op' v1 v2) | op' == op = Just (v1, v2)- match' _ = Nothing--prettyStatements :: [JS] -> StateT PrinterState Maybe String-prettyStatements sts = do- jss <- forM sts prettyPrintJS'- indentString <- currentIndent- return $ intercalate "\n" $ map ((++ ";") . (indentString ++)) jss---- |--- Generate a pretty-printed string representing a Javascript expression----prettyPrintJS1 :: JS -> String-prettyPrintJS1 = fromMaybe (error "Incomplete pattern") . flip evalStateT (PrinterState 0) . prettyPrintJS'---- |--- Generate a pretty-printed string representing a collection of Javascript expressions at the same indentation level----prettyPrintJS :: [JS] -> String-prettyPrintJS = fromMaybe (error "Incomplete pattern") . flip evalStateT (PrinterState 0) . prettyStatements---- |--- Generate an indented, pretty-printed string representing a Javascript expression----prettyPrintJS' :: JS -> StateT PrinterState Maybe String-prettyPrintJS' = A.runKleisli $ runPattern matchValue- where- matchValue :: Pattern PrinterState JS String- matchValue = buildPrettyPrinter operators (literals <+> fmap parens matchValue)- operators :: OperatorTable PrinterState JS String- operators =- OperatorTable [ [ Wrap accessor $ \prop val -> val ++ "." ++ prop ]- , [ Wrap indexer $ \index val -> val ++ "[" ++ index ++ "]" ]- , [ Wrap app $ \args val -> val ++ "(" ++ args ++ ")" ]- , [ unary JSNew "new " ]- , [ Wrap lam $ \(name, args) ret -> "function "- ++ fromMaybe "" name- ++ "(" ++ intercalate ", " args ++ ") "- ++ ret ]- , [ Wrap typeOf $ \_ s -> "typeof " ++ s ]- , [ unary Not "!"- , unary BitwiseNot "~"- , unary Positive "+"- , negateOperator ]- , [ binary Multiply "*"- , binary Divide "/"- , binary Modulus "%" ]- , [ binary Add "+"- , binary Subtract "-" ]- , [ binary ShiftLeft "<<"- , binary ShiftRight ">>"- , binary ZeroFillShiftRight ">>>" ]- , [ binary LessThan "<"- , binary LessThanOrEqualTo "<="- , binary GreaterThan ">"- , binary GreaterThanOrEqualTo ">="- , AssocR instanceOf $ \v1 v2 -> v1 ++ " instanceof " ++ v2 ]- , [ binary EqualTo "==="- , binary NotEqualTo "!==" ]- , [ binary BitwiseAnd "&" ]- , [ binary BitwiseXor "^" ]- , [ binary BitwiseOr "|" ]- , [ binary And "&&" ]- , [ binary Or "||" ]- , [ Wrap conditional $ \(th, el) cond -> cond ++ " ? " ++ prettyPrintJS1 th ++ " : " ++ prettyPrintJS1 el ]- ]
− src/Language/PureScript/Pretty/Kinds.hs
@@ -1,59 +0,0 @@------------------------------------------------------------------------------------ Module : Language.PureScript.Pretty.Kinds--- Copyright : (c) Phil Freeman 2013--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ |--- Pretty printer for kinds-----------------------------------------------------------------------------------module Language.PureScript.Pretty.Kinds (- prettyPrintKind-) where--import Data.Maybe (fromMaybe)--import Control.Arrow (ArrowPlus(..))-import Control.PatternArrows--import Language.PureScript.Kinds-import Language.PureScript.Pretty.Common--typeLiterals :: Pattern () Kind String-typeLiterals = mkPattern match- where- match Star = Just "*"- match Bang = Just "!"- match (KUnknown u) = Just $ 'u' : show u- match _ = Nothing--matchRow :: Pattern () Kind ((), Kind)-matchRow = mkPattern match- where- match (Row k) = Just ((), k)- match _ = Nothing--funKind :: Pattern () Kind (Kind, Kind)-funKind = mkPattern match- where- match (FunKind arg ret) = Just (arg, ret)- match _ = Nothing---- |--- Generate a pretty-printed string representing a Kind----prettyPrintKind :: Kind -> String-prettyPrintKind = fromMaybe (error "Incomplete pattern") . pattern matchKind ()- where- matchKind :: Pattern () Kind String- matchKind = buildPrettyPrinter operators (typeLiterals <+> fmap parens matchKind)- operators :: OperatorTable () Kind String- operators =- OperatorTable [ [ Wrap matchRow $ \_ k -> "# " ++ k]- , [ AssocR funKind $ \arg ret -> arg ++ " -> " ++ ret ] ]
src/Language/PureScript/Pretty/Types.hs view
@@ -1,129 +1,310 @@------------------------------------------------------------------------------------ Module : Language.PureScript.Pretty.Types--- Copyright : (c) Phil Freeman 2013--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :--- -- | -- Pretty printer for Types ----------------------------------------------------------------------------------module Language.PureScript.Pretty.Types (- prettyPrintType,- prettyPrintTypeAtom,- prettyPrintRow-) where+module Language.PureScript.Pretty.Types+ ( PrettyPrintType(..)+ , PrettyPrintConstraint+ , convertPrettyPrintType+ , typeAsBox+ , typeDiffAsBox+ , prettyPrintType+ , prettyPrintTypeWithUnicode+ , prettyPrintSuggestedType+ , typeAtomAsBox+ , prettyPrintTypeAtom+ , prettyPrintLabel+ , prettyPrintObjectKey+ ) where -import Data.Maybe (fromMaybe)-import Data.List (intercalate)+import Prelude hiding ((<>)) import Control.Arrow ((<+>))-import Control.PatternArrows+import Control.Lens (_2, (%~))+import Control.PatternArrows as PA -import Language.PureScript.Types-import Language.PureScript.Kinds-import Language.PureScript.Pretty.Common-import Language.PureScript.Pretty.Kinds-import Language.PureScript.Environment+import Data.Maybe (fromMaybe, catMaybes)+import Data.Text (Text)+import Data.Text qualified as T -typeLiterals :: Pattern () Type String-typeLiterals = mkPattern match+import Language.PureScript.Crash (internalError)+import Language.PureScript.Environment (tyFunction, tyRecord)+import Language.PureScript.Names (OpName(..), OpNameType(..), ProperName(..), ProperNameType(..), Qualified, coerceProperName, disqualify, showQualified)+import Language.PureScript.Pretty.Common (before, objectKeyRequiresQuoting)+import Language.PureScript.Types (Constraint(..), pattern REmptyKinded, RowListItem(..), Type(..), TypeVarVisibility(..), WildcardData(..), eqType, rowToSortedList, typeVarVisibilityPrefix)+import Language.PureScript.PSString (PSString, prettyPrintString, decodeString)+import Language.PureScript.Label (Label(..))++import Text.PrettyPrint.Boxes (Box(..), hcat, hsep, left, moveRight, nullBox, render, text, top, vcat, (<>))++data PrettyPrintType+ = PPTUnknown Int+ | PPTypeVar Text (Maybe Text)+ | PPTypeLevelString PSString+ | PPTypeLevelInt Integer+ | PPTypeWildcard (Maybe Text)+ | PPTypeConstructor (Qualified (ProperName 'TypeName))+ | PPTypeOp (Qualified (OpName 'TypeOpName))+ | PPSkolem Text Int+ | PPTypeApp PrettyPrintType PrettyPrintType+ | PPKindArg PrettyPrintType+ | PPConstrainedType PrettyPrintConstraint PrettyPrintType+ | PPKindedType PrettyPrintType PrettyPrintType+ | PPBinaryNoParensType PrettyPrintType PrettyPrintType PrettyPrintType+ | PPParensInType PrettyPrintType+ | PPForAll [(TypeVarVisibility, Text, Maybe PrettyPrintType)] PrettyPrintType+ | PPFunction PrettyPrintType PrettyPrintType+ | PPRecord [(Label, PrettyPrintType)] (Maybe PrettyPrintType)+ | PPRow [(Label, PrettyPrintType)] (Maybe PrettyPrintType)+ | PPTruncated++type PrettyPrintConstraint = (Qualified (ProperName 'ClassName), [PrettyPrintType], [PrettyPrintType])++convertPrettyPrintType :: Int -> Type a -> PrettyPrintType+convertPrettyPrintType = go where- match TypeWildcard = Just "_"- match (TypeVar var) = Just var- match (PrettyPrintObject row) = Just $ "{ " ++ prettyPrintRow row ++ " }"- match (PrettyPrintArray ty) = Just $ "[" ++ prettyPrintType ty ++ "]"- match (TypeConstructor ctor) = Just $ show ctor- match (TUnknown u) = Just $ 'u' : show u- match (Skolem name s _) = Just $ name ++ show s- match (ConstrainedType deps ty) = Just $ "(" ++ intercalate ", " (map (\(pn, ty') -> show pn ++ " " ++ unwords (map prettyPrintTypeAtom ty')) deps) ++ ") => " ++ prettyPrintType ty- match (SaturatedTypeSynonym name args) = Just $ show name ++ "<" ++ intercalate "," (map prettyPrintTypeAtom args) ++ ">"- match REmpty = Just "()"- match row@RCons{} = Just $ '(' : prettyPrintRow row ++ ")"- match _ = Nothing+ go _ (TUnknown _ n) = PPTUnknown n+ go _ (TypeVar _ t) = PPTypeVar t Nothing+ go _ (TypeLevelString _ s) = PPTypeLevelString s+ go _ (TypeLevelInt _ n) = PPTypeLevelInt n+ go _ (TypeWildcard _ (HoleWildcard n)) = PPTypeWildcard (Just n)+ go _ (TypeWildcard _ _) = PPTypeWildcard Nothing+ go _ (TypeConstructor _ c) = PPTypeConstructor c+ go _ (TypeOp _ o) = PPTypeOp o+ go _ (Skolem _ t _ n _) = PPSkolem t n+ go _ (REmpty _) = PPRow [] Nothing+ -- Guard the remaining "complex" type atoms on the current depth value. The+ -- prior constructors can all be printed simply so it's not really helpful to+ -- truncate them.+ go d _ | d < 0 = PPTruncated+ go d (ConstrainedType _ (Constraint _ cls kargs args _) ty) = PPConstrainedType (cls, go (d-1) <$> kargs, go (d-1) <$> args) (go d ty)+ go d (KindedType _ ty k) = PPKindedType (go (d-1) ty) (go (d-1) k)+ go d (BinaryNoParensType _ ty1 ty2 ty3) = PPBinaryNoParensType (go (d-1) ty1) (go (d-1) ty2) (go (d-1) ty3)+ go d (ParensInType _ ty) = PPParensInType (go (d-1) ty)+ go d ty@RCons{} = uncurry PPRow (goRow d ty)+ go d (ForAll _ vis v mbK ty _) = goForAll d [(vis, v, fmap (go (d-1)) mbK)] ty+ go d (TypeApp _ a b) = goTypeApp d a b+ go d (KindApp _ a b) = PPTypeApp (go (d-1) a) (PPKindArg (go (d-1) b)) + goForAll d vs (ForAll _ vis v mbK ty _) = goForAll d ((vis, v, fmap (go (d-1)) mbK) : vs) ty+ goForAll d vs ty = PPForAll (reverse vs) (go (d-1) ty)++ goRow d ty =+ let (items, tail_) = rowToSortedList ty+ in ( map (\item -> (rowListLabel item, go (d-1) (rowListType item))) items+ , case tail_ of+ REmptyKinded _ _ -> Nothing+ _ -> Just (go (d-1) tail_)+ )++ goTypeApp d (TypeApp _ f a) b+ | eqType f tyFunction = PPFunction (go (d-1) a) (go (d-1) b)+ | otherwise = PPTypeApp (goTypeApp d f a) (go (d-1) b)+ goTypeApp d o ty@RCons{}+ | eqType o tyRecord = uncurry PPRecord (goRow d ty)+ goTypeApp d a b = PPTypeApp (go (d-1) a) (go (d-1) b)++-- TODO(Christoph): get rid of T.unpack s++constraintsAsBox :: TypeRenderOptions -> PrettyPrintConstraint -> Box -> Box+constraintsAsBox tro con ty =+ constraintAsBox con `before` (" " <> text doubleRightArrow <> " " <> ty)+ where+ doubleRightArrow = if troUnicode tro then "⇒" else "=>"++constraintAsBox :: PrettyPrintConstraint -> Box+constraintAsBox (pn, ks, tys) = typeAsBox' (foldl PPTypeApp (foldl (\a b -> PPTypeApp a (PPKindArg b)) (PPTypeConstructor (fmap coerceProperName pn)) ks) tys)+ -- | -- Generate a pretty-printed string representing a Row ---prettyPrintRow :: Type -> String-prettyPrintRow = (\(tys, rest) -> intercalate ", " (map (uncurry nameAndTypeToPs) tys) ++ tailToPs rest) . toList []+prettyPrintRowWith :: TypeRenderOptions -> Char -> Char -> [(Label, PrettyPrintType)] -> Maybe PrettyPrintType -> Box+prettyPrintRowWith tro open close labels rest =+ case (labels, rest) of+ ([], Nothing) ->+ if troRowAsDiff tro then text [ open, ' ' ] <> text "..." <> text [ ' ', close ] else text [ open, close ]+ ([], Just _) ->+ text [ open, ' ' ] <> tailToPs rest <> text [ ' ', close ]+ _ ->+ vcat left $+ zipWith (\(nm, ty) i -> nameAndTypeToPs (if i == 0 then open else ',') nm ty) labels [0 :: Int ..] +++ catMaybes [ rowDiff, pure $ tailToPs rest, pure $ text [close] ]+ where- nameAndTypeToPs :: String -> Type -> String- nameAndTypeToPs name ty = prettyPrintObjectKey name ++ " :: " ++ prettyPrintType ty- tailToPs :: Type -> String- tailToPs REmpty = ""- tailToPs other = " | " ++ prettyPrintType other- toList :: [(String, Type)] -> Type -> ([(String, Type)], Type)- toList tys (RCons name ty row) = toList ((name, ty):tys) row- toList tys r = (tys, r)+ nameAndTypeToPs :: Char -> Label -> PrettyPrintType -> Box+ nameAndTypeToPs start name ty = text (start : ' ' : T.unpack (prettyPrintLabel name) ++ " " ++ doubleColon ++ " ") <> typeAsBox' ty -typeApp :: Pattern () Type (Type, Type)+ doubleColon = if troUnicode tro then "∷" else "::"++ rowDiff = if troRowAsDiff tro then Just (text "...") else Nothing++ tailToPs :: Maybe PrettyPrintType -> Box+ tailToPs Nothing = nullBox+ tailToPs (Just other) = text "| " <> typeAsBox' other++typeApp :: Pattern () PrettyPrintType (PrettyPrintType, PrettyPrintType) typeApp = mkPattern match where- match (TypeApp f x) = Just (f, x)+ match (PPTypeApp f x) = Just (f, x) match _ = Nothing -appliedFunction :: Pattern () Type (Type, Type)+kindArg :: Pattern () PrettyPrintType ((), PrettyPrintType)+kindArg = mkPattern match+ where+ match (PPKindArg ty) = Just ((), ty)+ match _ = Nothing++appliedFunction :: Pattern () PrettyPrintType (PrettyPrintType, PrettyPrintType) appliedFunction = mkPattern match where- match (PrettyPrintFunction arg ret) = Just (arg, ret)+ match (PPFunction arg ret) = Just (arg, ret) match _ = Nothing -kinded :: Pattern () Type (Kind, Type)+kinded :: Pattern () PrettyPrintType (PrettyPrintType, PrettyPrintType) kinded = mkPattern match where- match (KindedType t k) = Just (k, t)+ match (PPKindedType t k) = Just (t, k) match _ = Nothing -insertPlaceholders :: Type -> Type-insertPlaceholders = everywhereOnTypesTopDown convertForAlls . everywhereOnTypes convert+constrained :: Pattern () PrettyPrintType (PrettyPrintConstraint, PrettyPrintType)+constrained = mkPattern match where- convert (TypeApp (TypeApp f arg) ret) | f == tyFunction = PrettyPrintFunction arg ret- convert (TypeApp a el) | a == tyArray = PrettyPrintArray el- convert (TypeApp o r) | o == tyObject = PrettyPrintObject r- convert other = other- convertForAlls (ForAll ident ty _) = go [ident] ty- where- go idents (ForAll ident' ty' _) = go (ident' : idents) ty'- go idents other = PrettyPrintForAll idents other- convertForAlls other = other+ match (PPConstrainedType deps ty) = Just (deps, ty)+ match _ = Nothing -matchTypeAtom :: Pattern () Type String-matchTypeAtom = typeLiterals <+> fmap parens matchType+explicitParens :: Pattern () PrettyPrintType ((), PrettyPrintType)+explicitParens = mkPattern match+ where+ match (PPParensInType ty) = Just ((), ty)+ match _ = Nothing -matchType :: Pattern () Type String-matchType = buildPrettyPrinter operators matchTypeAtom+matchTypeAtom :: TypeRenderOptions -> Pattern () PrettyPrintType Box+matchTypeAtom tro@TypeRenderOptions{troSuggesting = suggesting} =+ typeLiterals <+> fmap ((`before` text ")") . (text "(" <>)) (matchType tro) where- operators :: OperatorTable () Type String+ typeLiterals :: Pattern () PrettyPrintType Box+ typeLiterals = mkPattern match where+ match (PPTypeWildcard name) = Just $ text $ maybe "_" (('?' :) . T.unpack) name+ match (PPTypeVar var _) = Just $ text $ T.unpack var+ match (PPTypeLevelString s) = Just $ text $ T.unpack $ prettyPrintString s+ match (PPTypeLevelInt n) = Just $ text $ show n+ match (PPTypeConstructor ctor) = Just $ text $ T.unpack $ runProperName $ disqualify ctor+ match (PPTUnknown u)+ | suggesting = Just $ text "_"+ | otherwise = Just $ text $ 't' : show u+ match (PPSkolem name s)+ | suggesting = Just $ text $ T.unpack name+ | otherwise = Just $ text $ T.unpack name ++ show s+ match (PPRecord labels tail_) = Just $ prettyPrintRowWith tro '{' '}' labels tail_+ match (PPRow labels tail_) = Just $ prettyPrintRowWith tro '(' ')' labels tail_+ match (PPBinaryNoParensType op l r) =+ Just $ typeAsBox' l <> text " " <> typeAsBox' op <> text " " <> typeAsBox' r+ match (PPTypeOp op) = Just $ text $ T.unpack $ showQualified runOpName op+ match PPTruncated = Just $ text "..."+ match _ = Nothing++matchType :: TypeRenderOptions -> Pattern () PrettyPrintType Box+matchType tro = buildPrettyPrinter operators (matchTypeAtom tro) where+ operators :: OperatorTable () PrettyPrintType Box operators =- OperatorTable [ [ AssocL typeApp $ \f x -> f ++ " " ++ x ]- , [ AssocR appliedFunction $ \arg ret -> arg ++ " -> " ++ ret- ]- , [ Wrap forall_ $ \idents ty -> "forall " ++ unwords idents ++ ". " ++ ty ]- , [ Wrap kinded $ \k ty -> ty ++ " :: " ++ prettyPrintKind k ]+ OperatorTable [ [ Wrap kindArg $ \_ ty -> text "@" <> ty ]+ , [ AssocL typeApp $ \f x -> keepSingleLinesOr (moveRight 2) f x ]+ , [ AssocR appliedFunction $ \arg ret -> keepSingleLinesOr id arg (text rightArrow <> " " <> ret) ]+ , [ Wrap constrained $ \deps ty -> constraintsAsBox tro deps ty ]+ , [ Wrap forall_ $ \idents ty -> keepSingleLinesOr (moveRight 2) (hsep 1 top (text forall' : fmap printMbKindedType idents) <> text ".") ty ]+ , [ Wrap kinded $ \ty k -> keepSingleLinesOr (moveRight 2) (typeAsBox' ty) (text (doubleColon ++ " ") <> k) ]+ , [ Wrap explicitParens $ \_ ty -> ty ] ] -forall_ :: Pattern () Type ([String], Type)+ rightArrow = if troUnicode tro then "→" else "->"+ forall' = if troUnicode tro then "∀" else "forall"+ doubleColon = if troUnicode tro then "∷" else "::"++ printMbKindedType (vis, v, Nothing) = text (T.unpack $ typeVarVisibilityPrefix vis) <> text v+ printMbKindedType (vis, v, Just k) = text ("(" ++ T.unpack (typeVarVisibilityPrefix vis) ++ v ++ " " ++ doubleColon ++ " ") <> typeAsBox' k <> text ")"++ -- If both boxes span a single line, keep them on the same line, or else+ -- use the specified function to modify the second box, then combine vertically.+ keepSingleLinesOr :: (Box -> Box) -> Box -> Box -> Box+ keepSingleLinesOr f b1 b2+ | rows b1 > 1 || rows b2 > 1 = vcat left [ b1, f b2 ]+ | otherwise = hcat top [ b1, text " ", b2]++forall_ :: Pattern () PrettyPrintType ([(TypeVarVisibility, String, Maybe PrettyPrintType)], PrettyPrintType) forall_ = mkPattern match where- match (PrettyPrintForAll idents ty) = Just (idents, ty)+ match (PPForAll idents ty) = Just ((_2 %~ T.unpack) <$> idents, ty) match _ = Nothing --- |--- Generate a pretty-printed string representing a Type, as it should appear inside parentheses----prettyPrintTypeAtom :: Type -> String-prettyPrintTypeAtom = fromMaybe (error "Incomplete pattern") . pattern matchTypeAtom () . insertPlaceholders+typeAtomAsBox' :: PrettyPrintType -> Box+typeAtomAsBox'+ = fromMaybe (internalError "Incomplete pattern")+ . PA.pattern (matchTypeAtom defaultOptions) () +typeAtomAsBox :: Int -> Type a -> Box+typeAtomAsBox maxDepth = typeAtomAsBox' . convertPrettyPrintType maxDepth --- |--- Generate a pretty-printed string representing a Type----prettyPrintType :: Type -> String-prettyPrintType = fromMaybe (error "Incomplete pattern") . pattern matchType () . insertPlaceholders+-- | Generate a pretty-printed string representing a Type, as it should appear inside parentheses+prettyPrintTypeAtom :: Int -> Type a -> String+prettyPrintTypeAtom maxDepth = render . typeAtomAsBox maxDepth +typeAsBox' :: PrettyPrintType -> Box+typeAsBox' = typeAsBoxImpl defaultOptions++typeAsBox :: Int -> Type a -> Box+typeAsBox maxDepth = typeAsBox' . convertPrettyPrintType maxDepth++typeDiffAsBox' :: PrettyPrintType -> Box+typeDiffAsBox' = typeAsBoxImpl diffOptions++typeDiffAsBox :: Int -> Type a -> Box+typeDiffAsBox maxDepth = typeDiffAsBox' . convertPrettyPrintType maxDepth++data TypeRenderOptions = TypeRenderOptions+ { troSuggesting :: Bool+ , troUnicode :: Bool+ , troRowAsDiff :: Bool+ }++suggestingOptions :: TypeRenderOptions+suggestingOptions = TypeRenderOptions True False False++defaultOptions :: TypeRenderOptions+defaultOptions = TypeRenderOptions False False False++diffOptions :: TypeRenderOptions+diffOptions = TypeRenderOptions False False True++unicodeOptions :: TypeRenderOptions+unicodeOptions = TypeRenderOptions False True False++typeAsBoxImpl :: TypeRenderOptions -> PrettyPrintType -> Box+typeAsBoxImpl tro+ = fromMaybe (internalError "Incomplete pattern")+ . PA.pattern (matchType tro) ()++-- | Generate a pretty-printed string representing a 'Type'+prettyPrintType :: Int -> Type a -> String+prettyPrintType = flip prettyPrintType' defaultOptions++-- | Generate a pretty-printed string representing a 'Type' using unicode+-- symbols where applicable+prettyPrintTypeWithUnicode :: Int -> Type a -> String+prettyPrintTypeWithUnicode = flip prettyPrintType' unicodeOptions++-- | Generate a pretty-printed string representing a suggested 'Type'+prettyPrintSuggestedType :: Type a -> String+prettyPrintSuggestedType = prettyPrintType' maxBound suggestingOptions++prettyPrintType' :: Int -> TypeRenderOptions -> Type a -> String+prettyPrintType' maxDepth tro = render . typeAsBoxImpl tro . convertPrettyPrintType maxDepth++prettyPrintLabel :: Label -> Text+prettyPrintLabel (Label s) =+ case decodeString s of+ Just s' | not (objectKeyRequiresQuoting s') ->+ s'+ _ ->+ prettyPrintString s++prettyPrintObjectKey :: PSString -> Text+prettyPrintObjectKey = prettyPrintLabel . Label
src/Language/PureScript/Pretty/Values.hs view
@@ -1,250 +1,230 @@------------------------------------------------------------------------------------ Module : Language.PureScript.Pretty.Values--- Copyright : (c) Phil Freeman 2013--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :--- -- | -- Pretty printer for values --------------------------------------------------------------------------------+module Language.PureScript.Pretty.Values+ ( prettyPrintValue+ , prettyPrintBinder+ , prettyPrintBinderAtom+ ) where -module Language.PureScript.Pretty.Values (- prettyPrintValue,- prettyPrintBinder-) where+import Prelude hiding ((<>)) -import Data.Maybe (fromMaybe)-import Data.List (intercalate)+import Control.Arrow (second) -import Control.Arrow ((<+>), runKleisli, second)-import Control.PatternArrows-import Control.Monad.State-import Control.Applicative+import Data.Text (Text)+import Data.List.NonEmpty qualified as NEL+import Data.Monoid qualified as Monoid ((<>))+import Data.Text qualified as T -import Language.PureScript.AST-import Language.PureScript.Names-import Language.PureScript.Pretty.Common-import Language.PureScript.Pretty.Types (prettyPrintType, prettyPrintTypeAtom)+import Language.PureScript.AST (AssocList(..), Binder(..), CaseAlternative(..), Declaration(..), DoNotationElement(..), Expr(..), Guard(..), GuardedExpr(..), Literal(..), PathNode(..), PathTree(..), TypeDeclarationData(..), pattern ValueDecl, WhereProvenance(..))+import Language.PureScript.Crash (internalError)+import Language.PureScript.Names (OpName(..), ProperName(..), Qualified(..), disqualify, runModuleName, showIdent)+import Language.PureScript.Pretty.Common (before, beforeWithSpace, parensT)+import Language.PureScript.Pretty.Types (typeAsBox, typeAtomAsBox, prettyPrintObjectKey)+import Language.PureScript.Types (Constraint(..))+import Language.PureScript.PSString (PSString, prettyPrintString) -literals :: Pattern PrinterState Expr String-literals = mkPattern' match- where- match :: Expr -> StateT PrinterState Maybe String- match (NumericLiteral n) = return $ either show show n- match (StringLiteral s) = return $ show s- match (BooleanLiteral True) = return "true"- match (BooleanLiteral False) = return "false"- match (ArrayLiteral xs) = concat <$> sequence- [ return "[ "- , withIndent $ prettyPrintMany prettyPrintValue' xs- , return " ]"- ]- match (ObjectLiteral ps) = prettyPrintObject' $ second Just `map` ps- match (ObjectConstructor ps) = prettyPrintObject' ps- match (ObjectGetter prop) = return $ "(." ++ prop ++ ")"- match (TypeClassDictionaryConstructorApp className ps) = concat <$> sequence- [ return (show className ++ "(\n")- , match ps- , return ")"- ]- match (Constructor name) = return $ show name- match (Case values binders) = concat <$> sequence- [ return "case "- , unwords <$> forM values prettyPrintValue'- , return " of\n"- , withIndent $ prettyPrintMany prettyPrintCaseAlternative binders- , currentIndent- ]- match (Let ds val) = concat <$> sequence- [ return "let\n"- , withIndent $ prettyPrintMany prettyPrintDeclaration ds- , return "\n"- , currentIndent- , return "in "- , prettyPrintValue' val- ]- match (Var ident) = return $ show ident- match (Do els) = concat <$> sequence- [ return "do "- , withIndent $ prettyPrintMany prettyPrintDoNotationElement els- , currentIndent- ]- match (OperatorSection op (Right val)) = return $ "(" ++ prettyPrintValue op ++ " " ++ prettyPrintValue val ++ ")"- match (OperatorSection op (Left val)) = return $ "(" ++ prettyPrintValue val ++ " " ++ prettyPrintValue op ++ ")"- match (TypeClassDictionary _ (name, tys) _) = return $ "<<dict " ++ show name ++ " " ++ unwords (map prettyPrintTypeAtom tys) ++ ">>"- match (SuperClassDictionary name _) = return $ "<<superclass dict " ++ show name ++ ">>"- match (TypedValue _ val _) = prettyPrintValue' val- match (PositionedValue _ _ val) = prettyPrintValue' val- match _ = mzero+import Text.PrettyPrint.Boxes (Box, left, moveRight, text, vcat, vsep, (//), (<>)) -prettyPrintDeclaration :: Declaration -> StateT PrinterState Maybe String-prettyPrintDeclaration (TypeDeclaration ident ty) = return $ show ident ++ " :: " ++ prettyPrintType ty-prettyPrintDeclaration (ValueDeclaration ident _ [] (Right val)) = concat <$> sequence- [ return $ show ident ++ " = "- , prettyPrintValue' val- ]-prettyPrintDeclaration (PositionedDeclaration _ _ d) = prettyPrintDeclaration d-prettyPrintDeclaration _ = error "Invalid argument to prettyPrintDeclaration"+-- TODO(Christoph): remove T.unpack s -prettyPrintCaseAlternative :: CaseAlternative -> StateT PrinterState Maybe String-prettyPrintCaseAlternative (CaseAlternative binders result) =- concat <$> sequence- [ intercalate ", " <$> forM binders prettyPrintBinder'- , prettyPrintResult result- ]+textT :: Text -> Box+textT = text . T.unpack++-- | Render an aligned list of items separated with commas+list :: Char -> Char -> (a -> Box) -> [a] -> Box+list open close _ [] = text [open, close]+list open close f xs = vcat left (zipWith toLine [0 :: Int ..] xs ++ [ text [ close ] ]) where- prettyPrintResult (Left gs) = concat <$> mapM prettyPrintGuardedValue gs- prettyPrintResult (Right v) = (" -> " ++) <$> prettyPrintValue' v+ toLine i a = text [ if i == 0 then open else ',', ' ' ] <> f a - prettyPrintGuardedValue (grd, val) =- concat <$> sequence- [ return "| "- , prettyPrintValue' grd- , return " -> "- , prettyPrintValue' val- , return "\n"- ]+ellipsis :: Box+ellipsis = text "..." -prettyPrintDoNotationElement :: DoNotationElement -> StateT PrinterState Maybe String-prettyPrintDoNotationElement (DoNotationValue val) =- prettyPrintValue' val-prettyPrintDoNotationElement (DoNotationBind binder val) =- concat <$> sequence- [ prettyPrintBinder' binder- , return " <- "- , prettyPrintValue' val- ]-prettyPrintDoNotationElement (DoNotationLet ds) =- concat <$> sequence- [ return "let "- , withIndent $ prettyPrintMany prettyPrintDeclaration ds- ]-prettyPrintDoNotationElement (PositionedDoNotationElement _ _ el) = prettyPrintDoNotationElement el+prettyPrintObject :: Int -> [(PSString, Maybe Expr)] -> Box+prettyPrintObject d = list '{' '}' prettyPrintObjectProperty+ where+ prettyPrintObjectProperty :: (PSString, Maybe Expr) -> Box+ prettyPrintObjectProperty (key, value) = textT (prettyPrintObjectKey key Monoid.<> ": ") <> maybe (text "_") (prettyPrintValue (d - 1)) value -prettyPrintObject' :: [(String, Maybe Expr)] -> StateT PrinterState Maybe String-prettyPrintObject' [] = return "{}"-prettyPrintObject' ps = concat <$> sequence- [ return "{\n"- , withIndent $ prettyPrintMany prettyPrintObjectProperty ps- , return "\n"- , currentIndent- , return "}"- ]+prettyPrintUpdateEntry :: Int -> PSString -> Expr -> Box+prettyPrintUpdateEntry d key val = textT (prettyPrintObjectKey key) <> text " = " <> prettyPrintValue (d - 1) val -ifThenElse :: Pattern PrinterState Expr ((Expr, Expr), Expr)-ifThenElse = mkPattern match+-- | Pretty-print an expression+prettyPrintValue :: Int -> Expr -> Box+prettyPrintValue d _ | d < 0 = text "..."+prettyPrintValue d (IfThenElse cond th el) =+ (text "if " <> prettyPrintValueAtom (d - 1) cond)+ // moveRight 2 (vcat left [ text "then " <> prettyPrintValueAtom (d - 1) th+ , text "else " <> prettyPrintValueAtom (d - 1) el+ ])+prettyPrintValue d (Accessor prop val) = prettyPrintValueAtom (d - 1) val `before` textT ("." Monoid.<> prettyPrintObjectKey prop)+prettyPrintValue d (ObjectUpdate o ps) = prettyPrintValueAtom (d - 1) o `beforeWithSpace` list '{' '}' (uncurry (prettyPrintUpdateEntry d)) ps+prettyPrintValue d (ObjectUpdateNested o ps) = prettyPrintValueAtom (d - 1) o `beforeWithSpace` prettyPrintUpdate ps where- match (IfThenElse cond th el) = Just ((th, el), cond)- match _ = Nothing+ prettyPrintUpdate (PathTree tree) = list '{' '}' printNode (runAssocList tree)+ printNode (key, Leaf val) = prettyPrintUpdateEntry d key val+ printNode (key, Branch val) = textT (prettyPrintObjectKey key) `beforeWithSpace` prettyPrintUpdate val+prettyPrintValue d (App val arg) = prettyPrintValueAtom (d - 1) val `beforeWithSpace` prettyPrintValueAtom (d - 1) arg+prettyPrintValue d (VisibleTypeApp val _) = prettyPrintValueAtom (d - 1) val+prettyPrintValue d (Unused val) = prettyPrintValue d val+prettyPrintValue d (Abs arg val) = text ('\\' : T.unpack (prettyPrintBinder arg) ++ " -> ") // moveRight 2 (prettyPrintValue (d - 1) val)+prettyPrintValue d (Case values binders) =+ (text "case " <> foldr beforeWithSpace (text "of") (map (prettyPrintValueAtom (d - 1)) values)) //+ moveRight 2 (vcat left (map (prettyPrintCaseAlternative (d - 1)) binders))+prettyPrintValue d (Let FromWhere ds val) =+ prettyPrintValue (d - 1) val //+ moveRight 2 (text "where" //+ vcat left (map (prettyPrintDeclaration (d - 1)) ds))+prettyPrintValue d (Let FromLet ds val) =+ text "let" //+ moveRight 2 (vcat left (map (prettyPrintDeclaration (d - 1)) ds)) //+ (text "in " <> prettyPrintValue (d - 1) val)+prettyPrintValue d (Do m els) =+ textT (maybe "" ((Monoid.<> ".") . runModuleName) m) <> text "do " <> vcat left (map (prettyPrintDoNotationElement (d - 1)) els)+prettyPrintValue d (Ado m els yield) =+ textT (maybe "" ((Monoid.<> ".") . runModuleName) m) <> text "ado " <> vcat left (map (prettyPrintDoNotationElement (d - 1)) els) //+ (text "in " <> prettyPrintValue (d - 1) yield)+-- TODO: constraint kind args+prettyPrintValue d (TypeClassDictionary (Constraint _ name _ tys _) _ _) = foldl1 beforeWithSpace $ text ("#dict " ++ T.unpack (runProperName (disqualify name))) : map (typeAtomAsBox d) tys+prettyPrintValue _ (DeferredDictionary name _) = text $ "#dict " ++ T.unpack (runProperName (disqualify name))+prettyPrintValue _ (DerivedInstancePlaceholder name _) = text $ "#derived " ++ T.unpack (runProperName (disqualify name))+prettyPrintValue d (TypedValue _ val _) = prettyPrintValue d val+prettyPrintValue d (PositionedValue _ _ val) = prettyPrintValue d val+prettyPrintValue d (Literal _ l) = prettyPrintLiteralValue d l+prettyPrintValue _ (Hole name) = text "?" <> textT name+prettyPrintValue d expr@AnonymousArgument{} = prettyPrintValueAtom d expr+prettyPrintValue d expr@Constructor{} = prettyPrintValueAtom d expr+prettyPrintValue d expr@Var{} = prettyPrintValueAtom d expr+prettyPrintValue d expr@Op{} = prettyPrintValueAtom d expr+prettyPrintValue d expr@BinaryNoParens{} = prettyPrintValueAtom d expr+prettyPrintValue d expr@Parens{} = prettyPrintValueAtom d expr+prettyPrintValue d expr@UnaryMinus{} = prettyPrintValueAtom d expr -accessor :: Pattern PrinterState Expr (String, Expr)-accessor = mkPattern match+-- | Pretty-print an atomic expression, adding parentheses if necessary.+prettyPrintValueAtom :: Int -> Expr -> Box+prettyPrintValueAtom d (Literal _ l) = prettyPrintLiteralValue d l+prettyPrintValueAtom _ AnonymousArgument = text "_"+prettyPrintValueAtom _ (Constructor _ name) = text $ T.unpack $ runProperName (disqualify name)+prettyPrintValueAtom _ (Var _ ident) = text $ T.unpack $ showIdent (disqualify ident)+prettyPrintValueAtom d (BinaryNoParens op lhs rhs) =+ prettyPrintValue (d - 1) lhs `beforeWithSpace` printOp op `beforeWithSpace` prettyPrintValue (d - 1) rhs where- match (Accessor prop val) = Just (prop, val)- match _ = Nothing+ printOp (Op _ (Qualified _ name)) = text $ T.unpack $ runOpName name+ printOp expr = text "`" <> prettyPrintValue (d - 1) expr `before` text "`"+prettyPrintValueAtom d (TypedValue _ val _) = prettyPrintValueAtom d val+prettyPrintValueAtom d (PositionedValue _ _ val) = prettyPrintValueAtom d val+prettyPrintValueAtom d (Parens expr) = (text "(" <> prettyPrintValue d expr) `before` text ")"+prettyPrintValueAtom d (UnaryMinus _ expr) = text "(-" <> prettyPrintValue d expr <> text ")"+prettyPrintValueAtom d expr = (text "(" <> prettyPrintValue d expr) `before` text ")" -objectUpdate :: Pattern PrinterState Expr ([String], Expr)-objectUpdate = mkPattern match- where- match (ObjectUpdate o ps) = Just (flip map ps $ \(key, val) -> key ++ " = " ++ prettyPrintValue val, o)- match (ObjectUpdater o ps) = Just (flip map ps $ \(key, val) -> key ++ " = " ++ maybe "_" prettyPrintValue val, fromMaybe (Var (Qualified Nothing $ Ident "_")) o)- match _ = Nothing+prettyPrintLiteralValue :: Int -> Literal Expr -> Box+prettyPrintLiteralValue _ (NumericLiteral n) = text $ either show show n+prettyPrintLiteralValue _ (StringLiteral s) = text $ T.unpack $ prettyPrintString s+prettyPrintLiteralValue _ (CharLiteral c) = text $ show c+prettyPrintLiteralValue _ (BooleanLiteral True) = text "true"+prettyPrintLiteralValue _ (BooleanLiteral False) = text "false"+prettyPrintLiteralValue d (ArrayLiteral xs) = list '[' ']' (prettyPrintValue (d - 1)) xs+prettyPrintLiteralValue d (ObjectLiteral ps) = prettyPrintObject (d - 1) $ second Just `map` ps -app :: Pattern PrinterState Expr (String, Expr)-app = mkPattern match+prettyPrintDeclaration :: Int -> Declaration -> Box+prettyPrintDeclaration d _ | d < 0 = ellipsis+prettyPrintDeclaration d (TypeDeclaration td) =+ text (T.unpack (showIdent (tydeclIdent td)) ++ " :: ") <> typeAsBox d (tydeclType td)+prettyPrintDeclaration d (ValueDecl _ ident _ [] [GuardedExpr [] val]) =+ text (T.unpack (showIdent ident) ++ " = ") <> prettyPrintValue (d - 1) val+prettyPrintDeclaration d (BindingGroupDeclaration ds) =+ vsep 1 left (NEL.toList (fmap (prettyPrintDeclaration (d - 1) . toDecl) ds)) where- match (App val arg) = Just (prettyPrintValue arg, val)- match _ = Nothing+ toDecl ((sa, nm), t, e) = ValueDecl sa nm t [] [GuardedExpr [] e]+prettyPrintDeclaration _ _ = internalError "Invalid argument to prettyPrintDeclaration" -lam :: Pattern PrinterState Expr (String, Expr)-lam = mkPattern match+prettyPrintCaseAlternative :: Int -> CaseAlternative -> Box+prettyPrintCaseAlternative d _ | d < 0 = ellipsis+prettyPrintCaseAlternative d (CaseAlternative binders result) =+ text (T.unpack (T.unwords (map prettyPrintBinderAtom binders))) <> prettyPrintResult result where- match (Abs (Left arg) val) = Just (show arg, val)- match _ = Nothing+ prettyPrintResult :: [GuardedExpr] -> Box+ prettyPrintResult [GuardedExpr [] v] = text " -> " <> prettyPrintValue (d - 1) v+ prettyPrintResult gs =+ vcat left (map (prettyPrintGuardedValueSep (text " | ")) gs) --- |--- Generate a pretty-printed string representing an expression----prettyPrintValue :: Expr -> String-prettyPrintValue = fromMaybe (error "Incomplete pattern") . flip evalStateT (PrinterState 0) . prettyPrintValue'+ prettyPrintGuardedValueSep :: Box -> GuardedExpr -> Box+ prettyPrintGuardedValueSep _ (GuardedExpr [] val) =+ text " -> " <> prettyPrintValue (d - 1) val -prettyPrintValue' :: Expr -> StateT PrinterState Maybe String-prettyPrintValue' = runKleisli $ runPattern matchValue- where- matchValue :: Pattern PrinterState Expr String- matchValue = buildPrettyPrinter operators (literals <+> fmap parens matchValue)- operators :: OperatorTable PrinterState Expr String- operators =- OperatorTable [ [ Wrap accessor $ \prop val -> val ++ "." ++ prop ]- , [ Wrap objectUpdate $ \ps val -> val ++ "{ " ++ intercalate ", " ps ++ " }" ]- , [ Wrap app $ \arg val -> val ++ "(" ++ arg ++ ")" ]- , [ Split lam $ \arg val -> "\\" ++ arg ++ " -> " ++ prettyPrintValue val ]- , [ Wrap ifThenElse $ \(th, el) cond -> "if " ++ cond ++ " then " ++ prettyPrintValue th ++ " else " ++ prettyPrintValue el ]+ prettyPrintGuardedValueSep sep (GuardedExpr [guard] val) =+ foldl1 before [ sep+ , prettyPrintGuard guard+ , prettyPrintGuardedValueSep sep (GuardedExpr [] val) ] -prettyPrintBinderAtom :: Pattern PrinterState Binder String-prettyPrintBinderAtom = mkPattern' match- where- match :: Binder -> StateT PrinterState Maybe String- match NullBinder = return "_"- match (StringBinder str) = return $ show str- match (NumberBinder num) = return $ either show show num- match (BooleanBinder True) = return "true"- match (BooleanBinder False) = return "false"- match (VarBinder ident) = return $ show ident- match (ConstructorBinder ctor args) = concat <$> sequence- [ return $ show ctor ++ " "- , unwords <$> forM args match- ]- match (ObjectBinder bs) = concat <$> sequence- [ return "{\n"- , withIndent $ prettyPrintMany prettyPrintObjectPropertyBinder bs- , currentIndent- , return "}"- ]- match (ArrayBinder bs) = concat <$> sequence- [ return "["- , unwords <$> mapM prettyPrintBinder' bs- , return "]"+ prettyPrintGuardedValueSep sep (GuardedExpr (guard : guards) val) =+ vcat left [ foldl1 before+ [ sep+ , prettyPrintGuard guard+ ]+ , prettyPrintGuardedValueSep (text " , ") (GuardedExpr guards val)+ ]++ prettyPrintGuard (ConditionGuard cond) =+ prettyPrintValue (d - 1) cond+ prettyPrintGuard (PatternGuard binder val) =+ foldl1 before+ [ text (T.unpack (prettyPrintBinder binder))+ , text " <- "+ , prettyPrintValue (d - 1) val ]- match (NamedBinder ident binder) = ((show ident ++ "@") ++) <$> prettyPrintBinder' binder- match (PositionedBinder _ _ binder) = prettyPrintBinder' binder- match _ = mzero --- |--- Generate a pretty-printed string representing a Binder----prettyPrintBinder :: Binder -> String-prettyPrintBinder = fromMaybe (error "Incomplete pattern") . flip evalStateT (PrinterState 0) . prettyPrintBinder'+prettyPrintDoNotationElement :: Int -> DoNotationElement -> Box+prettyPrintDoNotationElement d _ | d < 0 = ellipsis+prettyPrintDoNotationElement d (DoNotationValue val) =+ prettyPrintValue d val+prettyPrintDoNotationElement d (DoNotationBind binder val) =+ textT (prettyPrintBinder binder Monoid.<> " <- ") <> prettyPrintValue d val+prettyPrintDoNotationElement d (DoNotationLet ds) =+ text "let" //+ moveRight 2 (vcat left (map (prettyPrintDeclaration (d - 1)) ds))+prettyPrintDoNotationElement d (PositionedDoNotationElement _ _ el) = prettyPrintDoNotationElement d el -prettyPrintBinder' :: Binder -> StateT PrinterState Maybe String-prettyPrintBinder' = runKleisli $ runPattern matchBinder- where- matchBinder :: Pattern PrinterState Binder String- matchBinder = buildPrettyPrinter operators (prettyPrintBinderAtom <+> fmap parens matchBinder)- operators :: OperatorTable PrinterState Binder String- operators =- OperatorTable [ [ AssocR matchConsBinder (\b1 b2 -> b1 ++ " : " ++ b2) ] ]+prettyPrintBinderAtom :: Binder -> Text+prettyPrintBinderAtom NullBinder = "_"+prettyPrintBinderAtom (LiteralBinder _ l) = prettyPrintLiteralBinder l+prettyPrintBinderAtom (VarBinder _ ident) = showIdent ident+prettyPrintBinderAtom (ConstructorBinder _ ctor []) = runProperName (disqualify ctor)+prettyPrintBinderAtom b@ConstructorBinder{} = parensT (prettyPrintBinder b)+prettyPrintBinderAtom (NamedBinder _ ident binder) = showIdent ident Monoid.<> "@" Monoid.<> prettyPrintBinder binder+prettyPrintBinderAtom (PositionedBinder _ _ binder) = prettyPrintBinderAtom binder+prettyPrintBinderAtom (TypedBinder _ binder) = prettyPrintBinderAtom binder+prettyPrintBinderAtom (OpBinder _ op) = runOpName (disqualify op)+prettyPrintBinderAtom (BinaryNoParensBinder op b1 b2) =+ prettyPrintBinderAtom b1 Monoid.<> " " Monoid.<> prettyPrintBinderAtom op Monoid.<> " " Monoid.<> prettyPrintBinderAtom b2+prettyPrintBinderAtom (ParensInBinder b) = parensT (prettyPrintBinder b) -matchConsBinder :: Pattern PrinterState Binder (Binder, Binder)-matchConsBinder = mkPattern match'+prettyPrintLiteralBinder :: Literal Binder -> Text+prettyPrintLiteralBinder (StringLiteral str) = prettyPrintString str+prettyPrintLiteralBinder (CharLiteral c) = T.pack (show c)+prettyPrintLiteralBinder (NumericLiteral num) = either (T.pack . show) (T.pack . show) num+prettyPrintLiteralBinder (BooleanLiteral True) = "true"+prettyPrintLiteralBinder (BooleanLiteral False) = "false"+prettyPrintLiteralBinder (ObjectLiteral bs) =+ "{ "+ Monoid.<> T.intercalate ", " (map prettyPrintObjectPropertyBinder bs)+ Monoid.<> " }" where- match' (ConsBinder b1 b2) = Just (b1, b2)- match' _ = Nothing--prettyPrintObjectPropertyBinder :: (String, Binder) -> StateT PrinterState Maybe String-prettyPrintObjectPropertyBinder (key, binder) = concat <$> sequence- [ return $ prettyPrintObjectKey key ++ ": "- , prettyPrintBinder' binder- ]+ prettyPrintObjectPropertyBinder :: (PSString, Binder) -> Text+ prettyPrintObjectPropertyBinder (key, binder) = prettyPrintObjectKey key Monoid.<> ": " Monoid.<> prettyPrintBinder binder+prettyPrintLiteralBinder (ArrayLiteral bs) =+ "[ "+ Monoid.<> T.intercalate ", " (map prettyPrintBinder bs)+ Monoid.<> " ]" -prettyPrintObjectProperty :: (String, Maybe Expr) -> StateT PrinterState Maybe String-prettyPrintObjectProperty (key, value) = concat <$> sequence- [ return $ prettyPrintObjectKey key ++ ": "- , maybe (pure "_") prettyPrintValue' value- ]+-- |+-- Generate a pretty-printed string representing a Binder+--+prettyPrintBinder :: Binder -> Text+prettyPrintBinder (ConstructorBinder _ ctor []) = runProperName (disqualify ctor)+prettyPrintBinder (ConstructorBinder _ ctor args) = runProperName (disqualify ctor) Monoid.<> " " Monoid.<> T.unwords (map prettyPrintBinderAtom args)+prettyPrintBinder (PositionedBinder _ _ binder) = prettyPrintBinder binder+prettyPrintBinder (TypedBinder _ binder) = prettyPrintBinder binder+prettyPrintBinder b = prettyPrintBinderAtom b
+ src/Language/PureScript/Publish.hs view
@@ -0,0 +1,390 @@+module Language.PureScript.Publish+ ( preparePackage+ , preparePackage'+ , unsafePreparePackage+ , PrepareM()+ , runPrepareM+ , warn+ , userError+ , internalError+ , otherError+ , PublishOptions(..)+ , defaultPublishOptions+ , getGitWorkingTreeStatus+ , checkCleanWorkingTree+ , getVersionFromGitTag+ , getManifestRepositoryInfo+ , getModules+ ) where++import Protolude hiding (stdin, lines)++import Control.Arrow ((***))+import Control.Category ((>>>))+import Control.Monad.Writer.Strict (MonadWriter, WriterT, runWriterT, tell)++import Data.ByteString.Lazy qualified as BL+import Data.String (String, lines)+import Data.List (stripPrefix, (\\))+import Data.Text qualified as T+import Data.Time.Clock (UTCTime)+import Data.Time.Clock.POSIX (posixSecondsToUTCTime)+import Data.Version (Version)+import Distribution.SPDX qualified as SPDX+import Distribution.Parsec qualified as CabalParsec++import System.Directory (doesFileExist)+import System.FilePath.Glob (globDir1)+import System.Process (readProcess)++import Web.Bower.PackageMeta (PackageMeta(..), PackageName, Repository(..))+import Web.Bower.PackageMeta qualified as Bower++import Language.PureScript.Publish.ErrorsWarnings (InternalError(..), OtherError(..), PackageError(..), PackageWarning(..), RepositoryFieldError(..), UserError(..), printError, printWarnings)+import Language.PureScript.Publish.Registry.Compat (asPursJson, toBowerPackage)+import Language.PureScript.Publish.Utils (globRelative, purescriptSourceFiles)+import Language.PureScript qualified as P (version, ModuleName)+import Language.PureScript.CoreFn.FromJSON qualified as P+import Language.PureScript.Docs qualified as D+import Data.Aeson.BetterErrors (Parse, withString, eachInObjectWithKey, asString, key, keyMay, parse, mapError)+import Language.PureScript.Docs.Types (ManifestError(BowerManifest, PursManifest))++data PublishOptions = PublishOptions+ { -- | How to obtain the version tag and version that the data being+ -- generated will refer to.+ publishGetVersion :: PrepareM (Text, Version)+ -- | How to obtain at what time the version was committed+ , publishGetTagTime :: Text -> PrepareM UTCTime+ , -- | What to do when the working tree is dirty+ publishWorkingTreeDirty :: PrepareM ()+ , -- | Compiler output directory (which must include up-to-date docs.json+ -- files for any modules we are producing docs for).+ publishCompileOutputDir :: FilePath+ , -- | Path to the manifest file; a JSON file including information about the+ -- package, such as name, author, dependency version bounds.+ publishManifestFile :: FilePath+ , -- | Path to the resolutions file; a JSON file containing all of the+ -- package's dependencies, their versions, and their paths on the disk.+ publishResolutionsFile :: FilePath+ }++defaultPublishOptions :: PublishOptions+defaultPublishOptions = PublishOptions+ { publishGetVersion = getVersionFromGitTag+ , publishGetTagTime = getTagTime+ , publishWorkingTreeDirty = userError DirtyWorkingTree+ , publishCompileOutputDir = "output"+ , publishManifestFile = "bower.json"+ , publishResolutionsFile = "resolutions.json"+ }++-- | Attempt to retrieve package metadata from the current directory.+-- Calls exitFailure if no package metadata could be retrieved.+unsafePreparePackage :: PublishOptions -> IO D.UploadedPackage+unsafePreparePackage opts =+ either (\e -> printError e >> exitFailure) pure+ =<< preparePackage opts++-- | Attempt to retrieve package metadata from the current directory.+-- Returns a PackageError on failure+preparePackage :: PublishOptions -> IO (Either PackageError D.UploadedPackage)+preparePackage opts =+ runPrepareM (preparePackage' opts)+ >>= either (pure . Left) (fmap Right . handleWarnings)++ where+ handleWarnings (result, warns) = do+ printWarnings warns+ return result++newtype PrepareM a =+ PrepareM { unPrepareM :: WriterT [PackageWarning] (ExceptT PackageError IO) a }+ deriving (Functor, Applicative, Monad,+ MonadWriter [PackageWarning],+ MonadError PackageError)++-- This MonadIO instance ensures that IO errors don't crash the program.+instance MonadIO PrepareM where+ liftIO act =+ lift' (try act) >>= either (otherError . IOExceptionThrown) return+ where+ lift' :: IO a -> PrepareM a+ lift' = PrepareM . lift . lift++runPrepareM :: PrepareM a -> IO (Either PackageError (a, [PackageWarning]))+runPrepareM = runExceptT . runWriterT . unPrepareM++warn :: PackageWarning -> PrepareM ()+warn w = tell [w]++userError :: UserError -> PrepareM a+userError = throwError . UserError++internalError :: InternalError -> PrepareM a+internalError = throwError . InternalError++otherError :: OtherError -> PrepareM a+otherError = throwError . OtherError++catchLeft :: Applicative f => Either a b -> (a -> f b) -> f b+catchLeft a f = either f pure a++preparePackage' :: PublishOptions -> PrepareM D.UploadedPackage+preparePackage' opts = do+ checkCleanWorkingTree opts++ let manifestPath = publishManifestFile opts+ pkgMeta <- liftIO (try (BL.readFile manifestPath)) >>= \case+ Left (_ :: IOException) ->+ userError $ PackageManifestNotFound manifestPath+ Right found -> do+ -- We can determine the type of the manifest file based on the file path,+ -- as both the PureScript and Bower registries require their manifest+ -- files to have specific names.+ let isPursJson = "purs.json" `T.isInfixOf` T.pack manifestPath+ if isPursJson then do+ pursJson <- catchLeft (parse (mapError PursManifest asPursJson) found) (userError . CouldntDecodePackageManifest)+ catchLeft (toBowerPackage pursJson) (userError . CouldntConvertPackageManifest)+ else+ catchLeft (parse (mapError BowerManifest Bower.asPackageMeta) found) (userError . CouldntDecodePackageManifest)++ checkLicense pkgMeta++ (pkgVersionTag, pkgVersion) <- publishGetVersion opts+ pkgTagTime <- Just <$> publishGetTagTime opts pkgVersionTag+ pkgGithub <- getManifestRepositoryInfo pkgMeta++ resolvedDeps <- parseResolutionsFile (publishResolutionsFile opts)++ (pkgModules, pkgModuleMap) <- getModules opts (map (second fst) resolvedDeps)++ let declaredDeps = map fst $ Bower.bowerDependencies pkgMeta+ pkgResolvedDependencies <- handleDeps declaredDeps (map (second snd) resolvedDeps)++ let pkgUploader = D.NotYetKnown+ let pkgCompilerVersion = P.version++ return D.Package{..}++getModules+ :: PublishOptions+ -> [(PackageName, FilePath)]+ -> PrepareM ([D.Module], Map P.ModuleName PackageName)+getModules opts paths = do+ (inputFiles, depsFiles) <- liftIO (getInputAndDepsFiles paths)++ (modules, moduleMap) <-+ liftIO (runExceptT (D.collectDocs (publishCompileOutputDir opts) inputFiles depsFiles))+ >>= either (userError . CompileError) return++ pure (map snd modules, moduleMap)++data TreeStatus = Clean | Dirty deriving (Show, Eq, Ord, Enum)++getGitWorkingTreeStatus :: FilePath -> PrepareM TreeStatus+getGitWorkingTreeStatus manifestFilePath = do+ output <- lines <$> readProcess' "git" ["status", "--porcelain"] ""+ -- The PureScript registry generates purs.json files when publishing legacy+ -- packages. To ensure these packages can also be published to Pursuit, we+ -- include an exemption to the working tree status check that will ignore+ -- untracked purs.json files. Note that _modified_ purs.json files will+ -- still fail this check.+ let untrackedPursJson = "?? " <> manifestFilePath+ let filtered = filter (/= untrackedPursJson) output+ return $+ if all null filtered+ then Clean+ else Dirty++checkCleanWorkingTree :: PublishOptions -> PrepareM ()+checkCleanWorkingTree opts = do+ status <- getGitWorkingTreeStatus (publishManifestFile opts)+ unless (status == Clean) $+ publishWorkingTreeDirty opts++getVersionFromGitTag :: PrepareM (Text, Version)+getVersionFromGitTag = do+ out <- readProcess' "git" ["tag", "--list", "--points-at", "HEAD"] ""+ let vs = map trimWhitespace (lines out)+ case mapMaybe parseMay vs of+ [] -> userError TagMustBeCheckedOut+ [x] -> return (first T.pack x)+ xs -> userError (AmbiguousVersions (map snd xs))+ where+ trimWhitespace =+ dropWhile isSpace >>> reverse >>> dropWhile isSpace >>> reverse+ parseMay str = do+ digits <- stripPrefix "v" str+ (str,) <$> P.parseVersion' digits++-- | Given a git tag, get the time it was created.+getTagTime :: Text -> PrepareM UTCTime+getTagTime tag = do+ out <- readProcess' "git" ["log", "-1", "--format=%ct", T.unpack tag] ""+ case mapMaybe readMaybe (lines out) of+ [t] -> pure . posixSecondsToUTCTime . fromInteger $ t+ _ -> internalError (CouldntParseGitTagDate tag)++getManifestRepositoryInfo :: PackageMeta -> PrepareM (D.GithubUser, D.GithubRepo)+getManifestRepositoryInfo pkgMeta =+ case bowerRepository pkgMeta of+ Nothing -> do+ giturl <- catchError (Just . T.strip . T.pack <$> readProcess' "git" ["config", "remote.origin.url"] "")+ (const (return Nothing))+ userError (BadRepositoryField (RepositoryFieldMissing (giturl >>= extractGithub <&> format)))+ Just Repository{..} -> do+ unless (repositoryType == "git")+ (userError (BadRepositoryField (BadRepositoryType repositoryType)))+ maybe (userError (BadRepositoryField NotOnGithub)) return (extractGithub repositoryUrl)++ where+ format :: (D.GithubUser, D.GithubRepo) -> Text+ format (user, repo) = "https://github.com/" <> D.runGithubUser user <> "/" <> D.runGithubRepo repo <> ".git"++checkLicense :: PackageMeta -> PrepareM ()+checkLicense pkgMeta =+ case bowerLicense pkgMeta of+ [] ->+ userError NoLicenseSpecified+ ls ->+ unless (any (isValidSPDX . T.unpack) ls)+ (userError InvalidLicense)++-- |+-- Check if a string is a valid SPDX license expression.+--+isValidSPDX :: String -> Bool+isValidSPDX input = case CabalParsec.simpleParsec input of+ Nothing -> False+ Just SPDX.NONE -> False+ Just _ -> True+++extractGithub :: Text -> Maybe (D.GithubUser, D.GithubRepo)+extractGithub = stripGitHubPrefixes+ >>> fmap (T.splitOn "/")+ >=> takeTwo+ >>> fmap (D.GithubUser *** (D.GithubRepo . dropDotGit))++ where+ takeTwo :: [a] -> Maybe (a, a)+ takeTwo [x, y] = Just (x, y)+ takeTwo _ = Nothing++ stripGitHubPrefixes :: Text -> Maybe Text+ stripGitHubPrefixes = stripPrefixes [ "git://github.com/"+ , "https://github.com/"+ , "git@github.com:"+ ]++ stripPrefixes :: [Text] -> Text -> Maybe Text+ stripPrefixes prefixes str = msum $ (`T.stripPrefix` str) <$> prefixes++ dropDotGit :: Text -> Text+ dropDotGit str+ | ".git" `T.isSuffixOf` str = T.take (T.length str - 4) str+ | otherwise = str++readProcess' :: String -> [String] -> String -> PrepareM String+readProcess' prog args stdin = do+ out <- liftIO (catch (Right <$> readProcess prog args stdin)+ (return . Left))+ either (otherError . ProcessFailed prog args) return out++data DependencyStatus+ = NoResolution+ -- ^ In the resolutions file, there was no _resolution key.+ | ResolvedOther Text+ -- ^ Resolved, but to something other than a version. The Text argument+ -- is the resolution type. The values it can take that I'm aware of are+ -- "commit" and "branch". Note: this constructor is deprecated, and is only+ -- used when parsing legacy resolutions files.+ | ResolvedVersion Version+ -- ^ Resolved to a version.+ deriving (Show, Eq)++parseResolutionsFile :: FilePath -> PrepareM [(PackageName, (FilePath, DependencyStatus))]+parseResolutionsFile resolutionsFile = do+ unlessM (liftIO (doesFileExist resolutionsFile)) (userError ResolutionsFileNotFound)+ depsBS <- liftIO (BL.readFile resolutionsFile)++ case parse asResolutions depsBS of+ Right res ->+ pure res+ Left err ->+ userError $ ResolutionsFileError resolutionsFile err++-- | Parser for resolutions files, which contain information about the packages+-- which this package depends on. A resolutions file should look something like+-- this:+--+-- {+-- "purescript-prelude": {+-- "version": "4.0.0",+-- "path": "bower_components/purescript-prelude"+-- },+-- "purescript-lists": {+-- "version": "6.0.0",+-- "path": "bower_components/purescript-lists"+-- },+-- ...+-- }+--+-- where the version is used for generating links between packages on Pursuit,+-- and the path is used to obtain the source files while generating+-- documentation: all files matching the glob "src/**/*.purs" relative to the+-- `path` directory will be picked up.+--+-- The "version" field is optional, but omitting it will mean that no links+-- will be generated for any declarations from that package on Pursuit. The+-- "path" field is required.+asResolutions :: Parse D.PackageError [(PackageName, (FilePath, DependencyStatus))]+asResolutions =+ eachInObjectWithKey parsePackageName $+ (,) <$> key "path" asString+ <*> (maybe NoResolution ResolvedVersion <$> keyMay "version" asVersion)++asVersion :: Parse D.PackageError Version+asVersion =+ withString (note D.InvalidVersion . P.parseVersion')++parsePackageName :: Text -> Either D.PackageError PackageName+parsePackageName = first D.ErrorInPackageMeta . D.mapLeft BowerManifest . Bower.parsePackageName++handleDeps+ :: [PackageName]+ -- ^ dependencies declared in package manifest file; we should emit+ -- warnings for any package name in this list which is not in the+ -- resolutions file.+ -> [(PackageName, DependencyStatus)]+ -- ^ Contents of resolutions file+ -> PrepareM [(PackageName, Version)]+handleDeps declared resolutions = do+ let missing = declared \\ map fst resolutions+ case missing of+ (x:xs) ->+ userError (MissingDependencies (x :| xs))+ [] -> do+ pkgs <-+ for resolutions $ \(pkgName, status) ->+ case status of+ NoResolution -> do+ warn (NoResolvedVersion pkgName)+ pure Nothing+ ResolvedOther other -> do+ warn (UnacceptableVersion (pkgName, other))+ pure Nothing+ ResolvedVersion version ->+ pure (Just (pkgName, version))+ pure (catMaybes pkgs)++getInputAndDepsFiles+ :: [(PackageName, FilePath)]+ -> IO ([FilePath], [(PackageName, FilePath)])+getInputAndDepsFiles depPaths = do+ inputFiles <- globRelative purescriptSourceFiles+ let handleDep (pkgName, path) = do+ depFiles <- globDir1 purescriptSourceFiles path+ return (map (pkgName,) depFiles)+ depFiles <- concat <$> traverse handleDep depPaths+ return (inputFiles, depFiles)
+ src/Language/PureScript/Publish/BoxesHelpers.hs view
@@ -0,0 +1,46 @@+module Language.PureScript.Publish.BoxesHelpers+ ( Boxes.Box+ , Boxes.nullBox+ , module Language.PureScript.Publish.BoxesHelpers+ ) where++import Prelude++import Data.Text (Text)+import Data.Text qualified as T+import System.IO (hPutStr, stderr)++import Text.PrettyPrint.Boxes qualified as Boxes++width :: Int+width = 79++indentWidth :: Int+indentWidth = 2++para :: String -> Boxes.Box+para = Boxes.para Boxes.left width++indented :: Boxes.Box -> Boxes.Box+indented b = Boxes.hcat Boxes.left [Boxes.emptyBox 1 indentWidth, b]++successivelyIndented :: [String] -> Boxes.Box+successivelyIndented [] =+ Boxes.nullBox+successivelyIndented (x:xs) =+ Boxes.vcat Boxes.left [para x, indented (successivelyIndented xs)]++vcat :: [Boxes.Box] -> Boxes.Box+vcat = Boxes.vcat Boxes.left++spacer :: Boxes.Box+spacer = Boxes.emptyBox 1 1++bulletedList :: (a -> String) -> [a] -> [Boxes.Box]+bulletedList f = map (indented . para . ("* " ++) . f)++bulletedListT :: (a -> Text) -> [a] -> [Boxes.Box]+bulletedListT f = bulletedList (T.unpack . f)++printToStderr :: Boxes.Box -> IO ()+printToStderr = hPutStr stderr . Boxes.render
+ src/Language/PureScript/Publish/ErrorsWarnings.hs view
@@ -0,0 +1,412 @@+module Language.PureScript.Publish.ErrorsWarnings+ ( PackageError(..)+ , PackageWarning(..)+ , UserError(..)+ , InternalError(..)+ , OtherError(..)+ , RepositoryFieldError(..)+ , JSONSource(..)+ , printError+ , renderError+ , printWarnings+ , renderWarnings+ ) where++import Prelude++import Control.Exception (IOException)++import Data.Aeson.BetterErrors (ParseError, displayError)+import Data.List (intersperse)+import Data.List.NonEmpty (NonEmpty(..))+import Data.Maybe (catMaybes, fromMaybe)+import Data.Monoid (Any(..))+import Data.Version (Version, showVersion)+import Data.List.NonEmpty qualified as NonEmpty+import Data.Text (Text)+import Data.Text qualified as T++import Language.PureScript.Docs.Types qualified as D+import Language.PureScript qualified as P+import Language.PureScript.Publish.BoxesHelpers (Box, bulletedList, bulletedListT, indented, nullBox, para, printToStderr, spacer, successivelyIndented, vcat)++import Web.Bower.PackageMeta (PackageName, runPackageName, showBowerError)+import Web.Bower.PackageMeta qualified as Bower+import Language.PureScript.Docs.Types (showManifestError)++-- | An error which meant that it was not possible to retrieve metadata for a+-- package.+data PackageError+ = UserError UserError+ | InternalError InternalError+ | OtherError OtherError+ deriving (Show)++data PackageWarning+ = NoResolvedVersion PackageName+ | UnacceptableVersion (PackageName, Text)+ | DirtyWorkingTreeWarn+ deriving (Show)++-- | An error that should be fixed by the user.+data UserError+ = PackageManifestNotFound FilePath+ | ResolutionsFileNotFound+ | CouldntConvertPackageManifest Bower.BowerError+ | CouldntDecodePackageManifest (ParseError D.ManifestError)+ | TagMustBeCheckedOut+ | AmbiguousVersions [Version] -- Invariant: should contain at least two elements+ | BadRepositoryField RepositoryFieldError+ | NoLicenseSpecified+ | InvalidLicense+ | MissingDependencies (NonEmpty PackageName)+ | CompileError P.MultipleErrors+ | DirtyWorkingTree+ | ResolutionsFileError FilePath (ParseError D.PackageError)+ deriving (Show)++data RepositoryFieldError+ = RepositoryFieldMissing (Maybe Text)+ | BadRepositoryType Text+ | NotOnGithub+ deriving (Show)++-- | An error that probably indicates a bug in this module.+data InternalError+ = CouldntParseGitTagDate Text+ deriving (Show)++data JSONSource+ = FromFile FilePath+ | FromResolutions+ deriving (Show)++data OtherError+ = ProcessFailed String [String] IOException+ | IOExceptionThrown IOException+ deriving (Show)++printError :: PackageError -> IO ()+printError = printToStderr . renderError++renderError :: PackageError -> Box+renderError err =+ case err of+ UserError e ->+ vcat+ [ para (+ "There is a problem with your package, which meant that " +++ "it could not be published."+ )+ , para "Details:"+ , indented (displayUserError e)+ ]+ InternalError e ->+ vcat+ [ para "Internal error: this is probably a bug. Please report it:"+ , indented (para "https://github.com/purescript/purescript/issues/new")+ , spacer+ , para "Details:"+ , successivelyIndented (displayInternalError e)+ ]+ OtherError e ->+ vcat+ [ para "An error occurred, and your package could not be published."+ , para "Details:"+ , indented (displayOtherError e)+ ]++displayUserError :: UserError -> Box+displayUserError e = case e of+ PackageManifestNotFound path -> do+ vcat+ [ para "The package manifest file was not found:"+ , indented (para path)+ , spacer+ , para "Please create either a bower.json or purs.json manifest file."+ ]+ ResolutionsFileNotFound ->+ para "The resolutions file was not found."+ CouldntConvertPackageManifest err ->+ vcat+ [ para "Unable to convert your package manifest file to the Bower format:"+ , indented ((para . T.unpack) (showBowerError err))+ , spacer+ , para "Please ensure that your package manifest file is valid."+ ]+ CouldntDecodePackageManifest err ->+ vcat+ [ para "There was a problem with your package manifest file:"+ , indented (vcat (map (para . T.unpack) (displayError showManifestError err)))+ , spacer+ , para "Please ensure that your package manifest file is valid."+ ]+ TagMustBeCheckedOut ->+ vcat+ [ para (concat+ [ "purs publish requires a tagged version to be checked out in "+ , "order to build documentation, and no suitable tag was found. "+ , "Please check out a previously tagged version, or tag a new "+ , "version."+ ])+ , spacer+ , para "Note: tagged versions must be in the form"+ , indented (para "v{MAJOR}.{MINOR}.{PATCH} (example: \"v1.6.2\")")+ , spacer+ , para (concat+ [ "If the version you are publishing is not yet tagged, you might "+ , "want to use the --dry-run flag instead, which removes this "+ , "requirement. Run `purs publish --help` for more details."+ ])+ ]+ AmbiguousVersions vs ->+ vcat $+ [ para (concat+ [ "The currently checked out commit seems to have been tagged with "+ , "more than 1 version, and I don't know which one should be used. "+ , "Please either delete some of the tags, or create a new commit "+ , "to tag the desired version with."+ ])+ , spacer+ , para "Tags for the currently checked out commit:"+ ] ++ bulletedList showVersion vs+ BadRepositoryField err ->+ displayRepositoryError err+ NoLicenseSpecified ->+ vcat $+ [ para $ concat+ [ "No license is specified in package manifest. Please add a "+ , "\"license\" property with a SPDX license expression. For example, "+ , "any of the following would be acceptable:"+ ]+ , spacer+ ] ++ spdxExamples +++ [ spacer+ , para $+ "See https://spdx.org/licenses/ for a full list of licenses. For more " +++ "information on SPDX license expressions, see https://spdx.org/ids-how"+ , spacer+ , para $+ "Note that distributing code without a license means that nobody will " +++ "(legally) be able to use it."+ , spacer+ , para $+ "It is also recommended to add a LICENSE file to the repository, " +++ "including your name and the current year, although this is not necessary."+ ]+ InvalidLicense ->+ vcat $+ [ para $ concat+ [ "The license specified in package manifest is not a valid SPDX "+ , "license expression. Please update the \"license\" property so that "+ , "it is a valid SPDX license expression. For example, any of the "+ , "following would be acceptable:"+ ]+ , spacer+ ] +++ spdxExamples+ MissingDependencies pkgs ->+ let singular = NonEmpty.length pkgs == 1+ pl a b = if singular then b else a+ do_ = pl "do" "does"+ dependencies = pl "dependencies" "dependency"+ in vcat $+ para (concat+ [ "The following ", dependencies, " ", do_, " not appear to be "+ , "installed:"+ ]) :+ bulletedListT runPackageName (NonEmpty.toList pkgs)+ CompileError err ->+ vcat+ [ para "Compile error:"+ , indented (vcat (P.prettyPrintMultipleErrorsBox P.defaultPPEOptions err))+ ]+ DirtyWorkingTree ->+ para (+ "Your git working tree is dirty. Please commit, discard, or stash " +++ "your changes first."+ )+ ResolutionsFileError path err ->+ successivelyIndented $+ ("Error in resolutions file (" ++ path ++ "):") :+ map T.unpack (displayError D.displayPackageError err)++spdxExamples :: [Box]+spdxExamples =+ map (indented . para)+ [ "* \"MIT\""+ , "* \"Apache-2.0\""+ , "* \"BSD-2-Clause\""+ , "* \"GPL-2.0-or-later\""+ , "* \"(GPL-3.0-only OR MIT)\""+ ]++displayRepositoryError :: RepositoryFieldError -> Box+displayRepositoryError err = case err of+ RepositoryFieldMissing giturl ->+ vcat+ [ para (concat+ [ "The 'repository' or 'location' field is not present in your package manifest file. "+ , "Without this information, Pursuit would not be able to generate "+ , "source links in your package's documentation. Please add one - like "+ , "this, if you are using the bower.json format:"+ ])+ , spacer+ , indented (vcat+ [ para "\"repository\": {"+ , indented (para "\"type\": \"git\",")+ , indented (para ("\"url\": \"" ++ T.unpack (fromMaybe "https://github.com/USER/REPO.git" giturl) ++ "\""))+ , para "}"+ ]+ )+ , para "or like this, if you are using the purs.json format:"+ , spacer+ , indented (vcat+ [ para "\"location\": {"+ , indented (para "\"githubOwner\": \"USER\",")+ , indented (para "\"githubRepo\": \"REPO\",")+ , para "}"+ ]+ )+ ]+ BadRepositoryType ty ->+ para (concat+ [ "In your package manifest file, the repository type is currently listed as "+ , "\"" ++ T.unpack ty ++ "\". Currently, only git repositories are supported. "+ , "Please publish your code in a git repository, and then update the "+ , "repository type in your package manifest file to \"git\"."+ ])+ NotOnGithub ->+ vcat+ [ para (concat+ [ "The repository url in your package manifest file does not point to a "+ , "GitHub repository. Currently, Pursuit does not support packages "+ , "which are not hosted on GitHub."+ ])+ , spacer+ , para (concat+ [ "Please update your package manifest file to point to a GitHub repository. "+ , "Alternatively, if you would prefer not to host your package on "+ , "GitHub, please open an issue:"+ ])+ , indented (para "https://github.com/purescript/purescript/issues/new")+ ]++displayInternalError :: InternalError -> [String]+displayInternalError e = case e of+ CouldntParseGitTagDate tag ->+ [ "Unable to parse the date for a git tag: " ++ T.unpack tag+ ]++displayOtherError :: OtherError -> Box+displayOtherError e = case e of+ ProcessFailed prog args exc ->+ successivelyIndented+ [ "While running `" ++ prog ++ " " ++ unwords args ++ "`:"+ , show exc+ ]+ IOExceptionThrown exc ->+ successivelyIndented+ [ "An IO exception occurred:", show exc ]++data CollectedWarnings = CollectedWarnings+ { noResolvedVersions :: [PackageName]+ , unacceptableVersions :: [(PackageName, Text)]+ , dirtyWorkingTree :: Any+ }+ deriving (Show, Eq, Ord)++instance Semigroup CollectedWarnings where+ (<>) (CollectedWarnings a b c) (CollectedWarnings a' b' c') =+ CollectedWarnings (a <> a') (b <> b') (c <> c')++instance Monoid CollectedWarnings where+ mempty = CollectedWarnings mempty mempty mempty++collectWarnings :: [PackageWarning] -> CollectedWarnings+collectWarnings = foldMap singular+ where+ singular w = case w of+ NoResolvedVersion pn ->+ mempty { noResolvedVersions = [pn] }+ UnacceptableVersion t ->+ mempty { unacceptableVersions = [t] }+ DirtyWorkingTreeWarn ->+ mempty { dirtyWorkingTree = Any True }++renderWarnings :: [PackageWarning] -> Box+renderWarnings warns =+ let CollectedWarnings{..} = collectWarnings warns+ go toBox warns' = toBox <$> NonEmpty.nonEmpty warns'+ mboxes = [ go warnNoResolvedVersions noResolvedVersions+ , go warnUnacceptableVersions unacceptableVersions+ , if getAny dirtyWorkingTree+ then Just warnDirtyWorkingTree+ else Nothing+ ]+ in case catMaybes mboxes of+ [] -> nullBox+ boxes -> vcat [ para "Warnings:"+ , indented (vcat (intersperse spacer boxes))+ ]++warnNoResolvedVersions :: NonEmpty PackageName -> Box+warnNoResolvedVersions pkgNames =+ let singular = NonEmpty.length pkgNames == 1+ pl a b = if singular then b else a++ packages = pl "packages" "package"+ anyOfThese = pl "any of these" "this"+ these = pl "these" "this"+ in vcat $+ [ para (concat+ ["The following ", packages, " did not appear to have a resolved "+ , "version:"])+ ] +++ bulletedListT runPackageName (NonEmpty.toList pkgNames)+ +++ [ spacer+ , para (concat+ ["Links to types in ", anyOfThese, " ", packages, " will not work. In "+ , "order to make links work, edit your package manifest to specify a version"+ , " or a version range for ", these, " ", packages, "."+ ])+ ]++warnUnacceptableVersions :: NonEmpty (PackageName, Text) -> Box+warnUnacceptableVersions pkgs =+ let singular = NonEmpty.length pkgs == 1+ pl a b = if singular then b else a++ packages' = pl "packages'" "package's"+ packages = pl "packages" "package"+ anyOfThese = pl "any of these" "this"+ these = pl "these" "this"+ versions = pl "versions" "version"+ in vcat $+ [ para (concat+ [ "The following installed ", packages', " ", versions, " could "+ , "not be parsed:"+ ])+ ] +++ bulletedListT showTuple (NonEmpty.toList pkgs)+ +++ [ spacer+ , para (concat+ ["Links to types in ", anyOfThese, " ", packages, " will not work. In "+ , "order to make links work, edit your package manifest to specify an "+ , "acceptable version or version range for ", these, " ", packages, "."+ ])+ ]+ where+ showTuple (pkgName, tag) = runPackageName pkgName <> "#" <> tag++warnDirtyWorkingTree :: Box+warnDirtyWorkingTree =+ para (+ "Your working tree is dirty. (Note: this would be an error if it "+ ++ "were not a dry run)"+ )++printWarnings :: [PackageWarning] -> IO ()+printWarnings = printToStderr . renderWarnings
+ src/Language/PureScript/Publish/Registry/Compat.hs view
@@ -0,0 +1,98 @@+-- | A compatibility module that allows a restricted set of purs.json manifest+-- | files to be used for publishing. The manifest must described a package+-- | available on GitHub, and it must be convertable to a Bower manifest.+-- |+-- | Fully supporting the registry manifest format will require `purs publish`+-- | and by extension Pursuit to relax the requirement that packages are hosted+-- | on GitHub, because the registry does not have this requirement.+module Language.PureScript.Publish.Registry.Compat where++import Protolude+import Data.Map qualified as Map+import Web.Bower.PackageMeta qualified as Bower+import Data.Bitraversable (Bitraversable(..))+import Data.Aeson.BetterErrors (key, asText, keyMay, eachInObject, Parse, throwCustomError)++-- | Convert a valid purs.json manifest into a bower.json manifest+toBowerPackage :: PursJson -> Either Bower.BowerError Bower.PackageMeta+toBowerPackage PursJson{..} = do+ bowerName <- Bower.parsePackageName ("purescript-" <> pursJsonName)+ let+ bowerDescription = pursJsonDescription+ bowerMain = []+ bowerModuleType = []+ bowerLicense = [ pursJsonLicense ]+ bowerIgnore = []+ bowerKeywords = []+ bowerAuthors = []+ bowerHomepage = Just pursJsonLocation+ bowerRepository = Just $ Bower.Repository { repositoryUrl = pursJsonLocation, repositoryType = "git" }+ bowerDevDependencies = []+ bowerResolutions = []+ bowerPrivate = False++ let parseDependencies = traverse (bitraverse (Bower.parsePackageName . ("purescript-" <>)) (pure . Bower.VersionRange))+ bowerDependencies <- parseDependencies $ Map.toAscList pursJsonDependencies+ pure $ Bower.PackageMeta {..}++-- | A partial representation of the purs.json manifest format, including only+-- | the fields required for publishing.+-- |+-- | https://github.com/purescript/registry/blob/master/v1/Manifest.dhall+--+-- This type is intended for compatibility with the Bower publishing pipeline,+-- and does not accurately reflect all possible purs.json manifests. However,+-- supporting purs.json manifests properly introduces breaking changes to the+-- compiler and to Pursuit.+data PursJson = PursJson+ { -- | The name of the package+ pursJsonName :: Text+ -- | The SPDX identifier representing the package license+ , pursJsonLicense :: Text+ -- | The GitHub repository hosting the package+ , pursJsonLocation :: Text+ -- | An optional description of the package+ , pursJsonDescription :: Maybe Text+ -- | A map of dependencies, where keys are package names and values are+ -- | dependency ranges of the form '>=X.Y.Z <X.Y.Z'+ , pursJsonDependencies :: Map Text Text+ }++data PursJsonError+ = MalformedLocationField+ deriving (Eq, Show, Ord, Generic)++instance NFData PursJsonError++showPursJsonError :: PursJsonError -> Text+showPursJsonError = \case+ MalformedLocationField ->+ "The 'location' field must be either '{ \"githubOwner\": OWNER, \"githubRepo\": REPO }' or '{ \"gitUrl\": URL }'."++asPursJson :: Parse PursJsonError PursJson+asPursJson = do+ pursJsonName <- key "name" asText+ pursJsonDescription <- keyMay "description" asText+ pursJsonLicense <- key "license" asText+ pursJsonDependencies <- key "dependencies" (Map.fromAscList <$> eachInObject asText)+ -- Packages are required to come from GitHub in PureScript 0.14.x, but the+ -- PureScript registry does not require this, nor does it require that+ -- packages are Git repositories. This restriction should be lifted when+ -- we fully support purs.json manifests in the compiler and on Pursuit.+ --+ -- For the time being, we only parse manifests that include a GitHub owner+ -- and repo pair, or which specify a Git URL, which we use to try and get+ -- the package from GitHub.+ pursJsonLocation <- key "location" asOwnerRepoOrGitUrl+ pure $ PursJson{..}+ where+ asOwnerRepoOrGitUrl =+ catchError asOwnerRepo (\_ -> catchError asGitUrl (\_ -> throwCustomError MalformedLocationField))++ asGitUrl =+ key "gitUrl" asText++ asOwnerRepo = do+ githubOwner <- key "githubOwner" asText+ githubRepo <- key "githubRepo" asText+ pure $ "https://github.com/" <> githubOwner <> "/" <> githubRepo <> ".git"
+ src/Language/PureScript/Publish/Utils.hs view
@@ -0,0 +1,14 @@+module Language.PureScript.Publish.Utils where+ +import Prelude+ +import System.Directory (getCurrentDirectory)+import System.FilePath.Glob (Pattern, compile, globDir1)+ +-- | Glob relative to the current directory, and produce relative pathnames. +globRelative :: Pattern -> IO [FilePath]+globRelative pat = getCurrentDirectory >>= globDir1 pat+ +-- | Glob pattern for PureScript source files. +purescriptSourceFiles :: Pattern+purescriptSourceFiles = compile "src/**/*.purs"
src/Language/PureScript/Renamer.hs view
@@ -1,34 +1,22 @@------------------------------------------------------------------------------------------------------------------------------------------------------------------ Module : Language.PureScript.Renamer--- Copyright : (c) 2013-14 Phil Freeman, (c) 2014 Gary Burgess, and other contributors--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :--- -- | -- Renaming pass that prevents shadowing of local identifiers. --------------------------------------------------------------------------------+module Language.PureScript.Renamer (renameInModule) where -module Language.PureScript.Renamer (renameInModules) where+import Prelude -import Control.Applicative-import Control.Monad.State+import Control.Monad.State (MonadState(..), State, gets, modify, runState, (>=>)) +import Data.Functor ((<&>)) import Data.List (find)--import qualified Data.Map as M-import qualified Data.Set as S--import Language.PureScript.CoreFn-import Language.PureScript.Names-import Language.PureScript.Traversals+import Data.Maybe (fromJust, fromMaybe)+import Data.Map qualified as M+import Data.Set qualified as S+import Data.Text qualified as T -import qualified Language.PureScript.Constants as C+import Language.PureScript.CoreFn (Ann, Bind(..), Binder(..), CaseAlternative(..), Expr(..), Literal(..), Module(..))+import Language.PureScript.Names (Ident(..), Qualified(..), isBySourcePos, isPlainIdent, runIdent, showIdent)+import Language.PureScript.Traversals (eitherM, pairM, sndM) -- | -- The state object used in this module@@ -52,8 +40,8 @@ -- | -- Runs renaming starting with a list of idents for the initial scope. ---runRename :: [Ident] -> Rename a -> a-runRename scope = flip evalState (initState scope)+runRename :: [Ident] -> Rename a -> (a, RenameState)+runRename scope = flip runState (initState scope) -- | -- Creates a new renaming scope using the current as a basis. Used to backtrack@@ -71,124 +59,157 @@ -- unique name is generated and stored. -- updateScope :: Ident -> Rename Ident-updateScope i@(Ident name) | name == C.__unused = return i-updateScope name = do- scope <- get- let name' = case name `S.member` rsUsedNames scope of- True ->- let- newNames = [ Ident (runIdent name ++ "_" ++ show (i :: Int)) | i <- [1..] ]- Just newName = find (`S.notMember` rsUsedNames scope) newNames- in newName- False -> name- modify $ \s -> s { rsBoundNames = M.insert name name' (rsBoundNames s)- , rsUsedNames = S.insert name' (rsUsedNames s)- }- return name'+updateScope ident =+ case ident of+ GenIdent name _ -> go ident $ Ident (fromMaybe "v" name)+ UnusedIdent -> return UnusedIdent+ _ -> go ident ident+ where+ go :: Ident -> Ident -> Rename Ident+ go keyName baseName = do+ scope <- get+ let usedNames = rsUsedNames scope+ name' =+ if baseName `S.member` usedNames+ then getNewName usedNames baseName+ else baseName+ modify $ \s -> s { rsBoundNames = M.insert keyName name' (rsBoundNames s)+ , rsUsedNames = S.insert name' (rsUsedNames s)+ }+ return name'+ getNewName :: S.Set Ident -> Ident -> Ident+ getNewName usedNames name =+ fromJust $ find+ (`S.notMember` usedNames)+ [ Ident (runIdent name <> T.pack (show (i :: Int))) | i <- [1..] ] -- | -- Finds the new name to use for an ident. -- lookupIdent :: Ident -> Rename Ident-lookupIdent i@(Ident name) | name == C.__unused = return i+lookupIdent UnusedIdent = return UnusedIdent lookupIdent name = do name' <- gets $ M.lookup name . rsBoundNames case name' of Just name'' -> return name''- Nothing -> error $ "Rename scope is missing ident '" ++ show name ++ "'"+ Nothing -> error $ "Rename scope is missing ident '" ++ T.unpack (showIdent name) ++ "'" --- |--- Finds idents introduced by declarations.----findDeclIdents :: [Bind Ann] -> [Ident]-findDeclIdents = concatMap go- where- go (NonRec ident _) = [ident]- go (Rec ds) = map fst ds -- |--- Renames within each declaration in a module.+-- Renames within each declaration in a module. Returns the map of renamed+-- identifiers in the top-level scope, so that they can be renamed in the+-- externs files as well. ---renameInModules :: [Module Ann] -> [Module Ann]-renameInModules = map go+renameInModule :: Module Ann -> (M.Map Ident Ident, Module Ann)+renameInModule m@(Module _ _ _ _ _ exports _ foreigns decls) = (rsBoundNames, m { moduleExports, moduleDecls }) where- go :: Module Ann -> Module Ann- go m@(Module _ _ _ _ _ decls) = m { moduleDecls = renameInDecl' (findDeclIdents decls) `map` decls }- renameInDecl' :: [Ident] -> Bind Ann -> Bind Ann- renameInDecl' scope = runRename scope . renameInDecl True+ ((moduleDecls, moduleExports), RenameState{..}) = runRename foreigns $+ (,) <$> renameInDecls decls <*> traverse lookupIdent exports -- |--- Renames within a declaration. isTopLevel is used to determine whether the--- declaration is a module member or appearing within a Let. At the top level--- declarations are not renamed or added to the scope (they should already have--- been added), whereas in a Let declarations are renamed if their name shadows--- another in the current scope.+-- Renames within a list of declarations. The list is processed in three+-- passes: ---renameInDecl :: Bool -> Bind Ann -> Rename (Bind Ann)-renameInDecl isTopLevel (NonRec name val) = do- name' <- if isTopLevel then return name else updateScope name- NonRec name' <$> renameInValue val-renameInDecl isTopLevel (Rec ds) = do- ds' <- mapM updateNames ds- Rec <$> mapM updateValues ds'+-- 1) Declarations with user-provided names are added to the scope, renaming+-- them only if necessary to prevent shadowing.+-- 2) Declarations with compiler-provided names are added to the scope,+-- renaming them to prevent shadowing or collision with a user-provided+-- name.+-- 3) The bodies of the declarations are processed recursively.+--+-- The distinction between passes 1 and 2 is critical in the top-level module+-- scope, where declarations can be exported and named declarations must not+-- be renamed. Below the top level, this only matters for programmers looking+-- at the generated code or using a debugger; we want them to see the names+-- they used as much as possible.+--+-- The distinction between the first two passes and pass 3 is important because+-- a `GenIdent` can appear before its declaration in a depth-first traversal,+-- and we need to visit the declaration first in order to rename all of its+-- uses. Similarly, a plain `Ident` could shadow another declared in an outer+-- scope but later in a depth-first traversal, and we need to visit the+-- outer declaration first in order to know to rename the inner one.+--+renameInDecls :: [Bind Ann] -> Rename [Bind Ann]+renameInDecls =+ traverse (renameDecl False)+ >=> traverse (renameDecl True)+ >=> traverse renameValuesInDecl+ where- updateNames :: (Ident, Expr Ann) -> Rename (Ident, Expr Ann)- updateNames (name, val) = do- name' <- if isTopLevel then return name else updateScope name- return (name', val)- updateValues :: (Ident, Expr Ann) -> Rename (Ident, Expr Ann)- updateValues (name, val) = (,) name <$> renameInValue val + renameDecl :: Bool -> Bind Ann -> Rename (Bind Ann)+ renameDecl isSecondPass = \case+ NonRec a name val -> updateName name <&> \name' -> NonRec a name' val+ Rec ds -> Rec <$> traverse updateNames ds+ where+ updateName :: Ident -> Rename Ident+ updateName name = (if isSecondPass == isPlainIdent name then pure else updateScope) name++ updateNames :: ((Ann, Ident), Expr Ann) -> Rename ((Ann, Ident), Expr Ann)+ updateNames ((a, name), val) = updateName name <&> \name' -> ((a, name'), val)++ renameValuesInDecl :: Bind Ann -> Rename (Bind Ann)+ renameValuesInDecl = \case+ NonRec a name val -> NonRec a name <$> renameInValue val+ Rec ds -> Rec <$> traverse updateValues ds+ where+ updateValues :: ((Ann, Ident), Expr Ann) -> Rename ((Ann, Ident), Expr Ann)+ updateValues (aname, val) = (aname, ) <$> renameInValue val+ -- | -- Renames within a value. -- renameInValue :: Expr Ann -> Rename (Expr Ann) renameInValue (Literal ann l) = Literal ann <$> renameInLiteral renameInValue l-renameInValue c@(Constructor{}) = return c+renameInValue c@Constructor{} = return c renameInValue (Accessor ann prop v) = Accessor ann prop <$> renameInValue v-renameInValue (ObjectUpdate ann obj vs) =- ObjectUpdate ann <$> renameInValue obj <*> mapM (\(name, v) -> (,) name <$> renameInValue v) vs-renameInValue e@(Abs (_, _, _, Just IsTypeClassConstructor) _ _) = return e+renameInValue (ObjectUpdate ann obj copy vs) =+ (\obj' -> ObjectUpdate ann obj' copy) <$> renameInValue obj <*> traverse (\(name, v) -> (name, ) <$> renameInValue v) vs renameInValue (Abs ann name v) = newScope $ Abs ann <$> updateScope name <*> renameInValue v renameInValue (App ann v1 v2) = App ann <$> renameInValue v1 <*> renameInValue v2-renameInValue (Var ann (Qualified Nothing name)) =- Var ann . Qualified Nothing <$> lookupIdent name-renameInValue v@(Var{}) = return v+renameInValue (Var ann (Qualified qb name)) | isBySourcePos qb || not (isPlainIdent name) =+ -- This should only rename identifiers local to the current module: either+ -- they aren't qualified, or they are but they have a name that should not+ -- have appeared in a module's externs, so they must be from this module's+ -- top-level scope.+ Var ann . Qualified qb <$> lookupIdent name+renameInValue v@Var{} = return v renameInValue (Case ann vs alts) =- newScope $ Case ann <$> mapM renameInValue vs <*> mapM renameInCaseAlternative alts+ newScope $ Case ann <$> traverse renameInValue vs <*> traverse renameInCaseAlternative alts renameInValue (Let ann ds v) =- newScope $ Let ann <$> mapM (renameInDecl False) ds <*> renameInValue v+ newScope $ Let ann <$> renameInDecls ds <*> renameInValue v -- | -- Renames within literals. -- renameInLiteral :: (a -> Rename a) -> Literal a -> Rename (Literal a)-renameInLiteral rename (ArrayLiteral bs) = ArrayLiteral <$> mapM rename bs-renameInLiteral rename (ObjectLiteral bs) = ObjectLiteral <$> mapM (sndM rename) bs+renameInLiteral rename (ArrayLiteral bs) = ArrayLiteral <$> traverse rename bs+renameInLiteral rename (ObjectLiteral bs) = ObjectLiteral <$> traverse (sndM rename) bs renameInLiteral _ l = return l -- | -- Renames within case alternatives. -- renameInCaseAlternative :: CaseAlternative Ann -> Rename (CaseAlternative Ann)-renameInCaseAlternative (CaseAlternative bs v) =- CaseAlternative <$> mapM renameInBinder bs- <*> eitherM (mapM (pairM renameInValue renameInValue)) renameInValue v+renameInCaseAlternative (CaseAlternative bs v) = newScope $+ CaseAlternative <$> traverse renameInBinder bs+ <*> eitherM (traverse (pairM renameInValue renameInValue)) renameInValue v -- | -- Renames within binders. -- renameInBinder :: Binder a -> Rename (Binder a)-renameInBinder n@(NullBinder{}) = return n+renameInBinder n@NullBinder{} = return n renameInBinder (LiteralBinder ann b) = LiteralBinder ann <$> renameInLiteral renameInBinder b renameInBinder (VarBinder ann name) = VarBinder ann <$> updateScope name renameInBinder (ConstructorBinder ann tctor dctor bs) =- ConstructorBinder ann tctor dctor <$> mapM renameInBinder bs+ ConstructorBinder ann tctor dctor <$> traverse renameInBinder bs renameInBinder (NamedBinder ann name b) = NamedBinder ann <$> updateScope name <*> renameInBinder b
+ src/Language/PureScript/Roles.hs view
@@ -0,0 +1,43 @@+{-# LANGUAGE TemplateHaskell #-}++-- |+-- Data types for roles.+--+module Language.PureScript.Roles+ ( Role(..)+ , displayRole+ ) where++import Prelude++import Codec.Serialise (Serialise)+import Control.DeepSeq (NFData)+import Data.Aeson qualified as A+import Data.Aeson.TH qualified as A+import Data.Text (Text)+import GHC.Generics (Generic)++-- |+-- The role of a type constructor's parameter.+data Role+ = Nominal+ -- ^ This parameter's identity affects the representation of the type it is+ -- parameterising.+ | Representational+ -- ^ This parameter's representation affects the representation of the type it+ -- is parameterising.+ | Phantom+ -- ^ This parameter has no effect on the representation of the type it is+ -- parameterising.+ deriving (Show, Eq, Ord, Generic)++instance NFData Role+instance Serialise Role++$(A.deriveJSON A.defaultOptions ''Role)++displayRole :: Role -> Text+displayRole r = case r of+ Nominal -> "nominal"+ Representational -> "representational"+ Phantom -> "phantom"
src/Language/PureScript/Sugar.hs view
@@ -1,38 +1,29 @@------------------------------------------------------------------------------------ Module : Language.PureScript.Sugar--- Copyright : (c) Phil Freeman 2013--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :--- -- | -- Desugaring passes ----------------------------------------------------------------------------------{-# LANGUAGE FlexibleContexts #-}- module Language.PureScript.Sugar (desugar, module S) where -import Control.Monad import Control.Category ((>>>))-import Control.Applicative-import Control.Monad.Error.Class-import Control.Monad.Supply.Class--import Language.PureScript.AST-import Language.PureScript.Errors+import Control.Monad ((>=>))+import Control.Monad.Error.Class (MonadError)+import Control.Monad.Supply.Class (MonadSupply)+import Control.Monad.State.Class (MonadState)+import Control.Monad.Writer.Class (MonadWriter) +import Language.PureScript.AST (Module)+import Language.PureScript.Errors (MultipleErrors)+import Language.PureScript.Externs (ExternsFile)+import Language.PureScript.Linter.Imports (UsedImports) import Language.PureScript.Sugar.BindingGroups as S import Language.PureScript.Sugar.CaseDeclarations as S import Language.PureScript.Sugar.DoNotation as S+import Language.PureScript.Sugar.AdoNotation as S+import Language.PureScript.Sugar.LetPattern as S import Language.PureScript.Sugar.Names as S import Language.PureScript.Sugar.ObjectWildcards as S import Language.PureScript.Sugar.Operators as S import Language.PureScript.Sugar.TypeClasses as S+import Language.PureScript.Sugar.TypeClasses.Deriving as S import Language.PureScript.Sugar.TypeDeclarations as S -- |@@ -44,8 +35,10 @@ -- -- * Desugar operator sections ----- * Desugar do-notation using the @Prelude.Monad@ type class+-- * Desugar do-notation --+-- * Desugar ado-notation+-- -- * Desugar top-level case declarations into explicit case expressions -- -- * Desugar type declarations into value declarations with explicit type annotations@@ -54,18 +47,29 @@ -- -- * Rebracket user-defined binary operators ----- * Introduce type synonyms for type class dictionaries+-- * Introduce newtypes for type class dictionaries and value declarations for instances -- -- * Group mutually recursive value and data declarations into binding groups. ---desugar :: (Applicative m, MonadSupply m, MonadError MultipleErrors m) => [Module] -> m [Module]-desugar = map removeSignedLiterals- >>> mapM desugarObjectConstructors- >=> mapM desugarOperatorSections- >=> mapM desugarDoModule- >=> desugarCasesModule- >=> desugarTypeDeclarationsModule- >=> desugarImports- >=> rebracket- >=> desugarTypeClasses- >=> createBindingGroupsModule+desugar+ :: MonadSupply m+ => MonadError MultipleErrors m+ => MonadWriter MultipleErrors m+ => MonadState (Env, UsedImports) m+ => [ExternsFile]+ -> Module+ -> m Module+desugar externs =+ desugarSignedLiterals+ >>> desugarObjectConstructors+ >=> desugarDoModule+ >=> desugarAdoModule+ >=> desugarLetPatternModule+ >>> desugarCasesModule+ >=> desugarTypeDeclarationsModule+ >=> desugarImports+ >=> rebracket externs+ >=> checkFixityExports+ >=> deriveInstances+ >=> desugarTypeClasses externs+ >=> createBindingGroupsModule
+ src/Language/PureScript/Sugar/AdoNotation.hs view
@@ -0,0 +1,66 @@+-- | This module implements the desugaring pass which replaces ado-notation statements with+-- appropriate calls to pure and apply.++module Language.PureScript.Sugar.AdoNotation (desugarAdoModule) where++import Prelude hiding (abs)++import Control.Monad (foldM)+import Control.Monad.Error.Class (MonadError(..))+import Control.Monad.Supply.Class (MonadSupply)+import Data.List (foldl')+import Language.PureScript.AST (Binder(..), CaseAlternative(..), Declaration, DoNotationElement(..), Expr(..), pattern MkUnguarded, Module(..), SourceSpan, WhereProvenance(..), declSourceSpan, everywhereOnValuesM)+import Language.PureScript.Errors (MultipleErrors, parU, rethrowWithPosition)+import Language.PureScript.Names (pattern ByNullSourcePos, Ident(..), ModuleName, Qualified(..), byMaybeModuleName, freshIdent')+import Language.PureScript.Constants.Libs qualified as C++-- | Replace all @AdoNotationBind@ and @AdoNotationValue@ constructors with+-- applications of the pure and apply functions in scope, and all @AdoNotationLet@+-- constructors with let expressions.+desugarAdoModule :: forall m. (MonadSupply m, MonadError MultipleErrors m) => Module -> m Module+desugarAdoModule (Module ss coms mn ds exts) = Module ss coms mn <$> parU ds desugarAdo <*> pure exts++-- | Desugar a single ado statement+desugarAdo :: forall m. (MonadSupply m, MonadError MultipleErrors m) => Declaration -> m Declaration+desugarAdo d =+ let ss = declSourceSpan d+ (f, _, _) = everywhereOnValuesM return (replace ss) return+ in rethrowWithPosition ss $ f d+ where+ pure' :: SourceSpan -> Maybe ModuleName -> Expr+ pure' ss m = Var ss (Qualified (byMaybeModuleName m) (Ident C.S_pure))++ map' :: SourceSpan -> Maybe ModuleName -> Expr+ map' ss m = Var ss (Qualified (byMaybeModuleName m) (Ident C.S_map))++ apply :: SourceSpan -> Maybe ModuleName -> Expr+ apply ss m = Var ss (Qualified (byMaybeModuleName m) (Ident C.S_apply))++ replace :: SourceSpan -> Expr -> m Expr+ replace pos (Ado m els yield) = do+ (func, args) <- foldM (go pos) (yield, []) (reverse els)+ return $ case args of+ [] -> App (pure' pos m) func+ hd : tl -> foldl' (\a b -> App (App (apply pos m) a) b) (App (App (map' pos m) func) hd) tl+ replace _ (PositionedValue pos com v) = PositionedValue pos com <$> rethrowWithPosition pos (replace pos v)+ replace _ other = return other++ go :: SourceSpan -> (Expr, [Expr]) -> DoNotationElement -> m (Expr, [Expr])+ go _ (yield, args) (DoNotationValue val) =+ return (Abs NullBinder yield, val : args)+ go _ (yield, args) (DoNotationBind (VarBinder ss ident) val) =+ return (Abs (VarBinder ss ident) yield, val : args)+ go ss (yield, args) (DoNotationBind binder val) = do+ ident <- freshIdent'+ let abs = Abs (VarBinder ss ident)+ (Case [Var ss (Qualified ByNullSourcePos ident)]+ [CaseAlternative [binder] [MkUnguarded yield]])+ return (abs, val : args)+ go _ (yield, args) (DoNotationLet ds) = do+ return (Let FromLet ds yield, args)+ go _ acc (PositionedDoNotationElement pos com el) =+ rethrowWithPosition pos $ do+ (yield, args) <- go pos acc el+ return $ case args of+ [] -> (PositionedValue pos com yield, args)+ (a : as) -> (yield, PositionedValue pos com a : as)
src/Language/PureScript/Sugar/BindingGroups.hs view
@@ -1,164 +1,241 @@------------------------------------------------------------------------------------ Module : Language.PureScript.BindingGroups--- Copyright : (c) Phil Freeman 2013--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :--- -- | -- This module implements the desugaring pass which creates binding groups from sets of -- mutually-recursive value declarations and mutually-recursive type declarations. --------------------------------------------------------------------------------+module Language.PureScript.Sugar.BindingGroups+ ( createBindingGroups+ , createBindingGroupsModule+ , collapseBindingGroups+ ) where -{-# LANGUAGE FlexibleContexts #-}+import Prelude+import Protolude (ordNub, swap) -module Language.PureScript.Sugar.BindingGroups (- createBindingGroups,- createBindingGroupsModule,- collapseBindingGroups,- collapseBindingGroupsModule-) where+import Control.Monad ((<=<), guard)+import Control.Monad.Error.Class (MonadError(..)) -import Data.Graph-import Data.List (nub, intersect)+import Data.Graph (SCC(..), stronglyConnComp, stronglyConnCompR)+import Data.List (intersect, (\\))+import Data.List.NonEmpty (NonEmpty((:|)), nonEmpty)+import Data.Foldable (find)+import Data.Functor (($>)) import Data.Maybe (isJust, mapMaybe)-import Control.Applicative-import Control.Monad ((<=<))-import Control.Monad.Error.Class--import qualified Data.Set as S+import Data.List.NonEmpty qualified as NEL+import Data.Map qualified as M+import Data.Set qualified as S import Language.PureScript.AST-import Language.PureScript.Names-import Language.PureScript.Types-import Language.PureScript.Environment-import Language.PureScript.Errors+import Language.PureScript.Crash (internalError)+import Language.PureScript.Environment (NameKind)+import Language.PureScript.Errors (ErrorMessage(..), MultipleErrors(..), SimpleErrorMessage(..), errorMessage', parU, positionedError)+import Language.PureScript.Names (pattern ByNullSourcePos, Ident, ModuleName, ProperName, ProperNameType(..), Qualified(..), QualifiedBy(..), coerceProperName)+import Language.PureScript.Types (Constraint(..), SourceConstraint, SourceType, Type(..), everythingOnTypes) --- |--- Replace all sets of mutually-recursive declarations in a module with binding groups----createBindingGroupsModule :: (Functor m, Applicative m, MonadError MultipleErrors m) => [Module] -> m [Module]-createBindingGroupsModule = mapM $ \(Module coms name ds exps) -> Module coms name <$> createBindingGroups name ds <*> pure exps+data VertexType+ = VertexDefinition+ | VertexKindSignature+ | VertexRoleDeclaration+ deriving (Eq, Ord, Show) -- |--- Collapse all binding groups in a module to individual declarations+-- Replace all sets of mutually-recursive declarations in a module with binding groups ---collapseBindingGroupsModule :: [Module] -> [Module]-collapseBindingGroupsModule = map $ \(Module coms name ds exps) -> Module coms name (collapseBindingGroups ds) exps+createBindingGroupsModule+ :: (MonadError MultipleErrors m)+ => Module+ -> m Module+createBindingGroupsModule (Module ss coms name ds exps) =+ Module ss coms name <$> createBindingGroups name ds <*> pure exps -createBindingGroups :: (Functor m, Applicative m, MonadError MultipleErrors m) => ModuleName -> [Declaration] -> m [Declaration]+createBindingGroups+ :: forall m+ . (MonadError MultipleErrors m)+ => ModuleName+ -> [Declaration]+ -> m [Declaration] createBindingGroups moduleName = mapM f <=< handleDecls where (f, _, _) = everywhereOnValuesTopDownM return handleExprs return - handleExprs :: (Functor m, MonadError MultipleErrors m) => Expr -> m Expr- handleExprs (Let ds val) = flip Let val <$> handleDecls ds+ handleExprs :: Expr -> m Expr+ handleExprs (Let w ds val) = (\ds' -> Let w ds' val) <$> handleDecls ds handleExprs other = return other - -- | -- Replace all sets of mutually-recursive declarations with binding groups- --- handleDecls :: (Functor m, MonadError MultipleErrors m) => [Declaration] -> m [Declaration]+ handleDecls :: [Declaration] -> m [Declaration] handleDecls ds = do- let values = filter isValueDecl ds- dataDecls = filter isDataDecl ds- allProperNames = map getProperName dataDecls- dataVerts = map (\d -> (d, getProperName d, usedProperNames moduleName d `intersect` allProperNames)) dataDecls- dataBindingGroupDecls <- parU (stronglyConnComp dataVerts) toDataBindingGroup- let allIdents = map getIdent values- valueVerts = map (\d -> (d, getIdent d, usedIdents moduleName d `intersect` allIdents)) values- bindingGroupDecls <- parU (stronglyConnComp valueVerts) (toBindingGroup moduleName)+ let values = mapMaybe (fmap (fmap extractGuardedExpr) . getValueDeclaration) ds+ kindDecls = (,VertexKindSignature) <$> filter isKindDecl ds+ dataDecls = (,VertexDefinition) <$> filter (\a -> isDataDecl a || isExternDataDecl a || isTypeSynonymDecl a || isTypeClassDecl a) ds+ roleDecls = (,VertexRoleDeclaration) <$> filter isRoleDecl ds+ roleAnns = declTypeName . fst <$> roleDecls+ kindSigs = declTypeName . fst <$> kindDecls+ typeSyns = declTypeName <$> filter isTypeSynonymDecl ds+ nonTypeSynKindSigs = kindSigs \\ typeSyns+ allDecls = kindDecls ++ dataDecls ++ roleDecls+ allProperNames = declTypeName . fst <$> allDecls+ mkVert (d, vty) =+ let names = usedTypeNames moduleName d `intersect` allProperNames+ name = declTypeName d+ -- If a dependency of a kind signature has a kind signature, than that's all we need to+ -- depend on, except in the case that we are using a type synonym. In order to expand+ -- the type synonym, we must depend on the synonym declaration itself.+ --+ -- Arguably, type declarations (as opposed to just kind signatures) could also depend+ -- on kind signatures when present. Attempting this caused one known issue (#4038); the+ -- type checker might not expect type declarations not to be preceded or grouped by+ -- their actual dependencies in all cases. But in principle, if done carefully, this+ -- approach could be used to reduce the number or size of data binding group cycles.+ -- (It's critical that kind signatures not appear in groups, which is why they get+ -- special treatment.)+ vtype n+ | vty == VertexKindSignature && n `elem` nonTypeSynKindSigs = VertexKindSignature+ | otherwise = VertexDefinition+ deps = fmap (\n -> (n, vtype n)) names+ self+ | vty == VertexDefinition =+ (guard (name `elem` kindSigs) $> (name, VertexKindSignature))+ ++ (guard (name `elem` roleAnns && not (isExternDataDecl d)) $> (name, VertexRoleDeclaration))+ | vty == VertexRoleDeclaration = [(name, VertexDefinition)]+ | otherwise = []+ in (d, (name, vty), self ++ deps)+ dataVerts = fmap mkVert allDecls+ dataBindingGroupDecls <- parU (stronglyConnCompR dataVerts) toDataBindingGroup+ let+ -- #4437+ --+ -- The idea here is to create a `Graph` whose `key` is a tuple: `(Bool, Ident)`,+ -- where the `Bool` encodes the absence of a type hole. This relies on an implementation+ -- detail for `stronglyConnComp` which allows identifiers with no type holes to "float"+ -- and get checked before those that do, while preserving reverse topological sorting.+ makeValueDeclarationKey = (,) <$> exprHasNoTypeHole . valdeclExpression <*> valdeclIdent+ valueDeclarationKeys = makeValueDeclarationKey <$> values++ valueDeclarationInfo = M.fromList $ swap <$> valueDeclarationKeys+ findDeclarationInfo i = (M.findWithDefault False i valueDeclarationInfo, i)+ computeValueDependencies = (`intersect` valueDeclarationKeys) . fmap findDeclarationInfo . usedIdents moduleName + + makeValueDeclarationVert = (,,) <$> id <*> makeValueDeclarationKey <*> computeValueDependencies+ valueDeclarationVerts = makeValueDeclarationVert <$> values++ bindingGroupDecls <- parU (stronglyConnComp valueDeclarationVerts) (toBindingGroup moduleName) return $ filter isImportDecl ds ++- filter isExternDataDecl ds ++- filter isExternInstanceDecl ds ++ dataBindingGroupDecls ++- filter isTypeClassDeclaration ds ++- filter isTypeClassInstanceDeclaration ds +++ filter isTypeClassInstanceDecl ds ++ filter isFixityDecl ds ++ filter isExternDecl ds ++ bindingGroupDecls+ where+ extractGuardedExpr [MkUnguarded expr] = expr+ extractGuardedExpr _ = internalError "Expected Guards to have been desugared in handleDecls." + exprHasNoTypeHole :: Expr -> Bool+ exprHasNoTypeHole = not . exprHasTypeHole+ where+ exprHasTypeHole :: Expr -> Bool+ (_, exprHasTypeHole, _, _, _) = everythingOnValues (||) goDefault goExpr goDefault goDefault goDefault+ where+ goExpr :: Expr -> Bool+ goExpr (Hole _) = True+ goExpr _ = False++ goDefault :: forall a. a -> Bool+ goDefault = const False+ -- | -- Collapse all binding groups to individual declarations -- collapseBindingGroups :: [Declaration] -> [Declaration]-collapseBindingGroups = let (f, _, _) = everywhereOnValues id collapseBindingGroupsForValue id in map f . concatMap go+collapseBindingGroups =+ let (f, _, _) = everywhereOnValues id flattenBindingGroupsForValue id+ in fmap f . flattenBindingGroups++flattenBindingGroupsForValue :: Expr -> Expr+flattenBindingGroupsForValue (Let w ds val) = Let w (flattenBindingGroups ds) val+flattenBindingGroupsForValue other = other++flattenBindingGroups :: [Declaration] -> [Declaration]+flattenBindingGroups = concatMap go where- go (DataBindingGroupDeclaration ds) = ds- go (BindingGroupDeclaration ds) = map (\(ident, nameKind, val) -> ValueDeclaration ident nameKind [] (Right val)) ds- go (PositionedDeclaration pos com d) = map (PositionedDeclaration pos com) $ go d+ go (DataBindingGroupDeclaration ds) = NEL.toList ds+ go (BindingGroupDeclaration ds) =+ NEL.toList $ fmap (\((sa, ident), nameKind, val) ->+ ValueDecl sa ident nameKind [] [MkUnguarded val]) ds go other = [other] -collapseBindingGroupsForValue :: Expr -> Expr-collapseBindingGroupsForValue (Let ds val) = Let (collapseBindingGroups ds) val-collapseBindingGroupsForValue other = other--usedIdents :: ModuleName -> Declaration -> [Ident]-usedIdents moduleName =- let (f, _, _, _, _) = everythingWithContextOnValues S.empty [] (++) def usedNamesE usedNamesB def def- in nub . f+usedIdents :: ModuleName -> ValueDeclarationData Expr -> [Ident]+usedIdents moduleName = ordNub . usedIdents' S.empty . valdeclExpression where- def s _ = (s, [])+ def _ _ = [] - usedNamesE :: S.Set Ident -> Expr -> (S.Set Ident, [Ident])- usedNamesE scope (Var (Qualified Nothing name)) | name `S.notMember` scope = (scope, [name])- usedNamesE scope (Var (Qualified (Just moduleName') name)) | moduleName == moduleName' && name `S.notMember` scope = (scope, [name])- usedNamesE scope (Abs (Left name) _) = (name `S.insert` scope, [])- usedNamesE scope _ = (scope, [])+ (_, usedIdents', _, _, _) = everythingWithScope def usedNamesE def def def - usedNamesB :: S.Set Ident -> Binder -> (S.Set Ident, [Ident])- usedNamesB scope binder = (scope `S.union` S.fromList (binderNames binder), [])+ usedNamesE :: S.Set ScopedIdent -> Expr -> [Ident]+ usedNamesE scope (Var _ (Qualified (BySourcePos _) name))+ | LocalIdent name `S.notMember` scope = [name]+ usedNamesE scope (Var _ (Qualified (ByModuleName moduleName') name))+ | moduleName == moduleName' && ToplevelIdent name `S.notMember` scope = [name]+ usedNamesE _ _ = [] usedImmediateIdents :: ModuleName -> Declaration -> [Ident] usedImmediateIdents moduleName = let (f, _, _, _, _) = everythingWithContextOnValues True [] (++) def usedNamesE def def def- in nub . f+ in ordNub . f where def s _ = (s, []) usedNamesE :: Bool -> Expr -> (Bool, [Ident])- usedNamesE True (Var (Qualified Nothing name)) = (True, [name])- usedNamesE True (Var (Qualified (Just moduleName') name)) | moduleName == moduleName' = (True, [name])+ usedNamesE True (Var _ (Qualified (BySourcePos _) name)) = (True, [name])+ usedNamesE True (Var _ (Qualified (ByModuleName moduleName') name))+ | moduleName == moduleName' = (True, [name]) usedNamesE True (Abs _ _) = (False, []) usedNamesE scope _ = (scope, []) -usedProperNames :: ModuleName -> Declaration -> [ProperName]-usedProperNames moduleName =- let (f, _, _, _, _) = accumTypes (everythingOnTypes (++) usedNames)- in nub . f+usedTypeNames :: ModuleName -> Declaration -> [ProperName 'TypeName]+usedTypeNames moduleName = go where- usedNames :: Type -> [ProperName]- usedNames (ConstrainedType constraints _) = flip mapMaybe constraints $ \qual ->- case qual of- (Qualified (Just moduleName') name, _) | moduleName == moduleName' -> Just name- _ -> Nothing- usedNames (TypeConstructor (Qualified (Just moduleName') name)) | moduleName == moduleName' = [name]+ (f, _, _, _, _) = accumTypes (everythingOnTypes (++) usedNames)++ go :: Declaration -> [ProperName 'TypeName]+ go decl = ordNub (f decl <> usedNamesForTypeClassDeps decl)++ usedNames :: SourceType -> [ProperName 'TypeName]+ usedNames (ConstrainedType _ con _) = usedConstraint con+ usedNames (TypeConstructor _ (Qualified (ByModuleName moduleName') name))+ | moduleName == moduleName' = [name] usedNames _ = [] -getIdent :: Declaration -> Ident-getIdent (ValueDeclaration ident _ _ _) = ident-getIdent (PositionedDeclaration _ _ d) = getIdent d-getIdent _ = error "Expected ValueDeclaration"+ usedConstraint :: SourceConstraint -> [ProperName 'TypeName]+ usedConstraint (Constraint _ (Qualified (ByModuleName moduleName') name) _ _ _)+ | moduleName == moduleName' = [coerceProperName name]+ usedConstraint _ = [] -getProperName :: Declaration -> ProperName-getProperName (DataDeclaration _ pn _ _) = pn-getProperName (TypeSynonymDeclaration pn _ _) = pn-getProperName (PositionedDeclaration _ _ d) = getProperName d-getProperName _ = error "Expected DataDeclaration"+ usedNamesForTypeClassDeps :: Declaration -> [ProperName 'TypeName]+ usedNamesForTypeClassDeps (TypeClassDeclaration _ _ _ deps _ _) = foldMap usedConstraint deps+ usedNamesForTypeClassDeps _ = [] +declTypeName :: Declaration -> ProperName 'TypeName+declTypeName (DataDeclaration _ _ pn _ _) = pn+declTypeName (ExternDataDeclaration _ pn _) = pn+declTypeName (TypeSynonymDeclaration _ pn _ _) = pn+declTypeName (TypeClassDeclaration _ pn _ _ _ _) = coerceProperName pn+declTypeName (KindDeclaration _ _ pn _) = pn+declTypeName (RoleDeclaration (RoleDeclarationData _ pn _)) = pn+declTypeName _ = internalError "Expected DataDeclaration"+ -- | -- Convert a group of mutually-recursive dependencies into a BindingGroupDeclaration (or simple ValueDeclaration). -- ---toBindingGroup :: (Functor m, MonadError MultipleErrors m) => ModuleName -> SCC Declaration -> m Declaration-toBindingGroup _ (AcyclicSCC d) = return d-toBindingGroup _ (CyclicSCC [d]) = return d-toBindingGroup moduleName (CyclicSCC ds') =+toBindingGroup+ :: forall m+ . (MonadError MultipleErrors m)+ => ModuleName+ -> SCC (ValueDeclarationData Expr)+ -> m Declaration+toBindingGroup _ (AcyclicSCC d) = return (mkDeclaration d)+toBindingGroup moduleName (CyclicSCC ds') = do -- Once we have a mutually-recursive group of declarations, we need to sort -- them further by their immediate dependencies (those outside function -- bodies). In particular, this is relevant for type instance dictionaries@@ -168,40 +245,61 @@ -- If we discover declarations that still contain mutually-recursive -- immediate references, we're guaranteed to get an undefined reference at -- runtime, so treat this as an error. See also github issue #365.- BindingGroupDeclaration <$> mapM toBinding (stronglyConnComp valueVerts)+ BindingGroupDeclaration . NEL.fromList <$> mapM toBinding (stronglyConnComp valueVerts) where idents :: [Ident]- idents = map (\(_, i, _) -> i) valueVerts+ idents = fmap (\(_, i, _) -> i) valueVerts - valueVerts :: [(Declaration, Ident, [Ident])]- valueVerts = map (\d -> (d, getIdent d, usedImmediateIdents moduleName d `intersect` idents)) ds'+ valueVerts :: [(ValueDeclarationData Expr, Ident, [Ident])]+ valueVerts = fmap (\d -> (d, valdeclIdent d, usedImmediateIdents moduleName (mkDeclaration d) `intersect` idents)) ds' - toBinding :: (MonadError MultipleErrors m) => SCC Declaration -> m (Ident, NameKind, Expr)+ toBinding :: SCC (ValueDeclarationData Expr) -> m ((SourceAnn, Ident), NameKind, Expr) toBinding (AcyclicSCC d) = return $ fromValueDecl d- toBinding (CyclicSCC ~(d:ds)) = cycleError d ds+ toBinding (CyclicSCC ds) = throwError $ foldMap cycleError ds - cycleError :: (MonadError MultipleErrors m) => Declaration -> [Declaration] -> m a- cycleError (PositionedDeclaration p _ d) ds = rethrowWithPosition p $ cycleError d ds- cycleError (ValueDeclaration n _ _ (Right _)) [] = throwError . errorMessage $ CycleInDeclaration n- cycleError d ds@(_:_) = rethrow (onErrorMessages (NotYetDefined (map getIdent ds))) $ cycleError d []- cycleError _ _ = error "Expected ValueDeclaration"+ cycleError :: ValueDeclarationData Expr -> MultipleErrors+ cycleError (ValueDeclarationData (ss, _) n _ _ _) = errorMessage' ss $ CycleInDeclaration n -toDataBindingGroup :: (MonadError MultipleErrors m) => SCC Declaration -> m Declaration-toDataBindingGroup (AcyclicSCC d) = return d-toDataBindingGroup (CyclicSCC [d]) = case isTypeSynonym d of- Just pn -> throwError . errorMessage $ CycleInTypeSynonym (Just pn)- _ -> return d+toDataBindingGroup+ :: MonadError MultipleErrors m+ => Ord a+ => SCC (Declaration, (ProperName 'TypeName, a), [(ProperName 'TypeName, a)])+ -> m Declaration+toDataBindingGroup (AcyclicSCC (d, _, _)) = return d toDataBindingGroup (CyclicSCC ds')- | all (isJust . isTypeSynonym) ds' = throwError . errorMessage $ CycleInTypeSynonym Nothing- | otherwise = return $ DataBindingGroupDeclaration ds'+ | Just kds@((ss, _):|_) <- nonEmpty $ concatMap (kindDecl . getDecl) ds' = throwError . errorMessage' ss . CycleInKindDeclaration $ fmap snd kds+ | not (null typeSynonymCycles) =+ throwError+ . MultipleErrors+ . fmap (\syns -> ErrorMessage [positionedError . declSourceSpan . getDecl $ NEL.head syns] . CycleInTypeSynonym $ fmap (fst . getName) syns)+ $ typeSynonymCycles+ | otherwise = return . DataBindingGroupDeclaration . NEL.fromList $ getDecl <$> ds'+ where+ kindDecl (KindDeclaration sa _ pn _) = [(fst sa, Qualified ByNullSourcePos pn)]+ kindDecl (ExternDataDeclaration sa pn _) = [(fst sa, Qualified ByNullSourcePos pn)]+ kindDecl _ = [] -isTypeSynonym :: Declaration -> Maybe ProperName-isTypeSynonym (TypeSynonymDeclaration pn _ _) = Just pn-isTypeSynonym (PositionedDeclaration _ _ d) = isTypeSynonym d+ getDecl (decl, _, _) = decl+ getName (_, name, _) = name+ lookupVert name = find ((==) name . getName) ds'++ onlySynonyms (decl, name, deps) = do+ guard . isJust $ isTypeSynonym decl+ pure (decl, name, filter (maybe False (isJust . isTypeSynonym . getDecl) . lookupVert) deps)++ isCycle (CyclicSCC c) = nonEmpty c+ isCycle _ = Nothing++ typeSynonymCycles =+ mapMaybe isCycle . stronglyConnCompR . mapMaybe onlySynonyms $ ds'++isTypeSynonym :: Declaration -> Maybe (ProperName 'TypeName)+isTypeSynonym (TypeSynonymDeclaration _ pn _ _) = Just pn isTypeSynonym _ = Nothing -fromValueDecl :: Declaration -> (Ident, NameKind, Expr)-fromValueDecl (ValueDeclaration ident nameKind [] (Right val)) = (ident, nameKind, val)-fromValueDecl ValueDeclaration{} = error "Binders should have been desugared"-fromValueDecl (PositionedDeclaration _ _ d) = fromValueDecl d-fromValueDecl _ = error "Expected ValueDeclaration"+mkDeclaration :: ValueDeclarationData Expr -> Declaration+mkDeclaration = ValueDeclaration . fmap (pure . MkUnguarded)++fromValueDecl :: ValueDeclarationData Expr -> ((SourceAnn, Ident), NameKind, Expr)+fromValueDecl (ValueDeclarationData sa ident nameKind [] val) = ((sa, ident), nameKind, val)+fromValueDecl ValueDeclarationData{} = internalError "Binders should have been desugared"
src/Language/PureScript/Sugar/CaseDeclarations.hs view
@@ -1,161 +1,419 @@------------------------------------------------------------------------------------ Module : Language.PureScript.CaseDeclarations--- Copyright : (c) Phil Freeman 2013--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :--- -- | -- This module implements the desugaring pass which replaces top-level binders with -- case expressions. ----------------------------------------------------------------------------------{-# LANGUAGE FlexibleContexts #-}+module Language.PureScript.Sugar.CaseDeclarations+ ( desugarCases+ , desugarCasesModule+ , desugarCaseGuards+ ) where -module Language.PureScript.Sugar.CaseDeclarations (- desugarCases,- desugarCasesModule-) where+import Prelude+import Protolude (ordNub) -import Data.Maybe (catMaybes)-import Data.List (nub, groupBy)+import Data.List (groupBy, foldl1')+import Data.Maybe (catMaybes, mapMaybe) -import Control.Applicative-import Control.Monad ((<=<), forM, join, unless, replicateM)-import Control.Monad.Except (throwError)-import Control.Monad.Error.Class (MonadError)-import Control.Monad.Supply.Class+import Control.Monad ((<=<), forM, replicateM, join, unless)+import Control.Monad.Error.Class (MonadError(..))+import Control.Monad.Supply.Class (MonadSupply) -import Language.PureScript.Names import Language.PureScript.AST-import Language.PureScript.Environment-import Language.PureScript.Errors-import Language.PureScript.Traversals+import Language.PureScript.Crash (internalError)+import Language.PureScript.Environment (NameKind(..))+import Language.PureScript.Errors (ErrorMessage(..), MultipleErrors(..), SimpleErrorMessage(..), addHint, errorMessage', parU, rethrow, withPosition)+import Language.PureScript.Names (pattern ByNullSourcePos, Ident, Qualified(..), freshIdent') import Language.PureScript.TypeChecker.Monad (guardWith) --- Data.Either.isLeft (base 4.7)-isLeft :: Either a b -> Bool-isLeft (Left _) = True-isLeft (Right _) = False- -- | -- Replace all top-level binders in a module with case expressions. ---desugarCasesModule :: (Functor m, Applicative m, MonadSupply m, MonadError MultipleErrors m) => [Module] -> m [Module]-desugarCasesModule ms = forM ms $ \(Module coms name ds exps) ->- rethrow (onErrorMessages (ErrorInModule name)) $- Module coms name <$> (desugarCases <=< desugarAbs $ ds) <*> pure exps+desugarCasesModule+ :: (MonadSupply m, MonadError MultipleErrors m)+ => Module+ -> m Module+desugarCasesModule (Module ss coms name ds exps) =+ rethrow (addHint (ErrorInModule name)) $+ Module ss coms name+ <$> (desugarCases <=< desugarAbs <=< validateCases $ ds)+ <*> pure exps -desugarAbs :: (Functor m, Applicative m, MonadSupply m, MonadError MultipleErrors m) => [Declaration] -> m [Declaration]+desugarCaseGuards+ :: forall m. (MonadSupply m, MonadError MultipleErrors m)+ => [Declaration]+ -> m [Declaration]+desugarCaseGuards declarations = parU declarations go+ where+ go d =+ let (f, _, _) = everywhereOnValuesM return (desugarGuardedExprs (declSourceSpan d)) return+ in f d++-- |+-- Desugar case with pattern guards and pattern clauses to a+-- series of nested case expressions.+--+desugarGuardedExprs+ :: forall m. (MonadSupply m)+ => SourceSpan+ -> Expr+ -> m Expr+desugarGuardedExprs ss (Case scrut alternatives)+ | not $ all isTrivialExpr scrut = do+ -- in case the scrutinee is non trivial (e.g. not a Var or Literal)+ -- we may evaluate the scrutinee more than once when a guard occurs.+ -- We bind the scrutinee to Vars here to mitigate this case.+ (scrut', scrut_decls) <- unzip <$> forM scrut (\e -> do+ scrut_id <- freshIdent'+ pure ( Var ss (Qualified ByNullSourcePos scrut_id)+ , ValueDecl (ss, []) scrut_id Private [] [MkUnguarded e]+ )+ )+ Let FromLet scrut_decls <$> desugarGuardedExprs ss (Case scrut' alternatives)+ where+ isTrivialExpr (Var _ _) = True+ isTrivialExpr (Literal _ _) = True+ isTrivialExpr (Accessor _ e) = isTrivialExpr e+ isTrivialExpr (Parens e) = isTrivialExpr e+ isTrivialExpr (PositionedValue _ _ e) = isTrivialExpr e+ isTrivialExpr (TypedValue _ e _) = isTrivialExpr e+ isTrivialExpr _ = False++desugarGuardedExprs ss (Case scrut alternatives) =+ let+ -- Alternatives which do not have guards are+ -- left as-is. Alternatives which+ --+ -- 1) have multiple clauses of the form+ -- binder | g_1+ -- , g_2+ -- , ...+ -- , g_n+ -- -> expr+ --+ -- 2) and/or contain pattern guards of the form+ -- binder | pat_bind <- e+ -- , ...+ --+ -- are desugared to a sequence of nested case expressions.+ --+ -- Consider an example case expression:+ --+ -- case e of+ -- (T s) | Just info <- Map.lookup s names+ -- , is_used info+ -- -> f info+ --+ -- We desugar this to+ --+ -- case e of+ -- (T s) -> case Map.lookup s names of+ -- Just info -> case is_used info of+ -- True -> f info+ -- (_ -> <partial>)+ -- (_ -> <partial>)+ --+ -- Note that if the original case is partial the desugared+ -- case is also partial.+ --+ -- Consider an exhaustive case expression:+ --+ -- case e of+ -- (T s) | Just info <- Map.lookup s names+ -- , is_used info+ -- -> f info+ -- _ -> Nothing+ --+ -- desugars to:+ --+ -- case e of+ -- _ -> let+ -- v _ = Nothing+ -- in+ -- case e of+ -- (T s) -> case Map.lookup s names of+ -- Just info -> f info+ -- _ -> v true+ -- _ -> v true+ --+ -- This might look strange but simplifies the algorithm a lot.+ --+ desugarAlternatives :: [CaseAlternative]+ -> m [CaseAlternative]+ desugarAlternatives [] = pure []++ -- the trivial case: no guards+ desugarAlternatives (a@(CaseAlternative _ [MkUnguarded _]) : as) =+ (a :) <$> desugarAlternatives as++ -- Special case: CoreFn understands single condition guards on+ -- binders right hand side.+ desugarAlternatives (CaseAlternative ab ge : as)+ | not (null cond_guards) =+ (CaseAlternative ab cond_guards :)+ <$> desugarGuardedAlternative ab rest as+ | otherwise = desugarGuardedAlternative ab ge as+ where+ (cond_guards, rest) = span isSingleCondGuard ge++ isSingleCondGuard (GuardedExpr [ConditionGuard _] _) = True+ isSingleCondGuard _ = False++ desugarGuardedAlternative :: [Binder]+ -> [GuardedExpr]+ -> [CaseAlternative]+ -> m [CaseAlternative]+ desugarGuardedAlternative _vb [] rem_alts =+ desugarAlternatives rem_alts++ desugarGuardedAlternative vb (GuardedExpr gs e : ge) rem_alts = do+ rhs <- desugarAltOutOfLine vb ge rem_alts $ \alt_fail ->+ let+ -- if the binder is a var binder we must not add+ -- the fail case as it results in unreachable+ -- alternative+ alt_fail' n | all isIrrefutable vb = []+ | otherwise = alt_fail n+++ -- we are here:+ --+ -- case scrut of+ -- ...+ -- _ -> let+ -- v _ = <out of line case>+ -- in case scrut of -- we are here+ -- ...+ --+ in Case scrut+ (CaseAlternative vb [MkUnguarded (desugarGuard gs e alt_fail)]+ : alt_fail' (length scrut))++ return [ CaseAlternative scrut_nullbinder [MkUnguarded rhs]]++ desugarGuard :: [Guard] -> Expr -> (Int ->[CaseAlternative]) -> Expr+ desugarGuard [] e _ = e+ desugarGuard (ConditionGuard c : gs) e match_failed+ | isTrueExpr c = desugarGuard gs e match_failed+ | otherwise =+ Case [c]+ (CaseAlternative [LiteralBinder ss (BooleanLiteral True)]+ [MkUnguarded (desugarGuard gs e match_failed)] : match_failed 1)++ desugarGuard (PatternGuard vb g : gs) e match_failed =+ Case [g]+ (CaseAlternative [vb] [MkUnguarded (desugarGuard gs e match_failed)]+ : match_failed')+ where+ -- don't consider match_failed case if the binder is irrefutable+ match_failed' | isIrrefutable vb = []+ | otherwise = match_failed 1++ -- we generate a let-binding for the remaining guards+ -- and alternatives. A CaseAlternative is passed (or in+ -- fact the original case is partial non is passed) to+ -- mk_body which branches to the generated let-binding.+ desugarAltOutOfLine :: [Binder]+ -> [GuardedExpr]+ -> [CaseAlternative]+ -> ((Int -> [CaseAlternative]) -> Expr)+ -> m Expr+ desugarAltOutOfLine alt_binder rem_guarded rem_alts mk_body+ | Just rem_case <- mkCaseOfRemainingGuardsAndAlts = do++ desugared <- desugarGuardedExprs ss rem_case+ rem_case_id <- freshIdent'+ unused_binder <- freshIdent'++ let+ goto_rem_case :: Expr+ goto_rem_case = Var ss (Qualified ByNullSourcePos rem_case_id)+ `App` Literal ss (BooleanLiteral True)+ alt_fail :: Int -> [CaseAlternative]+ alt_fail n = [CaseAlternative (replicate n NullBinder) [MkUnguarded goto_rem_case]]++ pure $ Let FromLet [+ ValueDecl (ss, []) rem_case_id Private []+ [MkUnguarded (Abs (VarBinder ss unused_binder) desugared)]+ ] (mk_body alt_fail)++ | otherwise+ = pure $ mk_body (const [])+ where+ mkCaseOfRemainingGuardsAndAlts+ | not (null rem_guarded)+ = Just $ Case scrut (CaseAlternative alt_binder rem_guarded : rem_alts)+ | not (null rem_alts)+ = Just $ Case scrut rem_alts+ | otherwise+ = Nothing++ scrut_nullbinder :: [Binder]+ scrut_nullbinder = replicate (length scrut) NullBinder++ -- case expressions with a single alternative which have+ -- a NullBinder occur frequently after desugaring+ -- complex guards. This function removes these superfluous+ -- cases.+ optimize :: Expr -> Expr+ optimize (Case _ [CaseAlternative vb [MkUnguarded v]])+ | all isNullBinder vb = v+ where+ isNullBinder NullBinder = True+ isNullBinder (PositionedBinder _ _ b) = isNullBinder b+ isNullBinder (TypedBinder _ b) = isNullBinder b+ isNullBinder _ = False+ optimize e = e+ in do+ alts' <- desugarAlternatives alternatives+ return $ optimize (Case scrut alts')++desugarGuardedExprs ss (TypedValue inferred e ty) =+ TypedValue inferred <$> desugarGuardedExprs ss e <*> pure ty++desugarGuardedExprs _ (PositionedValue ss comms e) =+ PositionedValue ss comms <$> desugarGuardedExprs ss e++desugarGuardedExprs _ v = pure v++-- |+-- Validates that case head and binder lengths match.+--+validateCases :: forall m. (MonadSupply m, MonadError MultipleErrors m) => [Declaration] -> m [Declaration]+validateCases = flip parU f+ where+ (f, _, _) = everywhereOnValuesM return validate return++ validate :: Expr -> m Expr+ validate c@(Case vs alts) = do+ let l = length vs+ alts' = filter ((l /=) . length . caseAlternativeBinders) alts+ unless (null alts') $+ throwError . MultipleErrors $ fmap (altError l) (caseAlternativeBinders <$> alts')+ return c+ validate other = return other++ altError :: Int -> [Binder] -> ErrorMessage+ altError l bs = withPosition pos $ ErrorMessage [] $ CaseBinderLengthDiffers l bs+ where+ pos = foldl1' widenSpan (mapMaybe positionedBinder bs)++ widenSpan (SourceSpan n start end) (SourceSpan _ start' end') =+ SourceSpan n (min start start') (max end end')++ positionedBinder (PositionedBinder p _ _) = Just p+ positionedBinder _ = Nothing++desugarAbs :: forall m. (MonadSupply m, MonadError MultipleErrors m) => [Declaration] -> m [Declaration] desugarAbs = flip parU f where (f, _, _) = everywhereOnValuesM return replace return - replace :: (Functor m, Applicative m, MonadSupply m, MonadError MultipleErrors m) => Expr -> m Expr- replace (Abs (Right binder) val) = do- ident <- Ident <$> freshName- return $ Abs (Left ident) $ Case [Var (Qualified Nothing ident)] [CaseAlternative [binder] (Right val)]+ replace :: Expr -> m Expr+ replace (Abs (stripPositioned -> (VarBinder ss i)) val) =+ pure (Abs (VarBinder ss i) val)+ replace (Abs binder val) = do+ ident <- freshIdent'+ return $ Abs (VarBinder nullSourceSpan ident) $ Case [Var nullSourceSpan (Qualified ByNullSourcePos ident)] [CaseAlternative [binder] [MkUnguarded val]] replace other = return other +stripPositioned :: Binder -> Binder+stripPositioned (PositionedBinder _ _ binder) = stripPositioned binder+stripPositioned binder = binder+ -- | -- Replace all top-level binders with case expressions. ---desugarCases :: (Functor m, Applicative m, MonadSupply m, MonadError MultipleErrors m) => [Declaration] -> m [Declaration]+desugarCases :: forall m. (MonadSupply m, MonadError MultipleErrors m) => [Declaration] -> m [Declaration] desugarCases = desugarRest <=< fmap join . flip parU toDecls . groupBy inSameGroup where- desugarRest :: (Functor m, Applicative m, MonadSupply m, MonadError MultipleErrors m) => [Declaration] -> m [Declaration]- desugarRest (TypeInstanceDeclaration name constraints className tys ds : rest) =- (:) <$> (TypeInstanceDeclaration name constraints className tys <$> desugarCases ds) <*> desugarRest rest- desugarRest (ValueDeclaration name nameKind bs result : rest) =+ desugarRest :: [Declaration] -> m [Declaration]+ desugarRest (TypeInstanceDeclaration sa na cd idx name constraints className tys ds : rest) =+ (:) <$> (TypeInstanceDeclaration sa na cd idx name constraints className tys <$> traverseTypeInstanceBody desugarCases ds) <*> desugarRest rest+ desugarRest (ValueDecl sa name nameKind bs result : rest) = let (_, f, _) = everywhereOnValuesTopDownM return go return- f' (Left gs) = Left <$> mapM (pairM return f) gs- f' (Right v) = Right <$> f v- in (:) <$> (ValueDeclaration name nameKind bs <$> f' result) <*> desugarRest rest+ f' = mapM (\(GuardedExpr gs e) -> GuardedExpr gs <$> f e)+ in (:) <$> (ValueDecl sa name nameKind bs <$> f' result) <*> desugarRest rest where- go (Let ds val') = Let <$> desugarCases ds <*> pure val'+ go (Let w ds val') = Let w <$> desugarCases ds <*> pure val' go other = return other- desugarRest (PositionedDeclaration pos com d : ds) = do- (d' : ds') <- desugarRest (d : ds)- return (PositionedDeclaration pos com d' : ds') desugarRest (d : ds) = (:) d <$> desugarRest ds desugarRest [] = pure [] inSameGroup :: Declaration -> Declaration -> Bool-inSameGroup (ValueDeclaration ident1 _ _ _) (ValueDeclaration ident2 _ _ _) = ident1 == ident2-inSameGroup (PositionedDeclaration _ _ d1) d2 = inSameGroup d1 d2-inSameGroup d1 (PositionedDeclaration _ _ d2) = inSameGroup d1 d2+inSameGroup (ValueDeclaration vd1) (ValueDeclaration vd2) = valdeclIdent vd1 == valdeclIdent vd2 inSameGroup _ _ = False -toDecls :: (Functor m, Applicative m, MonadSupply m, MonadError MultipleErrors m) => [Declaration] -> m [Declaration]-toDecls [ValueDeclaration ident nameKind bs (Right val)] | all isVarBinder bs = do- let args = map (\(VarBinder arg) -> arg) bs- body = foldr (Abs . Left) val args- guardWith (errorMessage (OverlappingArgNames (Just ident))) $ length (nub args) == length args- return [ValueDeclaration ident nameKind [] (Right body)]-toDecls ds@(ValueDeclaration ident _ bs result : _) = do+toDecls :: forall m. (MonadSupply m, MonadError MultipleErrors m) => [Declaration] -> m [Declaration]+toDecls [ValueDecl sa@(ss, _) ident nameKind bs [MkUnguarded val]] | all isIrrefutable bs = do+ args <- mapM fromVarBinder bs+ let body = foldr (Abs . VarBinder ss) val args+ guardWith (errorMessage' ss (OverlappingArgNames (Just ident))) $ length (ordNub args) == length args+ return [ValueDecl sa ident nameKind [] [MkUnguarded body]]+ where+ fromVarBinder :: Binder -> m Ident+ fromVarBinder NullBinder = freshIdent'+ fromVarBinder (VarBinder _ name) = return name+ fromVarBinder (PositionedBinder _ _ b) = fromVarBinder b+ fromVarBinder (TypedBinder _ b) = fromVarBinder b+ fromVarBinder _ = internalError "fromVarBinder: Invalid argument"+toDecls ds@(ValueDecl (ss, _) ident _ bs (result : _) : _) = do let tuples = map toTuple ds- unless (all ((== length bs) . length . fst) tuples) $- throwError . errorMessage $ ArgListLengthsDiffer ident- unless (not (null bs) || isLeft result) $- throwError . errorMessage $ DuplicateValueDeclaration ident- caseDecl <- makeCaseDeclaration ident tuples++ isGuarded (MkUnguarded _) = False+ isGuarded _ = True++ unless (all ((== length bs) . length . fst) tuples) .+ throwError . errorMessage' ss $ ArgListLengthsDiffer ident+ unless (not (null bs) || isGuarded result) .+ throwError . errorMessage' ss $ DuplicateValueDeclaration ident+ caseDecl <- makeCaseDeclaration ss ident tuples return [caseDecl]-toDecls (PositionedDeclaration pos com d : ds) = do- (d' : ds') <- rethrowWithPosition pos $ toDecls (d : ds)- return (PositionedDeclaration pos com d' : ds') toDecls ds = return ds -isVarBinder :: Binder -> Bool-isVarBinder (VarBinder _) = True-isVarBinder _ = False--toTuple :: Declaration -> ([Binder], Either [(Guard, Expr)] Expr)-toTuple (ValueDeclaration _ _ bs result) = (bs, result)-toTuple (PositionedDeclaration _ _ d) = toTuple d-toTuple _ = error "Not a value declaration"+toTuple :: Declaration -> ([Binder], [GuardedExpr])+toTuple (ValueDecl _ _ _ bs result) = (bs, result)+toTuple _ = internalError "Not a value declaration" -makeCaseDeclaration :: (Functor m, Applicative m, MonadSupply m, MonadError MultipleErrors m) => Ident -> [([Binder], Either [(Guard, Expr)] Expr)] -> m Declaration-makeCaseDeclaration ident alternatives = do+makeCaseDeclaration :: forall m. (MonadSupply m) => SourceSpan -> Ident -> [([Binder], [GuardedExpr])] -> m Declaration+makeCaseDeclaration ss ident alternatives = do let namedArgs = map findName . fst <$> alternatives- argNames = map join $ foldl1 resolveNames namedArgs- args <- if allUnique (catMaybes argNames) - then mapM argName argNames - else replicateM (length argNames) (Ident <$> freshName)- let vars = map (Var . Qualified Nothing) args+ argNames = foldl1 resolveNames namedArgs+ args <- if allUnique (catMaybes argNames)+ then mapM argName argNames+ else replicateM (length argNames) ((nullSourceSpan, ) <$> freshIdent')+ let vars = map (Var ss . Qualified ByNullSourcePos . snd) args binders = [ CaseAlternative bs result | (bs, result) <- alternatives ]- value = foldr (Abs . Left) (Case vars binders) args- return $ ValueDeclaration ident Value [] (Right value)+ let value = foldr (Abs . uncurry VarBinder) (Case vars binders) args++ return $ ValueDecl (ss, []) ident Public [] [MkUnguarded value] where- findName :: Binder -> Maybe (Maybe Ident)- findName NullBinder = Just Nothing- findName (VarBinder name) = Just (Just name)+ -- We will construct a table of potential names.+ -- VarBinders will become Just _ which is a potential name.+ -- Everything else becomes Nothing, which indicates that we+ -- have to generate a name.+ findName :: Binder -> Maybe (SourceSpan, Ident)+ findName (VarBinder ss' name) = Just (ss', name) findName (PositionedBinder _ _ binder) = findName binder findName _ = Nothing - allUnique :: (Eq a) => [a] -> Bool- allUnique xs = length xs == length (nub xs)+ -- We still have to make sure the generated names are unique, or else+ -- we will end up constructing an invalid function.+ allUnique :: (Ord a) => [a] -> Bool+ allUnique xs = length xs == length (ordNub xs) - argName :: (MonadSupply m) => Maybe Ident -> m Ident- argName (Just name) = return name- argName _ = do- name <- freshName- return (Ident name)+ argName :: Maybe (SourceSpan, Ident) -> m (SourceSpan, Ident)+ argName (Just (ss', name)) = return (ss', name)+ argName _ = (nullSourceSpan, ) <$> freshIdent' - resolveNames :: [Maybe (Maybe Ident)] -> - [Maybe (Maybe Ident)] -> - [Maybe (Maybe Ident)]+ -- Combine two lists of potential names from two case alternatives+ -- by zipping corresponding columns.+ resolveNames :: [Maybe (SourceSpan, Ident)] -> [Maybe (SourceSpan, Ident)] -> [Maybe (SourceSpan, Ident)] resolveNames = zipWith resolveName - resolveName :: Maybe (Maybe Ident) -> - Maybe (Maybe Ident) -> - Maybe (Maybe Ident)- resolveName (Just (Just a)) (Just (Just b))- | a == b = Just (Just a)+ -- Resolve a pair of names. VarBinder beats NullBinder, and everything+ -- else results in Nothing.+ resolveName :: Maybe (SourceSpan, Ident) -> Maybe (SourceSpan, Ident) -> Maybe (SourceSpan, Ident)+ resolveName (Just a) (Just b)+ | a == b = Just a | otherwise = Nothing- resolveName (Just Nothing) a = a- resolveName a (Just Nothing) = a resolveName _ _ = Nothing
src/Language/PureScript/Sugar/DoNotation.hs view
@@ -1,77 +1,83 @@------------------------------------------------------------------------------------ Module : Language.PureScript.Sugar.DoNotation--- Copyright : (c) Phil Freeman 2013--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ |--- This module implements the desugaring pass which replaces do-notation statements with--- appropriate calls to (>>=) from the Prelude.Monad type class.-----------------------------------------------------------------------------------{-# LANGUAGE FlexibleContexts #-}-{-# LANGUAGE ScopedTypeVariables #-}--module Language.PureScript.Sugar.DoNotation (- desugarDoModule-) where+-- | This module implements the desugaring pass which replaces do-notation statements with+-- appropriate calls to bind. -import Language.PureScript.Names-import Language.PureScript.AST-import Language.PureScript.Errors+module Language.PureScript.Sugar.DoNotation (desugarDoModule) where -import qualified Language.PureScript.Constants as C+import Prelude -import Control.Applicative-import Control.Monad.Error.Class-import Control.Monad.Supply.Class+import Control.Applicative ((<|>))+import Control.Monad.Error.Class (MonadError(..))+import Control.Monad.Supply.Class (MonadSupply)+import Data.Maybe (fromMaybe)+import Data.Monoid (First(..))+import Language.PureScript.AST (Binder(..), CaseAlternative(..), Declaration, DoNotationElement(..), Expr(..), pattern MkUnguarded, Module(..), SourceSpan, pattern ValueDecl, WhereProvenance(..), binderNames, declSourceSpan, everywhereOnValuesM)+import Language.PureScript.Crash (internalError)+import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage(..), errorMessage, errorMessage', parU, rethrowWithPosition)+import Language.PureScript.Names (pattern ByNullSourcePos, Ident(..), ModuleName, Qualified(..), byMaybeModuleName, freshIdent')+import Language.PureScript.Constants.Libs qualified as C --- |--- Replace all @DoNotationBind@ and @DoNotationValue@ constructors with applications of the Prelude.(>>=) function,--- and all @DoNotationLet@ constructors with let expressions.----desugarDoModule :: forall m. (Applicative m, MonadSupply m, MonadError MultipleErrors m) => Module -> m Module-desugarDoModule (Module coms mn ds exts) = Module coms mn <$> parU ds desugarDo <*> pure exts+-- | Replace all @DoNotationBind@ and @DoNotationValue@ constructors with+-- applications of the bind function in scope, and all @DoNotationLet@+-- constructors with let expressions.+desugarDoModule :: forall m. (MonadSupply m, MonadError MultipleErrors m) => Module -> m Module+desugarDoModule (Module ss coms mn ds exts) = Module ss coms mn <$> parU ds desugarDo <*> pure exts -desugarDo :: forall m. (Applicative m, MonadSupply m, MonadError MultipleErrors m) => Declaration -> m Declaration-desugarDo (PositionedDeclaration pos com d) = PositionedDeclaration pos com <$> (rethrowWithPosition pos $ desugarDo d)+-- | Desugar a single do statement+desugarDo :: forall m. (MonadSupply m, MonadError MultipleErrors m) => Declaration -> m Declaration desugarDo d =- let (f, _, _) = everywhereOnValuesM return replace return- in f d+ let ss = declSourceSpan d+ (f, _, _) = everywhereOnValuesM return (replace ss) return+ in rethrowWithPosition ss $ f d where- prelude :: ModuleName- prelude = ModuleName [ProperName C.prelude]+ bind :: SourceSpan -> Maybe ModuleName -> Expr+ bind ss m = Var ss (Qualified (byMaybeModuleName m) (Ident C.S_bind)) - bind :: Expr- bind = Var (Qualified (Just prelude) (Op (C.>>=)))+ discard :: SourceSpan -> Maybe ModuleName -> Expr+ discard ss m = Var ss (Qualified (byMaybeModuleName m) (Ident C.S_discard)) - replace :: Expr -> m Expr- replace (Do els) = go els- replace (PositionedValue pos com v) = PositionedValue pos com <$> rethrowWithPosition pos (replace v)- replace other = return other+ replace :: SourceSpan -> Expr -> m Expr+ replace pos (Do m els) = go pos m els+ replace _ (PositionedValue pos com v) = PositionedValue pos com <$> rethrowWithPosition pos (replace pos v)+ replace _ other = return other - go :: [DoNotationElement] -> m Expr- go [] = error "The impossible happened in desugarDo"- go [DoNotationValue val] = return val- go (DoNotationValue val : rest) = do- rest' <- go rest- return $ App (App bind val) (Abs (Left (Ident C.__unused)) rest')- go [DoNotationBind _ _] = throwError . errorMessage $ InvalidDoBind- go (DoNotationBind NullBinder val : rest) = go (DoNotationValue val : rest)- go (DoNotationBind (VarBinder ident) val : rest) = do- rest' <- go rest- return $ App (App bind val) (Abs (Left ident) rest')- go (DoNotationBind binder val : rest) = do- rest' <- go rest- ident <- Ident <$> freshName- return $ App (App bind val) (Abs (Left ident) (Case [Var (Qualified Nothing ident)] [CaseAlternative [binder] (Right rest')]))- go [DoNotationLet _] = throwError . errorMessage $ InvalidDoLet- go (DoNotationLet ds : rest) = do- rest' <- go rest- return $ Let ds rest'- go (PositionedDoNotationElement pos com el : rest) = rethrowWithPosition pos $ PositionedValue pos com <$> go (el : rest)+ stripPositionedBinder :: Binder -> (Maybe SourceSpan, Binder)+ stripPositionedBinder (PositionedBinder ss _ b) =+ let (ss', b') = stripPositionedBinder b+ in (ss' <|> Just ss, b')+ stripPositionedBinder b =+ (Nothing, b)++ go :: SourceSpan -> Maybe ModuleName -> [DoNotationElement] -> m Expr+ go _ _ [] = internalError "The impossible happened in desugarDo"+ go _ _ [DoNotationValue val] = return val+ go pos m (DoNotationValue val : rest) = do+ rest' <- go pos m rest+ return $ App (App (discard pos m) val) (Abs (VarBinder pos UnusedIdent) rest')+ go _ _ [DoNotationBind _ _] = throwError . errorMessage $ InvalidDoBind+ go _ _ (DoNotationBind b _ : _) | First (Just ident) <- foldMap fromIdent (binderNames b) =+ throwError . errorMessage $ CannotUseBindWithDo (Ident ident)+ where+ fromIdent (Ident i) | i `elem` [ C.S_bind, C.S_discard ] = First (Just i)+ fromIdent _ = mempty+ go pos m (DoNotationBind binder val : rest) = do+ rest' <- go pos m rest+ let (mss, binder') = stripPositionedBinder binder+ let ss = fromMaybe pos mss+ case binder' of+ NullBinder ->+ return $ App (App (bind pos m) val) (Abs (VarBinder ss UnusedIdent) rest')+ VarBinder _ ident ->+ return $ App (App (bind pos m) val) (Abs (VarBinder ss ident) rest')+ _ -> do+ ident <- freshIdent'+ return $ App (App (bind pos m) val) (Abs (VarBinder pos ident) (Case [Var pos (Qualified ByNullSourcePos ident)] [CaseAlternative [binder] [MkUnguarded rest']]))+ go _ _ [DoNotationLet _] = throwError . errorMessage $ InvalidDoLet+ go pos m (DoNotationLet ds : rest) = do+ let checkBind :: Declaration -> m ()+ checkBind (ValueDecl (ss, _) i@(Ident name) _ _ _)+ | name `elem` [ C.S_bind, C.S_discard ] = throwError . errorMessage' ss $ CannotUseBindWithDo i+ checkBind _ = pure ()+ mapM_ checkBind ds+ rest' <- go pos m rest+ return $ Let FromLet ds rest'+ go _ m (PositionedDoNotationElement pos com el : rest) = rethrowWithPosition pos $ PositionedValue pos com <$> go pos m (el : rest)
+ src/Language/PureScript/Sugar/LetPattern.hs view
@@ -0,0 +1,54 @@+-- |+-- This module implements the desugaring pass which replaces patterns in let-in+-- expressions with appropriate case expressions.+--+module Language.PureScript.Sugar.LetPattern (desugarLetPatternModule) where++import Prelude++import Data.List (groupBy)+import Data.Function (on)++import Language.PureScript.AST (Binder, CaseAlternative(..), Declaration(..), Expr(..), pattern MkUnguarded, Module(..), SourceAnn, WhereProvenance, everywhereOnValues)+import Language.PureScript.Crash (internalError)++-- | Replace every @BoundValueDeclaration@ in @Let@ expressions with @Case@+-- expressions.+desugarLetPatternModule :: Module -> Module+desugarLetPatternModule (Module ss coms mn ds exts) = Module ss coms mn (map desugarLetPattern ds) exts++-- | Desugar a single let expression+desugarLetPattern :: Declaration -> Declaration+desugarLetPattern decl =+ let (f, _, _) = everywhereOnValues id replace id+ in f decl+ where+ replace :: Expr -> Expr+ replace (Let w ds e) = go w (partitionDecls ds) e+ replace other = other++ go :: WhereProvenance+ -- Metadata about whether the let-in was a where clause+ -> [Either [Declaration] (SourceAnn, Binder, Expr)]+ -- Declarations to desugar+ -> Expr+ -- The original let-in result expression+ -> Expr+ go _ [] e = e+ go w (Right ((pos, com), binder, boundE) : ds) e =+ PositionedValue pos com $ Case [boundE] [CaseAlternative [binder] [MkUnguarded $ go w ds e]]+ go w (Left ds:dss) e = Let w ds (go w dss e)++partitionDecls :: [Declaration] -> [Either [Declaration] (SourceAnn, Binder, Expr)]+partitionDecls = concatMap f . groupBy ((==) `on` isBoundValueDeclaration)+ where+ f ds@(d:_)+ | isBoundValueDeclaration d = map (Right . g) ds+ f ds = [Left ds]++ g (BoundValueDeclaration sa binder expr) = (sa, binder, expr)+ g _ = internalError "partitionDecls: the impossible happened."++isBoundValueDeclaration :: Declaration -> Bool+isBoundValueDeclaration BoundValueDeclaration{} = True+isBoundValueDeclaration _ = False
src/Language/PureScript/Sugar/Names.hs view
@@ -1,541 +1,443 @@------------------------------------------------------------------------------------ Module : Language.PureScript.Sugar.Names--- Copyright : (c) 2013-14 Phil Freeman, (c) 2014 Gary Burgess, and other contributors--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>, Gary Burgess <gary.burgess@gmail.com>--- Stability : experimental--- Portability :------ |-----------------------------------------------------------------------------------{-# LANGUAGE FlexibleContexts #-}-{-# LANGUAGE ScopedTypeVariables #-}--module Language.PureScript.Sugar.Names (- desugarImports-) where+module Language.PureScript.Sugar.Names+ ( desugarImports+ , Env+ , externsEnv+ , primEnv+ , ImportRecord(..)+ , ImportProvenance(..)+ , Imports(..)+ , Exports(..)+ ) where -import Data.List (nub)-import Data.Maybe (fromMaybe, isJust, mapMaybe)+import Prelude+import Protolude (sortOn, swap, foldl') -import Control.Applicative (Applicative(..), (<$>), (<*>))-import Control.Monad.Except+import Control.Arrow (first, second, (&&&))+import Control.Monad (foldM, when, (>=>))+import Control.Monad.Error.Class (MonadError(..))+import Control.Monad.State.Lazy (MonadState, StateT(..), gets, modify)+import Control.Monad.Writer (MonadWriter(..)) -import qualified Data.Map as M+import Data.List.NonEmpty qualified as NEL+import Data.Maybe (fromMaybe, mapMaybe)+import Data.Map qualified as M+import Data.Set qualified as S import Language.PureScript.AST-import Language.PureScript.Names-import Language.PureScript.Types-import Language.PureScript.Environment-import Language.PureScript.Errors-import Language.PureScript.Traversals--import qualified Language.PureScript.Constants as C+import Language.PureScript.Crash (internalError)+import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage(..), addHint, errorMessage, errorMessage'', nonEmpty, parU, warnAndRethrow, warnAndRethrowWithPosition)+import Language.PureScript.Externs (ExternsDeclaration(..), ExternsFile(..), ExternsImport(..))+import Language.PureScript.Linter.Imports (Name(..), UsedImports)+import Language.PureScript.Names (pattern ByNullSourcePos, Ident, OpName, OpNameType(..), ProperName, ProperNameType(..), Qualified(..), QualifiedBy(..))+import Language.PureScript.Sugar.Names.Env (Env, Exports(..), ImportProvenance(..), ImportRecord(..), Imports(..), checkImportConflicts, nullImports, primEnv)+import Language.PureScript.Sugar.Names.Exports (findExportable, resolveExports)+import Language.PureScript.Sugar.Names.Imports (resolveImports, resolveModuleImport)+import Language.PureScript.Traversals (defS, sndM)+import Language.PureScript.Types (Constraint(..), SourceConstraint, SourceType, Type(..), everywhereOnTypesM) -- |--- The global export environment - every declaration exported from every module.+-- Replaces all local names with qualified names. ---type ExportEnvironment = M.Map ModuleName Exports+desugarImports+ :: forall m+ . (MonadError MultipleErrors m, MonadWriter MultipleErrors m, MonadState (Env, UsedImports) m)+ => Module+ -> m Module+desugarImports = updateEnv >=> renameInModule'+ where+ updateEnv :: Module -> m Module+ updateEnv m@(Module ss _ mn _ refs) = do+ members <- findExportable m+ env' <- gets $ M.insert mn (ss, nullImports, members) . fst+ (m', imps) <- resolveImports env' m+ exps <- maybe (return members) (resolveExports env' ss mn imps members) refs+ modify . first $ M.insert mn (ss, imps, exps)+ return m' --- |--- The exported declarations from a module.----data Exports = Exports- {- -- |- -- The types exported from each module- --- exportedTypes :: [(ProperName, [ProperName])]- -- |- -- The classes exported from each module- --- , exportedTypeClasses :: [ProperName]- -- |- -- The values exported from each module- --- , exportedValues :: [Ident]- } deriving (Show)+ renameInModule' :: Module -> m Module+ renameInModule' m@(Module _ _ mn _ _) =+ warnAndRethrow (addHint (ErrorInModule mn)) $ do+ env <- gets fst+ let (_, imps, exps) = fromMaybe (internalError "Module is missing in renameInModule'") $ M.lookup mn env+ (m', used) <- flip runStateT M.empty $ renameInModule imps m+ modify . second $ M.unionWith (<>) used+ return $ elaborateExports exps m' --- |--- An imported environment for a particular module. This also contains the module's own members.----data ImportEnvironment = ImportEnvironment- {- -- |- -- Local names for types within a module mapped to to their qualified names- --- importedTypes :: M.Map (Qualified ProperName) (Qualified ProperName)- -- |- -- Local names for data constructors within a module mapped to to their qualified names- --- , importedDataConstructors :: M.Map (Qualified ProperName) (Qualified ProperName)- -- |- -- Local names for classes within a module mapped to to their qualified names- --- , importedTypeClasses :: M.Map (Qualified ProperName) (Qualified ProperName)- -- |- -- Local names for values within a module mapped to to their qualified names- --- , importedValues :: M.Map (Qualified Ident) (Qualified Ident)- } deriving (Show)+-- | Create an environment from a collection of externs files+externsEnv+ :: forall m+ . (MonadError MultipleErrors m, MonadWriter MultipleErrors m)+ => Env+ -> ExternsFile+ -> m Env+externsEnv env ExternsFile{..} = do+ let members = Exports{..}+ env' = M.insert efModuleName (efSourceSpan, nullImports, members) env+ fromEFImport (ExternsImport mn mt qmn) = (mn, [(efSourceSpan, Just mt, qmn)])+ imps <- foldM (resolveModuleImport env') nullImports (map fromEFImport efImports)+ exps <- resolveExports env' efSourceSpan efModuleName imps members efExports+ return $ M.insert efModuleName (efSourceSpan, imps, exps) env+ where --- |--- Updates the exports for a module from the global environment. If the module was not previously--- present in the global environment, it is created.----updateExportedModule :: (Applicative m, MonadError MultipleErrors m) => ExportEnvironment -> ModuleName -> (Exports -> m Exports) -> m ExportEnvironment-updateExportedModule env mn update = do- let exports = fromMaybe (error "Module was undefined in updateExportedModule") $ mn `M.lookup` env- exports' <- update exports- return $ M.insert mn exports' env+ -- An ExportSource for declarations local to the module which the given+ -- ExternsFile corresponds to.+ localExportSource =+ ExportSource { exportSourceDefinedIn = efModuleName+ , exportSourceImportedFrom = Nothing+ } --- |--- Adds an empty module to an ExportEnvironment.----addEmptyModule :: (Applicative m, MonadError MultipleErrors m) => ExportEnvironment -> ModuleName -> m ExportEnvironment-addEmptyModule env name =- if name `M.member` env- then throwError . errorMessage $ RedefinedModule name- else return $ M.insert name (Exports [] [] []) env+ exportedTypes :: M.Map (ProperName 'TypeName) ([ProperName 'ConstructorName], ExportSource)+ exportedTypes = M.fromList $ mapMaybe toExportedType efExports+ where+ toExportedType (TypeRef _ tyCon dctors) = Just (tyCon, (fromMaybe (mapMaybe forTyCon efDeclarations) dctors, localExportSource))+ where+ forTyCon :: ExternsDeclaration -> Maybe (ProperName 'ConstructorName)+ forTyCon (EDDataConstructor pn _ tNm _ _) | tNm == tyCon = Just pn+ forTyCon _ = Nothing+ toExportedType _ = Nothing --- |--- Adds a type belonging to a module to the export environment.----addType :: (Applicative m, MonadError MultipleErrors m) => ExportEnvironment -> ModuleName -> ProperName -> [ProperName] -> m ExportEnvironment-addType env mn name dctors = updateExportedModule env mn $ \m -> do- let exTypes = exportedTypes m- let exDctors = snd `concatMap` exTypes- let exClasses = exportedTypeClasses m- when (any ((== name) . fst) exTypes) $ throwConflictError ConflictingTypeDecls name- when (name `elem` exClasses) $ throwConflictError TypeConflictsWithClass name- forM_ dctors $ \dctor -> do- when (dctor `elem` exDctors) $ throwConflictError ConflictingCtorDecls dctor- when (dctor `elem` exClasses) $ throwConflictError CtorConflictsWithClass dctor- return $ m { exportedTypes = (name, dctors) : exTypes }+ exportedTypeOps :: M.Map (OpName 'TypeOpName) ExportSource+ exportedTypeOps = exportedRefs getTypeOpRef --- |--- Adds a class to the export environment.----addTypeClass :: (Applicative m, MonadError MultipleErrors m) => ExportEnvironment -> ModuleName -> ProperName -> m ExportEnvironment-addTypeClass env mn name = updateExportedModule env mn $ \m -> do- let exTypes = exportedTypes m- let exDctors = snd `concatMap` exTypes- when (any ((== name) . fst) exTypes) $ throwConflictError ClassConflictsWithType name- when (name `elem` exDctors) $ throwConflictError ClassConflictsWithCtor name- classes <- addExport DuplicateClassExport (exportedTypeClasses m) name- return $ m { exportedTypeClasses = classes }+ exportedTypeClasses :: M.Map (ProperName 'ClassName) ExportSource+ exportedTypeClasses = exportedRefs getTypeClassRef --- |--- Adds a class to the export environment.----addValue :: (Applicative m, MonadError MultipleErrors m) => ExportEnvironment -> ModuleName -> Ident -> m ExportEnvironment-addValue env mn name = updateExportedModule env mn $ \m -> do- values <- addExport DuplicateValueExport (exportedValues m) name- return $ m { exportedValues = values }+ exportedValues :: M.Map Ident ExportSource+ exportedValues = exportedRefs getValueRef --- |--- Adds an entry to a list of exports unless it is already present, in which case an error is--- returned.----addExport :: (Applicative m, MonadError MultipleErrors m, Eq a, Show a) => (a -> ErrorMessage) -> [a] -> a -> m [a]-addExport what exports name =- if name `elem` exports- then throwConflictError what name- else return $ name : exports+ exportedValueOps :: M.Map (OpName 'ValueOpName) ExportSource+ exportedValueOps = exportedRefs getValueOpRef + exportedRefs :: Ord a => (DeclarationRef -> Maybe a) -> M.Map a ExportSource+ exportedRefs f =+ M.fromList $ (, localExportSource) <$> mapMaybe f efExports+ -- |--- Replaces all local names with qualified names within a set of modules.+-- Make all exports for a module explicit. This may still affect modules that+-- have an exports list, as it will also make all data constructor exports+-- explicit. ---desugarImports :: forall m. (Applicative m, MonadError MultipleErrors m) => [Module] -> m [Module]-desugarImports modules = do- unfilteredExports <- findExports modules- exports <- foldM filterModuleExports unfilteredExports modules- mapM (renameInModule' unfilteredExports exports) modules+-- The exports will appear in the same order as they do in the existing exports+-- list, or if there is no export list, declarations are order based on their+-- order of appearance in the module.+--+elaborateExports :: Exports -> Module -> Module+elaborateExports exps (Module ss coms mn decls refs) =+ Module ss coms mn decls $ Just $ reorderExports decls refs+ $ elaboratedTypeRefs+ ++ go (TypeOpRef ss) exportedTypeOps+ ++ go (TypeClassRef ss) exportedTypeClasses+ ++ go (ValueRef ss) exportedValues+ ++ go (ValueOpRef ss) exportedValueOps+ ++ maybe [] (filter isModuleRef) refs where - -- Filters the exports for a module in the global exports environment so that only explicitly- -- exported members remain. If the module does not explicitly export anything, everything is- -- exported.- filterModuleExports :: ExportEnvironment -> Module -> m ExportEnvironment- filterModuleExports env (Module _ mn _ (Just exps)) = filterExports mn exps env- filterModuleExports env _ = return env-- -- Rename and check all the names within a module. We tweak the global exports environment so- -- the module has access to an unfiltered list of its own members.- renameInModule' :: ExportEnvironment -> ExportEnvironment -> Module -> m Module- renameInModule' unfilteredExports exports m@(Module _ mn _ _) =- rethrow (onErrorMessages (ErrorInModule mn)) $ do- let env = M.update (\_ -> M.lookup mn unfilteredExports) mn exports- let exps = fromMaybe (error "Module is missing in renameInModule'") $ M.lookup mn exports- imports <- resolveImports env m- elaborateImports <$> renameInModule imports env (elaborateExports exps m)+ elaboratedTypeRefs :: [DeclarationRef]+ elaboratedTypeRefs =+ flip map (M.toList (exportedTypes exps)) $ \(tctor, (dctors, src)) ->+ let ref = TypeRef ss tctor (Just dctors)+ in if mn == exportSourceDefinedIn src then ref else ReExportRef ss src ref --- |--- Make all exports for a module explicit. This may still effect modules that have an exports list,--- as it will also make all data constructor exports explicit.----elaborateExports :: Exports -> Module -> Module-elaborateExports exps (Module coms mn decls _) = Module coms mn decls (Just $- map (\(ctor, dctors) -> TypeRef ctor (Just dctors)) (exportedTypes exps) ++- map TypeClassRef (exportedTypeClasses exps) ++- map ValueRef (exportedValues exps))+ go :: (a -> DeclarationRef) -> (Exports -> M.Map a ExportSource) -> [DeclarationRef]+ go toRef select =+ flip map (M.toList (select exps)) $ \(export, src) ->+ if mn == exportSourceDefinedIn src then toRef export else ReExportRef ss src (toRef export) -- |--- Add `import X ()` for any modules where there are only fully qualified references to members.--- This ensures transitive instances are included when using a member from a module.----elaborateImports :: Module -> Module-elaborateImports (Module coms mn decls exps) = Module coms mn decls' exps+-- Given a list of declarations, an original exports list, and an elaborated+-- exports list, reorder the elaborated list so that it matches the original+-- order. If there is no original exports list, reorder declarations based on+-- their order in the source file.+reorderExports :: [Declaration] -> Maybe [DeclarationRef] -> [DeclarationRef] -> [DeclarationRef]+reorderExports decls originalRefs =+ sortOn originalIndex where- decls' :: [Declaration]- decls' =- let (f, _, _, _, _) = everythingOnValues (++) (const []) fqValues (const []) (const []) (const [])- in mkImport `map` nub (f `concatMap` decls) ++ decls- fqValues :: Expr -> [ModuleName]- fqValues (Var (Qualified (Just mn') _)) = [mn']- fqValues _ = []- mkImport :: ModuleName -> Declaration- mkImport mn' = ImportDeclaration mn' (Explicit []) Nothing+ names =+ maybe (mapMaybe declName decls) (map declRefName) originalRefs+ namesMap =+ M.fromList $ zip names [(0::Int)..]+ originalIndex ref =+ M.lookup (declRefName ref) namesMap -- | -- Replaces all local names with qualified names within a module and checks that all existing -- qualified names are valid. ---renameInModule :: forall m. (Applicative m, MonadError MultipleErrors m) => ImportEnvironment -> ExportEnvironment -> Module -> m Module-renameInModule imports exports (Module coms mn decls exps) =- Module coms mn <$> parU decls go <*> pure exps+renameInModule+ :: forall m+ . (MonadError MultipleErrors m, MonadWriter MultipleErrors m, MonadState UsedImports m)+ => Imports+ -> Module+ -> m Module+renameInModule imports (Module modSS coms mn decls exps) =+ Module modSS coms mn <$> parU decls go <*> pure exps where- (go, _, _, _, _) = everywhereWithContextOnValuesM (Nothing, []) updateDecl updateValue updateBinder updateCase defS - updateDecl :: (Maybe SourceSpan, [Ident]) -> Declaration -> m ((Maybe SourceSpan, [Ident]), Declaration)- updateDecl (_, bound) d@(PositionedDeclaration pos _ _) = return ((Just pos, bound), d)- updateDecl (pos, bound) (DataDeclaration dtype name args dctors) =- (,) (pos, bound) <$> (DataDeclaration dtype name args <$> mapM (sndM (mapM (updateTypesEverywhere pos))) dctors)- updateDecl (pos, bound) (TypeSynonymDeclaration name ps ty) =- (,) (pos, bound) <$> (TypeSynonymDeclaration name ps <$> updateTypesEverywhere pos ty)- updateDecl (pos, bound) (TypeClassDeclaration className args implies ds) =- (,) (pos, bound) <$> (TypeClassDeclaration className args <$> updateConstraints pos implies <*> pure ds)- updateDecl (pos, bound) (TypeInstanceDeclaration name cs cn ts ds) =- (,) (pos, bound) <$> (TypeInstanceDeclaration name <$> updateConstraints pos cs <*> updateClassName cn pos <*> mapM (updateTypesEverywhere pos) ts <*> pure ds)- updateDecl (pos, bound) (ExternInstanceDeclaration name cs cn ts) =- (,) (pos, bound) <$> (ExternInstanceDeclaration name <$> updateConstraints pos cs <*> updateClassName cn Nothing <*> mapM (updateTypesEverywhere pos) ts)- updateDecl (pos, bound) (TypeDeclaration name ty) =- (,) (pos, bound) <$> (TypeDeclaration name <$> updateTypesEverywhere pos ty)- updateDecl (pos, bound) (ExternDeclaration fit name js ty) =- (,) (pos, name : bound) <$> (ExternDeclaration fit name js <$> updateTypesEverywhere pos ty)- updateDecl s d = return (s, d)-- updateValue :: (Maybe SourceSpan, [Ident]) -> Expr -> m ((Maybe SourceSpan, [Ident]), Expr)- updateValue (_, bound) v@(PositionedValue pos' _ _) = return ((Just pos', bound), v)- updateValue (pos, bound) (Abs (Left arg) val') = return ((pos, arg : bound), Abs (Left arg) val')- updateValue (pos, bound) (Let ds val') = do- let args = mapMaybe letBoundVariable ds- unless (length (nub args) == length args) $- maybe id rethrowWithPosition pos $- throwError . errorMessage $ OverlappingNamesInLet- return ((pos, args ++ bound), Let ds val')- where- updateValue (pos, bound) (Var name'@(Qualified Nothing ident)) | ident `notElem` bound =- (,) (pos, bound) <$> (Var <$> updateValueName name' pos)- updateValue (pos, bound) (Var name'@(Qualified (Just _) _)) =- (,) (pos, bound) <$> (Var <$> updateValueName name' pos)- updateValue s@(pos, _) (Constructor name) = (,) s <$> (Constructor <$> updateDataConstructorName name pos)- updateValue s@(pos, _) (TypedValue check val ty) = (,) s <$> (TypedValue check val <$> updateTypesEverywhere pos ty)- updateValue s v = return (s, v)+ (go, _, _, _, _, _) =+ everywhereWithContextOnValuesM+ (modSS, M.empty)+ (\(_, bound) d -> (\(bound', d') -> ((declSourceSpan d', bound'), d')) <$> updateDecl bound d)+ updateValue+ updateBinder+ updateCase+ defS+ updateGuard - updateBinder :: (Maybe SourceSpan, [Ident]) -> Binder -> m ((Maybe SourceSpan, [Ident]), Binder)- updateBinder (_, bound) v@(PositionedBinder pos _ _) = return ((Just pos, bound), v)- updateBinder s@(pos, _) (ConstructorBinder name b) = (,) s <$> (ConstructorBinder <$> updateDataConstructorName name pos <*> pure b)- updateBinder s v = return (s, v)+ updateDecl+ :: M.Map Ident SourcePos+ -> Declaration+ -> m (M.Map Ident SourcePos, Declaration)+ updateDecl bound (DataDeclaration sa dtype name args dctors) =+ fmap (bound,) $+ DataDeclaration sa dtype name+ <$> updateTypeArguments args+ <*> traverse (traverseDataCtorFields (traverse (sndM updateTypesEverywhere))) dctors+ updateDecl bound (TypeSynonymDeclaration sa name ps ty) =+ fmap (bound,) $+ TypeSynonymDeclaration sa name+ <$> updateTypeArguments ps+ <*> updateTypesEverywhere ty+ updateDecl bound (TypeClassDeclaration sa className args implies deps ds) =+ fmap (bound,) $+ TypeClassDeclaration sa className+ <$> updateTypeArguments args+ <*> updateConstraints implies+ <*> pure deps+ <*> pure ds+ updateDecl bound (TypeInstanceDeclaration sa na@(ss, _) ch idx name cs cn ts ds) =+ fmap (bound,) $+ TypeInstanceDeclaration sa na ch idx name+ <$> updateConstraints cs+ <*> updateClassName cn ss+ <*> traverse updateTypesEverywhere ts+ <*> pure ds+ updateDecl bound (KindDeclaration sa kindFor name ty) =+ fmap (bound,) $+ KindDeclaration sa kindFor name+ <$> updateTypesEverywhere ty+ updateDecl bound (TypeDeclaration (TypeDeclarationData sa name ty)) =+ fmap (bound,) $+ TypeDeclaration . TypeDeclarationData sa name+ <$> updateTypesEverywhere ty+ updateDecl bound (ExternDeclaration sa name ty) =+ fmap (M.insert name (spanStart $ fst sa) bound,) $+ ExternDeclaration sa name+ <$> updateTypesEverywhere ty+ updateDecl bound (ExternDataDeclaration sa name ki) =+ fmap (bound,) $+ ExternDataDeclaration sa name+ <$> updateTypesEverywhere ki+ updateDecl bound (TypeFixityDeclaration sa@(ss, _) fixity alias op) =+ fmap (bound,) $+ TypeFixityDeclaration sa fixity+ <$> updateTypeName alias ss+ <*> pure op+ updateDecl bound (ValueFixityDeclaration sa@(ss, _) fixity (Qualified mn' (Left alias)) op) =+ fmap (bound,) $+ ValueFixityDeclaration sa fixity . fmap Left+ <$> updateValueName (Qualified mn' alias) ss+ <*> pure op+ updateDecl bound (ValueFixityDeclaration sa@(ss, _) fixity (Qualified mn' (Right alias)) op) =+ fmap (bound,) $+ ValueFixityDeclaration sa fixity . fmap Right+ <$> updateDataConstructorName (Qualified mn' alias) ss+ <*> pure op+ updateDecl b d =+ return (b, d) - updateCase :: (Maybe SourceSpan, [Ident]) -> CaseAlternative -> m ((Maybe SourceSpan, [Ident]), CaseAlternative)- updateCase (pos, bound) c@(CaseAlternative bs _) = return ((pos, concatMap binderNames bs ++ bound), c)+ updateValue+ :: (SourceSpan, M.Map Ident SourcePos)+ -> Expr+ -> m ((SourceSpan, M.Map Ident SourcePos), Expr)+ updateValue (_, bound) v@(PositionedValue pos' _ _) =+ return ((pos', bound), v)+ updateValue (pos, bound) (Abs (VarBinder ss arg) val') =+ return ((pos, M.insert arg (spanStart ss) bound), Abs (VarBinder ss arg) val')+ updateValue (pos, bound) (Let w ds val') = do+ let+ args = mapMaybe letBoundVariable ds+ groupByFst = map (\ts -> (fst (NEL.head ts), snd <$> ts)) . NEL.groupAllWith fst+ duplicateArgsErrs = foldMap mkArgError $ groupByFst args+ mkArgError (ident, poses)+ | NEL.length poses < 2 = mempty+ | otherwise = errorMessage'' (NEL.reverse poses) (OverlappingNamesInLet ident)+ when (nonEmpty duplicateArgsErrs) $+ throwError duplicateArgsErrs+ return ((pos, declarationsToMap ds `M.union` bound), Let w ds val')+ updateValue (_, bound) (Var ss name'@(Qualified qualifiedBy ident)) =+ ((ss, bound), ) <$> case (M.lookup ident bound, qualifiedBy) of+ -- bound idents that have yet to be locally qualified.+ (Just sourcePos, ByNullSourcePos) ->+ pure $ Var ss (Qualified (BySourcePos sourcePos) ident)+ -- unbound idents are likely import unqualified imports, so we+ -- handle them through updateValueName if they don't exist as a+ -- local binding.+ (Nothing, ByNullSourcePos) ->+ Var ss <$> updateValueName name' ss+ -- bound/unbound idents with explicit qualification is still+ -- handled through updateValueName, as it fully resolves the+ -- ModuleName.+ (_, ByModuleName _) ->+ Var ss <$> updateValueName name' ss+ -- encountering non-null source spans may be a bug in previous+ -- desugaring steps or with the AST traversals.+ (_, BySourcePos _) ->+ internalError "updateValue: ident is locally-qualified by a non-null source position"+ updateValue (_, bound) (Op ss op) =+ ((ss, bound), ) <$> (Op ss <$> updateValueOpName op ss)+ updateValue (_, bound) (Constructor ss name) =+ ((ss, bound), ) <$> (Constructor ss <$> updateDataConstructorName name ss)+ updateValue s (TypedValue check val ty) =+ (s, ) <$> (TypedValue check val <$> updateTypesEverywhere ty)+ updateValue s (VisibleTypeApp val ty) =+ (s, ) <$> VisibleTypeApp val <$> updateTypesEverywhere ty+ updateValue s v = return (s, v) - letBoundVariable :: Declaration -> Maybe Ident- letBoundVariable (ValueDeclaration ident _ _ _) = Just ident- letBoundVariable (PositionedDeclaration _ _ d) = letBoundVariable d- letBoundVariable _ = Nothing+ updateBinder+ :: (SourceSpan, M.Map Ident SourcePos)+ -> Binder+ -> m ((SourceSpan, M.Map Ident SourcePos), Binder)+ updateBinder (_, bound) v@(PositionedBinder pos _ _) =+ return ((pos, bound), v)+ updateBinder (_, bound) (ConstructorBinder ss name b) =+ ((ss, bound), ) <$> (ConstructorBinder ss <$> updateDataConstructorName name ss <*> pure b)+ updateBinder (_, bound) (OpBinder ss op) =+ ((ss, bound), ) <$> (OpBinder ss <$> updateValueOpName op ss)+ updateBinder s (TypedBinder t b) = do+ t' <- updateTypesEverywhere t+ return (s, TypedBinder t' b)+ updateBinder s v =+ return (s, v) - updateTypesEverywhere :: Maybe SourceSpan -> Type -> m Type- updateTypesEverywhere pos0 = everywhereOnTypesM (updateType pos0)+ updateCase+ :: (SourceSpan, M.Map Ident SourcePos)+ -> CaseAlternative+ -> m ((SourceSpan, M.Map Ident SourcePos), CaseAlternative)+ updateCase (pos, bound) c@(CaseAlternative bs _) =+ return ((pos, rUnionMap binderNamesWithSpans' bs `M.union` bound), c) where- updateType :: Maybe SourceSpan -> Type -> m Type- updateType pos (TypeConstructor name) = TypeConstructor <$> updateTypeName name pos- updateType pos (SaturatedTypeSynonym name tys) = SaturatedTypeSynonym <$> updateTypeName name pos <*> pure tys- updateType pos (ConstrainedType cs t) = ConstrainedType <$> updateConstraints pos cs <*> pure t- updateType _ t = return t-- updateConstraints pos = mapM (\(name, ts) -> (,) <$> updateClassName name pos <*> mapM (updateTypesEverywhere pos) ts)-- updateTypeName = update UnknownType importedTypes (\mes -> isJust . (`lookup` exportedTypes mes))- updateClassName = update UnknownTypeClass importedTypeClasses (flip elem . exportedTypeClasses)- updateValueName = update UnknownValue importedValues (flip elem . exportedValues)- updateDataConstructorName = update (flip UnknownDataConstructor Nothing) importedDataConstructors (\mes -> flip elem (join $ snd `map` exportedTypes mes))+ rUnionMap f = foldl' (flip (M.union . f)) M.empty - -- Update names so unqualified references become qualified, and locally qualified references- -- are replaced with their canoncial qualified names (e.g. M.Map -> Data.Map.Map)- update :: (Ord a, Show a) => (Qualified a -> ErrorMessage)- -> (ImportEnvironment -> M.Map (Qualified a) (Qualified a))- -> (Exports -> a -> Bool)- -> Qualified a- -> Maybe SourceSpan- -> m (Qualified a)- update unknown getI checkE qname@(Qualified mn' name) pos = positioned $ case (M.lookup qname imports', mn') of- (Just qname', _) -> return qname'- (Nothing, Just mn'') -> do- when (isExplicitQualModule mn'') . throwError . errorMessage $ unknown qname- modExports <- getExports mn''- if checkE modExports name- then return qname- else throwError . errorMessage $ unknown qname- _ -> throwError . errorMessage $ unknown qname- where- isExplicitQualModule :: ModuleName -> Bool- isExplicitQualModule = flip elem $ mapMaybe (\(Qualified q _) -> q) (M.keys imports')- imports' = getI imports- positioned err = case pos of- Nothing -> err- Just pos' -> rethrowWithPosition pos' err+ updateGuard+ :: (SourceSpan, M.Map Ident SourcePos)+ -> Guard+ -> m ((SourceSpan, M.Map Ident SourcePos), Guard)+ updateGuard (pos, bound) g@(ConditionGuard _) =+ return ((pos, bound), g)+ updateGuard (pos, bound) g@(PatternGuard b _) =+ return ((pos, binderNamesWithSpans' b `M.union` bound), g) - -- Gets the exports for a module, or an error message if the module doesn't exist- getExports :: ModuleName -> m Exports- getExports mn' = maybe (throwError . errorMessage $ UnknownModule mn') return $ M.lookup mn' exports+ binderNamesWithSpans' :: Binder -> M.Map Ident SourcePos+ binderNamesWithSpans'+ = M.fromList+ . fmap (second spanStart . swap)+ . binderNamesWithSpans --- |--- Finds all exported declarations in a set of modules.----findExports :: forall m. (Applicative m, MonadError MultipleErrors m) => [Module] -> m ExportEnvironment-findExports = foldM addModule $ M.singleton (ModuleName [ProperName C.prim]) primExports- where+ letBoundVariable :: Declaration -> Maybe (Ident, SourceSpan)+ letBoundVariable = fmap (valdeclIdent &&& (fst . valdeclSourceAnn)) . getValueDeclaration - -- The exported types from the Prim module- primExports = Exports (mkTypeEntry `map` M.keys primTypes) [] []+ declarationsToMap :: [Declaration] -> M.Map Ident SourcePos+ declarationsToMap = foldl goDTM M.empty where- mkTypeEntry (Qualified _ name) = (name, [])+ goDTM a (ValueDeclaration ValueDeclarationData {..}) =+ M.insert valdeclIdent (spanStart $ fst valdeclSourceAnn) a+ goDTM a _ =+ a - -- Add all of the exported declarations from a module to the global export environment- addModule :: ExportEnvironment -> Module -> m ExportEnvironment- addModule env (Module _ mn ds _) = do- env' <- addEmptyModule env mn- rethrow (onErrorMessages (ErrorInModule mn)) $ foldM (addDecl mn) env' ds+ updateTypeArguments+ :: (Traversable f, Traversable g)+ => f (a, g SourceType) -> m (f (a, g SourceType))+ updateTypeArguments = traverse (sndM (traverse updateTypesEverywhere)) - -- Add a declaration from a module to the global export environment- addDecl :: ModuleName -> ExportEnvironment -> Declaration -> m ExportEnvironment- addDecl mn env (TypeClassDeclaration tcn _ _ ds) = do- env' <- addTypeClass env mn tcn- foldM go env' ds+ updateTypesEverywhere :: SourceType -> m SourceType+ updateTypesEverywhere = everywhereOnTypesM updateType where- go env'' (TypeDeclaration name _) = addValue env'' mn name- go env'' (PositionedDeclaration pos _ d) = rethrowWithPosition pos $ go env'' d- go _ _ = error "Invalid declaration in TypeClassDeclaration"- addDecl mn env (DataDeclaration _ tn _ dcs) = addType env mn tn (map fst dcs)- addDecl mn env (TypeSynonymDeclaration tn _ _) = addType env mn tn []- addDecl mn env (ExternDataDeclaration tn _) = addType env mn tn []- addDecl mn env (ValueDeclaration name _ _ _) = addValue env mn name- addDecl mn env (ExternDeclaration _ name _ _) = addValue env mn name- addDecl mn env (PositionedDeclaration pos _ d) = rethrowWithPosition pos $ addDecl mn env d- addDecl _ env _ = return env---- |--- Filters the exports for a module to ensure only explicit exports are kept in the global exports--- environment.----filterExports :: forall m. (Applicative m, MonadError MultipleErrors m) => ModuleName -> [DeclarationRef] -> ExportEnvironment -> m ExportEnvironment-filterExports mn exps env = do- let moduleExports = fromMaybe (error "Module is missing") (mn `M.lookup` env)- moduleExports' <- rethrow (onErrorMessages (ErrorInModule mn)) $ filterModule moduleExports- return $ M.insert mn moduleExports' env- where-- -- Filter the exports for the specific module- filterModule :: Exports -> m Exports- filterModule exported = do- types' <- foldM (filterTypes $ exportedTypes exported) [] exps- values <- foldM (filterValues $ exportedValues exported) [] exps- classes <- foldM (filterClasses $ exportedTypeClasses exported) [] exps- return exported { exportedTypes = types', exportedTypeClasses = classes, exportedValues = values }-- -- Ensure the exported types and data constructors exist in the module and add them to the set of- -- exports- filterTypes :: [(ProperName, [ProperName])] -> [(ProperName, [ProperName])] -> DeclarationRef -> m [(ProperName, [ProperName])]- filterTypes expTys result (PositionedDeclarationRef pos _ r) = rethrowWithPosition pos $ filterTypes expTys result r- filterTypes expTys result (TypeRef name expDcons) = do- dcons <- maybe (throwError . errorMessage . UnknownType $ Qualified (Just mn) name) return $ name `lookup` expTys- dcons' <- maybe (return dcons) (foldM (filterDcons name dcons) []) expDcons- return $ (name, dcons') : result- filterTypes _ result _ = return result-- -- Ensure the exported data constructors exists for a type and add them to the list of exports- filterDcons :: ProperName -> [ProperName] -> [ProperName] -> ProperName -> m [ProperName]- filterDcons tcon exps' result name =- if name `elem` exps'- then return $ name : result- else throwError . errorMessage $ UnknownDataConstructor (Qualified (Just mn) name) (Just (Qualified (Just mn) tcon))-- -- Ensure the exported classes exist in the module and add them to the set of exports- filterClasses :: [ProperName] -> [ProperName] -> DeclarationRef -> m [ProperName]- filterClasses exps' result (PositionedDeclarationRef pos _ r) = rethrowWithPosition pos $ filterClasses exps' result r- filterClasses exps' result (TypeClassRef name) =- if name `elem` exps'- then return $ name : result- else throwError . errorMessage . UnknownTypeClass $ Qualified (Just mn) name- filterClasses _ result _ = return result+ updateType :: SourceType -> m SourceType+ updateType (TypeOp ann@(ss, _) name) = TypeOp ann <$> updateTypeOpName name ss+ updateType (TypeConstructor ann@(ss, _) name) = TypeConstructor ann <$> updateTypeName name ss+ updateType (ConstrainedType ann c t) = ConstrainedType ann <$> updateInConstraint c <*> pure t+ updateType t = return t+ updateInConstraint :: SourceConstraint -> m SourceConstraint+ updateInConstraint (Constraint ann@(ss, _) name ks ts info) =+ Constraint ann <$> updateClassName name ss <*> pure ks <*> pure ts <*> pure info - -- Ensure the exported values exist in the module and add them to the set of exports- filterValues :: [Ident] -> [Ident] -> DeclarationRef -> m [Ident]- filterValues exps' result (PositionedDeclarationRef pos _ r) = rethrowWithPosition pos $ filterValues exps' result r- filterValues exps' result (ValueRef name) =- if name `elem` exps'- then return $ name : result- else throwError . errorMessage . UnknownValue $ Qualified (Just mn) name- filterValues _ result _ = return result+ updateConstraints :: [SourceConstraint] -> m [SourceConstraint]+ updateConstraints = traverse $ \(Constraint ann@(pos, _) name ks ts info) ->+ Constraint ann+ <$> updateClassName name pos+ <*> traverse updateTypesEverywhere ks+ <*> traverse updateTypesEverywhere ts+ <*> pure info --- |--- Finds the imports within a module, mapping the imported module name to an optional set of--- explicitly imported declarations.----findImports :: [Declaration] -> M.Map ModuleName (Maybe SourceSpan, ImportDeclarationType, Maybe ModuleName)-findImports = foldl (findImports' Nothing) M.empty- where- findImports' pos result (ImportDeclaration mn typ qual) = M.insert mn (pos, typ, qual) result- findImports' _ result (PositionedDeclaration pos _ d) = findImports' (Just pos) result d- findImports' _ result _ = result+ updateTypeName+ :: Qualified (ProperName 'TypeName)+ -> SourceSpan+ -> m (Qualified (ProperName 'TypeName))+ updateTypeName = update (importedTypes imports) TyName --- |--- Constructs a local environment for a module.----resolveImports :: forall m. (Applicative m, MonadError MultipleErrors m) => ExportEnvironment -> Module -> m ImportEnvironment-resolveImports env (Module _ currentModule decls _) =- foldM resolveImport' (ImportEnvironment M.empty M.empty M.empty M.empty) (M.toList scope)- where+ updateTypeOpName+ :: Qualified (OpName 'TypeOpName)+ -> SourceSpan+ -> m (Qualified (OpName 'TypeOpName))+ updateTypeOpName = update (importedTypeOps imports) TyOpName - -- A Map from module name to the source position for the import, the list of imports from that- -- module (where Nothing indicates everything is to be imported), and optionally a qualified name- -- for the module- scope :: M.Map ModuleName (Maybe SourceSpan, ImportDeclarationType, Maybe ModuleName)- scope = M.insert currentModule (Nothing, Implicit, Nothing) (findImports decls)+ updateDataConstructorName+ :: Qualified (ProperName 'ConstructorName)+ -> SourceSpan+ -> m (Qualified (ProperName 'ConstructorName))+ updateDataConstructorName = update (importedDataConstructors imports) DctorName - resolveImport' :: ImportEnvironment -> (ModuleName, (Maybe SourceSpan, ImportDeclarationType, Maybe ModuleName)) -> m ImportEnvironment- resolveImport' imp (mn, (pos, typ, impQual)) = do- modExports <- positioned $ maybe (throwError . errorMessage $ UnknownModule mn) return $ mn `M.lookup` env- positioned $ resolveImport currentModule mn modExports imp impQual typ- where- positioned err = case pos of- Nothing -> err- Just pos' -> rethrowWithPosition pos' err+ updateClassName+ :: Qualified (ProperName 'ClassName)+ -> SourceSpan+ -> m (Qualified (ProperName 'ClassName))+ updateClassName = update (importedTypeClasses imports) TyClassName --- |--- Extends the local environment for a module by resolving an import of another module.----resolveImport :: forall m. (Applicative m, MonadError MultipleErrors m) => ModuleName -> ModuleName -> Exports -> ImportEnvironment -> Maybe ModuleName -> ImportDeclarationType -> m ImportEnvironment-resolveImport currentModule importModule exps imps impQual =- resolveByType- where+ updateValueName :: Qualified Ident -> SourceSpan -> m (Qualified Ident)+ updateValueName = update (importedValues imports) IdentName - resolveByType :: ImportDeclarationType -> m ImportEnvironment- resolveByType Implicit = importAll importExplicit- resolveByType (Explicit explImports) = (checkedRefs >=> foldM importExplicit imps) explImports- resolveByType (Hiding hiddenImports) = do- hiddenImports' <- checkedRefs hiddenImports- importAll (importNonHidden hiddenImports')+ updateValueOpName+ :: Qualified (OpName 'ValueOpName)+ -> SourceSpan+ -> m (Qualified (OpName 'ValueOpName))+ updateValueOpName = update (importedValueOps imports) ValOpName - importNonHidden :: [DeclarationRef] -> ImportEnvironment -> DeclarationRef -> m ImportEnvironment- importNonHidden hidden m ref =- if isHidden hidden ref- then return m- else importExplicit m ref+ -- Update names so unqualified references become qualified, and locally+ -- qualified references are replaced with their canonical qualified names+ -- (e.g. M.Map -> Data.Map.Map).+ update+ :: (Ord a)+ => M.Map (Qualified a) [ImportRecord a]+ -> (a -> Name)+ -> Qualified a+ -> SourceSpan+ -> m (Qualified a)+ update imps toName qname@(Qualified mn' name) pos = warnAndRethrowWithPosition pos $+ case (M.lookup qname imps, mn') of - isHidden :: [DeclarationRef] -> DeclarationRef -> Bool- isHidden hidden ref@(TypeRef _ _) =- let- checkTypeRef _ True _ = True- checkTypeRef (TypeRef _ Nothing) acc (TypeRef _ (Just _)) = acc- checkTypeRef (TypeRef name (Just dctor)) _ (TypeRef name' (Just dctor')) = name == name' && dctor == dctor'- checkTypeRef (TypeRef name _) _ (TypeRef name' Nothing) = name == name'- checkTypeRef (PositionedDeclarationRef _ _ r) acc hiddenRef = checkTypeRef r acc hiddenRef- checkTypeRef _ acc _ = acc- in foldl (checkTypeRef ref) False hidden- isHidden hidden ref = ref `elem` hidden+ -- We found the name in our imports, so we return the name for it,+ -- qualifying with the name of the module it was originally defined in+ -- rather than the module we're importing from, to handle the case of+ -- re-exports. If there are multiple options for the name to resolve to+ -- in scope, we throw an error.+ (Just options, _) -> do+ (mnNew, mnOrig) <- checkImportConflicts pos mn toName options+ modify $ \usedImports ->+ M.insertWith (++) mnNew [fmap toName qname] usedImports+ return $ Qualified (ByModuleName mnOrig) name - -- Import all symbols- importAll :: (ImportEnvironment -> DeclarationRef -> m ImportEnvironment) -> m ImportEnvironment- importAll importer = do- imp' <- foldM (\m (name, dctors) -> importer m (TypeRef name (Just dctors))) imps (exportedTypes exps)- imp'' <- foldM (\m name -> importer m (ValueRef name)) imp' (exportedValues exps)- foldM (\m name -> importer m (TypeClassRef name)) imp'' (exportedTypeClasses exps)+ -- If the name wasn't found in our imports but was qualified then we need+ -- to check whether it's a failed import from a "pseudo" module (created+ -- by qualified importing). If that's not the case, then we just need to+ -- check it refers to a symbol in another module.+ (Nothing, ByModuleName mn'') ->+ if mn'' `S.member` importedQualModules imports || mn'' `S.member` importedModules imports+ then throwUnknown+ else throwError . errorMessage . UnknownName . Qualified ByNullSourcePos $ ModName mn'' - -- Import something explicitly- importExplicit :: ImportEnvironment -> DeclarationRef -> m ImportEnvironment- importExplicit imp (PositionedDeclarationRef pos _ r) = rethrowWithPosition pos $ importExplicit imp r- importExplicit imp (ValueRef name) = do- values' <- updateImports (importedValues imp) name- return $ imp { importedValues = values' }- importExplicit imp (TypeRef name dctors) = do- types' <- updateImports (importedTypes imp) name- let allDctors = allExportedDataConstructors name- dctors' <- maybe (return allDctors) (mapM $ checkDctorExists allDctors) dctors- dctors'' <- foldM updateImports (importedDataConstructors imp) dctors'- return $ imp { importedTypes = types', importedDataConstructors = dctors'' }- importExplicit imp (TypeClassRef name) = do- typeClasses' <- updateImports (importedTypeClasses imp) name- return $ imp { importedTypeClasses = typeClasses' }- importExplicit _ _ = error "Invalid argument to importExplicit"+ -- If neither of the above cases are true then it's an undefined or+ -- unimported symbol.+ _ -> throwUnknown - -- Check if DeclarationRef points to an existent symbol- checkedRefs :: [DeclarationRef] -> m [DeclarationRef]- checkedRefs = mapM check where- check (PositionedDeclarationRef pos _ r) =- rethrowWithPosition pos $ check r- check ref@(ValueRef name) =- checkImportExists UnknownValue values name >> return ref- check ref@(TypeRef name dctors) = do- _ <- checkImportExists UnknownType availableTypes name- let allDctors = allExportedDataConstructors name- _ <- maybe (return allDctors) (mapM $ checkDctorExists allDctors) dctors- return ref- check ref@(TypeClassRef name) =- checkImportExists UnknownTypeClass classes name >> return ref- check _ = error "Invalid argument to checkRefIsValid"-- -- Find all exported data constructors for a given type- allExportedDataConstructors :: ProperName -> [ProperName]- allExportedDataConstructors name = fromMaybe [] $ name `lookup` exportedTypes exps-- -- Add something to the ImportEnvironment if it does not already exist there- updateImports :: (Ord a, Show a) => M.Map (Qualified a) (Qualified a) -> a -> m (M.Map (Qualified a) (Qualified a))- updateImports m name = case M.lookup (Qualified impQual name) m of- Nothing -> return $ M.insert (Qualified impQual name) (Qualified (Just importModule) name) m- Just (Qualified Nothing _) -> error "Invalid state in updateImports"- Just (Qualified (Just mn) _) -> throwError . errorMessage $ err- where- err = if mn == currentModule || importModule == currentModule- then ConflictingImport (show name) mn- else ConflictingImports (show name) mn importModule-- -- The available values, types, and classes in the module being imported- values = exportedValues exps- availableTypes = fst `map` exportedTypes exps- classes = exportedTypeClasses exps-- -- Ensure that an explicitly imported data constructor exists for the type it is being imported- -- from- checkDctorExists :: [ProperName] -> ProperName -> m ProperName- checkDctorExists = checkImportExists (flip UnknownDataConstructor Nothing)-- -- Check that an explicitly imported item exists in the module it is being imported from- checkImportExists :: (Eq a, Show a) => (Qualified a -> ErrorMessage) -> [a] -> a -> m a- checkImportExists unknown exports item =- if item `elem` exports- then return item- else throwError . errorMessage . unknown $ Qualified (Just importModule) item---- |--- Raises an error for when there is more than one definition for something.----throwConflictError :: (Applicative m, MonadError MultipleErrors m, Show a) => (a -> ErrorMessage) -> a -> m b-throwConflictError conflict = throwError . errorMessage . conflict+ throwUnknown = throwError . errorMessage . UnknownName . fmap toName $ qname
+ src/Language/PureScript/Sugar/Names/Common.hs view
@@ -0,0 +1,68 @@+module Language.PureScript.Sugar.Names.Common (warnDuplicateRefs) where++import Prelude+import Protolude (ordNub)++import Control.Monad.Writer (MonadWriter(..))++import Data.Foldable (for_)+import Data.List (group, sort, (\\))+import Data.Maybe (mapMaybe)++import Language.PureScript.AST (DeclarationRef(..), SourceSpan)+import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage, errorMessage, warnWithPosition)+import Language.PureScript.Names (Name(..))++-- |+-- Warns about duplicate values in a list of declaration refs.+--+warnDuplicateRefs+ :: MonadWriter MultipleErrors m+ => SourceSpan+ -> (Name -> SimpleErrorMessage)+ -> [DeclarationRef]+ -> m ()+warnDuplicateRefs pos toError refs = do+ let withoutCtors = deleteCtors `map` refs+ dupeRefs = mapMaybe (refToName pos) $ removeUnique withoutCtors+ dupeCtors = concat $ mapMaybe (extractCtors pos) refs++ for_ (dupeRefs ++ dupeCtors) $ \(pos', name) ->+ warnWithPosition pos' . tell . errorMessage $ toError name++ where++ -- Removes all unique elements from list+ -- as well as one of each duplicate.+ -- Example:+ -- removeUnique [1,2,2,3,3,3,4] == [2,3,3]+ -- Note that it may be more correct to keep ALL duplicates,+ -- but that requires additional changes in how warnings are printed.+ -- Example of keeping all duplicates (not what this code currently does):+ -- removeUnique [1,2,2,3,3,3,4] == [2,2,3,3,3]+ removeUnique :: Ord a => [a] -> [a]+ removeUnique = concatMap (drop 1) . group . sort++ -- Deletes the constructor information from TypeRefs so that only the+ -- referenced type is used in the duplicate check - constructors are handled+ -- separately+ deleteCtors :: DeclarationRef -> DeclarationRef+ deleteCtors (TypeRef sa pn _) = TypeRef sa pn Nothing+ deleteCtors other = other++ -- Extracts the names of duplicate constructor references from TypeRefs.+ extractCtors :: SourceSpan -> DeclarationRef -> Maybe [(SourceSpan, Name)]+ extractCtors pos' (TypeRef _ _ (Just dctors)) =+ let dupes = dctors \\ ordNub dctors+ in if null dupes then Nothing else Just $ (pos',) . DctorName <$> dupes+ extractCtors _ _ = Nothing++ -- Converts a DeclarationRef into a name for an error message.+ refToName :: SourceSpan -> DeclarationRef -> Maybe (SourceSpan, Name)+ refToName pos' (TypeRef _ name _) = Just (pos', TyName name)+ refToName pos' (TypeOpRef _ op) = Just (pos', TyOpName op)+ refToName pos' (ValueRef _ name) = Just (pos', IdentName name)+ refToName pos' (ValueOpRef _ op) = Just (pos', ValOpName op)+ refToName pos' (TypeClassRef _ name) = Just (pos', TyClassName name)+ refToName pos' (ModuleRef _ name) = Just (pos', ModName name)+ refToName _ _ = Nothing
+ src/Language/PureScript/Sugar/Names/Env.hs view
@@ -0,0 +1,501 @@+module Language.PureScript.Sugar.Names.Env+ ( ImportRecord(..)+ , ImportProvenance(..)+ , Imports(..)+ , nullImports+ , Exports(..)+ , nullExports+ , Env+ , primEnv+ , primExports+ , envModuleExports+ , ExportMode(..)+ , exportType+ , exportTypeOp+ , exportTypeClass+ , exportValue+ , exportValueOp+ , checkImportConflicts+ ) where++import Prelude++import Control.Monad (forM_, when)+import Control.Monad.Error.Class (MonadError(..))+import Control.Monad.Writer.Class (MonadWriter(..))++import Data.Function (on)+import Data.Foldable (find)+import Data.List (groupBy, sortOn, delete)+import Data.Maybe (mapMaybe)+import Safe (headMay)+import Data.Map qualified as M+import Data.Set qualified as S++import Language.PureScript.Constants.Prim qualified as C+import Language.PureScript.AST (ExportSource(..), SourceSpan, internalModuleSourceSpan, nullSourceSpan)+import Language.PureScript.Crash (internalError)+import Language.PureScript.Environment+import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage(..), errorMessage, errorMessage')+import Language.PureScript.Names (Ident, ModuleName, Name(..), OpName, OpNameType(..), ProperName, ProperNameType(..), Qualified(..), QualifiedBy(..), coerceProperName, disqualify, getQual)++-- |+-- The details for an import: the name of the thing that is being imported+-- (`A.x` if importing from `A`), the module that the thing was originally+-- defined in (for re-export resolution), and the import provenance (see below).+--+data ImportRecord a =+ ImportRecord+ { importName :: Qualified a+ , importSourceModule :: ModuleName+ , importSourceSpan :: SourceSpan+ , importProvenance :: ImportProvenance+ }+ deriving (Eq, Ord, Show)++-- |+-- Used to track how an import was introduced into scope. This allows us to+-- handle the one-open-import special case that allows a name conflict to become+-- a warning rather than being an unresolvable situation.+--+data ImportProvenance+ = FromImplicit+ | FromExplicit+ | Local+ | Prim+ deriving (Eq, Ord, Show)++type ImportMap a = M.Map (Qualified a) [ImportRecord a]++-- |+-- The imported declarations for a module, including the module's own members.+--+data Imports = Imports+ {+ -- |+ -- Local names for types within a module mapped to their qualified names+ --+ importedTypes :: ImportMap (ProperName 'TypeName)+ -- |+ -- Local names for type operators within a module mapped to their qualified names+ --+ , importedTypeOps :: ImportMap (OpName 'TypeOpName)+ -- |+ -- Local names for data constructors within a module mapped to their qualified names+ --+ , importedDataConstructors :: ImportMap (ProperName 'ConstructorName)+ -- |+ -- Local names for classes within a module mapped to their qualified names+ --+ , importedTypeClasses :: ImportMap (ProperName 'ClassName)+ -- |+ -- Local names for values within a module mapped to their qualified names+ --+ , importedValues :: ImportMap Ident+ -- |+ -- Local names for value operators within a module mapped to their qualified names+ --+ , importedValueOps :: ImportMap (OpName 'ValueOpName)+ -- |+ -- The name of modules that have been imported into the current scope that+ -- can be re-exported. If a module is imported with `as` qualification, the+ -- `as` name appears here, otherwise the original name.+ --+ , importedModules :: S.Set ModuleName+ -- |+ -- The "as" names of modules that have been imported qualified.+ --+ , importedQualModules :: S.Set ModuleName+ -- |+ -- Local names for kinds within a module mapped to their qualified names+ --+ , importedKinds :: ImportMap (ProperName 'TypeName)+ } deriving (Show)++nullImports :: Imports+nullImports = Imports M.empty M.empty M.empty M.empty M.empty M.empty S.empty S.empty M.empty++-- |+-- The exported declarations from a module.+--+data Exports = Exports+ {+ -- |+ -- The exported types along with the module they originally came from.+ --+ exportedTypes :: M.Map (ProperName 'TypeName) ([ProperName 'ConstructorName], ExportSource)+ -- |+ -- The exported type operators along with the module they originally came+ -- from.+ --+ , exportedTypeOps :: M.Map (OpName 'TypeOpName) ExportSource+ -- |+ -- The exported classes along with the module they originally came from.+ --+ , exportedTypeClasses :: M.Map (ProperName 'ClassName) ExportSource+ -- |+ -- The exported values along with the module they originally came from.+ --+ , exportedValues :: M.Map Ident ExportSource+ -- |+ -- The exported value operators along with the module they originally came+ -- from.+ --+ , exportedValueOps :: M.Map (OpName 'ValueOpName) ExportSource+ } deriving (Show)++-- |+-- An empty 'Exports' value.+--+nullExports :: Exports+nullExports = Exports M.empty M.empty M.empty M.empty M.empty++-- |+-- The imports and exports for a collection of modules. The 'SourceSpan' is used+-- to store the source location of the module with a given name, used to provide+-- useful information when there is a duplicate module definition.+--+type Env = M.Map ModuleName (SourceSpan, Imports, Exports)++-- |+-- Extracts the 'Exports' from an 'Env' value.+--+envModuleExports :: (a, b, Exports) -> Exports+envModuleExports (_, _, exps) = exps++-- |+-- The exported types from the @Prim@ module+--+primExports :: Exports+primExports = mkPrimExports primTypes primClasses++-- |+-- The exported types from the @Prim.Boolean@ module+--+primBooleanExports :: Exports+primBooleanExports = mkPrimExports primBooleanTypes mempty++-- |+-- The exported types from the @Prim.Coerce@ module+--+primCoerceExports :: Exports+primCoerceExports = mkPrimExports primCoerceTypes primCoerceClasses++-- |+-- The exported types from the @Prim.Ordering@ module+--+primOrderingExports :: Exports+primOrderingExports = mkPrimExports primOrderingTypes mempty++-- |+-- The exported types from the @Prim.Row@ module+--+primRowExports :: Exports+primRowExports = mkPrimExports primRowTypes primRowClasses++-- |+-- The exported types from the @Prim.RowList@ module+--+primRowListExports :: Exports+primRowListExports = mkPrimExports primRowListTypes primRowListClasses++-- |+-- The exported types from the @Prim.Symbol@ module+--+primSymbolExports :: Exports+primSymbolExports = mkPrimExports primSymbolTypes primSymbolClasses++-- |+-- The exported types from the @Prim.Int@ module+primIntExports :: Exports+primIntExports = mkPrimExports primIntTypes primIntClasses++-- |+-- The exported types from the @Prim.TypeError@ module+--+primTypeErrorExports :: Exports+primTypeErrorExports = mkPrimExports primTypeErrorTypes primTypeErrorClasses++-- |+-- Create a set of exports for a Prim module.+--+mkPrimExports+ :: M.Map (Qualified (ProperName 'TypeName)) a+ -> M.Map (Qualified (ProperName 'ClassName)) b+ -> Exports+mkPrimExports ts cs =+ nullExports+ { exportedTypes = M.fromList $ mkTypeEntry `map` M.keys ts+ , exportedTypeClasses = M.fromList $ mkClassEntry `map` M.keys cs+ }+ where+ mkTypeEntry (Qualified (ByModuleName mn) name) = (name, ([], primExportSource mn))+ mkTypeEntry _ = internalError+ "mkPrimExports.mkTypeEntry: a name is qualified BySourcePos instead of ByModuleName"++ mkClassEntry (Qualified (ByModuleName mn) name) = (name, primExportSource mn)+ mkClassEntry _ = internalError+ "mkPrimExports.mkClassEntry: a name is qualified BySourcePos instead of ByModuleName"++ primExportSource mn =+ ExportSource+ { exportSourceImportedFrom = Nothing+ , exportSourceDefinedIn = mn+ }++-- | Environment which only contains the Prim modules.+primEnv :: Env+primEnv = M.fromList+ [ ( C.M_Prim+ , (internalModuleSourceSpan "<Prim>", nullImports, primExports)+ )+ , ( C.M_Prim_Boolean+ , (internalModuleSourceSpan "<Prim.Boolean>", nullImports, primBooleanExports)+ )+ , ( C.M_Prim_Coerce+ , (internalModuleSourceSpan "<Prim.Coerce>", nullImports, primCoerceExports)+ )+ , ( C.M_Prim_Ordering+ , (internalModuleSourceSpan "<Prim.Ordering>", nullImports, primOrderingExports)+ )+ , ( C.M_Prim_Row+ , (internalModuleSourceSpan "<Prim.Row>", nullImports, primRowExports)+ )+ , ( C.M_Prim_RowList+ , (internalModuleSourceSpan "<Prim.RowList>", nullImports, primRowListExports)+ )+ , ( C.M_Prim_Symbol+ , (internalModuleSourceSpan "<Prim.Symbol>", nullImports, primSymbolExports)+ )+ , ( C.M_Prim_Int+ , (internalModuleSourceSpan "<Prim.Int>", nullImports, primIntExports)+ )+ , ( C.M_Prim_TypeError+ , (internalModuleSourceSpan "<Prim.TypeError>", nullImports, primTypeErrorExports)+ )+ ]++-- |+-- When updating the `Exports` the behaviour is slightly different depending+-- on whether we are exporting values defined within the module or elaborating+-- re-exported values. This type is used to indicate which behaviour should be+-- used.+--+data ExportMode = Internal | ReExport+ deriving (Eq, Show)++-- |+-- Safely adds a type and its data constructors to some exports, returning an+-- error if a conflict occurs.+--+exportType+ :: MonadError MultipleErrors m+ => SourceSpan+ -> ExportMode+ -> Exports+ -> ProperName 'TypeName+ -> [ProperName 'ConstructorName]+ -> ExportSource+ -> m Exports+exportType ss exportMode exps name dctors src = do+ let exTypes = exportedTypes exps+ exClasses = exportedTypeClasses exps+ dctorNameCounts :: [(ProperName 'ConstructorName, Int)]+ dctorNameCounts = M.toList $ M.fromListWith (+) (map (,1) dctors)+ forM_ dctorNameCounts $ \(dctorName, count) ->+ when (count > 1) $+ throwDeclConflict (DctorName dctorName) (DctorName dctorName)+ case exportMode of+ Internal -> do+ when (name `M.member` exTypes) $+ throwDeclConflict (TyName name) (TyName name)+ when (coerceProperName name `M.member` exClasses) $+ throwDeclConflict (TyName name) (TyClassName (coerceProperName name))+ forM_ dctors $ \dctor -> do+ when ((elem dctor . fst) `any` exTypes) $+ throwDeclConflict (DctorName dctor) (DctorName dctor)+ when (coerceProperName dctor `M.member` exClasses) $+ throwDeclConflict (DctorName dctor) (TyClassName (coerceProperName dctor))+ ReExport -> do+ let mn = exportSourceDefinedIn src+ forM_ (coerceProperName name `M.lookup` exClasses) $ \src' ->+ let mn' = exportSourceDefinedIn src' in+ throwExportConflict' ss mn mn' (TyName name) (TyClassName (coerceProperName name))+ forM_ (name `M.lookup` exTypes) $ \(_, src') ->+ let mn' = exportSourceDefinedIn src' in+ when (mn /= mn') $+ throwExportConflict ss mn mn' (TyName name)+ forM_ dctors $ \dctor ->+ forM_ ((elem dctor . fst) `find` exTypes) $ \(_, src') ->+ let mn' = exportSourceDefinedIn src' in+ when (mn /= mn') $+ throwExportConflict ss mn mn' (DctorName dctor)+ return $ exps { exportedTypes = M.alter updateOrInsert name exTypes }+ where+ updateOrInsert Nothing = Just (dctors, src)+ updateOrInsert (Just (dctors', _)) = Just (dctors ++ dctors', src)++-- |+-- Safely adds a type operator to some exports, returning an error if a+-- conflict occurs.+--+exportTypeOp+ :: MonadError MultipleErrors m+ => SourceSpan+ -> Exports+ -> OpName 'TypeOpName+ -> ExportSource+ -> m Exports+exportTypeOp ss exps op src = do+ typeOps <- addExport ss TyOpName op src (exportedTypeOps exps)+ return $ exps { exportedTypeOps = typeOps }++-- |+-- Safely adds a class to some exports, returning an error if a conflict occurs.+--+exportTypeClass+ :: MonadError MultipleErrors m+ => SourceSpan+ -> ExportMode+ -> Exports+ -> ProperName 'ClassName+ -> ExportSource+ -> m Exports+exportTypeClass ss exportMode exps name src = do+ let exTypes = exportedTypes exps+ when (exportMode == Internal) $ do+ when (coerceProperName name `M.member` exTypes) $+ throwDeclConflict (TyClassName name) (TyName (coerceProperName name))+ when ((elem (coerceProperName name) . fst) `any` exTypes) $+ throwDeclConflict (TyClassName name) (DctorName (coerceProperName name))+ classes <- addExport ss TyClassName name src (exportedTypeClasses exps)+ return $ exps { exportedTypeClasses = classes }++-- |+-- Safely adds a value to some exports, returning an error if a conflict occurs.+--+exportValue+ :: MonadError MultipleErrors m+ => SourceSpan+ -> Exports+ -> Ident+ -> ExportSource+ -> m Exports+exportValue ss exps name src = do+ values <- addExport ss IdentName name src (exportedValues exps)+ return $ exps { exportedValues = values }++-- |+-- Safely adds a value operator to some exports, returning an error if a+-- conflict occurs.+--+exportValueOp+ :: MonadError MultipleErrors m+ => SourceSpan+ -> Exports+ -> OpName 'ValueOpName+ -> ExportSource+ -> m Exports+exportValueOp ss exps op src = do+ valueOps <- addExport ss ValOpName op src (exportedValueOps exps)+ return $ exps { exportedValueOps = valueOps }++-- |+-- Adds an entry to a list of exports unless it is already present, in which+-- case an error is returned.+--+addExport+ :: (MonadError MultipleErrors m, Ord a)+ => SourceSpan+ -> (a -> Name)+ -> a+ -> ExportSource+ -> M.Map a ExportSource+ -> m (M.Map a ExportSource)+addExport ss toName name src exports =+ case M.lookup name exports of+ Just src' ->+ let+ mn = exportSourceDefinedIn src+ mn' = exportSourceDefinedIn src'+ in+ if mn == mn'+ then return exports+ else throwExportConflict ss mn mn' (toName name)+ Nothing ->+ return $ M.insert name src exports++-- |+-- Raises an error for when there is more than one definition for something.+--+throwDeclConflict+ :: MonadError MultipleErrors m+ => Name+ -> Name+ -> m a+throwDeclConflict new existing =+ throwError . errorMessage $ DeclConflict new existing++-- |+-- Raises an error for when there are conflicting names in the exports.+--+throwExportConflict+ :: MonadError MultipleErrors m+ => SourceSpan+ -> ModuleName+ -> ModuleName+ -> Name+ -> m a+throwExportConflict ss new existing name =+ throwExportConflict' ss new existing name name++-- |+-- Raises an error for when there are conflicting names in the exports. Allows+-- different categories of names. E.g. class and type names conflicting.+--+throwExportConflict'+ :: MonadError MultipleErrors m+ => SourceSpan+ -> ModuleName+ -> ModuleName+ -> Name+ -> Name+ -> m a+throwExportConflict' ss new existing newName existingName =+ throwError . errorMessage' ss $+ ExportConflict (Qualified (ByModuleName new) newName) (Qualified (ByModuleName existing) existingName)++-- |+-- When reading a value from the imports, check that there are no conflicts in+-- scope.+--+checkImportConflicts+ :: forall m a+ . (MonadError MultipleErrors m, MonadWriter MultipleErrors m)+ => SourceSpan+ -> ModuleName+ -> (a -> Name)+ -> [ImportRecord a]+ -> m (ModuleName, ModuleName)+checkImportConflicts ss currentModule toName xs =+ let+ byOrig = sortOn importSourceModule xs+ groups = groupBy ((==) `on` importSourceModule) byOrig+ nonImplicit = filter ((/= FromImplicit) . importProvenance) xs+ name = toName . disqualify . importName $ head xs+ conflictModules = mapMaybe (getQual . importName . head) groups+ in+ if length groups > 1+ then case nonImplicit of+ [ImportRecord (Qualified (ByModuleName mnNew) _) mnOrig _ _] -> do+ let warningModule = if mnNew == currentModule then Nothing else Just mnNew+ ss' = maybe nullSourceSpan importSourceSpan . headMay . filter ((== FromImplicit) . importProvenance) $ xs+ tell . errorMessage' ss' $ ScopeShadowing name warningModule $ delete mnNew conflictModules+ return (mnNew, mnOrig)+ _ -> throwError . errorMessage' ss $ ScopeConflict name conflictModules+ else+ case head byOrig of+ ImportRecord (Qualified (ByModuleName mnNew) _) mnOrig _ _ ->+ return (mnNew, mnOrig)+ _ ->+ internalError "checkImportConflicts: ImportRecord should be qualified"
+ src/Language/PureScript/Sugar/Names/Exports.hs view
@@ -0,0 +1,304 @@+module Language.PureScript.Sugar.Names.Exports+ ( findExportable+ , resolveExports+ ) where++import Prelude++import Control.Monad (filterM, foldM, liftM2, unless, void, when)+import Control.Monad.Writer.Class (MonadWriter(..))+import Control.Monad.Error.Class (MonadError(..))++import Data.Function (on)+import Data.Foldable (traverse_)+import Data.List (intersect, groupBy, sortOn)+import Data.Maybe (fromMaybe, mapMaybe)+import Data.Map qualified as M++import Language.PureScript.AST+import Language.PureScript.Crash (internalError)+import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage(..), addHint, errorMessage', rethrow, rethrowWithPosition, warnAndRethrow)+import Language.PureScript.Names (Ident, ModuleName, Name(..), OpName, OpNameType(..), ProperName, ProperNameType(..), Qualified(..), QualifiedBy(..), disqualifyFor, isQualifiedWith, isUnqualified)+import Language.PureScript.Sugar.Names.Env (Env, ExportMode(..), Exports(..), ImportRecord(..), Imports(..), checkImportConflicts, envModuleExports, exportType, exportTypeClass, exportTypeOp, exportValue, exportValueOp, nullExports)+import Language.PureScript.Sugar.Names.Common (warnDuplicateRefs)++-- |+-- Finds all exportable members of a module, disregarding any explicit exports.+--+findExportable :: forall m. (MonadError MultipleErrors m) => Module -> m Exports+findExportable (Module _ _ mn ds _) =+ rethrow (addHint (ErrorInModule mn)) $ foldM updateExports' nullExports ds+ where+ updateExports' :: Exports -> Declaration -> m Exports+ updateExports' exps decl = rethrowWithPosition (declSourceSpan decl) $ updateExports exps decl++ source =+ ExportSource+ { exportSourceDefinedIn = mn+ , exportSourceImportedFrom = Nothing+ }++ updateExports :: Exports -> Declaration -> m Exports+ updateExports exps (TypeClassDeclaration (ss, _) tcn _ _ _ ds') = do+ exps' <- rethrowWithPosition ss $ exportTypeClass ss Internal exps tcn source+ foldM go exps' ds'+ where+ go exps'' (TypeDeclaration (TypeDeclarationData (ss', _) name _)) = exportValue ss' exps'' name source+ go _ _ = internalError "Invalid declaration in TypeClassDeclaration"+ updateExports exps (DataDeclaration (ss, _) _ tn _ dcs) =+ exportType ss Internal exps tn (map dataCtorName dcs) source+ updateExports exps (TypeSynonymDeclaration (ss, _) tn _ _) =+ exportType ss Internal exps tn [] source+ updateExports exps (ExternDataDeclaration (ss, _) tn _) =+ exportType ss Internal exps tn [] source+ updateExports exps (ValueDeclaration vd) =+ exportValue (fst (valdeclSourceAnn vd)) exps (valdeclIdent vd) source+ updateExports exps (ValueFixityDeclaration (ss, _) _ _ op) =+ exportValueOp ss exps op source+ updateExports exps (TypeFixityDeclaration (ss, _) _ _ op) =+ exportTypeOp ss exps op source+ updateExports exps (ExternDeclaration (ss, _) name _) =+ exportValue ss exps name source+ updateExports exps _ = return exps++-- |+-- Resolves the exports for a module, filtering out members that have not been+-- exported and elaborating re-exports of other modules.+--+resolveExports+ :: forall m+ . (MonadError MultipleErrors m, MonadWriter MultipleErrors m)+ => Env+ -> SourceSpan+ -> ModuleName+ -> Imports+ -> Exports+ -> [DeclarationRef]+ -> m Exports+resolveExports env ss mn imps exps refs =+ warnAndRethrow (addHint (ErrorInModule mn)) $ do+ filtered <- filterModule mn exps refs+ exps' <- foldM elaborateModuleExports filtered refs+ warnDuplicateRefs ss DuplicateExportRef refs+ return exps'++ where++ -- Takes the current module's imports, the accumulated list of exports, and a+ -- `DeclarationRef` for an explicit export. When the ref refers to another+ -- module, export anything from the imports that matches for that module.+ elaborateModuleExports :: Exports -> DeclarationRef -> m Exports+ elaborateModuleExports result (ModuleRef _ name) | name == mn = do+ let types' = exportedTypes result `M.union` exportedTypes exps+ let typeOps' = exportedTypeOps result `M.union` exportedTypeOps exps+ let classes' = exportedTypeClasses result `M.union` exportedTypeClasses exps+ let values' = exportedValues result `M.union` exportedValues exps+ let valueOps' = exportedValueOps result `M.union` exportedValueOps exps+ return result+ { exportedTypes = types'+ , exportedTypeOps = typeOps'+ , exportedTypeClasses = classes'+ , exportedValues = values'+ , exportedValueOps = valueOps'+ }+ elaborateModuleExports result (ModuleRef ss' name) = do+ let isPseudo = isPseudoModule name+ when (not isPseudo && not (isImportedModule name))+ . throwError . errorMessage' ss' . UnknownExport $ ModName name+ reTypes <- extract ss' isPseudo name TyName (importedTypes imps)+ reTypeOps <- extract ss' isPseudo name TyOpName (importedTypeOps imps)+ reDctors <- extract ss' isPseudo name DctorName (importedDataConstructors imps)+ reClasses <- extract ss' isPseudo name TyClassName (importedTypeClasses imps)+ reValues <- extract ss' isPseudo name IdentName (importedValues imps)+ reValueOps <- extract ss' isPseudo name ValOpName (importedValueOps imps)+ foldM (\exps' ((tctor, dctors), src) -> exportType ss' ReExport exps' tctor dctors src) result (resolveTypeExports reTypes reDctors)+ >>= flip (foldM (uncurry . exportTypeOp ss')) (map resolveTypeOp reTypeOps)+ >>= flip (foldM (uncurry . exportTypeClass ss' ReExport)) (map resolveClass reClasses)+ >>= flip (foldM (uncurry . exportValue ss')) (map resolveValue reValues)+ >>= flip (foldM (uncurry . exportValueOp ss')) (map resolveValueOp reValueOps)+ elaborateModuleExports result _ = return result++ -- Extracts a list of values for a module based on a lookup table. If the+ -- boolean is true the values are filtered by the qualification+ extract+ :: SourceSpan+ -> Bool+ -> ModuleName+ -> (a -> Name)+ -> M.Map (Qualified a) [ImportRecord a]+ -> m [Qualified a]+ extract ss' useQual name toName = fmap (map (importName . head . snd)) . go . M.toList+ where+ go = filterM $ \(name', options) -> do+ let isMatch = if useQual then isQualifiedWith name name' else any (checkUnqual name') options+ when (isMatch && length options > 1) $ void $ checkImportConflicts ss' mn toName options+ return isMatch+ checkUnqual name' ir = isUnqualified name' && isQualifiedWith name (importName ir)++ -- Check whether a module name refers to a "pseudo module" that came into+ -- existence in an import scope due to importing one or more modules as+ -- qualified.+ isPseudoModule :: ModuleName -> Bool+ isPseudoModule = testQuals M.keys+ where+ -- Test for the presence of a `ModuleName` in a set of imports, using a+ -- function to either extract the keys or values. We test the keys to see if a+ -- value being re-exported belongs to a qualified module, and we test the+ -- values if that fails to see whether the value has been imported at all.+ testQuals :: (forall a b. M.Map (Qualified a) b -> [Qualified a]) -> ModuleName -> Bool+ testQuals f mn' = any (isQualifiedWith mn') (f (importedTypes imps))+ || any (isQualifiedWith mn') (f (importedTypeOps imps))+ || any (isQualifiedWith mn') (f (importedDataConstructors imps))+ || any (isQualifiedWith mn') (f (importedTypeClasses imps))+ || any (isQualifiedWith mn') (f (importedValues imps))+ || any (isQualifiedWith mn') (f (importedValueOps imps))+ || any (isQualifiedWith mn') (f (importedKinds imps))++ -- Check whether a module name refers to a module that has been imported+ -- without qualification into an import scope.+ isImportedModule :: ModuleName -> Bool+ isImportedModule = flip elem (importedModules imps)++ -- Constructs a list of types with their data constructors and the original+ -- module they were defined in from a list of type and data constructor names.+ resolveTypeExports+ :: [Qualified (ProperName 'TypeName)]+ -> [Qualified (ProperName 'ConstructorName)]+ -> [((ProperName 'TypeName, [ProperName 'ConstructorName]), ExportSource)]+ resolveTypeExports tctors dctors = map go tctors+ where+ go+ :: Qualified (ProperName 'TypeName)+ -> ((ProperName 'TypeName, [ProperName 'ConstructorName]), ExportSource)+ go (Qualified (ByModuleName mn'') name) =+ fromMaybe (internalError "Missing value in resolveTypeExports") $ do+ exps' <- envModuleExports <$> mn'' `M.lookup` env+ (dctors', src) <- name `M.lookup` exportedTypes exps'+ let relevantDctors = mapMaybe (disqualifyFor (Just mn'')) dctors+ return+ ( (name, relevantDctors `intersect` dctors')+ , src { exportSourceImportedFrom = Just mn'' }+ )+ go (Qualified _ _) = internalError "Unqualified value in resolveTypeExports"++ -- Looks up an imported type operator and re-qualifies it with the original+ -- module it came from.+ resolveTypeOp :: Qualified (OpName 'TypeOpName) -> (OpName 'TypeOpName, ExportSource)+ resolveTypeOp op+ = fromMaybe (internalError "Missing value in resolveValue")+ $ resolve exportedTypeOps op++ -- Looks up an imported class and re-qualifies it with the original module it+ -- came from.+ resolveClass :: Qualified (ProperName 'ClassName) -> (ProperName 'ClassName, ExportSource)+ resolveClass className+ = fromMaybe (internalError "Missing value in resolveClass")+ $ resolve exportedTypeClasses className++ -- Looks up an imported value and re-qualifies it with the original module it+ -- came from.+ resolveValue :: Qualified Ident -> (Ident, ExportSource)+ resolveValue ident+ = fromMaybe (internalError "Missing value in resolveValue")+ $ resolve exportedValues ident++ -- Looks up an imported operator and re-qualifies it with the original+ -- module it came from.+ resolveValueOp :: Qualified (OpName 'ValueOpName) -> (OpName 'ValueOpName, ExportSource)+ resolveValueOp op+ = fromMaybe (internalError "Missing value in resolveValueOp")+ $ resolve exportedValueOps op++ resolve+ :: Ord a+ => (Exports -> M.Map a ExportSource)+ -> Qualified a+ -> Maybe (a, ExportSource)+ resolve f (Qualified (ByModuleName mn'') a) = do+ exps' <- envModuleExports <$> mn'' `M.lookup` env+ src <- a `M.lookup` f exps'+ return (a, src { exportSourceImportedFrom = Just mn'' })+ resolve _ _ = internalError "Unqualified value in resolve"++-- |+-- Filters the full list of exportable values, types, and classes for a module+-- based on a list of export declaration references.+--+filterModule+ :: forall m+ . MonadError MultipleErrors m+ => ModuleName+ -> Exports+ -> [DeclarationRef]+ -> m Exports+filterModule mn exps refs = do+ types <- foldM filterTypes M.empty (combineTypeRefs refs)+ typeOps <- foldM (filterExport TyOpName getTypeOpRef exportedTypeOps) M.empty refs+ classes <- foldM (filterExport TyClassName getTypeClassRef exportedTypeClasses) M.empty refs+ values <- foldM (filterExport IdentName getValueRef exportedValues) M.empty refs+ valueOps <- foldM (filterExport ValOpName getValueOpRef exportedValueOps) M.empty refs+ return Exports+ { exportedTypes = types+ , exportedTypeOps = typeOps+ , exportedTypeClasses = classes+ , exportedValues = values+ , exportedValueOps = valueOps+ }++ where++ -- Takes the list of exported refs, filters out any non-TypeRefs, then+ -- combines any duplicate type exports to ensure that all constructors+ -- listed for the type are covered. Without this, only the data constructor+ -- listing for the last ref would be used.+ combineTypeRefs :: [DeclarationRef] -> [DeclarationRef]+ combineTypeRefs+ = fmap (\(ss', (tc, dcs)) -> TypeRef ss' tc dcs)+ . fmap (foldr1 $ \(ss, (tc, dcs1)) (_, (_, dcs2)) -> (ss, (tc, liftM2 (++) dcs1 dcs2)))+ . groupBy ((==) `on` (fst . snd))+ . sortOn (fst . snd)+ . mapMaybe (\ref -> (declRefSourceSpan ref,) <$> getTypeRef ref)++ filterTypes+ :: M.Map (ProperName 'TypeName) ([ProperName 'ConstructorName], ExportSource)+ -> DeclarationRef+ -> m (M.Map (ProperName 'TypeName) ([ProperName 'ConstructorName], ExportSource))+ filterTypes result (TypeRef ss name expDcons) =+ case name `M.lookup` exportedTypes exps of+ Nothing -> throwError . errorMessage' ss . UnknownExport $ TyName name+ Just (dcons, src) -> do+ let expDcons' = fromMaybe dcons expDcons+ traverse_ (checkDcon name dcons) expDcons'+ return $ M.insert name (expDcons', src) result+ where+ -- Ensures a data constructor is exportable for a given type. Takes a type+ -- name, a list of exportable data constructors for the type, and the name of+ -- the data constructor to check.+ checkDcon+ :: ProperName 'TypeName+ -> [ProperName 'ConstructorName]+ -> ProperName 'ConstructorName+ -> m ()+ checkDcon tcon dcons dcon =+ unless (dcon `elem` dcons) .+ throwError . errorMessage' ss $ UnknownExportDataConstructor tcon dcon+ filterTypes result _ = return result++ filterExport+ :: Ord a+ => (a -> Name)+ -> (DeclarationRef -> Maybe a)+ -> (Exports -> M.Map a ExportSource)+ -> M.Map a ExportSource+ -> DeclarationRef+ -> m (M.Map a ExportSource)+ filterExport toName get fromExps result ref+ | Just name <- get ref =+ case name `M.lookup` fromExps exps of+ -- TODO: I'm not sure if we actually need to check that these modules+ -- are the same here -gb+ Just source' | mn == exportSourceDefinedIn source' ->+ return $ M.insert name source' result+ _ ->+ throwError . errorMessage' (declRefSourceSpan ref) . UnknownExport $ toName name+ filterExport _ _ _ result _ = return result
+ src/Language/PureScript/Sugar/Names/Imports.hs view
@@ -0,0 +1,229 @@+module Language.PureScript.Sugar.Names.Imports+ ( ImportDef+ , resolveImports+ , resolveModuleImport+ , findImports+ ) where++import Prelude++import Control.Monad (foldM, when)+import Control.Monad.Error.Class (MonadError(..))++import Data.Foldable (for_, traverse_)+import Data.Maybe (fromMaybe)+import Data.Map qualified as M+import Data.Set qualified as S++import Language.PureScript.AST (Declaration(..), DeclarationRef(..), ErrorMessageHint(..), ExportSource(..), ImportDeclarationType(..), Module(..), SourceSpan, internalModuleSourceSpan)+import Language.PureScript.Crash (internalError)+import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage(..), addHint, errorMessage', rethrow)+import Language.PureScript.Names (pattern ByNullSourcePos, ModuleName, Name(..), ProperName, ProperNameType(..), Qualified(..), QualifiedBy(..), byMaybeModuleName)+import Language.PureScript.Sugar.Names.Env (Env, Exports(..), ImportProvenance(..), ImportRecord(..), Imports(..), envModuleExports, nullImports)++type ImportDef = (SourceSpan, ImportDeclarationType, Maybe ModuleName)++-- |+-- Finds the imports within a module, mapping the imported module name to an optional set of+-- explicitly imported declarations.+--+findImports+ :: [Declaration]+ -> M.Map ModuleName [ImportDef]+findImports = foldr go M.empty+ where+ go (ImportDeclaration (pos, _) mn typ qual) =+ M.alter (return . ((pos, typ, qual) :) . fromMaybe []) mn+ go _ = id++-- |+-- Constructs a set of imports for a module.+--+resolveImports+ :: forall m+ . MonadError MultipleErrors m+ => Env+ -> Module+ -> m (Module, Imports)+resolveImports env (Module ss coms currentModule decls exps) =+ rethrow (addHint (ErrorInModule currentModule)) $ do+ let imports = findImports decls+ imports' = M.map (map (\(ss', dt, mmn) -> (ss', Just dt, mmn))) imports+ scope = M.insert currentModule [(internalModuleSourceSpan "<module>", Nothing, Nothing)] imports'+ (Module ss coms currentModule decls exps,) <$>+ foldM (resolveModuleImport env) nullImports (M.toList scope)++-- | Constructs a set of imports for a single module import.+resolveModuleImport+ :: forall m+ . MonadError MultipleErrors m+ => Env+ -> Imports+ -> (ModuleName, [(SourceSpan, Maybe ImportDeclarationType, Maybe ModuleName)])+ -> m Imports+resolveModuleImport env ie (mn, imps) = foldM go ie imps+ where+ go :: Imports+ -> (SourceSpan, Maybe ImportDeclarationType, Maybe ModuleName)+ -> m Imports+ go ie' (ss, typ, impQual) = do+ modExports <-+ maybe+ (throwError . errorMessage' ss . UnknownName . Qualified ByNullSourcePos $ ModName mn)+ (return . envModuleExports)+ (mn `M.lookup` env)+ let impModules = importedModules ie'+ qualModules = importedQualModules ie'+ ie'' = ie' { importedModules = maybe (S.insert mn impModules) (const impModules) impQual+ , importedQualModules = maybe qualModules (`S.insert` qualModules) impQual+ }+ resolveImport mn modExports ie'' impQual ss typ++-- |+-- Extends the local environment for a module by resolving an import of another module.+--+resolveImport+ :: forall m+ . MonadError MultipleErrors m+ => ModuleName+ -> Exports+ -> Imports+ -> Maybe ModuleName+ -> SourceSpan+ -> Maybe ImportDeclarationType+ -> m Imports+resolveImport importModule exps imps impQual = resolveByType+ where++ resolveByType :: SourceSpan -> Maybe ImportDeclarationType -> m Imports+ resolveByType ss Nothing =+ importAll ss (importRef Local)+ resolveByType ss (Just Implicit) =+ importAll ss (importRef FromImplicit)+ resolveByType _ (Just (Explicit refs)) =+ checkRefs False refs >> foldM (importRef FromExplicit) imps refs+ resolveByType ss (Just (Hiding refs)) =+ checkRefs True refs >> importAll ss (importNonHidden refs)++ -- Check that a 'DeclarationRef' refers to an importable symbol+ checkRefs :: Bool -> [DeclarationRef] -> m ()+ checkRefs isHiding = traverse_ check+ where+ check (ValueRef ss name) =+ checkImportExists ss IdentName (exportedValues exps) name+ check (ValueOpRef ss op) =+ checkImportExists ss ValOpName (exportedValueOps exps) op+ check (TypeRef ss name dctors) = do+ checkImportExists ss TyName (exportedTypes exps) name+ let (allDctors, _) = allExportedDataConstructors name+ for_ dctors $ traverse_ (checkDctorExists ss name allDctors)+ check (TypeOpRef ss name) =+ checkImportExists ss TyOpName (exportedTypeOps exps) name+ check (TypeClassRef ss name) =+ checkImportExists ss TyClassName (exportedTypeClasses exps) name+ check (ModuleRef ss name) | isHiding =+ throwError . errorMessage' ss $ ImportHidingModule name+ check r = internalError $ "Invalid argument to checkRefs: " ++ show r++ -- Check that an explicitly imported item exists in the module it is being imported from+ checkImportExists+ :: Ord a+ => SourceSpan+ -> (a -> Name)+ -> M.Map a b+ -> a+ -> m ()+ checkImportExists ss toName exports item+ = when (item `M.notMember` exports)+ . throwError . errorMessage' ss+ $ UnknownImport importModule (toName item)++ -- Ensure that an explicitly imported data constructor exists for the type it is being imported+ -- from+ checkDctorExists+ :: SourceSpan+ -> ProperName 'TypeName+ -> [ProperName 'ConstructorName]+ -> ProperName 'ConstructorName+ -> m ()+ checkDctorExists ss tcon exports dctor+ = when (dctor `notElem` exports)+ . throwError . errorMessage' ss+ $ UnknownImportDataConstructor importModule tcon dctor++ importNonHidden :: [DeclarationRef] -> Imports -> DeclarationRef -> m Imports+ importNonHidden hidden m ref | isHidden ref = return m+ | otherwise = importRef FromImplicit m ref+ where+ -- TODO: rework this to be not confusing+ isHidden :: DeclarationRef -> Bool+ isHidden ref'@TypeRef{} = foldl (checkTypeRef ref') False hidden+ isHidden ref' = ref' `elem` hidden+ checkTypeRef :: DeclarationRef -> Bool -> DeclarationRef -> Bool+ checkTypeRef _ True _ = True+ checkTypeRef (TypeRef _ _ Nothing) acc (TypeRef _ _ (Just _)) = acc+ checkTypeRef (TypeRef _ name (Just dctor)) _ (TypeRef _ name' (Just dctor')) = name == name' && dctor == dctor'+ checkTypeRef (TypeRef _ name _) _ (TypeRef _ name' Nothing) = name == name'+ checkTypeRef _ acc _ = acc++ -- Import all symbols+ importAll :: SourceSpan -> (Imports -> DeclarationRef -> m Imports) -> m Imports+ importAll ss importer =+ foldM (\m (name, (dctors, _)) -> importer m (TypeRef ss name (Just dctors))) imps (M.toList (exportedTypes exps))+ >>= flip (foldM (\m (name, _) -> importer m (TypeOpRef ss name))) (M.toList (exportedTypeOps exps))+ >>= flip (foldM (\m (name, _) -> importer m (ValueRef ss name))) (M.toList (exportedValues exps))+ >>= flip (foldM (\m (name, _) -> importer m (ValueOpRef ss name))) (M.toList (exportedValueOps exps))+ >>= flip (foldM (\m (name, _) -> importer m (TypeClassRef ss name))) (M.toList (exportedTypeClasses exps))++ importRef :: ImportProvenance -> Imports -> DeclarationRef -> m Imports+ importRef prov imp (ValueRef ss name) = do+ let values' = updateImports (importedValues imp) (exportedValues exps) id name ss prov+ return $ imp { importedValues = values' }+ importRef prov imp (ValueOpRef ss name) = do+ let valueOps' = updateImports (importedValueOps imp) (exportedValueOps exps) id name ss prov+ return $ imp { importedValueOps = valueOps' }+ importRef prov imp (TypeRef ss name dctors) = do+ let types' = updateImports (importedTypes imp) (exportedTypes exps) snd name ss prov+ let (dctorNames, src) = allExportedDataConstructors name+ dctorLookup :: M.Map (ProperName 'ConstructorName) ExportSource+ dctorLookup = M.fromList $ map (, src) dctorNames+ traverse_ (traverse_ $ checkDctorExists ss name dctorNames) dctors+ let dctors' = foldl (\m d -> updateImports m dctorLookup id d ss prov) (importedDataConstructors imp) (fromMaybe dctorNames dctors)+ return $ imp { importedTypes = types', importedDataConstructors = dctors' }+ importRef prov imp (TypeOpRef ss name) = do+ let ops' = updateImports (importedTypeOps imp) (exportedTypeOps exps) id name ss prov+ return $ imp { importedTypeOps = ops' }+ importRef prov imp (TypeClassRef ss name) = do+ let typeClasses' = updateImports (importedTypeClasses imp) (exportedTypeClasses exps) id name ss prov+ return $ imp { importedTypeClasses = typeClasses' }+ importRef _ _ TypeInstanceRef{} = internalError "TypeInstanceRef in importRef"+ importRef _ _ ModuleRef{} = internalError "ModuleRef in importRef"+ importRef _ _ ReExportRef{} = internalError "ReExportRef in importRef"++ -- Find all exported data constructors for a given type+ allExportedDataConstructors+ :: ProperName 'TypeName+ -> ([ProperName 'ConstructorName], ExportSource)+ allExportedDataConstructors name =+ fromMaybe (internalError "Invalid state in allExportedDataConstructors")+ $ name `M.lookup` exportedTypes exps++ -- Add something to an import resolution list+ updateImports+ :: Ord a+ => M.Map (Qualified a) [ImportRecord a]+ -> M.Map a b+ -> (b -> ExportSource)+ -> a+ -> SourceSpan+ -> ImportProvenance+ -> M.Map (Qualified a) [ImportRecord a]+ updateImports imps' exps' expName name ss prov =+ let+ src = maybe (internalError "Invalid state in updateImports") expName (name `M.lookup` exps')+ rec = ImportRecord (Qualified (ByModuleName importModule) name) (exportSourceDefinedIn src) ss prov+ in+ M.alter+ (\currNames -> Just $ rec : fromMaybe [] currNames)+ (Qualified (byMaybeModuleName impQual) name)+ imps'
src/Language/PureScript/Sugar/ObjectWildcards.hs view
@@ -1,65 +1,101 @@------------------------------------------------------------------------------------ Module : Language.PureScript.Sugar.ObjectWildcards--- Copyright : (c) 2013-14 Phil Freeman, (c) 2014 Gary Burgess, and other contributors--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>, Gary Burgess <gary.burgess@gmail.com>--- Stability : experimental--- Portability :------ |---------------------------------------------------------------------------------+module Language.PureScript.Sugar.ObjectWildcards+ ( desugarObjectConstructors+ , desugarDecl+ ) where -{-# LANGUAGE FlexibleContexts #-}-{-# LANGUAGE ScopedTypeVariables #-}+import Prelude -module Language.PureScript.Sugar.ObjectWildcards (- desugarObjectConstructors-) where+import Control.Monad (forM)+import Control.Monad.Error.Class (MonadError(..))+import Control.Monad.Supply.Class (MonadSupply)+import Data.Foldable (toList)+import Data.List (foldl')+import Data.Maybe (catMaybes)+import Language.PureScript.AST+import Language.PureScript.Environment (NameKind(..))+import Language.PureScript.Errors (MultipleErrors, rethrowWithPosition)+import Language.PureScript.Names (pattern ByNullSourcePos, Ident, Qualified(..), freshIdent')+import Language.PureScript.PSString (PSString) -import Control.Applicative-import Control.Arrow (second)-import Control.Monad.Error.Class-import Control.Monad.Supply.Class -import Data.List (partition)-import Data.Maybe (isJust, fromJust, catMaybes)--import Language.PureScript.AST-import Language.PureScript.Errors-import Language.PureScript.Names+desugarObjectConstructors+ :: forall m+ . (MonadSupply m, MonadError MultipleErrors m)+ => Module+ -> m Module+desugarObjectConstructors (Module ss coms mn ds exts) = Module ss coms mn <$> mapM desugarDecl ds <*> pure exts -desugarObjectConstructors :: forall m. (Applicative m, MonadSupply m, MonadError MultipleErrors m) => Module -> m Module-desugarObjectConstructors (Module coms mn ds exts) = Module coms mn <$> mapM desugarDecl ds <*> pure exts+desugarDecl :: forall m. (MonadSupply m, MonadError MultipleErrors m) => Declaration -> m Declaration+desugarDecl d = rethrowWithPosition (declSourceSpan d) $ fn d where-- desugarDecl :: Declaration -> m Declaration- (desugarDecl, _, _) = everywhereOnValuesM return desugarExpr return+ (fn, _, _) = everywhereOnValuesTopDownM return desugarExpr return desugarExpr :: Expr -> m Expr- desugarExpr (ObjectConstructor ps) = wrapLambda ObjectLiteral ps- desugarExpr (ObjectUpdater (Just obj) ps) = wrapLambda (ObjectUpdate obj) ps- desugarExpr (ObjectUpdater Nothing ps) = do- obj <- Ident <$> freshName- Abs (Left obj) <$> wrapLambda (ObjectUpdate (Var (Qualified Nothing obj))) ps- desugarExpr (ObjectGetter prop) = do- arg <- Ident <$> freshName- return $ Abs (Left arg) (Accessor prop (Var (Qualified Nothing arg)))+ desugarExpr (Literal ss (ObjectLiteral ps)) = wrapLambdaAssoc (Literal ss . ObjectLiteral) ps+ desugarExpr (ObjectUpdateNested obj ps) = transformNestedUpdate obj ps+ desugarExpr (Accessor prop u)+ | Just props <- peelAnonAccessorChain u = do+ arg <- freshIdent'+ return $ Abs (VarBinder nullSourceSpan arg) $ foldr Accessor (argToExpr arg) (prop:props)+ desugarExpr (Case args cas) | any isAnonymousArgument args = do+ argIdents <- forM args freshIfAnon+ let args' = zipWith (`maybe` argToExpr) args argIdents+ return $ foldr (Abs . VarBinder nullSourceSpan) (Case args' cas) (catMaybes argIdents)+ desugarExpr (IfThenElse u t f) | any isAnonymousArgument [u, t, f] = do+ u' <- freshIfAnon u+ t' <- freshIfAnon t+ f' <- freshIfAnon f+ let if_ = IfThenElse (maybe u argToExpr u') (maybe t argToExpr t') (maybe f argToExpr f')+ return $ foldr (Abs . VarBinder nullSourceSpan) if_ (catMaybes [u', t', f']) desugarExpr e = return e - wrapLambda :: ([(String, Expr)] -> Expr) -> [(String, Maybe Expr)] -> m Expr- wrapLambda mkVal ps =- let (props, args) = partition (isJust . snd) ps- in if null args- then return . mkVal $ second fromJust `map` props- else do- (args', ps') <- unzip <$> mapM mkProp ps- return $ foldr (Abs . Left) (mkVal ps') (catMaybes args')+ transformNestedUpdate :: Expr -> PathTree Expr -> m Expr+ transformNestedUpdate obj ps = do+ -- If we don't have an anonymous argument then we need to generate a let wrapper+ -- so that the object expression isn't re-evaluated for each nested update.+ val <- freshIdent'+ let valExpr = argToExpr val+ if isAnonymousArgument obj+ then Abs (VarBinder nullSourceSpan val) <$> wrapLambda (buildUpdates valExpr) ps+ else wrapLambda (buildLet val . buildUpdates valExpr) ps+ where+ buildLet val = Let FromLet [ValueDecl (declSourceSpan d, []) val Public [] [MkUnguarded obj]] - mkProp :: (String, Maybe Expr) -> m (Maybe Ident, (String, Expr))- mkProp (name, Just e) = return (Nothing, (name, e))- mkProp (name, Nothing) = do- arg <- Ident <$> freshName- return (Just arg, (name, Var (Qualified Nothing arg)))+ -- recursively build up the nested `ObjectUpdate` expressions+ buildUpdates :: Expr -> PathTree Expr -> Expr+ buildUpdates val (PathTree vs) = ObjectUpdate val (goLayer [] <$> runAssocList vs) where+ goLayer :: [PSString] -> (PSString, PathNode Expr) -> (PSString, Expr)+ goLayer _ (key, Leaf expr) = (key, expr)+ goLayer path (key, Branch (PathTree branch)) =+ let path' = path ++ [key]+ updates = goLayer path' <$> runAssocList branch+ accessor = foldl' (flip Accessor) val path'+ objectUpdate = ObjectUpdate accessor updates+ in (key, objectUpdate)++ wrapLambda :: forall t. Traversable t => (t Expr -> Expr) -> t Expr -> m Expr+ wrapLambda mkVal ps = do+ args <- traverse processExpr ps+ return $ foldr (Abs . VarBinder nullSourceSpan) (mkVal (snd <$> args)) (catMaybes $ toList (fst <$> args))+ where+ processExpr :: Expr -> m (Maybe Ident, Expr)+ processExpr e = do+ arg <- freshIfAnon e+ return (arg, maybe e argToExpr arg)++ wrapLambdaAssoc :: ([(PSString, Expr)] -> Expr) -> [(PSString, Expr)] -> m Expr+ wrapLambdaAssoc mkVal = wrapLambda (mkVal . runAssocList) . AssocList++ peelAnonAccessorChain :: Expr -> Maybe [PSString]+ peelAnonAccessorChain (Accessor p e) = (p :) <$> peelAnonAccessorChain e+ peelAnonAccessorChain (PositionedValue _ _ e) = peelAnonAccessorChain e+ peelAnonAccessorChain AnonymousArgument = Just []+ peelAnonAccessorChain _ = Nothing++ freshIfAnon :: Expr -> m (Maybe Ident)+ freshIfAnon u+ | isAnonymousArgument u = Just <$> freshIdent'+ | otherwise = return Nothing++ argToExpr :: Ident -> Expr+ argToExpr = Var nullSourceSpan . Qualified ByNullSourcePos
src/Language/PureScript/Sugar/Operators.hs view
@@ -1,13 +1,3 @@------------------------------------------------------------------------------------ Module : Language.PureScript.Sugar.Operators--- Copyright : (c) Phil Freeman 2013--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :--- -- | -- This module implements the desugaring pass which reapplies binary operators based -- on their fixity data and removes explicit parentheses.@@ -15,152 +5,489 @@ -- The value parser ignores fixity data when parsing binary operator applications, so -- it is necessary to reorder them here. ----------------------------------------------------------------------------------{-# LANGUAGE Rank2Types #-}-{-# LANGUAGE FlexibleContexts #-}-{-# LANGUAGE ScopedTypeVariables #-}+module Language.PureScript.Sugar.Operators+ ( desugarSignedLiterals+ , RebracketCaller(..)+ , rebracket+ , rebracketFiltered+ , checkFixityExports+ ) where -module Language.PureScript.Sugar.Operators (- rebracket,- removeSignedLiterals,- desugarOperatorSections-) where+import Prelude import Language.PureScript.AST-import Language.PureScript.Errors-import Language.PureScript.Names+import Language.PureScript.Crash (internalError)+import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage(..), addHint, errorMessage, errorMessage', parU, rethrow, rethrowWithPosition)+import Language.PureScript.Externs (ExternsFile(..), ExternsFixity(..), ExternsTypeFixity(..))+import Language.PureScript.Names (pattern ByNullSourcePos, Ident(..), Name(..), OpName, OpNameType(..), ProperName, ProperNameType(..), Qualified(..), QualifiedBy(..), freshIdent')+import Language.PureScript.Sugar.Operators.Binders (matchBinderOperators)+import Language.PureScript.Sugar.Operators.Expr (matchExprOperators)+import Language.PureScript.Sugar.Operators.Types (matchTypeOperators)+import Language.PureScript.Traversals (defS, sndM)+import Language.PureScript.Types (Constraint(..), SourceType, Type(..), everywhereOnTypesTopDownM, overConstraintArgs) -import Control.Applicative-import Control.Monad.State-import Control.Monad.Except-import Control.Monad.Supply.Class+import Control.Monad (unless, (<=<))+import Control.Monad.Error.Class (MonadError(..))+import Control.Monad.Supply.Class (MonadSupply) +import Data.Either (partitionEithers)+import Data.Foldable (for_, traverse_) import Data.Function (on)-import Data.Functor.Identity-import Data.List (groupBy, sortBy)+import Data.Functor (($>))+import Data.Functor.Identity (Identity(..), runIdentity)+import Data.List (groupBy, sortOn)+import Data.Maybe (mapMaybe, listToMaybe)+import Data.Map qualified as M+import Data.Ord (Down(..)) -import qualified Text.Parsec as P-import qualified Text.Parsec.Pos as P-import qualified Text.Parsec.Expr as P+import Language.PureScript.Constants.Libs qualified as C -import qualified Language.PureScript.Constants as C+-- |+-- Removes unary negation operators and replaces them with calls to `negate`.+--+desugarSignedLiterals :: Module -> Module+desugarSignedLiterals (Module ss coms mn ds exts) =+ Module ss coms mn (map f' ds) exts+ where+ (f', _, _) = everywhereOnValues id go id+ go (UnaryMinus ss' val) = App (Var ss' (Qualified ByNullSourcePos (Ident C.S_negate))) val+ go other = other -- |--- Remove explicit parentheses and reorder binary operator applications+-- An operator associated with its declaration position, fixity, and the name+-- of the function or data constructor it is an alias for. ---rebracket :: (Applicative m, MonadError MultipleErrors m) => [Module] -> m [Module]-rebracket ms = do- let fixities = concatMap collectFixities ms- ensureNoDuplicates $ map (\(i, pos, _) -> (i, pos)) fixities- let opTable = customOperatorTable $ map (\(i, _, f) -> (i, f)) fixities- mapM (rebracketModule opTable) ms+type FixityRecord op alias = (Qualified op, SourceSpan, Fixity, Qualified alias)+type ValueFixityRecord = FixityRecord (OpName 'ValueOpName) (Either Ident (ProperName 'ConstructorName))+type TypeFixityRecord = FixityRecord (OpName 'TypeOpName) (ProperName 'TypeName) -removeSignedLiterals :: Module -> Module-removeSignedLiterals (Module coms mn ds exts) = Module coms mn (map f' ds) exts+-- |+-- Remove explicit parentheses and reorder binary operator applications.+--+-- This pass requires name desugaring and export elaboration to have run first.+--+rebracket+ :: forall m+ . MonadError MultipleErrors m+ => MonadSupply m+ => [ExternsFile]+ -> Module+ -> m Module+rebracket =+ rebracketFiltered CalledByCompile (const True)++-- |+-- A version of `rebracket` which allows you to choose which declarations+-- should be affected. This is used in docs generation, where we want to+-- desugar type operators in instance declarations to ensure that instances are+-- paired up with their types correctly, but we don't want to desugar type+-- operators in value declarations.+--+rebracketFiltered+ :: forall m+ . MonadError MultipleErrors m+ => MonadSupply m+ => RebracketCaller+ -> (Declaration -> Bool)+ -> [ExternsFile]+ -> Module+ -> m Module+rebracketFiltered !caller pred_ externs m = do+ let (valueFixities, typeFixities) =+ partitionEithers+ $ concatMap externsFixities externs+ ++ collectFixities m++ ensureNoDuplicates' MultipleValueOpFixities valueFixities+ ensureNoDuplicates' MultipleTypeOpFixities typeFixities++ let valueOpTable = customOperatorTable' valueFixities+ let valueAliased = M.fromList (map makeLookupEntry valueFixities)+ let typeOpTable = customOperatorTable' typeFixities+ let typeAliased = M.fromList (map makeLookupEntry typeFixities)++ rebracketModule caller pred_ valueOpTable typeOpTable m >>=+ renameAliasedOperators valueAliased typeAliased+ where- (f', _, _) = everywhereOnValues id go id - go (UnaryMinus val) = App (Var (Qualified (Just (ModuleName [ProperName C.prelude])) (Ident C.negate))) val- go other = other+ ensureNoDuplicates'+ :: Ord op+ => (op -> SimpleErrorMessage)+ -> [FixityRecord op alias]+ -> m ()+ ensureNoDuplicates' toError =+ ensureNoDuplicates toError . map (\(i, pos, _, _) -> (i, pos)) -rebracketModule :: (Applicative m, MonadError MultipleErrors m) => [[(Qualified Ident, Expr -> Expr -> Expr, Associativity)]] -> Module -> m Module-rebracketModule opTable (Module coms mn ds exts) =- let (f, _, _) = everywhereOnValuesTopDownM return (matchOperators opTable) return- in Module coms mn <$> (map removeParens <$> parU ds f) <*> pure exts+ customOperatorTable'+ :: [FixityRecord op alias]+ -> [[(Qualified op, Associativity)]]+ customOperatorTable' = customOperatorTable . map (\(i, _, f, _) -> (i, f)) + makeLookupEntry :: FixityRecord op alias -> (Qualified op, Qualified alias)+ makeLookupEntry (qname, _, _, alias) = (qname, alias)++ renameAliasedOperators+ :: M.Map (Qualified (OpName 'ValueOpName)) (Qualified (Either Ident (ProperName 'ConstructorName)))+ -> M.Map (Qualified (OpName 'TypeOpName)) (Qualified (ProperName 'TypeName))+ -> Module+ -> m Module+ renameAliasedOperators valueAliased typeAliased (Module ss coms mn ds exts) =+ Module ss coms mn <$> mapM (usingPredicate pred_ f') ds <*> pure exts+ where+ (goDecl', goExpr', goBinder') = updateTypes goType+ (f', _, _, _, _, _) =+ everywhereWithContextOnValuesM+ ss+ (\_ d -> (declSourceSpan d,) <$> goDecl' d)+ (\pos -> uncurry goExpr <=< goExpr' pos)+ (\pos -> uncurry goBinder <=< goBinder' pos)+ defS+ defS+ defS++ goExpr :: SourceSpan -> Expr -> m (SourceSpan, Expr)+ goExpr _ e@(PositionedValue pos _ _) = return (pos, e)+ goExpr _ (Op pos op) =+ (pos,) <$> case op `M.lookup` valueAliased of+ Just (Qualified mn' (Left alias)) ->+ return $ Var pos (Qualified mn' alias)+ Just (Qualified mn' (Right alias)) ->+ return $ Constructor pos (Qualified mn' alias)+ Nothing ->+ throwError . errorMessage' pos . UnknownName $ fmap ValOpName op+ goExpr pos other = return (pos, other)++ goBinder :: SourceSpan -> Binder -> m (SourceSpan, Binder)+ goBinder _ b@(PositionedBinder pos _ _) = return (pos, b)+ goBinder _ (BinaryNoParensBinder (OpBinder pos op) lhs rhs) =+ case op `M.lookup` valueAliased of+ Just (Qualified mn' (Left alias)) ->+ throwError . errorMessage' pos $ InvalidOperatorInBinder op (Qualified mn' alias)+ Just (Qualified mn' (Right alias)) ->+ return (pos, ConstructorBinder pos (Qualified mn' alias) [lhs, rhs])+ Nothing ->+ throwError . errorMessage' pos . UnknownName $ fmap ValOpName op+ goBinder _ BinaryNoParensBinder{} =+ internalError "BinaryNoParensBinder has no OpBinder"+ goBinder pos other = return (pos, other)++ goType :: SourceSpan -> SourceType -> m SourceType+ goType pos (TypeOp ann2 op) =+ case op `M.lookup` typeAliased of+ Just alias ->+ return $ TypeConstructor ann2 alias+ Nothing ->+ throwError . errorMessage' pos $ UnknownName $ fmap TyOpName op+ goType _ other = return other++-- | Indicates whether the `rebracketModule`+-- is being called with the full desugar pass+-- run via `purs compile` or whether+-- only the partial desugar pass is run+-- via `purs docs`.+-- This indication is needed to prevent+-- a `purs docs` error when using+-- `case _ of` syntax in a type class instance.+data RebracketCaller+ = CalledByCompile+ | CalledByDocs+ deriving (Eq, Show)++rebracketModule+ :: forall m+ . (MonadError MultipleErrors m)+ => MonadSupply m+ => RebracketCaller+ -> (Declaration -> Bool)+ -> [[(Qualified (OpName 'ValueOpName), Associativity)]]+ -> [[(Qualified (OpName 'TypeOpName), Associativity)]]+ -> Module+ -> m Module+rebracketModule !caller pred_ valueOpTable typeOpTable (Module ss coms mn ds exts) =+ Module ss coms mn <$> f' ds <*> pure exts+ where+ f' :: [Declaration] -> m [Declaration]+ f' =+ fmap (map (\d -> if pred_ d then removeParens d else d)) .+ flip parU (usingPredicate pred_ h)++ -- The AST will run through all the desugar passes when compiling+ -- and only some of the desugar passes when generating docs.+ -- When generating docs, `case _ of` syntax used in an instance declaration+ -- can trigger the `IncorrectAnonymousArgument` error because it does not+ -- run the same passes that the compile desugaring does. Since `purs docs`+ -- will only succeed once `purs compile` succeeds, we can ignore this check+ -- when running `purs docs`.+ -- See https://github.com/purescript/purescript/issues/4274#issuecomment-1087730651=+ -- for more info.+ h :: Declaration -> m Declaration+ h = case caller of+ CalledByDocs -> f+ CalledByCompile -> g <=< f++ (f, _, _, _, _, _) =+ everywhereWithContextOnValuesM+ ss+ (\_ d -> (declSourceSpan d,) <$> goDecl d)+ (\pos -> wrap (matchExprOperators valueOpTable) <=< goExpr' pos)+ (\pos -> wrap (matchBinderOperators valueOpTable) <=< goBinder' pos)+ defS+ defS+ defS++ (g, _, _) = everywhereOnValuesTopDownM pure removeBinaryNoParens pure++ (goDecl, goExpr', goBinder') = updateTypes goType++ goType :: SourceSpan -> SourceType -> m SourceType+ goType = flip matchTypeOperators typeOpTable++ wrap :: (a -> m a) -> (SourceSpan, a) -> m (SourceSpan, a)+ wrap go (ss', a) = (ss',) <$> go a++removeBinaryNoParens :: (MonadError MultipleErrors m, MonadSupply m) => Expr -> m Expr+removeBinaryNoParens u+ | isAnonymousArgument u = case u of+ PositionedValue p _ _ -> rethrowWithPosition p err+ _ -> err+ where err = throwError . errorMessage $ IncorrectAnonymousArgument+removeBinaryNoParens (Parens (stripPositionInfo -> BinaryNoParens op l r))+ | isAnonymousArgument r = do arg <- freshIdent'+ return $ Abs (VarBinder nullSourceSpan arg) $ App (App op l) (Var nullSourceSpan (Qualified ByNullSourcePos arg))+ | isAnonymousArgument l = do arg <- freshIdent'+ return $ Abs (VarBinder nullSourceSpan arg) $ App (App op (Var nullSourceSpan (Qualified ByNullSourcePos arg))) r+removeBinaryNoParens (BinaryNoParens op l r) = return $ App (App op l) r+removeBinaryNoParens e = return e++stripPositionInfo :: Expr -> Expr+stripPositionInfo (PositionedValue _ _ e) = stripPositionInfo e+stripPositionInfo e = e+ removeParens :: Declaration -> Declaration-removeParens =- let (f, _, _) = everywhereOnValues id go id- in f+removeParens = f where- go (Parens val) = val- go val = val+ (f, _, _) =+ everywhereOnValues+ (runIdentity . goDecl)+ (goExpr . decontextify goExpr')+ (goBinder . decontextify goBinder') -collectFixities :: Module -> [(Qualified Ident, SourceSpan, Fixity)]-collectFixities (Module _ moduleName ds _) = concatMap collect ds+ (goDecl, goExpr', goBinder') = updateTypes (\_ -> return . goType)++ goExpr :: Expr -> Expr+ goExpr (Parens val) = goExpr val+ goExpr val = val++ goBinder :: Binder -> Binder+ goBinder (ParensInBinder b) = goBinder b+ goBinder b = b++ goType :: Type a -> Type a+ goType (ParensInType _ t) = goType t+ goType t = t++ decontextify+ :: (SourceSpan -> a -> Identity (SourceSpan, a))+ -> a+ -> a+ decontextify ctxf = snd . runIdentity . ctxf (internalError "attempted to use SourceSpan in removeParens")++externsFixities :: ExternsFile -> [Either ValueFixityRecord TypeFixityRecord]+externsFixities ExternsFile{..} =+ map fromFixity efFixities ++ map fromTypeFixity efTypeFixities where- collect :: Declaration -> [(Qualified Ident, SourceSpan, Fixity)]- collect (PositionedDeclaration pos _ (FixityDeclaration fixity name)) = [(Qualified (Just moduleName) (Op name), pos, fixity)]- collect FixityDeclaration{} = error "Fixity without srcpos info"++ fromFixity+ :: ExternsFixity+ -> Either ValueFixityRecord TypeFixityRecord+ fromFixity (ExternsFixity assoc prec op name) =+ Left+ ( Qualified (ByModuleName efModuleName) op+ , internalModuleSourceSpan ""+ , Fixity assoc prec+ , name+ )++ fromTypeFixity+ :: ExternsTypeFixity+ -> Either ValueFixityRecord TypeFixityRecord+ fromTypeFixity (ExternsTypeFixity assoc prec op name) =+ Right+ ( Qualified (ByModuleName efModuleName) op+ , internalModuleSourceSpan ""+ , Fixity assoc prec+ , name+ )++collectFixities :: Module -> [Either ValueFixityRecord TypeFixityRecord]+collectFixities (Module _ _ moduleName ds _) = concatMap collect ds+ where+ collect :: Declaration -> [Either ValueFixityRecord TypeFixityRecord]+ collect (ValueFixityDeclaration (ss, _) fixity name op) =+ [Left (Qualified (ByModuleName moduleName) op, ss, fixity, name)]+ collect (TypeFixityDeclaration (ss, _) fixity name op) =+ [Right (Qualified (ByModuleName moduleName) op, ss, fixity, name)] collect _ = [] -ensureNoDuplicates :: (MonadError MultipleErrors m) => [(Qualified Ident, SourceSpan)] -> m ()-ensureNoDuplicates m = go $ sortBy (compare `on` fst) m+ensureNoDuplicates+ :: (Ord a, MonadError MultipleErrors m)+ => (a -> SimpleErrorMessage)+ -> [(Qualified a, SourceSpan)]+ -> m ()+ensureNoDuplicates toError m = go $ sortOn fst m where go [] = return () go [_] = return ()- go ((x@(Qualified (Just mn) name), _) : (y, pos) : _) | x == y =- rethrow (onErrorMessages (ErrorInModule mn)) $- rethrowWithPosition pos $- throwError . errorMessage $ MultipleFixities name+ go ((x@(Qualified (ByModuleName mn) op), _) : (y, pos) : _) | x == y =+ rethrow (addHint (ErrorInModule mn)) $+ rethrowWithPosition pos $ throwError . errorMessage $ toError op go (_ : rest) = go rest -customOperatorTable :: [(Qualified Ident, Fixity)] -> [[(Qualified Ident, Expr -> Expr -> Expr, Associativity)]]+customOperatorTable+ :: [(Qualified op, Fixity)]+ -> [[(Qualified op, Associativity)]] customOperatorTable fixities = let- applyUserOp ident t1 = App (App (Var ident) t1)- userOps = map (\(name, Fixity a p) -> (name, applyUserOp name, p, a)) fixities- sorted = sortBy (flip compare `on` (\(_, _, p, _) -> p)) userOps- groups = groupBy ((==) `on` (\(_, _, p, _) -> p)) sorted+ userOps = map (\(name, Fixity a p) -> (name, p, a)) fixities+ sorted = sortOn (Down . (\(_, p, _) -> p)) userOps+ groups = groupBy ((==) `on` (\(_, p, _) -> p)) sorted in- map (map (\(name, f, _, a) -> (name, f, a))) groups--type Chain = [Either Expr Expr]+ map (map (\(name, _, a) -> (name, a))) groups -matchOperators :: forall m. (MonadError MultipleErrors m) => [[(Qualified Ident, Expr -> Expr -> Expr, Associativity)]] -> Expr -> m Expr-matchOperators ops = parseChains+updateTypes+ :: forall m+ . Monad m+ => (SourceSpan -> SourceType -> m SourceType)+ -> ( Declaration -> m Declaration+ , SourceSpan -> Expr -> m (SourceSpan, Expr)+ , SourceSpan -> Binder -> m (SourceSpan, Binder)+ )+updateTypes goType = (goDecl, goExpr, goBinder) where- parseChains :: Expr -> m Expr- parseChains b@BinaryNoParens{} = bracketChain (extendChain b)- parseChains other = return other- extendChain :: Expr -> Chain- extendChain (BinaryNoParens op l r) = Left l : Right op : extendChain r- extendChain other = [Left other]- bracketChain :: Chain -> m Expr- bracketChain = either (const . throwError . errorMessage $ CannotReorderOperators) return . P.parse (P.buildExpressionParser opTable parseValue <* P.eof) "operator expression"- opTable = [P.Infix (P.try (parseTicks >>= \op -> return (\t1 t2 -> App (App op t1) t2))) P.AssocLeft]- : map (map (\(name, f, a) -> P.Infix (P.try (matchOp name) >> return f) (toAssoc a))) ops- ++ [[ P.Infix (P.try (parseOp >>= \ident -> return (\t1 t2 -> App (App (Var ident) t1) t2))) P.AssocLeft ]] -toAssoc :: Associativity -> P.Assoc-toAssoc Infixl = P.AssocLeft-toAssoc Infixr = P.AssocRight-toAssoc Infix = P.AssocNone+ goType' :: SourceSpan -> SourceType -> m SourceType+ goType' = everywhereOnTypesTopDownM . goType -token :: (P.Stream s Identity t, Show t) => (t -> Maybe a) -> P.Parsec s u a-token = P.token show (const (P.initialPos ""))+ goDecl :: Declaration -> m Declaration+ goDecl (DataDeclaration sa@(ss, _) ddt name args dctors) =+ DataDeclaration sa ddt name+ <$> traverse (traverse (traverse (goType' ss))) args+ <*> traverse (traverseDataCtorFields (traverse (sndM (goType' ss)))) dctors+ goDecl (ExternDeclaration sa@(ss, _) name ty) =+ ExternDeclaration sa name <$> goType' ss ty+ goDecl (TypeClassDeclaration sa@(ss, _) name args implies deps decls) = do+ implies' <- traverse (overConstraintArgs (traverse (goType' ss))) implies+ args' <- traverse (traverse (traverse (goType' ss))) args+ return $ TypeClassDeclaration sa name args' implies' deps decls+ goDecl (TypeInstanceDeclaration sa@(ss, _) na ch idx name cs className tys impls) = do+ cs' <- traverse (overConstraintArgs (traverse (goType' ss))) cs+ tys' <- traverse (goType' ss) tys+ return $ TypeInstanceDeclaration sa na ch idx name cs' className tys' impls+ goDecl (TypeSynonymDeclaration sa@(ss, _) name args ty) =+ TypeSynonymDeclaration sa name+ <$> traverse (traverse (traverse (goType' ss))) args+ <*> goType' ss ty+ goDecl (TypeDeclaration (TypeDeclarationData sa@(ss, _) expr ty)) =+ TypeDeclaration . TypeDeclarationData sa expr <$> goType' ss ty+ goDecl (KindDeclaration sa@(ss, _) sigFor name ty) =+ KindDeclaration sa sigFor name <$> goType' ss ty+ goDecl (ExternDataDeclaration sa@(ss, _) name ty) =+ ExternDataDeclaration sa name <$> goType' ss ty+ goDecl other =+ return other -parseValue :: P.Parsec Chain () Expr-parseValue = token (either Just (const Nothing)) P.<?> "expression"+ goExpr :: SourceSpan -> Expr -> m (SourceSpan, Expr)+ goExpr _ e@(PositionedValue pos _ _) = return (pos, e)+ goExpr pos (TypeClassDictionary (Constraint ann name kinds tys info) dicts hints) = do+ kinds' <- traverse (goType' pos) kinds+ tys' <- traverse (goType' pos) tys+ return (pos, TypeClassDictionary (Constraint ann name kinds' tys' info) dicts hints)+ goExpr pos (DeferredDictionary cls tys) = do+ tys' <- traverse (goType' pos) tys+ return (pos, DeferredDictionary cls tys')+ goExpr pos (TypedValue check v ty) = do+ ty' <- goType' pos ty+ return (pos, TypedValue check v ty')+ goExpr pos other = return (pos, other) -parseOp :: P.Parsec Chain () (Qualified Ident)-parseOp = token (either (const Nothing) fromOp) P.<?> "operator"- where- fromOp (Var q@(Qualified _ (Op _))) = Just q- fromOp _ = Nothing+ goBinder :: SourceSpan -> Binder -> m (SourceSpan, Binder)+ goBinder _ e@(PositionedBinder pos _ _) = return (pos, e)+ goBinder pos (TypedBinder ty b) = do+ ty' <- goType' pos ty+ return (pos, TypedBinder ty' b)+ goBinder pos other = return (pos, other) -parseTicks :: P.Parsec Chain () Expr-parseTicks = token (either (const Nothing) fromOther) P.<?> "infix function"+-- |+-- Checks all the fixity exports within a module to ensure that members aliased+-- by the operators are also exported from the module.+--+-- This pass requires name desugaring and export elaboration to have run first.+--+checkFixityExports+ :: forall m+ . MonadError MultipleErrors m+ => Module+ -> m Module+checkFixityExports (Module _ _ _ _ Nothing) =+ internalError "exports should have been elaborated before checkFixityExports"+checkFixityExports m@(Module ss _ mn ds (Just exps)) =+ rethrow (addHint (ErrorInModule mn))+ $ rethrowWithPosition ss (traverse_ checkRef exps)+ $> m where- fromOther (Var (Qualified _ (Op _))) = Nothing- fromOther v = Just v -matchOp :: Qualified Ident -> P.Parsec Chain () ()-matchOp op = do- ident <- parseOp- guard $ ident == op+ checkRef :: DeclarationRef -> m ()+ checkRef dr@(ValueOpRef ss' op) =+ for_ (getValueOpAlias op) $ \case+ Left ident ->+ unless (ValueRef ss' ident `elem` exps)+ . throwError . errorMessage' ss'+ $ TransitiveExportError dr [ValueRef ss' ident]+ Right ctor ->+ unless (anyTypeRef (maybe False (elem ctor) . snd))+ . throwError . errorMessage' ss+ $ TransitiveDctorExportError dr [ctor]+ checkRef dr@(TypeOpRef ss' op) =+ for_ (getTypeOpAlias op) $ \ty ->+ unless (anyTypeRef ((== ty) . fst))+ . throwError . errorMessage' ss'+ $ TransitiveExportError dr [TypeRef ss' ty Nothing]+ checkRef _ = return () -desugarOperatorSections :: forall m. (Applicative m, MonadSupply m, MonadError MultipleErrors m) => Module -> m Module-desugarOperatorSections (Module coms mn ds exts) = Module coms mn <$> mapM goDecl ds <*> pure exts- where+ -- Finds the name associated with a type operator when that type is also+ -- defined in the current module.+ getTypeOpAlias :: OpName 'TypeOpName -> Maybe (ProperName 'TypeName)+ getTypeOpAlias op =+ listToMaybe (mapMaybe (either (const Nothing) go <=< getFixityDecl) ds)+ where+ go (TypeFixity _ (Qualified (ByModuleName mn') ident) op')+ | mn == mn' && op == op' = Just ident+ go _ = Nothing - goDecl :: Declaration -> m Declaration- (goDecl, _, _) = everywhereOnValuesM return goExpr return+ -- Finds the value or data constructor associated with an operator when that+ -- declaration is also in the current module.+ getValueOpAlias+ :: OpName 'ValueOpName+ -> Maybe (Either Ident (ProperName 'ConstructorName))+ getValueOpAlias op =+ listToMaybe (mapMaybe (either go (const Nothing) <=< getFixityDecl) ds)+ where+ go (ValueFixity _ (Qualified (ByModuleName mn') ident) op')+ | mn == mn' && op == op' = Just ident+ go _ = Nothing - goExpr :: Expr -> m Expr- goExpr (OperatorSection op (Left val)) = return $ App op val- goExpr (OperatorSection op (Right val)) = do- arg <- Ident <$> freshName- return $ Abs (Left arg) $ App (App op (Var (Qualified Nothing arg))) val- goExpr other = return other+ -- Tests the exported `TypeRef` entries with a predicate.+ anyTypeRef+ :: ((ProperName 'TypeName, Maybe [ProperName 'ConstructorName]) -> Bool)+ -> Bool+ anyTypeRef f = any (maybe False f . getTypeRef) exps++usingPredicate+ :: forall f a+ . Applicative f+ => (a -> Bool)+ -> (a -> f a)+ -> (a -> f a)+usingPredicate p f x =+ if p x then f x else pure x
+ src/Language/PureScript/Sugar/Operators/Binders.hs view
@@ -0,0 +1,33 @@+module Language.PureScript.Sugar.Operators.Binders where++import Prelude++import Control.Monad.Except (MonadError)++import Language.PureScript.AST (Associativity, Binder(..), SourceSpan)+import Language.PureScript.Errors (MultipleErrors)+import Language.PureScript.Names (OpName(..), OpNameType(..), Qualified(..))+import Language.PureScript.Sugar.Operators.Common (matchOperators)++matchBinderOperators+ :: MonadError MultipleErrors m+ => [[(Qualified (OpName 'ValueOpName), Associativity)]] + -> Binder+ -> m Binder+matchBinderOperators = matchOperators isBinOp extractOp fromOp reapply id+ where++ isBinOp :: Binder -> Bool+ isBinOp BinaryNoParensBinder{} = True+ isBinOp _ = False++ extractOp :: Binder -> Maybe (Binder, Binder, Binder)+ extractOp (BinaryNoParensBinder op l r) = Just (op, l, r)+ extractOp _ = Nothing++ fromOp :: Binder -> Maybe (SourceSpan, Qualified (OpName 'ValueOpName))+ fromOp (OpBinder ss q@(Qualified _ (OpName _))) = Just (ss, q)+ fromOp _ = Nothing++ reapply :: SourceSpan -> Qualified (OpName 'ValueOpName) -> Binder -> Binder -> Binder+ reapply ss = BinaryNoParensBinder . OpBinder ss
+ src/Language/PureScript/Sugar/Operators/Common.hs view
@@ -0,0 +1,144 @@+module Language.PureScript.Sugar.Operators.Common where++import Prelude++import Control.Monad.State (guard, join)+import Control.Monad.Except (MonadError(..))++import Data.Either (rights)+import Data.Functor.Identity (Identity)+import Data.List (sortOn)+import Data.Maybe (mapMaybe, fromJust)+import Data.List.NonEmpty qualified as NEL+import Data.Map qualified as M++import Text.Parsec qualified as P+import Text.Parsec.Pos qualified as P+import Text.Parsec.Expr qualified as P++import Language.PureScript.AST (Associativity(..), ErrorMessageHint(..), SourceSpan)+import Language.PureScript.Crash (internalError)+import Language.PureScript.Errors (ErrorMessage(..), MultipleErrors(..), SimpleErrorMessage(..))+import Language.PureScript.Names (OpName, Qualified, eraseOpName)++type Chain a = [Either a a]++type FromOp nameType a = a -> Maybe (SourceSpan, Qualified (OpName nameType))+type Reapply nameType a = SourceSpan -> Qualified (OpName nameType) -> a -> a -> a++toAssoc :: Associativity -> P.Assoc+toAssoc Infixl = P.AssocLeft+toAssoc Infixr = P.AssocRight+toAssoc Infix = P.AssocNone++token :: (P.Stream s Identity t) => (t -> Maybe a) -> P.Parsec s u a+token = P.token (const "") (const (P.initialPos ""))++parseValue :: P.Parsec (Chain a) () a+parseValue = token (either Just (const Nothing)) P.<?> "expression"++parseOp+ :: FromOp nameType a+ -> P.Parsec (Chain a) () (SourceSpan, Qualified (OpName nameType))+parseOp fromOp = token (either (const Nothing) fromOp) P.<?> "operator"++matchOp+ :: FromOp nameType a+ -> Qualified (OpName nameType)+ -> P.Parsec (Chain a) () SourceSpan+matchOp fromOp op = do+ (ss, ident) <- parseOp fromOp+ guard $ ident == op+ pure ss++opTable+ :: [[(Qualified (OpName nameType), Associativity)]]+ -> FromOp nameType a+ -> Reapply nameType a+ -> [[P.Operator (Chain a) () Identity a]]+opTable ops fromOp reapply =+ map (map (\(name, a) -> P.Infix (P.try (matchOp fromOp name) >>= \ss -> return (reapply ss name)) (toAssoc a))) ops++matchOperators+ :: forall m a nameType+ . Show a+ => MonadError MultipleErrors m+ => (a -> Bool)+ -> (a -> Maybe (a, a, a))+ -> FromOp nameType a+ -> Reapply nameType a+ -> ([[P.Operator (Chain a) () Identity a]] -> P.OperatorTable (Chain a) () Identity a)+ -> [[(Qualified (OpName nameType), Associativity)]]+ -> a+ -> m a+matchOperators isBinOp extractOp fromOp reapply modOpTable ops = parseChains+ where+ parseChains :: a -> m a+ parseChains ty+ | True <- isBinOp ty = bracketChain (extendChain ty)+ | otherwise = pure ty+ extendChain :: a -> Chain a+ extendChain ty+ | Just (op, l, r) <- extractOp ty = Left l : Right op : extendChain r+ | otherwise = [Left ty]+ bracketChain :: Chain a -> m a+ bracketChain chain =+ case P.parse opParser "operator expression" chain of+ Right a -> pure a+ Left _ -> throwError . MultipleErrors $ mkErrors chain+ opParser :: P.Parsec (Chain a) () a+ opParser = P.buildExpressionParser (modOpTable (opTable ops fromOp reapply)) parseValue <* P.eof++ -- Generating a good error message involves a bit of work here, as the parser+ -- can't provide one for us.+ --+ -- We examine the expression chain, plucking out the operators and then+ -- grouping them by shared precedence, then if any of the following conditions+ -- are met, we have something to report:+ -- 1. any of the groups have mixed associativity+ -- 2. there is more than one occurrence of a non-associative operator in a+ -- precedence group+ mkErrors :: Chain a -> [ErrorMessage]+ mkErrors chain =+ let+ opInfo :: M.Map (Qualified (OpName nameType)) (Integer, Associativity)+ opInfo = M.fromList $ concatMap (\(n, o) -> map (\(name, assoc) -> (name, (n, assoc))) o) (zip [0..] ops)+ opPrec :: Qualified (OpName nameType) -> Integer+ opPrec = fst . fromJust . flip M.lookup opInfo+ opAssoc :: Qualified (OpName nameType) -> Associativity+ opAssoc = snd . fromJust . flip M.lookup opInfo+ chainOpSpans :: M.Map (Qualified (OpName nameType)) (NEL.NonEmpty SourceSpan)+ chainOpSpans = foldr (\(ss, name) -> M.alter (Just . maybe (pure ss) (NEL.cons ss)) name) M.empty . mapMaybe fromOp $ rights chain+ opUsages :: Qualified (OpName nameType) -> Int+ opUsages = maybe 0 NEL.length . flip M.lookup chainOpSpans+ precGrouped :: [NEL.NonEmpty (Qualified (OpName nameType))]+ precGrouped = NEL.groupWith opPrec . sortOn opPrec $ M.keys chainOpSpans+ assocGrouped :: [NEL.NonEmpty (NEL.NonEmpty (Qualified (OpName nameType)))]+ assocGrouped = fmap (NEL.groupWith1 opAssoc . NEL.sortWith opAssoc) precGrouped+ mixedAssoc :: [NEL.NonEmpty (Qualified (OpName nameType))]+ mixedAssoc = fmap join . filter (\precGroup -> NEL.length precGroup > 1) $ assocGrouped+ nonAssoc :: [NEL.NonEmpty (Qualified (OpName nameType))]+ nonAssoc = NEL.filter (\assocGroup -> opAssoc (NEL.head assocGroup) == Infix && sum (fmap opUsages assocGroup) > 1) =<< assocGrouped+ in+ if null (nonAssoc ++ mixedAssoc)+ then internalError "matchOperators: cannot reorder operators"+ else+ map+ (\grp ->+ mkPositionedError chainOpSpans grp+ (MixedAssociativityError (fmap (\name -> (eraseOpName <$> name, opAssoc name)) grp)))+ mixedAssoc+ ++ map+ (\grp ->+ mkPositionedError chainOpSpans grp+ (NonAssociativeError (fmap (fmap eraseOpName) grp)))+ nonAssoc++ mkPositionedError+ :: M.Map (Qualified (OpName nameType)) (NEL.NonEmpty SourceSpan)+ -> NEL.NonEmpty (Qualified (OpName nameType))+ -> SimpleErrorMessage+ -> ErrorMessage+ mkPositionedError chainOpSpans grp =+ ErrorMessage+ [PositionedError (fromJust . flip M.lookup chainOpSpans =<< grp)]
+ src/Language/PureScript/Sugar/Operators/Expr.hs view
@@ -0,0 +1,52 @@+module Language.PureScript.Sugar.Operators.Expr where++import Prelude++import Control.Monad.Except (MonadError)+import Data.Functor.Identity (Identity)++import Text.Parsec qualified as P+import Text.Parsec.Expr qualified as P++import Language.PureScript.AST (Associativity, Expr(..), SourceSpan)+import Language.PureScript.Names (OpName(..), OpNameType(..), Qualified(..))+import Language.PureScript.Sugar.Operators.Common (Chain, matchOperators, token)+import Language.PureScript.Errors (MultipleErrors)++matchExprOperators+ :: MonadError MultipleErrors m+ => [[(Qualified (OpName 'ValueOpName), Associativity)]]+ -> Expr+ -> m Expr+matchExprOperators = matchOperators isBinOp extractOp fromOp reapply modOpTable+ where++ isBinOp :: Expr -> Bool+ isBinOp BinaryNoParens{} = True+ isBinOp _ = False++ extractOp :: Expr -> Maybe (Expr, Expr, Expr)+ extractOp (BinaryNoParens op l r)+ | PositionedValue _ _ op' <- op = Just (op', l, r)+ | otherwise = Just (op, l, r)+ extractOp _ = Nothing++ fromOp :: Expr -> Maybe (SourceSpan, Qualified (OpName 'ValueOpName))+ fromOp (Op ss q@(Qualified _ (OpName _))) = Just (ss, q)+ fromOp _ = Nothing++ reapply :: SourceSpan -> Qualified (OpName 'ValueOpName) -> Expr -> Expr -> Expr+ reapply ss = BinaryNoParens . Op ss++ modOpTable+ :: [[P.Operator (Chain Expr) () Identity Expr]]+ -> [[P.Operator (Chain Expr) () Identity Expr]]+ modOpTable table =+ [ P.Infix (P.try (BinaryNoParens <$> parseTicks)) P.AssocLeft ]+ : table++ parseTicks :: P.Parsec (Chain Expr) () Expr+ parseTicks = token (either (const Nothing) fromOther) P.<?> "infix function"+ where+ fromOther (Op _ _) = Nothing+ fromOther v = Just v
+ src/Language/PureScript/Sugar/Operators/Types.hs view
@@ -0,0 +1,34 @@+module Language.PureScript.Sugar.Operators.Types where++import Prelude++import Control.Monad.Except (MonadError)+import Language.PureScript.AST (Associativity, SourceSpan)+import Language.PureScript.Errors (MultipleErrors)+import Language.PureScript.Names (OpName(..), OpNameType(..), Qualified(..))+import Language.PureScript.Sugar.Operators.Common (matchOperators)+import Language.PureScript.Types (SourceType, Type(..), srcTypeApp)++matchTypeOperators+ :: MonadError MultipleErrors m+ => SourceSpan+ -> [[(Qualified (OpName 'TypeOpName), Associativity)]]+ -> SourceType+ -> m SourceType+matchTypeOperators ss = matchOperators isBinOp extractOp fromOp reapply id+ where++ isBinOp :: SourceType -> Bool+ isBinOp BinaryNoParensType{} = True+ isBinOp _ = False++ extractOp :: SourceType -> Maybe (SourceType, SourceType, SourceType)+ extractOp (BinaryNoParensType _ op l r) = Just (op, l, r)+ extractOp _ = Nothing++ fromOp :: SourceType -> Maybe (SourceSpan, Qualified (OpName 'TypeOpName))+ fromOp (TypeOp _ q@(Qualified _ (OpName _))) = Just (ss, q)+ fromOp _ = Nothing++ reapply :: a -> Qualified (OpName 'TypeOpName) -> SourceType -> SourceType -> SourceType+ reapply _ op = srcTypeApp . srcTypeApp (TypeOp (ss, []) op)
src/Language/PureScript/Sugar/TypeClasses.hs view
@@ -1,48 +1,42 @@------------------------------------------------------------------------------------ Module : Language.PureScript.Sugar.TypeClasses--- Copyright : (c) Phil Freeman 2013--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :--- -- |--- This module implements the desugaring pass which creates type synonyms for type class dictionaries--- and dictionary expressions for type class instances.+-- This module implements the desugaring pass which creates newtypes for type class dictionaries+-- and value declarations for type class instances. ----------------------------------------------------------------------------------{-# LANGUAGE FlexibleContexts #-}- module Language.PureScript.Sugar.TypeClasses ( desugarTypeClasses , typeClassMemberName , superClassDictionaryNames ) where -import Language.PureScript.AST hiding (isExported)-import Language.PureScript.Environment-import Language.PureScript.Errors-import Language.PureScript.Kinds-import Language.PureScript.Names-import Language.PureScript.Sugar.CaseDeclarations-import Control.Monad.Supply.Class-import Language.PureScript.Types--import qualified Language.PureScript.Constants as C+import Prelude -import Control.Applicative import Control.Arrow (first, second)-import Control.Monad.Except-import Control.Monad.State-import Data.List ((\\), find, sortBy)+import Control.Monad (unless)+import Control.Monad.Error.Class (MonadError(..))+import Control.Monad.State (MonadState(..), StateT, evalStateT, modify)+import Control.Monad.Supply.Class (MonadSupply)+import Data.Graph (SCC(..), stronglyConnComp)+import Data.List (find, partition)+import Data.List.NonEmpty (nonEmpty)+import Data.Map qualified as M import Data.Maybe (catMaybes, mapMaybe, isJust)--import qualified Data.Map as M+import Data.List.NonEmpty qualified as NEL+import Data.Set qualified as S+import Data.Text (Text)+import Data.Traversable (for)+import Language.PureScript.Constants.Prim qualified as C+import Language.PureScript.Crash (internalError)+import Language.PureScript.Environment (DataDeclType(..), NameKind(..), TypeClassData(..), dictTypeName, function, makeTypeClassData, primClasses, primCoerceClasses, primIntClasses, primRowClasses, primRowListClasses, primSymbolClasses, primTypeErrorClasses, tyRecord)+import Language.PureScript.Errors hiding (isExported, nonEmpty)+import Language.PureScript.Externs (ExternsDeclaration(..), ExternsFile(..))+import Language.PureScript.Label (Label(..))+import Language.PureScript.Names (pattern ByNullSourcePos, Ident(..), ModuleName, Name(..), ProperName, ProperNameType(..), Qualified(..), QualifiedBy(..), coerceProperName, freshIdent, qualify, runIdent)+import Language.PureScript.PSString (mkString)+import Language.PureScript.Sugar.CaseDeclarations (desugarCases)+import Language.PureScript.TypeClassDictionaries (superclassName)+import Language.PureScript.Types -type MemberMap = M.Map (ModuleName, ProperName) Declaration+type MemberMap = M.Map (ModuleName, ProperName 'ClassName) TypeClassData type Desugar = StateT MemberMap @@ -50,24 +44,71 @@ -- Add type synonym declarations for type class dictionary types, and value declarations for type class -- instance dictionary expressions. ---desugarTypeClasses :: (Functor m, Applicative m, MonadSupply m, MonadError MultipleErrors m) => [Module] -> m [Module]-desugarTypeClasses = flip evalStateT M.empty . mapM desugarModule+desugarTypeClasses+ :: (MonadSupply m, MonadError MultipleErrors m)+ => [ExternsFile]+ -> Module+ -> m Module+desugarTypeClasses externs = flip evalStateT initialState . desugarModule+ where+ initialState :: MemberMap+ initialState =+ mconcat+ [ M.mapKeys (qualify C.M_Prim) primClasses+ , M.mapKeys (qualify C.M_Prim_Coerce) primCoerceClasses+ , M.mapKeys (qualify C.M_Prim_Row) primRowClasses+ , M.mapKeys (qualify C.M_Prim_RowList) primRowListClasses+ , M.mapKeys (qualify C.M_Prim_Symbol) primSymbolClasses+ , M.mapKeys (qualify C.M_Prim_Int) primIntClasses+ , M.mapKeys (qualify C.M_Prim_TypeError) primTypeErrorClasses+ , M.fromList (externs >>= \ExternsFile{..} -> mapMaybe (fromExternsDecl efModuleName) efDeclarations)+ ] -desugarModule :: (Functor m, Applicative m, MonadSupply m, MonadError MultipleErrors m) => Module -> Desugar m Module-desugarModule (Module coms name decls (Just exps)) = do- (newExpss, declss) <- unzip <$> parU (sortBy classesFirst decls) (desugarDecl name exps)- return $ Module coms name (concat declss) $ Just (exps ++ catMaybes newExpss)+ fromExternsDecl+ :: ModuleName+ -> ExternsDeclaration+ -> Maybe ((ModuleName, ProperName 'ClassName), TypeClassData)+ fromExternsDecl mn (EDClass name args members implies deps tcIsEmpty) = Just ((mn, name), typeClass) where+ typeClass = makeTypeClassData args members implies deps tcIsEmpty+ fromExternsDecl _ _ = Nothing++desugarModule+ :: (MonadSupply m, MonadError MultipleErrors m)+ => Module+ -> Desugar m Module+desugarModule (Module ss coms name decls (Just exps)) = do+ let (classDecls, restDecls) = partition isTypeClassDecl decls+ classVerts = fmap (\d -> (d, classDeclName d, superClassesNames d)) classDecls+ (classNewExpss, classDeclss) <- unzip <$> parU (stronglyConnComp classVerts) (desugarClassDecl name exps)+ (restNewExpss, restDeclss) <- unzip <$> parU restDecls (desugarDecl name exps)+ return $ Module ss coms name (concat restDeclss ++ concat classDeclss) $ Just (exps ++ catMaybes restNewExpss ++ catMaybes classNewExpss) where- classesFirst :: Declaration -> Declaration -> Ordering- classesFirst d1 d2 - | isTypeClassDeclaration d1 && not (isTypeClassDeclaration d2) = LT- | not (isTypeClassDeclaration d1) && isTypeClassDeclaration d2 = GT- | otherwise = EQ-desugarModule _ = error "Exports should have been elaborated in name desugaring"+ desugarClassDecl :: (MonadSupply m, MonadError MultipleErrors m)+ => ModuleName+ -> [DeclarationRef]+ -> SCC Declaration+ -> Desugar m (Maybe DeclarationRef, [Declaration])+ desugarClassDecl name' exps' (AcyclicSCC d) = desugarDecl name' exps' d+ desugarClassDecl _ _ (CyclicSCC ds')+ | Just ds'' <- nonEmpty ds' = throwError . errorMessage' (declSourceSpan (NEL.head ds'')) $ CycleInTypeClassDeclaration (NEL.map classDeclName ds'')+ | otherwise = internalError "desugarClassDecl: empty CyclicSCC" + superClassesNames :: Declaration -> [Qualified (ProperName 'ClassName)]+ superClassesNames (TypeClassDeclaration _ _ _ implies _ _) = fmap constraintName implies+ superClassesNames _ = []++ constraintName :: SourceConstraint -> Qualified (ProperName 'ClassName)+ constraintName (Constraint _ cName _ _ _) = cName++ classDeclName :: Declaration -> Qualified (ProperName 'ClassName)+ classDeclName (TypeClassDeclaration _ pn _ _ _ _) = Qualified (ByModuleName name) pn+ classDeclName _ = internalError "Expected TypeClassDeclaration"++desugarModule _ = internalError "Exports should have been elaborated in name desugaring"+ {- Desugar type class and type class instance declarations ----- Type classes become type synonyms for their dictionaries, and type instances become dictionary declarations.+-- Type classes become newtypes for their dictionaries, and type instances become dictionary declarations. -- Additional values are generated to access individual members of a dictionary, with the appropriate type. -- -- E.g. the following@@ -95,203 +136,256 @@ -- -- <TypeClassDeclaration Foo ...> ----- type Foo a = { foo :: a -> a }+-- newtype Foo$Dict a = Foo$Dict { foo :: a -> a } -- -- -- this following type is marked as not needing to be checked so a new Abs -- -- is not introduced around the definition in type checking, but when -- -- called the dictionary value is still passed in for the `dict` argument--- foo :: forall a. (Foo a) => a -> a--- foo dict = dict.foo+-- foo :: forall a. (Foo$Dict a) => a -> a+-- foo (Foo$Dict dict) = dict.foo ----- fooString :: {} -> Foo String--- fooString _ = <TypeClassDictionaryConstructorApp Foo { foo: \s -> s ++ s }>+-- fooString :: Foo$Dict String+-- fooString = Foo$Dict { foo: \s -> s ++ s } ----- fooArray :: forall a. (Foo a) => Foo [a]--- fooArray = <TypeClassDictionaryConstructorApp Foo { foo: map foo }>+-- fooArray :: forall a. (Foo$Dict a) => Foo$Dict [a]+-- fooArray = Foo$Dict { foo: map foo } -- -- {- Superclasses -} -- -- <TypeClassDeclaration Sub ...> ----- type Sub a = { sub :: a--- , "__superclass_Foo_0" :: {} -> Foo a--- }+-- newtype Sub$Dict a = Sub$Dict { sub :: a+-- , "Foo0" :: {} -> Foo$Dict a+-- } -- -- -- As with `foo` above, this type is unchecked at the declaration--- sub :: forall a. (Sub a) => a--- sub dict = dict.sub+-- sub :: forall a. (Sub$Dict a) => a+-- sub (Sub$Dict dict) = dict.sub ----- subString :: {} -> Sub String--- subString _ = { sub: "",--- , "__superclass_Foo_0": \_ -> <SuperClassDictionary Foo String>--- }+-- subString :: Sub$Dict String+-- subString = Sub$Dict { sub: "",+-- , "Foo0": \_ -> <DeferredDictionary Foo String>+-- } -- -- and finally as the generated javascript: ----- function Foo(foo) {--- this.foo = foo;--- };--- -- var foo = function (dict) { -- return dict.foo; -- }; ----- var fooString = function (_) {--- return new Foo(function (s) {--- return s + s;--- });--- };------ var fooArray = function (__dict_Foo_15) {--- return new Foo(map(foo(__dict_Foo_15)));+-- var fooString = {+-- foo: function (s) {+-- return s + s;+-- } -- }; ----- function Sub(__superclass_Foo_0, sub) {--- this["__superclass_Foo_0"] = __superclass_Foo_0;--- this.sub = sub;+-- var fooArray = function (dictFoo) {+-- return {+-- foo: map(foo(dictFoo))+-- }; -- }; -- -- var sub = function (dict) { -- return dict.sub; -- }; ----- var subString = function (_) {--- return new Sub(fooString, "");+-- var subString = {+-- sub: "",+-- Foo0: function () {+-- return fooString;+-- } -- }; -}-desugarDecl :: (Functor m, Applicative m, MonadSupply m, MonadError MultipleErrors m) => ModuleName -> [DeclarationRef] -> Declaration -> Desugar m (Maybe DeclarationRef, [Declaration])+desugarDecl+ :: (MonadSupply m, MonadError MultipleErrors m)+ => ModuleName+ -> [DeclarationRef]+ -> Declaration+ -> Desugar m (Maybe DeclarationRef, [Declaration]) desugarDecl mn exps = go where- go d@(TypeClassDeclaration name args implies members) = do- modify (M.insert (mn, name) d)- return (Nothing, d : typeClassDictionaryDeclaration name args implies members : map (typeClassMemberToDictionaryAccessor mn name args) members)- go d@(ExternInstanceDeclaration name _ className tys) = return (expRef name className tys, [d])- go d@(TypeInstanceDeclaration name deps className tys members) = do- desugared <- desugarCases members- dictDecl <- typeInstanceDictionaryDeclaration name mn deps className tys desugared- return (expRef name className tys, [d, dictDecl])- go (PositionedDeclaration pos com d) = do- (dr, ds) <- rethrowWithPosition pos $ desugarDecl mn exps d- return (dr, map (PositionedDeclaration pos com) ds)+ go d@(TypeClassDeclaration sa name args implies deps members) = do+ modify (M.insert (mn, name) (makeTypeClassData args (map memberToNameAndType members) implies deps False))+ return (Nothing, d : typeClassDictionaryDeclaration sa name args implies members : map (typeClassMemberToDictionaryAccessor mn name args) members)+ go (TypeInstanceDeclaration sa na chainId idx name deps className tys body) = do+ name' <- desugarInstName name+ let d = TypeInstanceDeclaration sa na chainId idx (Right name') deps className tys body+ let explicitOrNot = case body of+ DerivedInstance -> Left $ DerivedInstancePlaceholder className KnownClassStrategy+ NewtypeInstance -> Left $ DerivedInstancePlaceholder className NewtypeStrategy+ ExplicitInstance members -> Right members+ dictDecl <- case explicitOrNot of+ Right members+ | className == C.Coercible ->+ throwError . errorMessage' (fst sa) $ InvalidCoercibleInstanceDeclaration tys+ | otherwise -> do+ desugared <- desugarCases members+ typeInstanceDictionaryDeclaration sa name' mn deps className tys desugared+ Left dict ->+ let+ dictTy = foldl srcTypeApp (srcTypeConstructor (fmap (coerceProperName . dictTypeName) className)) tys+ constrainedTy = quantify (foldr srcConstrainedType dictTy deps)+ in+ return $ ValueDecl sa name' Private [] [MkUnguarded (TypedValue True dict constrainedTy)]+ return (expRef name' className tys, [d, dictDecl]) go other = return (Nothing, [other]) - expRef :: Ident -> Qualified ProperName -> [Type] -> Maybe DeclarationRef+ -- Completes the name generation for type class instances that do not have+ -- a unique name defined in source code.+ desugarInstName :: MonadSupply m => Either Text Ident -> Desugar m Ident+ desugarInstName = either freshIdent pure++ expRef :: Ident -> Qualified (ProperName 'ClassName) -> [SourceType] -> Maybe DeclarationRef expRef name className tys- | isExportedClass className && all isExportedType (getConstructors `concatMap` tys) = Just $ TypeInstanceRef name+ | isExportedClass className && all isExportedType (getConstructors `concatMap` tys) = Just $ TypeInstanceRef genSpan name UserNamed | otherwise = Nothing - isExportedClass :: Qualified ProperName -> Bool- isExportedClass = isExported (elem . TypeClassRef)+ isExportedClass :: Qualified (ProperName 'ClassName) -> Bool+ isExportedClass = isExported (elem . TypeClassRef genSpan) - isExportedType :: Qualified ProperName -> Bool+ isExportedType :: Qualified (ProperName 'TypeName) -> Bool isExportedType = isExported $ \pn -> isJust . find (matchesTypeRef pn) - isExported :: (ProperName -> [DeclarationRef] -> Bool) -> Qualified ProperName -> Bool- isExported test (Qualified (Just mn') pn) = mn /= mn' || test pn exps- isExported _ _ = error "Names should have been qualified in name desugaring"+ isExported+ :: (ProperName a -> [DeclarationRef] -> Bool)+ -> Qualified (ProperName a)+ -> Bool+ isExported test (Qualified (ByModuleName mn') pn) = mn /= mn' || test pn exps+ isExported _ _ = internalError "Names should have been qualified in name desugaring" - matchesTypeRef :: ProperName -> DeclarationRef -> Bool- matchesTypeRef pn (TypeRef pn' _) = pn == pn'+ matchesTypeRef :: ProperName 'TypeName -> DeclarationRef -> Bool+ matchesTypeRef pn (TypeRef _ pn' _) = pn == pn' matchesTypeRef _ _ = False - getConstructors :: Type -> [Qualified ProperName]+ getConstructors :: SourceType -> [Qualified (ProperName 'TypeName)] getConstructors = everythingOnTypes (++) getConstructor+ where+ getConstructor (TypeConstructor _ tcname) = [tcname]+ getConstructor _ = [] - getConstructor :: Type -> [Qualified ProperName]- getConstructor (TypeConstructor tcname) = [tcname]- getConstructor _ = []+ genSpan :: SourceSpan+ genSpan = internalModuleSourceSpan "<generated>" -memberToNameAndType :: Declaration -> (Ident, Type)-memberToNameAndType (TypeDeclaration ident ty) = (ident, ty)-memberToNameAndType (PositionedDeclaration _ _ d) = memberToNameAndType d-memberToNameAndType _ = error "Invalid declaration in type class definition"+memberToNameAndType :: Declaration -> (Ident, SourceType)+memberToNameAndType (TypeDeclaration td) = unwrapTypeDeclaration td+memberToNameAndType _ = internalError "Invalid declaration in type class definition" -typeClassDictionaryDeclaration :: ProperName -> [(String, Maybe Kind)] -> [Constraint] -> [Declaration] -> Declaration-typeClassDictionaryDeclaration name args implies members =+typeClassDictionaryDeclaration+ :: SourceAnn+ -> ProperName 'ClassName+ -> [(Text, Maybe SourceType)]+ -> [SourceConstraint]+ -> [Declaration]+ -> Declaration+typeClassDictionaryDeclaration sa name args implies members = let superclassTypes = superClassDictionaryNames implies `zip`- [ function unit (foldl TypeApp (TypeConstructor superclass) tyArgs)- | (superclass, tyArgs) <- implies+ [ function unit (foldl srcTypeApp (srcTypeConstructor (fmap (coerceProperName . dictTypeName) superclass)) tyArgs)+ | (Constraint _ superclass _ tyArgs _) <- implies ] members' = map (first runIdent . memberToNameAndType) members mtys = members' ++ superclassTypes- in TypeSynonymDeclaration name args (TypeApp tyObject $ rowFromList (mtys, REmpty))+ toRowListItem (l, t) = srcRowListItem (Label $ mkString l) t+ ctor = DataConstructorDeclaration sa (coerceProperName $ dictTypeName name)+ [(Ident "dict", srcTypeApp tyRecord $ rowFromList (map toRowListItem mtys, srcREmpty))]+ in DataDeclaration sa Newtype (coerceProperName $ dictTypeName name) args [ctor] -typeClassMemberToDictionaryAccessor :: ModuleName -> ProperName -> [(String, Maybe Kind)] -> Declaration -> Declaration-typeClassMemberToDictionaryAccessor mn name args (TypeDeclaration ident ty) =- let className = Qualified (Just mn) name- in ValueDeclaration ident TypeClassAccessorImport [] $ Right $- TypedValue False (TypeClassDictionaryAccessor className ident) $- moveQuantifiersToFront (quantify (ConstrainedType [(className, map (TypeVar . fst) args)] ty))-typeClassMemberToDictionaryAccessor mn name args (PositionedDeclaration pos com d) =- PositionedDeclaration pos com $ typeClassMemberToDictionaryAccessor mn name args d-typeClassMemberToDictionaryAccessor _ _ _ _ = error "Invalid declaration in type class definition"+typeClassMemberToDictionaryAccessor+ :: ModuleName+ -> ProperName 'ClassName+ -> [(Text, Maybe SourceType)]+ -> Declaration+ -> Declaration+typeClassMemberToDictionaryAccessor mn name args (TypeDeclaration (TypeDeclarationData sa@(ss, _) ident ty)) =+ let className = Qualified (ByModuleName mn) name+ dictIdent = Ident "dict"+ dictObjIdent = Ident "v"+ ctor = ConstructorBinder ss (coerceProperName . dictTypeName <$> className) [VarBinder ss dictObjIdent]+ acsr = Accessor (mkString $ runIdent ident) (Var ss (Qualified ByNullSourcePos dictObjIdent))+ visibility = second (const TypeVarVisible) <$> args+ in ValueDecl sa ident Private []+ [MkUnguarded (+ TypedValue False (Abs (VarBinder ss dictIdent) (Case [Var ss $ Qualified ByNullSourcePos dictIdent] [CaseAlternative [ctor] [MkUnguarded acsr]])) $+ addVisibility visibility (moveQuantifiersToFront NullSourceAnn (quantify (srcConstrainedType (srcConstraint className [] (map (srcTypeVar . fst) args) Nothing) ty)))+ )]+typeClassMemberToDictionaryAccessor _ _ _ _ = internalError "Invalid declaration in type class definition" -unit :: Type-unit = TypeApp tyObject REmpty+unit :: SourceType+unit = srcTypeApp tyRecord srcREmpty -typeInstanceDictionaryDeclaration :: (Functor m, Applicative m, MonadSupply m, MonadError MultipleErrors m) => Ident -> ModuleName -> [Constraint] -> Qualified ProperName -> [Type] -> [Declaration] -> Desugar m Declaration-typeInstanceDictionaryDeclaration name mn deps className tys decls =- rethrow (onErrorMessages (ErrorInInstance className tys)) $ do+typeInstanceDictionaryDeclaration+ :: forall m+ . MonadError MultipleErrors m+ => SourceAnn+ -> Ident+ -> ModuleName+ -> [SourceConstraint]+ -> Qualified (ProperName 'ClassName)+ -> [SourceType]+ -> [Declaration]+ -> Desugar m Declaration+typeInstanceDictionaryDeclaration sa@(ss, _) name mn deps className tys decls =+ rethrow (addHint (ErrorInInstance className tys)) $ do m <- get -- Lookup the type arguments and member types for the type class- (TypeClassDeclaration _ args implies tyDecls) <-- maybe (throwError . errorMessage $ UnknownTypeClass className) return $+ TypeClassData{..} <-+ maybe (throwError . errorMessage' ss . UnknownName $ fmap TyClassName className) return $ M.lookup (qualify mn className) m - case mapMaybe declName tyDecls \\ mapMaybe declName decls of- member : _ -> throwError . errorMessage $ MissingClassMember member- [] -> do+ -- Replace the type arguments with the appropriate types in the member types+ let memberTypes = map (second (replaceAllTypeVars (zip (map fst typeClassArguments) tys)) . tuple3To2) typeClassMembers - let instanceTys = map memberToNameAndType tyDecls+ let declaredMembers = S.fromList $ mapMaybe declIdent decls - -- Replace the type arguments with the appropriate types in the member types- let memberTypes = map (second (replaceAllTypeVars (zip (map fst args) tys))) instanceTys+ -- Instance declarations with a Fail constraint are unreachable code, so+ -- we allow them to be empty.+ let unreachable = any ((C.Fail ==) . constraintClass) deps && null decls - -- Create values for the type instance members- members <- zip (map typeClassMemberName decls) <$> mapM (memberToValue memberTypes) decls+ unless unreachable $+ case filter (\(ident, _) -> not $ S.member ident declaredMembers) memberTypes of+ hd : tl -> throwError . errorMessage' ss $ MissingClassMember (hd NEL.:| tl)+ [] -> pure () - -- Create the type of the dictionary- -- The type is an object type, but depending on type instance dependencies, may be constrained.- -- The dictionary itself is an object literal.- let superclasses = superClassDictionaryNames implies `zip`- [ Abs (Left (Ident C.__unused)) (SuperClassDictionary superclass tyArgs)- | (superclass, suTyArgs) <- implies- , let tyArgs = map (replaceAllTypeVars (zip (map fst args) tys)) suTyArgs- ]+ -- Create values for the type instance members+ members <- zip (map typeClassMemberName decls) <$> traverse (memberToValue memberTypes) decls - let props = ObjectLiteral (members ++ superclasses)- dictTy = foldl TypeApp (TypeConstructor className) tys- constrainedTy = quantify (if null deps then dictTy else ConstrainedType deps dictTy)- dict = TypeClassDictionaryConstructorApp className props- result = ValueDeclaration name TypeInstanceDictionaryValue [] (Right (TypedValue True dict constrainedTy))- return result+ -- Create the type of the dictionary+ -- The type is a record type, but depending on type instance dependencies, may be constrained.+ -- The dictionary itself is a record literal (unless unreachable, in which case it's undefined).+ superclassesDicts <- for typeClassSuperclasses $ \(Constraint _ superclass _ suTyArgs _) -> do+ let tyArgs = map (replaceAllTypeVars (zip (map fst typeClassArguments) tys)) suTyArgs+ pure $ Abs (VarBinder ss UnusedIdent) (DeferredDictionary superclass tyArgs)+ let superclasses = superClassDictionaryNames typeClassSuperclasses `zip` superclassesDicts - where+ let props = Literal ss $ ObjectLiteral $ map (first mkString) (members ++ superclasses)+ dictTy = foldl srcTypeApp (srcTypeConstructor (fmap (coerceProperName . dictTypeName) className)) tys+ constrainedTy = quantify (foldr srcConstrainedType dictTy deps)+ dict = App (Constructor ss (fmap (coerceProperName . dictTypeName) className)) props+ mkTV = if unreachable then TypedValue False (Var nullSourceSpan C.I_undefined) else TypedValue True dict+ result = ValueDecl sa name Private [] [MkUnguarded (mkTV constrainedTy)]+ return result - declName :: Declaration -> Maybe Ident- declName (PositionedDeclaration _ _ d) = declName d- declName (ValueDeclaration ident _ _ _) = Just ident- declName (TypeDeclaration ident _) = Just ident- declName _ = Nothing+ where - memberToValue :: (Functor m, Applicative m, MonadSupply m, MonadError MultipleErrors m) => [(Ident, Type)] -> Declaration -> Desugar m Expr- memberToValue tys' (ValueDeclaration ident _ [] (Right val)) = do- _ <- maybe (throwError . errorMessage $ MissingClassMember ident) return $ lookup ident tys'+ memberToValue :: [(Ident, SourceType)] -> Declaration -> Desugar m Expr+ memberToValue tys' (ValueDecl (ss', _) ident _ [] [MkUnguarded val]) = do+ _ <- maybe (throwError . errorMessage' ss' $ ExtraneousClassMember ident className) return $ lookup ident tys' return val- memberToValue tys' (PositionedDeclaration pos com d) = rethrowWithPosition pos $ do- val <- memberToValue tys' d- return (PositionedValue pos com val)- memberToValue _ _ = error "Invalid declaration in type instance definition"+ memberToValue _ _ = internalError "Invalid declaration in type instance definition" -typeClassMemberName :: Declaration -> String-typeClassMemberName (TypeDeclaration ident _) = runIdent ident-typeClassMemberName (ValueDeclaration ident _ _ _) = runIdent ident-typeClassMemberName (PositionedDeclaration _ _ d) = typeClassMemberName d-typeClassMemberName d = error $ "Invalid declaration in type class definition: " ++ show d+declIdent :: Declaration -> Maybe Ident+declIdent (ValueDeclaration vd) = Just (valdeclIdent vd)+declIdent (TypeDeclaration td) = Just (tydeclIdent td)+declIdent _ = Nothing -superClassDictionaryNames :: [Constraint] -> [String]+typeClassMemberName :: Declaration -> Text+typeClassMemberName = maybe (internalError "typeClassMemberName: Invalid declaration in type class definition") runIdent . declIdent++superClassDictionaryNames :: [Constraint a] -> [Text] superClassDictionaryNames supers =- [ C.__superclass_ ++ show pn ++ "_" ++ show (index :: Integer)- | (index, (pn, _)) <- zip [0..] supers+ [ superclassName pn index+ | (index, Constraint _ pn _ _ _) <- zip [0..] supers ]++tuple3To2 :: (a, b, c) -> (a, b)+tuple3To2 (a, b, _) = (a, b)
+ src/Language/PureScript/Sugar/TypeClasses/Deriving.hs view
@@ -0,0 +1,207 @@+-- | This module implements the generic deriving elaboration that takes place during desugaring.+module Language.PureScript.Sugar.TypeClasses.Deriving (deriveInstances) where++import Prelude+import Protolude (note)++import Control.Monad.Error.Class (MonadError(..))+import Control.Monad.Supply.Class (MonadSupply)+import Data.List (foldl', find, unzip5)+import Language.PureScript.AST (Binder(..), CaseAlternative(..), DataConstructorDeclaration(..), Declaration(..), Expr(..), pattern MkUnguarded, Module(..), SourceSpan(..), TypeInstanceBody(..), pattern ValueDecl)+import Language.PureScript.AST.Utils (UnwrappedTypeConstructor(..), lamCase, unguarded, unwrapTypeConstructor)+import Language.PureScript.Constants.Libs qualified as Libs+import Language.PureScript.Crash (internalError)+import Language.PureScript.Environment (DataDeclType(..), NameKind(..))+import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage(..), errorMessage')+import Language.PureScript.Names (pattern ByNullSourcePos, Ident(..), ModuleName, ProperName(..), ProperNameType(..), Qualified(..), QualifiedBy(..), freshIdent)+import Language.PureScript.PSString (mkString)+import Language.PureScript.Types (SourceType, Type(..), WildcardData(..), replaceAllTypeVars, srcTypeApp, srcTypeConstructor, srcTypeLevelString)+import Language.PureScript.TypeChecker (checkNewtype)++-- | Elaborates deriving instance declarations by code generation.+deriveInstances+ :: forall m+ . (MonadError MultipleErrors m, MonadSupply m)+ => Module+ -> m Module+deriveInstances (Module ss coms mn ds exts) =+ Module ss coms mn <$> mapM (deriveInstance mn ds) ds <*> pure exts++-- | Takes a declaration, and if the declaration is a deriving TypeInstanceDeclaration,+-- elaborates that into an instance declaration via code generation.+--+-- More instance deriving happens during type checking. The instances+-- derived here are special for two reasons:+-- * they depend only on the structure of the data, not types; and+-- * they expect wildcard types from the user and generate type expressions+-- to replace them.+--+deriveInstance+ :: forall m+ . (MonadError MultipleErrors m, MonadSupply m)+ => ModuleName+ -> [Declaration]+ -> Declaration+ -> m Declaration+deriveInstance mn ds decl =+ case decl of+ TypeInstanceDeclaration sa@(ss, _) na ch idx nm deps className tys DerivedInstance -> let+ binaryWildcardClass :: (Declaration -> [SourceType] -> m ([Declaration], SourceType)) -> m Declaration+ binaryWildcardClass f = case tys of+ [ty1, ty2] -> case unwrapTypeConstructor ty1 of+ Just UnwrappedTypeConstructor{..} | mn == utcModuleName -> do+ checkIsWildcard ss utcTyCon ty2+ tyConDecl <- findTypeDecl ss utcTyCon ds+ (members, ty2') <- f tyConDecl utcArgs+ pure $ TypeInstanceDeclaration sa na ch idx nm deps className [ty1, ty2'] (ExplicitInstance members)+ _ -> throwError . errorMessage' ss $ ExpectedTypeConstructor className tys ty1+ _ -> throwError . errorMessage' ss $ InvalidDerivedInstance className tys 2++ in case className of+ Libs.Generic -> binaryWildcardClass (deriveGenericRep ss mn)+ Libs.Newtype -> binaryWildcardClass deriveNewtype+ _ -> pure decl+ _ -> pure decl++deriveGenericRep+ :: forall m+ . (MonadError MultipleErrors m, MonadSupply m)+ => SourceSpan+ -> ModuleName+ -> Declaration+ -> [SourceType]+ -> m ([Declaration], SourceType)+deriveGenericRep ss mn tyCon tyConArgs =+ case tyCon of+ DataDeclaration (ss', _) _ _ args dctors -> do+ x <- freshIdent "x"+ (reps, to, from) <- unzip3 <$> traverse makeInst dctors+ let rep = toRepTy reps+ inst | null reps =+ -- If there are no cases, spin+ [ ValueDecl (ss', []) (Ident "to") Public [] $ unguarded $+ lamCase x+ [ CaseAlternative+ [NullBinder]+ (unguarded (App (Var ss Libs.I_to) (Var ss' (Qualified ByNullSourcePos x))))+ ]+ , ValueDecl (ss', []) (Ident "from") Public [] $ unguarded $+ lamCase x+ [ CaseAlternative+ [NullBinder]+ (unguarded (App (Var ss Libs.I_from) (Var ss' (Qualified ByNullSourcePos x))))+ ]+ ]+ | otherwise =+ [ ValueDecl (ss', []) (Ident "to") Public [] $ unguarded $+ lamCase x (zipWith ($) (map underBinder (sumBinders (length dctors))) to)+ , ValueDecl (ss', []) (Ident "from") Public [] $ unguarded $+ lamCase x (zipWith ($) (map underExpr (sumExprs (length dctors))) from)+ ]++ subst = zipWith ((,) . fst) args tyConArgs+ return (inst, replaceAllTypeVars subst rep)+ _ -> internalError "deriveGenericRep: expected DataDeclaration"++ where++ select :: (a -> a) -> (a -> a) -> Int -> [a -> a]+ select _ _ 0 = []+ select _ _ 1 = [id]+ select l r n = take (n - 1) (iterate (r .) l) ++ [compN (n - 1) r]++ sumBinders :: Int -> [Binder -> Binder]+ sumBinders = select (ConstructorBinder ss Libs.C_Inl . pure)+ (ConstructorBinder ss Libs.C_Inr . pure)++ sumExprs :: Int -> [Expr -> Expr]+ sumExprs = select (App (Constructor ss Libs.C_Inl))+ (App (Constructor ss Libs.C_Inr))++ compN :: Int -> (a -> a) -> a -> a+ compN 0 _ = id+ compN n f = f . compN (n - 1) f++ makeInst+ :: DataConstructorDeclaration+ -> m (SourceType, CaseAlternative, CaseAlternative)+ makeInst (DataConstructorDeclaration _ ctorName args) = do+ let args' = map snd args+ (ctorTy, matchProduct, ctorArgs, matchCtor, mkProduct) <- makeProduct args'+ return ( srcTypeApp (srcTypeApp (srcTypeConstructor Libs.Constructor)+ (srcTypeLevelString $ mkString (runProperName ctorName)))+ ctorTy+ , CaseAlternative [ ConstructorBinder ss Libs.C_Constructor [matchProduct] ]+ (unguarded (foldl' App (Constructor ss (Qualified (ByModuleName mn) ctorName)) ctorArgs))+ , CaseAlternative [ ConstructorBinder ss (Qualified (ByModuleName mn) ctorName) matchCtor ]+ (unguarded (App (Constructor ss Libs.C_Constructor) mkProduct))+ )++ makeProduct+ :: [SourceType]+ -> m (SourceType, Binder, [Expr], [Binder], Expr)+ makeProduct [] =+ pure (srcTypeConstructor Libs.NoArguments, NullBinder, [], [], Constructor ss Libs.C_NoArguments)+ makeProduct args = do+ (tys, bs1, es1, bs2, es2) <- unzip5 <$> traverse makeArg args+ pure ( foldr1 (\f -> srcTypeApp (srcTypeApp (srcTypeConstructor Libs.Product) f)) tys+ , foldr1 (\b1 b2 -> ConstructorBinder ss Libs.C_Product [b1, b2]) bs1+ , es1+ , bs2+ , foldr1 (\e1 -> App (App (Constructor ss Libs.C_Product) e1)) es2+ )++ makeArg :: SourceType -> m (SourceType, Binder, Expr, Binder, Expr)+ makeArg arg = do+ argName <- freshIdent "arg"+ pure ( srcTypeApp (srcTypeConstructor Libs.Argument) arg+ , ConstructorBinder ss Libs.C_Argument [ VarBinder ss argName ]+ , Var ss (Qualified (BySourcePos $ spanStart ss) argName)+ , VarBinder ss argName+ , App (Constructor ss Libs.C_Argument) (Var ss (Qualified (BySourcePos $ spanStart ss) argName))+ )++ underBinder :: (Binder -> Binder) -> CaseAlternative -> CaseAlternative+ underBinder f (CaseAlternative bs e) = CaseAlternative (map f bs) e++ underExpr :: (Expr -> Expr) -> CaseAlternative -> CaseAlternative+ underExpr f (CaseAlternative b [MkUnguarded e]) = CaseAlternative b (unguarded (f e))+ underExpr _ _ = internalError "underExpr: expected unguarded alternative"++ toRepTy :: [SourceType] -> SourceType+ toRepTy [] = srcTypeConstructor Libs.NoConstructors+ toRepTy [only] = only+ toRepTy ctors = foldr1 (\f -> srcTypeApp (srcTypeApp (srcTypeConstructor Libs.Sum) f)) ctors++checkIsWildcard :: MonadError MultipleErrors m => SourceSpan -> ProperName 'TypeName -> SourceType -> m ()+checkIsWildcard _ _ (TypeWildcard _ UnnamedWildcard) = return ()+checkIsWildcard ss tyConNm _ =+ throwError . errorMessage' ss $ ExpectedWildcard tyConNm++deriveNewtype+ :: forall m+ . MonadError MultipleErrors m+ => Declaration+ -> [SourceType]+ -> m ([Declaration], SourceType)+deriveNewtype tyCon tyConArgs =+ case tyCon of+ DataDeclaration (ss', _) Data name _ _ ->+ throwError . errorMessage' ss' $ CannotDeriveNewtypeForData name+ DataDeclaration _ Newtype name args dctors -> do+ (_, (_, ty)) <- checkNewtype name dctors+ let subst = zipWith ((,) . fst) args tyConArgs+ return ([], replaceAllTypeVars subst ty)+ _ -> internalError "deriveNewtype: expected DataDeclaration"++findTypeDecl+ :: (MonadError MultipleErrors m)+ => SourceSpan+ -> ProperName 'TypeName+ -> [Declaration]+ -> m Declaration+findTypeDecl ss tyConNm = note (errorMessage' ss $ CannotFindDerivingType tyConNm) . find isTypeDecl+ where+ isTypeDecl :: Declaration -> Bool+ isTypeDecl (DataDeclaration _ _ nm _ _) = nm == tyConNm+ isTypeDecl _ = False
src/Language/PureScript/Sugar/TypeDeclarations.hs view
@@ -1,70 +1,97 @@------------------------------------------------------------------------------------ Module : Language.PureScript.Sugar.TypeDeclarations--- Copyright : (c) Phil Freeman 2013--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :--- -- |--- This module implements the desugaring pass which replaces top-level type declarations with--- type annotations on the corresponding expression.+-- This module implements the desugaring pass which replaces top-level type+-- declarations with type annotations on the corresponding expression. ----------------------------------------------------------------------------------{-# LANGUAGE FlexibleContexts #-}+module Language.PureScript.Sugar.TypeDeclarations+ ( desugarTypeDeclarationsModule+ ) where -module Language.PureScript.Sugar.TypeDeclarations (- desugarTypeDeclarations,- desugarTypeDeclarationsModule-) where+import Prelude -import Control.Applicative-import Control.Monad (forM)-import Control.Monad.Except (throwError)-import Control.Monad.Error.Class (MonadError)+import Control.Monad (unless)+import Control.Monad.Error.Class (MonadError(..)) -import Language.PureScript.AST-import Language.PureScript.Names-import Language.PureScript.Environment-import Language.PureScript.Errors-import Language.PureScript.Traversals+import Language.PureScript.AST (Declaration(..), ErrorMessageHint(..), Expr(..), GuardedExpr(..), KindSignatureFor(..), pattern MkUnguarded, Module(..), RoleDeclarationData(..), TypeDeclarationData(..), TypeInstanceBody(..), pattern ValueDecl, declSourceSpan, everywhereOnValuesTopDownM)+import Language.PureScript.Names (Ident, coerceProperName)+import Language.PureScript.Environment (DataDeclType(..), NameKind)+import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage(..), addHint, errorMessage', rethrow) -- | -- Replace all top level type declarations in a module with type annotations ---desugarTypeDeclarationsModule :: (Functor m, Applicative m, MonadError MultipleErrors m) => [Module] -> m [Module]-desugarTypeDeclarationsModule ms = forM ms $ \(Module coms name ds exps) ->- rethrow (onErrorMessages (ErrorInModule name)) $- Module coms name <$> desugarTypeDeclarations ds <*> pure exps---- |--- Replace all top level type declarations with type annotations----desugarTypeDeclarations :: (Functor m, Applicative m, MonadError MultipleErrors m) => [Declaration] -> m [Declaration]-desugarTypeDeclarations (PositionedDeclaration pos com d : ds) = do- (d' : ds') <- rethrowWithPosition pos $ desugarTypeDeclarations (d : ds)- return (PositionedDeclaration pos com d' : ds')-desugarTypeDeclarations (TypeDeclaration name ty : d : rest) = do- (_, nameKind, val) <- fromValueDeclaration d- desugarTypeDeclarations (ValueDeclaration name nameKind [] (Right (TypedValue True val ty)) : rest)- where- fromValueDeclaration :: (Functor m, Applicative m, MonadError MultipleErrors m) => Declaration -> m (Ident, NameKind, Expr)- fromValueDeclaration (ValueDeclaration name' nameKind [] (Right val)) | name == name' = return (name', nameKind, val)- fromValueDeclaration (PositionedDeclaration pos com d') = do- (ident, nameKind, val) <- rethrowWithPosition pos $ fromValueDeclaration d'- return (ident, nameKind, PositionedValue pos com val)- fromValueDeclaration _ = throwError . errorMessage $ OrphanTypeDeclaration name-desugarTypeDeclarations (TypeDeclaration name _ : []) = throwError . errorMessage $ OrphanTypeDeclaration name-desugarTypeDeclarations (ValueDeclaration name nameKind bs val : rest) = do- let (_, f, _) = everywhereOnValuesTopDownM return go return- f' (Left gs) = Left <$> mapM (pairM return f) gs- f' (Right v) = Right <$> f v- (:) <$> (ValueDeclaration name nameKind bs <$> f' val) <*> desugarTypeDeclarations rest+desugarTypeDeclarationsModule+ :: forall m+ . MonadError MultipleErrors m+ => Module+ -> m Module+desugarTypeDeclarationsModule (Module modSS coms name ds exps) =+ rethrow (addHint (ErrorInModule name)) $ do+ checkKindDeclarations ds+ checkRoleDeclarations Nothing ds+ Module modSS coms name <$> desugarTypeDeclarations ds <*> pure exps where- go (Let ds val') = Let <$> desugarTypeDeclarations ds <*> pure val'- go other = return other-desugarTypeDeclarations (d:ds) = (:) d <$> desugarTypeDeclarations ds-desugarTypeDeclarations [] = return []++ desugarTypeDeclarations :: [Declaration] -> m [Declaration]+ desugarTypeDeclarations (TypeDeclaration (TypeDeclarationData sa name' ty) : d : rest) = do+ (_, nameKind, val) <- fromValueDeclaration d+ desugarTypeDeclarations (ValueDecl sa name' nameKind [] [MkUnguarded (TypedValue True val ty)] : rest)+ where+ fromValueDeclaration :: Declaration -> m (Ident, NameKind, Expr)+ fromValueDeclaration (ValueDecl _ name'' nameKind [] [MkUnguarded val])+ | name' == name'' = return (name'', nameKind, val)+ fromValueDeclaration d' =+ throwError . errorMessage' (declSourceSpan d') $ OrphanTypeDeclaration name'+ desugarTypeDeclarations [TypeDeclaration (TypeDeclarationData (ss, _) name' _)] =+ throwError . errorMessage' ss $ OrphanTypeDeclaration name'+ desugarTypeDeclarations (ValueDecl sa name' nameKind bs val : rest) = do+ let (_, f, _) = everywhereOnValuesTopDownM return go return+ f' = mapM (\(GuardedExpr g e) -> GuardedExpr g <$> f e)+ (:) <$> (ValueDecl sa name' nameKind bs <$> f' val)+ <*> desugarTypeDeclarations rest+ where+ go (Let w ds' val') = Let w <$> desugarTypeDeclarations ds' <*> pure val'+ go other = return other+ desugarTypeDeclarations (TypeInstanceDeclaration sa na ch idx nm deps cls args (ExplicitInstance ds') : rest) =+ (:) <$> (TypeInstanceDeclaration sa na ch idx nm deps cls args . ExplicitInstance <$> desugarTypeDeclarations ds')+ <*> desugarTypeDeclarations rest+ desugarTypeDeclarations (d:rest) = (:) d <$> desugarTypeDeclarations rest+ desugarTypeDeclarations [] = return []++ checkKindDeclarations :: [Declaration] -> m ()+ checkKindDeclarations (KindDeclaration sa kindFor name' _ : d : rest) = do+ unless (matchesDeclaration d) . throwError . errorMessage' (fst sa) $ OrphanKindDeclaration name'+ checkKindDeclarations rest+ where+ matchesDeclaration :: Declaration -> Bool+ matchesDeclaration (DataDeclaration _ Data name'' _ _) = kindFor == DataSig && name' == name''+ matchesDeclaration (DataDeclaration _ Newtype name'' _ _) = kindFor == NewtypeSig && name' == name''+ matchesDeclaration (TypeSynonymDeclaration _ name'' _ _) = kindFor == TypeSynonymSig && name' == name''+ matchesDeclaration (TypeClassDeclaration _ name'' _ _ _ _) = kindFor == ClassSig && name' == coerceProperName name''+ matchesDeclaration _ = False+ checkKindDeclarations (KindDeclaration sa _ name' _ : _) = do+ throwError . errorMessage' (fst sa) $ OrphanKindDeclaration name'+ checkKindDeclarations (_ : rest) = checkKindDeclarations rest+ checkKindDeclarations [] = return ()++ checkRoleDeclarations :: Maybe Declaration -> [Declaration] -> m ()+ checkRoleDeclarations Nothing (RoleDeclaration RoleDeclarationData{..} : _) =+ throwError . errorMessage' (fst rdeclSourceAnn) $ OrphanRoleDeclaration rdeclIdent+ checkRoleDeclarations (Just (RoleDeclaration (RoleDeclarationData _ name' _))) ((RoleDeclaration RoleDeclarationData{..}) : _) | name' == rdeclIdent =+ throwError . errorMessage' (fst rdeclSourceAnn) $ DuplicateRoleDeclaration rdeclIdent+ checkRoleDeclarations (Just d) (rd@(RoleDeclaration RoleDeclarationData{..}) : rest) = do+ unless (matchesDeclaration d) . throwError . errorMessage' (fst rdeclSourceAnn) $ OrphanRoleDeclaration rdeclIdent+ unless (isSupported d) . throwError . errorMessage' (fst rdeclSourceAnn) $ UnsupportedRoleDeclaration+ checkRoleDeclarations (Just rd) rest+ where+ isSupported :: Declaration -> Bool+ isSupported DataDeclaration{} = True+ isSupported ExternDataDeclaration{} = True+ isSupported _ = False+ matchesDeclaration :: Declaration -> Bool+ matchesDeclaration (DataDeclaration _ _ name' _ _) = rdeclIdent == name'+ matchesDeclaration (ExternDataDeclaration _ name' _) = rdeclIdent == name'+ matchesDeclaration (TypeSynonymDeclaration _ name' _ _) = rdeclIdent == name'+ matchesDeclaration (TypeClassDeclaration _ name' _ _ _ _) = rdeclIdent == coerceProperName name'+ matchesDeclaration _ = False+ checkRoleDeclarations _ (d : rest) = checkRoleDeclarations (Just d) rest+ checkRoleDeclarations _ [] = return ()
src/Language/PureScript/Traversals.hs view
@@ -1,41 +1,23 @@------------------------------------------------------------------------------------ Module : Language.PureScript.Traversals--- Copyright : (c) 2014 Phil Freeman--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :--- -- | Common functions for implementing generic traversals---------------------------------------------------------------------------------- module Language.PureScript.Traversals where -import Control.Applicative--fstM :: (Functor f) => (a -> f c) -> (a, b) -> f (c, b)-fstM f (a, b) = flip (,) b <$> f a+import Prelude sndM :: (Functor f) => (b -> f c) -> (a, b) -> f (a, c)-sndM f (a, b) = (,) a <$> f b+sndM f (a, b) = (a, ) <$> f b +sndM' :: (Functor f) => (a -> b -> f c) -> (a, b) -> f (a, c)+sndM' f (a, b) = (a, ) <$> f a b+ thirdM :: (Functor f) => (c -> f d) -> (a, b, c) -> f (a, b, d)-thirdM f (a, b, c) = (,,) a b <$> f c+thirdM f (a, b, c) = (a, b, ) <$> f c pairM :: (Applicative f) => (a -> f c) -> (b -> f d) -> (a, b) -> f (c, d) pairM f g (a, b) = (,) <$> f a <*> g b -maybeM :: (Applicative f) => (a -> f b) -> Maybe a -> f (Maybe b)-maybeM _ Nothing = pure Nothing-maybeM f (Just a) = Just <$> f a- eitherM :: (Applicative f) => (a -> f c) -> (b -> f d) -> Either a b -> f (Either c d) eitherM f _ (Left a) = Left <$> f a eitherM _ g (Right b) = Right <$> g b defS :: (Monad m) => st -> val -> m (st, val) defS s val = return (s, val)-
src/Language/PureScript/TypeChecker.hs view
@@ -1,118 +1,236 @@------------------------------------------------------------------------------------ Module : Language.PureScript.TypeChecker--- Copyright : (c) Phil Freeman 2013--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :--- -- | -- The top-level type checker, which checks all declarations in a module. ----------------------------------------------------------------------------------{-# LANGUAGE FlexibleInstances #-}--module Language.PureScript.TypeChecker (- module T,- typeCheckModule-) where--import Language.PureScript.TypeChecker.Monad as T-import Language.PureScript.TypeChecker.Kinds as T-import Language.PureScript.TypeChecker.Types as T-import Language.PureScript.TypeChecker.Synonyms as T+module Language.PureScript.TypeChecker+ ( module T+ , typeCheckModule+ , checkNewtype+ ) where -import Data.Maybe-import Data.List (nub, (\\))-import Data.Foldable (for_)+import Prelude+import Protolude (headMay, maybeToLeft, ordNub) -import qualified Data.Map as M+import Control.Lens ((^..), _2)+import Control.Monad (when, unless, void, forM, zipWithM_)+import Control.Monad.Error.Class (MonadError(..))+import Control.Monad.State.Class (MonadState(..), modify, gets)+import Control.Monad.Supply.Class (MonadSupply)+import Control.Monad.Writer.Class (MonadWriter, tell) -import Control.Monad.State-import Control.Monad.Except+import Data.Foldable (for_, traverse_, toList)+import Data.List (nubBy, (\\), sort, group)+import Data.Maybe (fromMaybe, listToMaybe, mapMaybe)+import Data.Either (partitionEithers)+import Data.Text (Text)+import Data.List.NonEmpty qualified as NEL+import Data.Map qualified as M+import Data.Set qualified as S+import Data.Text qualified as T -import Language.PureScript.Types-import Language.PureScript.Names-import Language.PureScript.Kinds import Language.PureScript.AST-import Language.PureScript.TypeClassDictionaries-import Language.PureScript.Environment-import Language.PureScript.Errors+import Language.PureScript.AST.Declarations.ChainId (ChainId)+import Language.PureScript.Constants.Libs qualified as Libs+import Language.PureScript.Crash (internalError)+import Language.PureScript.Environment (DataDeclType(..), Environment(..), FunctionalDependency, NameKind(..), NameVisibility(..), TypeClassData(..), TypeKind(..), isDictTypeName, kindArity, makeTypeClassData, nominalRolesForKind, tyFunction)+import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage(..), addHint, errorMessage, errorMessage', positionedError, rethrow, warnAndRethrow)+import Language.PureScript.Linter (checkExhaustiveExpr)+import Language.PureScript.Linter.Wildcards (ignoreWildcardsUnderCompleteTypeSignatures)+import Language.PureScript.Names (Ident, ModuleName, ProperName, ProperNameType(..), Qualified(..), QualifiedBy(..), coerceProperName, disqualify, isPlainIdent, mkQualified)+import Language.PureScript.Roles (Role)+import Language.PureScript.Sugar.Names.Env (Exports(..))+import Language.PureScript.TypeChecker.Kinds as T+import Language.PureScript.TypeChecker.Monad as T+import Language.PureScript.TypeChecker.Roles as T+import Language.PureScript.TypeChecker.Synonyms as T+import Language.PureScript.TypeChecker.Types as T+import Language.PureScript.TypeChecker.Unify (varIfUnknown)+import Language.PureScript.TypeClassDictionaries (NamedDict, TypeClassDictionaryInScope(..))+import Language.PureScript.Types (Constraint(..), SourceConstraint, SourceType, Type(..), containsForAll, eqType, everythingOnTypes, overConstraintArgs, srcInstanceType, unapplyTypes) -addDataType :: ModuleName -> DataDeclType -> ProperName -> [(String, Maybe Kind)] -> [(ProperName, [Type])] -> Kind -> Check ()+addDataType+ :: (MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m)+ => ModuleName+ -> DataDeclType+ -> ProperName 'TypeName+ -> [(Text, Maybe SourceType, Role)]+ -> [(DataConstructorDeclaration, SourceType)]+ -> SourceType+ -> m () addDataType moduleName dtype name args dctors ctorKind = do env <- getEnv- putEnv $ env { types = M.insert (Qualified (Just moduleName) name) (ctorKind, DataType args dctors) (types env) }- forM_ dctors $ \(dctor, tys) ->- rethrow (onErrorMessages (ErrorInDataConstructor dctor)) $- addDataConstructor moduleName dtype name (map fst args) dctor tys+ let mapDataCtor (DataConstructorDeclaration _ ctorName vars) = (ctorName, snd <$> vars)+ qualName = Qualified (ByModuleName moduleName) name+ hasSig = qualName `M.member` types env+ putEnv $ env { types = M.insert qualName (ctorKind, DataType dtype args (map (mapDataCtor . fst) dctors)) (types env) }+ unless (hasSig || isDictTypeName name || not (containsForAll ctorKind)) $ do+ tell . errorMessage $ MissingKindDeclaration (if dtype == Newtype then NewtypeSig else DataSig) name ctorKind+ for_ dctors $ \(DataConstructorDeclaration _ dctor fields, polyType) ->+ warnAndRethrow (addHint (ErrorInDataConstructor dctor)) $+ addDataConstructor moduleName dtype name dctor fields polyType -addDataConstructor :: ModuleName -> DataDeclType -> ProperName -> [String] -> ProperName -> [Type] -> Check ()-addDataConstructor moduleName dtype name args dctor tys = do+addDataConstructor+ :: (MonadState CheckState m, MonadError MultipleErrors m)+ => ModuleName+ -> DataDeclType+ -> ProperName 'TypeName+ -> ProperName 'ConstructorName+ -> [(Ident, SourceType)]+ -> SourceType+ -> m ()+addDataConstructor moduleName dtype name dctor dctorArgs polyType = do+ let fields = fst <$> dctorArgs env <- getEnv- mapM_ checkTypeSynonyms tys- let retTy = foldl TypeApp (TypeConstructor (Qualified (Just moduleName) name)) (map TypeVar args)- let dctorTy = foldr function retTy tys- let polyType = mkForAll args dctorTy- let fields = [Ident ("value" ++ show n) | n <- [0..(length tys - 1)]]- putEnv $ env { dataConstructors = M.insert (Qualified (Just moduleName) dctor) (dtype, name, polyType, fields) (dataConstructors env) }+ checkTypeSynonyms polyType+ putEnv $ env { dataConstructors = M.insert (Qualified (ByModuleName moduleName) dctor) (dtype, name, polyType, fields) (dataConstructors env) } -addTypeSynonym :: ModuleName -> ProperName -> [(String, Maybe Kind)] -> Type -> Kind -> Check ()+checkRoleDeclaration+ :: (MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m)+ => ModuleName+ -> RoleDeclarationData+ -> m ()+checkRoleDeclaration moduleName (RoleDeclarationData (ss, _) name declaredRoles) = do+ warnAndRethrow (addHint (ErrorInRoleDeclaration name) . addHint (positionedError ss)) $ do+ env <- getEnv+ let qualName = Qualified (ByModuleName moduleName) name+ case M.lookup qualName (types env) of+ Just (kind, DataType dtype args dctors) -> do+ checkRoleDeclarationArity name declaredRoles (length args)+ checkRoles args declaredRoles+ let args' = zipWith (\(v, k, _) r -> (v, k, r)) args declaredRoles+ putEnv $ env { types = M.insert qualName (kind, DataType dtype args' dctors) (types env) }+ Just (kind, ExternData _) -> do+ checkRoleDeclarationArity name declaredRoles (kindArity kind)+ putEnv $ env { types = M.insert qualName (kind, ExternData declaredRoles) (types env) }+ _ -> internalError "Unsupported role declaration"++addTypeSynonym+ :: (MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m)+ => ModuleName+ -> ProperName 'TypeName+ -> [(Text, Maybe SourceType)]+ -> SourceType+ -> SourceType+ -> m () addTypeSynonym moduleName name args ty kind = do env <- getEnv checkTypeSynonyms ty- putEnv $ env { types = M.insert (Qualified (Just moduleName) name) (kind, TypeSynonym) (types env)- , typeSynonyms = M.insert (Qualified (Just moduleName) name) (args, ty) (typeSynonyms env) }+ let qualName = Qualified (ByModuleName moduleName) name+ hasSig = qualName `M.member` types env+ unless (hasSig || not (containsForAll kind)) $ do+ tell . errorMessage $ MissingKindDeclaration TypeSynonymSig name kind+ putEnv $ env { types = M.insert qualName (kind, TypeSynonym) (types env)+ , typeSynonyms = M.insert qualName (args, ty) (typeSynonyms env) } -valueIsNotDefined :: ModuleName -> Ident -> Check ()+valueIsNotDefined+ :: (MonadState CheckState m, MonadError MultipleErrors m)+ => ModuleName+ -> Ident+ -> m () valueIsNotDefined moduleName name = do env <- getEnv- case M.lookup (moduleName, name) (names env) of+ case M.lookup (Qualified (ByModuleName moduleName) name) (names env) of Just _ -> throwError . errorMessage $ RedefinedIdent name Nothing -> return () -addValue :: ModuleName -> Ident -> Type -> NameKind -> Check ()+addValue+ :: (MonadState CheckState m)+ => ModuleName+ -> Ident+ -> SourceType+ -> NameKind+ -> m () addValue moduleName name ty nameKind = do env <- getEnv- putEnv (env { names = M.insert (moduleName, name) (ty, nameKind, Defined) (names env) })+ putEnv (env { names = M.insert (Qualified (ByModuleName moduleName) name) (ty, nameKind, Defined) (names env) }) -addTypeClass :: ModuleName -> ProperName -> [(String, Maybe Kind)] -> [Constraint] -> [Declaration] -> Check ()-addTypeClass moduleName pn args implies ds =- let members = map toPair ds in- modify $ \st -> st { checkEnv = (checkEnv st) { typeClasses = M.insert (Qualified (Just moduleName) pn) (args, members, implies) (typeClasses . checkEnv $ st) } }+addTypeClass+ :: forall m+ . (MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m)+ => ModuleName+ -> Qualified (ProperName 'ClassName)+ -> [(Text, Maybe SourceType)]+ -> [SourceConstraint]+ -> [FunctionalDependency]+ -> [Declaration]+ -> SourceType+ -> m ()+addTypeClass _ qualifiedClassName args implies dependencies ds kind = do+ env <- getEnv+ newClass <- mkNewClass+ let qualName = fmap coerceProperName qualifiedClassName+ hasSig = qualName `M.member` types env+ unless (hasSig || not (containsForAll kind)) $ do+ tell . errorMessage $ MissingKindDeclaration ClassSig (disqualify qualName) kind+ putEnv $ env { types = M.insert qualName (kind, ExternData (nominalRolesForKind kind)) (types env)+ , typeClasses = M.insert qualifiedClassName newClass (typeClasses env) } where- toPair (TypeDeclaration ident ty) = (ident, ty)- toPair (PositionedDeclaration _ _ d) = toPair d- toPair _ = error "Invalid declaration in TypeClassDeclaration"+ classMembers :: [(Ident, SourceType)]+ classMembers = map toPair ds -addTypeClassDictionaries :: [TypeClassDictionaryInScope] -> Check ()-addTypeClassDictionaries entries =- let mentries = M.fromList [ ((canonicalizeDictionary entry, mn), entry) | entry@TypeClassDictionaryInScope{ tcdName = Qualified mn _ } <- entries ]- in modify $ \st -> st { checkEnv = (checkEnv st) { typeClassDictionaries = (typeClassDictionaries . checkEnv $ st) `M.union` mentries } }+ mkNewClass :: m TypeClassData+ mkNewClass = do+ env <- getEnv+ implies' <- (traverse . overConstraintArgs . traverse) replaceAllTypeSynonyms implies+ let ctIsEmpty = null classMembers && all (typeClassIsEmpty . findSuperClass env) implies'+ pure $ makeTypeClassData args classMembers implies' dependencies ctIsEmpty+ where+ findSuperClass env c = case M.lookup (constraintClass c) (typeClasses env) of+ Just tcd -> tcd+ Nothing -> internalError "Unknown super class in TypeClassDeclaration" -checkDuplicateTypeArguments :: [String] -> Check ()+ toPair (TypeDeclaration (TypeDeclarationData _ ident ty)) = (ident, ty)+ toPair _ = internalError "Invalid declaration in TypeClassDeclaration"++addTypeClassDictionaries+ :: (MonadState CheckState m)+ => QualifiedBy+ -> M.Map (Qualified (ProperName 'ClassName)) (M.Map (Qualified Ident) (NEL.NonEmpty NamedDict))+ -> m ()+addTypeClassDictionaries mn entries =+ modify $ \st -> st { checkEnv = (checkEnv st) { typeClassDictionaries = insertState st } }+ where insertState st = M.insertWith (M.unionWith (M.unionWith (<>))) mn entries (typeClassDictionaries . checkEnv $ st)++checkDuplicateTypeArguments+ :: (MonadState CheckState m, MonadError MultipleErrors m)+ => [Text]+ -> m () checkDuplicateTypeArguments args = for_ firstDup $ \dup -> throwError . errorMessage $ DuplicateTypeArgument dup where- firstDup :: Maybe String- firstDup = listToMaybe $ args \\ nub args+ firstDup :: Maybe Text+ firstDup = listToMaybe $ args \\ ordNub args -checkTypeClassInstance :: ModuleName -> Type -> Check ()-checkTypeClassInstance _ (TypeVar _) = return ()-checkTypeClassInstance _ (TypeConstructor ctor) = do- env <- getEnv- when (ctor `M.member` typeSynonyms env) . throwError . errorMessage $ TypeSynonymInstance- return ()-checkTypeClassInstance m (TypeApp t1 t2) = checkTypeClassInstance m t1 >> checkTypeClassInstance m t2-checkTypeClassInstance _ ty = throwError . errorMessage $ InvalidInstanceHead ty+checkTypeClassInstance+ :: (MonadState CheckState m, MonadError MultipleErrors m)+ => TypeClassData+ -> Int -- ^ index of type class argument+ -> SourceType+ -> m ()+checkTypeClassInstance cls i = check where+ -- If the argument is determined via fundeps then we are less restrictive in+ -- what type is allowed. This is because the type cannot be used to influence+ -- which instance is selected. Currently the only weakened restriction is that+ -- row types are allowed in determined type class arguments.+ isFunDepDetermined = S.member i (typeClassDeterminedArguments cls)+ check = \case+ TypeVar _ _ -> return ()+ TypeLevelString _ _ -> return ()+ TypeLevelInt _ _ -> return ()+ TypeConstructor _ _ -> return ()+ TypeApp _ t1 t2 -> check t1 >> check t2+ KindApp _ t k -> check t >> check k+ KindedType _ t _ -> check t+ REmpty _ | isFunDepDetermined -> return ()+ RCons _ _ hd tl | isFunDepDetermined -> check hd >> check tl+ ty -> throwError . errorMessage $ InvalidInstanceHead ty -- | -- Check that type synonyms are fully-applied in a type ---checkTypeSynonyms :: Type -> Check ()+checkTypeSynonyms+ :: (MonadState CheckState m, MonadError MultipleErrors m)+ => SourceType+ -> m () checkTypeSynonyms = void . replaceAllTypeSynonyms -- |@@ -124,224 +242,552 @@ -- -- * Type-check all values and add them to the @Environment@ --+-- * Infer all type roles and add them to the @Environment@+-- -- * Bring type class instances into scope -- -- * Process module imports ---typeCheckAll :: Maybe ModuleName -> ModuleName -> [DeclarationRef] -> [Declaration] -> Check [Declaration]-typeCheckAll mainModuleName moduleName exps = go+typeCheckAll+ :: forall m+ . (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m)+ => ModuleName+ -> [Declaration]+ -> m [Declaration]+typeCheckAll moduleName = traverse go where- go :: [Declaration] -> Check [Declaration]- go [] = return []- go (DataDeclaration dtype name args dctors : rest) = do- rethrow (onErrorMessages (ErrorInTypeConstructor name)) $ do- when (dtype == Newtype) $ checkNewtype dctors+ go :: Declaration -> m Declaration+ go (DataDeclaration sa@(ss, _) dtype name args dctors) = do+ warnAndRethrow (addHint (ErrorInTypeConstructor name) . addHint (positionedError ss)) $ do+ when (dtype == Newtype) $ void $ checkNewtype name dctors checkDuplicateTypeArguments $ map fst args- ctorKind <- kindsOf True moduleName name args (concatMap snd dctors)+ (dataCtors, ctorKind) <- kindOfData moduleName (sa, name, args, dctors) let args' = args `withKinds` ctorKind- addDataType moduleName dtype name args' dctors ctorKind- ds <- go rest- return $ DataDeclaration dtype name args dctors : ds- where- checkNewtype :: [(ProperName, [Type])] -> Check ()- checkNewtype [(_, [_])] = return ()- checkNewtype [(_, _)] = throwError . errorMessage $ InvalidNewtype- checkNewtype _ = throwError . errorMessage $ InvalidNewtype- go (d@(DataBindingGroupDeclaration tys) : rest) = do- rethrow (onErrorMessages ErrorInDataBindingGroup) $ do- let syns = mapMaybe toTypeSynonym tys- let dataDecls = mapMaybe toDataDecl tys- (syn_ks, data_ks) <- kindsOfAll moduleName syns (map (\(_, name, args, dctors) -> (name, args, concatMap snd dctors)) dataDecls)- forM_ (zip dataDecls data_ks) $ \((dtype, name, args, dctors), ctorKind) -> do- checkDuplicateTypeArguments $ map fst args- let args' = args `withKinds` ctorKind- addDataType moduleName dtype name args' dctors ctorKind- forM_ (zip syns syn_ks) $ \((name, args, ty), kind) -> do+ env <- getEnv+ dctors' <- traverse (replaceTypeSynonymsInDataConstructor . fst) dataCtors+ let args'' = args' `withRoles` inferRoles env moduleName name args' dctors'+ addDataType moduleName dtype name args'' dataCtors ctorKind+ return $ DataDeclaration sa dtype name args dctors+ go d@(DataBindingGroupDeclaration tys) = do+ let tysList = NEL.toList tys+ syns = mapMaybe toTypeSynonym tysList+ dataDecls = mapMaybe toDataDecl tysList+ roleDecls = mapMaybe toRoleDecl tysList+ clss = mapMaybe toClassDecl tysList+ bindingGroupNames = ordNub ((syns ^.. traverse . _2) ++ (dataDecls ^.. traverse . _2 . _2) ++ fmap coerceProperName (clss ^.. traverse . _2 . _2))+ sss = fmap declSourceSpan tys+ warnAndRethrow (addHint (ErrorInDataBindingGroup bindingGroupNames) . addHint (PositionedError sss)) $ do+ env <- getEnv+ (syn_ks, data_ks, cls_ks) <- kindsOfAll moduleName syns (fmap snd dataDecls) (fmap snd clss)+ for_ (zip syns syn_ks) $ \((_, name, args, _), (elabTy, kind)) -> do checkDuplicateTypeArguments $ map fst args let args' = args `withKinds` kind- addTypeSynonym moduleName name args' ty kind- ds <- go rest- return $ d : ds+ addTypeSynonym moduleName name args' elabTy kind+ let dataDeclsWithKinds = zipWith (\(dtype, (_, name, args, _)) (dataCtors, ctorKind) ->+ (dtype, name, args `withKinds` ctorKind, dataCtors, ctorKind)) dataDecls data_ks+ inferRoles' <- fmap (inferDataBindingGroupRoles env moduleName roleDecls) .+ forM dataDeclsWithKinds $ \(_, name, args, dataCtors, _) ->+ (name, args,) <$> traverse (replaceTypeSynonymsInDataConstructor . fst) dataCtors+ for_ dataDeclsWithKinds $ \(dtype, name, args', dataCtors, ctorKind) -> do+ when (dtype == Newtype) $ void $ checkNewtype name (map fst dataCtors)+ checkDuplicateTypeArguments $ map fst args'+ let args'' = args' `withRoles` inferRoles' name args'+ addDataType moduleName dtype name args'' dataCtors ctorKind+ for_ roleDecls $ checkRoleDeclaration moduleName+ for_ (zip clss cls_ks) $ \((deps, (sa, pn, _, _, _)), (args', implies', tys', kind)) -> do+ let qualifiedClassName = Qualified (ByModuleName moduleName) pn+ guardWith (errorMessage (DuplicateTypeClass pn (fst sa))) $+ not (M.member qualifiedClassName (typeClasses env))+ addTypeClass moduleName qualifiedClassName (fmap Just <$> args') implies' deps tys' kind+ return d where- toTypeSynonym (TypeSynonymDeclaration nm args ty) = Just (nm, args, ty)- toTypeSynonym (PositionedDeclaration _ _ d') = toTypeSynonym d'+ toTypeSynonym (TypeSynonymDeclaration sa nm args ty) = Just (sa, nm, args, ty) toTypeSynonym _ = Nothing- toDataDecl (DataDeclaration dtype nm args dctors) = Just (dtype, nm, args, dctors)- toDataDecl (PositionedDeclaration _ _ d') = toDataDecl d'+ toDataDecl (DataDeclaration sa dtype nm args dctors) = Just (dtype, (sa, nm, args, dctors)) toDataDecl _ = Nothing- go (TypeSynonymDeclaration name args ty : rest) = do- rethrow (onErrorMessages (ErrorInTypeSynonym name)) $ do+ toRoleDecl (RoleDeclaration rdd) = Just rdd+ toRoleDecl _ = Nothing+ toClassDecl (TypeClassDeclaration sa nm args implies deps decls) = Just (deps, (sa, nm, args, implies, decls))+ toClassDecl _ = Nothing+ go (TypeSynonymDeclaration sa@(ss, _) name args ty) = do+ warnAndRethrow (addHint (ErrorInTypeSynonym name) . addHint (positionedError ss) ) $ do checkDuplicateTypeArguments $ map fst args- kind <- kindsOf False moduleName name args [ty]+ (elabTy, kind) <- kindOfTypeSynonym moduleName (sa, name, args, ty) let args' = args `withKinds` kind- addTypeSynonym moduleName name args' ty kind- ds <- go rest- return $ TypeSynonymDeclaration name args ty : ds- go (TypeDeclaration _ _ : _) = error "Type declarations should have been removed"- go (ValueDeclaration name nameKind [] (Right val) : rest) = do- d <- rethrow (onErrorMessages (ErrorInValueDeclaration name)) $ do+ addTypeSynonym moduleName name args' elabTy kind+ return $ TypeSynonymDeclaration sa name args ty+ go (KindDeclaration sa@(ss, _) kindFor name ty) = do+ warnAndRethrow (addHint (ErrorInKindDeclaration name) . addHint (positionedError ss)) $ do+ elabTy <- withFreshSubstitution $ checkKindDeclaration moduleName ty+ env <- getEnv+ putEnv $ env { types = M.insert (Qualified (ByModuleName moduleName) name) (elabTy, LocalTypeVariable) (types env) }+ return $ KindDeclaration sa kindFor name elabTy+ go d@(RoleDeclaration rdd) = do+ checkRoleDeclaration moduleName rdd+ return d+ go TypeDeclaration{} =+ internalError "Type declarations should have been removed before typeCheckAlld"+ go (ValueDecl sa@(ss, _) name nameKind [] [MkUnguarded val]) = do+ env <- getEnv+ let declHint = if isPlainIdent name then addHint (ErrorInValueDeclaration name) else id+ warnAndRethrow (declHint . addHint (positionedError ss)) $ do+ val' <- checkExhaustiveExpr ss env moduleName val valueIsNotDefined moduleName name- [(_, (val', ty))] <- typesOf mainModuleName moduleName [(name, val)]- addValue moduleName name ty nameKind- return $ ValueDeclaration name nameKind [] $ Right val'- ds <- go rest- return $ d : ds- go (ValueDeclaration{} : _) = error "Binders were not desugared"- go (BindingGroupDeclaration vals : rest) = do- d <- rethrow (onErrorMessages (ErrorInBindingGroup (map (\(ident, _, _) -> ident) vals))) $ do- forM_ (map (\(ident, _, _) -> ident) vals) $ \name ->- valueIsNotDefined moduleName name- tys <- typesOf mainModuleName moduleName $ map (\(ident, _, ty) -> (ident, ty)) vals- vals' <- forM [ (name, val, nameKind, ty)- | (name, nameKind, _) <- vals- , (name', (val, ty)) <- tys- , name == name'- ] $ \(name, val, nameKind, ty) -> do- addValue moduleName name ty nameKind- return (name, nameKind, val)- return $ BindingGroupDeclaration vals'- ds <- go rest- return $ d : ds- go (d@(ExternDataDeclaration name kind) : rest) = do+ typesOf NonRecursiveBindingGroup moduleName [((sa, name), val')] >>= \case+ [(_, (val'', ty))] -> do+ addValue moduleName name ty nameKind+ return $ ValueDecl sa name nameKind [] [MkUnguarded val'']+ _ -> internalError "typesOf did not return a singleton"+ go ValueDeclaration{} = internalError "Binders were not desugared"+ go BoundValueDeclaration{} = internalError "BoundValueDeclaration should be desugared"+ go (BindingGroupDeclaration vals) = do env <- getEnv- putEnv $ env { types = M.insert (Qualified (Just moduleName) name) (kind, ExternData) (types env) }- ds <- go rest- return $ d : ds- go (d@(ExternDeclaration importTy name _ ty) : rest) = do- rethrow (onErrorMessages (ErrorInForeignImport name)) $ do+ let sss = fmap (\(((ss, _), _), _, _) -> ss) vals+ warnAndRethrow (addHint (ErrorInBindingGroup (fmap (\((_, ident), _, _) -> ident) vals)) . addHint (PositionedError sss)) $ do+ for_ vals $ \((_, ident), _, _) -> valueIsNotDefined moduleName ident+ vals' <- NEL.toList <$> traverse (\(sai@((ss, _), _), nk, expr) -> (sai, nk,) <$> checkExhaustiveExpr ss env moduleName expr) vals+ tys <- typesOf RecursiveBindingGroup moduleName $ fmap (\(sai, _, ty) -> (sai, ty)) vals'+ vals'' <- forM [ (sai, val, nameKind, ty)+ | (sai@(_, name), nameKind, _) <- vals'+ , ((_, name'), (val, ty)) <- tys+ , name == name'+ ] $ \(sai@(_, name), val, nameKind, ty) -> do+ addValue moduleName name ty nameKind+ return (sai, nameKind, val)+ return . BindingGroupDeclaration $ NEL.fromList vals''+ go d@(ExternDataDeclaration (ss, _) name kind) = do+ warnAndRethrow (addHint (ErrorInForeignImportData name) . addHint (positionedError ss)) $ do+ elabKind <- withFreshSubstitution $ checkKindDeclaration moduleName kind env <- getEnv- kind <- kindOf moduleName ty- guardWith (errorMessage (ExpectedType kind)) $ kind == Star- case M.lookup (moduleName, name) (names env) of+ let qualName = Qualified (ByModuleName moduleName) name+ roles = nominalRolesForKind elabKind+ putEnv $ env { types = M.insert qualName (elabKind, ExternData roles) (types env) }+ return d+ go d@(ExternDeclaration (ss, _) name ty) = do+ warnAndRethrow (addHint (ErrorInForeignImport name) . addHint (positionedError ss)) $ do+ env <- getEnv+ (elabTy, kind) <- withFreshSubstitution $ do+ ((unks, ty'), kind) <- kindOfWithUnknowns ty+ ty'' <- varIfUnknown unks ty'+ pure (ty'', kind)+ checkTypeKind elabTy kind+ case M.lookup (Qualified (ByModuleName moduleName) name) (names env) of Just _ -> throwError . errorMessage $ RedefinedIdent name- Nothing -> putEnv (env { names = M.insert (moduleName, name) (ty, Extern importTy, Defined) (names env) })- ds <- go rest- return $ d : ds- go (d@(FixityDeclaration _ name) : rest) = do- ds <- go rest- env <- getEnv- guardWith (errorMessage (OrphanFixityDeclaration name)) $ M.member (moduleName, Op name) $ names env- return $ d : ds- go (d@(ImportDeclaration importedModule _ _) : rest) = do- tcds <- getTypeClassDictionaries- let instances = filter (\tcd -> let Qualified (Just mn) _ = tcdName tcd in importedModule == mn) tcds- addTypeClassDictionaries [ tcd { tcdName = Qualified (Just moduleName) ident, tcdType = TCDAlias (canonicalizeDictionary tcd) }- | tcd <- instances- , tcdExported tcd- , let (Qualified _ ident) = tcdName tcd- ]- ds <- go rest- return $ d : ds- go (d@(TypeClassDeclaration pn args implies tys) : rest) = do- addTypeClass moduleName pn args implies tys- ds <- go rest- return $ d : ds- go (d@(TypeInstanceDeclaration dictName deps className tys _) : rest) = do- goInstance d dictName deps className tys rest- go (d@(ExternInstanceDeclaration dictName deps className tys) : rest) = do- goInstance d dictName deps className tys rest- go (PositionedDeclaration pos com d : rest) =- rethrowWithPosition pos $ do- (d' : rest') <- go (d : rest)- return (PositionedDeclaration pos com d' : rest')- goInstance :: Declaration -> Ident -> [Constraint] -> Qualified ProperName -> [Type] -> [Declaration] -> Check [Declaration]- goInstance d dictName deps className tys rest = do- mapM_ (checkTypeClassInstance moduleName) tys- forM_ deps $ mapM_ (checkTypeClassInstance moduleName) . snd- addTypeClassDictionaries [TypeClassDictionaryInScope (Qualified (Just moduleName) dictName) className tys (Just deps) TCDRegular isInstanceExported]- ds <- go rest- return $ d : ds+ Nothing -> putEnv (env { names = M.insert (Qualified (ByModuleName moduleName) name) (elabTy, External, Defined) (names env) })+ return d+ go d@FixityDeclaration{} = return d+ go d@ImportDeclaration{} = return d+ go d@(TypeClassDeclaration sa@(ss, _) pn args implies deps tys) = do+ warnAndRethrow (addHint (ErrorInTypeClassDeclaration pn) . addHint (positionedError ss)) $ do+ env <- getEnv+ let qualifiedClassName = Qualified (ByModuleName moduleName) pn+ guardWith (errorMessage (DuplicateTypeClass pn ss)) $+ not (M.member qualifiedClassName (typeClasses env))+ (args', implies', tys', kind) <- kindOfClass moduleName (sa, pn, args, implies, tys)+ addTypeClass moduleName qualifiedClassName (fmap Just <$> args') implies' deps tys' kind+ return d+ go (TypeInstanceDeclaration _ _ _ _ (Left _) _ _ _ _) = internalError "typeCheckAll: type class instance generated name should have been desugared"+ go d@(TypeInstanceDeclaration sa@(ss, _) _ ch idx (Right dictName) deps className tys body) =+ rethrow (addHint (ErrorInInstance className tys) . addHint (positionedError ss)) $ do+ env <- getEnv+ let qualifiedDictName = Qualified (ByModuleName moduleName) dictName+ flip (traverse_ . traverse_) (typeClassDictionaries env) $ \dictionaries ->+ guardWith (errorMessage (DuplicateInstance dictName ss)) $+ not (M.member qualifiedDictName dictionaries)+ case M.lookup className (typeClasses env) of+ Nothing -> internalError "typeCheckAll: Encountered unknown type class in instance declaration"+ Just typeClass -> do+ checkInstanceArity dictName className typeClass tys+ (deps', kinds', tys', vars) <- withFreshSubstitution $ checkInstanceDeclaration moduleName (sa, deps, className, tys)+ tys'' <- traverse replaceAllTypeSynonyms tys'+ zipWithM_ (checkTypeClassInstance typeClass) [0..] tys''+ let nonOrphanModules = findNonOrphanModules className typeClass tys''+ checkOrphanInstance dictName className tys'' nonOrphanModules+ let chainId = Just ch+ checkOverlappingInstance ss chainId dictName vars className typeClass tys'' nonOrphanModules+ _ <- traverseTypeInstanceBody checkInstanceMembers body+ deps'' <- (traverse . overConstraintArgs . traverse) replaceAllTypeSynonyms deps'+ let dict =+ TypeClassDictionaryInScope chainId idx qualifiedDictName [] className vars kinds' tys'' (Just deps'') $+ if isPlainIdent dictName then Nothing else Just $ srcInstanceType ss vars className tys''+ addTypeClassDictionaries (ByModuleName moduleName) . M.singleton className $ M.singleton (tcdValue dict) (pure dict)+ return d + checkInstanceArity :: Ident -> Qualified (ProperName 'ClassName) -> TypeClassData -> [SourceType] -> m ()+ checkInstanceArity dictName className typeClass tys = do+ let typeClassArity = length (typeClassArguments typeClass)+ instanceArity = length tys+ when (typeClassArity /= instanceArity) $+ throwError . errorMessage $ ClassInstanceArityMismatch dictName className typeClassArity instanceArity++ checkInstanceMembers :: [Declaration] -> m [Declaration]+ checkInstanceMembers instDecls = do+ let idents = sort . map head . group . map memberName $ instDecls+ for_ (firstDuplicate idents) $ \ident ->+ throwError . errorMessage $ DuplicateValueDeclaration ident+ return instDecls where+ memberName :: Declaration -> Ident+ memberName (ValueDeclaration vd) = valdeclIdent vd+ memberName _ = internalError "checkInstanceMembers: Invalid declaration in type instance definition" - isInstanceExported :: Bool- isInstanceExported = any exportsInstance exps+ firstDuplicate :: (Eq a) => [a] -> Maybe a+ firstDuplicate (x : xs@(y : _))+ | x == y = Just x+ | otherwise = firstDuplicate xs+ firstDuplicate _ = Nothing - exportsInstance :: DeclarationRef -> Bool- exportsInstance (TypeInstanceRef name) | name == dictName = True- exportsInstance (PositionedDeclarationRef _ _ r) = exportsInstance r- exportsInstance _ = False+ findNonOrphanModules+ :: Qualified (ProperName 'ClassName)+ -> TypeClassData+ -> [SourceType]+ -> S.Set ModuleName+ findNonOrphanModules (Qualified (ByModuleName mn') _) typeClass tys' = nonOrphanModules+ where+ nonOrphanModules :: S.Set ModuleName+ nonOrphanModules = S.insert mn' nonOrphanModules' - -- |+ typeModule :: SourceType -> Maybe ModuleName+ typeModule (TypeVar _ _) = Nothing+ typeModule (TypeLevelString _ _) = Nothing+ typeModule (TypeLevelInt _ _) = Nothing+ typeModule (TypeConstructor _ (Qualified (ByModuleName mn'') _)) = Just mn''+ typeModule (TypeConstructor _ (Qualified (BySourcePos _) _)) = internalError "Unqualified type name in findNonOrphanModules"+ typeModule (TypeApp _ t1 _) = typeModule t1+ typeModule (KindApp _ t1 _) = typeModule t1+ typeModule (KindedType _ t1 _) = typeModule t1+ typeModule _ = internalError "Invalid type in instance in findNonOrphanModules"++ modulesByTypeIndex :: M.Map Int (Maybe ModuleName)+ modulesByTypeIndex = M.fromList (zip [0 ..] (typeModule <$> tys'))++ lookupModule :: Int -> S.Set ModuleName+ lookupModule idx = case M.lookup idx modulesByTypeIndex of+ Just ms -> S.fromList (toList ms)+ Nothing -> internalError "Unknown type index in findNonOrphanModules"++ -- If the instance is declared in a module that wouldn't be found based on a covering set+ -- then it is considered an orphan - because we'd have a situation in which we expect an+ -- instance but can't find it. So a valid module must be applicable across *all* covering+ -- sets - therefore we take the intersection of covering set modules.+ nonOrphanModules' :: S.Set ModuleName+ nonOrphanModules' = foldl1 S.intersection (foldMap lookupModule `S.map` typeClassCoveringSets typeClass)+ findNonOrphanModules _ _ _ = internalError "Unqualified class name in findNonOrphanModules"++ -- Check that the instance currently being declared doesn't overlap with any+ -- other instance in any module that this instance wouldn't be considered an+ -- orphan in. There are overlapping instance situations that won't be caught+ -- by this, for example when combining multiparameter type classes with+ -- flexible instances: the instances `Cls X y` and `Cls x Y` overlap and+ -- could live in different modules but won't be caught here.+ checkOverlappingInstance+ :: SourceSpan+ -> Maybe ChainId+ -> Ident+ -> [(Text, SourceType)]+ -> Qualified (ProperName 'ClassName)+ -> TypeClassData+ -> [SourceType]+ -> S.Set ModuleName+ -> m ()+ checkOverlappingInstance ss ch dictName vars className typeClass tys' nonOrphanModules = do+ for_ nonOrphanModules $ \m -> do+ dicts <- M.toList <$> lookupTypeClassDictionariesForClass (ByModuleName m) className++ for_ dicts $ \(Qualified mn' ident, dictNel) -> do+ for_ dictNel $ \dict -> do+ -- ignore instances in the same instance chain+ if ch == tcdChain dict ||+ instancesAreApart (typeClassCoveringSets typeClass) tys' (tcdInstanceTypes dict)+ then return ()+ else do+ let this = if isPlainIdent dictName then Right dictName else Left $ srcInstanceType ss vars className tys'+ let that = Qualified mn' . maybeToLeft ident $ tcdDescription dict+ throwError . errorMessage $+ OverlappingInstances className+ tys'+ [that, Qualified (ByModuleName moduleName) this]++ instancesAreApart+ :: S.Set (S.Set Int)+ -> [SourceType]+ -> [SourceType]+ -> Bool+ instancesAreApart sets lhs rhs = all (any typesApart . S.toList) (S.toList sets)+ where+ typesApart :: Int -> Bool+ typesApart i = typeHeadsApart (lhs !! i) (rhs !! i)++ -- Note: implementation doesn't need to care about all possible cases:+ -- TUnknown, Skolem, etc.+ typeHeadsApart :: SourceType -> SourceType -> Bool+ typeHeadsApart l r | eqType l r = False+ typeHeadsApart (TypeVar _ _) _ = False+ typeHeadsApart _ (TypeVar _ _) = False+ typeHeadsApart (KindedType _ t1 _) t2 = typeHeadsApart t1 t2+ typeHeadsApart t1 (KindedType _ t2 _) = typeHeadsApart t1 t2+ typeHeadsApart (TypeApp _ h1 t1) (TypeApp _ h2 t2) = typeHeadsApart h1 h2 || typeHeadsApart t1 t2+ typeHeadsApart _ _ = True++ checkOrphanInstance+ :: Ident+ -> Qualified (ProperName 'ClassName)+ -> [SourceType]+ -> S.Set ModuleName+ -> m ()+ checkOrphanInstance dictName className tys' nonOrphanModules+ | moduleName `S.member` nonOrphanModules = return ()+ | otherwise = throwError . errorMessage $ OrphanInstance dictName className nonOrphanModules tys'+ -- This function adds the argument kinds for a type constructor so that they may appear in the externs file, -- extracted from the kind of the type constructor itself. --- withKinds :: [(String, Maybe Kind)] -> Kind -> [(String, Maybe Kind)]- withKinds [] _ = []- withKinds (s@(_, Just _ ):ss) (FunKind _ k) = s : withKinds ss k- withKinds ( (s, Nothing):ss) (FunKind k1 k2) = (s, Just k1) : withKinds ss k2- withKinds _ _ = error "Invalid arguments to peelKinds"+ withKinds :: [(Text, Maybe SourceType)] -> SourceType -> [(Text, Maybe SourceType)]+ withKinds [] _ = []+ withKinds ss (ForAll _ _ _ _ k _) = withKinds ss k+ withKinds (s@(_, Just _):ss) (TypeApp _ (TypeApp _ tyFn _) k2) | eqType tyFn tyFunction = s : withKinds ss k2+ withKinds ((s, Nothing):ss) (TypeApp _ (TypeApp _ tyFn k1) k2) | eqType tyFn tyFunction = (s, Just k1) : withKinds ss k2+ withKinds _ _ = internalError "Invalid arguments to withKinds" + withRoles :: [(Text, Maybe SourceType)] -> [Role] -> [(Text, Maybe SourceType, Role)]+ withRoles = zipWith $ \(v, k) r -> (v, k, r)++ replaceTypeSynonymsInDataConstructor :: DataConstructorDeclaration -> m DataConstructorDeclaration+ replaceTypeSynonymsInDataConstructor DataConstructorDeclaration{..} = do+ dataCtorFields' <- traverse (traverse replaceAllTypeSynonyms) dataCtorFields+ return DataConstructorDeclaration+ { dataCtorFields = dataCtorFields'+ , ..+ }++-- | Check that a newtype has just one data constructor with just one field, or+-- throw an error. If the newtype is valid, this function returns the single+-- data constructor declaration and the single field, as a 'proof' that the+-- newtype was indeed a valid newtype.+checkNewtype+ :: forall m+ . MonadError MultipleErrors m+ => ProperName 'TypeName+ -> [DataConstructorDeclaration]+ -> m (DataConstructorDeclaration, (Ident, SourceType))+checkNewtype _ [decl@(DataConstructorDeclaration _ _ [field])] = return (decl, field)+checkNewtype name _ = throwError . errorMessage $ InvalidNewtype name+ -- | -- Type check an entire module and ensure all types and classes defined within the module that are -- required by exported members are also exported. ---typeCheckModule :: Maybe ModuleName -> Module -> Check Module-typeCheckModule _ (Module _ _ _ Nothing) = error "exports should have been elaborated"-typeCheckModule mainModuleName (Module coms mn decls (Just exps)) = rethrow (onErrorMessages (ErrorInModule mn)) $ do- modify (\s -> s { checkCurrentModule = Just mn })- decls' <- typeCheckAll mainModuleName mn exps decls- forM_ exps $ \e -> do- checkTypesAreExported e- checkClassMembersAreExported e- checkClassesAreExported e- return $ Module coms mn decls' (Just exps)+typeCheckModule+ :: forall m+ . (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m)+ => M.Map ModuleName Exports+ -> Module+ -> m Module+typeCheckModule _ (Module _ _ _ _ Nothing) =+ internalError "exports should have been elaborated before typeCheckModule"+typeCheckModule modulesExports (Module ss coms mn decls (Just exps)) =+ warnAndRethrow (addHint (ErrorInModule mn)) $ do+ let (decls', imports) = partitionEithers $ fromImportDecl <$> decls+ modify (\s -> s { checkCurrentModule = Just mn, checkCurrentModuleImports = imports })+ decls'' <- typeCheckAll mn $ ignoreWildcardsUnderCompleteTypeSignatures <$> decls'+ checkSuperClassesAreExported <- getSuperClassExportCheck+ for_ exps $ \e -> do+ checkTypesAreExported e+ checkClassMembersAreExported e+ checkClassesAreExported e+ checkSuperClassesAreExported e+ checkDataConstructorsAreExported e+ return $ Module ss coms mn (map toImportDecl imports ++ decls'') (Just exps) where - checkMemberExport :: (Type -> [DeclarationRef]) -> DeclarationRef -> Check ()- checkMemberExport extract dr@(ValueRef name) = do- ty <- lookupVariable mn (Qualified (Just mn) name)- case filter (not . exported) (extract ty) of- [] -> return ()- hidden -> throwError . errorMessage $ TransitiveExportError dr hidden- where- exported e = any (exports e) exps- exports (TypeRef pn1 _) (TypeRef pn2 _) = pn1 == pn2- exports (ValueRef id1) (ValueRef id2) = id1 == id2- exports (TypeClassRef pn1) (TypeClassRef pn2) = pn1 == pn2- exports (TypeInstanceRef id1) (TypeInstanceRef id2) = id1 == id2- exports (PositionedDeclarationRef _ _ r1) r2 = exports r1 r2- exports r1 (PositionedDeclarationRef _ _ r2) = exports r1 r2- exports _ _ = False+ fromImportDecl+ :: Declaration+ -> Either Declaration+ ( SourceAnn+ , ModuleName+ , ImportDeclarationType+ , Maybe ModuleName+ , M.Map (ProperName 'TypeName) ([ProperName 'ConstructorName], ExportSource)+ )+ fromImportDecl (ImportDeclaration sa moduleName importDeclarationType asModuleName) =+ Right (sa, moduleName, importDeclarationType, asModuleName, foldMap exportedTypes $ M.lookup moduleName modulesExports)+ fromImportDecl decl = Left decl++ toImportDecl+ :: ( SourceAnn+ , ModuleName+ , ImportDeclarationType+ , Maybe ModuleName+ , M.Map (ProperName 'TypeName) ([ProperName 'ConstructorName], ExportSource)+ )+ -> Declaration+ toImportDecl (sa, moduleName, importDeclarationType, asModuleName, _) =+ ImportDeclaration sa moduleName importDeclarationType asModuleName++ qualify' :: a -> Qualified a+ qualify' = Qualified (ByModuleName mn)++ getSuperClassExportCheck = do+ classesToSuperClasses <- gets+ ( M.map+ ( S.fromList+ . filter (\(Qualified mn' _) -> mn' == ByModuleName mn)+ . fmap constraintClass+ . typeClassSuperclasses+ )+ . typeClasses+ . checkEnv+ )+ let+ -- A function that, given a class name, returns the set of+ -- transitive class dependencies that are defined in this+ -- module.+ transitiveSuperClassesFor+ :: Qualified (ProperName 'ClassName)+ -> S.Set (Qualified (ProperName 'ClassName))+ transitiveSuperClassesFor qname =+ untilSame+ (\s -> s <> foldMap (\n -> fromMaybe S.empty (M.lookup n classesToSuperClasses)) s)+ (fromMaybe S.empty (M.lookup qname classesToSuperClasses))++ superClassesFor qname =+ fromMaybe S.empty (M.lookup qname classesToSuperClasses)++ pure $ checkSuperClassExport superClassesFor transitiveSuperClassesFor+ moduleClassExports :: S.Set (Qualified (ProperName 'ClassName))+ moduleClassExports = S.fromList $ mapMaybe (\case+ TypeClassRef _ name -> Just (qualify' name)+ _ -> Nothing) exps++ untilSame :: Eq a => (a -> a) -> a -> a+ untilSame f a = let a' = f a in if a == a' then a else untilSame f a'++ checkMemberExport :: (SourceType -> [DeclarationRef]) -> DeclarationRef -> m ()+ checkMemberExport extract dr@(TypeRef _ name dctors) = do+ env <- getEnv+ for_ (M.lookup (qualify' name) (types env)) $ \(k, _) -> do+ -- TODO: remove?+ -- let findModuleKinds = everythingOnTypes (++) $ \case+ -- TypeConstructor _ (Qualified (ByModuleName mn') kindName) | mn' == mn -> [kindName]+ -- _ -> []+ checkExport dr (extract k)+ for_ (M.lookup (qualify' name) (typeSynonyms env)) $ \(_, ty) ->+ checkExport dr (extract ty)+ for_ dctors $ \dctors' ->+ for_ dctors' $ \dctor ->+ for_ (M.lookup (qualify' dctor) (dataConstructors env)) $ \(_, _, ty, _) ->+ checkExport dr (extract ty)+ checkMemberExport extract dr@(ValueRef _ name) = do+ ty <- lookupVariable (qualify' name)+ checkExport dr (extract ty) checkMemberExport _ _ = return () + checkSuperClassExport+ :: (Qualified (ProperName 'ClassName) -> S.Set (Qualified (ProperName 'ClassName)))+ -> (Qualified (ProperName 'ClassName) -> S.Set (Qualified (ProperName 'ClassName)))+ -> DeclarationRef+ -> m ()+ checkSuperClassExport superClassesFor transitiveSuperClassesFor dr@(TypeClassRef drss className) = do+ let superClasses = superClassesFor (qualify' className)+ -- thanks to laziness, the computation of the transitive+ -- superclasses defined in-module will only occur if we actually+ -- throw the error. Constructing the full set of transitive+ -- superclasses is likely to be costly for every single term.+ transitiveSuperClasses = transitiveSuperClassesFor (qualify' className)+ unexported = S.difference superClasses moduleClassExports+ unless (null unexported)+ . throwError . errorMessage' drss+ . TransitiveExportError dr+ . map (TypeClassRef drss . disqualify)+ $ toList transitiveSuperClasses+ checkSuperClassExport _ _ _ =+ return ()++ checkExport :: DeclarationRef -> [DeclarationRef] -> m ()+ checkExport dr drs = case filter (not . exported) drs of+ [] -> return ()+ hidden -> throwError . errorMessage' (declRefSourceSpan dr) $ TransitiveExportError dr (nubBy nubEq hidden)+ where+ exported e = any (exports e) exps+ exports (TypeRef _ pn1 _) (TypeRef _ pn2 _) = pn1 == pn2+ exports (ValueRef _ id1) (ValueRef _ id2) = id1 == id2+ exports (TypeClassRef _ pn1) (TypeClassRef _ pn2) = pn1 == pn2+ exports _ _ = False+ -- We avoid Eq for `nub`bing as the dctor part of `TypeRef` evaluates to+ -- `error` for the values generated here (we don't need them anyway)+ nubEq (TypeRef _ pn1 _) (TypeRef _ pn2 _) = pn1 == pn2+ nubEq r1 r2 = r1 == r2++ -- Check that all the type constructors defined in the current module that appear in member types -- have also been exported from the module- checkTypesAreExported :: DeclarationRef -> Check ()- checkTypesAreExported = checkMemberExport findTcons+ checkTypesAreExported :: DeclarationRef -> m ()+ checkTypesAreExported ref = checkMemberExport findTcons ref where- findTcons :: Type -> [DeclarationRef]+ findTcons :: SourceType -> [DeclarationRef] findTcons = everythingOnTypes (++) go where- go (TypeConstructor (Qualified (Just mn') name)) | mn' == mn = [TypeRef name (error "Data constructors unused in checkTypesAreExported")]+ go (TypeConstructor _ (Qualified (ByModuleName mn') name)) | mn' == mn =+ [TypeRef (declRefSourceSpan ref) name (internalError "Data constructors unused in checkTypesAreExported")] go _ = [] -- Check that all the classes defined in the current module that appear in member types have also -- been exported from the module- checkClassesAreExported :: DeclarationRef -> Check ()- checkClassesAreExported = checkMemberExport findClasses+ checkClassesAreExported :: DeclarationRef -> m ()+ checkClassesAreExported ref = checkMemberExport findClasses ref where- findClasses :: Type -> [DeclarationRef]+ findClasses :: SourceType -> [DeclarationRef] findClasses = everythingOnTypes (++) go where- go (ConstrainedType cs _) = mapMaybe (fmap TypeClassRef . extractCurrentModuleClass . fst) cs+ go (ConstrainedType _ c _) = (fmap (TypeClassRef (declRefSourceSpan ref)) . extractCurrentModuleClass . constraintClass) c go _ = []- extractCurrentModuleClass :: Qualified ProperName -> Maybe ProperName- extractCurrentModuleClass (Qualified (Just mn') name) | mn == mn' = Just name- extractCurrentModuleClass _ = Nothing+ extractCurrentModuleClass :: Qualified (ProperName 'ClassName) -> [ProperName 'ClassName]+ extractCurrentModuleClass (Qualified (ByModuleName mn') name) | mn == mn' = [name]+ extractCurrentModuleClass _ = [] - checkClassMembersAreExported :: DeclarationRef -> Check ()- checkClassMembersAreExported dr@(TypeClassRef name) = do- let members = ValueRef `map` head (mapMaybe findClassMembers decls)+ checkClassMembersAreExported :: DeclarationRef -> m ()+ checkClassMembersAreExported dr@(TypeClassRef ss' name) = do+ let members = ValueRef ss' `map` head (mapMaybe findClassMembers decls) let missingMembers = members \\ exps- unless (null missingMembers) $ throwError . errorMessage $ TransitiveExportError dr members+ unless (null missingMembers) . throwError . errorMessage' ss' $ TransitiveExportError dr missingMembers where findClassMembers :: Declaration -> Maybe [Ident]- findClassMembers (TypeClassDeclaration name' _ _ ds) | name == name' = Just $ map extractMemberName ds- findClassMembers (PositionedDeclaration _ _ d) = findClassMembers d+ findClassMembers (TypeClassDeclaration _ name' _ _ _ ds) | name == name' = Just $ map extractMemberName ds+ findClassMembers (DataBindingGroupDeclaration decls') = headMay . mapMaybe findClassMembers $ NEL.toList decls' findClassMembers _ = Nothing extractMemberName :: Declaration -> Ident- extractMemberName (PositionedDeclaration _ _ d) = extractMemberName d- extractMemberName (TypeDeclaration memberName _) = memberName- extractMemberName _ = error "Unexpected declaration in typeclass member list"+ extractMemberName (TypeDeclaration td) = tydeclIdent td+ extractMemberName _ = internalError "Unexpected declaration in typeclass member list" checkClassMembersAreExported _ = return ()++ -- If a type is exported without data constructors, we warn on `Generic` or `Newtype` instances.+ -- On the other hand if any data constructors are exported, we require all of them to be exported.+ checkDataConstructorsAreExported :: DeclarationRef -> m ()+ checkDataConstructorsAreExported dr@(TypeRef ss' name (fromMaybe [] -> exportedDataConstructorsNames))+ | null exportedDataConstructorsNames = for_+ [ Libs.Generic+ , Libs.Newtype+ ] $ \className -> do+ env <- getEnv+ let dicts = foldMap (foldMap NEL.toList) $+ M.lookup (ByModuleName mn) (typeClassDictionaries env) >>= M.lookup className+ when (any isDictOfTypeRef dicts) $+ tell . errorMessage' ss' $ HiddenConstructors dr className+ | otherwise = do+ env <- getEnv+ let dataConstructorNames = fromMaybe [] $+ M.lookup (mkQualified name mn) (types env) >>= getDataConstructorNames . snd+ missingDataConstructorsNames = dataConstructorNames \\ exportedDataConstructorsNames+ unless (null missingDataConstructorsNames) $+ throwError . errorMessage' ss' $ TransitiveDctorExportError dr missingDataConstructorsNames+ where+ isDictOfTypeRef :: TypeClassDictionaryInScope a -> Bool+ isDictOfTypeRef dict+ | (TypeConstructor _ qualTyName, _, _) : _ <- unapplyTypes <$> tcdInstanceTypes dict+ , qualTyName == Qualified (ByModuleName mn) name+ = True+ isDictOfTypeRef _ = False+ getDataConstructorNames :: TypeKind -> Maybe [ProperName 'ConstructorName]+ getDataConstructorNames (DataType _ _ constructors) = Just $ fst <$> constructors+ getDataConstructorNames _ = Nothing+ checkDataConstructorsAreExported _ = return ()
+ src/Language/PureScript/TypeChecker/Deriving.hs view
@@ -0,0 +1,836 @@+{- HLINT ignore "Unused LANGUAGE pragma" -} -- HLint doesn't recognize that TypeApplications is used in a pattern+{-# LANGUAGE GADTs #-}+{-# LANGUAGE TypeApplications #-}+module Language.PureScript.TypeChecker.Deriving (deriveInstance) where++import Protolude hiding (Type)++import Control.Lens (both, over)+import Control.Monad.Error.Class (liftEither)+import Control.Monad.Trans.Writer (Writer, WriterT, runWriter, runWriterT)+import Control.Monad.Writer.Class (MonadWriter(..))+import Data.Align (align, unalign)+import Data.Foldable (foldl1, foldr1)+import Data.List (init, last, zipWith3, (!!))+import Data.Map qualified as M+import Data.These (These(..), mergeTheseWith, these)++import Control.Monad.Supply.Class (MonadSupply)+import Language.PureScript.AST (Binder(..), CaseAlternative(..), ErrorMessageHint(..), Expr(..), InstanceDerivationStrategy(..), Literal(..), SourceSpan, nullSourceSpan)+import Language.PureScript.AST.Utils (UnwrappedTypeConstructor(..), lam, lamCase, lamCase2, mkBinder, mkCtor, mkCtorBinder, mkLit, mkRef, mkVar, unguarded, unwrapTypeConstructor, utcQTyCon)+import Language.PureScript.Constants.Libs qualified as Libs+import Language.PureScript.Constants.Prim qualified as Prim+import Language.PureScript.Crash (internalError)+import Language.PureScript.Environment (DataDeclType(..), Environment(..), FunctionalDependency(..), TypeClassData(..), TypeKind(..), kindType, (-:>))+import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage(..), addHint, errorMessage, internalCompilerError)+import Language.PureScript.Label (Label(..))+import Language.PureScript.Names (pattern ByNullSourcePos, Ident(..), ModuleName(..), Name(..), ProperName(..), ProperNameType(..), Qualified(..), QualifiedBy(..), coerceProperName, freshIdent, qualify)+import Language.PureScript.PSString (PSString, mkString)+import Language.PureScript.Sugar.TypeClasses (superClassDictionaryNames)+import Language.PureScript.TypeChecker.Entailment (InstanceContext, findDicts)+import Language.PureScript.TypeChecker.Monad (CheckState, getEnv, getTypeClassDictionaries, unsafeCheckCurrentModule)+import Language.PureScript.TypeChecker.Synonyms (replaceAllTypeSynonyms)+import Language.PureScript.TypeClassDictionaries (TypeClassDictionaryInScope(..))+import Language.PureScript.Types (Constraint(..), pattern REmptyKinded, SourceType, Type(..), completeBinderList, eqType, everythingOnTypes, replaceAllTypeVars, srcTypeVar, usedTypeVariables)++-- | Extract the name of the newtype appearing in the last type argument of+-- a derived newtype instance.+--+-- Note: since newtypes in newtype instances can only be applied to type arguments+-- (no flexible instances allowed), we don't need to bother with unification when+-- looking for matching superclass instances, which saves us a lot of work. Instead,+-- we just match the newtype name.+extractNewtypeName :: ModuleName -> [SourceType] -> Maybe (ModuleName, ProperName 'TypeName)+extractNewtypeName mn+ = fmap (qualify mn . utcQTyCon)+ . (unwrapTypeConstructor <=< lastMay)++deriveInstance+ :: forall m+ . MonadError MultipleErrors m+ => MonadState CheckState m+ => MonadSupply m+ => MonadWriter MultipleErrors m+ => SourceType+ -> Qualified (ProperName 'ClassName)+ -> InstanceDerivationStrategy+ -> m Expr+deriveInstance instType className strategy = do+ mn <- unsafeCheckCurrentModule+ env <- getEnv+ instUtc@UnwrappedTypeConstructor{ utcArgs = tys } <- maybe (internalCompilerError "invalid instance type") pure $ unwrapTypeConstructor instType+ let ctorName = coerceProperName <$> utcQTyCon instUtc++ TypeClassData{..} <-+ note (errorMessage . UnknownName $ fmap TyClassName className) $+ className `M.lookup` typeClasses env++ case strategy of+ KnownClassStrategy -> let+ unaryClass :: (UnwrappedTypeConstructor -> m [(PSString, Expr)]) -> m Expr+ unaryClass f = case tys of+ [ty] -> case unwrapTypeConstructor ty of+ Just utc | mn == utcModuleName utc -> do+ let superclassesDicts = flip map typeClassSuperclasses $ \(Constraint _ superclass _ suTyArgs _) ->+ let tyArgs = map (replaceAllTypeVars (zip (map fst typeClassArguments) tys)) suTyArgs+ in lam UnusedIdent (DeferredDictionary superclass tyArgs)+ let superclasses = map mkString (superClassDictionaryNames typeClassSuperclasses) `zip` superclassesDicts+ App (Constructor nullSourceSpan ctorName) . mkLit . ObjectLiteral . (++ superclasses) <$> f utc+ _ -> throwError . errorMessage $ ExpectedTypeConstructor className tys ty+ _ -> throwError . errorMessage $ InvalidDerivedInstance className tys 1++ unaryClass' f = unaryClass (f className)++ in case className of+ Libs.Bifoldable -> unaryClass' $ deriveFoldable True+ Libs.Bifunctor -> unaryClass' $ deriveFunctor (Just False) False Libs.S_bimap+ Libs.Bitraversable -> unaryClass' $ deriveTraversable True+ Libs.Contravariant -> unaryClass' $ deriveFunctor Nothing True Libs.S_cmap+ Libs.Eq -> unaryClass deriveEq+ Libs.Eq1 -> unaryClass $ const deriveEq1+ Libs.Foldable -> unaryClass' $ deriveFoldable False+ Libs.Functor -> unaryClass' $ deriveFunctor Nothing False Libs.S_map+ Libs.Ord -> unaryClass deriveOrd+ Libs.Ord1 -> unaryClass $ const deriveOrd1+ Libs.Profunctor -> unaryClass' $ deriveFunctor (Just True) False Libs.S_dimap+ Libs.Traversable -> unaryClass' $ deriveTraversable False+ -- See L.P.Sugar.TypeClasses.Deriving for the classes that can be+ -- derived prior to type checking.+ _ -> throwError . errorMessage $ CannotDerive className tys++ NewtypeStrategy ->+ case tys of+ _ : _ | Just utc <- unwrapTypeConstructor (last tys)+ , mn == utcModuleName utc+ -> deriveNewtypeInstance className tys utc+ | otherwise -> throwError . errorMessage $ ExpectedTypeConstructor className tys (last tys)+ _ -> throwError . errorMessage $ InvalidNewtypeInstance className tys++deriveNewtypeInstance+ :: forall m+ . MonadError MultipleErrors m+ => MonadState CheckState m+ => MonadWriter MultipleErrors m+ => Qualified (ProperName 'ClassName)+ -> [SourceType]+ -> UnwrappedTypeConstructor+ -> m Expr+deriveNewtypeInstance className tys (UnwrappedTypeConstructor mn tyConNm dkargs dargs) = do+ verifySuperclasses+ (dtype, tyKindNames, tyArgNames, ctors) <- lookupTypeDecl mn tyConNm+ go dtype tyKindNames tyArgNames ctors+ where+ go (Just Newtype) tyKindNames tyArgNames [(_, [wrapped])] = do+ -- The newtype might not be applied to all type arguments.+ -- This is okay as long as the newtype wraps something which ends with+ -- sufficiently many type applications to variables.+ -- For example, we can derive Functor for+ --+ -- newtype MyArray a = MyArray (Array a)+ --+ -- since Array a is a type application which uses the last+ -- type argument+ wrapped' <- replaceAllTypeSynonyms wrapped+ case stripRight (takeReverse (length tyArgNames - length dargs) tyArgNames) wrapped' of+ Just wrapped'' -> do+ let subst = zipWith (\(name, _) t -> (name, t)) tyArgNames dargs <> zip tyKindNames dkargs+ wrapped''' <- replaceAllTypeSynonyms $ replaceAllTypeVars subst wrapped''+ tys' <- mapM replaceAllTypeSynonyms tys+ return (DeferredDictionary className (init tys' ++ [wrapped''']))+ Nothing -> throwError . errorMessage $ InvalidNewtypeInstance className tys+ go _ _ _ _ = throwError . errorMessage $ InvalidNewtypeInstance className tys++ takeReverse :: Int -> [a] -> [a]+ takeReverse n = take n . reverse++ stripRight :: [(Text, Maybe kind)] -> SourceType -> Maybe SourceType+ stripRight [] ty = Just ty+ stripRight ((arg, _) : args) (TypeApp _ t (TypeVar _ arg'))+ | arg == arg' = stripRight args t+ stripRight _ _ = Nothing++ verifySuperclasses :: m ()+ verifySuperclasses = do+ env <- getEnv+ for_ (M.lookup className (typeClasses env)) $ \TypeClassData{ typeClassArguments = args, typeClassSuperclasses = superclasses } ->+ for_ superclasses $ \Constraint{..} -> do+ let constraintClass' = qualify (internalError "verifySuperclasses: unknown class module") constraintClass+ for_ (M.lookup constraintClass (typeClasses env)) $ \TypeClassData{ typeClassDependencies = deps } ->+ -- We need to check whether the newtype is mentioned, because of classes like MonadWriter+ -- with its Monoid superclass constraint.+ when (not (null args) && any ((fst (last args) `elem`) . usedTypeVariables) constraintArgs) $ do+ -- For now, we only verify superclasses where the newtype is the only argument,+ -- or for which all other arguments are determined by functional dependencies.+ -- Everything else raises a UnverifiableSuperclassInstance warning.+ -- This covers pretty much all cases we're interested in, but later we might want to do+ -- more work to extend this to other superclass relationships.+ let determined = map (srcTypeVar . fst . (args !!)) . ordNub . concatMap fdDetermined . filter ((== [length args - 1]) . fdDeterminers) $ deps+ if eqType (last constraintArgs) (srcTypeVar . fst $ last args) && all (`elem` determined) (init constraintArgs)+ then do+ -- Now make sure that a superclass instance was derived. Again, this is not a complete+ -- check, since the superclass might have multiple type arguments, so overlaps might still+ -- be possible, so we warn again.+ for_ (extractNewtypeName mn tys) $ \nm -> do+ unless (hasNewtypeSuperclassInstance constraintClass' nm (typeClassDictionaries env)) $+ tell . errorMessage $ MissingNewtypeSuperclassInstance constraintClass className tys+ else tell . errorMessage $ UnverifiableSuperclassInstance constraintClass className tys++ -- Note that this check doesn't actually verify that the superclass is+ -- newtype-derived; see #3168. The whole verifySuperclasses feature+ -- is pretty sketchy, and could use a thorough review and probably rewrite.+ hasNewtypeSuperclassInstance (suModule, suClass) nt@(newtypeModule, _) dicts =+ let su = Qualified (ByModuleName suModule) suClass+ lookIn mn'+ = elem nt+ . (toList . extractNewtypeName mn' . tcdInstanceTypes+ <=< foldMap toList . M.elems+ <=< toList . (M.lookup su <=< M.lookup (ByModuleName mn')))+ $ dicts+ in lookIn suModule || lookIn newtypeModule++data TypeInfo = TypeInfo+ { tiTypeParams :: [Text]+ , tiCtors :: [(ProperName 'ConstructorName, [SourceType])]+ , tiArgSubst :: [(Text, SourceType)]+ }++lookupTypeInfo+ :: forall m+ . MonadError MultipleErrors m+ => MonadState CheckState m+ => UnwrappedTypeConstructor+ -> m TypeInfo+lookupTypeInfo UnwrappedTypeConstructor{..} = do+ (_, kindParams, map fst -> tiTypeParams, tiCtors) <- lookupTypeDecl utcModuleName utcTyCon+ let tiArgSubst = zip tiTypeParams utcArgs <> zip kindParams utcKindArgs+ pure TypeInfo{..}++deriveEq+ :: forall m+ . MonadError MultipleErrors m+ => MonadState CheckState m+ => MonadSupply m+ => UnwrappedTypeConstructor+ -> m [(PSString, Expr)]+deriveEq utc = do+ TypeInfo{..} <- lookupTypeInfo utc+ eqFun <- mkEqFunction tiCtors+ pure [(Libs.S_eq, eqFun)]+ where+ mkEqFunction :: [(ProperName 'ConstructorName, [SourceType])] -> m Expr+ mkEqFunction ctors = do+ x <- freshIdent "x"+ y <- freshIdent "y"+ lamCase2 x y . addCatch <$> mapM mkCtorClause ctors++ preludeConj :: Expr -> Expr -> Expr+ preludeConj = App . App (mkRef Libs.I_conj)++ preludeEq :: Expr -> Expr -> Expr+ preludeEq = App . App (mkRef Libs.I_eq)++ preludeEq1 :: Expr -> Expr -> Expr+ preludeEq1 = App . App (mkRef Libs.I_eq1)++ addCatch :: [CaseAlternative] -> [CaseAlternative]+ addCatch xs+ | length xs /= 1 = xs ++ [catchAll]+ | otherwise = xs -- Avoid redundant case+ where+ catchAll = CaseAlternative [NullBinder, NullBinder] (unguarded (mkLit (BooleanLiteral False)))++ mkCtorClause :: (ProperName 'ConstructorName, [SourceType]) -> m CaseAlternative+ mkCtorClause (ctorName, tys) = do+ identsL <- replicateM (length tys) (freshIdent "l")+ identsR <- replicateM (length tys) (freshIdent "r")+ tys' <- mapM replaceAllTypeSynonyms tys+ let tests = zipWith3 toEqTest (map mkVar identsL) (map mkVar identsR) tys'+ return $ CaseAlternative [caseBinder identsL, caseBinder identsR] (unguarded (conjAll tests))+ where+ caseBinder idents = mkCtorBinder (utcModuleName utc) ctorName $ map mkBinder idents++ conjAll :: [Expr] -> Expr+ conjAll = \case+ [] -> mkLit (BooleanLiteral True)+ xs -> foldl1 preludeConj xs++ toEqTest :: Expr -> Expr -> SourceType -> Expr+ toEqTest l r ty+ | Just fields <- decomposeRec <=< objectType $ ty+ = conjAll+ . map (\(Label str, typ) -> toEqTest (Accessor str l) (Accessor str r) typ)+ $ fields+ | isAppliedVar ty = preludeEq1 l r+ | otherwise = preludeEq l r++deriveEq1 :: forall m. Applicative m => m [(PSString, Expr)]+deriveEq1 = pure [(Libs.S_eq1, mkRef Libs.I_eq)]++deriveOrd+ :: forall m+ . MonadError MultipleErrors m+ => MonadState CheckState m+ => MonadSupply m+ => UnwrappedTypeConstructor+ -> m [(PSString, Expr)]+deriveOrd utc = do+ TypeInfo{..} <- lookupTypeInfo utc+ compareFun <- mkCompareFunction tiCtors+ pure [(Libs.S_compare, compareFun)]+ where+ mkCompareFunction :: [(ProperName 'ConstructorName, [SourceType])] -> m Expr+ mkCompareFunction ctors = do+ x <- freshIdent "x"+ y <- freshIdent "y"+ lamCase2 x y <$> (addCatch . concat <$> mapM mkCtorClauses (splitLast ctors))++ splitLast :: [a] -> [(a, Bool)]+ splitLast [] = []+ splitLast [x] = [(x, True)]+ splitLast (x : xs) = (x, False) : splitLast xs++ addCatch :: [CaseAlternative] -> [CaseAlternative]+ addCatch xs+ | null xs = [catchAll] -- No type constructors+ | otherwise = xs+ where+ catchAll = CaseAlternative [NullBinder, NullBinder] (unguarded (orderingCtor "EQ"))++ orderingMod :: ModuleName+ orderingMod = ModuleName "Data.Ordering"++ orderingCtor :: Text -> Expr+ orderingCtor = mkCtor orderingMod . ProperName++ orderingBinder :: Text -> Binder+ orderingBinder name = mkCtorBinder orderingMod (ProperName name) []++ ordCompare :: Expr -> Expr -> Expr+ ordCompare = App . App (mkRef Libs.I_compare)++ ordCompare1 :: Expr -> Expr -> Expr+ ordCompare1 = App . App (mkRef Libs.I_compare1)++ mkCtorClauses :: ((ProperName 'ConstructorName, [SourceType]), Bool) -> m [CaseAlternative]+ mkCtorClauses ((ctorName, tys), isLast) = do+ identsL <- replicateM (length tys) (freshIdent "l")+ identsR <- replicateM (length tys) (freshIdent "r")+ tys' <- mapM replaceAllTypeSynonyms tys+ let tests = zipWith3 toOrdering (map mkVar identsL) (map mkVar identsR) tys'+ extras | not isLast = [ CaseAlternative [nullCaseBinder, NullBinder] (unguarded (orderingCtor "LT"))+ , CaseAlternative [NullBinder, nullCaseBinder] (unguarded (orderingCtor "GT"))+ ]+ | otherwise = []+ return $ CaseAlternative [ caseBinder identsL+ , caseBinder identsR+ ]+ (unguarded (appendAll tests))+ : extras++ where+ mn = utcModuleName utc+ caseBinder idents = mkCtorBinder mn ctorName $ map mkBinder idents+ nullCaseBinder = mkCtorBinder mn ctorName $ replicate (length tys) NullBinder++ appendAll :: [Expr] -> Expr+ appendAll = \case+ [] -> orderingCtor "EQ"+ [x] -> x+ (x : xs) -> Case [x] [ CaseAlternative [orderingBinder "LT"] (unguarded (orderingCtor "LT"))+ , CaseAlternative [orderingBinder "GT"] (unguarded (orderingCtor "GT"))+ , CaseAlternative [NullBinder] (unguarded (appendAll xs))+ ]++ toOrdering :: Expr -> Expr -> SourceType -> Expr+ toOrdering l r ty+ | Just fields <- decomposeRec <=< objectType $ ty+ = appendAll+ . map (\(Label str, typ) -> toOrdering (Accessor str l) (Accessor str r) typ)+ $ fields+ | isAppliedVar ty = ordCompare1 l r+ | otherwise = ordCompare l r++deriveOrd1 :: forall m. Applicative m => m [(PSString, Expr)]+deriveOrd1 = pure [(Libs.S_compare1, mkRef Libs.I_compare)]++lookupTypeDecl+ :: forall m+ . MonadError MultipleErrors m+ => MonadState CheckState m+ => ModuleName+ -> ProperName 'TypeName+ -> m (Maybe DataDeclType, [Text], [(Text, Maybe SourceType)], [(ProperName 'ConstructorName, [SourceType])])+lookupTypeDecl mn typeName = do+ env <- getEnv+ note (errorMessage $ CannotFindDerivingType typeName) $ do+ (kind, DataType _ args dctors) <- Qualified (ByModuleName mn) typeName `M.lookup` types env+ (kargs, _) <- completeBinderList kind+ let dtype = do+ (ctorName, _) <- headMay dctors+ (a, _, _, _) <- Qualified (ByModuleName mn) ctorName `M.lookup` dataConstructors env+ pure a+ pure (dtype, fst . snd <$> kargs, map (\(v, k, _) -> (v, k)) args, dctors)++isAppliedVar :: Type a -> Bool+isAppliedVar (TypeApp _ (TypeVar _ _) _) = True+isAppliedVar _ = False++objectType :: Type a -> Maybe (Type a)+objectType (TypeApp _ (TypeConstructor _ Prim.Record) rec) = Just rec+objectType _ = Nothing++decomposeRec :: SourceType -> Maybe [(Label, SourceType)]+decomposeRec = fmap (sortOn fst) . go+ where go (RCons _ str typ typs) = fmap ((str, typ) :) (go typs)+ go (REmptyKinded _ _) = Just []+ go _ = Nothing++decomposeRec' :: SourceType -> [(Label, SourceType)]+decomposeRec' = sortOn fst . go+ where go (RCons _ str typ typs) = (str, typ) : go typs+ go _ = []++-- | The parameter `c` is used to allow or forbid contravariance for different+-- type classes. When deriving a type class that is a variation on Functor, a+-- witness for `c` will be provided; when deriving a type class that is a+-- variation on Foldable or Traversable, `c` will be Void and the contravariant+-- ParamUsage constructor can be skipped in pattern matching.+data ParamUsage c+ = IsParam+ | IsLParam+ -- ^ enables biparametric classes (of any variance) to be derived+ | MentionsParam (ParamUsage c)+ -- ^ enables monoparametric classes to be used in a derivation+ | MentionsParamBi (These (ParamUsage c) (ParamUsage c))+ -- ^ enables biparametric classes to be used in a derivation+ | MentionsParamContravariantly !c (ContravariantParamUsage c)+ -- ^ enables contravariant classes (of either parametricity) to be used in a derivation+ | IsRecord (NonEmpty (PSString, ParamUsage c))++data ContravariantParamUsage c+ = MentionsParamContra (ParamUsage c)+ -- ^ enables Contravariant to be used in a derivation+ | MentionsParamPro (These (ParamUsage c) (ParamUsage c))+ -- ^ enables Profunctor to be used in a derivation++data CovariantClasses = CovariantClasses+ { monoClass :: Qualified (ProperName 'ClassName)+ , biClass :: Qualified (ProperName 'ClassName)+ }++data ContravariantClasses = ContravariantClasses+ { contraClass :: Qualified (ProperName 'ClassName)+ , proClass :: Qualified (ProperName 'ClassName)+ }++data ContravarianceSupport c = ContravarianceSupport+ { contravarianceWitness :: c+ , paramIsContravariant :: Bool+ , lparamIsContravariant :: Bool+ , contravariantClasses :: ContravariantClasses+ }++-- | Return, if possible, a These the contents of which each satisfy the+-- predicate.+filterThese :: forall a. (a -> Bool) -> These a a -> Maybe (These a a)+filterThese p = uncurry align . over both (mfilter p) . unalign . Just++validateParamsInTypeConstructors+ :: forall c m+ . MonadError MultipleErrors m+ => MonadState CheckState m+ => Qualified (ProperName 'ClassName)+ -> UnwrappedTypeConstructor+ -> Bool+ -> CovariantClasses+ -> Maybe (ContravarianceSupport c)+ -> m [(ProperName 'ConstructorName, [Maybe (ParamUsage c)])]+validateParamsInTypeConstructors derivingClass utc isBi CovariantClasses{..} contravarianceSupport = do+ TypeInfo{..} <- lookupTypeInfo utc+ (mbLParam, param) <- liftEither . first (errorMessage . flip KindsDoNotUnify kindType . (kindType -:>)) $+ case (isBi, reverse tiTypeParams) of+ (False, x : _) -> Right (Nothing, x)+ (False, _) -> Left kindType+ (True, y : x : _) -> Right (Just x, y)+ (True, _ : _) -> Left kindType+ (True, _) -> Left $ kindType -:> kindType+ ctors <- traverse (traverse $ traverse replaceAllTypeSynonyms) tiCtors+ tcds <- getTypeClassDictionaries+ let (ctorUsages, problemSpans) = runWriter $ traverse (traverse . traverse $ typeToUsageOf tcds tiArgSubst (maybe That These mbLParam param) False) ctors+ let relatedClasses = [monoClass, biClass] ++ ([contraClass, proClass] <*> (contravariantClasses <$> toList contravarianceSupport))+ for_ (nonEmpty $ ordNub problemSpans) $ \sss ->+ throwError . addHint (RelatedPositions sss) . errorMessage $ CannotDeriveInvalidConstructorArg derivingClass relatedClasses (isJust contravarianceSupport)+ pure ctorUsages++ where+ typeToUsageOf :: InstanceContext -> [(Text, SourceType)] -> These Text Text -> Bool -> SourceType -> Writer [SourceSpan] (Maybe (ParamUsage c))+ typeToUsageOf tcds subst = fix $ \go params isNegative -> let+ goCo = go params isNegative+ goContra = go params $ not isNegative++ assertNoParamUsedIn :: SourceType -> Writer [SourceSpan] ()+ assertNoParamUsedIn ty = void $ both (flip assertParamNotUsedIn ty) params++ assertParamNotUsedIn :: Text -> SourceType -> Writer [SourceSpan] ()+ assertParamNotUsedIn param = everythingOnTypes (*>) $ \case+ TypeVar (ss, _) name | name == param -> tell [ss]+ _ -> pure ()++ tryBiClasses ht tyLArg tyArg+ | hasInstance tcds ht biClass+ = goCo tyLArg >>= preferMonoClass MentionsParamBi+ | Just (ContravarianceSupport c _ _ ContravariantClasses{..}) <- contravarianceSupport, hasInstance tcds ht proClass+ = goContra tyLArg >>= preferMonoClass (MentionsParamContravariantly c . MentionsParamPro)+ | otherwise+ = assertNoParamUsedIn tyLArg *> tryMonoClasses ht tyArg+ where+ preferMonoClass f lUsage =+ (if isNothing lUsage && hasInstance tcds ht monoClass then fmap MentionsParam else fmap f . align lUsage) <$> goCo tyArg++ tryMonoClasses ht tyArg+ | hasInstance tcds ht monoClass+ = fmap MentionsParam <$> goCo tyArg+ | Just (ContravarianceSupport c _ _ ContravariantClasses{..}) <- contravarianceSupport, hasInstance tcds ht contraClass+ = fmap (MentionsParamContravariantly c . MentionsParamContra) <$> goContra tyArg+ | otherwise+ = assertNoParamUsedIn tyArg $> Nothing++ headOfTypeWithSubst :: SourceType -> Qualified (Either Text (ProperName 'TypeName))+ headOfTypeWithSubst = headOfType . replaceAllTypeVars subst++ in \case+ ForAll _ _ name _ ty _ ->+ fmap join . traverse (\params' -> go params' isNegative ty) $ filterThese (/= name) params++ ConstrainedType _ _ ty ->+ goCo ty++ TypeApp _ (TypeConstructor _ Prim.Record) row ->+ fmap (fmap IsRecord . nonEmpty . catMaybes) . for (decomposeRec' row) $ \(Label lbl, ty) ->+ fmap (lbl, ) <$> goCo ty++ TypeApp _ (TypeApp _ tyFn tyLArg) tyArg ->+ assertNoParamUsedIn tyFn *> tryBiClasses (headOfTypeWithSubst tyFn) tyLArg tyArg++ TypeApp _ tyFn tyArg ->+ assertNoParamUsedIn tyFn *> tryMonoClasses (headOfTypeWithSubst tyFn) tyArg++ TypeVar (ss, _) name -> mergeTheseWith (checkName lparamIsContra IsLParam) (checkName paramIsContra IsParam) (liftA2 (<|>)) params+ where+ checkName thisParamIsContra usage param+ | name == param = when (thisParamIsContra /= isNegative) (tell [ss]) $> Just usage+ | otherwise = pure Nothing++ ty ->+ assertNoParamUsedIn ty $> Nothing++ paramIsContra = any paramIsContravariant contravarianceSupport+ lparamIsContra = any lparamIsContravariant contravarianceSupport++ hasInstance :: InstanceContext -> Qualified (Either Text (ProperName 'TypeName)) -> Qualified (ProperName 'ClassName) -> Bool+ hasInstance tcds ht@(Qualified qb _) cn@(Qualified cqb _) =+ any tcdAppliesToType $ concatMap (findDicts tcds cn) (ordNub [ByNullSourcePos, cqb, qb])+ where+ tcdAppliesToType tcd = case tcdInstanceTypes tcd of+ [headOfType -> ht'] -> ht == ht'+ -- It's possible that, if ht and ht' are Lefts, this might require+ -- verifying that the name isn't shadowed by something in tcdForAll. I+ -- can't devise a legal program that causes this issue, but if in the+ -- future it seems like a good idea, it probably is.+ _ -> False++ headOfType :: SourceType -> Qualified (Either Text (ProperName 'TypeName))+ headOfType = fix $ \go -> \case+ TypeApp _ ty _ -> go ty+ KindApp _ ty _ -> go ty+ TypeVar _ nm -> Qualified ByNullSourcePos (Left nm)+ Skolem _ nm _ _ _ -> Qualified ByNullSourcePos (Left nm)+ TypeConstructor _ (Qualified qb nm) -> Qualified qb (Right nm)+ ty -> internalError $ "headOfType missing a case: " <> show (void ty)++usingLamIdent :: forall m. MonadSupply m => (Expr -> m Expr) -> m Expr+usingLamIdent cb = do+ ident <- freshIdent "v"+ lam ident <$> cb (mkVar ident)++traverseFields :: forall c f. Applicative f => (ParamUsage c -> Expr -> f Expr) -> NonEmpty (PSString, ParamUsage c) -> Expr -> f Expr+traverseFields f fields r = fmap (ObjectUpdate r) . for (toList fields) $ \(lbl, usage) -> (lbl, ) <$> f usage (Accessor lbl r)++unnestRecords :: forall c f. Applicative f => (ParamUsage c -> Expr -> f Expr) -> ParamUsage c -> Expr -> f Expr+unnestRecords f = fix $ \go -> \case+ IsRecord fields -> traverseFields go fields+ usage -> f usage++mkCasesForTraversal+ :: forall c f m+ . Applicative f -- this effect distinguishes the semantics of maps, folds, and traversals+ => MonadSupply m+ => ModuleName+ -> (ParamUsage c -> Expr -> f Expr) -- how to handle constructor arguments+ -> (f Expr -> m Expr) -- resolve the applicative effect into an expression+ -> [(ProperName 'ConstructorName, [Maybe (ParamUsage c)])]+ -> m Expr+mkCasesForTraversal mn handleArg extractExpr ctors = do+ m <- freshIdent "m"+ fmap (lamCase m) . for ctors $ \(ctorName, ctorUsages) -> do+ ctorArgs <- for ctorUsages $ \usage -> freshIdent "v" <&> (, usage)+ let ctor = mkCtor mn ctorName+ let caseBinder = mkCtorBinder mn ctorName $ map (mkBinder . fst) ctorArgs+ fmap (CaseAlternative [caseBinder] . unguarded) . extractExpr $+ fmap (foldl' App ctor) . for ctorArgs $ \(ident, mbUsage) -> maybe pure handleArg mbUsage $ mkVar ident++data TraversalExprs = TraversalExprs+ { recurseVar :: Expr -- a var representing map, foldMap, or traverse, for handling structured values+ , birecurseVar :: Expr -- same, but bimap, bifoldMap, or bitraverse+ , lrecurseExpr :: Expr -- same, but lmap or ltraverse (there is no lfoldMap, but we can use `flip bifoldMap mempty`)+ , rrecurseExpr :: Expr -- same, but rmap or rtraverse etc., which conceptually should be the same as recurseVar but the bi classes aren't subclasses of the mono classes+ }++data ContraversalExprs = ContraversalExprs+ { crecurseVar :: Expr+ , direcurseVar :: Expr+ , lcrecurseVar :: Expr+ , rprorecurseVar :: Expr+ }++appBirecurseExprs :: TraversalExprs -> These Expr Expr -> Expr+appBirecurseExprs TraversalExprs{..} = these (App lrecurseExpr) (App rrecurseExpr) (App . App birecurseVar)++appDirecurseExprs :: ContraversalExprs -> These Expr Expr -> Expr+appDirecurseExprs ContraversalExprs{..} = these (App lcrecurseVar) (App rprorecurseVar) (App . App direcurseVar)++data TraversalOps m = forall f. Applicative f => TraversalOps+ { visitExpr :: m Expr -> f Expr -- lift an expression into the applicative effect defining the traversal+ , extractExpr :: f Expr -> m Expr -- resolve the applicative effect into an expression+ }++mkTraversal+ :: forall c m+ . MonadSupply m+ => ModuleName+ -> Bool+ -> TraversalExprs+ -> (c -> ContraversalExprs)+ -> TraversalOps m+ -> [(ProperName 'ConstructorName, [Maybe (ParamUsage c)])]+ -> m Expr+mkTraversal mn isBi te@TraversalExprs{..} getContraversalExprs (TraversalOps @_ @f visitExpr extractExpr) ctors = do+ f <- freshIdent "f"+ g <- if isBi then freshIdent "g" else pure f+ let+ handleValue :: ParamUsage c -> Expr -> f Expr+ handleValue = unnestRecords $ \usage inputExpr -> visitExpr $ flip App inputExpr <$> mkFnExprForValue usage++ mkFnExprForValue :: ParamUsage c -> m Expr+ mkFnExprForValue = \case+ IsParam ->+ pure $ mkVar g+ IsLParam ->+ pure $ mkVar f+ MentionsParam innerUsage ->+ App recurseVar <$> mkFnExprForValue innerUsage+ MentionsParamBi theseInnerUsages ->+ appBirecurseExprs te <$> both mkFnExprForValue theseInnerUsages+ MentionsParamContravariantly c contraUsage -> do+ let ce@ContraversalExprs{..} = getContraversalExprs c+ case contraUsage of+ MentionsParamContra innerUsage ->+ App crecurseVar <$> mkFnExprForValue innerUsage+ MentionsParamPro theseInnerUsages ->+ appDirecurseExprs ce <$> both mkFnExprForValue theseInnerUsages+ IsRecord fields ->+ usingLamIdent $ extractExpr . traverseFields handleValue fields++ lam f . applyWhen isBi (lam g) <$> mkCasesForTraversal mn handleValue extractExpr ctors++deriveFunctor+ :: forall m+ . MonadError MultipleErrors m+ => MonadState CheckState m+ => MonadSupply m+ => Maybe Bool -- does left parameter exist, and is it contravariant?+ -> Bool -- is the (right) parameter contravariant?+ -> PSString -- name of the map function for this functor type+ -> Qualified (ProperName 'ClassName)+ -> UnwrappedTypeConstructor+ -> m [(PSString, Expr)]+deriveFunctor mbLParamIsContravariant paramIsContravariant mapName nm utc = do+ ctors <- validateParamsInTypeConstructors nm utc isBi functorClasses $ Just $ ContravarianceSupport+ { contravarianceWitness = ()+ , paramIsContravariant+ , lparamIsContravariant = or mbLParamIsContravariant+ , contravariantClasses+ }+ mapFun <- mkTraversal (utcModuleName utc) isBi mapExprs (const cmapExprs) (TraversalOps identity identity) ctors+ pure [(mapName, mapFun)]+ where+ isBi = isJust mbLParamIsContravariant+ mapExprs = TraversalExprs+ { recurseVar = mkRef Libs.I_map+ , birecurseVar = mkRef Libs.I_bimap+ , lrecurseExpr = mkRef Libs.I_lmap+ , rrecurseExpr = mkRef Libs.I_rmap+ }+ cmapExprs = ContraversalExprs+ { crecurseVar = mkRef Libs.I_cmap+ , direcurseVar = mkRef Libs.I_dimap+ , lcrecurseVar = mkRef Libs.I_lcmap+ , rprorecurseVar = mkRef Libs.I_profunctorRmap+ }+ functorClasses = CovariantClasses Libs.Functor Libs.Bifunctor+ contravariantClasses = ContravariantClasses Libs.Contravariant Libs.Profunctor++toConst :: forall f a b. f a -> Const [f a] b+toConst = Const . pure++consumeConst :: forall f a b c. Applicative f => ([a] -> b) -> Const [f a] c -> f b+consumeConst f = fmap f . sequenceA . getConst++applyWhen :: forall a. Bool -> (a -> a) -> a -> a+applyWhen cond f = if cond then f else identity++deriveFoldable+ :: forall m+ . MonadError MultipleErrors m+ => MonadState CheckState m+ => MonadSupply m+ => Bool -- is there a left parameter (are we deriving Bifoldable)?+ -> Qualified (ProperName 'ClassName)+ -> UnwrappedTypeConstructor+ -> m [(PSString, Expr)]+deriveFoldable isBi nm utc = do+ ctors <- validateParamsInTypeConstructors nm utc isBi foldableClasses Nothing+ foldlFun <- mkAsymmetricFoldFunction False foldlExprs ctors+ foldrFun <- mkAsymmetricFoldFunction True foldrExprs ctors+ foldMapFun <- mkTraversal mn isBi foldMapExprs absurd foldMapOps ctors+ pure+ [ (if isBi then Libs.S_bifoldl else Libs.S_foldl, foldlFun)+ , (if isBi then Libs.S_bifoldr else Libs.S_foldr, foldrFun)+ , (if isBi then Libs.S_bifoldMap else Libs.S_foldMap, foldMapFun)+ ]+ where+ mn = utcModuleName utc+ foldableClasses = CovariantClasses Libs.Foldable Libs.Bifoldable+ foldlExprs = TraversalExprs+ { recurseVar = mkRef Libs.I_foldl+ , birecurseVar = bifoldlVar+ , lrecurseExpr = App (App flipVar bifoldlVar) constVar+ , rrecurseExpr = App bifoldlVar constVar+ }+ foldrExprs = TraversalExprs+ { recurseVar = mkRef Libs.I_foldr+ , birecurseVar = bifoldrVar+ , lrecurseExpr = App (App flipVar bifoldrVar) (App constVar identityVar)+ , rrecurseExpr = App bifoldrVar (App constVar identityVar)+ }+ foldMapExprs = TraversalExprs+ { recurseVar = mkRef Libs.I_foldMap+ , birecurseVar = bifoldMapVar+ , lrecurseExpr = App (App flipVar bifoldMapVar) memptyVar+ , rrecurseExpr = App bifoldMapVar memptyVar+ }+ bifoldlVar = mkRef Libs.I_bifoldl+ bifoldrVar = mkRef Libs.I_bifoldr+ bifoldMapVar = mkRef Libs.I_bifoldMap+ constVar = mkRef Libs.I_const+ flipVar = mkRef Libs.I_flip+ identityVar = mkRef Libs.I_identity+ memptyVar = mkRef Libs.I_mempty++ mkAsymmetricFoldFunction :: Bool -> TraversalExprs -> [(ProperName 'ConstructorName, [Maybe (ParamUsage Void)])] -> m Expr+ mkAsymmetricFoldFunction isRightFold te@TraversalExprs{..} ctors = do+ f <- freshIdent "f"+ g <- if isBi then freshIdent "g" else pure f+ z <- freshIdent "z"+ let+ appCombiner :: (Bool, Expr) -> Expr -> Expr -> Expr+ appCombiner (isFlipped, fn) = applyWhen (isFlipped == isRightFold) flip $ App . App fn++ mkCombinerExpr :: ParamUsage Void -> m Expr+ mkCombinerExpr = fmap (uncurry $ \isFlipped -> applyWhen isFlipped $ App flipVar) . getCombiner++ handleValue :: ParamUsage Void -> Expr -> Const [m (Expr -> Expr)] Expr+ handleValue = unnestRecords $ \usage inputExpr -> toConst $ flip appCombiner inputExpr <$> getCombiner usage++ getCombiner :: ParamUsage Void -> m (Bool, Expr)+ getCombiner = \case+ IsParam ->+ pure (False, mkVar g)+ IsLParam ->+ pure (False, mkVar f)+ MentionsParam innerUsage ->+ (isRightFold, ) . App recurseVar <$> mkCombinerExpr innerUsage+ MentionsParamBi theseInnerUsages ->+ (isRightFold, ) . appBirecurseExprs te <$> both mkCombinerExpr theseInnerUsages+ IsRecord fields -> do+ let foldFieldsOf = traverseFields handleValue fields+ fmap (False, ) . usingLamIdent $ \lVar ->+ usingLamIdent $+ if isRightFold+ then flip extractExprStartingWith $ foldFieldsOf lVar+ else extractExprStartingWith lVar . foldFieldsOf++ extractExprStartingWith :: Expr -> Const [m (Expr -> Expr)] Expr -> m Expr+ extractExprStartingWith = consumeConst . if isRightFold then foldr ($) else foldl' (&)++ lam f . applyWhen isBi (lam g) . lam z <$> mkCasesForTraversal mn handleValue (extractExprStartingWith $ mkVar z) ctors++foldMapOps :: forall m. Applicative m => TraversalOps m+foldMapOps = TraversalOps { visitExpr = toConst, .. }+ where+ appendVar = mkRef Libs.I_append+ memptyVar = mkRef Libs.I_mempty++ extractExpr :: Const [m Expr] Expr -> m Expr+ extractExpr = consumeConst $ \case+ [] -> memptyVar+ exprs -> foldr1 (App . App appendVar) exprs++deriveTraversable+ :: forall m+ . MonadError MultipleErrors m+ => MonadState CheckState m+ => MonadSupply m+ => Bool -- is there a left parameter (are we deriving Bitraversable)?+ -> Qualified (ProperName 'ClassName)+ -> UnwrappedTypeConstructor+ -> m [(PSString, Expr)]+deriveTraversable isBi nm utc = do+ ctors <- validateParamsInTypeConstructors nm utc isBi traversableClasses Nothing+ traverseFun <- mkTraversal (utcModuleName utc) isBi traverseExprs absurd traverseOps ctors+ sequenceFun <- usingLamIdent $ pure . App (App (if isBi then App bitraverseVar identityVar else traverseVar) identityVar)+ pure+ [ (if isBi then Libs.S_bitraverse else Libs.S_traverse, traverseFun)+ , (if isBi then Libs.S_bisequence else Libs.S_sequence, sequenceFun)+ ]+ where+ traversableClasses = CovariantClasses Libs.Traversable Libs.Bitraversable+ traverseExprs = TraversalExprs+ { recurseVar = traverseVar+ , birecurseVar = bitraverseVar+ , lrecurseExpr = mkRef Libs.I_ltraverse+ , rrecurseExpr = mkRef Libs.I_rtraverse+ }+ traverseVar = mkRef Libs.I_traverse+ bitraverseVar = mkRef Libs.I_bitraverse+ identityVar = mkRef Libs.I_identity++traverseOps :: forall m. MonadSupply m => TraversalOps m+traverseOps = TraversalOps { .. }+ where+ pureVar = mkRef Libs.I_pure+ mapVar = mkRef Libs.I_map+ applyVar = mkRef Libs.I_apply++ visitExpr :: m Expr -> WriterT [(Ident, m Expr)] m Expr+ visitExpr traversedExpr = do+ ident <- freshIdent "v"+ tell [(ident, traversedExpr)] $> mkVar ident++ extractExpr :: WriterT [(Ident, m Expr)] m Expr -> m Expr+ extractExpr = runWriterT >=> \(result, unzip -> (ctx, args)) -> flip mkApps (foldr lam result ctx) <$> sequenceA args++ mkApps :: [Expr] -> Expr -> Expr+ mkApps = \case+ [] -> App pureVar+ h : t -> \l -> foldl' (App . App applyVar) (App (App mapVar l) h) t
src/Language/PureScript/TypeChecker/Entailment.hs view
@@ -1,195 +1,921 @@------------------------------------------------------------------------------------ Module : Language.PureScript.TypeChecker.Entailment--- Copyright : (c) Phil Freeman 2013--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ |--- Type class entailment-----------------------------------------------------------------------------------module Language.PureScript.TypeChecker.Entailment (- entails-) where--import Data.Function (on)-import Data.List-import Data.Maybe (maybeToList)-import Data.Foldable (foldMap)-import qualified Data.Map as M--import Control.Applicative-import Control.Arrow (Arrow(..))-import Control.Monad.Except--import Language.PureScript.AST-import Language.PureScript.Errors-import Language.PureScript.Environment-import Language.PureScript.Names-import Language.PureScript.TypeChecker.Monad-import Language.PureScript.TypeChecker.Synonyms-import Language.PureScript.TypeChecker.Unify-import Language.PureScript.TypeClassDictionaries-import Language.PureScript.Types-import qualified Language.PureScript.Constants as C---- |--- Check that the current set of type class dictionaries entail the specified type class goal, and, if so,--- return a type class dictionary reference.----entails :: Environment -> ModuleName -> [TypeClassDictionaryInScope] -> Constraint -> Bool -> Check Expr-entails env moduleName context = solve (sortedNubBy canonicalizeDictionary (filter filterModule context))- where- sortedNubBy :: (Ord k) => (v -> k) -> [v] -> [v]- sortedNubBy f vs = M.elems (M.fromList (map (f &&& id) vs))-- -- Filter out type dictionaries which are in scope in the current module- filterModule :: TypeClassDictionaryInScope -> Bool- filterModule (TypeClassDictionaryInScope { tcdName = Qualified (Just mn) _ }) | mn == moduleName = True- filterModule (TypeClassDictionaryInScope { tcdName = Qualified Nothing _ }) = True- filterModule _ = False-- solve context' (className, tys) trySuperclasses =- checkOverlaps $ go trySuperclasses className tys- where- go trySuperclasses' className' tys' =- -- Look for regular type instances- [ mkDictionary (canonicalizeDictionary tcd) args- | tcd <- context'- -- Make sure the type class name matches the one we are trying to satisfy- , className' == tcdClassName tcd- -- Make sure the type unifies with the type in the type instance definition- , subst <- maybeToList . (>>= verifySubstitution) . fmap concat $ zipWithM (typeHeadsAreEqual moduleName env) tys' (tcdInstanceTypes tcd)- -- Solve any necessary subgoals- , args <- solveSubgoals subst (tcdDependencies tcd) ] ++-- -- Look for implementations via superclasses- [ SubclassDictionaryValue suDict superclass index- | trySuperclasses'- , (subclassName, (args, _, implies)) <- M.toList (typeClasses env)- -- Try each superclass- , (index, (superclass, suTyArgs)) <- zip [0..] implies- -- Make sure the type class name matches the superclass name- , className' == superclass- -- Make sure the types unify with the types in the superclass implication- , subst <- maybeToList . (>>= verifySubstitution) . fmap concat $ zipWithM (typeHeadsAreEqual moduleName env) tys' suTyArgs- -- Finally, satisfy the subclass constraint- , args' <- maybeToList $ mapM ((`lookup` subst) . fst) args- , suDict <- go True subclassName args' ]-- -- Create dictionaries for subgoals which still need to be solved by calling go recursively- -- E.g. the goal (Show a, Show b) => Show (Either a b) can be satisfied if the current type- -- unifies with Either a b, and we can satisfy the subgoals Show a and Show b recursively.- solveSubgoals :: [(String, Type)] -> Maybe [Constraint] -> [Maybe [DictionaryValue]]- solveSubgoals _ Nothing = return Nothing- solveSubgoals subst (Just subgoals) = do- dict <- mapM (uncurry (go True) . second (map (replaceAllTypeVars subst))) subgoals- return $ Just dict- -- Make a dictionary from subgoal dictionaries by applying the correct function- mkDictionary :: Qualified Ident -> Maybe [DictionaryValue] -> DictionaryValue- mkDictionary fnName Nothing = LocalDictionaryValue fnName- mkDictionary fnName (Just []) = GlobalDictionaryValue fnName- mkDictionary fnName (Just dicts) = DependentDictionaryValue fnName dicts- -- Turn a DictionaryValue into a Expr- dictionaryValueToValue :: DictionaryValue -> Expr- dictionaryValueToValue (LocalDictionaryValue fnName) = Var fnName- dictionaryValueToValue (GlobalDictionaryValue fnName) = Var fnName- dictionaryValueToValue (DependentDictionaryValue fnName dicts) = foldl App (Var fnName) (map dictionaryValueToValue dicts)- dictionaryValueToValue (SubclassDictionaryValue dict superclassName index) =- App (Accessor (C.__superclass_ ++ show superclassName ++ "_" ++ show index)- (dictionaryValueToValue dict))- valUndefined- -- Ensure that a substitution is valid- verifySubstitution :: [(String, Type)] -> Maybe [(String, Type)]- verifySubstitution subst = do- let grps = groupBy ((==) `on` fst) subst- guard (all (pairwise (unifiesWith env) . map snd) grps)- return $ map head grps- -- |- -- Check for overlapping instances- --- checkOverlaps :: [DictionaryValue] -> Check Expr- checkOverlaps dicts =- case [ (d1, d2) | d1 <- dicts, d2 <- dicts, d1 `overlapping` d2 ] of- ds@(_ : _) -> throwError . errorMessage $ OverlappingInstances className tys (map fst ds)- _ -> case chooseSimplestDictionaries dicts of- [] -> throwError . errorMessage $ NoInstanceFound className tys- d : _ -> return $ dictionaryValueToValue d- -- Choose the simplest DictionaryValues from a list of candidates- -- The reason for this function is as follows:- -- When considering overlapping instances, we don't want to consider the same dictionary- -- to be an overlap of itself when obtained as a superclass of another class.- -- Observing that we probably don't want to select a superclass instance when an instance- -- is available directly, and that there is no way for a superclass instance to actually- -- introduce an overlap that wouldn't have been there already, we simply remove dictionaries- -- obtained as superclass instances if there are simpler instances available.- chooseSimplestDictionaries :: [DictionaryValue] -> [DictionaryValue]- chooseSimplestDictionaries ds = case filter isSimpleDictionaryValue ds of- [] -> ds- simple -> simple- isSimpleDictionaryValue SubclassDictionaryValue{} = False- isSimpleDictionaryValue (DependentDictionaryValue _ ds) = all isSimpleDictionaryValue ds- isSimpleDictionaryValue _ = True- -- |- -- Check if two dictionaries are overlapping- --- -- Dictionaries which are subclass dictionaries cannot overlap, since otherwise the overlap would have- -- been caught when constructing superclass dictionaries.- --- overlapping :: DictionaryValue -> DictionaryValue -> Bool- overlapping (LocalDictionaryValue nm1) (LocalDictionaryValue nm2) | nm1 == nm2 = False- overlapping (GlobalDictionaryValue nm1) (GlobalDictionaryValue nm2) | nm1 == nm2 = False- overlapping (DependentDictionaryValue nm1 ds1) (DependentDictionaryValue nm2 ds2)- | nm1 == nm2 = or $ zipWith overlapping ds1 ds2- overlapping SubclassDictionaryValue{} _ = False- overlapping _ SubclassDictionaryValue{} = False- overlapping _ _ = True-- valUndefined :: Expr- valUndefined = Var (Qualified (Just (ModuleName [ProperName C.prim])) (Ident C.undefined))---- |--- Check whether the type heads of two types are equal (for the purposes of type class dictionary lookup),--- and return a substitution from type variables to types which makes the type heads unify.----typeHeadsAreEqual :: ModuleName -> Environment -> Type -> Type -> Maybe [(String, Type)]-typeHeadsAreEqual _ _ (Skolem _ s1 _) (Skolem _ s2 _) | s1 == s2 = Just []-typeHeadsAreEqual _ _ t (TypeVar v) = Just [(v, t)]-typeHeadsAreEqual _ _ (TypeConstructor c1) (TypeConstructor c2) | c1 == c2 = Just []-typeHeadsAreEqual m e (TypeApp h1 t1) (TypeApp h2 t2) = (++) <$> typeHeadsAreEqual m e h1 h2 - <*> typeHeadsAreEqual m e t1 t2-typeHeadsAreEqual m e (SaturatedTypeSynonym name args) t2 = case expandTypeSynonym' e name args of- Left _ -> Nothing- Right t1 -> typeHeadsAreEqual m e t1 t2-typeHeadsAreEqual _ _ REmpty REmpty = Just []-typeHeadsAreEqual m e r1@(RCons _ _ _) r2@(RCons _ _ _) =- let (s1, r1') = rowToList r1- (s2, r2') = rowToList r2- - int = [ (t1, t2) | (name, t1) <- s1, (name', t2) <- s2, name == name' ]- sd1 = [ (name, t1) | (name, t1) <- s1, name `notElem` map fst s2 ]- sd2 = [ (name, t2) | (name, t2) <- s2, name `notElem` map fst s1 ]- in (++) <$> foldMap (\(t1, t2) -> typeHeadsAreEqual m e t1 t2) int - <*> go sd1 r1' sd2 r2'- where- go :: [(String, Type)] -> Type -> [(String, Type)] -> Type -> Maybe [(String, Type)]- go [] REmpty [] REmpty = Just [] - go [] (TUnknown _) _ _ = Just [] - go [] (TypeVar v1) [] (TypeVar v2) | v1 == v2 = Just []- go [] (Skolem _ s1 _) [] (Skolem _ s2 _) | s1 == s2 = Just []- go sd r [] (TypeVar v) = Just [(v, rowFromList (sd, r))]- go _ _ _ _ = Nothing-typeHeadsAreEqual _ _ _ _ = Nothing---- |--- Check all values in a list pairwise match a predicate----pairwise :: (a -> a -> Bool) -> [a] -> Bool-pairwise _ [] = True-pairwise _ [_] = True-pairwise p (x : xs) = all (p x) xs && pairwise p xs+-- |+-- Type class entailment+--+module Language.PureScript.TypeChecker.Entailment+ ( InstanceContext+ , SolverOptions(..)+ , replaceTypeClassDictionaries+ , newDictionaries+ , entails+ , findDicts+ ) where++import Prelude+import Protolude (ordNub, headMay)++import Control.Arrow (second, (&&&))+import Control.Monad.Error.Class (MonadError(..))+import Control.Monad.State (MonadState(..), MonadTrans(..), StateT(..), evalStateT, execStateT, foldM, gets, guard, join, modify, zipWithM, zipWithM_, (<=<))+import Control.Monad.Supply.Class (MonadSupply(..))+import Control.Monad.Writer (Any(..), MonadWriter(..), WriterT(..))++import Data.Either (lefts, partitionEithers)+import Data.Foldable (for_, fold, toList)+import Data.Function (on)+import Data.Functor (($>), (<&>))+import Data.List (delete, findIndices, minimumBy, nubBy, sortOn, tails)+import Data.Maybe (catMaybes, fromMaybe, listToMaybe, mapMaybe)+import Data.Map qualified as M+import Data.Set qualified as S+import Data.Traversable (for)+import Data.Text (Text, stripPrefix, stripSuffix)+import Data.Text qualified as T+import Data.List.NonEmpty (NonEmpty(..))+import Data.List.NonEmpty qualified as NEL++import Language.PureScript.AST (Binder(..), ErrorMessageHint(..), Expr(..), Literal(..), pattern NullSourceSpan, everywhereOnValuesTopDownM, nullSourceSpan, everythingOnValues)+import Language.PureScript.AST.Declarations (UnknownsHint(..))+import Language.PureScript.Crash (internalError)+import Language.PureScript.Environment (Environment(..), FunctionalDependency(..), TypeClassData(..), dictTypeName, kindRow, tyBoolean, tyInt, tyString)+import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage(..), addHint, addHints, errorMessage, rethrow)+import Language.PureScript.Names (pattern ByNullSourcePos, Ident(..), ModuleName, ProperName(..), ProperNameType(..), Qualified(..), QualifiedBy(..), byMaybeModuleName, coerceProperName, disqualify, freshIdent, getQual)+import Language.PureScript.TypeChecker.Entailment.Coercible (GivenSolverState(..), WantedSolverState(..), initialGivenSolverState, initialWantedSolverState, insoluble, solveGivens, solveWanteds)+import Language.PureScript.TypeChecker.Entailment.IntCompare (mkFacts, mkRelation, solveRelation)+import Language.PureScript.TypeChecker.Kinds (elaborateKind, unifyKinds')+import Language.PureScript.TypeChecker.Monad (CheckState(..), withErrorMessageHint)+import Language.PureScript.TypeChecker.Synonyms (replaceAllTypeSynonyms)+import Language.PureScript.TypeChecker.Unify (freshTypeWithKind, substituteType, unifyTypes)+import Language.PureScript.TypeClassDictionaries (NamedDict, TypeClassDictionaryInScope(..), superclassName)+import Language.PureScript.Types+import Language.PureScript.Label (Label(..))+import Language.PureScript.PSString (PSString, mkString, decodeString)+import Language.PureScript.Constants.Libs qualified as C+import Language.PureScript.Constants.Prim qualified as C++-- | Describes what sort of dictionary to generate for type class instances+data Evidence+ -- | An existing named instance+ = NamedInstance (Qualified Ident)++ -- | Computed instances+ | WarnInstance SourceType -- ^ Warn type class with a user-defined warning message+ | IsSymbolInstance PSString -- ^ The IsSymbol type class for a given Symbol literal+ | ReflectableInstance Reflectable -- ^ The Reflectable type class for a reflectable kind+ | EmptyClassInstance -- ^ For any solved type class with no members+ deriving (Show, Eq)++-- | Describes kinds that are reflectable to the term-level+data Reflectable+ = ReflectableInt Integer -- ^ For type-level numbers+ | ReflectableString PSString -- ^ For type-level strings+ | ReflectableBoolean Bool -- ^ For type-level booleans+ | ReflectableOrdering Ordering -- ^ For type-level orderings+ deriving (Show, Eq)++-- | Reflect a reflectable type into an expression+asExpression :: Reflectable -> Expr+asExpression = \case+ ReflectableInt n -> Literal NullSourceSpan $ NumericLiteral $ Left n+ ReflectableString s -> Literal NullSourceSpan $ StringLiteral s+ ReflectableBoolean b -> Literal NullSourceSpan $ BooleanLiteral b+ ReflectableOrdering o -> Constructor NullSourceSpan $ case o of+ LT -> C.C_LT+ EQ -> C.C_EQ+ GT -> C.C_GT++-- | Extract the identifier of a named instance+namedInstanceIdentifier :: Evidence -> Maybe (Qualified Ident)+namedInstanceIdentifier (NamedInstance i) = Just i+namedInstanceIdentifier _ = Nothing++-- | Description of a type class dictionary with instance evidence+type TypeClassDict = TypeClassDictionaryInScope Evidence++-- | The 'InstanceContext' tracks those constraints which can be satisfied.+type InstanceContext = M.Map QualifiedBy+ (M.Map (Qualified (ProperName 'ClassName))+ (M.Map (Qualified Ident) (NonEmpty NamedDict)))++findDicts :: InstanceContext -> Qualified (ProperName 'ClassName) -> QualifiedBy -> [TypeClassDict]+findDicts ctx cn = fmap (fmap NamedInstance) . foldMap NEL.toList . foldMap M.elems . (M.lookup cn <=< flip M.lookup ctx)++-- | A type substitution which makes an instance head match a list of types.+--+-- Note: we store many types per type variable name. For any name, all types+-- should unify if we are going to commit to an instance.+type Matching a = M.Map Text a++combineContexts :: InstanceContext -> InstanceContext -> InstanceContext+combineContexts = M.unionWith (M.unionWith (M.unionWith (<>)))++-- | Replace type class dictionary placeholders with inferred type class dictionaries+replaceTypeClassDictionaries+ :: forall m+ . (MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m, MonadSupply m)+ => Bool+ -> Expr+ -> m (Expr, [(Ident, InstanceContext, SourceConstraint)])+replaceTypeClassDictionaries shouldGeneralize expr = flip evalStateT M.empty $ do+ -- Loop, deferring any unsolved constraints, until there are no more+ -- constraints which can be solved, then make a generalization pass.+ let loop e = do+ (e', solved) <- deferPass e+ if getAny solved+ then loop e'+ else return e'+ loop expr >>= generalizePass+ where+ -- This pass solves constraints where possible, deferring constraints if not.+ deferPass :: Expr -> StateT InstanceContext m (Expr, Any)+ deferPass = fmap (second fst) . runWriterT . f where+ f :: Expr -> WriterT (Any, [(Ident, InstanceContext, SourceConstraint)]) (StateT InstanceContext m) Expr+ (_, f, _) = everywhereOnValuesTopDownM return (go True) return++ -- This pass generalizes any remaining constraints+ generalizePass :: Expr -> StateT InstanceContext m (Expr, [(Ident, InstanceContext, SourceConstraint)])+ generalizePass = fmap (second snd) . runWriterT . f where+ f :: Expr -> WriterT (Any, [(Ident, InstanceContext, SourceConstraint)]) (StateT InstanceContext m) Expr+ (_, f, _) = everywhereOnValuesTopDownM return (go False) return++ go :: Bool -> Expr -> WriterT (Any, [(Ident, InstanceContext, SourceConstraint)]) (StateT InstanceContext m) Expr+ go deferErrors (TypeClassDictionary constraint context hints) =+ rethrow (addHints hints) $ entails (SolverOptions shouldGeneralize deferErrors) constraint context hints+ go _ other = return other++-- | Three options for how we can handle a constraint, depending on the mode we're in.+data EntailsResult a+ = Solved a TypeClassDict+ -- ^ We solved this constraint+ | Unsolved SourceConstraint+ -- ^ We couldn't solve this constraint right now, it will be generalized+ | Deferred+ -- ^ We couldn't solve this constraint right now, so it has been deferred+ deriving Show++-- | Options for the constraint solver+data SolverOptions = SolverOptions+ { solverShouldGeneralize :: Bool+ -- ^ Should the solver be allowed to generalize over unsolved constraints?+ , solverDeferErrors :: Bool+ -- ^ Should the solver be allowed to defer errors by skipping constraints?+ }++data Matched t+ = Match t+ | Apart+ | Unknown+ deriving (Eq, Show, Functor)++instance Semigroup t => Semigroup (Matched t) where+ (Match l) <> (Match r) = Match (l <> r)+ Apart <> _ = Apart+ _ <> Apart = Apart+ _ <> _ = Unknown++instance Monoid t => Monoid (Matched t) where+ mempty = Match mempty++-- | Check that the current set of type class dictionaries entail the specified type class goal, and, if so,+-- return a type class dictionary reference.+entails+ :: forall m+ . (MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m, MonadSupply m)+ => SolverOptions+ -- ^ Solver options+ -> SourceConstraint+ -- ^ The constraint to solve+ -> InstanceContext+ -- ^ The contexts in which to solve the constraint+ -> [ErrorMessageHint]+ -- ^ Error message hints to apply to any instance errors+ -> WriterT (Any, [(Ident, InstanceContext, SourceConstraint)]) (StateT InstanceContext m) Expr+entails SolverOptions{..} constraint context hints =+ overConstraintArgsAll (lift . lift . traverse replaceAllTypeSynonyms) constraint >>= solve+ where+ forClassNameM :: Environment -> InstanceContext -> Qualified (ProperName 'ClassName) -> [SourceType] -> [SourceType] -> m [TypeClassDict]+ forClassNameM env ctx cn@C.Coercible kinds args =+ fromMaybe (forClassName env ctx cn kinds args) <$>+ solveCoercible env ctx kinds args+ forClassNameM env ctx cn kinds args =+ pure $ forClassName env ctx cn kinds args++ forClassName :: Environment -> InstanceContext -> Qualified (ProperName 'ClassName) -> [SourceType] -> [SourceType] -> [TypeClassDict]+ forClassName _ ctx cn@C.Warn _ [msg] =+ -- Prefer a warning dictionary in scope if there is one available.+ -- This allows us to defer a warning by propagating the constraint.+ findDicts ctx cn ByNullSourcePos ++ [TypeClassDictionaryInScope Nothing 0 (WarnInstance msg) [] C.Warn [] [] [msg] Nothing Nothing]+ forClassName _ _ C.IsSymbol _ args | Just dicts <- solveIsSymbol args = dicts+ forClassName _ _ C.SymbolCompare _ args | Just dicts <- solveSymbolCompare args = dicts+ forClassName _ _ C.SymbolAppend _ args | Just dicts <- solveSymbolAppend args = dicts+ forClassName _ _ C.SymbolCons _ args | Just dicts <- solveSymbolCons args = dicts+ forClassName _ _ C.IntAdd _ args | Just dicts <- solveIntAdd args = dicts+ forClassName _ ctx C.IntCompare _ args | Just dicts <- solveIntCompare ctx args = dicts+ forClassName _ _ C.IntMul _ args | Just dicts <- solveIntMul args = dicts+ forClassName _ _ C.IntToString _ args | Just dicts <- solveIntToString args = dicts+ forClassName _ _ C.Reflectable _ args | Just dicts <- solveReflectable args = dicts+ forClassName _ _ C.RowUnion kinds args | Just dicts <- solveUnion kinds args = dicts+ forClassName _ _ C.RowNub kinds args | Just dicts <- solveNub kinds args = dicts+ forClassName _ _ C.RowLacks kinds args | Just dicts <- solveLacks kinds args = dicts+ forClassName _ _ C.RowCons kinds args | Just dicts <- solveRowCons kinds args = dicts+ forClassName _ _ C.RowToList kinds args | Just dicts <- solveRowToList kinds args = dicts+ forClassName _ ctx cn@(Qualified (ByModuleName mn) _) _ tys = concatMap (findDicts ctx cn) (ordNub (ByNullSourcePos : ByModuleName mn : map ByModuleName (mapMaybe ctorModules tys)))+ forClassName _ _ _ _ _ = internalError "forClassName: expected qualified class name"++ ctorModules :: SourceType -> Maybe ModuleName+ ctorModules (TypeConstructor _ (Qualified (ByModuleName mn) _)) = Just mn+ ctorModules (TypeConstructor _ (Qualified (BySourcePos _) _)) = internalError "ctorModules: unqualified type name"+ ctorModules (TypeApp _ ty _) = ctorModules ty+ ctorModules (KindApp _ ty _) = ctorModules ty+ ctorModules (KindedType _ ty _) = ctorModules ty+ ctorModules _ = Nothing++ valUndefined :: Expr+ valUndefined = Var nullSourceSpan C.I_undefined++ solve :: SourceConstraint -> WriterT (Any, [(Ident, InstanceContext, SourceConstraint)]) (StateT InstanceContext m) Expr+ solve = go 0 hints+ where+ go :: Int -> [ErrorMessageHint] -> SourceConstraint -> WriterT (Any, [(Ident, InstanceContext, SourceConstraint)]) (StateT InstanceContext m) Expr+ go work _ (Constraint _ className' _ tys' _) | work > 1000 = throwError . errorMessage $ PossiblyInfiniteInstance className' tys'+ go work hints' con@(Constraint _ className' kinds' tys' conInfo) = WriterT . StateT . (withErrorMessageHint (ErrorSolvingConstraint con) .) . runStateT . runWriterT $ do+ -- We might have unified types by solving other constraints, so we need to+ -- apply the latest substitution.+ latestSubst <- lift . lift $ gets checkSubstitution+ let kinds'' = map (substituteType latestSubst) kinds'+ tys'' = map (substituteType latestSubst) tys'++ -- Get the inferred constraint context so far, and merge it with the global context+ inferred <- lift get+ -- We need information about functional dependencies, so we have to look up the class+ -- name in the environment:+ env <- lift . lift $ gets checkEnv+ let classesInScope = typeClasses env+ TypeClassData+ { typeClassArguments+ , typeClassDependencies+ , typeClassIsEmpty+ , typeClassCoveringSets+ , typeClassMembers + } <- case M.lookup className' classesInScope of+ Nothing -> throwError . errorMessage $ UnknownClass className'+ Just tcd -> pure tcd++ dicts <- lift . lift $ forClassNameM env (combineContexts context inferred) className' kinds'' tys''++ let (catMaybes -> ambiguous, instances) = partitionEithers $ do+ chain :: NonEmpty TypeClassDict <-+ NEL.groupBy ((==) `on` tcdChain) $+ sortOn (tcdChain &&& tcdIndex)+ dicts+ -- process instances in a chain in index order+ let found = for (tails1 chain) $ \(tcd :| tl) ->+ -- Make sure the type unifies with the type in the type instance definition+ case matches typeClassDependencies tcd tys'' of+ Apart -> Right () -- keep searching+ Match substs -> Left (Right (substs, tcd)) -- found a match+ Unknown ->+ if null (tcdChain tcd) || null tl+ then Right () -- need proof of apartness but this is either not in a chain or at the end+ else Left (Left (tcdToInstanceDescription tcd)) -- can't continue with this chain yet, need proof of apartness++ lefts [found]+ solution <- lift . lift + $ unique kinds'' tys'' ambiguous instances + $ unknownsInAllCoveringSets (fst . (typeClassArguments !!)) typeClassMembers tys'' typeClassCoveringSets+ case solution of+ Solved substs tcd -> do+ -- Note that we solved something.+ tell (Any True, mempty)+ -- Make sure the substitution is valid:+ lift . lift . for_ substs $ pairwiseM unifyTypes+ -- Now enforce any functional dependencies, using unification+ -- Note: we need to generate fresh types for any unconstrained+ -- type variables before unifying.+ let subst = fmap head substs+ currentSubst <- lift . lift $ gets checkSubstitution+ subst' <- lift . lift $ withFreshTypes tcd (fmap (substituteType currentSubst) subst)+ lift . lift $ zipWithM_ (\t1 t2 -> do+ let inferredType = replaceAllTypeVars (M.toList subst') t1+ unifyTypes inferredType t2) (tcdInstanceTypes tcd) tys''+ currentSubst' <- lift . lift $ gets checkSubstitution+ let subst'' = fmap (substituteType currentSubst') subst'+ -- Solve any necessary subgoals+ args <- solveSubgoals subst'' (ErrorSolvingConstraint con) (tcdDependencies tcd)++ initDict <- lift . lift $ mkDictionary (tcdValue tcd) args++ let match = foldr (\(className, index) dict -> subclassDictionaryValue dict className index)+ initDict+ (tcdPath tcd)++ return (if typeClassIsEmpty then Unused match else match)+ Unsolved unsolved -> do+ -- Generate a fresh name for the unsolved constraint's new dictionary+ ident <- freshIdent ("dict" <> runProperName (disqualify (constraintClass unsolved)))+ let qident = Qualified ByNullSourcePos ident+ -- Store the new dictionary in the InstanceContext so that we can solve this goal in+ -- future.+ newDicts <- lift . lift $ newDictionaries [] qident unsolved+ let newContext = mkContext newDicts+ modify (combineContexts newContext)+ -- Mark this constraint for generalization+ tell (mempty, [(ident, context, unsolved)])+ return (Var nullSourceSpan qident)+ Deferred ->+ -- Constraint was deferred, just return the dictionary unchanged,+ -- with no unsolved constraints. Hopefully, we can solve this later.+ return (TypeClassDictionary (srcConstraint className' kinds'' tys'' conInfo) context hints')+ where+ -- When checking functional dependencies, we need to use unification to make+ -- sure it is safe to use the selected instance. We will unify the solved type with+ -- the type in the instance head under the substitution inferred from its instantiation.+ -- As an example, when solving MonadState t0 (State Int), we choose the+ -- MonadState s (State s) instance, and we unify t0 with Int, since the functional+ -- dependency from MonadState dictates that t0 should unify with s\[s -> Int], which is+ -- Int. This is fine, but in some cases, the substitution does not remove all TypeVars+ -- from the type, so we end up with a unification error. So, any type arguments which+ -- appear in the instance head, but not in the substitution need to be replaced with+ -- fresh type variables. This function extends a substitution with fresh type variables+ -- as necessary, based on the types in the instance head. It also unifies kinds based on+ -- the substitution so kind information propagates correctly through the solver.+ withFreshTypes+ :: TypeClassDict+ -> Matching SourceType+ -> m (Matching SourceType)+ withFreshTypes TypeClassDictionaryInScope{..} initSubst = do+ subst <- foldM withFreshType initSubst $ filter (flip M.notMember initSubst . fst) tcdForAll+ for_ (M.toList initSubst) $ unifySubstKind subst+ pure subst+ where+ withFreshType subst (var, kind) = do+ ty <- freshTypeWithKind $ replaceAllTypeVars (M.toList subst) kind+ pure $ M.insert var ty subst++ unifySubstKind subst (var, ty) =+ for_ (lookup var tcdForAll) $ \instKind -> do+ tyKind <- elaborateKind ty+ currentSubst <- gets checkSubstitution+ unifyKinds'+ (substituteType currentSubst . replaceAllTypeVars (M.toList subst) $ instKind)+ (substituteType currentSubst tyKind)++ unique :: [SourceType] -> [SourceType] -> [Qualified (Either SourceType Ident)] -> [(a, TypeClassDict)] -> UnknownsHint -> m (EntailsResult a)+ unique kindArgs tyArgs ambiguous [] unks+ | solverDeferErrors = return Deferred+ -- We need a special case for nullary type classes, since we want+ -- to generalize over Partial constraints.+ | solverShouldGeneralize && ((null kindArgs && null tyArgs) || any canBeGeneralized kindArgs || any canBeGeneralized tyArgs) =+ return (Unsolved (srcConstraint className' kindArgs tyArgs conInfo))+ | otherwise = throwError . errorMessage $ NoInstanceFound (srcConstraint className' kindArgs tyArgs conInfo) ambiguous unks+ unique _ _ _ [(a, dict)] _ = return $ Solved a dict+ unique _ tyArgs _ tcds _+ | pairwiseAny overlapping (map snd tcds) =+ throwError . errorMessage $ OverlappingInstances className' tyArgs (tcds >>= (toList . tcdToInstanceDescription . snd))+ | otherwise = return $ uncurry Solved (minimumBy (compare `on` length . tcdPath . snd) tcds)++ tcdToInstanceDescription :: TypeClassDict -> Maybe (Qualified (Either SourceType Ident))+ tcdToInstanceDescription TypeClassDictionaryInScope{ tcdDescription, tcdValue } =+ let nii = namedInstanceIdentifier tcdValue+ in case tcdDescription of+ Just ty -> flip Qualified (Left ty) <$> fmap (byMaybeModuleName . getQual) nii+ Nothing -> fmap Right <$> nii++ canBeGeneralized :: Type a -> Bool+ canBeGeneralized TUnknown{} = True+ canBeGeneralized (KindedType _ t _) = canBeGeneralized t+ canBeGeneralized _ = False++ -- Check if two dictionaries are overlapping+ --+ -- Dictionaries which are subclass dictionaries cannot overlap, since otherwise the overlap would have+ -- been caught when constructing superclass dictionaries.+ overlapping :: TypeClassDict -> TypeClassDict -> Bool+ overlapping TypeClassDictionaryInScope{ tcdPath = _ : _ } _ = False+ overlapping _ TypeClassDictionaryInScope{ tcdPath = _ : _ } = False+ overlapping TypeClassDictionaryInScope{ tcdDependencies = Nothing } _ = False+ overlapping _ TypeClassDictionaryInScope{ tcdDependencies = Nothing } = False+ overlapping tcd1 tcd2 = tcdValue tcd1 /= tcdValue tcd2++ -- Create dictionaries for subgoals which still need to be solved by calling go recursively+ -- E.g. the goal (Show a, Show b) => Show (Either a b) can be satisfied if the current type+ -- unifies with Either a b, and we can satisfy the subgoals Show a and Show b recursively.+ solveSubgoals :: Matching SourceType -> ErrorMessageHint -> Maybe [SourceConstraint] -> WriterT (Any, [(Ident, InstanceContext, SourceConstraint)]) (StateT InstanceContext m) (Maybe [Expr])+ solveSubgoals _ _ Nothing = return Nothing+ solveSubgoals subst hint (Just subgoals) =+ Just <$> traverse (rethrow (addHint hint) . go (work + 1) (hints' <> [hint]) . mapConstraintArgsAll (map (replaceAllTypeVars (M.toList subst)))) subgoals++ -- We need subgoal dictionaries to appear in the term somewhere+ -- If there aren't any then the dictionary is just undefined+ useEmptyDict :: Maybe [Expr] -> Expr+ useEmptyDict args = Unused (foldl (App . Abs (VarBinder nullSourceSpan UnusedIdent)) valUndefined (fold args))++ -- Make a dictionary from subgoal dictionaries by applying the correct function+ mkDictionary :: Evidence -> Maybe [Expr] -> m Expr+ mkDictionary (NamedInstance n) args = return $ foldl App (Var nullSourceSpan n) (fold args)+ mkDictionary EmptyClassInstance args = return (useEmptyDict args)+ mkDictionary (WarnInstance msg) args = do+ tell . errorMessage $ UserDefinedWarning msg+ -- We cannot call the type class constructor here because Warn is declared in Prim.+ -- This means that it doesn't have a definition that we can import.+ -- So pass an empty placeholder (undefined) instead.+ return (useEmptyDict args)+ mkDictionary (IsSymbolInstance sym) _ =+ let fields = [ ("reflectSymbol", Abs (VarBinder nullSourceSpan UnusedIdent) (Literal nullSourceSpan (StringLiteral sym))) ] in+ return $ App (Constructor nullSourceSpan (coerceProperName . dictTypeName <$> C.IsSymbol)) (Literal nullSourceSpan (ObjectLiteral fields))+ mkDictionary (ReflectableInstance ref) _ =+ let fields = [ ("reflectType", Abs (VarBinder nullSourceSpan UnusedIdent) (asExpression ref)) ] in+ pure $ App (Constructor nullSourceSpan (coerceProperName . dictTypeName <$> C.Reflectable)) (Literal nullSourceSpan (ObjectLiteral fields))++ unknownsInAllCoveringSets :: (Int -> Text) -> [(Ident, SourceType, Maybe (S.Set (NEL.NonEmpty Int)))] -> [SourceType] -> S.Set (S.Set Int) -> UnknownsHint+ unknownsInAllCoveringSets indexToArgText tyClassMembers tyArgs coveringSets = do+ let unkIndices = findIndices containsUnknowns tyArgs+ if all (\s -> any (`S.member` s) unkIndices) coveringSets then + fromMaybe Unknowns unknownsRequiringVtas+ else + NoUnknowns+ where+ unknownsRequiringVtas = do+ tyClassModuleName <- getQual className'+ let+ tyClassMemberVta :: M.Map (Qualified Ident) [[Text]]+ tyClassMemberVta = M.fromList $ mapMaybe qualifyAndFilter tyClassMembers+ where+ -- Only keep type class members that need VTAs to resolve their type class instances+ qualifyAndFilter (ident, _, mbVtaRequiredArgs) = mbVtaRequiredArgs <&> \vtaRequiredArgs ->+ (Qualified (ByModuleName tyClassModuleName) ident, map (map indexToArgText . NEL.toList) $ S.toList vtaRequiredArgs)++ tyClassMembersInExpr :: Expr -> [(Qualified Ident, [[Text]])]+ tyClassMembersInExpr = getVars+ where+ (_, getVars, _, _, _) = everythingOnValues (++) ignore getVarIdents ignore ignore ignore+ ignore = const []+ getVarIdents = \case+ Var _ ident | Just vtas <- M.lookup ident tyClassMemberVta -> + [(ident, vtas)]+ _ -> + []++ getECTExpr = \case+ ErrorCheckingType expr _ -> Just expr+ _ -> Nothing+ + tyClassMembers' <- headMay $ mapMaybe (fmap tyClassMembersInExpr . getECTExpr) hints+ membersWithVtas <- NEL.nonEmpty tyClassMembers'+ pure $ UnknownsWithVtaRequiringArgs membersWithVtas++ -- Turn a DictionaryValue into a Expr+ subclassDictionaryValue :: Expr -> Qualified (ProperName 'ClassName) -> Integer -> Expr+ subclassDictionaryValue dict className index =+ App (Accessor (mkString (superclassName className index)) dict) valUndefined++ solveCoercible :: Environment -> InstanceContext -> [SourceType] -> [SourceType] -> m (Maybe [TypeClassDict])+ solveCoercible env ctx kinds [a, b] = do+ let coercibleDictsInScope = findDicts ctx C.Coercible ByNullSourcePos+ givens = flip mapMaybe coercibleDictsInScope $ \case+ dict | [a', b'] <- tcdInstanceTypes dict -> Just (a', b')+ | otherwise -> Nothing+ GivenSolverState{ inertGivens } <- execStateT (solveGivens env) $+ initialGivenSolverState givens+ (WantedSolverState{ inertWanteds }, hints') <- runWriterT . execStateT (solveWanteds env) $+ initialWantedSolverState inertGivens a b+ -- Solving fails when there's irreducible wanteds left.+ --+ -- We report the first residual constraint instead of the initial wanted,+ -- unless we just swapped its arguments.+ --+ -- We may have collected hints for the solving failure along the way, in+ -- which case we decorate the error with the first one.+ maybe id addHint (listToMaybe hints') `rethrow` case inertWanteds of+ [] -> pure $ Just [TypeClassDictionaryInScope Nothing 0 EmptyClassInstance [] C.Coercible [] kinds [a, b] Nothing Nothing]+ (k, a', b') : _ | a' == b && b' == a -> throwError $ insoluble k b' a'+ (k, a', b') : _ -> throwError $ insoluble k a' b'+ solveCoercible _ _ _ _ = pure Nothing++ solveIsSymbol :: [SourceType] -> Maybe [TypeClassDict]+ solveIsSymbol [TypeLevelString ann sym] = Just [TypeClassDictionaryInScope Nothing 0 (IsSymbolInstance sym) [] C.IsSymbol [] [] [TypeLevelString ann sym] Nothing Nothing]+ solveIsSymbol _ = Nothing++ solveSymbolCompare :: [SourceType] -> Maybe [TypeClassDict]+ solveSymbolCompare [arg0@(TypeLevelString _ lhs), arg1@(TypeLevelString _ rhs), _] =+ let ordering = case compare lhs rhs of+ LT -> C.LT+ EQ -> C.EQ+ GT -> C.GT+ args' = [arg0, arg1, srcTypeConstructor ordering]+ in Just [TypeClassDictionaryInScope Nothing 0 EmptyClassInstance [] C.SymbolCompare [] [] args' Nothing Nothing]+ solveSymbolCompare _ = Nothing++ solveSymbolAppend :: [SourceType] -> Maybe [TypeClassDict]+ solveSymbolAppend [arg0, arg1, arg2] = do+ (arg0', arg1', arg2') <- appendSymbols arg0 arg1 arg2+ let args' = [arg0', arg1', arg2']+ pure [TypeClassDictionaryInScope Nothing 0 EmptyClassInstance [] C.SymbolAppend [] [] args' Nothing Nothing]+ solveSymbolAppend _ = Nothing++ -- Append type level symbols, or, run backwards, strip a prefix or suffix+ appendSymbols :: SourceType -> SourceType -> SourceType -> Maybe (SourceType, SourceType, SourceType)+ appendSymbols arg0@(TypeLevelString _ lhs) arg1@(TypeLevelString _ rhs) _ = Just (arg0, arg1, srcTypeLevelString (lhs <> rhs))+ appendSymbols arg0@(TypeLevelString _ lhs) _ arg2@(TypeLevelString _ out) = do+ lhs' <- decodeString lhs+ out' <- decodeString out+ rhs <- stripPrefix lhs' out'+ pure (arg0, srcTypeLevelString (mkString rhs), arg2)+ appendSymbols _ arg1@(TypeLevelString _ rhs) arg2@(TypeLevelString _ out) = do+ rhs' <- decodeString rhs+ out' <- decodeString out+ lhs <- stripSuffix rhs' out'+ pure (srcTypeLevelString (mkString lhs), arg1, arg2)+ appendSymbols _ _ _ = Nothing++ solveSymbolCons :: [SourceType] -> Maybe [TypeClassDict]+ solveSymbolCons [arg0, arg1, arg2] = do+ (arg0', arg1', arg2') <- consSymbol arg0 arg1 arg2+ let args' = [arg0', arg1', arg2']+ pure [TypeClassDictionaryInScope Nothing 0 EmptyClassInstance [] C.SymbolCons [] [] args' Nothing Nothing]+ solveSymbolCons _ = Nothing++ consSymbol :: SourceType -> SourceType -> SourceType -> Maybe (SourceType, SourceType, SourceType)+ consSymbol _ _ arg@(TypeLevelString _ s) = do+ (h, t) <- T.uncons =<< decodeString s+ pure (mkTLString (T.singleton h), mkTLString t, arg)+ where mkTLString = srcTypeLevelString . mkString+ consSymbol arg1@(TypeLevelString _ h) arg2@(TypeLevelString _ t) _ = do+ h' <- decodeString h+ t' <- decodeString t+ guard (T.length h' == 1)+ pure (arg1, arg2, srcTypeLevelString (mkString $ h' <> t'))+ consSymbol _ _ _ = Nothing++ solveIntToString :: [SourceType] -> Maybe [TypeClassDict]+ solveIntToString [arg0, _] = do+ (arg0', arg1') <- printIntToString arg0+ let args' = [arg0', arg1']+ pure [TypeClassDictionaryInScope Nothing 0 EmptyClassInstance [] C.IntToString [] [] args' Nothing Nothing]+ solveIntToString _ = Nothing++ printIntToString :: SourceType -> Maybe (SourceType, SourceType)+ printIntToString arg0@(TypeLevelInt _ i) = do+ pure (arg0, srcTypeLevelString $ mkString $ T.pack $ show i)+ printIntToString _ = Nothing++ solveReflectable :: [SourceType] -> Maybe [TypeClassDict]+ solveReflectable [typeLevel, _] = do+ (ref, typ) <- case typeLevel of+ TypeLevelInt _ i -> pure (ReflectableInt i, tyInt)+ TypeLevelString _ s -> pure (ReflectableString s, tyString)+ TypeConstructor _ n+ | n == C.True -> pure (ReflectableBoolean True, tyBoolean)+ | n == C.False -> pure (ReflectableBoolean False, tyBoolean)+ | n == C.LT -> pure (ReflectableOrdering LT, srcTypeConstructor C.Ordering)+ | n == C.EQ -> pure (ReflectableOrdering EQ, srcTypeConstructor C.Ordering)+ | n == C.GT -> pure (ReflectableOrdering GT, srcTypeConstructor C.Ordering)+ _ -> Nothing+ pure [TypeClassDictionaryInScope Nothing 0 (ReflectableInstance ref) [] C.Reflectable [] [] [typeLevel, typ] Nothing Nothing]+ solveReflectable _ = Nothing++ solveIntAdd :: [SourceType] -> Maybe [TypeClassDict]+ solveIntAdd [arg0, arg1, arg2] = do+ (arg0', arg1', arg2') <- addInts arg0 arg1 arg2+ let args' = [arg0', arg1', arg2']+ pure [TypeClassDictionaryInScope Nothing 0 EmptyClassInstance [] C.IntAdd [] [] args' Nothing Nothing]+ solveIntAdd _ = Nothing++ addInts :: SourceType -> SourceType -> SourceType -> Maybe (SourceType, SourceType, SourceType)+ -- l r -> o, l + r = o+ addInts arg0@(TypeLevelInt _ l) arg1@(TypeLevelInt _ r) _ = pure (arg0, arg1, srcTypeLevelInt (l + r))+ -- l o -> r, o - l = r+ addInts arg0@(TypeLevelInt _ l) _ arg2@(TypeLevelInt _ o) = pure (arg0, srcTypeLevelInt (o - l), arg2)+ -- r o -> l, o - r = l+ addInts _ arg1@(TypeLevelInt _ r) arg2@(TypeLevelInt _ o) = pure (srcTypeLevelInt (o - r), arg1, arg2)+ addInts _ _ _ = Nothing++ solveIntCompare :: InstanceContext -> [SourceType] -> Maybe [TypeClassDict]+ solveIntCompare _ [arg0@(TypeLevelInt _ a), arg1@(TypeLevelInt _ b), _] =+ let ordering = case compare a b of+ EQ -> C.EQ+ LT -> C.LT+ GT -> C.GT+ args' = [arg0, arg1, srcTypeConstructor ordering]+ in pure [TypeClassDictionaryInScope Nothing 0 EmptyClassInstance [] C.IntCompare [] [] args' Nothing Nothing]+ solveIntCompare ctx args@[a, b, _] = do+ let compareDictsInScope = findDicts ctx C.IntCompare ByNullSourcePos+ givens = flip mapMaybe compareDictsInScope $ \case+ dict | [a', b', c'] <- tcdInstanceTypes dict -> mkRelation a' b' c'+ | otherwise -> Nothing+ facts = mkFacts (args : (tcdInstanceTypes <$> compareDictsInScope))+ c' <- solveRelation (givens <> facts) a b+ pure [TypeClassDictionaryInScope Nothing 0 EmptyClassInstance [] C.IntCompare [] [] [a, b, srcTypeConstructor c'] Nothing Nothing]+ solveIntCompare _ _ = Nothing++ solveIntMul :: [SourceType] -> Maybe [TypeClassDict]+ solveIntMul [arg0@(TypeLevelInt _ l), arg1@(TypeLevelInt _ r), _] =+ let args' = [arg0, arg1, srcTypeLevelInt (l * r)]+ in pure [TypeClassDictionaryInScope Nothing 0 EmptyClassInstance [] C.IntMul [] [] args' Nothing Nothing]+ solveIntMul _ = Nothing++ solveUnion :: [SourceType] -> [SourceType] -> Maybe [TypeClassDict]+ solveUnion kinds [l, r, u] = do+ (lOut, rOut, uOut, cst, vars) <- unionRows kinds l r u+ pure [ TypeClassDictionaryInScope Nothing 0 EmptyClassInstance [] C.RowUnion vars kinds [lOut, rOut, uOut] cst Nothing ]+ solveUnion _ _ = Nothing++ -- Left biased union of two row types++ unionRows :: [SourceType] -> SourceType -> SourceType -> SourceType -> Maybe (SourceType, SourceType, SourceType, Maybe [SourceConstraint], [(Text, SourceType)])+ unionRows kinds l r u =+ guard canMakeProgress $> (lOut, rOut, uOut, cons, vars)+ where+ (fixed, rest) = rowToList l++ rowVar = srcTypeVar "r"++ (canMakeProgress, lOut, rOut, uOut, cons, vars) =+ case rest of+ -- If the left hand side is a closed row, then we can merge+ -- its labels into the right hand side.+ REmptyKinded _ _ -> (True, l, r, rowFromList (fixed, r), Nothing, [])+ -- If the right hand side and output are closed rows, then we can+ -- compute the left hand side by subtracting the right hand side+ -- from the output.+ _ | (right, rightu@(REmptyKinded _ _)) <- rowToList r+ , (output, restu@(REmptyKinded _ _)) <- rowToList u ->+ let+ -- Partition the output rows into those that belong in right+ -- (taken off the end) and those that must end up in left.+ grabLabel e (left', right', remaining)+ | rowListLabel e `elem` remaining =+ (left', e : right', delete (rowListLabel e) remaining)+ | otherwise =+ (e : left', right', remaining)+ (outL, outR, leftover) =+ foldr grabLabel ([], [], fmap rowListLabel right) output+ in ( null leftover+ , rowFromList (outL, restu)+ , rowFromList (outR, rightu)+ , u+ , Nothing+ , []+ )+ -- If the left hand side is not definitely closed, then the only way we+ -- can safely make progress is to move any known labels from the left+ -- input into the output, and add a constraint for any remaining labels.+ -- Otherwise, the left hand tail might contain the same labels as on+ -- the right hand side, and we can't be certain we won't reorder the+ -- types for such labels.+ _ -> ( not (null fixed)+ , l, r+ , rowFromList (fixed, rowVar)+ , Just [ srcConstraint C.RowUnion kinds [rest, r, rowVar] Nothing ]+ , [("r", kindRow (head kinds))]+ )++ solveRowCons :: [SourceType] -> [SourceType] -> Maybe [TypeClassDict]+ solveRowCons kinds [TypeLevelString ann sym, ty, r, _] =+ Just [ TypeClassDictionaryInScope Nothing 0 EmptyClassInstance [] C.RowCons [] kinds [TypeLevelString ann sym, ty, r, srcRCons (Label sym) ty r] Nothing Nothing ]+ solveRowCons _ _ = Nothing++ solveRowToList :: [SourceType] -> [SourceType] -> Maybe [TypeClassDict]+ solveRowToList [kind] [r, _] = do+ entries <- rowToRowList kind r+ pure [ TypeClassDictionaryInScope Nothing 0 EmptyClassInstance [] C.RowToList [] [kind] [r, entries] Nothing Nothing ]+ solveRowToList _ _ = Nothing++ -- Convert a closed row to a sorted list of entries+ rowToRowList :: SourceType -> SourceType -> Maybe SourceType+ rowToRowList kind r =+ guard (isREmpty rest) $>+ foldr rowListCons (srcKindApp (srcTypeConstructor C.RowListNil) kind) fixed+ where+ (fixed, rest) = rowToSortedList r+ rowListCons (RowListItem _ lbl ty) tl =+ foldl srcTypeApp (srcKindApp (srcTypeConstructor C.RowListCons) kind)+ [ srcTypeLevelString (runLabel lbl)+ , ty+ , tl ]++ solveNub :: [SourceType] -> [SourceType] -> Maybe [TypeClassDict]+ solveNub kinds [r, _] = do+ r' <- nubRows r+ pure [ TypeClassDictionaryInScope Nothing 0 EmptyClassInstance [] C.RowNub [] kinds [r, r'] Nothing Nothing ]+ solveNub _ _ = Nothing++ nubRows :: SourceType -> Maybe SourceType+ nubRows r =+ guard (isREmpty rest) $>+ rowFromList (nubBy ((==) `on` rowListLabel) fixed, rest)+ where+ (fixed, rest) = rowToSortedList r++ solveLacks :: [SourceType] -> [SourceType] -> Maybe [TypeClassDict]+ solveLacks kinds tys@[_, REmptyKinded _ _] =+ pure [ TypeClassDictionaryInScope Nothing 0 EmptyClassInstance [] C.RowLacks [] kinds tys Nothing Nothing ]+ solveLacks kinds [TypeLevelString ann sym, r] = do+ (r', cst) <- rowLacks kinds sym r+ pure [ TypeClassDictionaryInScope Nothing 0 EmptyClassInstance [] C.RowLacks [] kinds [TypeLevelString ann sym, r'] cst Nothing ]+ solveLacks _ _ = Nothing++ rowLacks :: [SourceType] -> PSString -> SourceType -> Maybe (SourceType, Maybe [SourceConstraint])+ rowLacks kinds sym r =+ guard (lacksSym && canMakeProgress) $> (r, cst)+ where+ (fixed, rest) = rowToList r++ lacksSym =+ sym `notElem` (runLabel . rowListLabel <$> fixed)++ (canMakeProgress, cst) = case rest of+ REmptyKinded _ _ -> (True, Nothing)+ _ -> (not (null fixed), Just [ srcConstraint C.RowLacks kinds [srcTypeLevelString sym, rest] Nothing ])++-- Check if an instance matches our list of types, allowing for types+-- to be solved via functional dependencies. If the types match, we return a+-- substitution which makes them match. If not, we return 'Nothing'.+matches :: [FunctionalDependency] -> TypeClassDict -> [SourceType] -> Matched (Matching [SourceType])+matches deps TypeClassDictionaryInScope{..} tys =+ -- First, find those types which match exactly+ let matched = zipWith typeHeadsAreEqual tys tcdInstanceTypes in+ -- Now, use any functional dependencies to infer any remaining types+ if not (covers matched)+ then if any ((==) Apart . fst) matched then Apart else Unknown+ else -- Verify that any repeated type variables are unifiable+ let determinedSet = foldMap (S.fromList . fdDetermined) deps+ solved = map snd . filter ((`S.notMember` determinedSet) . fst) $ zipWith (\(_, ts) i -> (i, ts)) matched [0..]+ in verifySubstitution (M.unionsWith (++) solved)+ where+ -- Find the closure of a set of functional dependencies.+ covers :: [(Matched (), subst)] -> Bool+ covers ms = finalSet == S.fromList [0..length ms - 1]+ where+ initialSet :: S.Set Int+ initialSet = S.fromList . map snd . filter ((==) (Match ()) . fst . fst) $ zip ms [0..]++ finalSet :: S.Set Int+ finalSet = untilFixedPoint applyAll initialSet++ untilFixedPoint :: Eq a => (a -> a) -> a -> a+ untilFixedPoint f = go+ where+ go a | a' == a = a'+ | otherwise = go a'+ where a' = f a++ applyAll :: S.Set Int -> S.Set Int+ applyAll s = foldr applyDependency s deps++ applyDependency :: FunctionalDependency -> S.Set Int -> S.Set Int+ applyDependency FunctionalDependency{..} xs+ | S.fromList fdDeterminers `S.isSubsetOf` xs = xs <> S.fromList fdDetermined+ | otherwise = xs++ --+ -- Check whether the type heads of two types are equal (for the purposes of type class dictionary lookup),+ -- and return a substitution from type variables to types which makes the type heads unify.+ --+ typeHeadsAreEqual :: Type a -> Type a -> (Matched (), Matching [Type a])+ typeHeadsAreEqual (KindedType _ t1 _) t2 = typeHeadsAreEqual t1 t2+ typeHeadsAreEqual t1 (KindedType _ t2 _) = typeHeadsAreEqual t1 t2+ typeHeadsAreEqual (TUnknown _ u1) (TUnknown _ u2) | u1 == u2 = (Match (), M.empty)+ typeHeadsAreEqual (Skolem _ _ _ s1 _) (Skolem _ _ _ s2 _) | s1 == s2 = (Match (), M.empty)+ typeHeadsAreEqual t (TypeVar _ v) = (Match (), M.singleton v [t])+ typeHeadsAreEqual (TypeConstructor _ c1) (TypeConstructor _ c2) | c1 == c2 = (Match (), M.empty)+ typeHeadsAreEqual (TypeLevelString _ s1) (TypeLevelString _ s2) | s1 == s2 = (Match (), M.empty)+ typeHeadsAreEqual (TypeLevelInt _ n1) (TypeLevelInt _ n2) | n1 == n2 = (Match (), M.empty)+ typeHeadsAreEqual (TypeApp _ h1 t1) (TypeApp _ h2 t2) =+ both (typeHeadsAreEqual h1 h2) (typeHeadsAreEqual t1 t2)+ typeHeadsAreEqual (KindApp _ h1 t1) (KindApp _ h2 t2) =+ both (typeHeadsAreEqual h1 h2) (typeHeadsAreEqual t1 t2)+ typeHeadsAreEqual (REmpty _) (REmpty _) = (Match (), M.empty)+ typeHeadsAreEqual r1@RCons{} r2@RCons{} =+ foldr both (uncurry go rest) common+ where+ (common, rest) = alignRowsWith (const typeHeadsAreEqual) r1 r2++ go :: ([RowListItem a], Type a) -> ([RowListItem a], Type a) -> (Matched (), Matching [Type a])+ go (l, KindedType _ t1 _) (r, t2) = go (l, t1) (r, t2)+ go (l, t1) (r, KindedType _ t2 _) = go (l, t1) (r, t2)+ go (l, KindApp _ t1 k1) (r, KindApp _ t2 k2) | eqType k1 k2 = go (l, t1) (r, t2)+ go ([], REmpty _) ([], REmpty _) = (Match (), M.empty)+ go ([], TUnknown _ u1) ([], TUnknown _ u2) | u1 == u2 = (Match (), M.empty)+ go ([], TypeVar _ v1) ([], TypeVar _ v2) | v1 == v2 = (Match (), M.empty)+ go ([], Skolem _ _ _ sk1 _) ([], Skolem _ _ _ sk2 _) | sk1 == sk2 = (Match (), M.empty)+ go ([], TUnknown _ _) _ = (Unknown, M.empty)+ go (sd, r) ([], TypeVar _ v) = (Match (), M.singleton v [rowFromList (sd, r)])+ go _ _ = (Apart, M.empty)+ typeHeadsAreEqual (TUnknown _ _) _ = (Unknown, M.empty)+ typeHeadsAreEqual Skolem{} _ = (Unknown, M.empty)+ typeHeadsAreEqual _ _ = (Apart, M.empty)++ both :: (Matched (), Matching [Type a]) -> (Matched (), Matching [Type a]) -> (Matched (), Matching [Type a])+ both (b1, m1) (b2, m2) = (b1 <> b2, M.unionWith (++) m1 m2)++ -- Ensure that a substitution is valid+ verifySubstitution :: Matching [Type a] -> Matched (Matching [Type a])+ verifySubstitution mts = foldMap meet mts $> mts where+ meet = pairwiseAll typesAreEqual++ -- Note that unknowns are only allowed to unify if they came from a type+ -- which was _not_ solved, i.e. one which was inferred by a functional+ -- dependency.+ typesAreEqual :: Type a -> Type a -> Matched ()+ typesAreEqual (KindedType _ t1 _) t2 = typesAreEqual t1 t2+ typesAreEqual t1 (KindedType _ t2 _) = typesAreEqual t1 t2+ typesAreEqual (TUnknown _ u1) (TUnknown _ u2) | u1 == u2 = Match ()+ typesAreEqual (TUnknown _ u1) t2 = if t2 `containsUnknown` u1 then Apart else Unknown+ typesAreEqual t1 (TUnknown _ u2) = if t1 `containsUnknown` u2 then Apart else Unknown+ typesAreEqual (Skolem _ _ _ s1 _) (Skolem _ _ _ s2 _) | s1 == s2 = Match ()+ typesAreEqual (Skolem _ _ _ s1 _) t2 = if t2 `containsSkolem` s1 then Apart else Unknown+ typesAreEqual t1 (Skolem _ _ _ s2 _) = if t1 `containsSkolem` s2 then Apart else Unknown+ typesAreEqual (TypeVar _ v1) (TypeVar _ v2) | v1 == v2 = Match ()+ typesAreEqual (TypeLevelString _ s1) (TypeLevelString _ s2) | s1 == s2 = Match ()+ typesAreEqual (TypeLevelInt _ n1) (TypeLevelInt _ n2) | n1 == n2 = Match ()+ typesAreEqual (TypeConstructor _ c1) (TypeConstructor _ c2) | c1 == c2 = Match ()+ typesAreEqual (TypeApp _ h1 t1) (TypeApp _ h2 t2) = typesAreEqual h1 h2 <> typesAreEqual t1 t2+ typesAreEqual (KindApp _ h1 t1) (KindApp _ h2 t2) = typesAreEqual h1 h2 <> typesAreEqual t1 t2+ typesAreEqual (REmpty _) (REmpty _) = Match ()+ typesAreEqual r1 r2 | isRCons r1 || isRCons r2 =+ let (common, rest) = alignRowsWith (const typesAreEqual) r1 r2+ in fold common <> uncurry go rest+ where+ go :: ([RowListItem a], Type a) -> ([RowListItem a], Type a) -> Matched ()+ go (l, KindedType _ t1 _) (r, t2) = go (l, t1) (r, t2)+ go (l, t1) (r, KindedType _ t2 _) = go (l, t1) (r, t2)+ go ([], KindApp _ t1 k1) ([], KindApp _ t2 k2) = typesAreEqual t1 t2 <> typesAreEqual k1 k2+ go ([], TUnknown _ u1) ([], TUnknown _ u2) | u1 == u2 = Match ()+ go ([], TUnknown _ _) ([], _) = Unknown+ go ([], _) ([], TUnknown _ _) = Unknown+ go ([], Skolem _ _ _ s1 _) ([], Skolem _ _ _ s2 _) | s1 == s2 = Match ()+ go ([], Skolem _ _ _ _ _) _ = Unknown+ go _ ([], Skolem _ _ _ _ _) = Unknown+ go ([], REmpty _) ([], REmpty _) = Match ()+ go ([], TypeVar _ v1) ([], TypeVar _ v2) | v1 == v2 = Match ()+ go _ _ = Apart+ typesAreEqual _ _ = Apart++ isRCons :: Type a -> Bool+ isRCons RCons{} = True+ isRCons _ = False++ containsSkolem :: Type a -> Int -> Bool+ containsSkolem t s = everythingOnTypes (||) (\case Skolem _ _ _ s' _ -> s == s'; _ -> False) t++ containsUnknown :: Type a -> Int -> Bool+ containsUnknown t u = everythingOnTypes (||) (\case TUnknown _ u' -> u == u'; _ -> False) t++-- | Add a dictionary for the constraint to the scope, and dictionaries+-- for all implied superclass instances.+newDictionaries+ :: MonadState CheckState m+ => [(Qualified (ProperName 'ClassName), Integer)]+ -> Qualified Ident+ -> SourceConstraint+ -> m [NamedDict]+newDictionaries path name (Constraint _ className instanceKinds instanceTy _) = do+ tcs <- gets (typeClasses . checkEnv)+ let TypeClassData{..} = fromMaybe (internalError "newDictionaries: type class lookup failed") $ M.lookup className tcs+ supDicts <- join <$> zipWithM (\(Constraint ann supName supKinds supArgs _) index ->+ let sub = zip (map fst typeClassArguments) instanceTy in+ newDictionaries ((supName, index) : path)+ name+ (Constraint ann supName+ (replaceAllTypeVars sub <$> supKinds)+ (replaceAllTypeVars sub <$> supArgs)+ Nothing)+ ) typeClassSuperclasses [0..]+ return (TypeClassDictionaryInScope Nothing 0 name path className [] instanceKinds instanceTy Nothing Nothing : supDicts)++mkContext :: [NamedDict] -> InstanceContext+mkContext = foldr combineContexts M.empty . map fromDict where+ fromDict d = M.singleton ByNullSourcePos (M.singleton (tcdClassName d) (M.singleton (tcdValue d) (pure d)))++-- | Check all pairs of values in a list match a predicate+pairwiseAll :: Monoid m => (a -> a -> m) -> [a] -> m+pairwiseAll _ [] = mempty+pairwiseAll _ [_] = mempty+pairwiseAll p (x : xs) = foldMap (p x) xs <> pairwiseAll p xs++-- | Check any pair of values in a list match a predicate+pairwiseAny :: (a -> a -> Bool) -> [a] -> Bool+pairwiseAny _ [] = False+pairwiseAny _ [_] = False+pairwiseAny p (x : xs) = any (p x) xs || pairwiseAny p xs++pairwiseM :: Applicative m => (a -> a -> m ()) -> [a] -> m ()+pairwiseM _ [] = pure ()+pairwiseM _ [_] = pure ()+pairwiseM p (x : xs) = traverse (p x) xs *> pairwiseM p xs++-- | Return all nonempty tails of a nonempty list. For example:+--+-- tails1 (fromList [1]) == fromList [fromList [1]]+-- tails1 (fromList [1,2]) == fromList [fromList [1,2], fromList [2]]+-- tails1 (fromList [1,2,3]) == fromList [fromList [1,2,3], fromList [2,3], fromList [3]]+tails1 :: NonEmpty a -> NonEmpty (NonEmpty a)+tails1 =+ -- NEL.fromList is an unsafe function, but this usage should be safe, since:+ -- - `tails xs = [xs, tail xs, tail (tail xs), ..., []]`+ -- - If `xs` is nonempty, it follows that `tails xs` contains at least one nonempty+ -- list, since `head (tails xs) = xs`.+ -- - The only empty element of `tails xs` is the last one (by the definition of `tails`)+ -- - Therefore, if we take all but the last element of `tails xs` i.e.+ -- `init (tails xs)`, we have a nonempty list of nonempty lists+ NEL.fromList . map NEL.fromList . init . tails . NEL.toList
+ src/Language/PureScript/TypeChecker/Entailment/Coercible.hs view
@@ -0,0 +1,946 @@+{-# LANGUAGE DuplicateRecordFields #-}++-- |+-- Interaction solver for Coercible constraints+--+module Language.PureScript.TypeChecker.Entailment.Coercible+ ( GivenSolverState(..)+ , initialGivenSolverState+ , solveGivens+ , WantedSolverState(..)+ , initialWantedSolverState+ , solveWanteds+ , insoluble+ ) where++import Prelude hiding (interact)++import Control.Applicative ((<|>), empty)+import Control.Arrow ((&&&))+import Control.Monad ((<=<), guard, unless, when)+import Control.Monad.Error.Class (MonadError, catchError, throwError)+import Control.Monad.State (MonadState, StateT, get, gets, modify, put)+import Control.Monad.Trans.Class (lift)+import Control.Monad.Trans.Maybe (MaybeT(..), runMaybeT)+import Control.Monad.Trans.Except (ExceptT(..), runExceptT)+import Control.Monad.Writer.Strict (MonadWriter, Writer, execWriter, runWriter, runWriterT, tell)+import Data.Either (partitionEithers)+import Data.Foldable (fold, foldl', for_, toList)+import Data.Functor (($>))+import Data.List (find)+import Data.Maybe (fromMaybe, isJust)+import Data.Monoid (Any(..))+import Data.Text (Text)++import Data.Map qualified as M+import Data.Set qualified as S++import Language.PureScript.Crash (internalError)+import Language.PureScript.Environment (DataDeclType(..), Environment(..), TypeKind(..), unapplyKinds)+import Language.PureScript.Errors (DeclarationRef(..), ErrorMessageHint(..), ExportSource, ImportDeclarationType(..), MultipleErrors, SimpleErrorMessage(..), SourceAnn, errorMessage, UnknownsHint(..))+import Language.PureScript.Names (ModuleName, ProperName, ProperNameType(..), Qualified(..), byMaybeModuleName, toMaybeModuleName)+import Language.PureScript.TypeChecker.Kinds (elaborateKind, freshKindWithKind, unifyKinds')+import Language.PureScript.TypeChecker.Monad (CheckState(..))+import Language.PureScript.TypeChecker.Roles (lookupRoles)+import Language.PureScript.TypeChecker.Synonyms (replaceAllTypeSynonyms)+import Language.PureScript.TypeChecker.Unify (alignRowsWith, freshTypeWithKind, substituteType)+import Language.PureScript.Roles (Role(..))+import Language.PureScript.Types (Constraint(..), SourceType, Type(..), completeBinderList, containsUnknowns, everythingOnTypes, isMonoType, replaceAllTypeVars, rowFromList, srcConstraint, srcTypeApp, unapplyTypes)+import Language.PureScript.Constants.Prim qualified as Prim++-- | State of the given constraints solver.+data GivenSolverState =+ GivenSolverState+ { inertGivens :: [(SourceType, SourceType, SourceType)]+ -- ^ A set of irreducible given constraints which do not interact together.+ , unsolvedGivens :: [(SourceType, SourceType)]+ -- ^ Given constraints yet to be solved.+ }++-- | Initialize the given constraints solver state with the givens to solve.+initialGivenSolverState :: [(SourceType, SourceType)] -> GivenSolverState+initialGivenSolverState =+ GivenSolverState []++-- | The given constraints solver follows these steps:+--+-- 1. Solving can diverge for recursive newtypes, so we check the solver depth+-- and abort if we crossed an arbitrary limit.+--+-- For instance the declarations:+--+-- @+-- newtype N a = N (a -> N a)+--+-- example :: forall a b. N a -> N b+-- example = coerce+-- @+--+-- yield the wanted @Coercible (N a) (N b)@ which we can unwrap on both sides+-- to yield @Coercible (a -> N a) (b -> N b)@, which we can then decompose back+-- to @Coercible a b@ and @Coercible (N a) (N b)@.+--+-- 2. We pick a constraint from the unsolved queue. If the queue is empty we are+-- done, otherwise we unify the constraint arguments kinds and continue.+--+-- 3. Then we try to canonicalize the constraint.++-- 3a. Canonicalization can fail, in which case we swallow the error and pretend+-- the constraint is irreducible because it is possible to eventually solve it.+--+-- For instance the declarations:+--+-- @+-- data D a = D a+-- type role D nominal+--+-- example :: forall a b. Coercible (D a) (D b) => D a -> D b+-- example = coerce+-- @+--+-- yield an insoluble given @Coercible (D a) (D b)@ which discharges the wanted+-- constraint regardless, because the given can be solved if @a@ and @b@ turn+-- out to be equal: @example (D true) :: D Boolean@ should compile.+--+-- 3b. Canonicalization can succeed with an irreducible constraint which we+-- then interact with the inert set.+--+-- 3bi. These interactions can yield a derived constraint which we add to the+-- unsolved queue and then go back to 1.+--+-- 3bii. These interactions can discharge the constraint, in which case we go+-- back to 1.+--+-- 3biii The constraint may not react to the inert set, in which case we add it+-- to the inert set, kick out any constraint that can be rewritten by the new+-- inert, add them to the unsolved queue and then go back to 1.+--+-- 3c. Otherwise canonicalization can succeed with derived constraints which we+-- add to the unsolved queue and then go back to 1.+solveGivens+ :: MonadError MultipleErrors m+ => MonadState CheckState m+ => Environment+ -> StateT GivenSolverState m ()+solveGivens env = go (0 :: Int) where+ go n = do+ when (n > 1000) . throwError . errorMessage $ PossiblyInfiniteCoercibleInstance+ gets unsolvedGivens >>= \case+ [] -> pure ()+ given : unsolved -> do+ (k, a, b) <- lift $ unify given+ GivenSolverState{..} <- get+ lift (fst <$> runWriterT (canon env Nothing k a b `catchError` recover)) >>= \case+ Irreducible -> case interact env (a, b) inertGivens of+ Just (Simplified (a', b')) ->+ put $ GivenSolverState { unsolvedGivens = (a', b') : unsolved, .. }+ Just Discharged ->+ put $ GivenSolverState { unsolvedGivens = unsolved, .. }+ Nothing -> do+ let (kickedOut, kept) = partitionEithers $ kicksOut env (a, b) <$> inertGivens+ put $ GivenSolverState+ { inertGivens = (k, a, b) : kept+ , unsolvedGivens = kickedOut <> unsolved+ }+ Canonicalized deriveds ->+ put $ GivenSolverState { unsolvedGivens = toList deriveds <> unsolved, .. }+ go (n + 1)+ recover _ = pure Irreducible++-- | State of the wanted constraints solver.+data WantedSolverState =+ WantedSolverState+ { inertGivens :: [(SourceType, SourceType, SourceType)]+ -- ^ A set of irreducible given constraints which do not interact together,+ -- but which could interact with the wanteds.+ , inertWanteds :: [(SourceType, SourceType, SourceType)]+ -- ^ A set of irreducible wanted constraints which do not interact together,+ -- nor with any given.+ , unsolvedWanteds :: [(SourceType, SourceType)]+ -- ^ Wanted constraints yet to be solved.+ }++-- | Initialize the wanted constraints solver state with an inert set of givens+-- and the two parameters of the wanted to solve.+initialWantedSolverState+ :: [(SourceType, SourceType, SourceType)]+ -> SourceType+ -> SourceType+ -> WantedSolverState+initialWantedSolverState givens a b =+ WantedSolverState givens [] [(a, b)]++-- | The wanted constraints solver follows similar steps than the given solver,+-- except for:+--+-- 1. When canonicalization fails we can swallow the error, but only if the+-- wanted interacts with the givens.+--+-- For instance the declarations:+--+-- @+-- data D a = D a+-- type role D nominal+--+-- example :: forall a b. Coercible (D a) (D b) => D a -> D b+-- example = coerce+-- @+--+-- yield an insoluble wanted @Coercible (D a) (D b)@ which is discharged by+-- the given. But we want @example :: forall a b. D a -> D b@ to fail.+--+-- 2. Irreducible wanted constraints don't interact with the inert wanteds set,+-- because doing so would yield confusing error messages.+--+-- For instance the declarations:+--+-- @+-- data D a = D a+--+-- example :: forall a. D a a -> D Boolean Char+-- example = coerce+-- @+--+-- yield the wanted @Coercible (D a a) (D Boolean Char)@, which is decomposed to+-- the irreducibles @Coercible a Boolean@ and @Coercible a Char@. Would we+-- interact the latter with the former, we would report an insoluble+-- @Coercible Boolean Char@.+solveWanteds+ :: MonadError MultipleErrors m+ => MonadWriter [ErrorMessageHint] m+ => MonadState CheckState m+ => Environment+ -> StateT WantedSolverState m ()+solveWanteds env = go (0 :: Int) where+ go n = do+ when (n > 1000) . throwError . errorMessage $ PossiblyInfiniteCoercibleInstance+ gets unsolvedWanteds >>= \case+ [] -> pure ()+ wanted : unsolved -> do+ (k, a, b) <- lift $ unify wanted+ WantedSolverState{..} <- get+ lift (canon env (Just inertGivens) k a b `catchError` recover (a, b) inertGivens) >>= \case+ Irreducible -> case interact env (a, b) inertGivens of+ Just (Simplified (a', b')) ->+ put $ WantedSolverState { unsolvedWanteds = (a', b') : unsolved, .. }+ Just Discharged ->+ put $ WantedSolverState { unsolvedWanteds = unsolved, .. }+ Nothing ->+ put $ WantedSolverState+ { inertWanteds = (k, a, b) : inertWanteds+ , unsolvedWanteds = unsolved+ , ..+ }+ Canonicalized deriveds ->+ put $ WantedSolverState { unsolvedWanteds = toList deriveds <> unsolved, .. }+ go (n + 1)+ recover wanted givens errors =+ case interact env wanted givens of+ Nothing -> throwError errors+ Just (Simplified wanted') -> pure . Canonicalized $ S.singleton wanted'+ Just Discharged -> pure $ Canonicalized mempty++-- | Unifying constraints arguments kinds isn't strictly necessary but yields+-- better error messages. For instance we cannot solve the constraint+-- @Coercible (D :: Type -> Type) (D a :: Type)@ because its arguments kinds+-- don't match and trying to unify them will say so, which is more helpful than+-- simply saying that no type class instance was found.+--+-- A subtle thing to note is that types with polymorphic kinds can be annotated+-- with kind applications mentioning unknowns that we may have solved by+-- unifying the kinds.+--+-- For instance the declarations:+--+-- @+-- data D :: forall k. k -> Type+-- data D a = D+--+-- type role D representational+--+-- example :: D D -> D D+-- example = coerce+-- @+--+-- yield a wanted+-- @Coercible (D \@(k1 -> Type) (D \@k1)) (D \@(k2 -> Type) (D \@k2))@, which we+-- decompose to @Coercible (D \@k1) (D \@k2)@, where @k1@ and @k2@ are unknowns.+-- This constraint is not reflexive because @D \@k1@ and @D \@k2@ are differents+-- but both arguments kinds unify with @k -> Type@, where @k@ is a fresh unknown,+-- so applying the substitution to @D \@k1@ and @D \@k2@ yields a+-- @Coercible (D \@k) (D \@k)@ constraint which could be trivially solved by+-- reflexivity instead of having to saturate the type constructors.+unify+ :: MonadError MultipleErrors m+ => MonadState CheckState m+ => (SourceType, SourceType)+ -> m (SourceType, SourceType, SourceType)+unify (a, b) = do+ let kindOf = sequence . (id &&& elaborateKind) <=< replaceAllTypeSynonyms+ (a', kind) <- kindOf a+ (b', kind') <- kindOf b+ unifyKinds' kind kind'+ subst <- gets checkSubstitution+ pure ( substituteType subst kind+ , substituteType subst a'+ , substituteType subst b'+ )++-- | A successful interaction between an irreducible constraint and an inert+-- given constraint has two possible outcomes:+data Interaction+ = Simplified (SourceType, SourceType)+ -- ^ The interaction can yield a derived constraint,+ | Discharged+ -- ^ or we can learn the irreducible constraint is redundant and discharge it.++-- | Interact an irreducible constraint with an inert set of givens.+interact+ :: Environment+ -> (SourceType, SourceType)+ -> [(SourceType, SourceType, SourceType)]+ -> Maybe Interaction+interact env irred = go where+ go [] = Nothing+ go (inert : _)+ | canDischarge inert irred = Just Discharged+ | Just derived <- interactSameTyVar inert irred = Just $ Simplified derived+ | Just derived <- interactDiffTyVar env inert irred = Just $ Simplified derived+ go (_ : inerts) = go inerts++-- | A given constraint of the form @Coercible a b@ can discharge constraints+-- of the form @Coercible a b@ and @Coercible b a@.+canDischarge+ :: (SourceType, SourceType, SourceType)+ -> (SourceType, SourceType)+ -> Bool+canDischarge (_, a, b) constraint =+ (a, b) == constraint || (b, a) == constraint++-- | Two canonical constraints of the form @Coercible tv ty1@ and+-- @Coercible tv ty2@ can interact together and yield a new constraint+-- @Coercible ty1 ty2@. Canonicality matters to avoid loops.+--+-- For instance the declarations:+--+-- @+-- data D a = D a+-- newtype N a = N (D (N a))+--+-- example :: forall a. Coercible a (D a) => a -> N a+-- example = coerce+-- @+--+-- yield a non canonical wanted @Coercible a (N a)@ that we can unwrap on the+-- right to yield @Coercible a (D (N a))@. Would it interact with the non+-- canonical given @Coercible a (D a)@ it would give @Coercible (D a) (D (N a))@,+-- then decompose back to @Coercible a (N a)@.+interactSameTyVar+ :: (SourceType, SourceType, SourceType)+ -> (SourceType, SourceType)+ -> Maybe (SourceType, SourceType)+interactSameTyVar (_, tv1, ty1) (tv2, ty2)+ | tv1 == tv2 && isCanonicalTyVarEq (tv1, ty1) && isCanonicalTyVarEq (tv2, ty2)+ = Just (ty1, ty2)+ | otherwise = Nothing++-- | Two canonical constraints of the form @Coercible tv1 ty1@ and+-- @Coercible tv2 ty2@ can interact together and yield a new constraint+-- @Coercible tv2 ty2[ty1/tv1]@. Once again, canonicality matters to avoid loops.+--+-- For instance the declarations:+--+-- @+-- data D a = D a+--+-- example :: forall a b. Coercible b (D b) => a -> b+-- example = coerce+-- @+--+-- yield an irreducible canonical wanted @Coercible a b@. Would it interact with+-- the non canonical given @Coercible b (D b)@ it would give @Coercible a (D b)@,+-- which would keep interacting indefinitely with the given.+interactDiffTyVar+ :: Environment+ -> (SourceType, SourceType, SourceType)+ -> (SourceType, SourceType)+ -> Maybe (SourceType, SourceType)+interactDiffTyVar env (_, tv1, ty1) (tv2, ty2)+ | tv1 /= tv2 && isCanonicalTyVarEq (tv2, ty2)+ , (ty2', Any True) <- runWriter $ rewrite env (tv1, ty1) ty2+ = Just (tv2, ty2')+ | otherwise = Nothing++-- | A canonical constraint of the form @Coercible tv1 ty1@ can rewrite the+-- right hand side of an irreducible constraint of the form @Coercible tv2 ty2@+-- by substituting @ty1@ for every occurrence of @tv1@ at representational and+-- phantom role in @ty2@. Nominal occurrences are left untouched.+rewrite :: Environment -> (SourceType, SourceType) -> SourceType -> Writer Any SourceType+rewrite env (Skolem _ _ _ s1 _, ty1) | not $ occurs s1 ty1 = go where+ go (Skolem _ _ _ s2 _) | s1 == s2 = tell (Any True) $> ty1+ go ty2 | (Skolem{}, _, xs) <- unapplyTypes ty2, not $ null xs =+ rewriteTyVarApp go ty2+ | (TypeConstructor _ tyName, _, _) <- unapplyTypes ty2 = do+ rewriteTyConApp go (lookupRoles env tyName) ty2+ go (KindApp sa ty k) = KindApp sa <$> go ty <*> pure k+ go (ForAll sa vis tv k ty scope) = ForAll sa vis tv k <$> go ty <*> pure scope+ go (ConstrainedType sa Constraint{..} ty) | s1 `S.notMember` foldMap skolems constraintArgs =+ ConstrainedType sa Constraint{..} <$> go ty+ go (RCons sa label ty rest) = RCons sa label <$> go ty <*> go rest+ go (KindedType sa ty k) = KindedType sa <$> go ty <*> pure k+ go ty2 = pure ty2+rewrite _ _ = pure++-- | Rewrite the head of a type application of the form @tv a_0 .. a_n@.+rewriteTyVarApp+ :: Applicative m+ => (SourceType -> m SourceType)+ -> SourceType+ -> m SourceType+rewriteTyVarApp f = go where+ go (TypeApp sa lhs rhs) =+ TypeApp sa <$> go lhs <*> pure rhs+ go (KindApp sa ty k) =+ KindApp sa <$> go ty <*> pure k+ go ty = f ty++-- | Rewrite the representational and phantom arguments of a type application+-- of the form @D a_0 .. a_n@.+rewriteTyConApp+ :: Applicative m+ => (SourceType -> m SourceType)+ -> [Role]+ -> SourceType+ -> m SourceType+rewriteTyConApp f = go where+ go (role : roles) (TypeApp sa lhs rhs) =+ TypeApp sa <$> go roles lhs <*> case role of+ Nominal -> pure rhs+ _ -> f rhs+ go roles (KindApp sa ty k) =+ KindApp sa <$> go roles ty <*> pure k+ go _ ty = pure ty++canRewrite :: Environment -> (SourceType, SourceType) -> SourceType -> Bool+canRewrite env irred = getAny . execWriter . rewrite env irred++-- | An irreducible given constraint must kick out of the inert set any+-- constraint it can rewrite when it becomes inert, otherwise solving would be+-- sensitive to the order of constraints. Wanteds cannot rewrite other wanteds+-- so this applies only to givens.+--+-- For instance the declaration:+--+-- @+-- example :: forall f g a b. Coercible a (f b) => Coercible f g => Proxy f -> a -> g b+-- example _ = coerce+-- @+--+-- yields the irreducible givens @Coercible a (f b)@ and @Coercible f g@. Would+-- we not kick out the former when adding the latter to the inert set we would+-- not be able to rewrite it to @Coercible a (g b)@ and discharge the wanted,+-- but inverting the givens would work.+kicksOut+ :: Environment+ -> (SourceType, SourceType)+ -> (SourceType, SourceType, SourceType)+ -> Either (SourceType, SourceType) (SourceType, SourceType, SourceType)+kicksOut env irred (_, tv2, ty2)+ | isCanonicalTyVarEq (tv2, ty2) && canRewrite env irred ty2+ = Left (tv2, ty2)+kicksOut _ _ inert = Right inert++-- | A constraint of the form @Coercible tv ty@ is canonical when @tv@ does not+-- occur in @ty@. Non canonical constraints do not interact to prevent loops.+isCanonicalTyVarEq :: (SourceType, SourceType) -> Bool+isCanonicalTyVarEq (Skolem _ _ _ s _, ty) = not $ occurs s ty+isCanonicalTyVarEq _ = False++occurs :: Int -> SourceType -> Bool+occurs s1 = everythingOnTypes (||) go where+ go (Skolem _ _ _ s2 _) | s1 == s2 = True+ go _ = False++skolems :: SourceType -> S.Set Int+skolems = everythingOnTypes (<>) go where+ go (Skolem _ _ _ s _) = S.singleton s+ go _ = mempty++-- | A successful canonicalization result has two possible outcomes:+data Canonicalized+ = Canonicalized (S.Set (SourceType, SourceType))+ -- ^ Canonicalization can yield a set of derived constraints,+ | Irreducible+ -- ^ or we can learn the constraint is irreducible. Irreducibility is not+ -- necessarily an error, we may make further progress by interacting with+ -- inerts.++-- | Canonicalization takes a wanted constraint and try to reduce it to a set of+-- simpler constraints whose satisfaction will imply the goal.+canon+ :: MonadError MultipleErrors m+ => MonadWriter [ErrorMessageHint] m+ => MonadState CheckState m+ => Environment+ -> Maybe [(SourceType, SourceType, SourceType)]+ -> SourceType+ -> SourceType+ -> SourceType+ -> m Canonicalized+canon env givens k a b =+ maybe (throwError $ insoluble k a b) pure <=< runMaybeT $+ canonRefl a b+ <|> canonUnsaturatedHigherKindedType env a b+ <|> canonRow a b+ -- We unwrap newtypes before trying the decomposition rules because it let+ -- us solve more constraints.+ --+ -- For instance the declarations:+ --+ -- @+ -- newtype N f a = N (f a)+ --+ -- example :: forall a b. Coercible a b => N Maybe a -> N Maybe b+ -- example = coerce+ -- @+ --+ -- yield the wanted @Coercible (N Maybe a) (N Maybe b)@ which we cannot+ -- decompose because the second parameter of @N@ is nominal. On the other+ -- hand, unwrapping on both sides yields @Coercible (Maybe a) (Maybe b)@+ -- which we can then decompose to @Coercible a b@ and discharge with the+ -- given.+ <|> canonNewtypeLeft env a b+ <|> canonNewtypeRight env a b+ <|> canonDecomposition env a b+ <|> canonDecompositionFailure env k a b+ <|> canonNewtypeDecomposition env givens a b+ <|> canonNewtypeDecompositionFailure a b+ <|> canonTypeVars a b+ <|> canonTypeVarLeft a b+ <|> canonTypeVarRight a b+ <|> canonApplicationLeft a b+ <|> canonApplicationRight a b++insoluble+ :: SourceType+ -> SourceType+ -> SourceType+ -> MultipleErrors+insoluble k a b =+ -- We can erase kind applications when determining whether to show the+ -- "Consider adding a type annotation" hint, because annotating kinds to+ -- instantiate unknowns in Coercible constraints should never resolve+ -- NoInstanceFound errors.+ errorMessage $ NoInstanceFound (srcConstraint Prim.Coercible [k] [a, b] Nothing) [] + $ if any containsUnknowns [a, b] then Unknowns else NoUnknowns++-- | Constraints of the form @Coercible a b@ can be solved if the two arguments+-- are the same. Since we currently don't support higher-rank arguments in+-- instance heads, term equality is a sufficient notion of "the same".+canonRefl+ :: Monad m+ => SourceType+ -> SourceType+ -> MaybeT m Canonicalized+canonRefl a b =+ guard (a == b) $> Canonicalized mempty++-- | Constraints of the form @Coercible (T1 a_0 .. a_n) (T2 b_0 .. b_n)@, where+-- both arguments have kind @k1 -> k2@, yield a constraint+-- @Coercible (T1 a_0 .. a_n c_0 .. c_m) (T2 b_0 .. b_n c_0 .. c_m)@, where both+-- arguments are fully saturated with the same unknowns and have kind @Type@.+canonUnsaturatedHigherKindedType+ :: MonadError MultipleErrors m+ => MonadState CheckState m+ => Environment+ -> SourceType+ -> SourceType+ -> MaybeT m Canonicalized+canonUnsaturatedHigherKindedType env a b+ | (TypeConstructor _ aTyName, akapps, axs) <- unapplyTypes a+ , (ak, _) <- fromMaybe (internalError "canonUnsaturatedHigherKindedType: type lookup failed") $ M.lookup aTyName (types env)+ , (aks, _) <- unapplyKinds ak+ , length axs < length aks = do+ ak' <- lift $ do+ let (kvs, ak') = fromMaybe (internalError "canonUnsaturatedHigherKindedType: unkinded forall binder") $ completeBinderList ak+ instantiatedKinds = zipWith (\(_, (kv, _)) k -> (kv, k)) kvs akapps+ unknownKinds <- traverse (\((ss, _), (kv, k)) -> (kv,) <$> freshKindWithKind ss k) $ drop (length akapps) kvs+ pure $ replaceAllTypeVars (instantiatedKinds <> unknownKinds) ak'+ let (aks', _) = unapplyKinds ak'+ tys <- traverse freshTypeWithKind $ drop (length axs) aks'+ let a' = foldl' srcTypeApp a tys+ b' = foldl' srcTypeApp b tys+ pure . Canonicalized $ S.singleton (a', b')+ | otherwise = empty++-- | Constraints of the form+-- @Coercible ( label_0 :: a_0, .. label_n :: a_n | r ) ( label_0 :: b_0, .. label_n :: b_n | s )@+-- yield a constraint @Coercible r s@ and constraints on the types for each+-- label in both rows. Labels exclusive to one row yield a failure.+canonRow+ :: MonadError MultipleErrors m+ => MonadState CheckState m+ => SourceType+ -> SourceType+ -> MaybeT m Canonicalized+canonRow a b+ | RCons{} <- a =+ case alignRowsWith (const (,)) a b of+ -- We throw early when a bare unknown remains on either side after+ -- aligning the rows because we don't know how to canonicalize them yet+ -- and the unification error thrown when the rows are misaligned should+ -- not mention unknowns.+ (_, (([], u@TUnknown{}), rl2)) -> do+ k <- elaborateKind u+ throwError $ insoluble k u (rowFromList rl2)+ (_, (rl1, ([], u@TUnknown{}))) -> do+ k <- elaborateKind u+ throwError $ insoluble k (rowFromList rl1) u+ (deriveds, (([], tail1), ([], tail2))) -> do+ pure . Canonicalized . S.fromList $ (tail1, tail2) : deriveds+ (_, (rl1, rl2)) ->+ throwError . errorMessage $ TypesDoNotUnify (rowFromList rl1) (rowFromList rl2)+ | otherwise = empty++-- | Unwrapping a newtype can fails in two ways:+data UnwrapNewtypeError+ = CannotUnwrapInfiniteNewtypeChain+ -- ^ The newtype might wrap an infinite newtype chain. We may think that this+ -- is already handled by the solver depth check, but failing to unwrap+ -- infinite chains of newtypes let us try other rules.+ --+ -- For instance the declarations:+ --+ -- @+ -- newtype N a = N (N a)+ -- type role N representational+ --+ -- example :: forall a b. Coercible a b => N a -> N b+ -- example = coerce+ -- @+ --+ -- yield a wanted @Coercible (N a) (N b)@ that we can decompose to+ -- @Coercible a b@ then discharge with the given if the newtype+ -- unwrapping rules do not apply.+ | CannotUnwrapConstructor+ -- ^ The constructor may not be in scope or may not belong to a newtype.++-- | Unwraps a newtype and yields its underlying type with the newtype arguments+-- substituted in (e.g. @N[D/a] = D@ given @newtype N a = N a@ and @data D = D@).+unwrapNewtype+ :: MonadState CheckState m+ => MonadWriter [ErrorMessageHint] m+ => Environment+ -> SourceType+ -> m (Either UnwrapNewtypeError SourceType)+unwrapNewtype env = go (0 :: Int) where+ go n ty = runExceptT $ do+ when (n > 1000) $ throwError CannotUnwrapInfiniteNewtypeChain+ (currentModuleName, currentModuleImports) <- gets $ checkCurrentModule &&& checkCurrentModuleImports+ case unapplyTypes ty of+ (TypeConstructor _ newtypeName, ks, xs)+ | Just (inScope, fromModuleName, tvs, newtypeCtorName, wrappedTy) <-+ lookupNewtypeConstructorInScope env currentModuleName currentModuleImports newtypeName ks+ -- We refuse to unwrap newtypes over polytypes because we don't know how+ -- to canonicalize them yet and we'd rather try to make progress with+ -- another rule.+ , isMonoType wrappedTy -> do+ unless inScope $ do+ tell [MissingConstructorImportForCoercible newtypeCtorName]+ throwError CannotUnwrapConstructor+ for_ fromModuleName $ flip addConstructorImportForCoercible newtypeCtorName+ let wrappedTySub = replaceAllTypeVars (zip tvs xs) wrappedTy+ ExceptT (go (n + 1) wrappedTySub) `catchError` \case+ CannotUnwrapInfiniteNewtypeChain -> throwError CannotUnwrapInfiniteNewtypeChain+ CannotUnwrapConstructor -> pure wrappedTySub+ _ -> throwError CannotUnwrapConstructor+ addConstructorImportForCoercible fromModuleName newtypeCtorName = modify $ \st ->+ st { checkConstructorImportsForCoercible = S.insert (fromModuleName, newtypeCtorName) $ checkConstructorImportsForCoercible st }++-- | Looks up a given name and, if it names a newtype, returns the names of the+-- type's parameters, the type the newtype wraps and the names of the type's+-- fields.+lookupNewtypeConstructor+ :: Environment+ -> Qualified (ProperName 'TypeName)+ -> [SourceType]+ -> Maybe ([Text], ProperName 'ConstructorName, SourceType)+lookupNewtypeConstructor env qualifiedNewtypeName ks = do+ (newtyk, DataType Newtype tvs [(ctorName, [wrappedTy])]) <- M.lookup qualifiedNewtypeName (types env)+ let (kvs, _) = fromMaybe (internalError "lookupNewtypeConstructor: unkinded forall binder") $ completeBinderList newtyk+ instantiatedKinds = zipWith (\(_, (kv, _)) k -> (kv, k)) kvs ks+ pure (map (\(name, _, _) -> name) tvs, ctorName, replaceAllTypeVars instantiatedKinds wrappedTy)++-- | Behaves like 'lookupNewtypeConstructor' but also returns whether the+-- newtype constructor is in scope and the module from which it is imported, or+-- 'Nothing' if it is defined in the current module.+lookupNewtypeConstructorInScope+ :: Environment+ -> Maybe ModuleName+ -> [ ( SourceAnn+ , ModuleName+ , ImportDeclarationType+ , Maybe ModuleName+ , M.Map (ProperName 'TypeName) ([ProperName 'ConstructorName], ExportSource)+ )+ ]+ -> Qualified (ProperName 'TypeName)+ -> [SourceType]+ -> Maybe (Bool, Maybe ModuleName, [Text], Qualified (ProperName 'ConstructorName), SourceType)+lookupNewtypeConstructorInScope env currentModuleName currentModuleImports qualifiedNewtypeName@(Qualified newtypeModuleName newtypeName) ks = do+ let fromModule = find isNewtypeCtorImported currentModuleImports+ fromModuleName = (\(_, n, _, _, _) -> n) <$> fromModule+ asModuleName = (\(_, _, _, n, _) -> n) =<< fromModule+ isDefinedInCurrentModule = toMaybeModuleName newtypeModuleName == currentModuleName+ isImported = isJust fromModule+ inScope = isDefinedInCurrentModule || isImported+ (tvs, ctorName, wrappedTy) <- lookupNewtypeConstructor env qualifiedNewtypeName ks+ pure (inScope, fromModuleName, tvs, Qualified (byMaybeModuleName asModuleName) ctorName, wrappedTy)+ where+ isNewtypeCtorImported (_, _, importDeclType, _, exportedTypes) =+ case M.lookup newtypeName exportedTypes of+ Just ([_], _) -> case importDeclType of+ Implicit -> True+ Explicit refs -> any isNewtypeCtorRef refs+ Hiding refs -> not $ any isNewtypeCtorRef refs+ _ -> False+ isNewtypeCtorRef = \case+ TypeRef _ importedTyName Nothing -> importedTyName == newtypeName+ TypeRef _ importedTyName (Just [_]) -> importedTyName == newtypeName+ _ -> False++-- | Constraints of the form @Coercible (N a_0 .. a_n) b@ yield a constraint+-- @Coercible a b@ if unwrapping the newtype yields @a@.+canonNewtypeLeft+ :: MonadState CheckState m+ => MonadWriter [ErrorMessageHint] m+ => Environment+ -> SourceType+ -> SourceType+ -> MaybeT m Canonicalized+canonNewtypeLeft env a b =+ unwrapNewtype env a >>= \case+ Left CannotUnwrapInfiniteNewtypeChain -> empty+ Left CannotUnwrapConstructor -> empty+ Right a' -> pure . Canonicalized $ S.singleton (a', b)++-- | Constraints of the form @Coercible a (N b_0 .. b_n)@ yield a constraint+-- @Coercible a b@ if unwrapping the newtype yields @b@.+canonNewtypeRight+ :: MonadState CheckState m+ => MonadWriter [ErrorMessageHint] m+ => Environment+ -> SourceType+ -> SourceType+ -> MaybeT m Canonicalized+canonNewtypeRight env =+ flip $ canonNewtypeLeft env++-- | Decomposes constraints of the form @Coercible (D a_0 .. a_n) (D b_0 .. b_n)@+-- into constraints on their representational arguments, ignoring phantom+-- arguments and failing on unequal nominal arguments.+--+-- For instance given the declarations:+--+-- @+-- data D a b c = D a b+-- type role D nominal representational phantom+-- @+--+-- We can decompose @Coercible (D a b d) (D a c e)@ into @Coercible b c@, but+-- decomposing @Coercible (D a c d) (D b c d)@ would fail.+decompose+ :: MonadError MultipleErrors m+ => Environment+ -> Qualified (ProperName 'TypeName)+ -> [SourceType]+ -> [SourceType]+ -> m Canonicalized+decompose env tyName axs bxs = do+ let roles = lookupRoles env tyName+ f role ax bx = case role of+ Nominal+ -- If we had first-class equality constraints, we'd just+ -- emit one of the form @(a ~ b)@ here and let the solver+ -- recurse. Since we don't we must compare the types at+ -- this point and fail if they don't match. This likely+ -- means there are cases we should be able to handle that+ -- we currently can't, but is at least sound.+ | ax == bx ->+ pure mempty+ | otherwise ->+ throwError . errorMessage $ TypesDoNotUnify ax bx+ Representational ->+ pure $ S.singleton (ax, bx)+ Phantom ->+ pure mempty+ fmap (Canonicalized . fold) $ sequence $ zipWith3 f roles axs bxs++-- | Constraints of the form @Coercible (D a_0 .. a_n) (D b_0 .. b_n)@, where+-- @D@ is not a newtype, yield constraints on their arguments.+canonDecomposition+ :: MonadError MultipleErrors m+ => Environment+ -> SourceType+ -> SourceType+ -> MaybeT m Canonicalized+canonDecomposition env a b+ | (TypeConstructor _ aTyName, _, axs) <- unapplyTypes a+ , (TypeConstructor _ bTyName, _, bxs) <- unapplyTypes b+ , aTyName == bTyName+ , Nothing <- lookupNewtypeConstructor env aTyName [] =+ decompose env aTyName axs bxs+ | otherwise = empty++-- | Constraints of the form @Coercible (D1 a_0 .. a_n) (D2 b_0 .. b_n)@, where+-- @D1@ and @D2@ are different type constructors and neither of them are+-- newtypes, are insoluble.+canonDecompositionFailure+ :: MonadError MultipleErrors m+ => Environment+ -> SourceType+ -> SourceType+ -> SourceType+ -> MaybeT m Canonicalized+canonDecompositionFailure env k a b+ | (TypeConstructor _ aTyName, _, _) <- unapplyTypes a+ , (TypeConstructor _ bTyName, _, _) <- unapplyTypes b+ , aTyName /= bTyName+ , Nothing <- lookupNewtypeConstructor env aTyName []+ , Nothing <- lookupNewtypeConstructor env bTyName [] =+ throwError $ insoluble k a b+ | otherwise = empty++-- | Wanted constraints of the form @Coercible (N a_0 .. a_n) (N b_0 .. b_n)@,+-- where @N@ is a newtype whose constructor is out of scope, yield constraints+-- on their arguments only when no given constraint can discharge them.+--+-- We cannot decompose given constraints because newtypes are not necessarily+-- injective with respect to representational equality.+--+-- For instance given the declaration:+--+-- @+-- newtype Const a b = MkConst a+-- type role Const representational representational+-- @+--+-- Decomposing a given @Coercible (Const a a) (Const a b)@ constraint to+-- @Coercible a b@ when @MkConst@ is out of scope would let us coerce arbitrary+-- types in modules where @MkConst@ is imported, because the given is easily+-- satisfied with the newtype unwrapping rules.+--+-- Moreover we do not decompose wanted constraints if they could be discharged+-- by a given constraint.+--+-- For instance the declaration:+--+-- @+-- example :: forall a b. Coercible (Const a a) (Const a b) => Const a a -> Const a b+-- example = coerce+-- @+--+-- yield an irreducible given @Coercible (Const a a) (Const a b)@ when @MkConst@+-- is out of scope. Would we decompose the wanted+-- @Coercible (Const a a) (Const a b)@ to @Coercible a b@ we would not be able+-- to discharge it with the given.+canonNewtypeDecomposition+ :: MonadError MultipleErrors m+ => Environment+ -> Maybe [(SourceType, SourceType, SourceType)]+ -> SourceType+ -> SourceType+ -> MaybeT m Canonicalized+canonNewtypeDecomposition env (Just givens) a b+ | (TypeConstructor _ aTyName, _, axs) <- unapplyTypes a+ , (TypeConstructor _ bTyName, _, bxs) <- unapplyTypes b+ , aTyName == bTyName+ , Just _ <- lookupNewtypeConstructor env aTyName [] = do+ let givensCanDischarge = any (\given -> canDischarge given (a, b)) givens+ guard $ not givensCanDischarge+ decompose env aTyName axs bxs+canonNewtypeDecomposition _ _ _ _ = empty++-- | Constraints of the form @Coercible (N1 a_0 .. a_n) (N2 b_0 .. b_n)@, where+-- @N1@ and @N2@ are different type constructors and either of them is a+-- newtype whose constructor is out of scope, are irreducible.+canonNewtypeDecompositionFailure+ :: Monad m+ => SourceType+ -> SourceType+ -> MaybeT m Canonicalized+canonNewtypeDecompositionFailure a b+ | (TypeConstructor{}, _, _) <- unapplyTypes a+ , (TypeConstructor{}, _, _) <- unapplyTypes b+ = pure Irreducible+ | otherwise = empty++-- | Constraints of the form @Coercible tv1 tv2@ may be irreducibles, but only+-- when the variables are lexicographically ordered. Reordering variables is+-- necessary to prevent loops.+--+-- For instance the declaration:+--+-- @+-- example :: forall a b. Coercible a b => Coercible b a => a -> b+-- example = coerce+-- @+--+-- yields the irreducible givens @Coercible a b@ and @Coercible b a@ which would+-- repeatedly kick each other out the inert set whereas reordering the latter to+-- @Coercible a b@ makes it redundant and let us discharge it.+canonTypeVars+ :: Monad m+ => SourceType+ -> SourceType+ -> MaybeT m Canonicalized+canonTypeVars a b+ | Skolem _ tv1 _ _ _ <- a+ , Skolem _ tv2 _ _ _ <- b+ , tv2 < tv1+ = pure . Canonicalized $ S.singleton (b, a)+ | Skolem{} <- a, Skolem{} <- b+ = pure Irreducible+ | otherwise = empty++-- | Constraints of the form @Coercible tv ty@ are irreducibles.+canonTypeVarLeft+ :: Monad m+ => SourceType+ -> SourceType+ -> MaybeT m Canonicalized+canonTypeVarLeft a _+ | Skolem{} <- a = pure Irreducible+ | otherwise = empty++-- | Constraints of the form @Coercible ty tv@ are reordered to+-- @Coercible tv ty@ to satisfy the canonicality requirement of having the type+-- variable on the left.+canonTypeVarRight+ :: Monad m+ => SourceType+ -> SourceType+ -> MaybeT m Canonicalized+canonTypeVarRight a b+ | Skolem{} <- b = pure . Canonicalized $ S.singleton (b, a)+ | otherwise = empty++-- | Constraints of the form @Coercible (f a_0 .. a_n) b@ are irreducibles.+canonApplicationLeft+ :: Monad m+ => SourceType+ -> SourceType+ -> MaybeT m Canonicalized+canonApplicationLeft a _+ | TypeApp{} <- a = pure Irreducible+ | otherwise = empty++-- | Constraints of the form @Coercible a (f b_0 .. b_n) b@ are irreducibles.+canonApplicationRight+ :: Monad m+ => SourceType+ -> SourceType+ -> MaybeT m Canonicalized+canonApplicationRight _ b+ | TypeApp{} <- b = pure Irreducible+ | otherwise = empty
+ src/Language/PureScript/TypeChecker/Entailment/IntCompare.hs view
@@ -0,0 +1,102 @@+-- |+-- Graph-based solver for comparing type-level numbers with respect to+-- reflexivity, symmetry, and transitivity properties.+--+module Language.PureScript.TypeChecker.Entailment.IntCompare where++import Protolude++import Data.Graph qualified as G+import Data.Map qualified as M++import Language.PureScript.Names qualified as P+import Language.PureScript.Types qualified as P+import Language.PureScript.Constants.Prim qualified as P++data Relation a+ = Equal a a+ | LessThan a a+ deriving (Functor, Show, Eq, Ord)++type Context a = [Relation a]++type PSOrdering = P.Qualified (P.ProperName 'P.TypeName)++-- Commentary:+--+-- In essence, this solver builds a directed graph using the provided+-- context, which is then used to determine the relationship between+-- the two elements being compared.+--+-- Given the context [a < b, b < c], we can infer that a < c as a+-- path exists from a to c. Likewise, we can also infer that c > a+-- as a path exists from c to a.+--+-- ╔═══╗ ╔═══╗ ╔═══╗+-- ║ a ║ -> ║ b ║ -> ║ c ║+-- ╚═══╝ ╚═══╝ ╚═══╝+--+-- Introducing equality to the context augments the graph further,+-- and it is represented by creating cycles between equal nodes.+-- For example, [a < b, b < c, c = d] yields the following graph:+--+-- ╔═══╗ ╔═══╗ ╔═══╗ ╔═══╗+-- ║ a ║ -> ║ b ║ -> ║ c ║ <-> ║ d ║+-- ╚═══╝ ╚═══╝ ╚═══╝ ╚═══╝+solveRelation :: forall a. Ord a => Context a -> a -> a -> Maybe PSOrdering+solveRelation context lhs rhs =+ if lhs == rhs then+ pure P.EQ+ else do+ let (graph, search) = inequalities+ lhs' <- search lhs+ rhs' <- search rhs+ case (G.path graph lhs' rhs', G.path graph rhs' lhs') of+ (True, True) ->+ pure P.EQ+ (True, False) ->+ pure P.LT+ (False, True) ->+ pure P.GT+ _ ->+ Nothing+ where+ inequalities :: (G.Graph, a -> Maybe G.Vertex)+ inequalities = makeGraph $ clean $ foldMap convert context+ where+ convert :: Relation a -> [(a, [a])]+ convert (Equal a b) = [(a, [b]), (b, [a])]+ convert (LessThan a b) = [(a, [b]), (b, [])]++ makeGraph :: [(a, [a])] -> (G.Graph, a -> Maybe G.Vertex)+ makeGraph m =+ case G.graphFromEdges $ (\(a, b) -> (a, a, b)) <$> m of+ (g, _, f) -> (g, f)++ clean :: forall k. Ord k => [(k, [k])] -> [(k, [k])]+ clean = M.toList . M.fromListWith (<>)++mkRelation :: P.Type a -> P.Type a -> P.Type a -> Maybe (Relation (P.Type a))+mkRelation lhs rhs rel = case rel of+ P.TypeConstructor _ ordering+ | ordering == P.EQ -> pure $ Equal lhs rhs+ | ordering == P.LT -> pure $ LessThan lhs rhs+ | ordering == P.GT -> pure $ LessThan rhs lhs+ _ ->+ Nothing++mkFacts :: [[P.Type a]] -> [Relation (P.Type a)]+mkFacts = mkRels [] . sort . findFacts+ where+ mkRels a [] = concat a+ mkRels a (x : xs) = mkRels (map (LessThan x) xs : a) xs++ findFacts = mapMaybe $ \case+ [P.TypeLevelInt _ _, P.TypeLevelInt _ _, _] ->+ Nothing+ [i@(P.TypeLevelInt _ _), _, _] ->+ Just i+ [_, i@(P.TypeLevelInt _ _), _] ->+ Just i+ _ ->+ Nothing
src/Language/PureScript/TypeChecker/Kinds.hs view
@@ -1,217 +1,1020 @@------------------------------------------------------------------------------------ Module : Language.PureScript.TypeChecker.Kinds--- Copyright : (c) Phil Freeman 2013--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ |--- This module implements the kind checker-----------------------------------------------------------------------------------{-# OPTIONS_GHC -fno-warn-orphans #-}-{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances, TupleSections #-}--module Language.PureScript.TypeChecker.Kinds (- kindOf,- kindOfWithScopedVars,- kindsOf,- kindsOfAll-) where--import Data.Maybe (fromMaybe)--import qualified Data.HashMap.Strict as H-import qualified Data.Map as M--import Control.Arrow (second)-import Control.Applicative-import Control.Monad.Except-import Control.Monad.State-import Control.Monad.Unify--import Language.PureScript.Environment-import Language.PureScript.Errors-import Language.PureScript.Kinds-import Language.PureScript.Names-import Language.PureScript.TypeChecker.Monad-import Language.PureScript.Types--instance Partial Kind where- unknown = KUnknown- isUnknown (KUnknown u) = Just u- isUnknown _ = Nothing- unknowns = everythingOnKinds (++) go- where- go (KUnknown u) = [u]- go _ = []- ($?) sub = everywhereOnKinds go- where- go t@(KUnknown u) = fromMaybe t $ H.lookup u (runSubstitution sub)- go other = other--instance Unifiable Check Kind where- KUnknown u1 =?= KUnknown u2 | u1 == u2 = return ()- KUnknown u =?= k = u =:= k- k =?= KUnknown u = u =:= k- Star =?= Star = return ()- Bang =?= Bang = return ()- Row k1 =?= Row k2 = k1 =?= k2- FunKind k1 k2 =?= FunKind k3 k4 = do- k1 =?= k3- k2 =?= k4- k1 =?= k2 = UnifyT . lift . throwError . errorMessage $ KindsDoNotUnify k1 k2---- |--- Infer the kind of a single type----kindOf :: ModuleName -> Type -> Check Kind-kindOf _ ty = fst <$> kindOfWithScopedVars ty- --- |--- Infer the kind of a single type, returning the kinds of any scoped type variables----kindOfWithScopedVars :: Type -> Check (Kind, [(String, Kind)]) -kindOfWithScopedVars ty = - rethrow (onErrorMessages (ErrorCheckingKind ty)) $- fmap tidyUp . liftUnify $ infer ty- where- tidyUp ((k, args), sub) = ( starIfUnknown (sub $? k)- , map (second (starIfUnknown . (sub $?))) args- )---- |--- Infer the kind of a type constructor with a collection of arguments and a collection of associated data constructors----kindsOf :: Bool -> ModuleName -> ProperName -> [(String, Maybe Kind)] -> [Type] -> Check Kind-kindsOf isData moduleName name args ts = fmap tidyUp . liftUnify $ do- tyCon <- fresh- kargs <- replicateM (length args) fresh- rest <- zipWithM freshKindVar args kargs- let dict = (name, tyCon) : rest- bindLocalTypeVariables moduleName dict $- solveTypes isData ts kargs tyCon- where- tidyUp (k, sub) = starIfUnknown $ sub $? k--freshKindVar :: (String, Maybe Kind) -> Kind -> UnifyT Kind Check (ProperName, Kind)-freshKindVar (arg, Nothing) kind = return (ProperName arg, kind)-freshKindVar (arg, Just kind') kind = do- kind =?= kind'- return (ProperName arg, kind')---- |--- Simultaneously infer the kinds of several mutually recursive type constructors----kindsOfAll :: ModuleName -> [(ProperName, [(String, Maybe Kind)], Type)] -> [(ProperName, [(String, Maybe Kind)], [Type])] -> Check ([Kind], [Kind])-kindsOfAll moduleName syns tys = fmap tidyUp . liftUnify $ do- synVars <- replicateM (length syns) fresh- let dict = zipWith (\(name, _, _) var -> (name, var)) syns synVars- bindLocalTypeVariables moduleName dict $ do- tyCons <- replicateM (length tys) fresh- let dict' = zipWith (\(name, _, _) tyCon -> (name, tyCon)) tys tyCons- bindLocalTypeVariables moduleName dict' $ do- data_ks <- zipWithM (\tyCon (_, args, ts) -> do- kargs <- replicateM (length args) fresh- argDict <- zipWithM freshKindVar args kargs- bindLocalTypeVariables moduleName argDict $- solveTypes True ts kargs tyCon) tyCons tys- syn_ks <- zipWithM (\synVar (_, args, ty) -> do- kargs <- replicateM (length args) fresh- argDict <- zipWithM freshKindVar args kargs- bindLocalTypeVariables moduleName argDict $- solveTypes False [ty] kargs synVar) synVars syns- return (syn_ks, data_ks)- where- tidyUp ((ks1, ks2), sub) = (map (starIfUnknown . (sub $?)) ks1, map (starIfUnknown . (sub $?)) ks2)---- |--- Solve the set of kind constraints associated with the data constructors for a type constructor----solveTypes :: Bool -> [Type] -> [Kind] -> Kind -> UnifyT Kind Check Kind-solveTypes isData ts kargs tyCon = do- ks <- mapM (fmap fst . infer) ts- when isData $ do- tyCon =?= foldr FunKind Star kargs- forM_ ks $ \k -> k =?= Star- unless isData $- tyCon =?= foldr FunKind (head ks) kargs- return tyCon---- |--- Default all unknown kinds to the Star kind of types----starIfUnknown :: Kind -> Kind-starIfUnknown (KUnknown _) = Star-starIfUnknown (Row k) = Row (starIfUnknown k)-starIfUnknown (FunKind k1 k2) = FunKind (starIfUnknown k1) (starIfUnknown k2)-starIfUnknown k = k---- |--- Infer a kind for a type----infer :: Type -> UnifyT Kind Check (Kind, [(String, Kind)])-infer ty = rethrow (onErrorMessages (ErrorCheckingKind ty)) $ infer' ty--infer' :: Type -> UnifyT Kind Check (Kind, [(String, Kind)])-infer' (ForAll ident ty _) = do- k1 <- fresh- Just moduleName <- checkCurrentModule <$> get- (k2, args) <- bindLocalTypeVariables moduleName [(ProperName ident, k1)] $ infer ty- k2 =?= Star- return (Star, (ident, k1) : args)-infer' (KindedType ty k) = do- (k', args) <- infer ty- k =?= k'- return (k', args)-infer' other = (, []) <$> go other- where- go :: Type -> UnifyT Kind Check Kind- go (ForAll ident ty _) = do- k1 <- fresh- Just moduleName <- checkCurrentModule <$> get- k2 <- bindLocalTypeVariables moduleName [(ProperName ident, k1)] $ go ty- k2 =?= Star- return Star- go (KindedType ty k) = do- k' <- go ty- k =?= k'- return k'- go TypeWildcard = fresh- go (TypeVar v) = do- Just moduleName <- checkCurrentModule <$> get- UnifyT . lift $ lookupTypeVariable moduleName (Qualified Nothing (ProperName v))- go (Skolem v _ _) = do- Just moduleName <- checkCurrentModule <$> get- UnifyT . lift $ lookupTypeVariable moduleName (Qualified Nothing (ProperName v))- go (TypeConstructor v) = do- env <- liftCheck getEnv- case M.lookup v (types env) of- Nothing -> UnifyT . lift . throwError . errorMessage $ UnknownTypeConstructor v- Just (kind, _) -> return kind- go (TypeApp t1 t2) = do- k0 <- fresh- k1 <- go t1- k2 <- go t2- k1 =?= FunKind k2 k0- return k0- go REmpty = do- k <- fresh- return $ Row k- go (RCons _ ty row) = do- k1 <- go ty- k2 <- go row- k2 =?= Row k1- return $ Row k1- go (ConstrainedType deps ty) = do- forM_ deps $ \(className, tys) -> do- _ <- go $ foldl TypeApp (TypeConstructor className) tys- return ()- k <- go ty- k =?= Star- return Star- go _ = error "Invalid argument to infer"+-- |+-- This module implements the kind checker+--+module Language.PureScript.TypeChecker.Kinds+ ( kindOf+ , kindOfWithUnknowns+ , kindOfWithScopedVars+ , kindOfData+ , kindOfTypeSynonym+ , kindOfClass+ , kindsOfAll+ , unifyKinds+ , unifyKinds'+ , subsumesKind+ , instantiateKind+ , checkKind+ , inferKind+ , elaborateKind+ , checkConstraint+ , checkInstanceDeclaration+ , checkKindDeclaration+ , checkTypeKind+ , unknownsWithKinds+ , freshKind+ , freshKindWithKind+ ) where++import Prelude++import Control.Arrow ((***))+import Control.Lens ((^.), _1, _2, _3)+import Control.Monad (join, unless, void, when, (<=<))+import Control.Monad.Error.Class (MonadError(..))+import Control.Monad.State (MonadState, gets, modify)+import Control.Monad.Supply.Class (MonadSupply(..))++import Data.Bifunctor (first, second)+import Data.Bitraversable (bitraverse)+import Data.Foldable (for_, traverse_)+import Data.Function (on)+import Data.Functor (($>))+import Data.IntSet qualified as IS+import Data.List (nubBy, sortOn, (\\))+import Data.Map qualified as M+import Data.Maybe (fromJust, fromMaybe)+import Data.Text (Text)+import Data.Text qualified as T+import Data.Traversable (for)++import Language.PureScript.Crash (HasCallStack, internalError)+import Language.PureScript.Environment qualified as E+import Language.PureScript.Errors+import Language.PureScript.Names (pattern ByNullSourcePos, ModuleName, Name(..), ProperName(..), ProperNameType(..), Qualified(..), QualifiedBy(..), coerceProperName, mkQualified)+import Language.PureScript.TypeChecker.Monad (CheckState(..), Substitution(..), UnkLevel(..), Unknown, bindLocalTypeVariables, debugType, getEnv, lookupTypeVariable, unsafeCheckCurrentModule, withErrorMessageHint, withFreshSubstitution)+import Language.PureScript.TypeChecker.Skolems (newSkolemConstant, newSkolemScope, skolemize)+import Language.PureScript.TypeChecker.Synonyms (replaceAllTypeSynonyms)+import Language.PureScript.Types+import Language.PureScript.Pretty.Types (prettyPrintType)++generalizeUnknowns :: [(Unknown, SourceType)] -> SourceType -> SourceType+generalizeUnknowns unks ty =+ generalizeUnknownsWithVars (unknownVarNames (usedTypeVariables ty) unks) ty++generalizeUnknownsWithVars :: [(Unknown, (Text, SourceType))] -> SourceType -> SourceType+generalizeUnknownsWithVars binders ty =+ mkForAll ((getAnnForType ty,) . fmap (Just . replaceUnknownsWithVars binders) . snd <$> binders) . replaceUnknownsWithVars binders $ ty++replaceUnknownsWithVars :: [(Unknown, (Text, a))] -> SourceType -> SourceType+replaceUnknownsWithVars binders ty+ | null binders = ty+ | otherwise = go ty+ where+ go :: SourceType -> SourceType+ go = everywhereOnTypes $ \case+ TUnknown ann unk | Just (name, _) <- lookup unk binders -> TypeVar ann name+ other -> other++unknownVarNames :: [Text] -> [(Unknown, SourceType)] -> [(Unknown, (Text, SourceType))]+unknownVarNames used unks =+ zipWith (\(a, b) n -> (a, (n, b))) unks $ allVars \\ used+ where+ allVars :: [Text]+ allVars+ | [_] <- unks = "k" : vars+ | otherwise = vars++ vars :: [Text]+ vars = fmap (("k" <>) . T.pack . show) ([1..] :: [Int])++apply :: (MonadState CheckState m) => SourceType -> m SourceType+apply ty = flip substituteType ty <$> gets checkSubstitution++substituteType :: Substitution -> SourceType -> SourceType+substituteType sub = everywhereOnTypes $ \case+ TUnknown ann u ->+ case M.lookup u (substType sub) of+ Nothing -> TUnknown ann u+ Just (TUnknown ann' u1) | u1 == u -> TUnknown ann' u1+ Just t -> substituteType sub t+ other ->+ other++freshUnknown :: (MonadState CheckState m) => m Unknown+freshUnknown = do+ k <- gets checkNextType+ modify $ \st -> st { checkNextType = k + 1 }+ pure k++freshKind :: (MonadState CheckState m) => SourceSpan -> m SourceType+freshKind ss = freshKindWithKind ss E.kindType++freshKindWithKind :: (MonadState CheckState m) => SourceSpan -> SourceType -> m SourceType+freshKindWithKind ss kind = do+ u <- freshUnknown+ addUnsolved Nothing u kind+ pure $ TUnknown (ss, []) u++addUnsolved :: (MonadState CheckState m) => Maybe UnkLevel -> Unknown -> SourceType -> m ()+addUnsolved lvl unk kind = modify $ \st -> do+ let+ newLvl = UnkLevel $ case lvl of+ Nothing -> pure unk+ Just (UnkLevel lvl') -> lvl' <> pure unk+ subs = checkSubstitution st+ uns = M.insert unk (newLvl, kind) $ substUnsolved subs+ st { checkSubstitution = subs { substUnsolved = uns } }++solve :: (MonadState CheckState m) => Unknown -> SourceType -> m ()+solve unk solution = modify $ \st -> do+ let+ subs = checkSubstitution st+ tys = M.insert unk solution $ substType subs+ st { checkSubstitution = subs { substType = tys } }++lookupUnsolved+ :: (MonadState CheckState m, MonadError MultipleErrors m, HasCallStack)+ => Unknown+ -> m (UnkLevel, SourceType)+lookupUnsolved u = do+ uns <- gets (substUnsolved . checkSubstitution)+ case M.lookup u uns of+ Nothing -> internalCompilerError $ "Unsolved unification variable ?" <> T.pack (show u) <> " is not bound"+ Just res -> return res++unknownsWithKinds+ :: forall m. (MonadState CheckState m, MonadError MultipleErrors m, HasCallStack)+ => [Unknown]+ -> m [(Unknown, SourceType)]+unknownsWithKinds = fmap (fmap snd . nubBy ((==) `on` fst) . sortOn fst . join) . traverse go+ where+ go u = do+ (lvl, ty) <- traverse apply =<< lookupUnsolved u+ rest <- fmap join . traverse go . IS.toList . unknowns $ ty+ pure $ (lvl, (u, ty)) : rest++inferKind+ :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack)+ => SourceType+ -> m (SourceType, SourceType)+inferKind = \tyToInfer ->+ withErrorMessageHint (ErrorInferringKind tyToInfer)+ . rethrowWithPosition (fst $ getAnnForType tyToInfer)+ $ go tyToInfer+ where+ go = \case+ ty@(TypeConstructor ann v) -> do+ env <- getEnv+ case M.lookup v (E.types env) of+ Nothing ->+ throwError . errorMessage' (fst ann) . UnknownName . fmap TyName $ v+ Just (kind, E.LocalTypeVariable) -> do+ kind' <- apply kind+ pure (ty, kind' $> ann)+ Just (kind, _) -> do+ pure (ty, kind $> ann)+ ConstrainedType ann' con@(Constraint ann v _ _ _) ty -> do+ env <- getEnv+ con' <- case M.lookup (coerceProperName <$> v) (E.types env) of+ Nothing ->+ throwError . errorMessage' (fst ann) . UnknownName . fmap TyClassName $ v+ Just _ ->+ checkConstraint con+ ty' <- checkIsSaturatedType ty+ con'' <- applyConstraint con'+ pure (ConstrainedType ann' con'' ty', E.kindType $> ann')+ ty@(TypeLevelString ann _) ->+ pure (ty, E.kindSymbol $> ann)+ ty@(TypeLevelInt ann _) ->+ pure (ty, E.tyInt $> ann)+ ty@(TypeVar ann v) -> do+ moduleName <- unsafeCheckCurrentModule+ kind <- apply =<< lookupTypeVariable moduleName (Qualified ByNullSourcePos $ ProperName v)+ pure (ty, kind $> ann)+ ty@(Skolem ann _ mbK _ _) -> do+ kind <- apply $ fromMaybe (internalError "Skolem has no kind") mbK+ pure (ty, kind $> ann)+ ty@(TUnknown ann u) -> do+ kind <- apply . snd =<< lookupUnsolved u+ pure (ty, kind $> ann)+ ty@(TypeWildcard ann _) -> do+ k <- freshKind (fst ann)+ pure (ty, k $> ann)+ ty@(REmpty ann) -> do+ pure (ty, E.kindOfREmpty $> ann)+ ty@(RCons ann _ _ _) | (rowList, rowTail) <- rowToList ty -> do+ kr <- freshKind (fst ann)+ rowList' <- for rowList $ \(RowListItem a lbl t) ->+ RowListItem a lbl <$> checkKind t kr+ rowTail' <- checkKind rowTail $ E.kindRow kr+ kr' <- apply kr+ pure (rowFromList (rowList', rowTail'), E.kindRow kr' $> ann)+ TypeApp ann t1 t2 -> do+ (t1', k1) <- go t1+ inferAppKind ann (t1', k1) t2+ KindApp ann t1 t2 -> do+ (t1', kind) <- bitraverse pure apply =<< go t1+ case kind of+ ForAll _ _ arg (Just argKind) resKind _ -> do+ t2' <- checkKind t2 argKind+ pure (KindApp ann t1' t2', replaceTypeVars arg t2' resKind)+ _ ->+ internalError "inferKind: unkinded forall binder"+ KindedType _ t1 t2 -> do+ t2' <- replaceAllTypeSynonyms . fst =<< go t2+ t1' <- checkKind t1 t2'+ t2'' <- apply t2'+ pure (t1', t2'')+ ForAll ann vis arg mbKind ty sc -> do+ moduleName <- unsafeCheckCurrentModule+ kind <- case mbKind of+ Just k -> replaceAllTypeSynonyms =<< checkIsSaturatedType k+ Nothing -> freshKind (fst ann)+ (ty', unks) <- bindLocalTypeVariables moduleName [(ProperName arg, kind)] $ do+ ty' <- apply =<< checkIsSaturatedType ty+ unks <- unknownsWithKinds . IS.toList $ unknowns ty'+ pure (ty', unks)+ for_ unks . uncurry $ addUnsolved Nothing+ pure (ForAll ann vis arg (Just kind) ty' sc, E.kindType $> ann)+ ParensInType _ ty ->+ go ty+ ty ->+ internalError $ "inferKind: Unimplemented case \n" <> prettyPrintType 100 ty++inferAppKind+ :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack)+ => SourceAnn+ -> (SourceType, SourceType)+ -> SourceType+ -> m (SourceType, SourceType)+inferAppKind ann (fn, fnKind) arg = case fnKind of+ TypeApp _ (TypeApp _ arrKind argKind) resKind | eqType arrKind E.tyFunction -> do+ expandSynonyms <- requiresSynonymsToExpand fn+ arg' <- checkKind' expandSynonyms arg argKind+ (TypeApp ann fn arg',) <$> apply resKind+ TUnknown _ u -> do+ (lvl, _) <- lookupUnsolved u+ u1 <- freshUnknown+ u2 <- freshUnknown+ addUnsolved (Just lvl) u1 E.kindType+ addUnsolved (Just lvl) u2 E.kindType+ solve u $ (TUnknown ann u1 E.-:> TUnknown ann u2) $> ann+ arg' <- checkKind arg $ TUnknown ann u1+ pure (TypeApp ann fn arg', TUnknown ann u2)+ ForAll _ _ a (Just k) ty _ -> do+ u <- freshUnknown+ addUnsolved Nothing u k+ inferAppKind ann (KindApp ann fn (TUnknown ann u), replaceTypeVars a (TUnknown ann u) ty) arg+ _ ->+ cannotApplyTypeToType fn arg+ where+ requiresSynonymsToExpand = \case+ TypeConstructor _ v -> M.notMember v . E.typeSynonyms <$> getEnv+ TypeApp _ l _ -> requiresSynonymsToExpand l+ KindApp _ l _ -> requiresSynonymsToExpand l+ _ -> pure True++cannotApplyTypeToType+ :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack)+ => SourceType+ -> SourceType+ -> m a+cannotApplyTypeToType fn arg = do+ argKind <- snd <$> inferKind arg+ _ <- checkKind fn . srcTypeApp (srcTypeApp E.tyFunction argKind) =<< freshKind nullSourceSpan+ internalCompilerError . T.pack $ "Cannot apply type to type: " <> debugType (srcTypeApp fn arg)++cannotApplyKindToType+ :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack)+ => SourceType+ -> SourceType+ -> m a+cannotApplyKindToType poly arg = do+ let ann = getAnnForType arg+ argKind <- snd <$> inferKind arg+ _ <- checkKind poly . mkForAll [(ann, ("k", Just argKind))] =<< freshKind nullSourceSpan+ internalCompilerError . T.pack $ "Cannot apply kind to type: " <> debugType (srcKindApp poly arg)++checkKind+ :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack)+ => SourceType+ -> SourceType+ -> m SourceType+checkKind = checkKind' False++-- | `checkIsSaturatedType t` is identical to `checkKind t E.kindType` except+-- that the former checks that the type synonyms in `t` expand completely. This+-- is the appropriate function to use when expanding the types of type+-- parameter kinds, arguments to data constructors, etc., in order for the+-- PartiallyAppliedSynonym error to take precedence over the KindsDoNotUnify+-- error.+--+checkIsSaturatedType+ :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack)+ => SourceType+ -> m SourceType+checkIsSaturatedType ty = checkKind' True ty E.kindType++checkKind'+ :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack)+ => Bool+ -> SourceType+ -> SourceType+ -> m SourceType+checkKind' requireSynonymsToExpand ty kind2 = do+ withErrorMessageHint (ErrorCheckingKind ty kind2)+ . rethrowWithPosition (fst $ getAnnForType ty) $ do+ (ty', kind1) <- inferKind ty+ kind1' <- apply kind1+ kind2' <- apply kind2+ when requireSynonymsToExpand $ void $ replaceAllTypeSynonyms ty'+ instantiateKind (ty', kind1') kind2'++instantiateKind+ :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack)+ => (SourceType, SourceType)+ -> SourceType+ -> m SourceType+instantiateKind (ty, kind1) kind2 = case kind1 of+ ForAll _ _ a (Just k) t _ | shouldInstantiate kind2 -> do+ let ann = getAnnForType ty+ u <- freshKindWithKind (fst ann) k+ instantiateKind (KindApp ann ty u, replaceTypeVars a u t) kind2+ _ -> do+ subsumesKind kind1 kind2+ pure ty+ where+ shouldInstantiate = not . \case+ ForAll _ _ _ _ _ _ -> True+ _ -> False++subsumesKind+ :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack)+ => SourceType+ -> SourceType+ -> m ()+subsumesKind = go+ where+ go = curry $ \case+ (TypeApp _ (TypeApp _ arr1 a1) a2, TypeApp _ (TypeApp _ arr2 b1) b2)+ | eqType arr1 E.tyFunction+ , eqType arr2 E.tyFunction -> do+ go b1 a1+ join $ go <$> apply a2 <*> apply b2+ (a, ForAll ann _ var mbKind b mbScope) -> do+ scope <- maybe newSkolemScope pure mbScope+ skolc <- newSkolemConstant+ go a $ skolemize ann var mbKind skolc scope b+ (ForAll ann _ var (Just kind) a _, b) -> do+ a' <- freshKindWithKind (fst ann) kind+ go (replaceTypeVars var a' a) b+ (TUnknown ann u, b@(TypeApp _ (TypeApp _ arr _) _))+ | eqType arr E.tyFunction+ , IS.notMember u (unknowns b) ->+ join $ go <$> solveUnknownAsFunction ann u <*> pure b+ (a@(TypeApp _ (TypeApp _ arr _) _), TUnknown ann u)+ | eqType arr E.tyFunction+ , IS.notMember u (unknowns a) ->+ join $ go <$> pure a <*> solveUnknownAsFunction ann u+ (a, b) ->+ unifyKinds a b++unifyKinds+ :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack)+ => SourceType+ -> SourceType+ -> m ()+unifyKinds = unifyKindsWithFailure $ \w1 w2 ->+ throwError+ . errorMessage''' (fst . getAnnForType <$> [w1, w2])+ $ KindsDoNotUnify w1 w2++-- | Does not attach positions to the error node, instead relies on the+-- | local position context. This is useful when invoking kind unification+-- | outside of kind checker internals.+unifyKinds'+ :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack)+ => SourceType+ -> SourceType+ -> m ()+unifyKinds' = unifyKindsWithFailure $ \w1 w2 ->+ throwError+ . errorMessage+ $ KindsDoNotUnify w1 w2++-- | Check the kind of a type, failing if it is not of kind *.+checkTypeKind+ :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack)+ => SourceType+ -> SourceType+ -> m ()+checkTypeKind ty kind =+ unifyKindsWithFailure (\_ _ -> throwError . errorMessage $ ExpectedType ty kind) kind E.kindType++unifyKindsWithFailure+ :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack)+ => (SourceType -> SourceType -> m ())+ -> SourceType+ -> SourceType+ -> m ()+unifyKindsWithFailure onFailure = go+ where+ goWithLabel l t1 t2 = withErrorMessageHint (ErrorInRowLabel l) $ go t1 t2+ go = curry $ \case+ (TypeApp _ p1 p2, TypeApp _ p3 p4) -> do+ go p1 p3+ join $ go <$> apply p2 <*> apply p4+ (KindApp _ p1 p2, KindApp _ p3 p4) -> do+ go p1 p3+ join $ go <$> apply p2 <*> apply p4+ (r1@(RCons _ _ _ _), r2) ->+ unifyRows r1 r2+ (r1, r2@(RCons _ _ _ _)) ->+ unifyRows r1 r2+ (r1@(REmpty _), r2) ->+ unifyRows r1 r2+ (r1, r2@(REmpty _)) ->+ unifyRows r1 r2+ (w1, w2) | eqType w1 w2 ->+ pure ()+ (TUnknown _ a', p1) ->+ solveUnknown a' p1+ (p1, TUnknown _ a') ->+ solveUnknown a' p1+ (w1, w2) ->+ onFailure w1 w2++ unifyRows r1 r2 = do+ let (matches, rest) = alignRowsWith goWithLabel r1 r2+ sequence_ matches+ unifyTails rest++ unifyTails = \case+ (([], TUnknown _ a'), (rs, p1)) ->+ solveUnknown a' $ rowFromList (rs, p1)+ ((rs, p1), ([], TUnknown _ a')) ->+ solveUnknown a' $ rowFromList (rs, p1)+ (([], w1), ([], w2)) | eqType w1 w2 ->+ pure ()+ ((rs1, TUnknown _ u1), (rs2, TUnknown _ u2)) | u1 /= u2 -> do+ rest <- freshKind nullSourceSpan+ solveUnknown u1 $ rowFromList (rs2, rest)+ solveUnknown u2 $ rowFromList (rs1, rest)+ (w1, w2) ->+ onFailure (rowFromList w1) (rowFromList w2)++solveUnknown+ :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack)+ => Unknown+ -> SourceType+ -> m ()+solveUnknown a' p1 = do+ p2 <- promoteKind a' p1+ w1 <- snd <$> lookupUnsolved a'+ join $ unifyKinds <$> apply w1 <*> elaborateKind p2+ solve a' p2++solveUnknownAsFunction+ :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack)+ => SourceAnn+ -> Unknown+ -> m SourceType+solveUnknownAsFunction ann u = do+ lvl <- fst <$> lookupUnsolved u+ u1 <- freshUnknown+ u2 <- freshUnknown+ addUnsolved (Just lvl) u1 E.kindType+ addUnsolved (Just lvl) u2 E.kindType+ let uarr = (TUnknown ann u1 E.-:> TUnknown ann u2) $> ann+ solve u uarr+ pure uarr++promoteKind+ :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack)+ => Unknown+ -> SourceType+ -> m SourceType+promoteKind u2 ty = do+ lvl2 <- fst <$> lookupUnsolved u2+ flip everywhereOnTypesM ty $ \case+ ty'@(TUnknown ann u1) -> do+ when (u1 == u2) . throwError . errorMessage . InfiniteKind $ ty+ (lvl1, k) <- lookupUnsolved u1+ if lvl1 < lvl2 then+ pure ty'+ else do+ k' <- promoteKind u2 =<< apply k+ u1' <- freshUnknown+ addUnsolved (Just lvl2) u1' k'+ solve u1 $ TUnknown ann u1'+ pure $ TUnknown ann u1'+ ty' ->+ pure ty'++elaborateKind+ :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack)+ => SourceType+ -> m SourceType+elaborateKind = \case+ TypeLevelString ann _ ->+ pure $ E.kindSymbol $> ann+ TypeLevelInt ann _ ->+ pure $ E.tyInt $> ann+ TypeConstructor ann v -> do+ env <- getEnv+ case M.lookup v (E.types env) of+ Nothing ->+ throwError . errorMessage' (fst ann) . UnknownName . fmap TyName $ v+ Just (kind, _) ->+ ($> ann) <$> apply kind+ TypeVar ann a -> do+ moduleName <- unsafeCheckCurrentModule+ kind <- apply =<< lookupTypeVariable moduleName (Qualified ByNullSourcePos $ ProperName a)+ pure (kind $> ann)+ (Skolem ann _ mbK _ _) -> do+ kind <- apply $ fromMaybe (internalError "Skolem has no kind") mbK+ pure $ kind $> ann+ TUnknown ann a' -> do+ kind <- snd <$> lookupUnsolved a'+ ($> ann) <$> apply kind+ REmpty ann -> do+ pure $ E.kindOfREmpty $> ann+ RCons ann _ t1 _ -> do+ k1 <- elaborateKind t1+ pure $ E.kindRow k1 $> ann+ ty@(TypeApp ann t1 t2) -> do+ k1 <- elaborateKind t1+ case k1 of+ TypeApp _ (TypeApp _ k _) w2 | eqType k E.tyFunction -> do+ pure $ w2 $> ann+ -- Normally we wouldn't unify in `elaborateKind`, since an unknown should+ -- always have a known kind. However, since type holes are fully inference+ -- driven, they are unknowns with unknown kinds, which may require some+ -- late unification here.+ TUnknown a u -> do+ _ <- solveUnknownAsFunction a u+ elaborateKind ty+ _ ->+ cannotApplyTypeToType t1 t2+ KindApp ann t1 t2 -> do+ k1 <- elaborateKind t1+ case k1 of+ ForAll _ _ a _ n _ -> do+ flip (replaceTypeVars a) n . ($> ann) <$> apply t2+ _ ->+ cannotApplyKindToType t1 t2+ ForAll ann _ _ _ _ _ -> do+ pure $ E.kindType $> ann+ ConstrainedType ann _ _ ->+ pure $ E.kindType $> ann+ KindedType ann _ k ->+ pure $ k $> ann+ ty ->+ throwError . errorMessage' (fst (getAnnForType ty)) $ UnsupportedTypeInKind ty++checkEscapedSkolems :: MonadError MultipleErrors m => SourceType -> m ()+checkEscapedSkolems ty =+ traverse_ (throwError . toSkolemError)+ . everythingWithContextOnTypes ty [] (<>) go+ $ ty+ where+ go :: SourceType -> SourceType -> (SourceType, [(SourceSpan, Text, SourceType)])+ go ty' = \case+ Skolem ss name _ _ _ -> (ty', [(fst ss, name, ty')])+ ty''@(KindApp _ _ _) -> (ty'', [])+ _ -> (ty', [])++ toSkolemError (ss, name, ty') =+ errorMessage' (fst $ getAnnForType ty') $ EscapedSkolem name (Just ss) ty'++kindOfWithUnknowns+ :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack)+ => SourceType+ -> m (([(Unknown, SourceType)], SourceType), SourceType)+kindOfWithUnknowns ty = do+ (ty', kind) <- kindOf ty+ unks <- unknownsWithKinds . IS.toList $ unknowns ty'+ pure ((unks, ty'), kind)++-- | Infer the kind of a single type+kindOf+ :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack)+ => SourceType+ -> m (SourceType, SourceType)+kindOf = fmap (first snd) . kindOfWithScopedVars++-- | Infer the kind of a single type, returning the kinds of any scoped type variables+kindOfWithScopedVars+ :: (MonadError MultipleErrors m, MonadState CheckState m, HasCallStack)+ => SourceType+ -> m (([(Text, SourceType)], SourceType), SourceType)+kindOfWithScopedVars ty = do+ (ty', kind) <- bitraverse apply (replaceAllTypeSynonyms <=< apply) =<< inferKind ty+ let binders = fst . fromJust $ completeBinderList ty'+ pure ((snd <$> binders, ty'), kind)++type DataDeclarationArgs =+ ( SourceAnn+ , ProperName 'TypeName+ , [(Text, Maybe SourceType)]+ , [DataConstructorDeclaration]+ )++type DataDeclarationResult =+ ( [(DataConstructorDeclaration, SourceType)]+ -- The infered type signatures of data constructors+ , SourceType+ -- The inferred kind of the declaration+ )++kindOfData+ :: forall m. (MonadError MultipleErrors m, MonadState CheckState m)+ => ModuleName+ -> DataDeclarationArgs+ -> m DataDeclarationResult+kindOfData moduleName dataDecl =+ head . (^. _2) <$> kindsOfAll moduleName [] [dataDecl] []++inferDataDeclaration+ :: forall m. (MonadError MultipleErrors m, MonadState CheckState m)+ => ModuleName+ -> DataDeclarationArgs+ -> m [(DataConstructorDeclaration, SourceType)]+inferDataDeclaration moduleName (ann, tyName, tyArgs, ctors) = do+ tyKind <- apply =<< lookupTypeVariable moduleName (Qualified ByNullSourcePos tyName)+ let (sigBinders, tyKind') = fromJust . completeBinderList $ tyKind+ bindLocalTypeVariables moduleName (first ProperName . snd <$> sigBinders) $ do+ tyArgs' <- for tyArgs . traverse . maybe (freshKind (fst ann)) $ replaceAllTypeSynonyms <=< apply <=< checkIsSaturatedType+ subsumesKind (foldr ((E.-:>) . snd) E.kindType tyArgs') tyKind'+ bindLocalTypeVariables moduleName (first ProperName <$> tyArgs') $ do+ let tyCtorName = srcTypeConstructor $ mkQualified tyName moduleName+ tyCtor = foldl (\ty -> srcKindApp ty . srcTypeVar . fst . snd) tyCtorName sigBinders+ tyCtor' = foldl (\ty -> srcTypeApp ty . srcTypeVar . fst) tyCtor tyArgs'+ ctorBinders = fmap (fmap (fmap Just)) $ sigBinders <> fmap (nullSourceAnn,) tyArgs'+ visibility = second (const TypeVarVisible) <$> tyArgs+ for ctors $+ fmap (fmap (addVisibility visibility . mkForAll ctorBinders)) . inferDataConstructor tyCtor'++inferDataConstructor+ :: forall m. (MonadError MultipleErrors m, MonadState CheckState m)+ => SourceType+ -> DataConstructorDeclaration+ -> m (DataConstructorDeclaration, SourceType)+inferDataConstructor tyCtor DataConstructorDeclaration{..} = do+ dataCtorFields' <- traverse (traverse checkIsSaturatedType) dataCtorFields+ dataCtor <- flip (foldr ((E.-:>) . snd)) dataCtorFields' <$> checkKind tyCtor E.kindType+ pure ( DataConstructorDeclaration { dataCtorFields = dataCtorFields', .. }, dataCtor )++type TypeDeclarationArgs =+ ( SourceAnn+ , ProperName 'TypeName+ , [(Text, Maybe SourceType)]+ , SourceType+ )++type TypeDeclarationResult =+ ( SourceType+ -- The elaborated rhs of the declaration+ , SourceType+ -- The inferred kind of the declaration+ )++kindOfTypeSynonym+ :: forall m. (MonadError MultipleErrors m, MonadState CheckState m)+ => ModuleName+ -> TypeDeclarationArgs+ -> m TypeDeclarationResult+kindOfTypeSynonym moduleName typeDecl =+ head . (^. _1) <$> kindsOfAll moduleName [typeDecl] [] []++inferTypeSynonym+ :: forall m. (MonadError MultipleErrors m, MonadState CheckState m)+ => ModuleName+ -> TypeDeclarationArgs+ -> m SourceType+inferTypeSynonym moduleName (ann, tyName, tyArgs, tyBody) = do+ tyKind <- apply =<< lookupTypeVariable moduleName (Qualified ByNullSourcePos tyName)+ let (sigBinders, tyKind') = fromJust . completeBinderList $ tyKind+ bindLocalTypeVariables moduleName (first ProperName . snd <$> sigBinders) $ do+ kindRes <- freshKind (fst ann)+ tyArgs' <- for tyArgs . traverse . maybe (freshKind (fst ann)) $ replaceAllTypeSynonyms <=< apply <=< checkIsSaturatedType+ unifyKinds tyKind' $ foldr ((E.-:>) . snd) kindRes tyArgs'+ bindLocalTypeVariables moduleName (first ProperName <$> tyArgs') $ do+ tyBodyAndKind <- traverse apply =<< inferKind tyBody+ instantiateKind tyBodyAndKind =<< apply kindRes++-- | Checks that a particular generalization is valid and well-scoped.+-- | Implicitly generalized kinds are always elaborated before explicitly+-- | quantified type variables. It's possible that such a kind can be+-- | inserted before other variables that it depends on, making it+-- | ill-scoped. We require that users explicitly generalize this kind+-- | in such a case.+checkQuantification+ :: forall m. (MonadError MultipleErrors m)+ => SourceType+ -> m ()+checkQuantification =+ collectErrors . go [] [] . fst . fromJust . completeBinderList+ where+ collectErrors vars =+ unless (null vars)+ . throwError+ . foldMap (\(ann, arg) -> errorMessage' (fst ann) $ QuantificationCheckFailureInKind arg)+ $ vars++ go acc _ [] = reverse acc+ go acc sco ((_, (arg, k)) : rest)+ | not . all (flip elem sco) $ freeTypeVariables k = goDeps acc arg rest+ | otherwise = go acc (arg : sco) rest++ goDeps acc _ [] = acc+ goDeps acc karg ((ann, (arg, k)) : rest)+ | isDep && arg == karg = (ann, arg) : acc+ | isDep = goDeps ((ann, arg) : acc) karg rest+ | otherwise = goDeps acc karg rest+ where+ isDep =+ elem karg $ freeTypeVariables k++checkVisibleTypeQuantification+ :: forall m. (MonadError MultipleErrors m)+ => SourceType+ -> m ()+checkVisibleTypeQuantification =+ collectErrors . freeTypeVariables+ where+ collectErrors vars =+ unless (null vars)+ . throwError+ . foldMap (errorMessage . VisibleQuantificationCheckFailureInType)+ $ vars++-- | Checks that there are no remaining unknowns in a type, and if so+-- | throws an error. This is necessary for contexts where we can't+-- | implicitly generalize unknowns, such as on the right-hand-side of+-- | a type synonym, or in arguments to data constructors.+checkTypeQuantification+ :: forall m. (MonadError MultipleErrors m)+ => SourceType+ -> m ()+checkTypeQuantification =+ collectErrors . everythingWithContextOnTypes True [] (<>) unknownsInKinds+ where+ collectErrors tysWithUnks =+ unless (null tysWithUnks) . throwError . foldMap toMultipleErrors $ tysWithUnks++ toMultipleErrors (ss, unks, ty) =+ errorMessage' ss $ QuantificationCheckFailureInType (IS.toList unks) ty++ unknownsInKinds False _ = (False, [])+ unknownsInKinds _ ty = case ty of+ ForAll sa _ _ _ _ _ | unks <- unknowns ty, not (IS.null unks) ->+ (False, [(fst sa, unks, ty)])+ KindApp sa _ _ | unks <- unknowns ty, not (IS.null unks) ->+ (False, [(fst sa, unks, ty)])+ ConstrainedType sa _ _ | unks <- unknowns ty, not (IS.null unks) ->+ (False, [(fst sa, unks, ty)])+ _ ->+ (True, [])++type ClassDeclarationArgs =+ ( SourceAnn+ , ProperName 'ClassName+ , [(Text, Maybe SourceType)]+ , [SourceConstraint]+ , [Declaration]+ )++type ClassDeclarationResult =+ ( [(Text, SourceType)]+ -- The kind annotated class arguments+ , [SourceConstraint]+ -- The kind annotated superclass constraints+ , [Declaration]+ -- The kind annotated declarations+ , SourceType+ -- The inferred kind of the declaration+ )++kindOfClass+ :: forall m. (MonadError MultipleErrors m, MonadState CheckState m)+ => ModuleName+ -> ClassDeclarationArgs+ -> m ClassDeclarationResult+kindOfClass moduleName clsDecl =+ head . (^. _3) <$> kindsOfAll moduleName [] [] [clsDecl]++inferClassDeclaration+ :: forall m. (MonadError MultipleErrors m, MonadState CheckState m)+ => ModuleName+ -> ClassDeclarationArgs+ -> m ([(Text, SourceType)], [SourceConstraint], [Declaration])+inferClassDeclaration moduleName (ann, clsName, clsArgs, superClasses, decls) = do+ clsKind <- apply =<< lookupTypeVariable moduleName (Qualified ByNullSourcePos $ coerceProperName clsName)+ let (sigBinders, clsKind') = fromJust . completeBinderList $ clsKind+ bindLocalTypeVariables moduleName (first ProperName . snd <$> sigBinders) $ do+ clsArgs' <- for clsArgs . traverse . maybe (freshKind (fst ann)) $ replaceAllTypeSynonyms <=< apply <=< checkIsSaturatedType+ unifyKinds clsKind' $ foldr ((E.-:>) . snd) E.kindConstraint clsArgs'+ bindLocalTypeVariables moduleName (first ProperName <$> clsArgs') $ do+ (clsArgs',,)+ <$> for superClasses checkConstraint+ <*> for decls checkClassMemberDeclaration++checkClassMemberDeclaration+ :: forall m. (MonadError MultipleErrors m, MonadState CheckState m)+ => Declaration+ -> m Declaration+checkClassMemberDeclaration = \case+ TypeDeclaration (TypeDeclarationData ann ident ty) ->+ TypeDeclaration . TypeDeclarationData ann ident <$> checkKind ty E.kindType+ _ -> internalError "Invalid class member declaration"++applyClassMemberDeclaration+ :: forall m. (MonadError MultipleErrors m, MonadState CheckState m)+ => Declaration+ -> m Declaration+applyClassMemberDeclaration = \case+ TypeDeclaration (TypeDeclarationData ann ident ty) ->+ TypeDeclaration . TypeDeclarationData ann ident <$> apply ty+ _ -> internalError "Invalid class member declaration"++mapTypeDeclaration :: (SourceType -> SourceType) -> Declaration -> Declaration+mapTypeDeclaration f = \case+ TypeDeclaration (TypeDeclarationData ann ident ty) ->+ TypeDeclaration . TypeDeclarationData ann ident $ f ty+ other ->+ other++checkConstraint+ :: forall m. (MonadError MultipleErrors m, MonadState CheckState m)+ => SourceConstraint+ -> m SourceConstraint+checkConstraint (Constraint ann clsName kinds args dat) = do+ let ty = foldl (TypeApp ann) (foldl (KindApp ann) (TypeConstructor ann (fmap coerceProperName clsName)) kinds) args+ (_, kinds', args') <- unapplyTypes <$> checkKind ty E.kindConstraint+ pure $ Constraint ann clsName kinds' args' dat++applyConstraint+ :: forall m. (MonadError MultipleErrors m, MonadState CheckState m)+ => SourceConstraint+ -> m SourceConstraint+applyConstraint (Constraint ann clsName kinds args dat) = do+ let ty = foldl (TypeApp ann) (foldl (KindApp ann) (TypeConstructor ann (fmap coerceProperName clsName)) kinds) args+ (_, kinds', args') <- unapplyTypes <$> apply ty+ pure $ Constraint ann clsName kinds' args' dat++type InstanceDeclarationArgs =+ ( SourceAnn+ , [SourceConstraint]+ , Qualified (ProperName 'ClassName)+ , [SourceType]+ )++type InstanceDeclarationResult =+ ( [SourceConstraint]+ , [SourceType]+ , [SourceType]+ , [(Text, SourceType)]+ )++checkInstanceDeclaration+ :: forall m. (MonadError MultipleErrors m, MonadState CheckState m)+ => ModuleName+ -> InstanceDeclarationArgs+ -> m InstanceDeclarationResult+checkInstanceDeclaration moduleName (ann, constraints, clsName, args) = do+ let ty = foldl (TypeApp ann) (TypeConstructor ann (fmap coerceProperName clsName)) args+ tyWithConstraints = foldr srcConstrainedType ty constraints+ freeVars = freeTypeVariables tyWithConstraints+ freeVarsDict <- for freeVars $ \v -> (ProperName v,) <$> freshKind (fst ann)+ bindLocalTypeVariables moduleName freeVarsDict $ do+ ty' <- checkKind ty E.kindConstraint+ constraints' <- for constraints checkConstraint+ allTy <- apply $ foldr srcConstrainedType ty' constraints'+ allUnknowns <- unknownsWithKinds . IS.toList . foldMap unknowns . (allTy :) =<< traverse (apply . snd) freeVarsDict+ let unknownVars = unknownVarNames (usedTypeVariables allTy) allUnknowns+ let allWithVars = replaceUnknownsWithVars unknownVars allTy+ let (allConstraints, (_, allKinds, allArgs)) = unapplyTypes <$> unapplyConstraints allWithVars+ varKinds <- traverse (traverse (fmap (replaceUnknownsWithVars unknownVars) . apply)) $ (snd <$> unknownVars) <> (first runProperName <$> freeVarsDict)+ pure (allConstraints, allKinds, allArgs, varKinds)++checkKindDeclaration+ :: forall m. (MonadSupply m, MonadError MultipleErrors m, MonadState CheckState m)+ => ModuleName+ -> SourceType+ -> m SourceType+checkKindDeclaration _ ty = do+ (ty', kind) <- kindOf ty+ checkTypeKind kind E.kindType+ ty'' <- replaceAllTypeSynonyms ty'+ unks <- unknownsWithKinds . IS.toList $ unknowns ty''+ finalTy <- generalizeUnknowns unks <$> freshenForAlls ty' ty''+ checkQuantification finalTy+ checkValidKind finalTy+ where+ -- When expanding type synonyms and generalizing, we need to generate more+ -- unique names so that they don't clash or shadow other names, or can+ -- be referenced (easily).+ freshVar arg = (arg <>) . T.pack . show <$> fresh+ freshenForAlls = curry $ \case+ (ForAll _ _ v1 _ ty1 _, ForAll a2 vis v2 k2 ty2 sc2) | v1 == v2 -> do+ ty2' <- freshenForAlls ty1 ty2+ pure $ ForAll a2 vis v2 k2 ty2' sc2+ (_, ty2) -> go ty2 where+ go = \case+ ForAll a' vis v' k' ty' sc' -> do+ v'' <- freshVar v'+ ty'' <- go (replaceTypeVars v' (TypeVar a' v'') ty')+ pure $ ForAll a' vis v'' k' ty'' sc'+ other -> pure other++ checkValidKind = everywhereOnTypesM $ \case+ ty'@(ConstrainedType ann _ _) ->+ throwError . errorMessage' (fst ann) $ UnsupportedTypeInKind ty'+ other -> pure other++existingSignatureOrFreshKind+ :: forall m. MonadState CheckState m+ => ModuleName+ -> SourceSpan+ -> ProperName 'TypeName+ -> m SourceType+existingSignatureOrFreshKind moduleName ss name = do+ env <- getEnv+ case M.lookup (Qualified (ByModuleName moduleName) name) (E.types env) of+ Nothing -> freshKind ss+ Just (kind, _) -> pure kind++kindsOfAll+ :: forall m. (MonadError MultipleErrors m, MonadState CheckState m)+ => ModuleName+ -> [TypeDeclarationArgs]+ -> [DataDeclarationArgs]+ -> [ClassDeclarationArgs]+ -> m ([TypeDeclarationResult], [DataDeclarationResult], [ClassDeclarationResult])+kindsOfAll moduleName syns dats clss = withFreshSubstitution $ do+ synDict <- for syns $ \(sa, synName, _, _) -> (synName,) <$> existingSignatureOrFreshKind moduleName (fst sa) synName+ datDict <- for dats $ \(sa, datName, _, _) -> (datName,) <$> existingSignatureOrFreshKind moduleName (fst sa) datName+ clsDict <- for clss $ \(sa, clsName, _, _, _) -> fmap (coerceProperName clsName,) $ existingSignatureOrFreshKind moduleName (fst sa) $ coerceProperName clsName+ let bindingGroup = synDict <> datDict <> clsDict+ bindLocalTypeVariables moduleName bindingGroup $ do+ synResults <- for syns (inferTypeSynonym moduleName)+ datResults <- for dats (inferDataDeclaration moduleName)+ clsResults <- for clss (inferClassDeclaration moduleName)+ synResultsWithUnks <- for (zip synDict synResults) $ \((synName, synKind), synBody) -> do+ synKind' <- apply synKind+ synBody' <- apply synBody+ pure (((synName, synKind'), synBody'), unknowns synKind')+ datResultsWithUnks <- for (zip datDict datResults) $ \((datName, datKind), ctors) -> do+ datKind' <- apply datKind+ ctors' <- traverse (bitraverse (traverseDataCtorFields (traverse (traverse apply))) apply) ctors+ pure (((datName, datKind'), ctors'), unknowns datKind')+ clsResultsWithUnks <- for (zip clsDict clsResults) $ \((clsName, clsKind), (args, supers, decls)) -> do+ clsKind' <- apply clsKind+ args' <- traverse (traverse apply) args+ supers' <- traverse applyConstraint supers+ decls' <- traverse applyClassMemberDeclaration decls+ pure (((clsName, clsKind'), (args', supers', decls')), unknowns clsKind')+ let synUnks = fmap (\(((synName, _), _), unks) -> (synName, unks)) synResultsWithUnks+ datUnks = fmap (\(((datName, _), _), unks) -> (datName, unks)) datResultsWithUnks+ clsUnks = fmap (\(((clsName, _), _), unks) -> (clsName, unks)) clsResultsWithUnks+ tysUnks = synUnks <> datUnks <> clsUnks+ allUnks <- unknownsWithKinds . IS.toList $ foldMap snd tysUnks+ let mkTySub (name, unks) = do+ let tyCtorName = mkQualified name moduleName+ tyUnks = filter (flip IS.member unks . fst) allUnks+ tyCtor = foldl (\ty -> srcKindApp ty . TUnknown nullSourceAnn . fst) (srcTypeConstructor tyCtorName) tyUnks+ (tyCtorName, (tyCtor, tyUnks))+ tySubs = fmap mkTySub tysUnks+ replaceTypeCtors = everywhereOnTypes $ \case+ TypeConstructor _ name+ | Just (tyCtor, _) <- lookup name tySubs -> tyCtor+ other -> other+ clsResultsWithKinds = flip fmap clsResultsWithUnks $ \(((clsName, clsKind), (args, supers, decls)), _) -> do+ let tyUnks = snd . fromJust $ lookup (mkQualified clsName moduleName) tySubs+ (usedTypeVariablesInDecls, _, _, _, _) = accumTypes usedTypeVariables+ usedVars = usedTypeVariables clsKind+ <> foldMap (usedTypeVariables . snd) args+ <> foldMap (foldMap usedTypeVariables . (\c -> constraintKindArgs c <> constraintArgs c)) supers+ <> foldMap usedTypeVariablesInDecls decls+ unkBinders = unknownVarNames usedVars tyUnks+ args' = fmap (replaceUnknownsWithVars unkBinders . replaceTypeCtors) <$> args+ supers' = mapConstraintArgsAll (fmap (replaceUnknownsWithVars unkBinders . replaceTypeCtors)) <$> supers+ decls' = mapTypeDeclaration (replaceUnknownsWithVars unkBinders . replaceTypeCtors) <$> decls+ (args', supers', decls', generalizeUnknownsWithVars unkBinders clsKind)+ datResultsWithKinds <- for datResultsWithUnks $ \(((datName, datKind), ctors), _) -> do+ let tyUnks = snd . fromJust $ lookup (mkQualified datName moduleName) tySubs+ replaceDataCtorField ty = replaceUnknownsWithVars (unknownVarNames (usedTypeVariables ty) tyUnks) $ replaceTypeCtors ty+ ctors' = fmap (mapDataCtorFields (fmap (fmap replaceDataCtorField)) *** generalizeUnknowns tyUnks . replaceTypeCtors) ctors+ traverse_ (traverse_ checkTypeQuantification) ctors'+ pure (ctors', generalizeUnknowns tyUnks datKind)+ synResultsWithKinds <- for synResultsWithUnks $ \(((synName, synKind), synBody), _) -> do+ let tyUnks = snd . fromJust $ lookup (mkQualified synName moduleName) tySubs+ unkBinders = unknownVarNames (usedTypeVariables synKind <> usedTypeVariables synBody) tyUnks+ genBody = replaceUnknownsWithVars unkBinders $ replaceTypeCtors synBody+ genSig = generalizeUnknownsWithVars unkBinders synKind+ checkEscapedSkolems genBody+ checkTypeQuantification genBody+ checkVisibleTypeQuantification genSig+ pure (genBody, genSig)+ pure (synResultsWithKinds, datResultsWithKinds, clsResultsWithKinds)
src/Language/PureScript/TypeChecker/Monad.hs view
@@ -1,44 +1,124 @@------------------------------------------------------------------------------------ Module : Language.PureScript.TypeChecker.Monad--- Copyright : (c) Phil Freeman 2013--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :---+{-# LANGUAGE GADTs #-}+ -- | -- Monads for type checking and type inference and associated data types --------------------------------------------------------------------------------+module Language.PureScript.TypeChecker.Monad where -{-# LANGUAGE GeneralizedNewtypeDeriving, FlexibleInstances, RankNTypes,- MultiParamTypeClasses, FlexibleContexts, GADTs #-}+import Prelude -module Language.PureScript.TypeChecker.Monad where+import Control.Arrow (second)+import Control.Monad.Error.Class (MonadError(..))+import Control.Monad.State (MonadState(..), StateT(..), forM_, gets, guard, join, modify, when, (<=<))+import Control.Monad.Writer.Class (MonadWriter(..), censor) -import Data.Maybe-import qualified Data.Map as M+import Data.Maybe (fromMaybe)+import Data.Map qualified as M+import Data.Set qualified as S+import Data.Text (Text, isPrefixOf, unpack)+import Data.List.NonEmpty qualified as NEL -import Control.Applicative-import Control.Monad.Except-import Control.Monad.Reader.Class-import Control.Monad.State-import Control.Monad.Unify+import Language.PureScript.Crash (internalError)+import Language.PureScript.Environment (Environment(..), NameKind(..), NameVisibility(..), TypeClassData(..), TypeKind(..))+import Language.PureScript.Errors (Context, ErrorMessageHint, ExportSource, Expr, ImportDeclarationType, MultipleErrors, SimpleErrorMessage(..), SourceAnn, SourceSpan(..), addHint, errorMessage, positionedError, rethrow, warnWithPosition)+import Language.PureScript.Names (Ident(..), ModuleName, ProperName(..), ProperNameType(..), Qualified(..), QualifiedBy(..), coerceProperName, disqualify, runIdent, runModuleName, showQualified, toMaybeModuleName)+import Language.PureScript.Pretty.Types (prettyPrintType)+import Language.PureScript.Pretty.Values (prettyPrintValue)+import Language.PureScript.TypeClassDictionaries (NamedDict, TypeClassDictionaryInScope(..))+import Language.PureScript.Types (Constraint(..), SourceType, Type(..), srcKindedType, srcTypeVar)+import Text.PrettyPrint.Boxes (render) -import Language.PureScript.Environment-import Language.PureScript.Errors-import Language.PureScript.Kinds-import Language.PureScript.Names-import Language.PureScript.Options-import Language.PureScript.TypeClassDictionaries-import Language.PureScript.Types+newtype UnkLevel = UnkLevel (NEL.NonEmpty Unknown)+ deriving (Eq, Show) --- |--- Temporarily bind a collection of names to values----bindNames :: (MonadState CheckState m) => M.Map (ModuleName, Ident) (Type, NameKind, NameVisibility) -> m a -> m a+-- This instance differs from the NEL instance in that longer but otherwise+-- equal paths are LT rather than GT. An extended path puts it *before* its root.+instance Ord UnkLevel where+ compare (UnkLevel a) (UnkLevel b) =+ go (NEL.toList a) (NEL.toList b)+ where+ go [] [] = EQ+ go _ [] = LT+ go [] _ = GT+ go (x:xs) (y:ys) =+ compare x y <> go xs ys++-- | A substitution of unification variables for types.+data Substitution = Substitution+ { substType :: M.Map Int SourceType+ -- ^ Type substitution+ , substUnsolved :: M.Map Int (UnkLevel, SourceType)+ -- ^ Unsolved unification variables with their level (scope ordering) and kind+ , substNames :: M.Map Int Text+ -- ^ The original names of unknowns+ }++insertUnkName :: (MonadState CheckState m) => Unknown -> Text -> m ()+insertUnkName u t = do+ modify (\s ->+ s { checkSubstitution =+ (checkSubstitution s) { substNames =+ M.insert u t $ substNames $ checkSubstitution s+ }+ }+ )++lookupUnkName :: (MonadState CheckState m) => Unknown -> m (Maybe Text)+lookupUnkName u = gets $ M.lookup u . substNames . checkSubstitution++-- | An empty substitution+emptySubstitution :: Substitution+emptySubstitution = Substitution M.empty M.empty M.empty++-- | State required for type checking+data CheckState = CheckState+ { checkEnv :: Environment+ -- ^ The current @Environment@+ , checkNextType :: Int+ -- ^ The next type unification variable+ , checkNextSkolem :: Int+ -- ^ The next skolem variable+ , checkNextSkolemScope :: Int+ -- ^ The next skolem scope constant+ , checkCurrentModule :: Maybe ModuleName+ -- ^ The current module+ , checkCurrentModuleImports ::+ [ ( SourceAnn+ , ModuleName+ , ImportDeclarationType+ , Maybe ModuleName+ , M.Map (ProperName 'TypeName) ([ProperName 'ConstructorName], ExportSource)+ )+ ]+ -- ^ The current module imports and their exported types.+ -- Newtype constructors have to be in scope for some Coercible constraints to+ -- be solvable, so we need to know which constructors are imported and whether+ -- they are actually defined in or re-exported from the imported modules.+ , checkSubstitution :: Substitution+ -- ^ The current substitution+ , checkHints :: [ErrorMessageHint]+ -- ^ The current error message hint stack.+ -- This goes into state, rather than using 'rethrow',+ -- since this way, we can provide good error messages+ -- during instance resolution.+ , checkConstructorImportsForCoercible :: S.Set (ModuleName, Qualified (ProperName 'ConstructorName))+ -- ^ Newtype constructors imports required to solve Coercible constraints.+ -- We have to keep track of them so that we don't emit unused import warnings.+ }++-- | Create an empty @CheckState@+emptyCheckState :: Environment -> CheckState+emptyCheckState env = CheckState env 0 0 0 Nothing [] emptySubstitution [] mempty++-- | Unification variables+type Unknown = Int++-- | Temporarily bind a collection of names to values+bindNames+ :: MonadState CheckState m+ => M.Map (Qualified Ident) (SourceType, NameKind, NameVisibility)+ -> m a+ -> m a bindNames newNames action = do orig <- get modify $ \st -> st { checkEnv = (checkEnv st) { names = newNames `M.union` (names . checkEnv $ st) } }@@ -46,10 +126,12 @@ modify $ \st -> st { checkEnv = (checkEnv st) { names = names . checkEnv $ orig } } return a --- |--- Temporarily bind a collection of names to types----bindTypes :: (MonadState CheckState m) => M.Map (Qualified ProperName) (Kind, TypeKind) -> m a -> m a+-- | Temporarily bind a collection of names to types+bindTypes+ :: MonadState CheckState m+ => M.Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind)+ -> m a+ -> m a bindTypes newNames action = do orig <- get modify $ \st -> st { checkEnv = (checkEnv st) { types = newNames `M.union` (types . checkEnv $ st) } }@@ -57,185 +139,346 @@ modify $ \st -> st { checkEnv = (checkEnv st) { types = types . checkEnv $ orig } } return a --- |--- Temporarily bind a collection of names to types----withScopedTypeVars :: (Functor m, MonadState CheckState m) => ModuleName -> [(String, Kind)] -> m a -> m a-withScopedTypeVars mn ks = bindTypes (M.fromList (map (\(name, k) -> (Qualified (Just mn) (ProperName name), (k, ScopedTypeVar))) ks))+-- | Temporarily bind a collection of names to types+withScopedTypeVars+ :: (MonadState CheckState m, MonadWriter MultipleErrors m)+ => ModuleName+ -> [(Text, SourceType)]+ -> m a+ -> m a+withScopedTypeVars mn ks ma = do+ orig <- get+ forM_ ks $ \(name, _) ->+ when (Qualified (ByModuleName mn) (ProperName name) `M.member` types (checkEnv orig)) $+ tell . errorMessage $ ShadowedTypeVar name+ bindTypes (M.fromList (map (\(name, k) -> (Qualified (ByModuleName mn) (ProperName name), (k, ScopedTypeVar))) ks)) ma --- |--- Temporarily make a collection of type class dictionaries available----withTypeClassDictionaries :: (MonadState CheckState m) => [TypeClassDictionaryInScope] -> m a -> m a+withErrorMessageHint+ :: (MonadState CheckState m, MonadError MultipleErrors m)+ => ErrorMessageHint+ -> m a+ -> m a+withErrorMessageHint hint action = do+ orig <- get+ modify $ \st -> st { checkHints = hint : checkHints st }+ -- Need to use 'rethrow' anyway, since we have to handle regular errors+ a <- rethrow (addHint hint) action+ modify $ \st -> st { checkHints = checkHints orig }+ return a++-- | These hints are added at the front, so the most nested hint occurs+-- at the front, but the simplifier assumes the reverse order.+getHints :: MonadState CheckState m => m [ErrorMessageHint]+getHints = gets (reverse . checkHints)++rethrowWithPositionTC+ :: (MonadState CheckState m, MonadError MultipleErrors m)+ => SourceSpan+ -> m a+ -> m a+rethrowWithPositionTC pos = withErrorMessageHint (positionedError pos)++warnAndRethrowWithPositionTC+ :: (MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m)+ => SourceSpan+ -> m a+ -> m a+warnAndRethrowWithPositionTC pos = rethrowWithPositionTC pos . warnWithPosition pos++-- | Temporarily make a collection of type class dictionaries available+withTypeClassDictionaries+ :: MonadState CheckState m+ => [NamedDict]+ -> m a+ -> m a withTypeClassDictionaries entries action = do orig <- get- let mentries = M.fromList [ ((canonicalizeDictionary entry, mn), entry) | entry@TypeClassDictionaryInScope{ tcdName = Qualified mn _ } <- entries ]- modify $ \st -> st { checkEnv = (checkEnv st) { typeClassDictionaries = (typeClassDictionaries . checkEnv $ st) `M.union` mentries } }++ let mentries =+ M.fromListWith (M.unionWith (M.unionWith (<>)))+ [ (qb, M.singleton className (M.singleton tcdValue (pure entry)))+ | entry@TypeClassDictionaryInScope{ tcdValue = tcdValue@(Qualified qb _), tcdClassName = className }+ <- entries+ ]++ modify $ \st -> st { checkEnv = (checkEnv st) { typeClassDictionaries = M.unionWith (M.unionWith (M.unionWith (<>))) (typeClassDictionaries . checkEnv $ st) mentries } } a <- action modify $ \st -> st { checkEnv = (checkEnv st) { typeClassDictionaries = typeClassDictionaries . checkEnv $ orig } } return a --- |--- Get the currently available list of type class dictionaries----getTypeClassDictionaries :: (Functor m, MonadState CheckState m) => m [TypeClassDictionaryInScope]-getTypeClassDictionaries = M.elems . typeClassDictionaries . checkEnv <$> get+-- | Get the currently available map of type class dictionaries+getTypeClassDictionaries+ :: (MonadState CheckState m)+ => m (M.Map QualifiedBy (M.Map (Qualified (ProperName 'ClassName)) (M.Map (Qualified Ident) (NEL.NonEmpty NamedDict))))+getTypeClassDictionaries = gets $ typeClassDictionaries . checkEnv --- |--- Temporarily bind a collection of names to local variables----bindLocalVariables :: (Functor m, MonadState CheckState m) => ModuleName -> [(Ident, Type, NameVisibility)] -> m a -> m a-bindLocalVariables moduleName bindings =- bindNames (M.fromList $ flip map bindings $ \(name, ty, visibility) -> ((moduleName, name), (ty, LocalVariable, visibility)))+-- | Lookup type class dictionaries in a module.+lookupTypeClassDictionaries+ :: (MonadState CheckState m)+ => QualifiedBy+ -> m (M.Map (Qualified (ProperName 'ClassName)) (M.Map (Qualified Ident) (NEL.NonEmpty NamedDict)))+lookupTypeClassDictionaries mn = gets $ fromMaybe M.empty . M.lookup mn . typeClassDictionaries . checkEnv --- |--- Temporarily bind a collection of names to local type variables----bindLocalTypeVariables :: (Functor m, MonadState CheckState m) => ModuleName -> [(ProperName, Kind)] -> m a -> m a+-- | Lookup type class dictionaries in a module.+lookupTypeClassDictionariesForClass+ :: (MonadState CheckState m)+ => QualifiedBy+ -> Qualified (ProperName 'ClassName)+ -> m (M.Map (Qualified Ident) (NEL.NonEmpty NamedDict))+lookupTypeClassDictionariesForClass mn cn = fromMaybe M.empty . M.lookup cn <$> lookupTypeClassDictionaries mn++-- | Temporarily bind a collection of names to local variables+bindLocalVariables+ :: (MonadState CheckState m)+ => [(SourceSpan, Ident, SourceType, NameVisibility)]+ -> m a+ -> m a+bindLocalVariables bindings =+ bindNames (M.fromList $ flip map bindings $ \(ss, name, ty, visibility) -> (Qualified (BySourcePos $ spanStart ss) name, (ty, Private, visibility)))++-- | Temporarily bind a collection of names to local type variables+bindLocalTypeVariables+ :: (MonadState CheckState m)+ => ModuleName+ -> [(ProperName 'TypeName, SourceType)]+ -> m a+ -> m a bindLocalTypeVariables moduleName bindings =- bindTypes (M.fromList $ flip map bindings $ \(pn, kind) -> (Qualified (Just moduleName) pn, (kind, LocalTypeVariable)))+ bindTypes (M.fromList $ flip map bindings $ \(pn, kind) -> (Qualified (ByModuleName moduleName) pn, (kind, LocalTypeVariable))) --- |--- Update the visibility of all names to Defined----makeBindingGroupVisible :: (Functor m, MonadState CheckState m) => m a -> m a-makeBindingGroupVisible action = do- orig <- get- modify $ \st -> st { checkEnv = (checkEnv st) { names = M.map (\(ty, nk, _) -> (ty, nk, Defined)) (names . checkEnv $ st) } }+-- | Update the visibility of all names to Defined+makeBindingGroupVisible :: (MonadState CheckState m) => m ()+makeBindingGroupVisible = modifyEnv $ \e -> e { names = M.map (\(ty, nk, _) -> (ty, nk, Defined)) (names e) }++-- | Update the visibility of all names to Defined in the scope of the provided action+withBindingGroupVisible :: (MonadState CheckState m) => m a -> m a+withBindingGroupVisible action = preservingNames $ makeBindingGroupVisible >> action++-- | Perform an action while preserving the names from the @Environment@.+preservingNames :: (MonadState CheckState m) => m a -> m a+preservingNames action = do+ orig <- gets (names . checkEnv) a <- action- modify $ \st -> st { checkEnv = (checkEnv st) { names = names . checkEnv $ orig } }+ modifyEnv $ \e -> e { names = orig } return a --- |--- Lookup the type of a value by name in the @Environment@----lookupVariable :: (e ~ MultipleErrors, Functor m, MonadState CheckState m, MonadError e m) => ModuleName -> Qualified Ident -> m Type-lookupVariable currentModule (Qualified moduleName var) = do+-- | Lookup the type of a value by name in the @Environment@+lookupVariable+ :: (e ~ MultipleErrors, MonadState CheckState m, MonadError e m)+ => Qualified Ident+ -> m SourceType+lookupVariable qual = do env <- getEnv- case M.lookup (fromMaybe currentModule moduleName, var) (names env) of- Nothing -> throwError . errorMessage $ NameIsUndefined var+ case M.lookup qual (names env) of+ Nothing -> throwError . errorMessage $ NameIsUndefined (disqualify qual) Just (ty, _, _) -> return ty --- |--- Lookup the visibility of a value by name in the @Environment@----getVisibility :: (e ~ MultipleErrors, Functor m, MonadState CheckState m, MonadError e m) => ModuleName -> Qualified Ident -> m NameVisibility-getVisibility currentModule (Qualified moduleName var) = do+-- | Lookup the visibility of a value by name in the @Environment@+getVisibility+ :: (e ~ MultipleErrors, MonadState CheckState m, MonadError e m)+ => Qualified Ident+ -> m NameVisibility+getVisibility qual = do env <- getEnv- case M.lookup (fromMaybe currentModule moduleName, var) (names env) of- Nothing -> throwError . errorMessage $ NameIsUndefined var+ case M.lookup qual (names env) of+ Nothing -> throwError . errorMessage $ NameIsUndefined (disqualify qual) Just (_, _, vis) -> return vis --- |--- Assert that a name is visible----checkVisibility :: (e ~ MultipleErrors, Functor m, MonadState CheckState m, MonadError e m) => ModuleName -> Qualified Ident -> m ()-checkVisibility currentModule name@(Qualified _ var) = do- vis <- getVisibility currentModule name+-- | Assert that a name is visible+checkVisibility+ :: (e ~ MultipleErrors, MonadState CheckState m, MonadError e m)+ => Qualified Ident+ -> m ()+checkVisibility name@(Qualified _ var) = do+ vis <- getVisibility name case vis of- Undefined -> throwError . errorMessage $ NameNotInScope var+ Undefined -> throwError . errorMessage $ CycleInDeclaration var _ -> return () --- |--- Lookup the kind of a type by name in the @Environment@----lookupTypeVariable :: (e ~ MultipleErrors, Functor m, MonadState CheckState m, MonadError e m) => ModuleName -> Qualified ProperName -> m Kind-lookupTypeVariable currentModule (Qualified moduleName name) = do+-- | Lookup the kind of a type by name in the @Environment@+lookupTypeVariable+ :: (e ~ MultipleErrors, MonadState CheckState m, MonadError e m)+ => ModuleName+ -> Qualified (ProperName 'TypeName)+ -> m SourceType+lookupTypeVariable currentModule (Qualified qb name) = do env <- getEnv- case M.lookup (Qualified (Just $ fromMaybe currentModule moduleName) name) (types env) of+ case M.lookup (Qualified qb' name) (types env) of Nothing -> throwError . errorMessage $ UndefinedTypeVariable name Just (k, _) -> return k---- |--- State required for type checking:----data CheckState = CheckState {- -- |- -- The current @Environment@- --- checkEnv :: Environment- -- |- -- The next fresh unification variable name- --- , checkNextVar :: Int- -- |- -- The next type class dictionary name- --- , checkNextDictName :: Int- -- |- -- The current module- --- , checkCurrentModule :: Maybe ModuleName- }+ where+ qb' = ByModuleName $ case qb of+ ByModuleName m -> m+ BySourcePos _ -> currentModule --- |--- The type checking monad, which provides the state of the type checker, and error reporting capabilities----newtype Check a = Check { unCheck :: StateT CheckState (Either MultipleErrors) a }- deriving (Functor, Monad, Applicative, MonadState CheckState, MonadError MultipleErrors)+-- | Get the current @Environment@+getEnv :: (MonadState CheckState m) => m Environment+getEnv = gets checkEnv --- |--- Get the current @Environment@----getEnv :: (Functor m, MonadState CheckState m) => m Environment-getEnv = checkEnv <$> get+-- | Get locally-bound names in context, to create an error message.+getLocalContext :: MonadState CheckState m => m Context+getLocalContext = do+ env <- getEnv+ return [ (ident, ty') | (Qualified (BySourcePos _) ident@Ident{}, (ty', _, Defined)) <- M.toList (names env) ] --- |--- Update the @Environment@---+-- | Update the @Environment@ putEnv :: (MonadState CheckState m) => Environment -> m () putEnv env = modify (\s -> s { checkEnv = env }) --- |--- Modify the @Environment@---+-- | Modify the @Environment@ modifyEnv :: (MonadState CheckState m) => (Environment -> Environment) -> m () modifyEnv f = modify (\s -> s { checkEnv = f (checkEnv s) }) --- |--- Run a computation in the Check monad, starting with an empty @Environment@----runCheck :: (MonadReader (Options mode) m, MonadError String m) => Check a -> m (a, Environment)-runCheck = runCheck' initEnvironment---- |--- Run a computation in the Check monad, failing with an error, or succeeding with a return value and the final @Environment@.----runCheck' :: (MonadReader (Options mode) m, MonadError String m) => Environment -> Check a -> m (a, Environment)-runCheck' env c = do- verbose <- asks optionsVerboseErrors- interpretMultipleErrors verbose $ do- (a, s) <- flip runStateT (CheckState env 0 0 Nothing) $ unCheck c- return (a, checkEnv s)+-- | Run a computation in the typechecking monad, failing with an error, or succeeding with a return value and the final @Environment@.+runCheck :: (Functor m) => CheckState -> StateT CheckState m a -> m (a, Environment)+runCheck st check = second checkEnv <$> runStateT check st --- |--- Make an assertion, failing with an error message---+-- | Make an assertion, failing with an error message guardWith :: (MonadError e m) => e -> Bool -> m () guardWith _ True = return () guardWith e False = throwError e --- |--- Generate new type class dictionary name----freshDictionaryName :: Check Int-freshDictionaryName = do- n <- checkNextDictName <$> get- modify $ \s -> s { checkNextDictName = succ (checkNextDictName s) }- return n+capturingSubstitution+ :: MonadState CheckState m+ => (a -> Substitution -> b)+ -> m a+ -> m b+capturingSubstitution f ma = do+ a <- ma+ subst <- gets checkSubstitution+ return (f a subst) --- |--- Lift a computation in the @Check@ monad into the substitution monad.----liftCheck :: Check a -> UnifyT t Check a-liftCheck = UnifyT . lift+withFreshSubstitution+ :: MonadState CheckState m+ => m a+ -> m a+withFreshSubstitution ma = do+ orig <- get+ modify $ \st -> st { checkSubstitution = emptySubstitution }+ a <- ma+ modify $ \st -> st { checkSubstitution = checkSubstitution orig }+ return a --- |--- Run a computation in the substitution monad, generating a return value and the final substitution.----liftUnify :: (Partial t) => UnifyT t Check a -> Check (a, Substitution t)-liftUnify unify = do- st <- get- (a, ust) <- runUnify (defaultUnifyState { unifyNextVar = checkNextVar st }) unify- modify $ \st' -> st' { checkNextVar = unifyNextVar ust }- return (a, unifyCurrentSubstitution ust)+withoutWarnings+ :: MonadWriter w m+ => m a+ -> m (a, w)+withoutWarnings = censor (const mempty) . listen++unsafeCheckCurrentModule+ :: forall m+ . (MonadError MultipleErrors m, MonadState CheckState m)+ => m ModuleName+unsafeCheckCurrentModule = gets checkCurrentModule >>= \case+ Nothing -> internalError "No module name set in scope"+ Just name -> pure name++debugEnv :: Environment -> [String]+debugEnv env = join+ [ debugTypes env+ , debugTypeSynonyms env+ , debugTypeClasses env+ , debugTypeClassDictionaries env+ , debugDataConstructors env+ , debugNames env+ ]++debugType :: Type a -> String+debugType = init . prettyPrintType 100++debugConstraint :: Constraint a -> String+debugConstraint (Constraint ann clsName kinds args _) =+ debugType $ foldl (TypeApp ann) (foldl (KindApp ann) (TypeConstructor ann (fmap coerceProperName clsName)) kinds) args++debugTypes :: Environment -> [String]+debugTypes = go <=< M.toList . types+ where+ go (qual, (srcTy, which)) = do+ let+ ppTy = prettyPrintType 100 srcTy+ name = showQualified runProperName qual+ decl = case which of+ DataType _ _ _ -> "data"+ TypeSynonym -> "type"+ ExternData _ -> "extern"+ LocalTypeVariable -> "local"+ ScopedTypeVar -> "scoped"+ guard (not ("Prim" `isPrefixOf` name))+ pure $ decl <> " " <> unpack name <> " :: " <> init ppTy++debugNames :: Environment -> [String]+debugNames = fmap go . M.toList . names+ where+ go (qual, (srcTy, _, _)) = do+ let+ ppTy = prettyPrintType 100 srcTy+ name = showQualified runIdent qual+ unpack name <> " :: " <> init ppTy++debugDataConstructors :: Environment -> [String]+debugDataConstructors = fmap go . M.toList . dataConstructors+ where+ go (qual, (_, _, ty, _)) = do+ let+ ppTy = prettyPrintType 100 ty+ name = showQualified runProperName qual+ unpack name <> " :: " <> init ppTy++debugTypeSynonyms :: Environment -> [String]+debugTypeSynonyms = fmap go . M.toList . typeSynonyms+ where+ go (qual, (binders, subTy)) = do+ let+ vars = unwords $ flip fmap binders $ \case+ (v, Just k) -> "(" <> unpack v <> " :: " <> init (prettyPrintType 100 k) <> ")"+ (v, Nothing) -> unpack v+ ppTy = prettyPrintType 100 subTy+ name = showQualified runProperName qual+ "type " <> unpack name <> " " <> vars <> " = " <> init ppTy++debugTypeClassDictionaries :: Environment -> [String]+debugTypeClassDictionaries = go . typeClassDictionaries+ where+ go tcds = do+ (mbModuleName, classes) <- M.toList tcds+ (className, instances) <- M.toList classes+ (ident, dicts) <- M.toList instances+ let+ moduleName = maybe "" (\m -> "[" <> runModuleName m <> "] ") (toMaybeModuleName mbModuleName)+ className' = showQualified runProperName className+ ident' = showQualified runIdent ident+ kds = unwords $ fmap ((\a -> "@(" <> a <> ")") . debugType) $ tcdInstanceKinds $ NEL.head dicts+ tys = unwords $ fmap ((\a -> "(" <> a <> ")") . debugType) $ tcdInstanceTypes $ NEL.head dicts+ pure $ "dict " <> unpack moduleName <> unpack className' <> " " <> unpack ident' <> " (" <> show (length dicts) <> ")" <> " " <> kds <> " " <> tys++debugTypeClasses :: Environment -> [String]+debugTypeClasses = fmap go . M.toList . typeClasses+ where+ go (className, tc) = do+ let+ className' = showQualified runProperName className+ args = unwords $ (\(a, b) -> "(" <> debugType (maybe (srcTypeVar a) (srcKindedType (srcTypeVar a)) b) <> ")") <$> typeClassArguments tc+ "class " <> unpack className' <> " " <> args++debugValue :: Expr -> String+debugValue = init . render . prettyPrintValue 100++debugSubstitution :: Substitution -> [String]+debugSubstitution (Substitution solved unsolved names) =+ concat+ [ fmap go1 (M.toList solved)+ , fmap go2 (M.toList unsolved')+ , fmap go3 (M.toList names)+ ]+ where+ unsolved' =+ M.filterWithKey (\k _ -> M.notMember k solved) unsolved++ go1 (u, ty) =+ "?" <> show u <> " = " <> debugType ty++ go2 (u, (_, k)) =+ "?" <> show u <> " :: " <> debugType k++ go3 (u, t) =+ unpack t <> show u
+ src/Language/PureScript/TypeChecker/Roles.hs view
@@ -0,0 +1,263 @@+{-# LANGUAGE TypeApplications #-}++-- |+-- Role inference+--+module Language.PureScript.TypeChecker.Roles+ ( lookupRoles+ , checkRoles+ , checkRoleDeclarationArity+ , inferRoles+ , inferDataBindingGroupRoles+ ) where++import Prelude++import Control.Arrow ((&&&))+import Control.Monad (unless, when, zipWithM_)+import Control.Monad.Error.Class (MonadError(..))+import Control.Monad.State (MonadState(..), runState, state)+import Data.Coerce (coerce)+import Data.Map qualified as M+import Data.Maybe (fromMaybe)+import Data.Set qualified as S+import Data.Semigroup (Any(..))+import Data.Text (Text)++import Language.PureScript.Environment (Environment(..), TypeKind(..))+import Language.PureScript.Errors (DataConstructorDeclaration(..), MultipleErrors, RoleDeclarationData(..), SimpleErrorMessage(..), errorMessage)+import Language.PureScript.Names (ModuleName, ProperName, ProperNameType(..), Qualified(..), QualifiedBy(..))+import Language.PureScript.Roles (Role(..))+import Language.PureScript.Types (Constraint(..), SourceType, Type(..), freeTypeVariables, unapplyTypes)++-- |+-- A map of a type's formal parameter names to their roles. This type's+-- @Semigroup@ and @Monoid@ instances preserve the least-permissive role+-- ascribed to any given variable, as defined by the @Role@ type's @Ord@+-- instance. That is, a variable that has been marked as @Nominal@ can not+-- later be marked @Representational@, and so on.+newtype RoleMap = RoleMap { getRoleMap :: M.Map Text Role }++instance Semigroup RoleMap where+ (<>) =+ coerce @(M.Map Text Role -> _ -> _) @(RoleMap -> _ -> _) (M.unionWith min)++instance Monoid RoleMap where+ mempty =+ RoleMap M.empty++type RoleEnv = M.Map (Qualified (ProperName 'TypeName)) [Role]++typeKindRoles :: TypeKind -> Maybe [Role]+typeKindRoles = \case+ DataType _ args _ ->+ Just $ map (\(_, _, role) -> role) args+ ExternData roles ->+ Just roles+ _ ->+ Nothing++getRoleEnv :: Environment -> RoleEnv+getRoleEnv env =+ M.mapMaybe (typeKindRoles . snd) (types env)++updateRoleEnv+ :: Qualified (ProperName 'TypeName)+ -> [Role]+ -> RoleEnv+ -> (Any, RoleEnv)+updateRoleEnv qualTyName roles' roleEnv =+ let roles = fromMaybe (repeat Phantom) $ M.lookup qualTyName roleEnv+ mostRestrictiveRoles = zipWith min roles roles'+ didRolesChange = any (uncurry (<)) $ zip mostRestrictiveRoles roles+ in (Any didRolesChange, M.insert qualTyName mostRestrictiveRoles roleEnv)++-- |+-- Lookup the roles for a type in the environment. If the type does not have+-- roles (e.g. is a type synonym or a type variable), then this function+-- returns an empty list.+--+lookupRoles+ :: Environment+ -> Qualified (ProperName 'TypeName)+ -> [Role]+lookupRoles env tyName =+ fromMaybe [] $ M.lookup tyName (types env) >>= typeKindRoles . snd++-- |+-- Compares the inferred roles to the explicitly declared roles and ensures+-- that the explicitly declared roles are not more permissive than the+-- inferred ones.+--+checkRoles+ :: forall m+ . (MonadError MultipleErrors m)+ => [(Text, Maybe SourceType, Role)]+ -- ^ type parameters for the data type whose roles we are checking+ -> [Role]+ -- ^ roles declared for the data type+ -> m ()+checkRoles tyArgs declaredRoles = do+ let k (var, _, inf) dec =+ when (inf < dec) . throwError . errorMessage $ RoleMismatch var inf dec+ zipWithM_ k tyArgs declaredRoles++checkRoleDeclarationArity+ :: forall m+ . (MonadError MultipleErrors m)+ => ProperName 'TypeName+ -> [Role]+ -> Int+ -> m ()+checkRoleDeclarationArity tyName roles expected = do+ let actual = length roles+ unless (expected == actual) $+ throwError . errorMessage $+ RoleDeclarationArityMismatch tyName expected actual++-- |+-- Infers roles for the given data type declaration.+--+inferRoles+ :: Environment+ -> ModuleName+ -> ProperName 'TypeName+ -- ^ The name of the data type whose roles we are checking+ -> [(Text, Maybe SourceType)]+ -- ^ type parameters for the data type whose roles we are checking+ -> [DataConstructorDeclaration]+ -- ^ constructors of the data type whose roles we are checking+ -> [Role]+inferRoles env moduleName tyName tyArgs ctors =+ inferDataBindingGroupRoles env moduleName [] [(tyName, tyArgs, ctors)] tyName tyArgs++inferDataBindingGroupRoles+ :: Environment+ -> ModuleName+ -> [RoleDeclarationData]+ -> [DataDeclaration]+ -> ProperName 'TypeName+ -> [(Text, Maybe SourceType)]+ -> [Role]+inferDataBindingGroupRoles env moduleName roleDeclarations group =+ let declaredRoleEnv = M.fromList $ map (Qualified (ByModuleName moduleName) . rdeclIdent &&& rdeclRoles) roleDeclarations+ inferredRoleEnv = getRoleEnv env+ initialRoleEnv = declaredRoleEnv `M.union` inferredRoleEnv+ inferredRoleEnv' = inferDataBindingGroupRoles' moduleName group initialRoleEnv+ in \tyName tyArgs ->+ let qualTyName = Qualified (ByModuleName moduleName) tyName+ inferredRoles = M.lookup qualTyName inferredRoleEnv'+ in fromMaybe (Phantom <$ tyArgs) inferredRoles++type DataDeclaration =+ ( ProperName 'TypeName+ , [(Text, Maybe SourceType)]+ , [DataConstructorDeclaration]+ )++inferDataBindingGroupRoles'+ :: ModuleName+ -> [DataDeclaration]+ -> RoleEnv+ -> RoleEnv+inferDataBindingGroupRoles' moduleName group roleEnv =+ let (Any didRolesChange, roleEnv') = flip runState roleEnv $+ mconcat <$> traverse (state . inferDataDeclarationRoles moduleName) group+ in if didRolesChange+ then inferDataBindingGroupRoles' moduleName group roleEnv'+ else roleEnv'++-- |+-- Infers roles for the given data type declaration, along with a flag to tell+-- if more restrictive roles were added to the environment.+--+inferDataDeclarationRoles+ :: ModuleName+ -> DataDeclaration+ -> RoleEnv+ -> (Any, RoleEnv)+inferDataDeclarationRoles moduleName (tyName, tyArgs, ctors) roleEnv =+ let qualTyName = Qualified (ByModuleName moduleName) tyName+ ctorRoles = getRoleMap . foldMap (walk mempty . snd) $ ctors >>= dataCtorFields+ inferredRoles = map (\(arg, _) -> fromMaybe Phantom (M.lookup arg ctorRoles)) tyArgs+ in updateRoleEnv qualTyName inferredRoles roleEnv+ where+ -- This function is named @walk@ to match the specification given in the+ -- "Role inference" section of the paper "Safe Zero-cost Coercions for+ -- Haskell".+ walk :: S.Set Text -> SourceType -> RoleMap+ walk btvs (TypeVar _ v)+ -- A type variable standing alone (e.g. @a@ in @data D a b = D a@) is+ -- representational, _unless_ it has been bound by a quantifier, in which+ -- case it is not actually a parameter to the type (e.g. @z@ in+ -- @data T z = T (forall z. z -> z)@).+ | S.member v btvs =+ mempty+ | otherwise =+ RoleMap $ M.singleton v Representational+ walk btvs (ForAll _ _ tv _ t _) =+ -- We can walk under universal quantifiers as long as we make note of the+ -- variables that they bind. For instance, given a definition+ -- @data T z = T (forall z. z -> z)@, we will make note that @z@ is bound+ -- by a quantifier so that we do not mark @T@'s parameter as+ -- representational later on. Similarly, given a definition like+ -- @data D a = D (forall r. r -> a)@, we'll mark @r@ as bound so that it+ -- doesn't appear as a spurious parameter to @D@ when we complete+ -- inference.+ walk (S.insert tv btvs) t+ walk btvs (ConstrainedType _ Constraint{..} t) =+ -- For constrained types, mark all free variables in the constraint+ -- arguments as nominal and recurse on the type beneath the constraint.+ walk btvs t <> foldMap (freeNominals btvs) constraintArgs+ walk btvs (RCons _ _ thead ttail) = do+ -- For row types, we just walk along them and collect the results.+ walk btvs thead <> walk btvs ttail+ walk btvs (KindedType _ t _k) =+ -- For kind-annotated types, discard the annotation and recurse on the+ -- type beneath.+ walk btvs t+ walk btvs t+ | (t1, _, t2s) <- unapplyTypes t+ , not $ null t2s =+ case t1 of+ -- If the type is an application of a type constructor to some+ -- arguments, recursively infer the roles of the type constructor's+ -- arguments. For each (role, argument) pair:+ --+ -- - If the role is nominal, mark all free variables in the argument+ -- as nominal also, since they cannot be coerced if the+ -- argument's nominality is to be preserved.+ --+ -- - If the role is representational, recurse on the argument, since+ -- its use of our parameters is important.+ --+ -- - If the role is phantom, terminate, since the argument's use of+ -- our parameters is unimportant.+ TypeConstructor _ t1Name ->+ let+ t1Roles = fromMaybe (repeat Phantom) $ M.lookup t1Name roleEnv+ k role ti = case role of+ Nominal ->+ freeNominals btvs ti+ Representational ->+ go ti+ Phantom ->+ mempty+ in mconcat (zipWith k t1Roles t2s)+ -- If the type is an application of any other type-level term, walk+ -- that term to collect its roles and mark all free variables in+ -- its argument as nominal.+ _ -> do+ go t1 <> foldMap (freeNominals btvs) t2s+ | otherwise =+ mempty+ where+ go = walk btvs++-- Given a type, computes the list of free variables in that type+-- (taking into account those bound in @walk@) and returns a @RoleMap@+-- ascribing a nominal role to each of those variables.+freeNominals :: S.Set Text -> SourceType -> RoleMap+freeNominals btvs x =+ let ftvs = filter (flip S.notMember btvs) (freeTypeVariables x)+ in RoleMap (M.fromList $ map (, Nominal) ftvs)
− src/Language/PureScript/TypeChecker/Rows.hs
@@ -1,66 +0,0 @@------------------------------------------------------------------------------------ Module : Language.PureScript.TypeChecker.Rows--- Copyright : (c) Phil Freeman 2013--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ |--- Functions relating to type checking for rows-----------------------------------------------------------------------------------module Language.PureScript.TypeChecker.Rows (- checkDuplicateLabels-) where--import Data.List--import Control.Monad.Except--import Language.PureScript.AST-import Language.PureScript.Errors-import Language.PureScript.TypeChecker.Monad-import Language.PureScript.Types---- |--- Ensure rows do not contain duplicate labels----checkDuplicateLabels :: Expr -> Check ()-checkDuplicateLabels =- let (_, f, _) = everywhereOnValuesM def go def- in void . f- where- def :: a -> Check a- def = return-- go :: Expr -> Check Expr- go e@(TypedValue _ val ty) = do- checkDups ty- return e-- where- checkDups :: Type -> Check ()- checkDups (TypeApp t1 t2) = checkDups t1 >> checkDups t2- checkDups (SaturatedTypeSynonym _ ts) = mapM_ checkDups ts- checkDups (ForAll _ t _) = checkDups t- checkDups (ConstrainedType args t) = do- mapM_ checkDups $ concatMap snd args- checkDups t- checkDups r@RCons{} =- let (ls, _) = rowToList r in- case firstDup . sort . map fst $ ls of- Just l -> throwError . errorMessage $ DuplicateLabel l (Just val)- Nothing -> return ()- checkDups _ = return ()-- firstDup :: (Eq a) => [a] -> Maybe a- firstDup (x : xs@(x' : _))- | x == x' = Just x- | otherwise = firstDup xs- firstDup _ = Nothing-- go other = return other
src/Language/PureScript/TypeChecker/Skolems.hs view
@@ -1,114 +1,131 @@------------------------------------------------------------------------------------ Module : Language.PureScript.TypeChecker.Skolems--- Copyright : (c) Phil Freeman 2013--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ |--- Functions relating to skolemization used during typechecking-----------------------------------------------------------------------------------module Language.PureScript.TypeChecker.Skolems (- newSkolemConstant,- introduceSkolemScope,- newSkolemScope,- skolemize,- skolemizeTypesInValue,- skolemEscapeCheck-) where--import Data.List (nub, (\\))-import Data.Monoid+-- | Functions relating to skolemization used during typechecking+module Language.PureScript.TypeChecker.Skolems+ ( newSkolemConstant+ , introduceSkolemScope+ , newSkolemScope+ , skolemize+ , skolemizeTypesInValue+ , skolemEscapeCheck+ ) where -import Control.Applicative-import Control.Monad.Except-import Control.Monad.Unify+import Prelude -import Language.PureScript.AST-import Language.PureScript.Errors-import Language.PureScript.TypeChecker.Monad-import Language.PureScript.Types+import Control.Monad.Error.Class (MonadError(..))+import Control.Monad.State.Class (MonadState(..), gets, modify)+import Data.Foldable (traverse_)+import Data.Functor.Identity (Identity(), runIdentity)+import Data.Set (Set, fromList, notMember)+import Data.Text (Text)+import Language.PureScript.AST (Binder(..), ErrorMessageHint(..), Expr(..), SourceAnn, SourceSpan, everythingWithContextOnValues, everywhereWithContextOnValuesM, nonEmptySpan)+import Language.PureScript.Crash (internalError)+import Language.PureScript.Errors (ErrorMessage(..), MultipleErrors, SimpleErrorMessage(..), positionedError, singleError)+import Language.PureScript.Traversals (defS)+import Language.PureScript.TypeChecker.Monad (CheckState(..))+import Language.PureScript.Types (SkolemScope(..), SourceType, Type(..), everythingOnTypes, everywhereOnTypesM, replaceTypeVars) --- |--- Generate a new skolem constant----newSkolemConstant :: UnifyT Type Check Int-newSkolemConstant = fresh'+-- | Generate a new skolem constant+newSkolemConstant :: MonadState CheckState m => m Int+newSkolemConstant = do+ s <- gets checkNextSkolem+ modify $ \st -> st { checkNextSkolem = s + 1 }+ return s --- |--- Introduce skolem scope at every occurence of a ForAll----introduceSkolemScope :: Type -> UnifyT Type Check Type+-- | Introduce skolem scope at every occurrence of a ForAll+introduceSkolemScope :: MonadState CheckState m => Type a -> m (Type a) introduceSkolemScope = everywhereOnTypesM go where- go (ForAll ident ty Nothing) = ForAll ident ty <$> (Just <$> newSkolemScope)+ go (ForAll ann vis ident mbK ty Nothing) = ForAll ann vis ident mbK ty <$> (Just <$> newSkolemScope) go other = return other --- |--- Generate a new skolem scope----newSkolemScope :: UnifyT Type Check SkolemScope-newSkolemScope = SkolemScope <$> fresh'+-- | Generate a new skolem scope+newSkolemScope :: MonadState CheckState m => m SkolemScope+newSkolemScope = do+ s <- gets checkNextSkolemScope+ modify $ \st -> st { checkNextSkolemScope = s + 1 }+ return $ SkolemScope s --- |--- Skolemize a type variable by replacing its instances with fresh skolem constants----skolemize :: String -> Int -> SkolemScope -> Type -> Type-skolemize ident sko scope = replaceTypeVars ident (Skolem ident sko scope)+-- | Skolemize a type variable by replacing its instances with fresh skolem constants+skolemize :: a -> Text -> Maybe (Type a) -> Int -> SkolemScope -> Type a -> Type a+skolemize ann ident mbK sko scope = replaceTypeVars ident (Skolem ann ident mbK sko scope) --- |--- This function has one purpose - to skolemize type variables appearing in a--- SuperClassDictionary placeholder. These type variables are somewhat unique since they are the--- only example of scoped type variables.----skolemizeTypesInValue :: String -> Int -> SkolemScope -> Expr -> Expr-skolemizeTypesInValue ident sko scope = let (_, f, _) = everywhereOnValues id go id in f+-- | This function skolemizes type variables appearing in any type signatures or+-- 'DeferredDictionary' placeholders. These type variables are the only places+-- where scoped type variables can appear in expressions.+skolemizeTypesInValue :: SourceAnn -> Text -> Maybe SourceType -> Int -> SkolemScope -> Expr -> Expr+skolemizeTypesInValue ann ident mbK sko scope =+ runIdentity . onExpr' where- go (SuperClassDictionary c ts) = SuperClassDictionary c (map (skolemize ident sko scope) ts)- go (TypedValue check val ty) = TypedValue check val (skolemize ident sko scope ty)- go other = other+ onExpr' :: Expr -> Identity Expr+ (_, onExpr', _, _, _, _) = everywhereWithContextOnValuesM [] defS onExpr onBinder defS defS defS --- |--- Ensure skolem variables do not escape their scope+ onExpr :: [Text] -> Expr -> Identity ([Text], Expr)+ onExpr sco (DeferredDictionary c ts)+ | ident `notElem` sco = return (sco, DeferredDictionary c (map (skolemize ann ident mbK sko scope) ts))+ onExpr sco (TypedValue check val ty)+ | ident `notElem` sco = return (sco ++ peelTypeVars ty, TypedValue check val (skolemize ann ident mbK sko scope ty))+ onExpr sco (VisibleTypeApp val ty)+ | ident `notElem` sco = return (sco ++ peelTypeVars ty, VisibleTypeApp val (skolemize ann ident mbK sko scope ty))+ onExpr sco other = return (sco, other)++ onBinder :: [Text] -> Binder -> Identity ([Text], Binder)+ onBinder sco (TypedBinder ty b)+ | ident `notElem` sco = return (sco ++ peelTypeVars ty, TypedBinder (skolemize ann ident mbK sko scope ty) b)+ onBinder sco other = return (sco, other)++ peelTypeVars :: SourceType -> [Text]+ peelTypeVars (ForAll _ _ i _ ty _) = i : peelTypeVars ty+ peelTypeVars _ = []++-- | Ensure skolem variables do not escape their scope ---skolemEscapeCheck :: Expr -> Check ()+-- Every skolem variable is created when a 'ForAll' type is skolemized.+-- This determines the scope of that skolem variable, which is copied from+-- the 'SkolemScope' field of the 'ForAll' constructor.+--+-- This function traverses the tree top-down, and collects any 'SkolemScope's+-- introduced by 'ForAll's. If a 'Skolem' is encountered whose 'SkolemScope' is+-- not in the current list, then we have found an escaped skolem variable.+skolemEscapeCheck :: MonadError MultipleErrors m => Expr -> m () skolemEscapeCheck (TypedValue False _ _) = return ()-skolemEscapeCheck root@TypedValue{} =- -- Every skolem variable is created when a ForAll type is skolemized.- -- This determines the scope of that skolem variable, which is copied from the SkolemScope- -- field of the ForAll constructor.- -- We traverse the tree top-down, and collect any SkolemScopes introduced by ForAlls.- -- If a Skolem is encountered whose SkolemScope is not in the current list, we have found- -- an escaped skolem variable.- let (_, f, _, _, _) = everythingWithContextOnValues [] [] (++) def go def def def- in case f root of- [] -> return ()- ((binding, val) : _) -> throwError . errorMessage . ErrorInExpression val $ EscapedSkolem binding+skolemEscapeCheck expr@TypedValue{} =+ traverse_ (throwError . singleError) (toSkolemErrors expr) where- def s _ = (s, [])+ toSkolemErrors :: Expr -> [ErrorMessage]+ (_, toSkolemErrors, _, _, _) = everythingWithContextOnValues (mempty, Nothing) [] (<>) def go def def def - go :: [(SkolemScope, Expr)] -> Expr -> ([(SkolemScope, Expr)], [(Maybe Expr, Expr)])- go scos val@(TypedValue _ _ (ForAll _ _ (Just sco))) = ((sco, val) : scos, [])- go scos val@(TypedValue _ _ ty) = case collectSkolems ty \\ map fst scos of- (sco : _) -> (scos, [(findBindingScope sco, val)])- _ -> (scos, [])- where- collectSkolems :: Type -> [SkolemScope]- collectSkolems = nub . everythingOnTypes (++) collect+ def s _ = (s, [])++ go :: (Set SkolemScope, Maybe SourceSpan)+ -> Expr+ -> ((Set SkolemScope, Maybe SourceSpan), [ErrorMessage])+ go (scopes, _) (PositionedValue ss _ _) = ((scopes, Just ss), [])+ go (scopes, ssUsed) val@(TypedValue _ _ ty) =+ ( (allScopes, ssUsed)+ , [ ErrorMessage (maybe id ((:) . positionedError) ssUsed [ ErrorInExpression val ]) $+ EscapedSkolem name (nonEmptySpan ssBound) ty+ | (ssBound, name, scope) <- collectSkolems ty+ , notMember scope allScopes+ ]+ ) where- collect (Skolem _ _ scope) = [scope]- collect _ = []- go scos _ = (scos, [])- findBindingScope :: SkolemScope -> Maybe Expr- findBindingScope sco =- let (_, f, _, _, _) = everythingOnValues mappend (const mempty) go' (const mempty) (const mempty) (const mempty)- in getFirst $ f root- where- go' val@(TypedValue _ _ (ForAll _ _ (Just sco'))) | sco == sco' = First (Just val)- go' _ = mempty-skolemEscapeCheck _ = error "Untyped value passed to skolemEscapeCheck"+ -- Any new skolem scopes introduced by universal quantifiers+ newScopes :: [SkolemScope]+ newScopes = collectScopes ty++ -- All scopes, including new scopes+ allScopes :: Set SkolemScope+ allScopes = fromList newScopes <> scopes++ -- Collect any scopes appearing in quantifiers at the top level+ collectScopes :: SourceType -> [SkolemScope]+ collectScopes (ForAll _ _ _ _ t (Just sco)) = sco : collectScopes t+ collectScopes ForAll{} = internalError "skolemEscapeCheck: No skolem scope"+ collectScopes _ = []++ -- Collect any skolem variables appearing in a type+ collectSkolems :: SourceType -> [(SourceAnn, Text, SkolemScope)]+ collectSkolems = everythingOnTypes (++) collect where+ collect (Skolem ss name _ _ scope) = [(ss, name, scope)]+ collect _ = []+ go scos _ = (scos, [])+skolemEscapeCheck _ = internalError "skolemEscapeCheck: untyped value"
src/Language/PureScript/TypeChecker/Subsumption.hs view
@@ -1,95 +1,130 @@------------------------------------------------------------------------------------ Module : Language.PureScript.TypeChecker.Subsumption--- Copyright : (c) Phil Freeman 2013--- License : MIT+{-# LANGUAGE GADTs #-}++-- | Subsumption checking+module Language.PureScript.TypeChecker.Subsumption+ ( subsumes+ ) where++import Prelude++import Control.Monad (when)+import Control.Monad.Error.Class (MonadError(..))+import Control.Monad.State.Class (MonadState(..))++import Data.Foldable (for_)+import Data.List (uncons)+import Data.List.Ordered (minusBy')+import Data.Ord (comparing)++import Language.PureScript.AST (ErrorMessageHint(..), Expr(..), pattern NullSourceAnn)+import Language.PureScript.Crash (internalError)+import Language.PureScript.Environment (tyFunction, tyRecord)+import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage(..), errorMessage, internalCompilerError)+import Language.PureScript.TypeChecker.Monad (CheckState, getHints, getTypeClassDictionaries, withErrorMessageHint)+import Language.PureScript.TypeChecker.Skolems (newSkolemConstant, skolemize)+import Language.PureScript.TypeChecker.Unify (alignRowsWith, freshTypeWithKind, unifyTypes)+import Language.PureScript.Types (RowListItem(..), SourceType, Type(..), eqType, isREmpty, replaceTypeVars, rowFromList)++-- | Subsumption can operate in two modes: ----- Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :+-- * Elaboration mode, in which we try to insert type class dictionaries+-- * No-elaboration mode, in which we do not insert dictionaries ----- |--- Subsumption checking+-- Some subsumption rules apply in both modes, and others are specific to+-- certain modes. ----------------------------------------------------------------------------------module Language.PureScript.TypeChecker.Subsumption (- subsumes-) where+-- The subsumption algorithm follows the structure of the types in question,+-- and we can switch into no-elaboration mode when we move under a type+-- constructor where we can no longer insert dictionaries, e.g. into the fields+-- of a record.+data Mode = Elaborate | NoElaborate -import Data.List (sortBy)-import Data.Ord (comparing)+-- | Value-level proxies for the two modes+data ModeSing (mode :: Mode) where+ SElaborate :: ModeSing 'Elaborate+ SNoElaborate :: ModeSing 'NoElaborate -import Control.Monad.Except-import Control.Monad.Unify+-- | This type family tracks what evidence we return from 'subsumes' for each+-- mode.+type family Coercion (mode :: Mode) where+ -- When elaborating, we generate a coercion+ Coercion 'Elaborate = Expr -> Expr+ -- When we're not elaborating, we don't generate coercions+ Coercion 'NoElaborate = () -import Language.PureScript.AST-import Language.PureScript.Environment-import Language.PureScript.Errors-import Language.PureScript.TypeChecker.Monad-import Language.PureScript.TypeChecker.Skolems-import Language.PureScript.TypeChecker.Synonyms-import Language.PureScript.TypeChecker.Unify-import Language.PureScript.Types+-- | The default coercion for each mode.+defaultCoercion :: ModeSing mode -> Coercion mode+defaultCoercion SElaborate = id+defaultCoercion SNoElaborate = () --- |--- Check whether one type subsumes another, rethrowing errors to provide a better error message----subsumes :: Maybe Expr -> Type -> Type -> UnifyT Type Check (Maybe Expr)-subsumes val ty1 ty2 = rethrow (onErrorMessages (ErrorInSubsumption ty1 ty2)) $ subsumes' val ty1 ty2+-- | Check that one type subsumes another, rethrowing errors to provide a better error message+subsumes+ :: (MonadError MultipleErrors m, MonadState CheckState m)+ => SourceType+ -> SourceType+ -> m (Expr -> Expr)+subsumes ty1 ty2 =+ withErrorMessageHint (ErrorInSubsumption ty1 ty2) $+ subsumes' SElaborate ty1 ty2 --- |--- Check whether one type subsumes another----subsumes' :: Maybe Expr -> Type -> Type -> UnifyT Type Check (Maybe Expr)-subsumes' val (ForAll ident ty1 _) ty2 = do- replaced <- replaceVarWithUnknown ident ty1- subsumes val replaced ty2-subsumes' val ty1 (ForAll ident ty2 sco) =+-- | Check that one type subsumes another+subsumes'+ :: (MonadError MultipleErrors m, MonadState CheckState m)+ => ModeSing mode+ -> SourceType+ -> SourceType+ -> m (Coercion mode)+subsumes' mode (ForAll _ _ ident mbK ty1 _) ty2 = do+ u <- maybe (internalCompilerError "Unelaborated forall") freshTypeWithKind mbK+ let replaced = replaceTypeVars ident u ty1+ subsumes' mode replaced ty2+subsumes' mode ty1 (ForAll _ _ ident mbK ty2 sco) = case sco of Just sco' -> do sko <- newSkolemConstant- let sk = skolemize ident sko sco' ty2- subsumes val ty1 sk- Nothing -> throwError . errorMessage $ UnspecifiedSkolemScope-subsumes' val (TypeApp (TypeApp f1 arg1) ret1) (TypeApp (TypeApp f2 arg2) ret2) | f1 == tyFunction && f2 == tyFunction = do- _ <- subsumes Nothing arg2 arg1- _ <- subsumes Nothing ret1 ret2- return val-subsumes' val (SaturatedTypeSynonym name tyArgs) ty2 = do- ty1 <- introduceSkolemScope <=< expandTypeSynonym name $ tyArgs- subsumes val ty1 ty2-subsumes' val ty1 (SaturatedTypeSynonym name tyArgs) = do- ty2 <- introduceSkolemScope <=< expandTypeSynonym name $ tyArgs- subsumes val ty1 ty2-subsumes' val (KindedType ty1 _) ty2 =- subsumes val ty1 ty2-subsumes' val ty1 (KindedType ty2 _) =- subsumes val ty1 ty2-subsumes' (Just val) (ConstrainedType constraints ty1) ty2 = do+ let sk = skolemize NullSourceAnn ident mbK sko sco' ty2+ subsumes' mode ty1 sk+ Nothing -> internalError "subsumes: unspecified skolem scope"+subsumes' mode (TypeApp _ (TypeApp _ f1 arg1) ret1) (TypeApp _ (TypeApp _ f2 arg2) ret2) | eqType f1 tyFunction && eqType f2 tyFunction = do+ subsumes' SNoElaborate arg2 arg1+ subsumes' SNoElaborate ret1 ret2+ -- Nothing was elaborated, return the default coercion+ return (defaultCoercion mode)+subsumes' mode (KindedType _ ty1 _) ty2 =+ subsumes' mode ty1 ty2+subsumes' mode ty1 (KindedType _ ty2 _) =+ subsumes' mode ty1 ty2+-- Only check subsumption for constrained types when elaborating.+-- Otherwise fall back to unification.+subsumes' SElaborate (ConstrainedType _ con ty1) ty2 = do dicts <- getTypeClassDictionaries- subsumes' (Just $ foldl App val (map (flip (TypeClassDictionary True) dicts) constraints)) ty1 ty2-subsumes' val (TypeApp f1 r1) (TypeApp f2 r2) | f1 == tyObject && f2 == tyObject = do- let- (ts1, r1') = rowToList r1- (ts2, r2') = rowToList r2- ts1' = sortBy (comparing fst) ts1- ts2' = sortBy (comparing fst) ts2- go ts1' ts2' r1' r2'- return val+ hints <- getHints+ elaborate <- subsumes' SElaborate ty1 ty2+ let addDicts val = App val (TypeClassDictionary con dicts hints)+ return (elaborate . addDicts)+subsumes' mode (TypeApp _ f1 r1) (TypeApp _ f2 r2) | eqType f1 tyRecord && eqType f2 tyRecord = do+ let goWithLabel l t1 t2 = withErrorMessageHint (ErrorInRowLabel l) $ subsumes' SNoElaborate t1 t2+ let (common, ((ts1', r1'), (ts2', r2'))) = alignRowsWith goWithLabel r1 r2+ -- For { ts1 | r1 } to subsume { ts2 | r2 } when r1 is empty (= we're working with a closed row),+ -- every property in ts2 must appear in ts1. If not, then the candidate expression is missing a required property.+ -- Conversely, when r2 is empty, every property in ts1 must appear in ts2, or else the expression has+ -- an additional property which is not allowed.+ when (isREmpty r1')+ (for_ (firstMissingProp ts2' ts1') (throwError . errorMessage . PropertyIsMissing . rowListLabel))+ when (isREmpty r2')+ (for_ (firstMissingProp ts1' ts2') (throwError . errorMessage . AdditionalProperty . rowListLabel))+ -- Check subsumption for common labels+ sequence_ common+ -- Inject the info here+ unifyTypes (rowFromList (ts1', r1')) (rowFromList (ts2', r2'))+ -- Nothing was elaborated, return the default coercion+ return (defaultCoercion mode) where- go [] ts2 r1' r2' = r1' =?= rowFromList (ts2, r2')- go ts1 [] r1' r2' = r2' =?= rowFromList (ts1, r1')- go ((p1, ty1) : ts1) ((p2, ty2) : ts2) r1' r2'- | p1 == p2 = do _ <- subsumes Nothing ty1 ty2- go ts1 ts2 r1' r2'- | p1 < p2 = do rest <- fresh- r2' =?= RCons p1 ty1 rest- go ts1 ((p2, ty2) : ts2) r1' rest- | otherwise = do rest <- fresh- r1' =?= RCons p2 ty2 rest- go ((p1, ty1) : ts1) ts2 rest r2'-subsumes' val ty1 ty2@(TypeApp obj _) | obj == tyObject = subsumes val ty2 ty1-subsumes' val ty1 ty2 = do- ty1 =?= ty2- return val+ -- Find the first property that's in the first list (of tuples) but not in the second+ firstMissingProp t1 t2 = fst <$> uncons (minusBy' (comparing rowListLabel) t1 t2)+subsumes' mode ty1 ty2@(TypeApp _ obj _) | obj == tyRecord =+ subsumes' mode ty2 ty1+subsumes' mode ty1 ty2 = do+ unifyTypes ty1 ty2+ -- Nothing was elaborated, return the default coercion+ return (defaultCoercion mode)
src/Language/PureScript/TypeChecker/Synonyms.hs view
@@ -1,111 +1,62 @@------------------------------------------------------------------------------------ Module : Language.PureScript.TypeChecker.Synonyms--- Copyright : (c) Phil Freeman 2013--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :---+{-# LANGUAGE GADTs #-}+ -- |--- Functions for replacing fully applied type synonyms with the @SaturatedTypeSynonym@ data constructor+-- Functions for replacing fully applied type synonyms ----------------------------------------------------------------------------------{-# LANGUAGE FlexibleContexts, MultiParamTypeClasses, GADTs #-}+module Language.PureScript.TypeChecker.Synonyms+ ( SynonymMap+ , KindMap+ , replaceAllTypeSynonyms+ ) where -module Language.PureScript.TypeChecker.Synonyms (- saturateAllTypeSynonyms,- desaturateAllTypeSynonyms,- replaceAllTypeSynonyms,- expandAllTypeSynonyms,- expandTypeSynonym,- expandTypeSynonym'-) where+import Prelude +import Control.Monad.Error.Class (MonadError(..))+import Control.Monad.State (MonadState) import Data.Maybe (fromMaybe)-import qualified Data.Map as M--import Control.Applicative-import Control.Monad.Except-import Control.Monad.State+import Data.Map qualified as M+import Data.Text (Text)+import Language.PureScript.Environment (Environment(..), TypeKind)+import Language.PureScript.Errors (MultipleErrors, SimpleErrorMessage(..), SourceSpan, errorMessage')+import Language.PureScript.Names (ProperName, ProperNameType(..), Qualified)+import Language.PureScript.TypeChecker.Monad (CheckState, getEnv)+import Language.PureScript.Types (SourceType, Type(..), completeBinderList, everywhereOnTypesTopDownM, getAnnForType, replaceAllTypeVars) -import Language.PureScript.Environment-import Language.PureScript.Errors-import Language.PureScript.Names-import Language.PureScript.TypeChecker.Monad-import Language.PureScript.Types+-- | Type synonym information (arguments with kinds, aliased type), indexed by name+type SynonymMap = M.Map (Qualified (ProperName 'TypeName)) ([(Text, Maybe SourceType)], SourceType) --- |--- Build a type substitution for a type synonym----buildTypeSubstitution :: Qualified ProperName -> Int -> Type -> Either ErrorMessage (Maybe Type)-buildTypeSubstitution name n = go n []- where- go :: Int -> [Type] -> Type -> Either ErrorMessage (Maybe Type)- go 0 args (TypeConstructor ctor) | name == ctor = return (Just $ SaturatedTypeSynonym ctor args)- go m _ (TypeConstructor ctor) | m > 0 && name == ctor = throwError $ PartiallyAppliedSynonym name- go m args (TypeApp f arg) = go (m - 1) (arg:args) f- go _ _ _ = return Nothing+type KindMap = M.Map (Qualified (ProperName 'TypeName)) (SourceType, TypeKind) --- |--- Replace all instances of a specific type synonym with the @SaturatedTypeSynonym@ data constructor----saturateTypeSynonym :: Qualified ProperName -> Int -> Type -> Either ErrorMessage Type-saturateTypeSynonym name n = everywhereOnTypesTopDownM replace+replaceAllTypeSynonyms'+ :: SynonymMap+ -> KindMap+ -> SourceType+ -> Either MultipleErrors SourceType+replaceAllTypeSynonyms' syns kinds = everywhereOnTypesTopDownM try where- replace t = fromMaybe t <$> buildTypeSubstitution name n t---- |--- Replace all type synonyms with the @SaturatedTypeSynonym@ data constructor----saturateAllTypeSynonyms :: [(Qualified ProperName, Int)] -> Type -> Either ErrorMessage Type-saturateAllTypeSynonyms syns d = foldM (\result (name, n) -> saturateTypeSynonym name n result) d syns+ try :: SourceType -> Either MultipleErrors SourceType+ try t = fromMaybe t <$> go (fst $ getAnnForType t) 0 [] [] t --- |--- \"Desaturate\" @SaturatedTypeSynonym@s----desaturateAllTypeSynonyms :: Type -> Type-desaturateAllTypeSynonyms = everywhereOnTypes replaceSaturatedTypeSynonym- where- replaceSaturatedTypeSynonym (SaturatedTypeSynonym name args) = foldl TypeApp (TypeConstructor name) args- replaceSaturatedTypeSynonym t = t+ go :: SourceSpan -> Int -> [SourceType] -> [SourceType] -> SourceType -> Either MultipleErrors (Maybe SourceType)+ go ss c kargs args (TypeConstructor _ ctor)+ | Just (synArgs, body) <- M.lookup ctor syns+ , c == length synArgs+ , kindArgs <- lookupKindArgs ctor+ , length kargs == length kindArgs+ = let repl = replaceAllTypeVars (zip (map fst synArgs) args <> zip kindArgs kargs) body+ in Just <$> try repl+ | Just (synArgs, _) <- M.lookup ctor syns+ , length synArgs > c+ = throwError . errorMessage' ss $ PartiallyAppliedSynonym ctor+ go ss c kargs args (TypeApp _ f arg) = go ss (c + 1) kargs (arg : args) f+ go ss c kargs args (KindApp _ f arg) = go ss c (arg : kargs) args f+ go _ _ _ _ _ = return Nothing --- |--- Replace fully applied type synonyms with the @SaturatedTypeSynonym@ data constructor, which helps generate--- better error messages during unification.----replaceAllTypeSynonyms' :: Environment -> Type -> Either ErrorMessage Type-replaceAllTypeSynonyms' env d =- let- syns = map (\(name, (args, _)) -> (name, length args)) . M.toList $ typeSynonyms env- in- saturateAllTypeSynonyms syns d+ lookupKindArgs :: Qualified (ProperName 'TypeName) -> [Text]+ lookupKindArgs ctor = fromMaybe [] $ fmap (fmap (fst . snd) . fst) . completeBinderList . fst =<< M.lookup ctor kinds -replaceAllTypeSynonyms :: (e ~ MultipleErrors, Functor m, Monad m, MonadState CheckState m, MonadError e m) => Type -> m Type+-- | Replace fully applied type synonyms+replaceAllTypeSynonyms :: (e ~ MultipleErrors, MonadState CheckState m, MonadError e m) => SourceType -> m SourceType replaceAllTypeSynonyms d = do env <- getEnv- either (throwError . errorMessage) return $ replaceAllTypeSynonyms' env d---- |--- Replace a type synonym and its arguments with the aliased type----expandTypeSynonym' :: Environment -> Qualified ProperName -> [Type] -> Either ErrorMessage Type-expandTypeSynonym' env name args =- case M.lookup name (typeSynonyms env) of- Just (synArgs, body) -> do- let repl = replaceAllTypeVars (zip (map fst synArgs) args) body- replaceAllTypeSynonyms' env repl- Nothing -> error "Type synonym was not defined"--expandTypeSynonym :: (e ~ MultipleErrors, Functor m, Monad m, MonadState CheckState m, MonadError e m) => Qualified ProperName -> [Type] -> m Type-expandTypeSynonym name args = do- env <- getEnv- either (throwError . errorMessage) return $ expandTypeSynonym' env name args--expandAllTypeSynonyms :: (e ~ MultipleErrors, Functor m, Applicative m, Monad m, MonadState CheckState m, MonadError e m) => Type -> m Type-expandAllTypeSynonyms = everywhereOnTypesTopDownM go- where- go (SaturatedTypeSynonym name args) = expandTypeSynonym name args- go other = return other+ either throwError return $ replaceAllTypeSynonyms' (typeSynonyms env) (types env) d
+ src/Language/PureScript/TypeChecker/TypeSearch.hs view
@@ -0,0 +1,133 @@+module Language.PureScript.TypeChecker.TypeSearch+ ( typeSearch+ ) where++import Protolude++import Control.Monad.Writer (WriterT, runWriterT)+import Data.Map qualified as Map+import Language.PureScript.TypeChecker.Entailment qualified as Entailment++import Language.PureScript.TypeChecker.Monad qualified as TC+import Language.PureScript.TypeChecker.Subsumption (subsumes)+import Language.PureScript.TypeChecker.Unify as P++import Control.Monad.Supply as P+import Language.PureScript.AST as P+import Language.PureScript.Environment as P+import Language.PureScript.Errors as P+import Language.PureScript.Label (Label)+import Language.PureScript.Names as P+import Language.PureScript.Pretty.Types as P+import Language.PureScript.TypeChecker.Skolems as Skolem+import Language.PureScript.TypeChecker.Synonyms as P+import Language.PureScript.Types as P++checkInEnvironment+ :: Environment+ -> TC.CheckState+ -> StateT TC.CheckState (SupplyT (WriterT b (Except P.MultipleErrors))) a+ -> Maybe (a, Environment)+checkInEnvironment env st =+ either (const Nothing) Just+ . runExcept+ . evalWriterT+ . P.evalSupplyT 0+ . TC.runCheck (st { TC.checkEnv = env })++evalWriterT :: Monad m => WriterT b m r -> m r+evalWriterT m = fmap fst (runWriterT m)++checkSubsume+ :: Maybe [(P.Ident, Entailment.InstanceContext, P.SourceConstraint)]+ -- ^ Additional constraints we need to satisfy+ -> P.Environment+ -- ^ The Environment which contains the relevant definitions and typeclasses+ -> TC.CheckState+ -- ^ The typechecker state+ -> P.SourceType+ -- ^ The user supplied type+ -> P.SourceType+ -- ^ The type supplied by the environment+ -> Maybe ((P.Expr, [(P.Ident, Entailment.InstanceContext, P.SourceConstraint)]), P.Environment)+checkSubsume unsolved env st userT envT = checkInEnvironment env st $ do+ let initializeSkolems =+ Skolem.introduceSkolemScope+ <=< P.replaceAllTypeSynonyms+ <=< P.replaceTypeWildcards++ userT' <- initializeSkolems userT+ envT' <- initializeSkolems envT++ let dummyExpression = P.Var nullSourceSpan (P.Qualified P.ByNullSourcePos (P.Ident "x"))++ elab <- subsumes envT' userT'+ subst <- gets TC.checkSubstitution+ let expP = P.overTypes (P.substituteType subst) (elab dummyExpression)++ -- Now check that any unsolved constraints have not become impossible+ (traverse_ . traverse_) (\(_, context, constraint) -> do+ let constraint' = P.mapConstraintArgs (map (P.substituteType subst)) constraint+ flip evalStateT Map.empty . evalWriterT $+ Entailment.entails+ (Entailment.SolverOptions+ { solverShouldGeneralize = True+ , solverDeferErrors = False+ }) constraint' context []) unsolved++ -- Finally, check any constraints which were found during elaboration+ Entailment.replaceTypeClassDictionaries (isJust unsolved) expP++accessorSearch+ :: Maybe [(P.Ident, Entailment.InstanceContext, P.SourceConstraint)]+ -> P.Environment+ -> TC.CheckState+ -> P.SourceType+ -> ([(Label, P.SourceType)], [(Label, P.SourceType)])+ -- ^ (all accessors we found, all accessors we found that match the result type)+accessorSearch unsolved env st userT = maybe ([], []) fst $ checkInEnvironment env st $ do+ let initializeSkolems =+ Skolem.introduceSkolemScope+ <=< P.replaceAllTypeSynonyms+ <=< P.replaceTypeWildcards++ userT' <- initializeSkolems userT++ rowType <- freshTypeWithKind (P.kindRow P.kindType)+ resultType <- freshTypeWithKind P.kindType+ let recordFunction = srcTypeApp (srcTypeApp tyFunction (srcTypeApp tyRecord rowType)) resultType+ _ <- subsumes recordFunction userT'+ subst <- gets TC.checkSubstitution+ let solvedRow = toRowPair <$> fst (rowToList (substituteType subst rowType))+ tcS <- get+ pure (solvedRow, filter (\x -> checkAccessor tcS (substituteType subst resultType) x) solvedRow)+ where+ checkAccessor tcs x (_, type') = isJust (checkSubsume unsolved env tcs x type')+ toRowPair (RowListItem _ lbl ty) = (lbl, ty)++typeSearch+ :: Maybe [(P.Ident, Entailment.InstanceContext, P.SourceConstraint)]+ -- ^ Additional constraints we need to satisfy+ -> P.Environment+ -- ^ The Environment which contains the relevant definitions and typeclasses+ -> TC.CheckState+ -- ^ The typechecker state+ -> P.SourceType+ -- ^ The type we are looking for+ -> ([(P.Qualified Text, P.SourceType)], Maybe [(Label, P.SourceType)])+typeSearch unsolved env st type' =+ let+ runTypeSearch :: Map k P.SourceType -> Map k P.SourceType+ runTypeSearch = Map.mapMaybe (\ty -> checkSubsume unsolved env st type' ty $> ty)++ matchingNames = runTypeSearch (Map.map (\(ty, _, _) -> ty) (P.names env))+ matchingConstructors = runTypeSearch (Map.map (\(_, _, ty, _) -> ty) (P.dataConstructors env))+ (allLabels, matchingLabels) = accessorSearch unsolved env st type'++ runPlainIdent (Qualified m (Ident k), v) = Just (Qualified m k, v)+ runPlainIdent _ = Nothing+ in+ ( (first (P.Qualified P.ByNullSourcePos . ("_." <>) . P.prettyPrintLabel) <$> matchingLabels)+ <> mapMaybe runPlainIdent (Map.toList matchingNames)+ <> (first (map P.runProperName) <$> Map.toList matchingConstructors)+ , if null allLabels then Nothing else Just allLabels)
src/Language/PureScript/TypeChecker/Types.hs view
@@ -1,667 +1,1040 @@------------------------------------------------------------------------------------ Module : Language.PureScript.TypeChecker.Types--- Copyright : (c) Phil Freeman 2013--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ |--- This module implements the type checker-----------------------------------------------------------------------------------{-# LANGUAGE FlexibleContexts, MultiParamTypeClasses, OverloadedStrings #-}--module Language.PureScript.TypeChecker.Types (- typesOf-) where--{-- The following functions represent the corresponding type checking judgements:-- infer- Synthesize a type for a value-- check- Check a value has a given type-- checkProperties- Check an object with a given type contains specified properties-- checkFunctionApplication- Check a function of a given type returns a value of another type when applied to its arguments--}--import Data.Either (lefts, rights)-import Data.List-import Data.Maybe (fromMaybe)-import qualified Data.Map as M--import Control.Applicative-import Control.Monad.Except-import Control.Monad.State-import Control.Monad.Unify--import Language.PureScript.AST-import Language.PureScript.Environment-import Language.PureScript.Errors-import Language.PureScript.Kinds-import Language.PureScript.Names-import Language.PureScript.Traversals-import Language.PureScript.TypeChecker.Entailment-import Language.PureScript.TypeChecker.Kinds-import Language.PureScript.TypeChecker.Monad-import Language.PureScript.TypeChecker.Rows-import Language.PureScript.TypeChecker.Skolems-import Language.PureScript.TypeChecker.Subsumption-import Language.PureScript.TypeChecker.Synonyms-import Language.PureScript.TypeChecker.Unify-import Language.PureScript.TypeClassDictionaries-import Language.PureScript.Types-import qualified Language.PureScript.Constants as C---- |--- Infer the types of multiple mutually-recursive values, and return elaborated values including--- type class dictionaries and type annotations.----typesOf :: Maybe ModuleName -> ModuleName -> [(Ident, Expr)] -> Check [(Ident, (Expr, Type))]-typesOf mainModuleName moduleName vals = do- tys <- fmap tidyUp . liftUnify $ do- (untyped, typed, dict, untypedDict) <- typeDictionaryForBindingGroup moduleName vals- ds1 <- parU typed $ \e -> do- triple@(_, (_, ty)) <- checkTypedBindingGroupElement moduleName e dict- checkMain (fst e) ty- return triple- ds2 <- forM untyped $ \e -> do- triple@(_, (_, ty)) <- typeForBindingGroupElement e dict untypedDict- checkMain (fst e) ty- return triple- return $ ds1 ++ ds2-- forM tys $ \(ident, (val, ty)) -> do- -- Replace type class dictionary placeholders with actual dictionaries- val' <- replaceTypeClassDictionaries moduleName val- -- Check skolem variables did not escape their scope- skolemEscapeCheck val'- -- Check rows do not contain duplicate labels- checkDuplicateLabels val'- -- Remove type synonyms placeholders, and replace- -- top-level unification variables with named type variables.- let val'' = overTypes desaturateAllTypeSynonyms val'- ty' = varIfUnknown . desaturateAllTypeSynonyms $ ty- return (ident, (val'', ty'))- where- -- Apply the substitution that was returned from runUnify to both types and (type-annotated) values- tidyUp (ts, sub) = map (\(i, (val, ty)) -> (i, (overTypes (sub $?) val, sub $? ty))) ts- -- If --main is enabled, need to check that `main` has type Eff eff a for some eff, a- checkMain nm ty = when (Just moduleName == mainModuleName && nm == Ident C.main) $ do- [eff, a] <- replicateM 2 fresh- ty =?= TypeApp (TypeApp (TypeConstructor (Qualified (Just (ModuleName [ProperName "Control", ProperName "Monad", ProperName "Eff"])) (ProperName "Eff"))) eff) a--type TypeData = M.Map (ModuleName, Ident) (Type, NameKind, NameVisibility)--type UntypedData = [(Ident, Type)]--typeDictionaryForBindingGroup :: ModuleName -> [(Ident, Expr)] -> UnifyT Type Check ([(Ident, Expr)], [(Ident, (Expr, Type, Bool))], TypeData, UntypedData)-typeDictionaryForBindingGroup moduleName vals = do- let- -- Map each declaration to a name/value pair, with an optional type, if the declaration is typed- es = map isTyped vals- -- Filter the typed and untyped declarations- untyped = lefts es- typed = rights es- -- Make a map of names to typed declarations- typedDict = map (\(ident, (_, ty, _)) -> (ident, ty)) typed-- -- Create fresh unification variables for the types of untyped declarations- untypedNames <- replicateM (length untyped) fresh-- let- -- Make a map of names to the unification variables of untyped declarations- untypedDict = zip (map fst untyped) untypedNames- -- Create the dictionary of all name/type pairs, which will be added to the environment during type checking- dict = M.fromList (map (\(ident, ty) -> ((moduleName, ident), (ty, LocalVariable, Undefined))) $ typedDict ++ untypedDict)- return (untyped, typed, dict, untypedDict)--checkTypedBindingGroupElement :: ModuleName -> (Ident, (Expr, Type, Bool)) -> TypeData -> UnifyT Type Check (Ident, (Expr, Type))-checkTypedBindingGroupElement mn (ident, (val', ty, checkType)) dict = do- -- Replace type wildcards- ty' <- replaceTypeWildcards ty- -- Kind check- (kind, args) <- liftCheck $ kindOfWithScopedVars ty- checkTypeKind kind- -- Check the type with the new names in scope- ty'' <- introduceSkolemScope <=< replaceAllTypeSynonyms <=< replaceTypeWildcards $ ty'- val'' <- if checkType- then withScopedTypeVars mn args $ bindNames dict $ TypedValue True <$> check val' ty'' <*> pure ty''- else return (TypedValue False val' ty'')- return (ident, (val'', ty''))--typeForBindingGroupElement :: (Ident, Expr) -> TypeData -> UntypedData -> UnifyT Type Check (Ident, (Expr, Type))-typeForBindingGroupElement (ident, val) dict untypedDict = do- -- Infer the type with the new names in scope- TypedValue _ val' ty <- bindNames dict $ infer val- ty =?= fromMaybe (error "name not found in dictionary") (lookup ident untypedDict)- return (ident, (TypedValue True val' ty, ty))---- |--- Check if a value contains a type annotation----isTyped :: (Ident, Expr) -> Either (Ident, Expr) (Ident, (Expr, Type, Bool))-isTyped (name, TypedValue checkType value ty) = Right (name, (value, ty, checkType))-isTyped (name, value) = Left (name, value)---- |--- Map a function over type annotations appearing inside a value----overTypes :: (Type -> Type) -> Expr -> Expr-overTypes f = let (_, f', _) = everywhereOnValues id g id in f'- where- g :: Expr -> Expr- g (TypedValue checkTy val t) = TypedValue checkTy val (f t)- g (TypeClassDictionary b (nm, tys) sco) = TypeClassDictionary b (nm, map f tys) sco- g other = other---- |--- Replace type class dictionary placeholders with inferred type class dictionaries----replaceTypeClassDictionaries :: ModuleName -> Expr -> Check Expr-replaceTypeClassDictionaries mn =- let (_, f, _) = everywhereOnValuesTopDownM return go return- in f- where- go (TypeClassDictionary trySuperclasses constraint dicts) = do- env <- getEnv- entails env mn dicts constraint trySuperclasses- go other = return other---- |--- Check the kind of a type, failing if it is not of kind *.----checkTypeKind :: Kind -> UnifyT t Check ()-checkTypeKind kind = guardWith (errorMessage (ExpectedType kind)) $ kind == Star---- |--- Remove any ForAlls and ConstrainedType constructors in a type by introducing new unknowns--- or TypeClassDictionary values.------ This is necessary during type checking to avoid unifying a polymorphic type with a--- unification variable.----instantiatePolyTypeWithUnknowns :: Expr -> Type -> UnifyT Type Check (Expr, Type)-instantiatePolyTypeWithUnknowns val (ForAll ident ty _) = do- ty' <- replaceVarWithUnknown ident ty- instantiatePolyTypeWithUnknowns val ty'-instantiatePolyTypeWithUnknowns val (ConstrainedType constraints ty) = do- dicts <- getTypeClassDictionaries- (_, ty') <- instantiatePolyTypeWithUnknowns (error "Types under a constraint cannot themselves be constrained") ty- return (foldl App val (map (flip (TypeClassDictionary True) dicts) constraints), ty')-instantiatePolyTypeWithUnknowns val ty = return (val, ty)---- |--- Infer a type for a value, rethrowing any error to provide a more useful error message----infer :: Expr -> UnifyT Type Check Expr-infer val = rethrow (onErrorMessages (ErrorInferringType val)) $ infer' val---- |--- Infer a type for a value----infer' :: Expr -> UnifyT Type Check Expr-infer' v@(NumericLiteral _) = return $ TypedValue True v tyNumber-infer' v@(StringLiteral _) = return $ TypedValue True v tyString-infer' v@(BooleanLiteral _) = return $ TypedValue True v tyBoolean-infer' (ArrayLiteral vals) = do- ts <- mapM infer vals- els <- fresh- forM_ ts $ \(TypedValue _ _ t) -> els =?= t- return $ TypedValue True (ArrayLiteral ts) (TypeApp tyArray els)-infer' (ObjectLiteral ps) = do- ensureNoDuplicateProperties ps- ts <- mapM (infer . snd) ps- let fields = zipWith (\name (TypedValue _ _ t) -> (name, t)) (map fst ps) ts- ty = TypeApp tyObject $ rowFromList (fields, REmpty)- return $ TypedValue True (ObjectLiteral (zip (map fst ps) ts)) ty-infer' (ObjectUpdate o ps) = do- ensureNoDuplicateProperties ps- row <- fresh- newVals <- zipWith (\(name, _) t -> (name, t)) ps <$> mapM (infer . snd) ps- let newTys = map (\(name, TypedValue _ _ ty) -> (name, ty)) newVals- oldTys <- zip (map fst ps) <$> replicateM (length ps) fresh- let oldTy = TypeApp tyObject $ rowFromList (oldTys, row)- o' <- TypedValue True <$> check o oldTy <*> pure oldTy- return $ TypedValue True (ObjectUpdate o' newVals) $ TypeApp tyObject $ rowFromList (newTys, row)-infer' (Accessor prop val) = do- typed@(TypedValue _ _ objTy) <- infer val- propTy <- inferProperty objTy prop- case propTy of- Nothing -> do- field <- fresh- rest <- fresh- _ <- subsumes Nothing objTy (TypeApp tyObject (RCons prop field rest))- return $ TypedValue True (Accessor prop typed) field- Just ty -> return $ TypedValue True (Accessor prop typed) ty-infer' (Abs (Left arg) ret) = do- ty <- fresh- Just moduleName <- checkCurrentModule <$> get- makeBindingGroupVisible $ bindLocalVariables moduleName [(arg, ty, Defined)] $ do- body@(TypedValue _ _ bodyTy) <- infer' ret- return $ TypedValue True (Abs (Left arg) body) $ function ty bodyTy-infer' (Abs (Right _) _) = error "Binder was not desugared"-infer' (App f arg) = do- f'@(TypedValue _ _ ft) <- infer f- (ret, app) <- checkFunctionApplication f' ft arg Nothing- return $ TypedValue True app ret-infer' (Var var) = do- Just moduleName <- checkCurrentModule <$> get- checkVisibility moduleName var- ty <- introduceSkolemScope <=< replaceAllTypeSynonyms <=< replaceTypeWildcards <=< lookupVariable moduleName $ var- case ty of- ConstrainedType constraints ty' -> do- dicts <- getTypeClassDictionaries- return $ TypedValue True (foldl App (Var var) (map (flip (TypeClassDictionary True) dicts) constraints)) ty'- _ -> return $ TypedValue True (Var var) ty-infer' v@(Constructor c) = do- env <- getEnv- case M.lookup c (dataConstructors env) of- Nothing -> throwError . errorMessage $ UnknownDataConstructor c Nothing- Just (_, _, ty, _) -> do (v', ty') <- sndM (introduceSkolemScope <=< replaceAllTypeSynonyms) <=< instantiatePolyTypeWithUnknowns v $ ty- return $ TypedValue True v' ty'-infer' (Case vals binders) = do- ts <- mapM infer vals- ret <- fresh- binders' <- checkBinders (map (\(TypedValue _ _ t) -> t) ts) ret binders- return $ TypedValue True (Case ts binders') ret-infer' (IfThenElse cond th el) = do- cond' <- check cond tyBoolean- v2@(TypedValue _ _ t2) <- infer th- v3@(TypedValue _ _ t3) <- infer el- (v2', v3', t) <- meet v2 v3 t2 t3- return $ TypedValue True (IfThenElse cond' v2' v3') t-infer' (Let ds val) = do- (ds', val'@(TypedValue _ _ valTy)) <- inferLetBinding [] ds val infer- return $ TypedValue True (Let ds' val') valTy-infer' (SuperClassDictionary className tys) = do- dicts <- getTypeClassDictionaries- return $ TypeClassDictionary False (className, tys) dicts-infer' (TypedValue checkType val ty) = do- Just moduleName <- checkCurrentModule <$> get- (kind, args) <- liftCheck $ kindOfWithScopedVars ty- checkTypeKind kind- ty' <- introduceSkolemScope <=< replaceAllTypeSynonyms <=< replaceTypeWildcards $ ty- val' <- if checkType then withScopedTypeVars moduleName args (check val ty') else return val- return $ TypedValue True val' ty'-infer' (PositionedValue pos _ val) = rethrowWithPosition pos $ infer' val-infer' _ = error "Invalid argument to infer"--inferLetBinding :: [Declaration] -> [Declaration] -> Expr -> (Expr -> UnifyT Type Check Expr) -> UnifyT Type Check ([Declaration], Expr)-inferLetBinding seen [] ret j = (,) seen <$> makeBindingGroupVisible (j ret)-inferLetBinding seen (ValueDeclaration ident nameKind [] (Right (tv@(TypedValue checkType val ty))) : rest) ret j = do- Just moduleName <- checkCurrentModule <$> get- (kind, args) <- liftCheck $ kindOfWithScopedVars ty- checkTypeKind kind- let dict = M.singleton (moduleName, ident) (ty, nameKind, Undefined)- ty' <- introduceSkolemScope <=< replaceAllTypeSynonyms <=< replaceTypeWildcards $ ty- TypedValue _ val' ty'' <- if checkType then withScopedTypeVars moduleName args (bindNames dict (check val ty')) else return tv- bindNames (M.singleton (moduleName, ident) (ty'', nameKind, Defined)) $ inferLetBinding (seen ++ [ValueDeclaration ident nameKind [] (Right (TypedValue checkType val' ty''))]) rest ret j-inferLetBinding seen (ValueDeclaration ident nameKind [] (Right val) : rest) ret j = do- valTy <- fresh- Just moduleName <- checkCurrentModule <$> get- let dict = M.singleton (moduleName, ident) (valTy, nameKind, Undefined)- TypedValue _ val' valTy' <- bindNames dict $ infer val- valTy =?= valTy'- bindNames (M.singleton (moduleName, ident) (valTy', nameKind, Defined)) $ inferLetBinding (seen ++ [ValueDeclaration ident nameKind [] (Right val')]) rest ret j-inferLetBinding seen (BindingGroupDeclaration ds : rest) ret j = do- Just moduleName <- checkCurrentModule <$> get- (untyped, typed, dict, untypedDict) <- typeDictionaryForBindingGroup moduleName (map (\(i, _, v) -> (i, v)) ds)- ds1' <- parU typed $ \e -> checkTypedBindingGroupElement moduleName e dict- ds2' <- forM untyped $ \e -> typeForBindingGroupElement e dict untypedDict- let ds' = [(ident, LocalVariable, val') | (ident, (val', _)) <- ds1' ++ ds2']- makeBindingGroupVisible $ bindNames dict $ inferLetBinding (seen ++ [BindingGroupDeclaration ds']) rest ret j-inferLetBinding seen (PositionedDeclaration pos com d : ds) ret j = rethrowWithPosition pos $ do- (d' : ds', val') <- inferLetBinding seen (d : ds) ret j- return (PositionedDeclaration pos com d' : ds', val')-inferLetBinding _ _ _ _ = error "Invalid argument to inferLetBinding"---- |--- Infer the type of a property inside a record with a given type----inferProperty :: Type -> String -> UnifyT Type Check (Maybe Type)-inferProperty (TypeApp obj row) prop | obj == tyObject = do- let (props, _) = rowToList row- return $ lookup prop props-inferProperty (SaturatedTypeSynonym name args) prop = do- replaced <- introduceSkolemScope <=< expandTypeSynonym name $ args- inferProperty replaced prop-inferProperty (ForAll ident ty _) prop = do- replaced <- replaceVarWithUnknown ident ty- inferProperty replaced prop-inferProperty _ _ = return Nothing---- |--- Infer the types of variables brought into scope by a binder----inferBinder :: Type -> Binder -> UnifyT Type Check (M.Map Ident Type)-inferBinder _ NullBinder = return M.empty-inferBinder val (StringBinder _) = val =?= tyString >> return M.empty-inferBinder val (NumberBinder _) = val =?= tyNumber >> return M.empty-inferBinder val (BooleanBinder _) = val =?= tyBoolean >> return M.empty-inferBinder val (VarBinder name) = return $ M.singleton name val-inferBinder val (ConstructorBinder ctor binders) = do- env <- getEnv- case M.lookup ctor (dataConstructors env) of- Just (_, _, ty, _) -> do- (_, fn) <- instantiatePolyTypeWithUnknowns (error "Data constructor types cannot contain constraints") ty- fn' <- introduceSkolemScope <=< replaceAllTypeSynonyms $ fn- go binders fn'- where- go [] ty' = do- _ <- subsumes Nothing val ty'- return M.empty- go (binder : binders') (TypeApp (TypeApp t obj) ret) | t == tyFunction =- M.union <$> inferBinder obj binder <*> go binders' ret- go _ _ = throwError . errorMessage $ IncorrectConstructorArity ctor- _ -> throwError . errorMessage $ UnknownDataConstructor ctor Nothing-inferBinder val (ObjectBinder props) = do- row <- fresh- rest <- fresh- m1 <- inferRowProperties row rest props- val =?= TypeApp tyObject row- return m1- where- inferRowProperties :: Type -> Type -> [(String, Binder)] -> UnifyT Type Check (M.Map Ident Type)- inferRowProperties nrow row [] = nrow =?= row >> return M.empty- inferRowProperties nrow row ((name, binder):binders) = do- propTy <- fresh- m1 <- inferBinder propTy binder- m2 <- inferRowProperties nrow (RCons name propTy row) binders- return $ m1 `M.union` m2-inferBinder val (ArrayBinder binders) = do- el <- fresh- m1 <- M.unions <$> mapM (inferBinder el) binders- val =?= TypeApp tyArray el- return m1-inferBinder val (ConsBinder headBinder tailBinder) = do- el <- fresh- m1 <- inferBinder el headBinder- m2 <- inferBinder val tailBinder- val =?= TypeApp tyArray el- return $ m1 `M.union` m2-inferBinder val (NamedBinder name binder) = do- m <- inferBinder val binder- return $ M.insert name val m-inferBinder val (PositionedBinder pos _ binder) =- rethrowWithPosition pos $ inferBinder val binder---- |--- Check the types of the return values in a set of binders in a case statement----checkBinders :: [Type] -> Type -> [CaseAlternative] -> UnifyT Type Check [CaseAlternative]-checkBinders _ _ [] = return []-checkBinders nvals ret (CaseAlternative binders result : bs) = do- guardWith (errorMessage $ OverlappingArgNames Nothing) $- let ns = concatMap binderNames binders in length (nub ns) == length ns- Just moduleName <- checkCurrentModule <$> get- m1 <- M.unions <$> zipWithM inferBinder nvals binders- r <- bindLocalVariables moduleName [ (name, ty, Defined) | (name, ty) <- M.toList m1 ] $- CaseAlternative binders <$>- case result of- Left gs -> do- gs' <- forM gs $ \(grd, val) -> do- grd' <- check grd tyBoolean- val' <- TypedValue True <$> check val ret <*> pure ret- return (grd', val')- return $ Left gs'- Right val -> do- val' <- TypedValue True <$> check val ret <*> pure ret- return $ Right val'- rs <- checkBinders nvals ret bs- return $ r : rs---- |--- Check the type of a value, rethrowing errors to provide a better error message----check :: Expr -> Type -> UnifyT Type Check Expr-check val ty = rethrow (onErrorMessages (ErrorCheckingType val ty)) $ check' val ty---- |--- Check the type of a value----check' :: Expr -> Type -> UnifyT Type Check Expr-check' val (ForAll ident ty _) = do- scope <- newSkolemScope- sko <- newSkolemConstant- let sk = skolemize ident sko scope ty- let skVal = skolemizeTypesInValue ident sko scope val- val' <- check skVal sk- return $ TypedValue True val' (ForAll ident ty (Just scope))-check' val t@(ConstrainedType constraints ty) = do- dictNames <- forM constraints $ \(Qualified _ (ProperName className), _) -> do- n <- liftCheck freshDictionaryName- return $ Ident $ "__dict_" ++ className ++ "_" ++ show n- val' <- makeBindingGroupVisible $ withTypeClassDictionaries (zipWith (\name (className, instanceTy) ->- TypeClassDictionaryInScope name className instanceTy Nothing TCDRegular False) (map (Qualified Nothing) dictNames)- constraints) $ check val ty- return $ TypedValue True (foldr (Abs . Left) val' dictNames) t-check' val (SaturatedTypeSynonym name args) = do- ty <- introduceSkolemScope <=< expandTypeSynonym name $ args- check val ty-check' val u@(TUnknown _) = do- val'@(TypedValue _ _ ty) <- infer val- -- Don't unify an unknown with an inferred polytype- (val'', ty') <- instantiatePolyTypeWithUnknowns val' ty- ty' =?= u- return $ TypedValue True val'' ty'-check' v@(NumericLiteral _) t | t == tyNumber =- return $ TypedValue True v t-check' v@(StringLiteral _) t | t == tyString =- return $ TypedValue True v t-check' v@(BooleanLiteral _) t | t == tyBoolean =- return $ TypedValue True v t-check' (ArrayLiteral vals) t@(TypeApp a ty) = do- a =?= tyArray- array <- ArrayLiteral <$> forM vals (`check` ty)- return $ TypedValue True array t-check' (Abs (Left arg) ret) ty@(TypeApp (TypeApp t argTy) retTy) = do- t =?= tyFunction- Just moduleName <- checkCurrentModule <$> get- ret' <- makeBindingGroupVisible $ bindLocalVariables moduleName [(arg, argTy, Defined)] $ check ret retTy- return $ TypedValue True (Abs (Left arg) ret') ty-check' (Abs (Right _) _) _ = error "Binder was not desugared"-check' (App f arg) ret = do- f'@(TypedValue _ _ ft) <- infer f- (_, app) <- checkFunctionApplication f' ft arg (Just ret)- return $ TypedValue True app ret-check' v@(Var var) ty = do- Just moduleName <- checkCurrentModule <$> get- checkVisibility moduleName var- repl <- introduceSkolemScope <=< replaceAllTypeSynonyms <=< lookupVariable moduleName $ var- ty' <- introduceSkolemScope <=< replaceAllTypeSynonyms <=< replaceTypeWildcards $ ty- v' <- subsumes (Just v) repl ty'- case v' of- Nothing -> throwError . errorMessage $ SubsumptionCheckFailed- Just v'' -> return $ TypedValue True v'' ty'-check' (SuperClassDictionary className tys) _ = do- {-- -- Here, we replace a placeholder for a superclass dictionary with a regular- -- TypeClassDictionary placeholder. The reason we do this is that it is necessary to have the- -- correct super instance dictionaries in scope, and these are not available when the type class- -- declaration gets desugared.- --- -- Note also that the first argument to TypeClassDictionary is False, meaning we _do not_ want- -- to consider superclass instances when searching for this dictionary - doing so might lead- -- to traversing a cycle in the instance graph.- -}- dicts <- getTypeClassDictionaries- return $ TypeClassDictionary False (className, tys) dicts-check' (TypedValue checkType val ty1) ty2 = do- Just moduleName <- checkCurrentModule <$> get- (kind, args) <- liftCheck $ kindOfWithScopedVars ty1- checkTypeKind kind- ty1' <- introduceSkolemScope <=< replaceAllTypeSynonyms <=< replaceTypeWildcards $ ty1- ty2' <- introduceSkolemScope <=< replaceAllTypeSynonyms <=< replaceTypeWildcards $ ty2- val' <- subsumes (Just val) ty1' ty2'- case val' of- Nothing -> throwError . errorMessage $ SubsumptionCheckFailed- Just _ -> do- val''' <- if checkType then withScopedTypeVars moduleName args (check val ty2') else return val- return $ TypedValue checkType val''' ty2'-check' (Case vals binders) ret = do- vals' <- mapM infer vals- let ts = map (\(TypedValue _ _ t) -> t) vals'- binders' <- checkBinders ts ret binders- return $ TypedValue True (Case vals' binders') ret-check' (IfThenElse cond th el) ty = do- cond' <- check cond tyBoolean- th' <- check th ty- el' <- check el ty- return $ TypedValue True (IfThenElse cond' th' el') ty-check' (ObjectLiteral ps) t@(TypeApp obj row) | obj == tyObject = do- ensureNoDuplicateProperties ps- ps' <- checkProperties ps row False- return $ TypedValue True (ObjectLiteral ps') t-check' (TypeClassDictionaryConstructorApp name ps) t = do- ps' <- check' ps t- return $ TypedValue True (TypeClassDictionaryConstructorApp name ps') t-check' (ObjectUpdate obj ps) t@(TypeApp o row) | o == tyObject = do- ensureNoDuplicateProperties ps- -- We need to be careful to avoid duplicate labels here.- -- We check _obj_ agaist the type _t_ with the types in _ps_ replaced with unknowns.- let (propsToCheck, rest) = rowToList row- (removedProps, remainingProps) = partition (\(p, _) -> p `elem` map fst ps) propsToCheck- us <- zip (map fst removedProps) <$> replicateM (length ps) fresh- obj' <- check obj (TypeApp tyObject (rowFromList (us ++ remainingProps, rest)))- ps' <- checkProperties ps row True- return $ TypedValue True (ObjectUpdate obj' ps') t-check' (Accessor prop val) ty = do- rest <- fresh- val' <- check val (TypeApp tyObject (RCons prop ty rest))- return $ TypedValue True (Accessor prop val') ty-check' (Constructor c) ty = do- env <- getEnv- case M.lookup c (dataConstructors env) of- Nothing -> throwError . errorMessage $ UnknownDataConstructor c Nothing- Just (_, _, ty1, _) -> do- repl <- introduceSkolemScope <=< replaceAllTypeSynonyms $ ty1- _ <- subsumes Nothing repl ty- return $ TypedValue True (Constructor c) ty-check' (Let ds val) ty = do- (ds', val') <- inferLetBinding [] ds val (`check` ty)- return $ TypedValue True (Let ds' val') ty-check' val ty | containsTypeSynonyms ty = do- ty' <- introduceSkolemScope <=< expandAllTypeSynonyms <=< replaceTypeWildcards $ ty- check val ty'-check' val kt@(KindedType ty kind) = do- checkTypeKind kind- val' <- check' val ty- return $ TypedValue True val' kt-check' (PositionedValue pos _ val) ty =- rethrowWithPosition pos $ check' val ty-check' val ty = throwError . errorMessage $ ExprDoesNotHaveType val ty--containsTypeSynonyms :: Type -> Bool-containsTypeSynonyms = everythingOnTypes (||) go where- go (SaturatedTypeSynonym _ _) = True- go _ = False---- |--- Check the type of a collection of named record fields------ The @lax@ parameter controls whether or not every record member has to be provided. For object updates, this is not the case.----checkProperties :: [(String, Expr)] -> Type -> Bool -> UnifyT Type Check [(String, Expr)]-checkProperties ps row lax = let (ts, r') = rowToList row in go ps ts r' where- go [] [] REmpty = return []- go [] [] u@(TUnknown _)- | lax = return []- | otherwise = do u =?= REmpty- return []- go [] [] Skolem{} | lax = return []- go [] ((p, _): _) _ | lax = return []- | otherwise = throwError . errorMessage $ PropertyIsMissing p row- go ((p,_):_) [] REmpty = throwError . errorMessage $ PropertyIsMissing p row- go ((p,v):ps') ts r =- case lookup p ts of- Nothing -> do- v'@(TypedValue _ _ ty) <- infer v- rest <- fresh- r =?= RCons p ty rest- ps'' <- go ps' ts rest- return $ (p, v') : ps''- Just ty -> do- v' <- check v ty- ps'' <- go ps' (delete (p, ty) ts) r- return $ (p, v') : ps''- go _ _ _ = throwError . errorMessage $ ExprDoesNotHaveType (ObjectLiteral ps) (TypeApp tyObject row)---- |--- Check the type of a function application, rethrowing errors to provide a better error message----checkFunctionApplication :: Expr -> Type -> Expr -> Maybe Type -> UnifyT Type Check (Type, Expr)-checkFunctionApplication fn fnTy arg ret = rethrow (onErrorMessages (ErrorInApplication fn fnTy arg)) $ do- subst <- unifyCurrentSubstitution <$> UnifyT get- checkFunctionApplication' fn (subst $? fnTy) arg (($?) subst <$> ret)---- |--- Check the type of a function application----checkFunctionApplication' :: Expr -> Type -> Expr -> Maybe Type -> UnifyT Type Check (Type, Expr)-checkFunctionApplication' fn (TypeApp (TypeApp tyFunction' argTy) retTy) arg ret = do- tyFunction' =?= tyFunction- arg' <- check arg argTy- case ret of- Nothing -> return (retTy, App fn arg')- Just ret' -> do- Just app' <- subsumes (Just (App fn arg')) retTy ret'- return (retTy, app')-checkFunctionApplication' fn (ForAll ident ty _) arg ret = do- replaced <- replaceVarWithUnknown ident ty- checkFunctionApplication fn replaced arg ret-checkFunctionApplication' fn u@(TUnknown _) arg ret = do- arg' <- do- TypedValue _ arg' t <- infer arg- (arg'', t') <- instantiatePolyTypeWithUnknowns arg' t- return $ TypedValue True arg'' t'- let ty = (\(TypedValue _ _ t) -> t) arg'- ret' <- maybe fresh return ret- u =?= function ty ret'- return (ret', App fn arg')-checkFunctionApplication' fn (SaturatedTypeSynonym name tyArgs) arg ret = do- ty <- introduceSkolemScope <=< expandTypeSynonym name $ tyArgs- checkFunctionApplication fn ty arg ret-checkFunctionApplication' fn (KindedType ty _) arg ret =- checkFunctionApplication fn ty arg ret-checkFunctionApplication' fn (ConstrainedType constraints fnTy) arg ret = do- dicts <- getTypeClassDictionaries- checkFunctionApplication' (foldl App fn (map (flip (TypeClassDictionary True) dicts) constraints)) fnTy arg ret-checkFunctionApplication' fn fnTy dict@TypeClassDictionary{} _ =- return (fnTy, App fn dict)-checkFunctionApplication' _ fnTy arg _ = throwError . errorMessage $ CannotApplyFunction fnTy arg---- |--- Compute the meet of two types, i.e. the most general type which both types subsume.--- TODO: handle constrained types----meet :: Expr -> Expr -> Type -> Type -> UnifyT Type Check (Expr, Expr, Type)-meet e1 e2 (ForAll ident t1 _) t2 = do- t1' <- replaceVarWithUnknown ident t1- meet e1 e2 t1' t2-meet e1 e2 t1 (ForAll ident t2 _) = do- t2' <- replaceVarWithUnknown ident t2- meet e1 e2 t1 t2'-meet e1 e2 t1 t2 = do- t1 =?= t2- return (e1, e2, t1)---- |--- Ensure a set of property names and value does not contain duplicate labels----ensureNoDuplicateProperties :: (MonadError MultipleErrors m) => [(String, Expr)] -> m ()-ensureNoDuplicateProperties ps =- let ls = map fst ps in- case ls \\ nub ls of- l : _ -> throwError . errorMessage $ DuplicateLabel l Nothing- _ -> return ()+-- |+-- This module implements the type checker+--+module Language.PureScript.TypeChecker.Types+ ( BindingGroupType(..)+ , typesOf+ , checkTypeKind+ ) where++{-+ The following functions represent the corresponding type checking judgements:++ infer+ Synthesize a type for a value++ check+ Check a value has a given type++ checkProperties+ Check an object with a given type contains specified properties++ checkFunctionApplication+ Check a function of a given type returns a value of another type when applied to its arguments+-}++import Prelude+import Protolude (ordNub, fold, atMay)++import Control.Arrow (first, second, (***))+import Control.Monad (forM, forM_, guard, replicateM, unless, when, zipWithM, (<=<))+import Control.Monad.Error.Class (MonadError(..))+import Control.Monad.State.Class (MonadState(..), gets)+import Control.Monad.Supply.Class (MonadSupply)+import Control.Monad.Writer.Class (MonadWriter(..))++import Data.Bifunctor (bimap)+import Data.Either (partitionEithers)+import Data.Functor (($>))+import Data.List (transpose, (\\), partition, delete)+import Data.Maybe (fromMaybe)+import Data.Text (Text)+import Data.Traversable (for)+import Data.List.NonEmpty qualified as NEL+import Data.Map qualified as M+import Data.Set qualified as S+import Data.IntSet qualified as IS++import Language.PureScript.AST+import Language.PureScript.Crash (internalError)+import Language.PureScript.Environment+import Language.PureScript.Errors (ErrorMessage(..), MultipleErrors, SimpleErrorMessage(..), errorMessage, errorMessage', escalateWarningWhen, internalCompilerError, onErrorMessages, onTypesInErrorMessage, parU)+import Language.PureScript.Names (pattern ByNullSourcePos, Ident(..), ModuleName, Name(..), ProperName(..), ProperNameType(..), Qualified(..), QualifiedBy(..), byMaybeModuleName, coerceProperName, freshIdent)+import Language.PureScript.TypeChecker.Deriving (deriveInstance)+import Language.PureScript.TypeChecker.Entailment (InstanceContext, newDictionaries, replaceTypeClassDictionaries)+import Language.PureScript.TypeChecker.Kinds (checkConstraint, checkKind, checkTypeKind, kindOf, kindOfWithScopedVars, unifyKinds', unknownsWithKinds)+import Language.PureScript.TypeChecker.Monad+import Language.PureScript.TypeChecker.Skolems (introduceSkolemScope, newSkolemConstant, newSkolemScope, skolemEscapeCheck, skolemize, skolemizeTypesInValue)+import Language.PureScript.TypeChecker.Subsumption (subsumes)+import Language.PureScript.TypeChecker.Synonyms (replaceAllTypeSynonyms)+import Language.PureScript.TypeChecker.TypeSearch (typeSearch)+import Language.PureScript.TypeChecker.Unify (freshTypeWithKind, replaceTypeWildcards, substituteType, unifyTypes, unknownsInType, varIfUnknown)+import Language.PureScript.Types+import Language.PureScript.Label (Label(..))+import Language.PureScript.PSString (PSString)++data BindingGroupType+ = RecursiveBindingGroup+ | NonRecursiveBindingGroup+ deriving (Show, Eq, Ord)++-- | The result of a successful type check.+data TypedValue' = TypedValue' Bool Expr SourceType++-- | Convert an type checked value into an expression.+tvToExpr :: TypedValue' -> Expr+tvToExpr (TypedValue' c e t) = TypedValue c e t++-- | Lookup data about a type class in the @Environment@+lookupTypeClass :: MonadState CheckState m => Qualified (ProperName 'ClassName) -> m TypeClassData+lookupTypeClass name =+ let findClass = fromMaybe (internalError "entails: type class not found in environment") . M.lookup name+ in gets (findClass . typeClasses . checkEnv)++-- | Infer the types of multiple mutually-recursive values, and return elaborated values including+-- type class dictionaries and type annotations.+typesOf+ :: (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m)+ => BindingGroupType+ -> ModuleName+ -> [((SourceAnn, Ident), Expr)]+ -> m [((SourceAnn, Ident), (Expr, SourceType))]+typesOf bindingGroupType moduleName vals = withFreshSubstitution $ do+ (tys, wInfer) <- capturingSubstitution tidyUp $ do+ (SplitBindingGroup untyped typed dict, w) <- withoutWarnings $ typeDictionaryForBindingGroup (Just moduleName) vals+ ds1 <- parU typed $ \e -> withoutWarnings $ checkTypedBindingGroupElement moduleName e dict+ ds2 <- forM untyped $ \e -> withoutWarnings $ typeForBindingGroupElement e dict+ return (map (False, ) ds1 ++ map (True, ) ds2, w)++ inferred <- forM tys $ \(shouldGeneralize, ((sai@((ss, _), ident), (val, ty)), _)) -> do+ -- Replace type class dictionary placeholders with actual dictionaries+ (val', unsolved) <- replaceTypeClassDictionaries shouldGeneralize val+ -- Generalize and constrain the type+ currentSubst <- gets checkSubstitution+ let ty' = substituteType currentSubst ty+ ty'' = constrain unsolved ty'+ unsolvedTypeVarsWithKinds <- unknownsWithKinds . IS.toList . unknowns $ constrain unsolved ty''+ let unsolvedTypeVars = IS.toList $ unknowns ty'++ generalized <- varIfUnknown unsolvedTypeVarsWithKinds ty''++ when shouldGeneralize $ do+ -- Show the inferred type in a warning+ tell+ . errorMessage' ss+ $ MissingTypeDeclaration ident generalized+ -- For non-recursive binding groups, can generalize over constraints.+ -- For recursive binding groups, we throw an error here for now.+ when (bindingGroupType == RecursiveBindingGroup && not (null unsolved))+ . throwError+ . errorMessage' ss+ $ CannotGeneralizeRecursiveFunction ident generalized+ -- We need information about functional dependencies, since we allow+ -- ambiguous types to be inferred if they can be solved by some functional+ -- dependency.+ conData <- forM unsolved $ \(_, _, con) -> do+ TypeClassData{ typeClassDependencies } <- lookupTypeClass $ constraintClass con+ let+ -- The set of unknowns mentioned in each argument.+ unknownsForArg :: [S.Set Int]+ unknownsForArg =+ map (S.fromList . map snd . unknownsInType) (constraintArgs con)+ pure (typeClassDependencies, unknownsForArg)+ -- Make sure any unsolved type constraints are determined by the+ -- type variables which appear unknown in the inferred type.+ let+ -- Take the closure of fundeps across constraints, to get more+ -- and more solved variables until reaching a fixpoint.+ solveFrom :: S.Set Int -> S.Set Int+ solveFrom determined = do+ let solved = solve1 determined+ if solved `S.isSubsetOf` determined+ then determined+ else solveFrom (determined <> solved)+ solve1 :: S.Set Int -> S.Set Int+ solve1 determined = fold $ do+ (tcDeps, conArgUnknowns) <- conData+ let+ lookupUnknowns :: Int -> Maybe (S.Set Int)+ lookupUnknowns = atMay conArgUnknowns+ unknownsDetermined :: Maybe (S.Set Int) -> Bool+ unknownsDetermined Nothing = False+ unknownsDetermined (Just unks) =+ unks `S.isSubsetOf` determined+ -- If all of the determining arguments of a particular fundep are+ -- already determined, add the determined arguments from the fundep+ tcDep <- tcDeps+ guard $ all (unknownsDetermined . lookupUnknowns) (fdDeterminers tcDep)+ map (fromMaybe S.empty . lookupUnknowns) (fdDetermined tcDep)+ -- These unknowns can be determined from the body of the inferred+ -- type (i.e. excluding the unknowns mentioned in the constraints)+ let determinedFromType = S.fromList unsolvedTypeVars+ -- These are all the unknowns mentioned in the constraints+ let constraintTypeVars = fold (conData >>= snd)+ let solved = solveFrom determinedFromType+ let unsolvedVars = S.difference constraintTypeVars solved+ let lookupUnkName' i = do+ mn <- lookupUnkName i+ pure (fromMaybe "t" mn, i)+ unsolvedVarNames <- traverse lookupUnkName' (S.toList unsolvedVars)+ unless (S.null unsolvedVars) .+ throwError+ . onErrorMessages (replaceTypes currentSubst)+ . errorMessage' ss+ $ AmbiguousTypeVariables generalized unsolvedVarNames++ -- Check skolem variables did not escape their scope+ skolemEscapeCheck val'+ return ((sai, (foldr (Abs . VarBinder nullSourceSpan . (\(x, _, _) -> x)) val' unsolved, generalized)), unsolved)++ -- Show warnings here, since types in wildcards might have been solved during+ -- instance resolution (by functional dependencies).+ finalState <- get+ let replaceTypes' = replaceTypes (checkSubstitution finalState)+ runTypeSearch' gen = runTypeSearch (guard gen $> foldMap snd inferred) finalState+ raisePreviousWarnings gen = escalateWarningWhen isHoleError . tell . onErrorMessages (runTypeSearch' gen . replaceTypes')++ raisePreviousWarnings False wInfer+ forM_ tys $ \(shouldGeneralize, ((_, (_, _)), w)) ->+ raisePreviousWarnings shouldGeneralize w++ return (map fst inferred)+ where+ replaceTypes+ :: Substitution+ -> ErrorMessage+ -> ErrorMessage+ replaceTypes subst = onTypesInErrorMessage (substituteType subst)++ -- Run type search to complete any typed hole error messages+ runTypeSearch+ :: Maybe [(Ident, InstanceContext, SourceConstraint)]+ -- Any unsolved constraints which we need to continue to satisfy+ -> CheckState+ -- The final type checker state+ -> ErrorMessage+ -> ErrorMessage+ runTypeSearch cons st = \case+ ErrorMessage hints (HoleInferredType x ty y (Just (TSBefore env))) ->+ let subst = checkSubstitution st+ searchResult = onTypeSearchTypes+ (substituteType subst)+ (uncurry TSAfter (typeSearch cons env st (substituteType subst ty)))+ in ErrorMessage hints (HoleInferredType x ty y (Just searchResult))+ other -> other++ -- Add any unsolved constraints+ constrain cs ty = foldr srcConstrainedType ty (map (\(_, _, x) -> x) cs)++ -- Apply the substitution that was returned from runUnify to both types and (type-annotated) values++ tidyUp ts sub = first (map (second (first (second (overTypes (substituteType sub) *** substituteType sub))))) ts++ isHoleError :: ErrorMessage -> Bool+ isHoleError (ErrorMessage _ HoleInferredType{}) = True+ isHoleError _ = False++-- | A binding group contains multiple value definitions, some of which are typed+-- and some which are not.+--+-- This structure breaks down a binding group into typed and untyped parts.+data SplitBindingGroup = SplitBindingGroup+ { _splitBindingGroupUntyped :: [((SourceAnn, Ident), (Expr, SourceType))]+ -- ^ The untyped expressions+ , _splitBindingGroupTyped :: [((SourceAnn, Ident), (Expr, [(Text, SourceType)], SourceType, Bool))]+ -- ^ The typed expressions, along with their type annotations+ , _splitBindingGroupNames :: M.Map (Qualified Ident) (SourceType, NameKind, NameVisibility)+ -- ^ A map containing all expressions and their assigned types (which might be+ -- fresh unification variables). These will be added to the 'Environment' after+ -- the binding group is checked, so the value type of the 'Map' is chosen to be+ -- compatible with the type of 'bindNames'.+ }++-- | This function breaks a binding group down into two sets of declarations:+-- those which contain type annotations, and those which don't.+-- This function also generates fresh unification variables for the types of+-- declarations without type annotations, returned in the 'UntypedData' structure.+typeDictionaryForBindingGroup+ :: (MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m)+ => Maybe ModuleName+ -> [((SourceAnn, Ident), Expr)]+ -> m SplitBindingGroup+typeDictionaryForBindingGroup moduleName vals = do+ -- Filter the typed and untyped declarations and make a map of names to typed declarations.+ -- Replace type wildcards here so that the resulting dictionary of types contains the+ -- fully expanded types.+ let (untyped, typed) = partitionEithers (map splitTypeAnnotation vals)+ (typedDict, typed') <- fmap unzip . for typed $ \(sai, (expr, ty, checkType)) -> do+ ((args, elabTy), kind) <- kindOfWithScopedVars ty+ checkTypeKind ty kind+ elabTy' <- replaceTypeWildcards elabTy+ return ((sai, elabTy'), (sai, (expr, args, elabTy', checkType)))+ -- Create fresh unification variables for the types of untyped declarations+ (untypedDict, untyped') <- fmap unzip . for untyped $ \(sai, expr) -> do+ ty <- freshTypeWithKind kindType+ return ((sai, ty), (sai, (expr, ty)))+ -- Create the dictionary of all name/type pairs, which will be added to the+ -- environment during type checking+ let dict = M.fromList [ (Qualified (maybe (BySourcePos $ spanStart ss) ByModuleName moduleName) ident, (ty, Private, Undefined))+ | (((ss, _), ident), ty) <- typedDict <> untypedDict+ ]+ return (SplitBindingGroup untyped' typed' dict)+ where+ -- Check if a value contains a type annotation, and if so, separate it+ -- from the value itself.+ splitTypeAnnotation :: (a, Expr) -> Either (a, Expr) (a, (Expr, SourceType, Bool))+ splitTypeAnnotation (a, TypedValue checkType value ty) = Right (a, (value, ty, checkType))+ splitTypeAnnotation (a, PositionedValue pos c value) =+ bimap (second (PositionedValue pos c))+ (second (\(e, t, b) -> (PositionedValue pos c e, t, b)))+ (splitTypeAnnotation (a, value))+ splitTypeAnnotation (a, value) = Left (a, value)++-- | Check the type annotation of a typed value in a binding group.+checkTypedBindingGroupElement+ :: (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m)+ => ModuleName+ -> ((SourceAnn, Ident), (Expr, [(Text, SourceType)], SourceType, Bool))+ -- ^ The identifier we are trying to define, along with the expression and its type annotation+ -> M.Map (Qualified Ident) (SourceType, NameKind, NameVisibility)+ -- ^ Names brought into scope in this binding group+ -> m ((SourceAnn, Ident), (Expr, SourceType))+checkTypedBindingGroupElement mn (ident, (val, args, ty, checkType)) dict = do+ -- We replace type synonyms _after_ kind-checking, since we don't want type+ -- synonym expansion to bring type variables into scope. See #2542.+ ty' <- introduceSkolemScope <=< replaceAllTypeSynonyms $ ty+ -- Check the type with the new names in scope+ val' <- if checkType+ then withScopedTypeVars mn args $ bindNames dict $ check val ty'+ else return (TypedValue' False val ty')+ return (ident, (tvToExpr val', ty'))++-- | Infer a type for a value in a binding group which lacks an annotation.+typeForBindingGroupElement+ :: (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m)+ => ((SourceAnn, Ident), (Expr, SourceType))+ -- ^ The identifier we are trying to define, along with the expression and its assigned type+ -- (at this point, this should be a unification variable)+ -> M.Map (Qualified Ident) (SourceType, NameKind, NameVisibility)+ -- ^ Names brought into scope in this binding group+ -> m ((SourceAnn, Ident), (Expr, SourceType))+typeForBindingGroupElement (ident, (val, ty)) dict = do+ -- Infer the type with the new names in scope+ TypedValue' _ val' ty' <- bindNames dict $ infer val+ -- Unify the type with the unification variable we chose for this definition+ unifyTypes ty ty'+ return (ident, (TypedValue True val' ty', ty'))++-- | Remove any ForAlls and ConstrainedType constructors in a type by introducing new unknowns+-- or TypeClassDictionary values.+--+-- This is necessary during type checking to avoid unifying a polymorphic type with a+-- unification variable.+instantiatePolyTypeWithUnknowns+ :: (MonadState CheckState m, MonadError MultipleErrors m)+ => Expr+ -> SourceType+ -> m (Expr, SourceType)+instantiatePolyTypeWithUnknowns val (ForAll _ _ ident mbK ty _) = do+ u <- maybe (internalCompilerError "Unelaborated forall") freshTypeWithKind mbK+ insertUnkName' u ident+ instantiatePolyTypeWithUnknowns val $ replaceTypeVars ident u ty+instantiatePolyTypeWithUnknowns val (ConstrainedType _ con ty) = do+ dicts <- getTypeClassDictionaries+ hints <- getHints+ instantiatePolyTypeWithUnknowns (App val (TypeClassDictionary con dicts hints)) ty+instantiatePolyTypeWithUnknowns val ty = return (val, ty)++instantiatePolyTypeWithUnknownsUntilVisible+ :: (MonadState CheckState m, MonadError MultipleErrors m)+ => Expr+ -> SourceType+ -> m (Expr, SourceType)+instantiatePolyTypeWithUnknownsUntilVisible val (ForAll _ TypeVarInvisible ident mbK ty _) = do+ u <- maybe (internalCompilerError "Unelaborated forall") freshTypeWithKind mbK+ insertUnkName' u ident+ instantiatePolyTypeWithUnknownsUntilVisible val $ replaceTypeVars ident u ty+instantiatePolyTypeWithUnknownsUntilVisible val ty = return (val, ty)++instantiateConstraint :: MonadState CheckState m => Expr -> Type SourceAnn -> m (Expr, Type SourceAnn)+instantiateConstraint val (ConstrainedType _ con ty) = do+ dicts <- getTypeClassDictionaries+ hints <- getHints+ instantiateConstraint (App val (TypeClassDictionary con dicts hints)) ty+instantiateConstraint val ty = pure (val, ty)++-- | Match against TUnknown and call insertUnkName, failing otherwise.+insertUnkName' :: (MonadState CheckState m, MonadError MultipleErrors m) => SourceType -> Text -> m ()+insertUnkName' (TUnknown _ i) n = insertUnkName i n+insertUnkName' _ _ = internalCompilerError "type is not TUnknown"++-- | Infer a type for a value, rethrowing any error to provide a more useful error message+infer+ :: (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m)+ => Expr+ -> m TypedValue'+infer val = withErrorMessageHint (ErrorInferringType val) $ infer' val++-- | Infer a type for a value+infer'+ :: forall m+ . (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m)+ => Expr+ -> m TypedValue'+infer' v@(Literal _ (NumericLiteral (Left _))) = return $ TypedValue' True v tyInt+infer' v@(Literal _ (NumericLiteral (Right _))) = return $ TypedValue' True v tyNumber+infer' v@(Literal _ (StringLiteral _)) = return $ TypedValue' True v tyString+infer' v@(Literal _ (CharLiteral _)) = return $ TypedValue' True v tyChar+infer' v@(Literal _ (BooleanLiteral _)) = return $ TypedValue' True v tyBoolean+infer' (Literal ss (ArrayLiteral vals)) = do+ ts <- traverse infer vals+ els <- freshTypeWithKind kindType+ ts' <- forM ts $ \(TypedValue' ch val t) -> do+ (val', t') <- instantiatePolyTypeWithUnknowns val t+ unifyTypes els t'+ return (TypedValue ch val' t')+ return $ TypedValue' True (Literal ss (ArrayLiteral ts')) (srcTypeApp tyArray els)+infer' (Literal ss (ObjectLiteral ps)) = do+ ensureNoDuplicateProperties ps+ typedFields <- inferProperties ps+ let+ toRowListItem :: (PSString, (Expr, SourceType)) -> RowListItem SourceAnn+ toRowListItem (l, (_, t)) = srcRowListItem (Label l) t++ recordType :: SourceType+ recordType = srcTypeApp tyRecord $ rowFromList (toRowListItem <$> typedFields, srcKindApp srcREmpty kindType)++ typedProperties :: [(PSString, Expr)]+ typedProperties = fmap (fmap (uncurry (TypedValue True))) typedFields+ pure $ TypedValue' True (Literal ss (ObjectLiteral typedProperties)) recordType+infer' (ObjectUpdate ob ps) = do+ ensureNoDuplicateProperties ps+ -- This "tail" holds all other fields not being updated.+ rowType <- freshTypeWithKind (kindRow kindType)+ let updateLabels = Label . fst <$> ps+ -- Generate unification variables for each field in ps.+ --+ -- Given:+ --+ -- ob { a = 0, b = 0 }+ --+ -- Then:+ --+ -- obTypes = [(a, ?0), (b, ?1)]+ obTypes <- zip updateLabels <$> replicateM (length updateLabels) (freshTypeWithKind kindType)+ let obItems :: [RowListItem SourceAnn]+ obItems = uncurry srcRowListItem <$> obTypes+ -- Create a record type that contains the unification variables.+ --+ -- obRecordType = Record ( a :: ?0, b :: ?1 | rowType )+ obRecordType :: SourceType+ obRecordType = srcTypeApp tyRecord $ rowFromList (obItems, rowType)+ -- Check ob against obRecordType.+ --+ -- Given:+ --+ -- ob : { a :: Int, b :: Int }+ --+ -- Then:+ --+ -- ?0 ~ Int+ -- ?1 ~ Int+ -- ob' : { a :: ?0, b :: ?1 }+ ob' <- TypedValue True <$> (tvToExpr <$> check ob obRecordType) <*> pure obRecordType+ -- Infer the types of the values used for the record update.+ typedFields <- inferProperties ps+ let newItems :: [RowListItem SourceAnn]+ newItems = (\(l, (_, t)) -> srcRowListItem (Label l) t) <$> typedFields++ ps' :: [(PSString, Expr)]+ ps' = (\(l, (e, t)) -> (l, TypedValue True e t)) <$> typedFields++ newRecordType :: SourceType+ newRecordType = srcTypeApp tyRecord $ rowFromList (newItems, rowType)+ pure $ TypedValue' True (ObjectUpdate ob' ps') newRecordType+infer' (Accessor prop val) = withErrorMessageHint (ErrorCheckingAccessor val prop) $ do+ field <- freshTypeWithKind kindType+ rest <- freshTypeWithKind (kindRow kindType)+ typed <- tvToExpr <$> check val (srcTypeApp tyRecord (srcRCons (Label prop) field rest))+ return $ TypedValue' True (Accessor prop typed) field+infer' (Abs binder ret)+ | VarBinder ss arg <- binder = do+ ty <- freshTypeWithKind kindType+ withBindingGroupVisible $ bindLocalVariables [(ss, arg, ty, Defined)] $ do+ body@(TypedValue' _ _ bodyTy) <- infer' ret+ (body', bodyTy') <- instantiatePolyTypeWithUnknowns (tvToExpr body) bodyTy+ return $ TypedValue' True (Abs (VarBinder ss arg) body') (function ty bodyTy')+ | otherwise = internalError "Binder was not desugared"+infer' (App f arg) = do+ f'@(TypedValue' _ _ ft) <- infer f+ (ret, app) <- checkFunctionApplication (tvToExpr f') ft arg+ return $ TypedValue' True app ret+infer' (VisibleTypeApp valFn (TypeWildcard _ _)) = do+ TypedValue' _ valFn' valTy <- infer valFn+ (valFn'', valTy') <- instantiatePolyTypeWithUnknownsUntilVisible valFn' valTy+ case valTy' of+ ForAll qAnn _ qName qKind qBody qSko -> do+ pure $ TypedValue' True valFn'' (ForAll qAnn TypeVarInvisible qName qKind qBody qSko)+ _ ->+ throwError $ errorMessage $ CannotSkipTypeApplication valTy'+infer' (VisibleTypeApp valFn tyArg) = do+ TypedValue' _ valFn' valTy <- infer valFn+ tyArg' <- introduceSkolemScope <=< replaceAllTypeSynonyms <=< replaceTypeWildcards $ tyArg+ (valFn'', valTy') <- instantiatePolyTypeWithUnknownsUntilVisible valFn' valTy+ case valTy' of+ ForAll _ _ qName (Just qKind) qBody _ -> do+ tyArg'' <- replaceAllTypeSynonyms <=< checkKind tyArg' $ qKind+ let resTy = replaceTypeVars qName tyArg'' qBody+ (valFn''', resTy') <- instantiateConstraint valFn'' resTy+ pure $ TypedValue' True valFn''' resTy'+ _ ->+ throwError $ errorMessage $ CannotApplyExpressionOfTypeOnType valTy tyArg+infer' (Var ss var) = do+ checkVisibility var+ ty <- introduceSkolemScope <=< replaceAllTypeSynonyms <=< replaceTypeWildcards <=< lookupVariable $ var+ case ty of+ ConstrainedType _ con ty' -> do+ dicts <- getTypeClassDictionaries+ hints <- getHints+ return $ TypedValue' True (App (Var ss var) (TypeClassDictionary con dicts hints)) ty'+ _ -> return $ TypedValue' True (Var ss var) ty+infer' v@(Constructor _ c) = do+ env <- getEnv+ case M.lookup c (dataConstructors env) of+ Nothing -> throwError . errorMessage . UnknownName . fmap DctorName $ c+ Just (_, _, ty, _) -> TypedValue' True v <$> (introduceSkolemScope <=< replaceAllTypeSynonyms $ ty)+infer' (Case vals binders) = do+ (vals', ts) <- instantiateForBinders vals binders+ ret <- freshTypeWithKind kindType+ binders' <- checkBinders ts ret binders+ return $ TypedValue' True (Case vals' binders') ret+infer' (IfThenElse cond th el) = do+ cond' <- tvToExpr <$> check cond tyBoolean+ th'@(TypedValue' _ _ thTy) <- infer th+ el'@(TypedValue' _ _ elTy) <- infer el+ (th'', thTy') <- instantiatePolyTypeWithUnknowns (tvToExpr th') thTy+ (el'', elTy') <- instantiatePolyTypeWithUnknowns (tvToExpr el') elTy+ unifyTypes thTy' elTy'+ return $ TypedValue' True (IfThenElse cond' th'' el'') thTy'+infer' (Let w ds val) = do+ (ds', tv@(TypedValue' _ _ valTy)) <- inferLetBinding [] ds val infer+ return $ TypedValue' True (Let w ds' (tvToExpr tv)) valTy+infer' (DeferredDictionary className tys) = do+ dicts <- getTypeClassDictionaries+ hints <- getHints+ con <- checkConstraint (srcConstraint className [] tys Nothing)+ return $ TypedValue' False+ (TypeClassDictionary con dicts hints)+ (foldl srcTypeApp (srcTypeConstructor (fmap coerceProperName className)) tys)+infer' (TypedValue checkType val ty) = do+ moduleName <- unsafeCheckCurrentModule+ ((args, elabTy), kind) <- kindOfWithScopedVars ty+ checkTypeKind ty kind+ ty' <- introduceSkolemScope <=< replaceAllTypeSynonyms <=< replaceTypeWildcards $ elabTy+ tv <- if checkType then withScopedTypeVars moduleName args (check val ty') else return (TypedValue' False val ty)+ return $ TypedValue' True (tvToExpr tv) ty'+infer' (Hole name) = do+ ty <- freshTypeWithKind kindType+ ctx <- getLocalContext+ env <- getEnv+ tell . errorMessage $ HoleInferredType name ty ctx . Just $ TSBefore env+ return $ TypedValue' True (Hole name) ty+infer' (PositionedValue pos c val) = warnAndRethrowWithPositionTC pos $ do+ TypedValue' t v ty <- infer' val+ return $ TypedValue' t (PositionedValue pos c v) ty+infer' v = internalError $ "Invalid argument to infer: " ++ show v++-- |+-- Infer the types of named record fields.+inferProperties+ :: ( MonadSupply m+ , MonadState CheckState m+ , MonadError MultipleErrors m+ , MonadWriter MultipleErrors m+ )+ => [(PSString, Expr)]+ -> m [(PSString, (Expr, SourceType))]+inferProperties = traverse (traverse inferWithinRecord)++-- |+-- Infer the type of a value when used as a record field.+inferWithinRecord+ :: ( MonadSupply m+ , MonadState CheckState m+ , MonadError MultipleErrors m+ , MonadWriter MultipleErrors m+ )+ => Expr+ -> m (Expr, SourceType)+inferWithinRecord e = do+ TypedValue' _ v t <- infer e+ if propertyShouldInstantiate e+ then instantiatePolyTypeWithUnknowns v t+ else pure (v, t)++-- |+-- Determines if a value's type needs to be monomorphized when+-- used inside of a record.+propertyShouldInstantiate :: Expr -> Bool+propertyShouldInstantiate = \case+ Var{} -> True+ Constructor{} -> True+ VisibleTypeApp e _ -> propertyShouldInstantiate e+ PositionedValue _ _ e -> propertyShouldInstantiate e+ _ -> False++inferLetBinding+ :: (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m)+ => [Declaration]+ -> [Declaration]+ -> Expr+ -> (Expr -> m TypedValue')+ -> m ([Declaration], TypedValue')+inferLetBinding seen [] ret j = (seen, ) <$> withBindingGroupVisible (j ret)+inferLetBinding seen (ValueDecl sa@(ss, _) ident nameKind [] [MkUnguarded (TypedValue checkType val ty)] : rest) ret j = do+ moduleName <- unsafeCheckCurrentModule+ TypedValue' _ val' ty'' <- warnAndRethrowWithPositionTC ss $ do+ ((args, elabTy), kind) <- kindOfWithScopedVars ty+ checkTypeKind ty kind+ let dict = M.singleton (Qualified (BySourcePos $ spanStart ss) ident) (elabTy, nameKind, Undefined)+ ty' <- introduceSkolemScope <=< replaceAllTypeSynonyms <=< replaceTypeWildcards $ elabTy+ if checkType+ then withScopedTypeVars moduleName args (bindNames dict (check val ty'))+ else return (TypedValue' checkType val elabTy)+ bindNames (M.singleton (Qualified (BySourcePos $ spanStart ss) ident) (ty'', nameKind, Defined))+ $ inferLetBinding (seen ++ [ValueDecl sa ident nameKind [] [MkUnguarded (TypedValue checkType val' ty'')]]) rest ret j+inferLetBinding seen (ValueDecl sa@(ss, _) ident nameKind [] [MkUnguarded val] : rest) ret j = do+ valTy <- freshTypeWithKind kindType+ TypedValue' _ val' valTy' <- warnAndRethrowWithPositionTC ss $ do+ let dict = M.singleton (Qualified (BySourcePos $ spanStart ss) ident) (valTy, nameKind, Undefined)+ bindNames dict $ infer val+ warnAndRethrowWithPositionTC ss $ unifyTypes valTy valTy'+ bindNames (M.singleton (Qualified (BySourcePos $ spanStart ss) ident) (valTy', nameKind, Defined))+ $ inferLetBinding (seen ++ [ValueDecl sa ident nameKind [] [MkUnguarded val']]) rest ret j+inferLetBinding seen (BindingGroupDeclaration ds : rest) ret j = do+ moduleName <- unsafeCheckCurrentModule+ SplitBindingGroup untyped typed dict <- typeDictionaryForBindingGroup Nothing . NEL.toList $ fmap (\(i, _, v) -> (i, v)) ds+ ds1' <- parU typed $ \e -> checkTypedBindingGroupElement moduleName e dict+ ds2' <- forM untyped $ \e -> typeForBindingGroupElement e dict+ let ds' = NEL.fromList [(ident, Private, val') | (ident, (val', _)) <- ds1' ++ ds2']+ bindNames dict $ do+ makeBindingGroupVisible+ inferLetBinding (seen ++ [BindingGroupDeclaration ds']) rest ret j+inferLetBinding _ _ _ _ = internalError "Invalid argument to inferLetBinding"++-- | Infer the types of variables brought into scope by a binder+inferBinder+ :: forall m+ . (MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m)+ => SourceType+ -> Binder+ -> m (M.Map Ident (SourceSpan, SourceType))+inferBinder _ NullBinder = return M.empty+inferBinder val (LiteralBinder _ (StringLiteral _)) = unifyTypes val tyString >> return M.empty+inferBinder val (LiteralBinder _ (CharLiteral _)) = unifyTypes val tyChar >> return M.empty+inferBinder val (LiteralBinder _ (NumericLiteral (Left _))) = unifyTypes val tyInt >> return M.empty+inferBinder val (LiteralBinder _ (NumericLiteral (Right _))) = unifyTypes val tyNumber >> return M.empty+inferBinder val (LiteralBinder _ (BooleanLiteral _)) = unifyTypes val tyBoolean >> return M.empty+inferBinder val (VarBinder ss name) = return $ M.singleton name (ss, val)+inferBinder val (ConstructorBinder ss ctor binders) = do+ env <- getEnv+ case M.lookup ctor (dataConstructors env) of+ Just (_, _, ty, _) -> do+ (_, fn) <- instantiatePolyTypeWithUnknowns (internalError "Data constructor types cannot contain constraints") ty+ fn' <- introduceSkolemScope <=< replaceAllTypeSynonyms $ fn+ let (args, ret) = peelArgs fn'+ expected = length args+ actual = length binders+ unless (expected == actual) . throwError . errorMessage' ss $ IncorrectConstructorArity ctor expected actual+ unifyTypes ret val+ M.unions <$> zipWithM inferBinder (reverse args) binders+ _ -> throwError . errorMessage' ss . UnknownName . fmap DctorName $ ctor+ where+ peelArgs :: Type a -> ([Type a], Type a)+ peelArgs = go []+ where+ go args (TypeApp _ (TypeApp _ fn arg) ret) | eqType fn tyFunction = go (arg : args) ret+ go args ret = (args, ret)+inferBinder val (LiteralBinder _ (ObjectLiteral props)) = do+ row <- freshTypeWithKind (kindRow kindType)+ rest <- freshTypeWithKind (kindRow kindType)+ m1 <- inferRowProperties row rest props+ unifyTypes val (srcTypeApp tyRecord row)+ return m1+ where+ inferRowProperties :: SourceType -> SourceType -> [(PSString, Binder)] -> m (M.Map Ident (SourceSpan, SourceType))+ inferRowProperties nrow row [] = unifyTypes nrow row >> return M.empty+ inferRowProperties nrow row ((name, binder):binders) = do+ propTy <- freshTypeWithKind kindType+ m1 <- inferBinder propTy binder+ m2 <- inferRowProperties nrow (srcRCons (Label name) propTy row) binders+ return $ m1 `M.union` m2+inferBinder val (LiteralBinder _ (ArrayLiteral binders)) = do+ el <- freshTypeWithKind kindType+ m1 <- M.unions <$> traverse (inferBinder el) binders+ unifyTypes val (srcTypeApp tyArray el)+ return m1+inferBinder val (NamedBinder ss name binder) =+ warnAndRethrowWithPositionTC ss $ do+ m <- inferBinder val binder+ return $ M.insert name (ss, val) m+inferBinder val (PositionedBinder pos _ binder) =+ warnAndRethrowWithPositionTC pos $ inferBinder val binder+inferBinder val (TypedBinder ty binder) = do+ (elabTy, kind) <- kindOf ty+ checkTypeKind ty kind+ ty1 <- introduceSkolemScope <=< replaceAllTypeSynonyms <=< replaceTypeWildcards $ elabTy+ unifyTypes val ty1+ inferBinder ty1 binder+inferBinder _ OpBinder{} =+ internalError "OpBinder should have been desugared before inferBinder"+inferBinder _ BinaryNoParensBinder{} =+ internalError "BinaryNoParensBinder should have been desugared before inferBinder"+inferBinder _ ParensInBinder{} =+ internalError "ParensInBinder should have been desugared before inferBinder"++-- | Returns true if a binder requires its argument type to be a monotype.+-- | If this is the case, we need to instantiate any polymorphic types before checking binders.+binderRequiresMonotype :: Binder -> Bool+binderRequiresMonotype NullBinder = False+binderRequiresMonotype (VarBinder _ _) = False+binderRequiresMonotype (NamedBinder _ _ b) = binderRequiresMonotype b+binderRequiresMonotype (PositionedBinder _ _ b) = binderRequiresMonotype b+binderRequiresMonotype (TypedBinder ty b) = isMonoType ty || binderRequiresMonotype b+binderRequiresMonotype _ = True++-- | Instantiate polytypes only when necessitated by a binder.+instantiateForBinders+ :: (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m)+ => [Expr]+ -> [CaseAlternative]+ -> m ([Expr], [SourceType])+instantiateForBinders vals cas = unzip <$> zipWithM (\val inst -> do+ TypedValue' _ val' ty <- infer val+ if inst+ then instantiatePolyTypeWithUnknowns val' ty+ else return (val', ty)) vals shouldInstantiate+ where+ shouldInstantiate :: [Bool]+ shouldInstantiate = map (any binderRequiresMonotype) . transpose . map caseAlternativeBinders $ cas++-- |+-- Check the types of the return values in a set of binders in a case statement+--+checkBinders+ :: (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m)+ => [SourceType]+ -> SourceType+ -> [CaseAlternative]+ -> m [CaseAlternative]+checkBinders _ _ [] = return []+checkBinders nvals ret (CaseAlternative binders result : bs) = do+ guardWith (errorMessage $ OverlappingArgNames Nothing) $+ let ns = concatMap binderNames binders in length (ordNub ns) == length ns+ m1 <- M.unions <$> zipWithM inferBinder nvals binders+ r <- bindLocalVariables [ (ss, name, ty, Defined) | (name, (ss, ty)) <- M.toList m1 ] $+ CaseAlternative binders <$> forM result (\ge -> checkGuardedRhs ge ret)+ rs <- checkBinders nvals ret bs+ return $ r : rs++checkGuardedRhs+ :: (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m)+ => GuardedExpr+ -> SourceType+ -> m GuardedExpr+checkGuardedRhs (GuardedExpr [] rhs) ret = do+ rhs' <- TypedValue True <$> (tvToExpr <$> check rhs ret) <*> pure ret+ return $ GuardedExpr [] rhs'+checkGuardedRhs (GuardedExpr (ConditionGuard cond : guards) rhs) ret = do+ cond' <- withErrorMessageHint ErrorCheckingGuard $ check cond tyBoolean+ GuardedExpr guards' rhs' <- checkGuardedRhs (GuardedExpr guards rhs) ret+ return $ GuardedExpr (ConditionGuard (tvToExpr cond') : guards') rhs'+checkGuardedRhs (GuardedExpr (PatternGuard binder expr : guards) rhs) ret = do+ tv@(TypedValue' _ _ ty) <- infer expr+ variables <- inferBinder ty binder+ GuardedExpr guards' rhs' <- bindLocalVariables [ (ss, name, bty, Defined)+ | (name, (ss, bty)) <- M.toList variables+ ] $+ checkGuardedRhs (GuardedExpr guards rhs) ret+ return $ GuardedExpr (PatternGuard binder (tvToExpr tv) : guards') rhs'++-- |+-- Check the type of a value, rethrowing errors to provide a better error message+--+check+ :: (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m)+ => Expr+ -> SourceType+ -> m TypedValue'+check val ty = withErrorMessageHint' val (ErrorCheckingType val ty) $ check' val ty++-- |+-- Check the type of a value+--+check'+ :: forall m+ . (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m)+ => Expr+ -> SourceType+ -> m TypedValue'+check' val (ForAll ann vis ident mbK ty _) = do+ env <- getEnv+ mn <- gets checkCurrentModule+ scope <- newSkolemScope+ sko <- newSkolemConstant+ let ss = case val of+ PositionedValue pos c _ -> (pos, c)+ _ -> NullSourceAnn+ sk = skolemize ss ident mbK sko scope ty+ -- We should only skolemize types in values when the type variable+ -- was actually brought into scope. Otherwise we can end up skolemizing+ -- an undefined type variable that happens to clash with the variable we+ -- want to skolemize. This can happen due to synonym expansion (see 2542).+ skVal+ | Just _ <- M.lookup (Qualified (byMaybeModuleName mn) (ProperName ident)) $ types env =+ skolemizeTypesInValue ss ident mbK sko scope val+ | otherwise = val+ val' <- tvToExpr <$> check skVal sk+ return $ TypedValue' True val' (ForAll ann vis ident mbK ty (Just scope))+check' val t@(ConstrainedType _ con@(Constraint _ cls@(Qualified _ (ProperName className)) _ _ _) ty) = do+ TypeClassData{ typeClassIsEmpty } <- lookupTypeClass cls+ -- An empty class dictionary is never used; see code in `TypeChecker.Entailment`+ -- that wraps empty dictionary solutions in `Unused`.+ dictName <- if typeClassIsEmpty then pure UnusedIdent else freshIdent ("dict" <> className)+ dicts <- newDictionaries [] (Qualified ByNullSourcePos dictName) con+ val' <- withBindingGroupVisible $ withTypeClassDictionaries dicts $ check val ty+ return $ TypedValue' True (Abs (VarBinder nullSourceSpan dictName) (tvToExpr val')) t+check' val u@(TUnknown _ _) = do+ val'@(TypedValue' _ _ ty) <- infer val+ -- Don't unify an unknown with an inferred polytype+ (val'', ty') <- instantiatePolyTypeWithUnknowns (tvToExpr val') ty+ unifyTypes ty' u+ return $ TypedValue' True val'' ty'+check' v@(Literal _ (NumericLiteral (Left _))) t | t == tyInt =+ return $ TypedValue' True v t+check' v@(Literal _ (NumericLiteral (Right _))) t | t == tyNumber =+ return $ TypedValue' True v t+check' v@(Literal _ (StringLiteral _)) t | t == tyString =+ return $ TypedValue' True v t+check' v@(Literal _ (CharLiteral _)) t | t == tyChar =+ return $ TypedValue' True v t+check' v@(Literal _ (BooleanLiteral _)) t | t == tyBoolean =+ return $ TypedValue' True v t+check' (Literal ss (ArrayLiteral vals)) t@(TypeApp _ a ty) = do+ unifyTypes a tyArray+ array <- Literal ss . ArrayLiteral . map tvToExpr <$> forM vals (`check` ty)+ return $ TypedValue' True array t+check' (Abs binder ret) ty@(TypeApp _ (TypeApp _ t argTy) retTy)+ | VarBinder ss arg <- binder = do+ unifyTypes t tyFunction+ ret' <- withBindingGroupVisible $ bindLocalVariables [(ss, arg, argTy, Defined)] $ check ret retTy+ return $ TypedValue' True (Abs (VarBinder ss arg) (tvToExpr ret')) ty+ | otherwise = internalError "Binder was not desugared"+check' (App f arg) ret = do+ f'@(TypedValue' _ _ ft) <- infer f+ (retTy, app) <- checkFunctionApplication (tvToExpr f') ft arg+ elaborate <- subsumes retTy ret+ return $ TypedValue' True (elaborate app) ret+check' v@(Var _ var) ty = do+ checkVisibility var+ repl <- introduceSkolemScope <=< replaceAllTypeSynonyms <=< lookupVariable $ var+ ty' <- introduceSkolemScope <=< replaceAllTypeSynonyms <=< replaceTypeWildcards $ ty+ elaborate <- subsumes repl ty'+ return $ TypedValue' True (elaborate v) ty'+check' (DeferredDictionary className tys) ty = do+ {-+ -- Here, we replace a placeholder for a superclass dictionary with a regular+ -- TypeClassDictionary placeholder. The reason we do this is that it is necessary to have the+ -- correct super instance dictionaries in scope, and these are not available when the type class+ -- declaration gets desugared.+ -}+ dicts <- getTypeClassDictionaries+ hints <- getHints+ con <- checkConstraint (srcConstraint className [] tys Nothing)+ return $ TypedValue' False+ (TypeClassDictionary con dicts hints)+ ty+check' (TypedValue checkType val ty1) ty2 = do+ moduleName <- unsafeCheckCurrentModule+ ((args, elabTy1), kind1) <- kindOfWithScopedVars ty1+ (elabTy2, kind2) <- kindOf ty2+ unifyKinds' kind1 kind2+ checkTypeKind ty1 kind1+ ty1' <- introduceSkolemScope <=< replaceAllTypeSynonyms <=< replaceTypeWildcards $ elabTy1+ ty2' <- introduceSkolemScope <=< replaceAllTypeSynonyms <=< replaceTypeWildcards $ elabTy2+ elaborate <- subsumes ty1' ty2'+ val' <- if checkType+ then withScopedTypeVars moduleName args $ tvToExpr <$> check val ty1'+ else pure val+ return $ TypedValue' True (TypedValue checkType (elaborate val') ty1') ty2'+check' (Case vals binders) ret = do+ (vals', ts) <- instantiateForBinders vals binders+ binders' <- checkBinders ts ret binders+ return $ TypedValue' True (Case vals' binders') ret+check' (IfThenElse cond th el) ty = do+ cond' <- tvToExpr <$> check cond tyBoolean+ th' <- tvToExpr <$> check th ty+ el' <- tvToExpr <$> check el ty+ return $ TypedValue' True (IfThenElse cond' th' el') ty+check' e@(Literal ss (ObjectLiteral ps)) t@(TypeApp _ obj row) | obj == tyRecord = do+ ensureNoDuplicateProperties ps+ ps' <- checkProperties e ps row False+ return $ TypedValue' True (Literal ss (ObjectLiteral ps')) t+check' (DerivedInstancePlaceholder name strategy) t = do+ d <- deriveInstance t name strategy+ d' <- tvToExpr <$> check' d t+ return $ TypedValue' True d' t+check' e@(ObjectUpdate obj ps) t@(TypeApp _ o row) | o == tyRecord = do+ ensureNoDuplicateProperties ps+ -- We need to be careful to avoid duplicate labels here.+ -- We check _obj_ against the type _t_ with the types in _ps_ replaced with unknowns.+ let (propsToCheck, rest) = rowToList row+ (removedProps, remainingProps) = partition (\(RowListItem _ p _) -> p `elem` map (Label . fst) ps) propsToCheck+ us <- zipWith srcRowListItem (map rowListLabel removedProps) <$> replicateM (length ps) (freshTypeWithKind kindType)+ obj' <- tvToExpr <$> check obj (srcTypeApp tyRecord (rowFromList (us ++ remainingProps, rest)))+ ps' <- checkProperties e ps row True+ return $ TypedValue' True (ObjectUpdate obj' ps') t+check' (Accessor prop val) ty = withErrorMessageHint (ErrorCheckingAccessor val prop) $ do+ rest <- freshTypeWithKind (kindRow kindType)+ val' <- tvToExpr <$> check val (srcTypeApp tyRecord (srcRCons (Label prop) ty rest))+ return $ TypedValue' True (Accessor prop val') ty+check' v@(Constructor _ c) ty = do+ env <- getEnv+ case M.lookup c (dataConstructors env) of+ Nothing -> throwError . errorMessage . UnknownName . fmap DctorName $ c+ Just (_, _, ty1, _) -> do+ repl <- introduceSkolemScope <=< replaceAllTypeSynonyms $ ty1+ ty' <- introduceSkolemScope <=< replaceAllTypeSynonyms $ ty+ elaborate <- subsumes repl ty'+ return $ TypedValue' True (elaborate v) ty'+check' (Let w ds val) ty = do+ (ds', val') <- inferLetBinding [] ds val (`check` ty)+ return $ TypedValue' True (Let w ds' (tvToExpr val')) ty+check' val kt@(KindedType _ ty kind) = do+ checkTypeKind ty kind+ val' <- tvToExpr <$> check' val ty+ return $ TypedValue' True val' kt+check' (PositionedValue pos c val) ty = warnAndRethrowWithPositionTC pos $ do+ TypedValue' t v ty' <- check' val ty+ return $ TypedValue' t (PositionedValue pos c v) ty'+check' val ty = do+ TypedValue' _ val' ty' <- infer val+ elaborate <- subsumes ty' ty+ return $ TypedValue' True (elaborate val') ty++-- |+-- Check the type of a collection of named record fields+--+-- The @lax@ parameter controls whether or not every record member has to be provided. For object updates, this is not the case.+--+checkProperties+ :: (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m)+ => Expr+ -> [(PSString, Expr)]+ -> SourceType+ -> Bool+ -> m [(PSString, Expr)]+checkProperties expr ps row lax = convert <$> go ps (toRowPair <$> ts') r' where+ convert = fmap (fmap tvToExpr)+ (ts', r') = rowToList row+ toRowPair (RowListItem _ lbl ty) = (lbl, ty)+ go [] [] (REmptyKinded _ _) = return []+ go [] [] u@(TUnknown _ _)+ | lax = return []+ | otherwise = do unifyTypes u srcREmpty+ return []+ go [] [] Skolem{} | lax = return []+ go [] ((p, _): _) _ | lax = return []+ | otherwise = throwError . errorMessage $ PropertyIsMissing p+ go ((p,_):_) [] (REmptyKinded _ _) = throwError . errorMessage $ AdditionalProperty $ Label p+ go ((p,v):ps') ts r =+ case lookup (Label p) ts of+ Nothing -> do+ (v', ty) <- inferWithinRecord v+ rest <- freshTypeWithKind (kindRow kindType)+ unifyTypes r (srcRCons (Label p) ty rest)+ ps'' <- go ps' ts rest+ return $ (p, TypedValue' True v' ty) : ps''+ Just ty -> do+ v' <- check v ty+ ps'' <- go ps' (delete (Label p, ty) ts) r+ return $ (p, v') : ps''+ go _ _ _ = throwError . errorMessage $ ExprDoesNotHaveType expr (srcTypeApp tyRecord row)++-- | Check the type of a function application, rethrowing errors to provide a better error message.+--+-- This judgment takes three inputs:+--+-- * The expression of the function we are applying+-- * The type of that function+-- * The expression we are applying it to+--+-- and synthesizes two outputs:+--+-- * The return type+-- * The elaborated expression for the function application (since we might need to+-- insert type class dictionaries, etc.)+checkFunctionApplication+ :: (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m)+ => Expr+ -- ^ The function expression+ -> SourceType+ -- ^ The type of the function+ -> Expr+ -- ^ The argument expression+ -> m (SourceType, Expr)+ -- ^ The result type, and the elaborated term+checkFunctionApplication fn fnTy arg = withErrorMessageHint' fn (ErrorInApplication fn fnTy arg) $ do+ subst <- gets checkSubstitution+ checkFunctionApplication' fn (substituteType subst fnTy) arg++-- | Check the type of a function application+checkFunctionApplication'+ :: (MonadSupply m, MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m)+ => Expr+ -> SourceType+ -> Expr+ -> m (SourceType, Expr)+checkFunctionApplication' fn (TypeApp _ (TypeApp _ tyFunction' argTy) retTy) arg = do+ unifyTypes tyFunction' tyFunction+ arg' <- tvToExpr <$> check arg argTy+ return (retTy, App fn arg')+checkFunctionApplication' fn (ForAll _ _ ident mbK ty _) arg = do+ u <- maybe (internalCompilerError "Unelaborated forall") freshTypeWithKind mbK+ insertUnkName' u ident+ let replaced = replaceTypeVars ident u ty+ checkFunctionApplication fn replaced arg+checkFunctionApplication' fn (KindedType _ ty _) arg =+ checkFunctionApplication fn ty arg+checkFunctionApplication' fn (ConstrainedType _ con fnTy) arg = do+ dicts <- getTypeClassDictionaries+ hints <- getHints+ checkFunctionApplication' (App fn (TypeClassDictionary con dicts hints)) fnTy arg+checkFunctionApplication' fn fnTy dict@TypeClassDictionary{} =+ return (fnTy, App fn dict)+checkFunctionApplication' fn u arg = do+ tv@(TypedValue' _ _ ty) <- do+ TypedValue' _ arg' t <- infer arg+ (arg'', t') <- instantiatePolyTypeWithUnknowns arg' t+ return $ TypedValue' True arg'' t'+ ret <- freshTypeWithKind kindType+ unifyTypes u (function ty ret)+ return (ret, App fn (tvToExpr tv))++-- |+-- Ensure a set of property names and value does not contain duplicate labels+--+ensureNoDuplicateProperties :: (MonadError MultipleErrors m) => [(PSString, Expr)] -> m ()+ensureNoDuplicateProperties ps =+ let ls = map fst ps in+ case ls \\ ordNub ls of+ l : _ -> throwError . errorMessage $ DuplicateLabel (Label l) Nothing+ _ -> return ()++-- | Test if this is an internal value to be excluded from error hints+isInternal :: Expr -> Bool+isInternal = \case+ PositionedValue _ _ v -> isInternal v+ TypedValue _ v _ -> isInternal v+ Constructor _ (Qualified _ name) -> isDictTypeName name+ DerivedInstancePlaceholder{} -> True+ _ -> False++-- | Introduce a hint only if the given expression is not internal+withErrorMessageHint'+ :: (MonadState CheckState m, MonadError MultipleErrors m)+ => Expr+ -> ErrorMessageHint+ -> m a+ -> m a+withErrorMessageHint' expr = if isInternal expr then const id else withErrorMessageHint
src/Language/PureScript/TypeChecker/Unify.hs view
@@ -1,203 +1,223 @@------------------------------------------------------------------------------------ Module : Language.PureScript.TypeChecker.Unify--- Copyright : (c) Phil Freeman 2013--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :--- -- | -- Functions and instances relating to unification --------------------------------------------------------------------------------+module Language.PureScript.TypeChecker.Unify+ ( freshType+ , freshTypeWithKind+ , solveType+ , substituteType+ , unknownsInType+ , unifyTypes+ , unifyRows+ , alignRowsWith+ , replaceTypeWildcards+ , varIfUnknown+ ) where -{-# OPTIONS_GHC -fno-warn-orphans #-}-{-# LANGUAGE FlexibleInstances, FlexibleContexts, MultiParamTypeClasses #-}+import Prelude -module Language.PureScript.TypeChecker.Unify (- unifyTypes,- unifyRows,- unifiesWith,- replaceVarWithUnknown,- replaceTypeWildcards,- varIfUnknown-) where+import Control.Monad (forM_, void)+import Control.Monad.Error.Class (MonadError(..))+import Control.Monad.State.Class (MonadState(..), gets, modify, state)+import Control.Monad.Writer.Class (MonadWriter(..)) -import Data.List (nub, sort)+import Data.Foldable (traverse_) import Data.Maybe (fromMaybe)-import qualified Data.HashMap.Strict as H+import Data.Map qualified as M+import Data.Text qualified as T -import Control.Monad.Except-import Control.Monad.Unify+import Language.PureScript.Crash (internalError)+import Language.PureScript.Environment qualified as E+import Language.PureScript.Errors (ErrorMessageHint(..), MultipleErrors, SimpleErrorMessage(..), SourceAnn, errorMessage, internalCompilerError, onErrorMessages, rethrow, warnWithPosition, withoutPosition)+import Language.PureScript.TypeChecker.Kinds (elaborateKind, instantiateKind, unifyKinds')+import Language.PureScript.TypeChecker.Monad (CheckState(..), Substitution(..), UnkLevel(..), Unknown, getLocalContext, guardWith, lookupUnkName, withErrorMessageHint)+import Language.PureScript.TypeChecker.Skolems (newSkolemConstant, skolemize)+import Language.PureScript.Types (Constraint(..), pattern REmptyKinded, RowListItem(..), SourceType, Type(..), WildcardData(..), alignRowsWith, everythingOnTypes, everywhereOnTypes, everywhereOnTypesM, getAnnForType, mkForAll, rowFromList, srcTUnknown) -import Language.PureScript.Environment-import Language.PureScript.Errors-import Language.PureScript.TypeChecker.Monad-import Language.PureScript.TypeChecker.Skolems-import Language.PureScript.TypeChecker.Synonyms-import Language.PureScript.Types+-- | Generate a fresh type variable with an unknown kind. Avoid this if at all possible.+freshType :: (MonadState CheckState m) => m SourceType+freshType = state $ \st -> do+ let+ t = checkNextType st+ st' = st { checkNextType = t + 2+ , checkSubstitution =+ (checkSubstitution st) { substUnsolved = M.insert t (UnkLevel (pure t), E.kindType)+ . M.insert (t + 1) (UnkLevel (pure (t + 1)), srcTUnknown t)+ . substUnsolved+ $ checkSubstitution st+ }+ }+ (srcTUnknown (t + 1), st') -instance Partial Type where- unknown = TUnknown- isUnknown (TUnknown u) = Just u- isUnknown _ = Nothing- unknowns = everythingOnTypes (++) go- where- go (TUnknown u) = [u]- go _ = []- ($?) sub = everywhereOnTypes go- where- go t@(TUnknown u) = fromMaybe t $ H.lookup u (runSubstitution sub)- go other = other+-- | Generate a fresh type variable with a known kind.+freshTypeWithKind :: (MonadState CheckState m) => SourceType -> m SourceType+freshTypeWithKind kind = state $ \st -> do+ let+ t = checkNextType st+ st' = st { checkNextType = t + 1+ , checkSubstitution =+ (checkSubstitution st) { substUnsolved = M.insert t (UnkLevel (pure t), kind) (substUnsolved (checkSubstitution st)) }+ }+ (srcTUnknown t, st') -instance Unifiable Check Type where- (=?=) = unifyTypes+-- | Update the substitution to solve a type constraint+solveType :: (MonadError MultipleErrors m, MonadState CheckState m) => Int -> SourceType -> m ()+solveType u t = rethrow (onErrorMessages withoutPosition) $ do+ -- We strip the position so that any errors get rethrown with the position of+ -- the original unification constraint. Otherwise errors may arise from arbitrary+ -- locations. We don't otherwise have the "correct" position on hand, since it+ -- is maintained as part of the type-checker stack.+ occursCheck u t+ k1 <- elaborateKind t+ subst <- gets checkSubstitution+ k2 <- maybe (internalCompilerError ("No kind for unification variable ?" <> T.pack (show u))) (pure . substituteType subst . snd) . M.lookup u . substUnsolved $ subst+ t' <- instantiateKind (t, k1) k2+ modify $ \cs -> cs { checkSubstitution =+ (checkSubstitution cs) { substType =+ M.insert u t' $ substType $ checkSubstitution cs+ }+ } --- |--- Unify two types, updating the current substitution----unifyTypes :: Type -> Type -> UnifyT Type Check ()-unifyTypes t1 t2 = rethrow (onErrorMessages (ErrorUnifyingTypes t1 t2)) $- unifyTypes' t1 t2+-- | Apply a substitution to a type+substituteType :: Substitution -> SourceType -> SourceType+substituteType sub = everywhereOnTypes go where- unifyTypes' (TUnknown u1) (TUnknown u2) | u1 == u2 = return ()- unifyTypes' (TUnknown u) t = u =:= t- unifyTypes' t (TUnknown u) = u =:= t- unifyTypes' (SaturatedTypeSynonym name args) ty = do- ty1 <- introduceSkolemScope <=< expandTypeSynonym name $ args- ty1 `unifyTypes` ty- unifyTypes' ty s@(SaturatedTypeSynonym _ _) = s `unifyTypes` ty- unifyTypes' (ForAll ident1 ty1 sc1) (ForAll ident2 ty2 sc2) =+ go (TUnknown ann u) =+ case M.lookup u (substType sub) of+ Nothing -> TUnknown ann u+ Just (TUnknown ann' u1) | u1 == u -> TUnknown ann' u1+ Just t -> substituteType sub t+ go other = other++-- | Make sure that an unknown does not occur in a type+occursCheck :: (MonadError MultipleErrors m) => Int -> SourceType -> m ()+occursCheck _ TUnknown{} = return ()+occursCheck u t = void $ everywhereOnTypesM go t+ where+ go (TUnknown _ u') | u == u' = throwError . errorMessage . InfiniteType $ t+ go other = return other++-- | Compute a list of all unknowns appearing in a type+unknownsInType :: Type a -> [(a, Int)]+unknownsInType t = everythingOnTypes (.) go t []+ where+ go :: Type a -> [(a, Int)] -> [(a, Int)]+ go (TUnknown ann u) = ((ann, u) :)+ go _ = id++-- | Unify two types, updating the current substitution+unifyTypes :: (MonadError MultipleErrors m, MonadState CheckState m) => SourceType -> SourceType -> m ()+unifyTypes t1 t2 = do+ sub <- gets checkSubstitution+ withErrorMessageHint (ErrorUnifyingTypes t1 t2) $ unifyTypes' (substituteType sub t1) (substituteType sub t2)+ where+ unifyTypes' (TUnknown _ u1) (TUnknown _ u2) | u1 == u2 = return ()+ unifyTypes' (TUnknown _ u) t = solveType u t+ unifyTypes' t (TUnknown _ u) = solveType u t+ unifyTypes' (ForAll ann1 _ ident1 mbK1 ty1 sc1) (ForAll ann2 _ ident2 mbK2 ty2 sc2) = case (sc1, sc2) of (Just sc1', Just sc2') -> do sko <- newSkolemConstant- let sk1 = skolemize ident1 sko sc1' ty1- let sk2 = skolemize ident2 sko sc2' ty2+ let sk1 = skolemize ann1 ident1 mbK1 sko sc1' ty1+ let sk2 = skolemize ann2 ident2 mbK2 sko sc2' ty2 sk1 `unifyTypes` sk2- _ -> error "Skolemized type variable was not given a scope"- unifyTypes' (ForAll ident ty1 (Just sc)) ty2 = do+ _ -> internalError "unifyTypes: unspecified skolem scope"+ unifyTypes' (ForAll ann _ ident mbK ty1 (Just sc)) ty2 = do sko <- newSkolemConstant- let sk = skolemize ident sko sc ty1+ let sk = skolemize ann ident mbK sko sc ty1 sk `unifyTypes` ty2- unifyTypes' ForAll{} _ = throwError . errorMessage $ UnspecifiedSkolemScope+ unifyTypes' ForAll{} _ = internalError "unifyTypes: unspecified skolem scope" unifyTypes' ty f@ForAll{} = f `unifyTypes` ty- unifyTypes' (TypeVar v1) (TypeVar v2) | v1 == v2 = return ()- unifyTypes' ty1@(TypeConstructor c1) ty2@(TypeConstructor c2) =+ unifyTypes' (TypeVar _ v1) (TypeVar _ v2) | v1 == v2 = return ()+ unifyTypes' ty1@(TypeConstructor _ c1) ty2@(TypeConstructor _ c2) = guardWith (errorMessage (TypesDoNotUnify ty1 ty2)) (c1 == c2)- unifyTypes' (TypeApp t3 t4) (TypeApp t5 t6) = do+ unifyTypes' (TypeLevelString _ s1) (TypeLevelString _ s2) | s1 == s2 = return ()+ unifyTypes' (TypeLevelInt _ n1) (TypeLevelInt _ n2) | n1 == n2 = return ()+ unifyTypes' (TypeApp _ t3 t4) (TypeApp _ t5 t6) = do t3 `unifyTypes` t5 t4 `unifyTypes` t6- unifyTypes' (Skolem _ s1 _) (Skolem _ s2 _) | s1 == s2 = return ()- unifyTypes' (KindedType ty1 _) ty2 = ty1 `unifyTypes` ty2- unifyTypes' ty1 (KindedType ty2 _) = ty1 `unifyTypes` ty2+ unifyTypes' (KindApp _ t3 t4) (KindApp _ t5 t6) = do+ t3 `unifyKinds'` t5+ t4 `unifyTypes` t6+ unifyTypes' (Skolem _ _ _ s1 _) (Skolem _ _ _ s2 _) | s1 == s2 = return ()+ unifyTypes' (KindedType _ ty1 _) ty2 = ty1 `unifyTypes` ty2+ unifyTypes' ty1 (KindedType _ ty2 _) = ty1 `unifyTypes` ty2 unifyTypes' r1@RCons{} r2 = unifyRows r1 r2 unifyTypes' r1 r2@RCons{} = unifyRows r1 r2- unifyTypes' r1@REmpty r2 = unifyRows r1 r2- unifyTypes' r1 r2@REmpty = unifyRows r1 r2- unifyTypes' ty1@(ConstrainedType _ _) ty2 = throwError . errorMessage $ ConstrainedTypeUnified ty1 ty2- unifyTypes' t3 t4@(ConstrainedType _ _) = unifyTypes' t4 t3- unifyTypes' t3 t4 = throwError . errorMessage $ TypesDoNotUnify t3 t4+ unifyTypes' r1@REmptyKinded{} r2 = unifyRows r1 r2+ unifyTypes' r1 r2@REmptyKinded{} = unifyRows r1 r2+ unifyTypes' (ConstrainedType _ c1 ty1) (ConstrainedType _ c2 ty2)+ | constraintClass c1 == constraintClass c2 && constraintData c1 == constraintData c2 = do+ traverse_ (uncurry unifyTypes) (constraintArgs c1 `zip` constraintArgs c2)+ ty1 `unifyTypes` ty2+ unifyTypes' ty1@ConstrainedType{} ty2 =+ throwError . errorMessage $ ConstrainedTypeUnified ty1 ty2+ unifyTypes' t3 t4@ConstrainedType{} = unifyTypes' t4 t3+ unifyTypes' t3 t4 =+ throwError . errorMessage $ TypesDoNotUnify t3 t4 --- |--- Unify two rows, updating the current substitution------ Common labels are first identified, and unified. Remaining labels and types are unified with a--- trailing row unification variable, if appropriate, otherwise leftover labels result in a unification--- error.+-- | Unify two rows, updating the current substitution ---unifyRows :: Type -> Type -> UnifyT Type Check ()-unifyRows r1 r2 =- let- (s1, r1') = rowToList r1- (s2, r2') = rowToList r2- int = [ (t1, t2) | (name, t1) <- s1, (name', t2) <- s2, name == name' ]- sd1 = [ (name, t1) | (name, t1) <- s1, name `notElem` map fst s2 ]- sd2 = [ (name, t2) | (name, t2) <- s2, name `notElem` map fst s1 ]- in do- forM_ int (uncurry (=?=))- unifyRows' sd1 r1' sd2 r2'- where- unifyRows' :: [(String, Type)] -> Type -> [(String, Type)] -> Type -> UnifyT Type Check ()- unifyRows' [] (TUnknown u) sd r = u =:= rowFromList (sd, r)- unifyRows' sd r [] (TUnknown u) = u =:= rowFromList (sd, r)- unifyRows' sd1 (TUnknown u1) sd2 (TUnknown u2) = do- forM_ sd1 $ \(_, t) -> occursCheck u2 t- forM_ sd2 $ \(_, t) -> occursCheck u1 t- rest <- fresh- u1 =:= rowFromList (sd2, rest)- u2 =:= rowFromList (sd1, rest)- unifyRows' sd1 (SaturatedTypeSynonym name args) sd2 r2' = do- r1' <- expandTypeSynonym name $ args- unifyRows (rowFromList (sd1, r1')) (rowFromList (sd2, r2'))- unifyRows' sd1 r1' sd2 r2'@(SaturatedTypeSynonym _ _) = unifyRows' sd2 r2' sd1 r1'- unifyRows' [] REmpty [] REmpty = return ()- unifyRows' [] (TypeVar v1) [] (TypeVar v2) | v1 == v2 = return ()- unifyRows' [] (Skolem _ s1 _) [] (Skolem _ s2 _) | s1 == s2 = return ()- unifyRows' sd3 r3 sd4 r4 = throwError . errorMessage $ TypesDoNotUnify (rowFromList (sd3, r3)) (rowFromList (sd4, r4))+-- Common labels are identified and unified. Remaining labels and types are unified with a+-- trailing row unification variable, if appropriate.+unifyRows :: forall m. (MonadError MultipleErrors m, MonadState CheckState m) => SourceType -> SourceType -> m ()+unifyRows r1 r2 = sequence_ matches *> uncurry unifyTails rest where+ unifyTypesWithLabel l t1 t2 = withErrorMessageHint (ErrorInRowLabel l) $ unifyTypes t1 t2 --- |--- Check that two types unify----unifiesWith :: Environment -> Type -> Type -> Bool-unifiesWith _ (TUnknown u1) (TUnknown u2) | u1 == u2 = True-unifiesWith _ (Skolem _ s1 _) (Skolem _ s2 _) | s1 == s2 = True-unifiesWith _ (TypeVar v1) (TypeVar v2) | v1 == v2 = True-unifiesWith _ (TypeConstructor c1) (TypeConstructor c2) | c1 == c2 = True-unifiesWith e (TypeApp h1 t1) (TypeApp h2 t2) = unifiesWith e h1 h2 && unifiesWith e t1 t2-unifiesWith e (SaturatedTypeSynonym name args) t2 =- case expandTypeSynonym' e name args of- Left _ -> False- Right t1 -> unifiesWith e t1 t2-unifiesWith e t1 t2@(SaturatedTypeSynonym _ _) = unifiesWith e t2 t1-unifiesWith _ REmpty REmpty = True-unifiesWith e r1@(RCons _ _ _) r2@(RCons _ _ _) =- let (s1, r1') = rowToList r1- (s2, r2') = rowToList r2- - int = [ (t1, t2) | (name, t1) <- s1, (name', t2) <- s2, name == name' ]- sd1 = [ (name, t1) | (name, t1) <- s1, name `notElem` map fst s2 ]- sd2 = [ (name, t2) | (name, t2) <- s2, name `notElem` map fst s1 ]- in all (\(t1, t2) -> unifiesWith e t1 t2) int && go sd1 r1' sd2 r2'- where- go :: [(String, Type)] -> Type -> [(String, Type)] -> Type -> Bool- go [] REmpty [] REmpty = True - go [] (TypeVar v1) [] (TypeVar v2) = v1 == v2- go [] (Skolem _ s1 _) [] (Skolem _ s2 _) = s1 == s2- go _ (TUnknown _) _ _ = True- go _ _ _ (TUnknown _) = True- go _ _ _ _ = False-unifiesWith _ _ _ = False+ (matches, rest) = alignRowsWith unifyTypesWithLabel r1 r2 --- |--- Replace a single type variable with a new unification variable----replaceVarWithUnknown :: String -> Type -> UnifyT Type Check Type-replaceVarWithUnknown ident ty = do- tu <- fresh- return $ replaceTypeVars ident tu ty+ unifyTails :: ([RowListItem SourceAnn], SourceType) -> ([RowListItem SourceAnn], SourceType) -> m ()+ unifyTails ([], TUnknown _ u) (sd, r) = solveType u (rowFromList (sd, r))+ unifyTails (sd, r) ([], TUnknown _ u) = solveType u (rowFromList (sd, r))+ unifyTails ([], REmptyKinded _ _) ([], REmptyKinded _ _) = return ()+ unifyTails ([], TypeVar _ v1) ([], TypeVar _ v2) | v1 == v2 = return ()+ unifyTails ([], Skolem _ _ _ s1 _) ([], Skolem _ _ _ s2 _) | s1 == s2 = return ()+ unifyTails (sd1, TUnknown a u1) (sd2, TUnknown _ u2) | u1 /= u2 = do+ forM_ sd1 $ occursCheck u2 . rowListType+ forM_ sd2 $ occursCheck u1 . rowListType+ rest' <- freshTypeWithKind =<< elaborateKind (TUnknown a u1)+ solveType u1 (rowFromList (sd2, rest'))+ solveType u2 (rowFromList (sd1, rest'))+ unifyTails _ _ =+ throwError . errorMessage $ TypesDoNotUnify r1 r2 -- | -- Replace type wildcards with unknowns ---replaceTypeWildcards :: Type -> UnifyT t Check Type+replaceTypeWildcards :: (MonadWriter MultipleErrors m, MonadState CheckState m) => SourceType -> m SourceType replaceTypeWildcards = everywhereOnTypesM replace where- replace TypeWildcard = do- u <- fresh'- return $ TUnknown u+ replace (TypeWildcard ann wdata) = do+ t <- freshType+ ctx <- getLocalContext+ let err = case wdata of+ HoleWildcard n -> Just $ HoleInferredType n t ctx Nothing+ UnnamedWildcard -> Just $ WildcardInferredType t ctx+ IgnoredWildcard -> Nothing+ forM_ err $ warnWithPosition (fst ann) . tell . errorMessage+ return t replace other = return other -- | -- Replace outermost unsolved unification variables with named type variables ---varIfUnknown :: Type -> Type-varIfUnknown ty =- let unks = nub $ unknowns ty- toName = (:) 't' . show- ty' = everywhereOnTypes typeToVar ty- typeToVar :: Type -> Type- typeToVar (TUnknown u) = TypeVar (toName u)- typeToVar t = t- in mkForAll (sort . map toName $ unks) ty'+varIfUnknown :: forall m. (MonadState CheckState m) => [(Unknown, SourceType)] -> SourceType -> m SourceType+varIfUnknown unks ty = do+ bn' <- traverse toBinding unks+ ty' <- go ty+ pure $ mkForAll bn' ty'+ where+ toName :: Unknown -> m T.Text+ toName u = (<> T.pack (show u)) . fromMaybe "t" <$> lookupUnkName u++ toBinding :: (Unknown, SourceType) -> m (SourceAnn, (T.Text, Maybe SourceType))+ toBinding (u, k) = do+ u' <- toName u+ k' <- go k+ pure (getAnnForType ty, (u', Just k'))++ go :: SourceType -> m SourceType+ go = everywhereOnTypesM $ \case+ (TUnknown ann u) ->+ TypeVar ann <$> toName u+ t -> pure t
src/Language/PureScript/TypeClassDictionaries.hs view
@@ -1,96 +1,49 @@------------------------------------------------------------------------------------ Module : Language.PureScript.TypeClassDictionaries--- Copyright : (c) 2014 Phil Freeman--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ |-----------------------------------------------------------------------------------{-# LANGUAGE DeriveDataTypeable #-}- module Language.PureScript.TypeClassDictionaries where -import Data.Data+import Prelude -import Language.PureScript.Names-import Language.PureScript.Types+import GHC.Generics (Generic)+import Control.DeepSeq (NFData)+import Data.Text (Text, pack) --- |+import Language.PureScript.AST.Declarations.ChainId (ChainId)+import Language.PureScript.Names (Ident, ProperName(..), ProperNameType(..), Qualified, disqualify)+import Language.PureScript.Types (SourceConstraint, SourceType)++-- -- Data representing a type class dictionary which is in scope ---data TypeClassDictionaryInScope+data TypeClassDictionaryInScope v = TypeClassDictionaryInScope {- -- |- -- The identifier with which the dictionary can be accessed at runtime- --- tcdName :: Qualified Ident- -- |- -- The name of the type class to which this type class instance applies- --- , tcdClassName :: Qualified ProperName- -- |- -- The types to which this type class instance applies- --- , tcdInstanceTypes :: [Type]- -- |- -- Type class dependencies which must be satisfied to construct this dictionary- --- , tcdDependencies :: Maybe [Constraint]- -- |- -- The type of this dictionary- --- , tcdType :: TypeClassDictionaryType- -- |- -- Is this instance exported by its module?- --- , tcdExported :: Bool- } deriving (Show, Data, Typeable)+ -- | The instance chain+ tcdChain :: Maybe ChainId+ -- | Index of the instance chain+ , tcdIndex :: Integer+ -- | The value with which the dictionary can be accessed at runtime+ , tcdValue :: v+ -- | How to obtain this instance via superclass relationships+ , tcdPath :: [(Qualified (ProperName 'ClassName), Integer)]+ -- | The name of the type class to which this type class instance applies+ , tcdClassName :: Qualified (ProperName 'ClassName)+ -- | Quantification of type variables in the instance head and dependencies+ , tcdForAll :: [(Text, SourceType)]+ -- | The kinds to which this type class instance applies+ , tcdInstanceKinds :: [SourceType]+ -- | The types to which this type class instance applies+ , tcdInstanceTypes :: [SourceType]+ -- | Type class dependencies which must be satisfied to construct this dictionary+ , tcdDependencies :: Maybe [SourceConstraint]+ -- | If this instance was unnamed, the type to use when describing it in+ -- error messages+ , tcdDescription :: Maybe SourceType+ }+ deriving (Show, Functor, Foldable, Traversable, Generic) --- |--- The type of a type class dictionary----data TypeClassDictionaryType- -- |- -- A regular type class dictionary- --- = TCDRegular- -- |- -- A type class dictionary which is an alias for an imported dictionary from another module- --- | TCDAlias (Qualified Ident) deriving (Show, Eq, Data, Typeable)+instance NFData v => NFData (TypeClassDictionaryInScope v) --- |--- A simplified representation of expressions which are used to represent type--- class dictionaries at runtime, which can be compared for equality----data DictionaryValue- -- |- -- A dictionary which is brought into scope by a local constraint- --- = LocalDictionaryValue (Qualified Ident)- -- |- -- A dictionary which is brought into scope by an instance declaration- --- | GlobalDictionaryValue (Qualified Ident)- -- |- -- A dictionary which depends on other dictionaries- --- | DependentDictionaryValue (Qualified Ident) [DictionaryValue]- -- |- -- A subclass dictionary- --- | SubclassDictionaryValue DictionaryValue (Qualified ProperName) Integer- deriving (Show, Ord, Eq)+type NamedDict = TypeClassDictionaryInScope (Qualified Ident) --- |--- Find the original dictionary which a type class dictionary in scope refers to----canonicalizeDictionary :: TypeClassDictionaryInScope -> Qualified Ident-canonicalizeDictionary (TypeClassDictionaryInScope { tcdType = TCDRegular, tcdName = nm }) = nm-canonicalizeDictionary (TypeClassDictionaryInScope { tcdType = TCDAlias nm }) = nm+-- | Generate a name for a superclass reference which can be used in+-- generated code.+superclassName :: Qualified (ProperName 'ClassName) -> Integer -> Text+superclassName pn index = runProperName (disqualify pn) <> pack (show index)
src/Language/PureScript/Types.hs view
@@ -1,314 +1,874 @@------------------------------------------------------------------------------------ Module : Language.PureScript.Types--- Copyright : (c) Phil Freeman 2013--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ |--- Data types for types-----------------------------------------------------------------------------------{-# LANGUAGE DeriveDataTypeable #-}--module Language.PureScript.Types where--import Data.Data-import Data.List (nub)--import Control.Monad.Unify-import Control.Arrow (second)-import Control.Applicative-import Control.Monad ((<=<))--import Language.PureScript.Names-import Language.PureScript.Kinds-import Language.PureScript.Traversals---- |--- An identifier for the scope of a skolem variable----newtype SkolemScope = SkolemScope { runSkolemScope :: Int } deriving (Show, Eq, Ord, Data, Typeable)---- |--- The type of types----data Type- -- |- -- A unification variable of type Type- --- = TUnknown Unknown- -- |- -- A named type variable- --- | TypeVar String- -- |- -- A type wildcard, as would appear in a partial type synonym- --- | TypeWildcard- -- |- -- A type constructor- --- | TypeConstructor (Qualified ProperName)- -- |- -- A type application- --- | TypeApp Type Type- -- |- -- A type synonym which is \"saturated\", i.e. fully applied- --- | SaturatedTypeSynonym (Qualified ProperName) [Type]- -- |- -- Forall quantifier- --- | ForAll String Type (Maybe SkolemScope)- -- |- -- A type with a set of type class constraints- --- | ConstrainedType [Constraint] Type- -- |- -- A skolem constant- --- | Skolem String Int SkolemScope- -- |- -- An empty row- --- | REmpty- -- |- -- A non-empty row- --- | RCons String Type Type- -- |- -- A type with a kind annotation- --- | KindedType Type Kind- --- -- |- -- A placeholder used in pretty printing- --- | PrettyPrintFunction Type Type- -- |- -- A placeholder used in pretty printing- --- | PrettyPrintArray Type- -- |- -- A placeholder used in pretty printing- --- | PrettyPrintObject Type- -- |- -- A placeholder used in pretty printing- --- | PrettyPrintForAll [String] Type deriving (Show, Eq, Data, Typeable)---- |--- A typeclass constraint----type Constraint = (Qualified ProperName, [Type])---- |--- Convert a row to a list of pairs of labels and types----rowToList :: Type -> ([(String, Type)], Type)-rowToList (RCons name ty row) = let (tys, rest) = rowToList row- in ((name, ty):tys, rest)-rowToList r = ([], r)---- |--- Convert a list of labels and types to a row----rowFromList :: ([(String, Type)], Type) -> Type-rowFromList ([], r) = r-rowFromList ((name, t):ts, r) = RCons name t (rowFromList (ts, r))---- |--- Check whether a type is a monotype----isMonoType :: Type -> Bool-isMonoType ForAll{} = False-isMonoType _ = True---- |--- Universally quantify a type----mkForAll :: [String] -> Type -> Type-mkForAll args ty = foldl (\t arg -> ForAll arg t Nothing) ty args---- |--- Replace a type variable, taking into account variable shadowing----replaceTypeVars :: String -> Type -> Type -> Type-replaceTypeVars v r = replaceAllTypeVars [(v, r)]---- |--- Replace named type variables with types----replaceAllTypeVars :: [(String, Type)] -> Type -> Type-replaceAllTypeVars = go []- where-- go :: [String] -> [(String, Type)] -> Type -> Type- go _ m (TypeVar v) =- case v `lookup` m of- Just r -> r- Nothing -> TypeVar v- go bs m (TypeApp t1 t2) = TypeApp (go bs m t1) (go bs m t2)- go bs m (SaturatedTypeSynonym name' ts) = SaturatedTypeSynonym name' $ map (go bs m) ts- go bs m f@(ForAll v t sco) | v `elem` keys = go bs (filter ((/= v) . fst) m) f- | v `elem` usedVars =- let v' = genName v (keys ++ bs ++ usedVars)- t' = go bs [(v, TypeVar v')] t- in ForAll v' (go (v' : bs) m t') sco- | otherwise = ForAll v (go (v : bs) m t) sco- where- keys = map fst m- usedVars = concatMap (usedTypeVariables . snd) m- go bs m (ConstrainedType cs t) = ConstrainedType (map (second $ map (go bs m)) cs) (go bs m t)- go bs m (RCons name' t r) = RCons name' (go bs m t) (go bs m r)- go bs m (KindedType t k) = KindedType (go bs m t) k- go _ _ ty = ty-- genName orig inUse = try 0- where- try :: Integer -> String- try n | (orig ++ show n) `elem` inUse = try (n + 1)- | otherwise = orig ++ show n---- |--- Collect all type variables appearing in a type----usedTypeVariables :: Type -> [String]-usedTypeVariables = nub . everythingOnTypes (++) go- where- go (TypeVar v) = [v]- go _ = []---- |--- Collect all free type variables appearing in a type----freeTypeVariables :: Type -> [String]-freeTypeVariables = nub . go []- where- go :: [String] -> Type -> [String]- go bound (TypeVar v) | v `notElem` bound = [v]- go bound (TypeApp t1 t2) = go bound t1 ++ go bound t2- go bound (SaturatedTypeSynonym _ ts) = concatMap (go bound) ts- go bound (ForAll v t _) = go (v : bound) t- go bound (ConstrainedType cs t) = concatMap (concatMap (go bound) . snd) cs ++ go bound t- go bound (RCons _ t r) = go bound t ++ go bound r- go bound (KindedType t _) = go bound t- go _ _ = []---- |--- Universally quantify over all type variables appearing free in a type----quantify :: Type -> Type-quantify ty = foldr (\arg t -> ForAll arg t Nothing) ty $ freeTypeVariables ty---- |--- Move all universal quantifiers to the front of a type----moveQuantifiersToFront :: Type -> Type-moveQuantifiersToFront = go [] []- where- go qs cs (ForAll q ty sco) = go ((q, sco) : qs) cs ty- go qs cs (ConstrainedType cs' ty) = go qs (cs ++ cs') ty- go qs cs ty =- let constrained = case cs of- [] -> ty- cs' -> ConstrainedType cs' ty- in case qs of- [] -> constrained- qs' -> foldl (\ty' (q, sco) -> ForAll q ty' sco) constrained qs'---- |--- Check if a type contains wildcards----containsWildcards :: Type -> Bool-containsWildcards = everythingOnTypes (||) go- where- go :: Type -> Bool- go TypeWildcard = True- go _ = False------- Traversals-----everywhereOnTypes :: (Type -> Type) -> Type -> Type-everywhereOnTypes f = go- where- go (TypeApp t1 t2) = f (TypeApp (go t1) (go t2))- go (SaturatedTypeSynonym name tys) = f (SaturatedTypeSynonym name (map go tys))- go (ForAll arg ty sco) = f (ForAll arg (go ty) sco)- go (ConstrainedType cs ty) = f (ConstrainedType (map (fmap (map go)) cs) (go ty))- go (RCons name ty rest) = f (RCons name (go ty) (go rest))- go (KindedType ty k) = f (KindedType (go ty) k)- go (PrettyPrintFunction t1 t2) = f (PrettyPrintFunction (go t1) (go t2))- go (PrettyPrintArray t) = f (PrettyPrintArray (go t))- go (PrettyPrintObject t) = f (PrettyPrintObject (go t))- go (PrettyPrintForAll args t) = f (PrettyPrintForAll args (go t))- go other = f other--everywhereOnTypesTopDown :: (Type -> Type) -> Type -> Type-everywhereOnTypesTopDown f = go . f- where- go (TypeApp t1 t2) = TypeApp (go (f t1)) (go (f t2))- go (SaturatedTypeSynonym name tys) = SaturatedTypeSynonym name (map (go . f) tys)- go (ForAll arg ty sco) = ForAll arg (go (f ty)) sco- go (ConstrainedType cs ty) = ConstrainedType (map (fmap (map (go . f))) cs) (go (f ty))- go (RCons name ty rest) = RCons name (go (f ty)) (go (f rest))- go (KindedType ty k) = KindedType (go (f ty)) k- go (PrettyPrintFunction t1 t2) = PrettyPrintFunction (go (f t1)) (go (f t2))- go (PrettyPrintArray t) = PrettyPrintArray (go (f t))- go (PrettyPrintObject t) = PrettyPrintObject (go (f t))- go (PrettyPrintForAll args t) = PrettyPrintForAll args (go (f t))- go other = f other--everywhereOnTypesM :: (Functor m, Applicative m, Monad m) => (Type -> m Type) -> Type -> m Type-everywhereOnTypesM f = go- where- go (TypeApp t1 t2) = (TypeApp <$> go t1 <*> go t2) >>= f- go (SaturatedTypeSynonym name tys) = (SaturatedTypeSynonym name <$> mapM go tys) >>= f- go (ForAll arg ty sco) = (ForAll arg <$> go ty <*> pure sco) >>= f- go (ConstrainedType cs ty) = (ConstrainedType <$> mapM (sndM (mapM go)) cs <*> go ty) >>= f- go (RCons name ty rest) = (RCons name <$> go ty <*> go rest) >>= f- go (KindedType ty k) = (KindedType <$> go ty <*> pure k) >>= f- go (PrettyPrintFunction t1 t2) = (PrettyPrintFunction <$> go t1 <*> go t2) >>= f- go (PrettyPrintArray t) = (PrettyPrintArray <$> go t) >>= f- go (PrettyPrintObject t) = (PrettyPrintObject <$> go t) >>= f- go (PrettyPrintForAll args t) = (PrettyPrintForAll args <$> go t) >>= f- go other = f other--everywhereOnTypesTopDownM :: (Functor m, Applicative m, Monad m) => (Type -> m Type) -> Type -> m Type-everywhereOnTypesTopDownM f = go <=< f- where- go (TypeApp t1 t2) = TypeApp <$> (f t1 >>= go) <*> (f t2 >>= go)- go (SaturatedTypeSynonym name tys) = SaturatedTypeSynonym name <$> mapM (go <=< f) tys- go (ForAll arg ty sco) = ForAll arg <$> (f ty >>= go) <*> pure sco- go (ConstrainedType cs ty) = ConstrainedType <$> mapM (sndM (mapM (go <=< f))) cs <*> (f ty >>= go)- go (RCons name ty rest) = RCons name <$> (f ty >>= go) <*> (f rest >>= go)- go (KindedType ty k) = KindedType <$> (f ty >>= go) <*> pure k- go (PrettyPrintFunction t1 t2) = PrettyPrintFunction <$> (f t1 >>= go) <*> (f t2 >>= go)- go (PrettyPrintArray t) = PrettyPrintArray <$> (f t >>= go)- go (PrettyPrintObject t) = PrettyPrintObject <$> (f t >>= go)- go (PrettyPrintForAll args t) = PrettyPrintForAll args <$> (f t >>= go)- go other = f other--everythingOnTypes :: (r -> r -> r) -> (Type -> r) -> Type -> r-everythingOnTypes (<>) f = go- where- go t@(TypeApp t1 t2) = f t <> go t1 <> go t2- go t@(SaturatedTypeSynonym _ tys) = foldl (<>) (f t) (map go tys)- go t@(ForAll _ ty _) = f t <> go ty- go t@(ConstrainedType cs ty) = foldl (<>) (f t) (map go $ concatMap snd cs) <> go ty- go t@(RCons _ ty rest) = f t <> go ty <> go rest- go t@(KindedType ty _) = f t <> go ty- go t@(PrettyPrintFunction t1 t2) = f t <> go t1 <> go t2- go t@(PrettyPrintArray t1) = f t <> go t1- go t@(PrettyPrintObject t1) = f t <> go t1- go t@(PrettyPrintForAll _ t1) = f t <> go t1- go other = f other+-- |+-- Data types for types+--+module Language.PureScript.Types where++import Prelude+import Protolude (ordNub, fromMaybe)++import Codec.Serialise (Serialise)+import Control.Applicative ((<|>))+import Control.Arrow (first, second)+import Control.DeepSeq (NFData)+import Control.Lens (Lens', (^.), set)+import Control.Monad ((<=<), (>=>))+import Data.Aeson ((.:), (.:?), (.!=), (.=))+import Data.Aeson qualified as A+import Data.Aeson.Types qualified as A+import Data.Foldable (fold, foldl')+import Data.IntSet qualified as IS+import Data.List (sortOn)+import Data.Maybe (isJust)+import Data.Text (Text)+import Data.Text qualified as T+import GHC.Generics (Generic)++import Language.PureScript.AST.SourcePos (pattern NullSourceAnn, SourceAnn, SourceSpan)+import Language.PureScript.Constants.Prim qualified as C+import Language.PureScript.Names (OpName, OpNameType(..), ProperName, ProperNameType(..), Qualified, coerceProperName)+import Language.PureScript.Label (Label)+import Language.PureScript.PSString (PSString)++type SourceType = Type SourceAnn+type SourceConstraint = Constraint SourceAnn++-- |+-- An identifier for the scope of a skolem variable+--+newtype SkolemScope = SkolemScope { runSkolemScope :: Int }+ deriving (Show, Eq, Ord, A.ToJSON, A.FromJSON, Generic)++instance NFData SkolemScope+instance Serialise SkolemScope++-- |+-- Describes how a TypeWildcard should be presented to the user during+-- type checking: holes (?foo) are always emitted as errors, whereas unnamed+-- wildcards (_) default to warnings, but are ignored entirely if they are+-- contained by a binding with a complete (wildcard-free) type signature.+--+data WildcardData = HoleWildcard Text | UnnamedWildcard | IgnoredWildcard+ deriving (Show, Eq, Ord, Generic)++instance NFData WildcardData+instance Serialise WildcardData++data TypeVarVisibility+ = TypeVarVisible+ | TypeVarInvisible+ deriving (Show, Eq, Ord, Generic)++instance NFData TypeVarVisibility+instance Serialise TypeVarVisibility++typeVarVisibilityPrefix :: TypeVarVisibility -> Text+typeVarVisibilityPrefix = \case+ TypeVarVisible -> "@"+ TypeVarInvisible -> mempty++-- |+-- The type of types+--+data Type a+ -- | A unification variable of type Type+ = TUnknown a Int+ -- | A named type variable+ | TypeVar a Text+ -- | A type-level string+ | TypeLevelString a PSString+ -- | A type-level natural+ | TypeLevelInt a Integer+ -- | A type wildcard, as would appear in a partial type synonym+ | TypeWildcard a WildcardData+ -- | A type constructor+ | TypeConstructor a (Qualified (ProperName 'TypeName))+ -- | A type operator. This will be desugared into a type constructor during the+ -- "operators" phase of desugaring.+ | TypeOp a (Qualified (OpName 'TypeOpName))+ -- | A type application+ | TypeApp a (Type a) (Type a)+ -- | Explicit kind application+ | KindApp a (Type a) (Type a)+ -- | Forall quantifier+ | ForAll a TypeVarVisibility Text (Maybe (Type a)) (Type a) (Maybe SkolemScope)+ -- | A type with a set of type class constraints+ | ConstrainedType a (Constraint a) (Type a)+ -- | A skolem constant+ | Skolem a Text (Maybe (Type a)) Int SkolemScope+ -- | An empty row+ | REmpty a+ -- | A non-empty row+ | RCons a Label (Type a) (Type a)+ -- | A type with a kind annotation+ | KindedType a (Type a) (Type a)+ -- | Binary operator application. During the rebracketing phase of desugaring,+ -- this data constructor will be removed.+ | BinaryNoParensType a (Type a) (Type a) (Type a)+ -- | Explicit parentheses. During the rebracketing phase of desugaring, this+ -- data constructor will be removed.+ --+ -- Note: although it seems this constructor is not used, it _is_ useful,+ -- since it prevents certain traversals from matching.+ | ParensInType a (Type a)+ deriving (Show, Generic, Functor, Foldable, Traversable)++instance NFData a => NFData (Type a)+instance Serialise a => Serialise (Type a)++srcTUnknown :: Int -> SourceType+srcTUnknown = TUnknown NullSourceAnn++srcTypeVar :: Text -> SourceType+srcTypeVar = TypeVar NullSourceAnn++srcTypeLevelString :: PSString -> SourceType+srcTypeLevelString = TypeLevelString NullSourceAnn++srcTypeLevelInt :: Integer -> SourceType+srcTypeLevelInt = TypeLevelInt NullSourceAnn++srcTypeWildcard :: SourceType+srcTypeWildcard = TypeWildcard NullSourceAnn UnnamedWildcard++srcTypeConstructor :: Qualified (ProperName 'TypeName) -> SourceType+srcTypeConstructor = TypeConstructor NullSourceAnn++srcTypeApp :: SourceType -> SourceType -> SourceType+srcTypeApp = TypeApp NullSourceAnn++srcKindApp :: SourceType -> SourceType -> SourceType+srcKindApp = KindApp NullSourceAnn++srcForAll :: TypeVarVisibility -> Text -> Maybe SourceType -> SourceType -> Maybe SkolemScope -> SourceType+srcForAll = ForAll NullSourceAnn++srcConstrainedType :: SourceConstraint -> SourceType -> SourceType+srcConstrainedType = ConstrainedType NullSourceAnn++srcREmpty :: SourceType+srcREmpty = REmpty NullSourceAnn++srcRCons :: Label -> SourceType -> SourceType -> SourceType+srcRCons = RCons NullSourceAnn++srcKindedType :: SourceType -> SourceType -> SourceType+srcKindedType = KindedType NullSourceAnn++pattern REmptyKinded :: forall a. a -> Maybe (Type a) -> Type a+pattern REmptyKinded ann mbK <- (toREmptyKinded -> Just (ann, mbK))++toREmptyKinded :: forall a. Type a -> Maybe (a, Maybe (Type a))+toREmptyKinded (REmpty ann) = Just (ann, Nothing)+toREmptyKinded (KindApp _ (REmpty ann) k) = Just (ann, Just k)+toREmptyKinded _ = Nothing++isREmpty :: forall a. Type a -> Bool+isREmpty = isJust . toREmptyKinded++-- | Additional data relevant to type class constraints+data ConstraintData+ = PartialConstraintData [[Text]] Bool+ -- ^ Data to accompany a Partial constraint generated by the exhaustivity checker.+ -- It contains (rendered) binder information for those binders which were+ -- not matched, and a flag indicating whether the list was truncated or not.+ -- Note: we use 'Text' here because using 'Binder' would introduce a cyclic+ -- dependency in the module graph.+ deriving (Show, Eq, Ord, Generic)++instance NFData ConstraintData+instance Serialise ConstraintData++-- | A typeclass constraint+data Constraint a = Constraint+ { constraintAnn :: a+ -- ^ constraint annotation+ , constraintClass :: Qualified (ProperName 'ClassName)+ -- ^ constraint class name+ , constraintKindArgs :: [Type a]+ -- ^ kind arguments+ , constraintArgs :: [Type a]+ -- ^ type arguments+ , constraintData :: Maybe ConstraintData+ -- ^ additional data relevant to this constraint+ } deriving (Show, Generic, Functor, Foldable, Traversable)++instance NFData a => NFData (Constraint a)+instance Serialise a => Serialise (Constraint a)++srcConstraint :: Qualified (ProperName 'ClassName) -> [SourceType] -> [SourceType] -> Maybe ConstraintData -> SourceConstraint+srcConstraint = Constraint NullSourceAnn++mapConstraintArgs :: ([Type a] -> [Type a]) -> Constraint a -> Constraint a+mapConstraintArgs f c = c { constraintArgs = f (constraintArgs c) }++overConstraintArgs :: Functor f => ([Type a] -> f [Type a]) -> Constraint a -> f (Constraint a)+overConstraintArgs f c = (\args -> c { constraintArgs = args }) <$> f (constraintArgs c)++mapConstraintArgsAll :: ([Type a] -> [Type a]) -> Constraint a -> Constraint a+mapConstraintArgsAll f c =+ c { constraintKindArgs = f (constraintKindArgs c)+ , constraintArgs = f (constraintArgs c)+ }++overConstraintArgsAll :: Applicative f => ([Type a] -> f [Type a]) -> Constraint a -> f (Constraint a)+overConstraintArgsAll f c =+ (\a b -> c { constraintKindArgs = a, constraintArgs = b })+ <$> f (constraintKindArgs c)+ <*> f (constraintArgs c)++constraintDataToJSON :: ConstraintData -> A.Value+constraintDataToJSON (PartialConstraintData bs trunc) =+ A.object+ [ "contents" .= (bs, trunc)+ ]++constraintToJSON :: (a -> A.Value) -> Constraint a -> A.Value+constraintToJSON annToJSON Constraint {..} =+ A.object+ [ "constraintAnn" .= annToJSON constraintAnn+ , "constraintClass" .= constraintClass+ , "constraintKindArgs" .= fmap (typeToJSON annToJSON) constraintKindArgs+ , "constraintArgs" .= fmap (typeToJSON annToJSON) constraintArgs+ , "constraintData" .= fmap constraintDataToJSON constraintData+ ]++typeVarVisToJSON :: TypeVarVisibility -> A.Value+typeVarVisToJSON = \case+ TypeVarVisible -> A.toJSON ("TypeVarVisible" :: Text)+ TypeVarInvisible -> A.toJSON ("TypeVarInvisible" :: Text)++typeToJSON :: forall a. (a -> A.Value) -> Type a -> A.Value+typeToJSON annToJSON ty =+ case ty of+ TUnknown a b ->+ variant "TUnknown" a b+ TypeVar a b ->+ variant "TypeVar" a b+ TypeLevelString a b ->+ variant "TypeLevelString" a b+ TypeLevelInt a b ->+ variant "TypeLevelInt" a b+ TypeWildcard a b ->+ variant "TypeWildcard" a b+ TypeConstructor a b ->+ variant "TypeConstructor" a b+ TypeOp a b ->+ variant "TypeOp" a b+ TypeApp a b c ->+ variant "TypeApp" a (go b, go c)+ KindApp a b c ->+ variant "KindApp" a (go b, go c)+ ForAll a b c d e f ->+ variant "ForAll" a $ A.object+ [ "visibility" .= b+ , "identifier" .= c+ , "kind" .= fmap go d+ , "type" .= go e+ , "skolem" .= f+ ]+ ConstrainedType a b c ->+ variant "ConstrainedType" a (constraintToJSON annToJSON b, go c)+ Skolem a b c d e ->+ variant "Skolem" a (b, go <$> c, d, e)+ REmpty a ->+ nullary "REmpty" a+ RCons a b c d ->+ variant "RCons" a (b, go c, go d)+ KindedType a b c ->+ variant "KindedType" a (go b, go c)+ BinaryNoParensType a b c d ->+ variant "BinaryNoParensType" a (go b, go c, go d)+ ParensInType a b ->+ variant "ParensInType" a (go b)+ where+ go :: Type a -> A.Value+ go = typeToJSON annToJSON++ variant :: A.ToJSON b => String -> a -> b -> A.Value+ variant tag ann contents =+ A.object+ [ "tag" .= tag+ , "annotation" .= annToJSON ann+ , "contents" .= contents+ ]++ nullary :: String -> a -> A.Value+ nullary tag ann =+ A.object+ [ "tag" .= tag+ , "annotation" .= annToJSON ann+ ]++instance A.ToJSON WildcardData where+ toJSON = \case+ HoleWildcard name -> A.String name+ UnnamedWildcard -> A.Null+ IgnoredWildcard -> A.object [ "ignored" .= True ]++instance A.ToJSON a => A.ToJSON (Type a) where+ toJSON = typeToJSON A.toJSON++instance A.ToJSON a => A.ToJSON (Constraint a) where+ toJSON = constraintToJSON A.toJSON++instance A.ToJSON ConstraintData where+ toJSON = constraintDataToJSON++instance A.ToJSON TypeVarVisibility where+ toJSON = typeVarVisToJSON++constraintDataFromJSON :: A.Value -> A.Parser ConstraintData+constraintDataFromJSON = A.withObject "PartialConstraintData" $ \o -> do+ (bs, trunc) <- o .: "contents"+ pure $ PartialConstraintData bs trunc++constraintFromJSON :: forall a. A.Parser a -> (A.Value -> A.Parser a) -> A.Value -> A.Parser (Constraint a)+constraintFromJSON defaultAnn annFromJSON = A.withObject "Constraint" $ \o -> do+ constraintAnn <- (o .: "constraintAnn" >>= annFromJSON) <|> defaultAnn+ constraintClass <- o .: "constraintClass"+ constraintKindArgs <- o .:? "constraintKindArgs" .!= [] >>= traverse (typeFromJSON defaultAnn annFromJSON)+ constraintArgs <- o .: "constraintArgs" >>= traverse (typeFromJSON defaultAnn annFromJSON)+ constraintData <- o .: "constraintData" >>= traverse constraintDataFromJSON+ pure $ Constraint {..}++typeVarVisFromJSON :: A.Value -> A.Parser TypeVarVisibility+typeVarVisFromJSON v = do+ v' <- A.parseJSON v+ case v' of+ "TypeVarVisible" -> pure TypeVarVisible+ "TypeVarInvisible" -> pure TypeVarInvisible+ _ -> fail $ "Unrecognized TypeVarVisibility: " <> v'++typeFromJSON :: forall a. A.Parser a -> (A.Value -> A.Parser a) -> A.Value -> A.Parser (Type a)+typeFromJSON defaultAnn annFromJSON = A.withObject "Type" $ \o -> do+ tag <- o .: "tag"+ a <- (o .: "annotation" >>= annFromJSON) <|> defaultAnn+ let+ contents :: A.FromJSON b => A.Parser b+ contents = o .: "contents"+ case tag of+ "TUnknown" ->+ TUnknown a <$> contents+ "TypeVar" ->+ TypeVar a <$> contents+ "TypeLevelString" ->+ TypeLevelString a <$> contents+ "TypeLevelInt" ->+ TypeLevelInt a <$> contents+ "TypeWildcard" -> do+ b <- contents <|> pure UnnamedWildcard+ pure $ TypeWildcard a b+ "TypeConstructor" ->+ TypeConstructor a <$> contents+ "TypeOp" ->+ TypeOp a <$> contents+ "TypeApp" -> do+ (b, c) <- contents+ TypeApp a <$> go b <*> go c+ "KindApp" -> do+ (b, c) <- contents+ KindApp a <$> go b <*> go c+ "ForAll" -> do+ let+ asObject = do+ f <- contents+ v <- f .: "visibility"+ i <- f .: "identifier"+ k <- f .:? "kind"+ t <- f .: "type"+ s <- f .: "skolem"+ ForAll a v i <$> traverse go k <*> go t <*> pure s++ withoutMbKind = do+ (b, c, d) <- contents+ ForAll a TypeVarInvisible b Nothing <$> go c <*> pure d++ withMbKind = do+ (b, c, d, e) <- contents+ ForAll a TypeVarInvisible b <$> (Just <$> go c) <*> go d <*> pure e+ asObject <|> withMbKind <|> withoutMbKind+ "ConstrainedType" -> do+ (b, c) <- contents+ ConstrainedType a <$> constraintFromJSON defaultAnn annFromJSON b <*> go c+ "Skolem" -> do+ (b, c, d, e) <- contents+ c' <- traverse go c+ pure $ Skolem a b c' d e+ "REmpty" ->+ pure $ REmpty a+ "RCons" -> do+ (b, c, d) <- contents+ RCons a b <$> go c <*> go d+ "KindedType" -> do+ (b, c) <- contents+ KindedType a <$> go b <*> go c+ "BinaryNoParensType" -> do+ (b, c, d) <- contents+ BinaryNoParensType a <$> go b <*> go c <*> go d+ "ParensInType" -> do+ b <- contents+ ParensInType a <$> go b+ -- Backwards compatibility for kinds+ "KUnknown" ->+ TUnknown a <$> contents+ "Row" ->+ TypeApp a (TypeConstructor a C.Row) <$> (go =<< contents)+ "FunKind" -> do+ (b, c) <- contents+ TypeApp a . TypeApp a (TypeConstructor a C.Function) <$> go b <*> go c+ "NamedKind" ->+ TypeConstructor a <$> contents+ other ->+ fail $ "Unrecognised tag: " ++ other+ where+ go :: A.Value -> A.Parser (Type a)+ go = typeFromJSON defaultAnn annFromJSON++-- These overlapping instances exist to preserve compatibility for common+-- instances which have a sensible default for missing annotations.+instance {-# OVERLAPPING #-} A.FromJSON (Type SourceAnn) where+ parseJSON = typeFromJSON (pure NullSourceAnn) A.parseJSON++instance {-# OVERLAPPING #-} A.FromJSON (Type ()) where+ parseJSON = typeFromJSON (pure ()) A.parseJSON++instance {-# OVERLAPPING #-} A.FromJSON a => A.FromJSON (Type a) where+ parseJSON = typeFromJSON (fail "Invalid annotation") A.parseJSON++instance {-# OVERLAPPING #-} A.FromJSON (Constraint SourceAnn) where+ parseJSON = constraintFromJSON (pure NullSourceAnn) A.parseJSON++instance {-# OVERLAPPING #-} A.FromJSON (Constraint ()) where+ parseJSON = constraintFromJSON (pure ()) A.parseJSON++instance {-# OVERLAPPING #-} A.FromJSON a => A.FromJSON (Constraint a) where+ parseJSON = constraintFromJSON (fail "Invalid annotation") A.parseJSON++instance A.FromJSON ConstraintData where+ parseJSON = constraintDataFromJSON++instance A.FromJSON WildcardData where+ parseJSON = \case+ A.String name -> pure $ HoleWildcard name+ A.Object _ -> pure IgnoredWildcard+ A.Null -> pure UnnamedWildcard+ _ -> fail "Unrecognized WildcardData"++instance A.FromJSON TypeVarVisibility where+ parseJSON = typeVarVisFromJSON++data RowListItem a = RowListItem+ { rowListAnn :: a+ , rowListLabel :: Label+ , rowListType :: Type a+ } deriving (Show, Generic, Functor, Foldable, Traversable)++srcRowListItem :: Label -> SourceType -> RowListItem SourceAnn+srcRowListItem = RowListItem NullSourceAnn++-- | Convert a row to a list of pairs of labels and types+rowToList :: Type a -> ([RowListItem a], Type a)+rowToList = go where+ go (RCons ann name ty row) =+ first (RowListItem ann name ty :) (rowToList row)+ go r = ([], r)++-- | Convert a row to a list of pairs of labels and types, sorted by the labels.+rowToSortedList :: Type a -> ([RowListItem a], Type a)+rowToSortedList = first (sortOn rowListLabel) . rowToList++-- | Convert a list of labels and types to a row+rowFromList :: ([RowListItem a], Type a) -> Type a+rowFromList (xs, r) = foldr (\(RowListItem ann name ty) -> RCons ann name ty) r xs++-- | Align two rows of types, splitting them into three parts:+--+-- * Those types which appear in both rows+-- * Those which appear only on the left+-- * Those which appear only on the right+--+-- Note: importantly, we preserve the order of the types with a given label.+alignRowsWith+ :: (Label -> Type a -> Type a -> r)+ -> Type a+ -> Type a+ -> ([r], (([RowListItem a], Type a), ([RowListItem a], Type a)))+alignRowsWith f ty1 ty2 = go s1 s2 where+ (s1, tail1) = rowToSortedList ty1+ (s2, tail2) = rowToSortedList ty2++ go [] r = ([], (([], tail1), (r, tail2)))+ go r [] = ([], ((r, tail1), ([], tail2)))+ go lhs@(RowListItem a1 l1 t1 : r1) rhs@(RowListItem a2 l2 t2 : r2) = + case compare l1 l2 of+ LT -> (second . first . first) (RowListItem a1 l1 t1 :) (go r1 rhs)+ GT -> (second . second . first) (RowListItem a2 l2 t2 :) (go lhs r2)+ EQ -> first (f l1 t1 t2 :) (go r1 r2)++-- | Check whether a type is a monotype+isMonoType :: Type a -> Bool+isMonoType ForAll{} = False+isMonoType (ParensInType _ t) = isMonoType t+isMonoType (KindedType _ t _) = isMonoType t+isMonoType _ = True++-- | Universally quantify a type+mkForAll :: [(a, (Text, Maybe (Type a)))] -> Type a -> Type a+mkForAll args ty = foldr (\(ann, (arg, mbK)) t -> ForAll ann TypeVarInvisible arg mbK t Nothing) ty args++-- | Replace a type variable, taking into account variable shadowing+replaceTypeVars :: Text -> Type a -> Type a -> Type a+replaceTypeVars v r = replaceAllTypeVars [(v, r)]++-- | Replace named type variables with types+replaceAllTypeVars :: [(Text, Type a)] -> Type a -> Type a+replaceAllTypeVars = go [] where+ go :: [Text] -> [(Text, Type a)] -> Type a -> Type a+ go _ m (TypeVar ann v) = fromMaybe (TypeVar ann v) (v `lookup` m)+ go bs m (TypeApp ann t1 t2) = TypeApp ann (go bs m t1) (go bs m t2)+ go bs m (KindApp ann t1 t2) = KindApp ann (go bs m t1) (go bs m t2)+ go bs m (ForAll ann vis v mbK t sco)+ | v `elem` keys = go bs (filter ((/= v) . fst) m) $ ForAll ann vis v mbK' t sco+ | v `elem` usedVars =+ let v' = genPureName v (keys ++ bs ++ usedVars)+ t' = go bs [(v, TypeVar ann v')] t+ in ForAll ann vis v' mbK' (go (v' : bs) m t') sco+ | otherwise = ForAll ann vis v mbK' (go (v : bs) m t) sco+ where+ mbK' = go bs m <$> mbK+ keys = map fst m+ usedVars = concatMap (usedTypeVariables . snd) m+ go bs m (ConstrainedType ann c t) = ConstrainedType ann (mapConstraintArgsAll (map (go bs m)) c) (go bs m t)+ go bs m (RCons ann name' t r) = RCons ann name' (go bs m t) (go bs m r)+ go bs m (KindedType ann t k) = KindedType ann (go bs m t) (go bs m k)+ go bs m (BinaryNoParensType ann t1 t2 t3) = BinaryNoParensType ann (go bs m t1) (go bs m t2) (go bs m t3)+ go bs m (ParensInType ann t) = ParensInType ann (go bs m t)+ go _ _ ty = ty++genPureName :: Text -> [Text] -> Text+genPureName orig inUse = try' 0+ where+ try' :: Integer -> Text+ try' n | (orig <> T.pack (show n)) `elem` inUse = try' (n + 1)+ | otherwise = orig <> T.pack (show n)++-- | Add visible type abstractions to top-level foralls.+addVisibility :: [(Text, TypeVarVisibility)] -> Type a -> Type a+addVisibility v = go where+ go (ForAll ann vis arg mbK ty sco) = case lookup arg v of+ Just vis' ->+ ForAll ann vis' arg mbK (go ty) sco+ Nothing ->+ ForAll ann vis arg mbK (go ty) sco+ go (ParensInType ann ty) = ParensInType ann (go ty)+ go ty = ty++-- | Collect all type variables appearing in a type+usedTypeVariables :: Type a -> [Text]+usedTypeVariables = ordNub . everythingOnTypes (++) go where+ go (TypeVar _ v) = [v]+ go _ = []++-- | Collect all free type variables appearing in a type+freeTypeVariables :: Type a -> [Text]+freeTypeVariables = ordNub . fmap snd . sortOn fst . go 0 [] where+ -- Tracks kind levels so that variables appearing in kind annotations are listed first.+ go :: Int -> [Text] -> Type a -> [(Int, Text)]+ go lvl bound (TypeVar _ v) | v `notElem` bound = [(lvl, v)]+ go lvl bound (TypeApp _ t1 t2) = go lvl bound t1 ++ go lvl bound t2+ go lvl bound (KindApp _ t1 t2) = go lvl bound t1 ++ go (lvl - 1) bound t2+ go lvl bound (ForAll _ _ v mbK t _) = foldMap (go (lvl - 1) bound) mbK ++ go lvl (v : bound) t+ go lvl bound (ConstrainedType _ c t) = foldMap (go (lvl - 1) bound) (constraintKindArgs c) ++ foldMap (go lvl bound) (constraintArgs c) ++ go lvl bound t+ go lvl bound (RCons _ _ t r) = go lvl bound t ++ go lvl bound r+ go lvl bound (KindedType _ t k) = go lvl bound t ++ go (lvl - 1) bound k+ go lvl bound (BinaryNoParensType _ t1 t2 t3) = go lvl bound t1 ++ go lvl bound t2 ++ go lvl bound t3+ go lvl bound (ParensInType _ t) = go lvl bound t+ go _ _ _ = []++-- | Collect a complete set of kind-annotated quantifiers at the front of a type.+completeBinderList :: Type a -> Maybe ([(a, (Text, Type a))], Type a)+completeBinderList = go []+ where+ go acc = \case+ ForAll _ _ _ Nothing _ _ -> Nothing+ ForAll ann _ var (Just k) ty _ -> go ((ann, (var, k)) : acc) ty+ ty -> Just (reverse acc, ty)++-- | Universally quantify over all type variables appearing free in a type+quantify :: Type a -> Type a+quantify ty = foldr (\arg t -> ForAll (getAnnForType ty) TypeVarInvisible arg Nothing t Nothing) ty $ freeTypeVariables ty++-- | Move all universal quantifiers to the front of a type+moveQuantifiersToFront :: a -> Type a -> Type a+moveQuantifiersToFront syntheticAnn = go [] [] + where+ go qs cs = \case+ ForAll ann vis q mbK ty sco -> do+ let + cArgs :: [Text] = cs >>= constraintArgs . snd >>= freeTypeVariables+ (q'', ty')+ | q `elem` cArgs = do+ let q' = genPureName q $ cArgs <> freeTypeVariables ty+ (q', replaceTypeVars q (TypeVar syntheticAnn q') ty)+ | otherwise =+ (q, ty)+ go ((ann, q'', sco, mbK, vis) : qs) cs ty'+ ConstrainedType ann c ty ->+ go qs ((ann, c) : cs) ty+ ty -> + foldl (\ty' (ann, q, sco, mbK, vis) -> ForAll ann vis q mbK ty' sco) (foldl (\ty' (ann, c) -> ConstrainedType ann c ty') ty cs) qs++-- | Check if a type contains `forall`+containsForAll :: Type a -> Bool+containsForAll = everythingOnTypes (||) go where+ go :: Type a -> Bool+ go ForAll{} = True+ go _ = False++unknowns :: Type a -> IS.IntSet+unknowns = everythingOnTypes (<>) go where+ go :: Type a -> IS.IntSet+ go (TUnknown _ u) = IS.singleton u+ go _ = mempty++-- | Check if a type contains unknowns in a position that is relevant to+-- constraint solving. (Kinds are not.)+containsUnknowns :: Type a -> Bool+containsUnknowns = everythingOnTypes (||) go . eraseKindApps where+ go :: Type a -> Bool+ go TUnknown{} = True+ go _ = False++eraseKindApps :: Type a -> Type a+eraseKindApps = everywhereOnTypes $ \case+ KindApp _ ty _ -> ty+ ConstrainedType ann con ty ->+ ConstrainedType ann (con { constraintKindArgs = [] }) ty+ Skolem ann name _ i sc ->+ Skolem ann name Nothing i sc+ other -> other++eraseForAllKindAnnotations :: Type a -> Type a+eraseForAllKindAnnotations = removeAmbiguousVars . removeForAllKinds+ where+ removeForAllKinds = everywhereOnTypes $ \case+ ForAll ann vis arg _ ty sco ->+ ForAll ann vis arg Nothing ty sco+ other -> other++ removeAmbiguousVars = everywhereOnTypes $ \case+ fa@(ForAll _ _ arg _ ty _)+ | arg `elem` freeTypeVariables ty -> fa+ | otherwise -> ty+ other -> other++unapplyTypes :: Type a -> (Type a, [Type a], [Type a])+unapplyTypes = goTypes []+ where+ goTypes acc (TypeApp _ a b) = goTypes (b : acc) a+ goTypes acc a = let (ty, kinds) = goKinds [] a in (ty, kinds, acc)++ goKinds acc (KindApp _ a b) = goKinds (b : acc) a+ goKinds acc a = (a, acc)++unapplyConstraints :: Type a -> ([Constraint a], Type a)+unapplyConstraints = go []+ where+ go acc (ConstrainedType _ con ty) = go (con : acc) ty+ go acc ty = (reverse acc, ty)++-- | Construct the type of an instance declaration from its parts. Used in+-- error messages describing unnamed instances.+srcInstanceType+ :: SourceSpan+ -> [(Text, SourceType)]+ -> Qualified (ProperName 'ClassName)+ -> [SourceType]+ -> SourceType+srcInstanceType ss vars className tys+ = setAnnForType (ss, [])+ . flip (foldr $ \(tv, k) ty -> srcForAll TypeVarInvisible tv (Just k) ty Nothing) vars+ . flip (foldl' srcTypeApp) tys+ $ srcTypeConstructor $ coerceProperName <$> className++everywhereOnTypes :: (Type a -> Type a) -> Type a -> Type a+everywhereOnTypes f = go where+ go (TypeApp ann t1 t2) = f (TypeApp ann (go t1) (go t2))+ go (KindApp ann t1 t2) = f (KindApp ann (go t1) (go t2))+ go (ForAll ann vis arg mbK ty sco) = f (ForAll ann vis arg (go <$> mbK) (go ty) sco)+ go (ConstrainedType ann c ty) = f (ConstrainedType ann (mapConstraintArgsAll (map go) c) (go ty))+ go (Skolem ann name mbK i sc) = f (Skolem ann name (go <$> mbK) i sc)+ go (RCons ann name ty rest) = f (RCons ann name (go ty) (go rest))+ go (KindedType ann ty k) = f (KindedType ann (go ty) (go k))+ go (BinaryNoParensType ann t1 t2 t3) = f (BinaryNoParensType ann (go t1) (go t2) (go t3))+ go (ParensInType ann t) = f (ParensInType ann (go t))+ go other = f other++everywhereOnTypesM :: Monad m => (Type a -> m (Type a)) -> Type a -> m (Type a)+everywhereOnTypesM f = go where+ go (TypeApp ann t1 t2) = (TypeApp ann <$> go t1 <*> go t2) >>= f+ go (KindApp ann t1 t2) = (KindApp ann <$> go t1 <*> go t2) >>= f+ go (ForAll ann vis arg mbK ty sco) = (ForAll ann vis arg <$> traverse go mbK <*> go ty <*> pure sco) >>= f+ go (ConstrainedType ann c ty) = (ConstrainedType ann <$> overConstraintArgsAll (mapM go) c <*> go ty) >>= f+ go (Skolem ann name mbK i sc) = (Skolem ann name <$> traverse go mbK <*> pure i <*> pure sc) >>= f+ go (RCons ann name ty rest) = (RCons ann name <$> go ty <*> go rest) >>= f+ go (KindedType ann ty k) = (KindedType ann <$> go ty <*> go k) >>= f+ go (BinaryNoParensType ann t1 t2 t3) = (BinaryNoParensType ann <$> go t1 <*> go t2 <*> go t3) >>= f+ go (ParensInType ann t) = (ParensInType ann <$> go t) >>= f+ go other = f other++everywhereOnTypesTopDownM :: Monad m => (Type a -> m (Type a)) -> Type a -> m (Type a)+everywhereOnTypesTopDownM f = go <=< f where+ go (TypeApp ann t1 t2) = TypeApp ann <$> (f t1 >>= go) <*> (f t2 >>= go)+ go (KindApp ann t1 t2) = KindApp ann <$> (f t1 >>= go) <*> (f t2 >>= go)+ go (ForAll ann vis arg mbK ty sco) = ForAll ann vis arg <$> traverse (f >=> go) mbK <*> (f ty >>= go) <*> pure sco+ go (ConstrainedType ann c ty) = ConstrainedType ann <$> overConstraintArgsAll (mapM (go <=< f)) c <*> (f ty >>= go)+ go (Skolem ann name mbK i sc) = Skolem ann name <$> traverse (f >=> go) mbK <*> pure i <*> pure sc+ go (RCons ann name ty rest) = RCons ann name <$> (f ty >>= go) <*> (f rest >>= go)+ go (KindedType ann ty k) = KindedType ann <$> (f ty >>= go) <*> (f k >>= go)+ go (BinaryNoParensType ann t1 t2 t3) = BinaryNoParensType ann <$> (f t1 >>= go) <*> (f t2 >>= go) <*> (f t3 >>= go)+ go (ParensInType ann t) = ParensInType ann <$> (f t >>= go)+ go other = pure other++everythingOnTypes :: (r -> r -> r) -> (Type a -> r) -> Type a -> r+everythingOnTypes (<+>) f = go where+ go t@(TypeApp _ t1 t2) = f t <+> go t1 <+> go t2+ go t@(KindApp _ t1 t2) = f t <+> go t1 <+> go t2+ go t@(ForAll _ _ _ (Just k) ty _) = f t <+> go k <+> go ty+ go t@(ForAll _ _ _ _ ty _) = f t <+> go ty+ go t@(ConstrainedType _ c ty) = foldl (<+>) (f t) (map go (constraintKindArgs c) ++ map go (constraintArgs c)) <+> go ty+ go t@(Skolem _ _ (Just k) _ _) = f t <+> go k+ go t@(RCons _ _ ty rest) = f t <+> go ty <+> go rest+ go t@(KindedType _ ty k) = f t <+> go ty <+> go k+ go t@(BinaryNoParensType _ t1 t2 t3) = f t <+> go t1 <+> go t2 <+> go t3+ go t@(ParensInType _ t1) = f t <+> go t1+ go other = f other++everythingWithContextOnTypes :: s -> r -> (r -> r -> r) -> (s -> Type a -> (s, r)) -> Type a -> r+everythingWithContextOnTypes s0 r0 (<+>) f = go' s0 where+ go' s t = let (s', r) = f s t in r <+> go s' t+ go s (TypeApp _ t1 t2) = go' s t1 <+> go' s t2+ go s (KindApp _ t1 t2) = go' s t1 <+> go' s t2+ go s (ForAll _ _ _ (Just k) ty _) = go' s k <+> go' s ty+ go s (ForAll _ _ _ _ ty _) = go' s ty+ go s (ConstrainedType _ c ty) = foldl (<+>) r0 (map (go' s) (constraintKindArgs c) ++ map (go' s) (constraintArgs c)) <+> go' s ty+ go s (Skolem _ _ (Just k) _ _) = go' s k+ go s (RCons _ _ ty rest) = go' s ty <+> go' s rest+ go s (KindedType _ ty k) = go' s ty <+> go' s k+ go s (BinaryNoParensType _ t1 t2 t3) = go' s t1 <+> go' s t2 <+> go' s t3+ go s (ParensInType _ t1) = go' s t1+ go _ _ = r0++annForType :: Lens' (Type a) a+annForType k (TUnknown a b) = (\z -> TUnknown z b) <$> k a+annForType k (TypeVar a b) = (\z -> TypeVar z b) <$> k a+annForType k (TypeLevelString a b) = (\z -> TypeLevelString z b) <$> k a+annForType k (TypeLevelInt a b) = (\z -> TypeLevelInt z b) <$> k a+annForType k (TypeWildcard a b) = (\z -> TypeWildcard z b) <$> k a+annForType k (TypeConstructor a b) = (\z -> TypeConstructor z b) <$> k a+annForType k (TypeOp a b) = (\z -> TypeOp z b) <$> k a+annForType k (TypeApp a b c) = (\z -> TypeApp z b c) <$> k a+annForType k (KindApp a b c) = (\z -> KindApp z b c) <$> k a+annForType k (ForAll a b c d e f) = (\z -> ForAll z b c d e f) <$> k a+annForType k (ConstrainedType a b c) = (\z -> ConstrainedType z b c) <$> k a+annForType k (Skolem a b c d e) = (\z -> Skolem z b c d e) <$> k a+annForType k (REmpty a) = REmpty <$> k a+annForType k (RCons a b c d) = (\z -> RCons z b c d) <$> k a+annForType k (KindedType a b c) = (\z -> KindedType z b c) <$> k a+annForType k (BinaryNoParensType a b c d) = (\z -> BinaryNoParensType z b c d) <$> k a+annForType k (ParensInType a b) = (\z -> ParensInType z b) <$> k a++getAnnForType :: Type a -> a+getAnnForType = (^. annForType)++setAnnForType :: a -> Type a -> Type a+setAnnForType = set annForType++instance Eq (Type a) where+ (==) = eqType++instance Ord (Type a) where+ compare = compareType++eqType :: Type a -> Type b -> Bool+eqType (TUnknown _ a) (TUnknown _ a') = a == a'+eqType (TypeVar _ a) (TypeVar _ a') = a == a'+eqType (TypeLevelString _ a) (TypeLevelString _ a') = a == a'+eqType (TypeLevelInt _ a) (TypeLevelInt _ a') = a == a'+eqType (TypeWildcard _ a) (TypeWildcard _ a') = a == a'+eqType (TypeConstructor _ a) (TypeConstructor _ a') = a == a'+eqType (TypeOp _ a) (TypeOp _ a') = a == a'+eqType (TypeApp _ a b) (TypeApp _ a' b') = eqType a a' && eqType b b'+eqType (KindApp _ a b) (KindApp _ a' b') = eqType a a' && eqType b b'+eqType (ForAll _ _ a b c d) (ForAll _ _ a' b' c' d') = a == a' && eqMaybeType b b' && eqType c c' && d == d'+eqType (ConstrainedType _ a b) (ConstrainedType _ a' b') = eqConstraint a a' && eqType b b'+eqType (Skolem _ a b c d) (Skolem _ a' b' c' d') = a == a' && eqMaybeType b b' && c == c' && d == d'+eqType (REmpty _) (REmpty _) = True+eqType (RCons _ a b c) (RCons _ a' b' c') = a == a' && eqType b b' && eqType c c'+eqType (KindedType _ a b) (KindedType _ a' b') = eqType a a' && eqType b b'+eqType (BinaryNoParensType _ a b c) (BinaryNoParensType _ a' b' c') = eqType a a' && eqType b b' && eqType c c'+eqType (ParensInType _ a) (ParensInType _ a') = eqType a a'+eqType _ _ = False++eqMaybeType :: Maybe (Type a) -> Maybe (Type b) -> Bool+eqMaybeType (Just a) (Just b) = eqType a b+eqMaybeType Nothing Nothing = True+eqMaybeType _ _ = False++compareType :: Type a -> Type b -> Ordering+compareType (TUnknown _ a) (TUnknown _ a') = compare a a'+compareType (TypeVar _ a) (TypeVar _ a') = compare a a'+compareType (TypeLevelString _ a) (TypeLevelString _ a') = compare a a'+compareType (TypeLevelInt _ a) (TypeLevelInt _ a') = compare a a'+compareType (TypeWildcard _ a) (TypeWildcard _ a') = compare a a'+compareType (TypeConstructor _ a) (TypeConstructor _ a') = compare a a'+compareType (TypeOp _ a) (TypeOp _ a') = compare a a'+compareType (TypeApp _ a b) (TypeApp _ a' b') = compareType a a' <> compareType b b'+compareType (KindApp _ a b) (KindApp _ a' b') = compareType a a' <> compareType b b'+compareType (ForAll _ _ a b c d) (ForAll _ _ a' b' c' d') = compare a a' <> compareMaybeType b b' <> compareType c c' <> compare d d'+compareType (ConstrainedType _ a b) (ConstrainedType _ a' b') = compareConstraint a a' <> compareType b b'+compareType (Skolem _ a b c d) (Skolem _ a' b' c' d') = compare a a' <> compareMaybeType b b' <> compare c c' <> compare d d'+compareType (REmpty _) (REmpty _) = EQ+compareType (RCons _ a b c) (RCons _ a' b' c') = compare a a' <> compareType b b' <> compareType c c'+compareType (KindedType _ a b) (KindedType _ a' b') = compareType a a' <> compareType b b'+compareType (BinaryNoParensType _ a b c) (BinaryNoParensType _ a' b' c') = compareType a a' <> compareType b b' <> compareType c c'+compareType (ParensInType _ a) (ParensInType _ a') = compareType a a'+compareType typ typ' =+ compare (orderOf typ) (orderOf typ')+ where+ orderOf :: Type a -> Int+ orderOf TUnknown{} = 0+ orderOf TypeVar{} = 1+ orderOf TypeLevelString{} = 2+ orderOf TypeLevelInt{} = 3+ orderOf TypeWildcard{} = 4+ orderOf TypeConstructor{} = 5+ orderOf TypeOp{} = 6+ orderOf TypeApp{} = 7+ orderOf KindApp{} = 8+ orderOf ForAll{} = 9+ orderOf ConstrainedType{} = 10+ orderOf Skolem{} = 11+ orderOf REmpty{} = 12+ orderOf RCons{} = 13+ orderOf KindedType{} = 14+ orderOf BinaryNoParensType{} = 15+ orderOf ParensInType{} = 16++compareMaybeType :: Maybe (Type a) -> Maybe (Type b) -> Ordering+compareMaybeType (Just a) (Just b) = compareType a b+compareMaybeType Nothing Nothing = EQ+compareMaybeType Nothing _ = LT+compareMaybeType _ _ = GT++instance Eq (Constraint a) where+ (==) = eqConstraint++instance Ord (Constraint a) where+ compare = compareConstraint++eqConstraint :: Constraint a -> Constraint b -> Bool+eqConstraint (Constraint _ a b c d) (Constraint _ a' b' c' d') = a == a' && and (zipWith eqType b b') && and (zipWith eqType c c') && d == d'++compareConstraint :: Constraint a -> Constraint b -> Ordering+compareConstraint (Constraint _ a b c d) (Constraint _ a' b' c' d') = compare a a' <> fold (zipWith compareType b b') <> fold (zipWith compareType c c') <> compare d d'
+ src/System/IO/UTF8.hs view
@@ -0,0 +1,32 @@+module System.IO.UTF8 where++import Prelude++import Data.ByteString qualified as BS+import Data.ByteString.Lazy qualified as BSL+import Data.ByteString.Search qualified as BSS+import Data.ByteString.UTF8 qualified as UTF8+import Data.Text (Text)+import Data.Text.Encoding qualified as TE+import Protolude (ordNub)++-- | Unfortunately ByteString's readFile does not convert line endings on+-- Windows, so we have to do it ourselves+fixCRLF :: BS.ByteString -> BS.ByteString+fixCRLF = BSL.toStrict . BSS.replace "\r\n" ("\n" :: BS.ByteString)++readUTF8FilesT :: [FilePath] -> IO [(FilePath, Text)]+readUTF8FilesT =+ traverse (\inFile -> (inFile, ) <$> readUTF8FileT inFile) . ordNub++readUTF8FileT :: FilePath -> IO Text+readUTF8FileT inFile =+ fmap (TE.decodeUtf8 . fixCRLF) (BS.readFile inFile)++writeUTF8FileT :: FilePath -> Text -> IO ()+writeUTF8FileT inFile text =+ BS.writeFile inFile (TE.encodeUtf8 text)++readUTF8File :: FilePath -> IO String+readUTF8File inFile =+ fmap (UTF8.toString . fixCRLF) (BS.readFile inFile)
+ stack.yaml view
@@ -0,0 +1,44 @@+# Please update Haskell image versions under .github/workflows/ci.yml together to use the same GHC version+# (or the CI build will fail)+resolver: lts-20.9+pvp-bounds: both+packages:+- '.'+ghc-options:+ # Build with advanced optimizations enabled by default+ "$locals": -O2 -Werror+extra-deps:+# As of 2021-11-08, the latest release of `language-javascript` is 0.7.1.0,+# but it has a problem with parsing the `async` keyword. It doesn't allow+# `async` to be used as an object key:+# https://github.com/erikd/language-javascript/issues/131+- language-javascript-0.7.0.0+# Fix issue with libtinfo.+# See https://github.com/purescript/purescript/issues/4253+- process-1.6.13.1+# The Cabal library is not in Stackage+- Cabal-3.6.3.0+# hspec versions 2.9.3 to 2.10.6 depend on ghc+# ghc depends on terminfo by default, but that can be ignored+# if one uses the '-terminfo' flag.+# Unfortunately, hspec doesn't expose a similar flag.+#+# Using hspec >= 2.10.7 addresses this.+- hspec-2.10.9+- hspec-core-2.10.9+- hspec-discover-2.10.9+nix:+ packages:+ - zlib+ # Test dependencies+ - nodejs+ - nodePackages.npm+ - nodePackages.bower+flags:+ aeson-pretty:+ lib-only: true+ these:+ assoc: false+ haskeline:+ # Avoids a libtinfo dynamic library dependency+ terminfo: false
+ tests/Language/PureScript/Ide/CompletionSpec.hs view
@@ -0,0 +1,145 @@+module Language.PureScript.Ide.CompletionSpec where++import Protolude++import Language.PureScript qualified as P+import Language.PureScript.Ide.Test as Test+import Language.PureScript.Ide.Command as Command+import Language.PureScript.Ide.Completion (CompletionOptions(..), applyCompletionOptions, defaultCompletionOptions)+import Language.PureScript.Ide.Filter.Declaration qualified as DeclarationType+import Language.PureScript.Ide.Types (Completion(..), IdeDeclarationAnn, Match(..), Success(..))+import Test.Hspec (Spec, describe, it, shouldBe, shouldMatchList, shouldSatisfy)++reexportMatches :: [Match IdeDeclarationAnn]+reexportMatches =+ map (\d -> Match (mn "A", d)) moduleA+ ++ map (\d -> Match (mn "B", d)) moduleB+ where+ moduleA = [ideKind "Kind"]+ moduleB = [ideKind "Kind" `annExp` "A"]++matches :: [(Match IdeDeclarationAnn, [P.ModuleName])]+matches = map (\d -> (Match (mn "Main", d), [mn "Main"])) [ ideKind "Kind", ideType "Type" Nothing [] ]++typ :: Text -> Command+typ txt = Type txt [] Nothing++load :: [Text] -> Command+load = LoadSync . map Test.mn++spec :: Spec+spec = describe "Applying completion options" $ do+ it "keeps all matches if maxResults is not specified" $ do+ applyCompletionOptions (defaultCompletionOptions { coMaxResults = Nothing })+ (map fst matches) `shouldMatchList` matches+ it "keeps only the specified amount of maxResults" $ do+ applyCompletionOptions (defaultCompletionOptions { coMaxResults = Just 1 })+ (map fst matches) `shouldMatchList` take 1 matches+ it "groups reexports for a single identifier" $ do+ applyCompletionOptions (defaultCompletionOptions { coGroupReexports = True })+ reexportMatches `shouldBe` [(Match (mn "A", ideKind "Kind"), [mn "A", mn "B"])]++ it "gets simple docs on definition itself" $ do+ ([_, Right (CompletionResult [ result ])], _) <- Test.inProject $+ Test.runIde [ load ["CompletionSpecDocs"]+ , typ "something"+ ]+ result `shouldSatisfy` \res -> complDocumentation res == Just "Doc x\n"++ it "gets multiline docs" $ do+ ([_, Right (CompletionResult [ result ])], _) <- Test.inProject $+ Test.runIde [ load ["CompletionSpecDocs"]+ , typ "multiline"+ ]+ result `shouldSatisfy` \res -> complDocumentation res == Just "This is\na multi-line\ncomment\n"++ it "gets simple docs on type annotation" $ do+ ([_, Right (CompletionResult [ result ])], _) <- Test.inProject $+ Test.runIde [ load ["CompletionSpecDocs"]+ , typ "withType"+ ]+ result `shouldSatisfy` \res -> complDocumentation res == Just "Doc *123*\n"++ it "gets docs on module declaration" $ do+ ([_, Right (CompletionResult [ result ])], _) <- Test.inProject $+ Test.runIde [ load ["CompletionSpecDocs"]+ , typ "CompletionSpecDocs"+ ]+ result `shouldSatisfy` \res -> complDocumentation res == Just "Module Documentation\n"++ it "gets docs on type class declaration" $ do+ ([_, Right (CompletionResult [ result ])], _) <- Test.inProject $+ Test.runIde [ load ["CompletionSpecDocs"]+ , typ "DocClass"+ ]+ result `shouldSatisfy` \res -> complDocumentation res == Just "Doc for class\n"++ it "gets docs on type class members" $ do+ ([_, Right (CompletionResult [ result ])], _) <- Test.inProject $+ Test.runIde [ load ["CompletionSpecDocs"]+ , typ "member"+ ]+ result `shouldSatisfy` \res -> complDocumentation res == Just "doc for member\n"++ it "includes declarationType in completions for values" $ do+ ([_, Right (CompletionResult [ result ])], _) <- Test.inProject $+ Test.runIde [ load ["CompletionSpec"]+ , typ "exampleValue"+ ]+ result `shouldSatisfy` \res ->+ complDeclarationType res == Just DeclarationType.Value++ it "includes declarationType in completions for functions" $ do+ ([_, Right (CompletionResult [ result ])], _) <- Test.inProject $+ Test.runIde [ load ["CompletionSpec"]+ , typ "exampleFunction"+ ]+ result `shouldSatisfy` \res ->+ complDeclarationType res == Just DeclarationType.Value++ it "includes declarationType in completions for inferred values" $ do+ ([_, Right (CompletionResult [ result ])], _) <- Test.inProject $+ Test.runIde [ load ["CompletionSpec"]+ , typ "exampleInferredString"+ ]+ result `shouldSatisfy` \res ->+ complDeclarationType res == Just DeclarationType.Value++ it "includes declarationType in completions for operators" $ do+ ([_, Right (CompletionResult results)], _) <- Test.inProject $+ Test.runIde [ load ["CompletionSpec"]+ , typ "\\°/"+ ]+ length results `shouldBe` 2+ results `shouldSatisfy` any (\res ->+ complDeclarationType res == Just DeclarationType.ValueOperator)+ results `shouldSatisfy` any (\res ->+ complDeclarationType res == Just DeclarationType.TypeOperator)++ it "includes declarationType in completions for type constructors with \+ \conflicting names" $ do+ ([_, Right (CompletionResult results)], _) <- Test.inProject $+ Test.runIde [ load ["CompletionSpec"]+ , typ "ExampleTypeConstructor"+ ]+ length results `shouldBe` 2+ results `shouldSatisfy` any (\res ->+ complDeclarationType res == Just DeclarationType.DataConstructor)+ results `shouldSatisfy` any (\res ->+ complDeclarationType res == Just DeclarationType.Type)++ it "includes declarationType in completions for type classes" $ do+ ([_, Right (CompletionResult [result])], _) <- Test.inProject $+ Test.runIde [ load ["CompletionSpec"]+ , typ "ExampleClass"+ ]+ result `shouldSatisfy` \res ->+ complDeclarationType res == Just DeclarationType.TypeClass++ it "includes declarationType in completions for type class members" $ do+ ([_, Right (CompletionResult [result])], _) <- Test.inProject $+ Test.runIde [ load ["CompletionSpec"]+ , typ "exampleMember"+ ]+ result `shouldSatisfy` \res ->+ complDeclarationType res == Just DeclarationType.Value
+ tests/Language/PureScript/Ide/FilterSpec.hs view
@@ -0,0 +1,193 @@+module Language.PureScript.Ide.FilterSpec where++import Protolude+import Data.Map qualified as Map+import Data.Set qualified as Set+import Language.PureScript.Ide.Filter (applyFilters, declarationTypeFilter, dependencyFilter, exactFilter, moduleFilter, namespaceFilter, prefixFilter)+import Language.PureScript.Ide.Filter.Declaration as D+import Language.PureScript.Ide.Types (IdeDeclarationAnn, IdeNamespace(..), ModuleMap)+import Language.PureScript.Ide.Imports (Import, sliceImportSection)+import Language.PureScript.Ide.Test as T+import Language.PureScript qualified as P+import Test.Hspec (Spec, describe, it, shouldBe)++type Module = (P.ModuleName, [IdeDeclarationAnn])++moduleA, moduleB, moduleC, moduleD, moduleE, moduleF, moduleG, moduleH, moduleI, moduleDCtors :: Module+moduleA = (P.moduleNameFromString "Module.A", [T.ideValue "function1" Nothing])+moduleB = (P.moduleNameFromString "Module.B", [T.ideValue "data1" Nothing])+moduleC = (P.moduleNameFromString "Module.C", [T.ideType "List" Nothing []])+moduleD = (P.moduleNameFromString "Module.D", [T.ideType "kind1" Nothing []])+moduleE = (P.moduleNameFromString "Module.E", [T.ideSynonym "SFType" Nothing Nothing `annLoc` synonymSS])+moduleF = (P.moduleNameFromString "Module.F", [T.ideDtor "DtorA" "TypeA" Nothing])+moduleG = (P.moduleNameFromString "Module.G", [T.ideTypeClass "MyClass" P.kindType []])+moduleH = (P.moduleNameFromString "Module.H", [T.ideValueOp "<$>" (P.Qualified P.ByNullSourcePos (Left "")) 0 Nothing Nothing])+moduleI = (P.moduleNameFromString "Module.I", [T.ideTypeOp "~>" (P.Qualified P.ByNullSourcePos "") 0 Nothing Nothing])+moduleDCtors = (P.moduleNameFromString "Module.WithDC", [T.ideType "Foo" Nothing [(P.ProperName "A", P.tyString), (P.ProperName "B", P.tyString)] ])++modules :: ModuleMap [IdeDeclarationAnn]+modules = Map.fromList [moduleA, moduleB]++allModules :: ModuleMap [IdeDeclarationAnn]+allModules = Map.fromList [moduleA, moduleB,moduleC,moduleD,moduleE,moduleF,moduleG,moduleH,moduleI,moduleDCtors]++runEq :: Text -> [Module]+runEq s = Map.toList (applyFilters [exactFilter s] modules)++runPrefix :: Text -> [Module]+runPrefix s = Map.toList $ applyFilters [prefixFilter s] modules++runModule :: [P.ModuleName] -> [Module]+runModule ms = Map.toList $ applyFilters [moduleFilter (Set.fromList ms)] modules++runNamespace :: Set IdeNamespace -> [Module] -> [Module]+runNamespace namespaces = Map.toList . applyFilters [namespaceFilter namespaces] . Map.fromList++runDeclaration :: [D.DeclarationType] -> [Module] -> [Module]+runDeclaration decls = Map.toList . applyFilters [declarationTypeFilter (Set.fromList decls)] . Map.fromList++runDependency :: [Text] -> [Module]+runDependency = runDependency' "Whatever"++runDependency' :: Text -> [Text] -> [Module]+runDependency' currentModuleName imports = Map.toList $ applyFilters [dependencyFilter Nothing (P.ModuleName currentModuleName) (testParseImports currentModuleName imports)] allModules++runDependencyQualified :: Text -> [Text] -> [Module]+runDependencyQualified qualifier imports = Map.toList $ applyFilters [dependencyFilter (Just $ P.ModuleName qualifier) (P.ModuleName "Whatever") (testParseImports "Whatever" imports)] allModules++testParseImports :: Text -> [Text] -> [Import]+testParseImports currentModuleName imports = either (const []) (\(_, _, x, _) -> x) $ sliceImportSection moduleLines+ where+ moduleLines = "module " <> currentModuleName <> " where" : (imports <> [ "", "blah = 42" ])++spec :: Spec+spec = do+ describe "equality Filter" $ do+ it "removes empty modules" $+ runEq "test" `shouldBe` []+ it "keeps function declarations that are equal" $+ runEq "function1" `shouldBe` [moduleA]+ it "keeps data declarations that are equal" $+ runEq "data1" `shouldBe` [moduleB]+ describe "prefixFilter" $ do+ it "keeps everything on empty string" $+ runPrefix "" `shouldBe` Map.toList modules+ it "keeps functionname prefix matches" $+ runPrefix "fun" `shouldBe` [moduleA]+ it "keeps data decls prefix matches" $+ runPrefix "dat" `shouldBe` [moduleB]+ describe "moduleFilter" $ do+ it "removes everything on empty input" $+ runModule [] `shouldBe` []+ it "only keeps the specified modules" $+ runModule [P.moduleNameFromString "Module.A"] `shouldBe` [moduleA]+ it "ignores modules that are not in scope" $+ runModule (P.moduleNameFromString <$> ["Module.A", "Unknown"]) `shouldBe` [moduleA]+ describe "namespaceFilter" $ do+ it "extracts modules by filtering `value` namespaces" $+ runNamespace (Set.fromList [IdeNSValue])+ [moduleA, moduleB, moduleD] `shouldBe` [moduleA, moduleB]+ it "extracts no modules by filtering `value` namespaces" $+ runNamespace (Set.fromList [IdeNSValue])+ [moduleD] `shouldBe` []+ it "extracts modules by filtering `type` namespaces" $+ runNamespace (Set.fromList [IdeNSType])+ [moduleA, moduleB, moduleC] `shouldBe` [moduleC]+ it "extracts no modules by filtering `type` namespaces" $+ runNamespace (Set.fromList [IdeNSType])+ [moduleA, moduleB] `shouldBe` []+ it "extracts modules by filtering `value` and `type` namespaces" $+ runNamespace (Set.fromList [ IdeNSValue, IdeNSType])+ [moduleA, moduleB, moduleC, moduleD]+ `shouldBe` [moduleA, moduleB, moduleC, moduleD]+ describe "declarationTypeFilter" $ do+ it "extracts modules by filtering `value` declarations" $+ runDeclaration [D.Value]+ [moduleA, moduleB, moduleD] `shouldBe` [moduleA, moduleB]+ it "removes everything if no `value` declarations has been found" $+ runDeclaration [D.Value]+ [moduleD, moduleG, moduleE, moduleH] `shouldBe` []+ it "extracts module by filtering `type` declarations" $+ runDeclaration [D.Type]+ [moduleA, moduleB, moduleC, moduleD, moduleE] `shouldBe` [moduleC, moduleD]+ it "removes everything if a `type` declaration have not been found" $+ runDeclaration [D.Type]+ [moduleA, moduleG, moduleE, moduleH] `shouldBe` []+ it "extracts module by filtering `synonym` declarations" $+ runDeclaration [D.Synonym]+ [moduleA, moduleB, moduleD, moduleE] `shouldBe` [moduleE]+ it "removes everything if a `synonym` declaration have not been found" $+ runDeclaration [D.Synonym]+ [moduleA, moduleB, moduleC, moduleH] `shouldBe` []+ it "extracts module by filtering `constructor` declarations" $+ runDeclaration [D.DataConstructor]+ [moduleA, moduleB, moduleC, moduleF] `shouldBe` [moduleF]+ it "removes everything if a `constructor` declaration have not been found" $+ runDeclaration [D.DataConstructor]+ [moduleA, moduleB, moduleC, moduleH] `shouldBe` []+ it "extracts module by filtering `typeclass` declarations" $+ runDeclaration [D.TypeClass]+ [moduleA, moduleC, moduleG] `shouldBe` [moduleG]+ it "removes everything if a `typeclass` declaration have not been found" $+ runDeclaration [D.TypeClass]+ [moduleA, moduleB, moduleC, moduleH] `shouldBe` []+ it "extracts modules by filtering `valueoperator` declarations" $+ runDeclaration [D.ValueOperator]+ [moduleA, moduleC, moduleG, moduleH, moduleF] `shouldBe` [moduleH]+ it "removes everything if a `valueoperator` declaration have not been found" $+ runDeclaration [D.ValueOperator]+ [moduleA, moduleB, moduleC, moduleD] `shouldBe` []+ it "extracts modules by filtering `typeoperator` declarations" $+ runDeclaration [D.TypeOperator]+ [moduleA, moduleC, moduleG, moduleI, moduleF] `shouldBe` [moduleI]+ it "removes everything if a `typeoperator` declaration have not been found" $+ runDeclaration [D.TypeOperator]+ [moduleA, moduleD] `shouldBe` []+ it "extracts modules by filtering `value` and `synonym` declarations" $+ runDeclaration [D.Value, D.Synonym]+ [moduleA, moduleB, moduleD, moduleE] `shouldBe` [moduleA, moduleB, moduleE]+ it "extracts modules by filtering `value`, and `valueoperator` declarations" $+ runDeclaration [D.Value, D.ValueOperator]+ [moduleA, moduleB, moduleD, moduleG, moduleE, moduleH] `shouldBe` [moduleA, moduleB, moduleH]+ describe "dependencyFilter" $ do+ describe "import types" $ do+ it "filters by implicit imports" $ do+ runDependency ["import Module.A", "import Module.C"] `shouldBe` [moduleA, moduleC]+ it "filters by matching explicit value import" $ do+ runDependency ["import Module.A (function1)"] `shouldBe` [moduleA]+ it "filters by matching explicit value import from correct module" $ do+ runDependency ["import Module.B (function1)"] `shouldBe` []+ it "filters not matching explicit value import" $ do+ runDependency ["import Module.A (function2)"] `shouldBe` []+ it "filters out names in hiding import" $ do+ runDependency ["import Module.A hiding (function1)"] `shouldBe` []+ it "doesn't filter out not matching names in hiding import" $ do+ runDependency ["import Module.A hiding (nonsense)"] `shouldBe` [moduleA]+ it "filters by containing module" $ do+ runDependency' "Module.A" ["import Module.Blah"] `shouldBe` [moduleA]+ describe "declaration types" $ do+ it "matches type" $ do+ runDependency ["import Module.C (List)"] `shouldBe` [moduleC]+ it "includes data constructor with (..)" $ do+ runDependency ["import Module.F (TypeA(..))"] `shouldBe` [moduleF]+ it "includes data constructor explicitly listed" $ do+ runDependency ["import Module.F (TypeA(DtorA))"] `shouldBe` [moduleF]+ it "does not include data constructor not explicitly listed" $ do+ runDependency ["import Module.F (TypeA(BogusOtherConstructor))"] `shouldBe` []+ it "does not include data constructor when only the type is imported" $ do+ runDependency ["import Module.F (TypeA)"] `shouldBe` []+ it "includes synonym" $ do+ runDependency ["import Module.E (SFType)"] `shouldBe` [moduleE]+ it "includes typeclass" $ do+ runDependency ["import Module.G (class MyClass)"] `shouldBe` [moduleG]+ it "includes value op" $ do+ runDependency ["import Module.H ((<$>))"] `shouldBe` [moduleH]+ it "includes type op" $ do+ runDependency ["import Module.I (type (~>))"] `shouldBe` [moduleI]+ describe "qualifiers" $ do+ it "includes single qualified import and not unqualified things" $ do+ runDependencyQualified "AA" [ "import Module.A as AA", "import Module.C"] `shouldBe` [moduleA]+ it "includes multiple qualified imports" $ do+ runDependencyQualified "Combined.Thing" [ "import Module.A as Combined.Thing", "import Module.C as Combined.Thing", "import Module.F"] `shouldBe` [moduleA, moduleC]+ it "doesn't include qualified import when qualifier not specified" $ do+ runDependency [ "import Module.AA as A"] `shouldBe` []
+ tests/Language/PureScript/Ide/ImportsSpec.hs view
@@ -0,0 +1,398 @@+module Language.PureScript.Ide.ImportsSpec where++import Protolude hiding (moduleName)+import Data.Maybe (fromJust)+import Data.Set qualified as Set++import Language.PureScript qualified as P+import Language.PureScript.Ide.Command as Command+import Language.PureScript.Ide.Error (IdeError)+import Language.PureScript.Ide.Imports (Import, parseImport, prettyPrintImport', prettyPrintImportSection, sliceImportSection)+import Language.PureScript.Ide.Imports.Actions (addExplicitImport', addImplicitImport', addQualifiedImport')+import Language.PureScript.Ide.Filter (moduleFilter)+import Language.PureScript.Ide.Test qualified as Test+import Language.PureScript.Ide.Types (IdeDeclarationAnn(..), Success(..))+import System.FilePath ((</>))+import Test.Hspec (Expectation, Spec, describe, it, shouldBe, shouldSatisfy)++noImportsFile :: [Text]+noImportsFile =+ [ "module Main where"+ , ""+ , "myFunc x y = x + y"+ ]++simpleFile :: [Text]+simpleFile =+ [ "module Main where"+ , "import Prelude"+ , ""+ , "myFunc x y = x + y"+ ]++hidingFile :: [Text]+hidingFile =+ [ "module Main where"+ , "import Prelude"+ , "import Data.Maybe hiding (maybe, maybe')"+ , ""+ , "myFunc x y = x + y"+ ]++syntaxErrorFile :: [Text]+syntaxErrorFile =+ [ "module Main where"+ , "import Prelude"+ , ""+ , "myFunc ="+ ]++testSliceImportSection :: [Text] -> (P.ModuleName, [Text], [Import], [Text])+testSliceImportSection = unsafeFromRight . sliceImportSection+ where+ unsafeFromRight = fromJust . rightToMaybe++withImports :: [Text] -> [Text]+withImports is =+ take 2 simpleFile ++ [""] ++ is ++ drop 2 simpleFile++testParseImport :: Text -> Import+testParseImport = fromJust . parseImport++preludeImport, arrayImport, listImport, consoleImport, maybeImport :: Import+preludeImport = testParseImport "import Prelude"+arrayImport = testParseImport "import Data.Array (head, cons)"+listImport = testParseImport "import Data.List as List"+consoleImport = testParseImport "import Effect.Console (log) as Console"+maybeImport = testParseImport "import Data.Maybe (Maybe(Just))"++spec :: Spec+spec = do+ describe "determining the importsection" $ do+ let moduleSkeleton imports =+ Right (P.moduleNameFromString "Main", take 1 simpleFile, imports, drop 2 simpleFile)+ it "slices a file without imports" $+ shouldBe (sliceImportSection noImportsFile)+ (Right (P.moduleNameFromString "Main", take 1 noImportsFile, [], drop 1 noImportsFile))++ it "handles a file with syntax errors just fine" $+ shouldBe (sliceImportSection syntaxErrorFile)+ (Right (P.moduleNameFromString "Main", take 1 syntaxErrorFile, [preludeImport], drop 2 syntaxErrorFile))++ it "finds a simple import" $+ shouldBe (sliceImportSection simpleFile) (moduleSkeleton [preludeImport])++ it "allows multiline import statements" $+ shouldBe+ (sliceImportSection (withImports [ "import Data.Array (head,"+ , " cons)"+ ]))+ (moduleSkeleton [preludeImport, arrayImport])+ it "allows multiline import statements with hanging parens" $+ shouldBe+ (sliceImportSection (withImports [ "import Data.Array ("+ , " head,"+ , " cons"+ , ")"+ ]))+ (moduleSkeleton [preludeImport, arrayImport])+ describe "pretty printing imports" $ do+ it "pretty prints a simple import" $+ shouldBe (prettyPrintImport' preludeImport) "import Prelude"+ it "pretty prints an explicit import" $+ shouldBe (prettyPrintImport' arrayImport) "import Data.Array (head, cons)"+ it "pretty prints a qualified import" $+ shouldBe (prettyPrintImport' listImport) "import Data.List as List"+ it "pretty prints a qualified explicit import" $+ shouldBe (prettyPrintImport' consoleImport) "import Effect.Console (log) as Console"+ it "pretty prints an import with a datatype (and PositionedRef's for the dtors)" $+ shouldBe (prettyPrintImport' maybeImport) "import Data.Maybe (Maybe(Just))"++ describe "import commands" $ do+ let simpleFileImports = let (_, _, i, _) = testSliceImportSection simpleFile in i+ hidingFileImports = let (_, _, i, _) = testSliceImportSection hidingFile in i+ addValueImport i mn q is =+ prettyPrintImportSection (addExplicitImport' (_idaDeclaration (Test.ideValue i Nothing)) mn q is)+ addOpImport op mn q is =+ prettyPrintImportSection (addExplicitImport' (_idaDeclaration (Test.ideValueOp op (P.Qualified (P.byMaybeModuleName q) (Left "")) 2 Nothing Nothing)) mn q is)+ addDtorImport i t mn q is =+ prettyPrintImportSection (addExplicitImport' (_idaDeclaration (Test.ideDtor i t Nothing)) mn q is)+ addTypeImport i mn q is =+ prettyPrintImportSection (addExplicitImport' (_idaDeclaration (Test.ideType i Nothing [])) mn q is)+ qualify s = Just (Test.mn s)+ it "adds an implicit unqualified import to a file without any imports" $+ shouldBe+ (addImplicitImport' [] (P.moduleNameFromString "Data.Map"))+ ["import Data.Map"]+ it "adds an implicit unqualified import" $+ shouldBe+ (addImplicitImport' simpleFileImports (P.moduleNameFromString "Data.Map"))+ [ "import Data.Map"+ , "import Prelude"+ ]+ it "adds a qualified import" $+ shouldBe+ (addQualifiedImport' simpleFileImports (Test.mn "Data.Map") (Test.mn "Map"))+ [ "import Prelude"+ , ""+ , "import Data.Map as Map"+ ]+ it "adds a qualified import and maintains proper grouping and formatting for implicit hiding imports" $+ shouldBe+ (addQualifiedImport' hidingFileImports (Test.mn "Data.Map") (Test.mn "Map"))+ [ "import Data.Maybe hiding (maybe, maybe')"+ , "import Prelude"+ , ""+ , "import Data.Map as Map"+ ]+ it "adds an explicit unqualified import to a file without any imports" $+ shouldBe+ (addValueImport "head" (P.moduleNameFromString "Data.Array") Nothing [])+ ["import Data.Array (head)"]+ it "adds an explicit qualified import to a file without any imports" $+ shouldBe+ (addValueImport "head" (P.moduleNameFromString "Data.Array") (qualify "Array") [])+ ["import Data.Array (head) as Array"]+ it "adds an explicit unqualified import" $+ shouldBe+ (addValueImport "head" (P.moduleNameFromString "Data.Array") Nothing simpleFileImports)+ [ "import Prelude"+ , ""+ , "import Data.Array (head)"+ ]+ it "adds an explicit qualified import" $+ shouldBe+ (addValueImport "head" (P.moduleNameFromString "Data.Array") (qualify "Array") simpleFileImports)+ [ "import Prelude"+ , ""+ , "import Data.Array (head) as Array"+ ]+ it "doesn't add an import if the containing module is imported implicitly" $+ shouldBe+ (addValueImport "const" (P.moduleNameFromString "Prelude") Nothing simpleFileImports)+ ["import Prelude"]+ let Right (_, _, qualifiedImports, _) = sliceImportSection (withImports ["import Data.Array as Array"])+ it "doesn't add a qualified explicit import if the containing module is imported qualified" $+ shouldBe+ (addValueImport "length" (P.moduleNameFromString "Data.Array") (qualify "Array") qualifiedImports)+ ["import Prelude"+ , ""+ , "import Data.Array as Array"]+ let Right (_, _, explicitImports, _) = sliceImportSection (withImports ["import Data.Array (tail)"])+ it "adds an identifier to an explicit import list" $+ shouldBe+ (addValueImport "head" (P.moduleNameFromString "Data.Array") Nothing explicitImports)+ [ "import Prelude"+ , ""+ , "import Data.Array (head, tail)"+ ]+ let Right (_, _, explicitQualImports, _) = sliceImportSection (withImports ["import Data.Array (tail) as Array"])+ it "adds an identifier to an explicit qualified import list" $+ shouldBe+ (addValueImport "head" (P.moduleNameFromString "Data.Array") (qualify "Array") explicitQualImports)+ [ "import Prelude"+ , ""+ , "import Data.Array (head, tail) as Array"+ ]+ it "adds an operator to an explicit import list" $+ shouldBe+ (addOpImport "<~>" (P.moduleNameFromString "Data.Array") Nothing explicitImports)+ [ "import Prelude"+ , ""+ , "import Data.Array (tail, (<~>))"+ ]+ it "adds an operator to an explicit qualified import list" $+ shouldBe+ (addOpImport "<~>" (P.moduleNameFromString "Data.Array") (qualify "Array") explicitQualImports)+ [ "import Prelude"+ , ""+ , "import Data.Array (tail, (<~>)) as Array"+ ]+ it "adds a type with constructors without automatically adding an open import of said constructors " $+ shouldBe+ (addTypeImport "Maybe" (P.moduleNameFromString "Data.Maybe") Nothing simpleFileImports)+ [ "import Prelude"+ , ""+ , "import Data.Maybe (Maybe)"+ ]+ it "adds the type for a given DataConstructor" $+ shouldBe+ (addDtorImport "Just" "Maybe" (P.moduleNameFromString "Data.Maybe") Nothing simpleFileImports)+ [ "import Prelude"+ , ""+ , "import Data.Maybe (Maybe(..))"+ ]+ it "adds the type for a given DataConstructor qualified" $+ shouldBe+ (addDtorImport "Just" "Maybe" (P.moduleNameFromString "Data.Maybe") (qualify "M") simpleFileImports)+ [ "import Prelude"+ , ""+ , "import Data.Maybe (Maybe(..)) as M"+ ]+ it "adds a dataconstructor to an existing type import" $ do+ let Right (_, _, typeImports, _) = sliceImportSection (withImports ["import Data.Maybe (Maybe)"])+ shouldBe+ (addDtorImport "Just" "Maybe" (P.moduleNameFromString "Data.Maybe") Nothing typeImports)+ [ "import Prelude"+ , ""+ , "import Data.Maybe (Maybe(..))"+ ]+ it "adding a type to an existing import of that type is noop" $ do+ let Right (_, _, typeImports, _) = sliceImportSection (withImports ["import Data.Maybe (Maybe)"])+ shouldBe+ (addTypeImport "Maybe" (P.moduleNameFromString "Data.Maybe") Nothing typeImports)+ [ "import Prelude"+ , ""+ , "import Data.Maybe (Maybe)"+ ]+ it "adding a type to an existing import of that type with its constructors is noop" $ do+ let Right (_, _, typeImports, _) = sliceImportSection (withImports ["import Data.Maybe (Maybe (..))"])+ shouldBe+ (addTypeImport "Maybe" (P.moduleNameFromString "Data.Maybe") Nothing typeImports)+ [ "import Prelude"+ , ""+ , "import Data.Maybe (Maybe(..))"+ ]+ it "adds a dataconstructor to an existing qualified type import" $ do+ let Right (_, _, typeImports, _) = sliceImportSection (withImports ["import Data.Maybe (Maybe) as M"])+ shouldBe+ (addDtorImport "Just" "Maybe" (P.moduleNameFromString "Data.Maybe") (qualify "M") typeImports)+ [ "import Prelude"+ , ""+ , "import Data.Maybe (Maybe(..)) as M"+ ]+ it "doesn't add a dataconstructor to an existing type import with open dtors" $ do+ let Right (_, _, typeImports, _) = sliceImportSection (withImports ["import Data.Maybe (Maybe(..))"])+ shouldBe+ (addDtorImport "Just" "Maybe" (P.moduleNameFromString "Data.Maybe") Nothing typeImports)+ [ "import Prelude"+ , ""+ , "import Data.Maybe (Maybe(..))"+ ]+ it "doesn't add an identifier to an explicit import list if it's already imported" $+ shouldBe+ (addValueImport "tail" (P.moduleNameFromString "Data.Array") Nothing explicitImports)+ [ "import Prelude"+ , ""+ , "import Data.Array (tail)"+ ]+ it "doesn't add an identifier to an explicit qualified import list if it's already imported qualified" $+ shouldBe+ (addValueImport "tail" (P.moduleNameFromString "Data.Array") (qualify "Array") explicitQualImports)+ [ "import Prelude"+ , ""+ , "import Data.Array (tail) as Array"+ ]++ describe "explicit import sorting" $ do+ -- given some basic import skeleton+ let Right (_, _, baseImports, _) = sliceImportSection $ withImports ["import Control.Monad (ap)"]+ moduleName = P.moduleNameFromString "Control.Monad"+ addImport imports import' = addExplicitImport' import' moduleName Nothing imports+ valueImport ident = _idaDeclaration (Test.ideValue ident Nothing)+ typeImport name = _idaDeclaration (Test.ideType name Nothing [])+ classImport name = _idaDeclaration (Test.ideTypeClass name P.kindType [])+ dtorImport name typeName = _idaDeclaration (Test.ideDtor name typeName Nothing)+ -- expect any list of provided identifiers, when imported, to come out as specified+ expectSorted imports expected = shouldBe+ (ordNub $ map+ (prettyPrintImportSection . foldl addImport baseImports)+ (permutations imports))+ [expected]+ it "sorts class" $+ expectSorted (map classImport ["Applicative", "Bind"])+ ["import Prelude", "", "import Control.Monad (class Applicative, class Bind, ap)"]+ it "sorts value" $+ expectSorted (map valueImport ["unless", "where"])+ ["import Prelude", "", "import Control.Monad (ap, unless, where)"]+ it "sorts type, value" $+ expectSorted+ (map valueImport ["unless", "where"] ++ map typeImport ["Foo", "Bar"])+ ["import Prelude", "", "import Control.Monad (Bar, Foo, ap, unless, where)"]+ it "sorts class, type, value" $+ expectSorted+ (map valueImport ["unless", "where"] ++ map typeImport ["Foo", "Bar"] ++ map classImport ["Applicative", "Bind"])+ ["import Prelude", "", "import Control.Monad (class Applicative, class Bind, Bar, Foo, ap, unless, where)"]+ it "sorts types with constructors, using open imports for the constructors" $+ expectSorted+ -- the imported names don't actually have to exist!+ (map (uncurry dtorImport) [("Just", "Maybe"), ("Nothing", "Maybe"), ("SomeOtherConstructor", "SomeDataType")])+ ["import Prelude", "", "import Control.Monad (Maybe(..), SomeDataType(..), ap)"]+ describe "importing from a loaded IdeState" importFromIdeState++implImport :: Text -> Command+implImport mn =+ Command.Import ("src" </> "ImportsSpec.purs") Nothing [] (Command.AddImplicitImport (Test.mn mn))++addExplicitImport :: Text -> Command+addExplicitImport i =+ Command.Import ("src" </> "ImportsSpec.purs") Nothing [] (Command.AddImportForIdentifier i Nothing)++addExplicitImportFiltered :: Text -> [P.ModuleName] -> Command+addExplicitImportFiltered i ms =+ Command.Import ("src" </> "ImportsSpec.purs") Nothing [moduleFilter (Set.fromList ms)] (Command.AddImportForIdentifier i Nothing)++importShouldBe :: [Text] -> [Text] -> Expectation+importShouldBe res importSection =+ res `shouldBe`+ [ "module ImportsSpec where" ]+ ++ (if null importSection then [] else "" : importSection)+ ++ [ ""+ , "myId x = x"+ ]++runIdeLoaded :: Command -> IO (Either IdeError Success)+runIdeLoaded c = do+ ([_, result], _) <- Test.inProject $ Test.runIde [Command.LoadSync [] , c]+ pure result++importFromIdeState :: Spec+importFromIdeState = do+ it "adds an implicit import" $ do+ Right (MultilineTextResult result) <-+ runIdeLoaded (implImport "ImportsSpec1")+ result `importShouldBe` [ "import ImportsSpec1" ]+ it "adds an explicit unqualified import" $ do+ Right (MultilineTextResult result) <- runIdeLoaded (addExplicitImport "exportedFunction")+ result `importShouldBe` [ "import ImportsSpec1 (exportedFunction)" ]+ it "adds an explicit unqualified import (type)" $ do+ Right (MultilineTextResult result) <- runIdeLoaded (addExplicitImport "MyType")+ result `importShouldBe` [ "import ImportsSpec1 (MyType)" ]+ it "adds an explicit unqualified import (parameterized type)" $ do+ Right (MultilineTextResult result) <- runIdeLoaded (addExplicitImport "MyParamType")+ result `importShouldBe` [ "import ImportsSpec1 (MyParamType)" ]+ it "adds an explicit unqualified import (typeclass)" $ do+ Right (MultilineTextResult result) <- runIdeLoaded (addExplicitImport "ATypeClass")+ result `importShouldBe` [ "import ImportsSpec1 (class ATypeClass)" ]+ it "adds an explicit unqualified import (dataconstructor)" $ do+ Right (MultilineTextResult result) <- runIdeLoaded (addExplicitImport "MyJust")+ result `importShouldBe` [ "import ImportsSpec1 (MyMaybe(..))" ]+ it "adds an explicit unqualified import (newtype)" $ do+ Right (MultilineTextResult result) <- runIdeLoaded (addExplicitImport "MyNewtype")+ result `importShouldBe` [ "import ImportsSpec1 (MyNewtype(..))" ]+ it "adds an explicit unqualified import (typeclass member function)" $ do+ Right (MultilineTextResult result) <- runIdeLoaded (addExplicitImport "typeClassFun")+ result `importShouldBe` [ "import ImportsSpec1 (typeClassFun)" ]+ it "doesn't add a newtypes constructor if only the type is exported" $ do+ Right (MultilineTextResult result) <-+ runIdeLoaded (addExplicitImport "OnlyTypeExported")+ result `importShouldBe` [ "import ImportsSpec1 (OnlyTypeExported)" ]+ it "doesn't add an import if the identifier is defined in the module itself" $ do+ Right (MultilineTextResult result) <- runIdeLoaded (addExplicitImport "myId")+ result `importShouldBe` []+ it "responds with an error if it's undecidable whether we want a type or constructor" $ do+ result <- runIdeLoaded (addExplicitImport "SpecialCase")+ result `shouldSatisfy` isLeft+ it "responds with an error if the identifier cannot be found and doesn't \+ \write to the output file" $ do+ result <- runIdeLoaded (addExplicitImport "doesnExist")+ result `shouldSatisfy` isLeft+ it "doesn't import things from the Prim modules" $ do+ Right (MultilineTextResult result) <- runIdeLoaded (addExplicitImport "String")+ result `importShouldBe` []+ it "imports classes from Prim.* modules" $ do+ Right (MultilineTextResult result) <- runIdeLoaded (addExplicitImportFiltered "Cons" [Test.mn "Prim.Row"])+ result `importShouldBe` ["import Prim.Row (class Cons)"]+ it "imports types from Prim.* modules" $ do+ Right (MultilineTextResult result) <- runIdeLoaded (addExplicitImportFiltered "Cons" [Test.mn "Prim.RowList"])+ result `importShouldBe` ["import Prim.RowList (Cons)"]
+ tests/Language/PureScript/Ide/MatcherSpec.hs view
@@ -0,0 +1,33 @@+module Language.PureScript.Ide.MatcherSpec where++import Protolude++import Language.PureScript qualified as P+import Language.PureScript.Ide.Matcher (flexMatcher, runMatcher)+import Language.PureScript.Ide.Types (IdeDeclaration(..), IdeDeclarationAnn, IdeValue(..), Match(..))+import Language.PureScript.Ide.Util (withEmptyAnn)+import Test.Hspec (Spec, describe, it, shouldBe)++value :: Text -> IdeDeclarationAnn+value s = withEmptyAnn (IdeDeclValue (IdeValue (P.Ident (toS s)) P.srcREmpty))++firstResult, secondResult, fiult :: Match IdeDeclarationAnn+firstResult = Match (P.moduleNameFromString "Match", value "firstResult")+secondResult = Match (P.moduleNameFromString "Match", value "secondResult")+fiult = Match (P.moduleNameFromString "Match", value "fiult")++completions :: [Match IdeDeclarationAnn]+completions = [firstResult, secondResult, fiult]++runFlex :: Text -> [Match IdeDeclarationAnn]+runFlex s = runMatcher (flexMatcher s) completions++spec :: Spec+spec = do+ describe "Flex Matcher" $ do+ it "doesn't match on an empty string" $+ runFlex "" `shouldBe` []+ it "matches on equality" $+ runFlex "firstResult" `shouldBe` [firstResult]+ it "scores short matches higher and sorts accordingly" $+ runFlex "filt" `shouldBe` [fiult, firstResult]
+ tests/Language/PureScript/Ide/RebuildSpec.hs view
@@ -0,0 +1,89 @@+module Language.PureScript.Ide.RebuildSpec where++import Protolude++import Data.Set qualified as Set+import Language.PureScript qualified as P+import Language.PureScript.AST.SourcePos (spanName)+import Language.PureScript.Ide.Command (Command(..))+import Language.PureScript.Ide.Completion (defaultCompletionOptions)+import Language.PureScript.Ide.Matcher (flexMatcher)+import Language.PureScript.Ide.Types (Completion(..), Success(..), emptyIdeState)+import Language.PureScript.Ide.Test qualified as Test+import System.FilePath ((</>))+import System.Directory (doesFileExist, removePathForcibly)+import Test.Hspec (Spec, describe, it, shouldBe, shouldSatisfy)++defaultTarget :: Set P.CodegenTarget+defaultTarget = Set.singleton P.JS++load :: [Text] -> Command+load = LoadSync . map Test.mn++rebuild :: FilePath -> Command+rebuild fp = Rebuild ("src" </> fp) Nothing defaultTarget++rebuildSync :: FilePath -> Command+rebuildSync fp = RebuildSync ("src" </> fp) Nothing defaultTarget++spec :: Spec+spec = describe "Rebuilding single modules" $ do+ it "rebuilds a correct module without dependencies successfully" $ do+ ([_, result], _) <- Test.inProject $+ Test.runIde [ load ["RebuildSpecSingleModule"]+ , rebuild "RebuildSpecSingleModule.purs"+ ]+ result `shouldSatisfy` isRight+ it "fails to rebuild an incorrect module without dependencies and returns the errors" $ do+ ([result], _) <- Test.inProject $+ Test.runIde [ rebuild "RebuildSpecSingleModule.fail" ]+ result `shouldSatisfy` isLeft+ it "rebuilds a correct module with its dependencies successfully" $ do+ ([_, result], _) <- Test.inProject $+ Test.runIde [ load ["RebuildSpecWithDeps", "RebuildSpecDep"]+ , rebuild "RebuildSpecWithDeps.purs"+ ]+ result `shouldSatisfy` isRight+ it "rebuilds a correct module that has reverse dependencies" $ do+ ([_, result], _) <- Test.inProject $+ Test.runIde [ load ["RebuildSpecWithDeps"], rebuild "RebuildSpecDep.purs" ]+ result `shouldSatisfy` isRight+ it "fails to rebuild a module if its dependencies are not loaded" $ do+ ([_, result], _) <- Test.inProject $+ Test.runIde [ load ["RebuildSpecWithDeps"], rebuild "RebuildSpecWithDeps.purs" ]+ result `shouldSatisfy` isLeft+ it "rebuilds a correct module with a foreign file" $ do+ ([_, result], _) <- Test.inProject $+ Test.runIde [ load ["RebuildSpecWithForeign"], rebuild "RebuildSpecWithForeign.purs" ]+ result `shouldSatisfy` isRight+ it "fails to rebuild a module with a foreign import but no file" $ do+ ([result], _) <- Test.inProject $+ Test.runIde [ rebuild "RebuildSpecWithMissingForeign.fail" ]+ result `shouldSatisfy` isLeft+ it "completes a hidden identifier after rebuilding" $ do+ ([_, Right (CompletionResult [ result ])], _) <- Test.inProject $+ Test.runIde [ rebuildSync "RebuildSpecWithHiddenIdent.purs"+ , Complete [] (flexMatcher "hid") (Just (Test.mn "RebuildSpecWithHiddenIdent")) defaultCompletionOptions]+ complIdentifier result `shouldBe` "hidden"+ it "uses the specified `actualFile` for location information" $ do+ ([_, Right (CompletionResult [ result ])], _) <- Test.inProject $+ Test.runIde'+ Test.defConfig+ emptyIdeState+ [ RebuildSync ("src" </> "RebuildSpecWithHiddenIdent.purs") (Just "actualFile") defaultTarget+ , Complete [] (flexMatcher "hid") (Just (Test.mn "RebuildSpecWithHiddenIdent")) defaultCompletionOptions]+ map spanName (complLocation result) `shouldBe` Just "actualFile"+ it "doesn't produce JS when an empty target list is supplied" $ do+ exists <- Test.inProject $ do+ let indexJs = "output" </> "RebuildSpecSingleModule" </> "index.js"+ removePathForcibly ("output" </> "RebuildSpecSingleModule")+ _ <- Test.runIde [ RebuildSync ("src" </> "RebuildSpecSingleModule.purs") Nothing Set.empty ]+ doesFileExist indexJs+ exists `shouldBe` False+ it "does produce corefn if it's a codegen target" $ do+ exists <- Test.inProject $ do+ let corefn = "output" </> "RebuildSpecSingleModule" </> "corefn.json"+ removePathForcibly ("output" </> "RebuildSpecSingleModule")+ _ <- Test.runIde [ RebuildSync ("src" </> "RebuildSpecSingleModule.purs") Nothing (Set.singleton P.CoreFn) ]+ doesFileExist corefn+ exists `shouldBe` True
+ tests/Language/PureScript/Ide/ReexportsSpec.hs view
@@ -0,0 +1,63 @@+module Language.PureScript.Ide.ReexportsSpec where++import Protolude++import Data.Map qualified as Map+import Language.PureScript.Ide.Reexports (ReexportResult(..), reexportHasFailures, resolveReexports')+import Language.PureScript.Ide.Types (IdeDeclarationAnn, ModuleMap)+import Language.PureScript.Ide.Test (annExp, ideDtor, ideKind, ideSynonym, ideType, ideTypeClass, ideValue, mn)+import Language.PureScript qualified as P+import Test.Hspec (Spec, describe, it, shouldBe, shouldSatisfy)++valueA, typeA, synonymA, classA, dtorA1, dtorA2, kindA :: IdeDeclarationAnn+valueA = ideValue "valueA" Nothing+typeA = ideType "TypeA" Nothing []+synonymA = ideSynonym "SynonymA" Nothing Nothing+classA = ideTypeClass "ClassA" P.kindType []+dtorA1 = ideDtor "DtorA1" "TypeA" Nothing+dtorA2 = ideDtor "DtorA2" "TypeA" Nothing+kindA = ideKind "KindA"++env :: ModuleMap [IdeDeclarationAnn]+env = Map.fromList+ [ (mn "A", [valueA, typeA, synonymA, classA, dtorA1, dtorA2, kindA])+ ]++type Refs = [(P.ModuleName, P.DeclarationRef)]++testSpan :: P.SourceSpan+testSpan = P.internalModuleSourceSpan "<test>"++succTestCases :: [(Text, Refs, [IdeDeclarationAnn])]+succTestCases =+ [ ("resolves a value reexport", [(mn "A", P.ValueRef testSpan (P.Ident "valueA"))], [valueA `annExp` "A"])+ , ("resolves a type reexport with explicit data constructors"+ , [(mn "A", P.TypeRef testSpan (P.ProperName "TypeA") (Just [P.ProperName "DtorA1"]))], [typeA `annExp` "A", dtorA1 `annExp` "A"])+ , ("resolves a type reexport with implicit data constructors"+ , [(mn "A", P.TypeRef testSpan (P.ProperName "TypeA") Nothing)], map (`annExp` "A") [typeA, dtorA1, dtorA2])+ , ("resolves a synonym reexport"+ , [(mn "A", P.TypeRef testSpan (P.ProperName "SynonymA") Nothing)], [synonymA `annExp` "A"])+ , ("resolves a class reexport", [(mn "A", P.TypeClassRef testSpan (P.ProperName "ClassA"))], [classA `annExp` "A"])+ ]++failTestCases :: [(Text, Refs)]+failTestCases =+ [ ("fails to resolve a non existing value", [(mn "A", P.ValueRef testSpan (P.Ident "valueB"))])+ , ("fails to resolve a non existing type reexport" , [(mn "A", P.TypeRef testSpan (P.ProperName "TypeB") Nothing)])+ , ("fails to resolve a non existing class reexport", [(mn "A", P.TypeClassRef testSpan (P.ProperName "ClassB"))])+ ]++spec :: Spec+spec = do+ describe "Successful Reexports" $+ for_ succTestCases $ \(desc, refs, result) ->+ it (toS desc) $ do+ let reResult = resolveReexports' env refs+ reResolved reResult `shouldBe` result+ reResult `shouldSatisfy` not . reexportHasFailures+ describe "Failed Reexports" $+ for_ failTestCases $ \(desc, refs) ->+ it (toS desc) $ do+ let reResult = resolveReexports' env refs+ reFailed reResult `shouldBe` refs+ reResult `shouldSatisfy` reexportHasFailures
+ tests/Language/PureScript/Ide/SourceFileSpec.hs view
@@ -0,0 +1,114 @@+module Language.PureScript.Ide.SourceFileSpec where++import Protolude++import Language.PureScript qualified as P+import Language.PureScript.Ide.Command (Command(..))+import Language.PureScript.Ide.SourceFile (extractSpans, extractTypeAnnotations)+import Language.PureScript.Ide.Types (Completion(..), IdeNamespace(..), IdeNamespaced(..), Success(..), emptyIdeState)+import Language.PureScript.Ide.Test+import Test.Hspec (Spec, describe, it, shouldBe)++span1, span2 :: P.SourceSpan+span1 = P.SourceSpan "" (P.SourcePos 1 1) (P.SourcePos 2 2)+span2 = P.SourceSpan "" (P.SourcePos 2 2) (P.SourcePos 3 3)++ann1, ann2 :: P.SourceAnn+ann1 = (span1, [])+ann2 = (span2, [])++typeAnnotation1, value1, synonym1, class1, class2, data1, data2, valueFixity, typeFixity, foreign1, foreign2, member1 :: P.Declaration+typeAnnotation1 = P.TypeDeclaration (P.TypeDeclarationData ann1 (P.Ident "value1") P.srcREmpty)+value1 = P.ValueDecl ann1 (P.Ident "value1") P.Public [] []+synonym1 = P.TypeSynonymDeclaration ann1 (P.ProperName "Synonym1") [] P.srcREmpty+class1 = P.TypeClassDeclaration ann1 (P.ProperName "Class1") [] [] [] []+class2 = P.TypeClassDeclaration ann1 (P.ProperName "Class2") [] [] [] [member1]+data1 = P.DataDeclaration ann1 P.Newtype (P.ProperName "Data1") [] []+data2 = P.DataDeclaration ann1 P.Data (P.ProperName "Data2") [] [P.DataConstructorDeclaration ann2 (P.ProperName "Cons1") []]+valueFixity =+ P.ValueFixityDeclaration+ ann1+ (P.Fixity P.Infix 0)+ (P.Qualified P.ByNullSourcePos (Left (P.Ident "")))+ (P.OpName "<$>")+typeFixity =+ P.TypeFixityDeclaration+ ann1+ (P.Fixity P.Infix 0)+ (P.Qualified P.ByNullSourcePos (P.ProperName ""))+ (P.OpName "~>")+foreign1 = P.ExternDeclaration ann1 (P.Ident "foreign1") P.srcREmpty+foreign2 = P.ExternDataDeclaration ann1 (P.ProperName "Foreign2") P.kindType+member1 = P.TypeDeclaration (P.TypeDeclarationData ann2 (P.Ident "member1") P.srcREmpty)++spec :: Spec+spec = do+ describe "Extracting Spans" $ do+ it "extracts a span for a value declaration" $+ extractSpans value1 `shouldBe` [(IdeNamespaced IdeNSValue "value1", span1)]+ it "extracts a span for a type synonym declaration" $+ extractSpans synonym1 `shouldBe` [(IdeNamespaced IdeNSType "Synonym1", span1)]+ it "extracts a span for a typeclass declaration" $+ extractSpans class1 `shouldBe` [(IdeNamespaced IdeNSType "Class1", span1)]+ it "extracts spans for a typeclass declaration and its members" $+ extractSpans class2 `shouldBe` [(IdeNamespaced IdeNSType "Class2", span1), (IdeNamespaced IdeNSValue "member1", span2)]+ it "extracts a span for a data declaration" $+ extractSpans data1 `shouldBe` [(IdeNamespaced IdeNSType "Data1", span1)]+ it "extracts spans for a data declaration and its constructors" $+ extractSpans data2 `shouldBe` [(IdeNamespaced IdeNSType "Data2", span1), (IdeNamespaced IdeNSValue "Cons1", span2)]+ it "extracts a span for a value operator fixity declaration" $+ extractSpans valueFixity `shouldBe` [(IdeNamespaced IdeNSValue "<$>", span1)]+ it "extracts a span for a type operator fixity declaration" $+ extractSpans typeFixity `shouldBe` [(IdeNamespaced IdeNSType "~>", span1)]+ it "extracts a span for a foreign declaration" $+ extractSpans foreign1 `shouldBe` [(IdeNamespaced IdeNSValue "foreign1", span1)]+ it "extracts a span for a data foreign declaration" $+ extractSpans foreign2 `shouldBe` [(IdeNamespaced IdeNSType "Foreign2", span1)]+ describe "Type annotations" $ do+ it "extracts a type annotation" $+ extractTypeAnnotations [typeAnnotation1] `shouldBe` [(P.Ident "value1", P.srcREmpty)]+ describe "Finding Source Spans for identifiers" $ do+ it "finds a value declaration" $ do+ Just r <- getLocation "sfValue"+ r `shouldBe` valueSS+ it "finds a synonym declaration" $ do+ Just r <- getLocation "SFType"+ r `shouldBe` synonymSS+ it "finds a data declaration and its constructors" $ do+ rs <- traverse getLocation ["SFData", "SFOne", "SFTwo", "SFThree"]+ traverse_ (`shouldBe` Just typeSS) rs+ it "finds a class declaration" $ do+ Just r <- getLocation "SFClass"+ r `shouldBe` classSS+ it "finds a value operator declaration" $ do+ Just r <- getLocation "<$>"+ r `shouldBe` valueOpSS+ it "finds a type operator declaration" $ do+ Just r <- getLocation "~>"+ r `shouldBe` typeOpSS+ it "finds a module declaration" $ do+ Just r <- getLocation "SfModule"+ r `shouldBe` moduleSS++getLocation :: Text -> IO (Maybe P.SourceSpan)+getLocation s = do+ ([Right (CompletionResult [c])], _) <-+ runIde' defConfig ideState [Type s [] Nothing]+ pure (complLocation c)+ where+ ideState = emptyIdeState `volatileState`+ [ ("Test",+ [ ideModule "SfModule" `annLoc` moduleSS+ , ideValue "sfValue" Nothing `annLoc` valueSS+ , ideSynonym "SFType" Nothing Nothing `annLoc` synonymSS+ , ideType "SFData" Nothing [] `annLoc` typeSS+ , ideDtor "SFOne" "SFData" Nothing `annLoc` typeSS+ , ideDtor "SFTwo" "SFData" Nothing `annLoc` typeSS+ , ideDtor "SFThree" "SFData" Nothing `annLoc` typeSS+ , ideTypeClass "SFClass" P.kindType [] `annLoc` classSS+ , ideValueOp "<$>" (P.Qualified P.ByNullSourcePos (Left "")) 0 Nothing Nothing+ `annLoc` valueOpSS+ , ideTypeOp "~>" (P.Qualified P.ByNullSourcePos "") 0 Nothing Nothing+ `annLoc` typeOpSS+ ])+ ]
+ tests/Language/PureScript/Ide/StateSpec.hs view
@@ -0,0 +1,105 @@+module Language.PureScript.Ide.StateSpec where++import Protolude+import Control.Lens (Ixed(..), folded)+import Language.PureScript.Ide.Types (IdeDeclarationAnn, IdeInstance(..), ModuleMap, _IdeDeclTypeClass, anyOf, idaDeclaration, ideTCInstances)+import Language.PureScript.Ide.State (resolveDataConstructorsForModule, resolveInstances, resolveOperatorsForModule)+import Language.PureScript.Ide.Test (ideDtor, ideType, ideTypeClass, ideTypeOp, ideValue, ideValueOp, mn)+import Language.PureScript qualified as P+import Test.Hspec (Spec, describe, it, shouldSatisfy)+import Data.Map qualified as Map++valueOperator :: Maybe P.SourceType -> IdeDeclarationAnn+valueOperator =+ ideValueOp "<$>" (P.Qualified (P.ByModuleName (mn "Test")) (Left "function")) 2 Nothing++ctorOperator :: Maybe P.SourceType -> IdeDeclarationAnn+ctorOperator =+ ideValueOp ":" (P.Qualified (P.ByModuleName (mn "Test")) (Right "Cons")) 2 Nothing++typeOperator :: Maybe P.SourceType -> IdeDeclarationAnn+typeOperator =+ ideTypeOp ":" (P.Qualified (P.ByModuleName (mn "Test")) "List") 2 Nothing++testModule :: (P.ModuleName, [IdeDeclarationAnn])+testModule =+ (mn "Test",+ [ ideValue "function" (Just P.srcREmpty)+ , ideDtor "Cons" "List" (Just P.tyString)+ , ideType "List" Nothing []+ , valueOperator Nothing+ , ctorOperator Nothing+ , typeOperator Nothing+ ])++testState :: ModuleMap [IdeDeclarationAnn]+testState = Map.fromList [testModule]++-- The accessor fields for these data types are not exposed unfortunately+ef :: P.ExternsFile+ef = P.ExternsFile+ -- { efVersion =+ mempty+ -- , efModuleName =+ (mn "InstanceModule")+ -- , efExports =+ mempty+ -- , efImports =+ mempty+ -- , efFixities =+ mempty+ -- , efTypeFixities =+ mempty+ --, efDeclarations =+ [ P.EDInstance+ -- { edInstanceClassName =+ (P.Qualified (P.ByModuleName (mn "ClassModule")) (P.ProperName "MyClass"))+ -- , edInstanceName =+ (P.Ident "myClassInstance")+ -- . edInstanceForAll =+ []+ -- , edInstanceKinds =+ mempty+ -- , edInstanceTypes =+ mempty+ -- , edInstanceConstraints =+ mempty+ -- , edInstanceChain =+ Nothing+ -- , edInstanceChainIndex =+ 0+ -- , edInstanceNameSource =+ P.UserNamed+ -- , edInstanceSourceSpan =+ P.NullSourceSpan+ -- }+ ]+ --, efSourceSpan =+ (P.internalModuleSourceSpan "<tests>")+ -- }++moduleMap :: ModuleMap [IdeDeclarationAnn]+moduleMap = Map.singleton (mn "ClassModule") [ideTypeClass "MyClass" P.kindType []]++ideInstance :: IdeInstance+ideInstance = IdeInstance (mn "InstanceModule") (P.Ident "myClassInstance") mempty mempty++spec :: Spec+spec = do+ describe "resolving operators" $ do+ it "resolves the type for a value operator" $+ resolveOperatorsForModule testState (snd testModule) `shouldSatisfy` elem (valueOperator (Just P.srcREmpty))+ it "resolves the type for a constructor operator" $+ resolveOperatorsForModule testState (snd testModule) `shouldSatisfy` elem (ctorOperator (Just P.tyString))+ it "resolves the kind for a type operator" $+ resolveOperatorsForModule testState (snd testModule) `shouldSatisfy` elem (typeOperator (Just P.kindType))+ describe "resolving instances for type classes" $ do+ it "resolves an instance for an existing type class" $ do+ resolveInstances (Map.singleton (mn "InstanceModule") ef) moduleMap+ `shouldSatisfy`+ anyOf (ix (mn "ClassModule") . ix 0 . idaDeclaration . _IdeDeclTypeClass . ideTCInstances . folded) (ideInstance ==)+ describe "resolving data constructors" $ do+ it "resolves a constructor" $ do+ resolveDataConstructorsForModule (snd testModule)+ `shouldSatisfy`+ elem (ideType "List" Nothing [(P.ProperName "Cons", P.tyString)])
+ tests/Language/PureScript/Ide/Test.hs view
@@ -0,0 +1,152 @@+{-# LANGUAGE PackageImports #-}+module Language.PureScript.Ide.Test where++import Control.Concurrent.STM (newTVarIO, readTVarIO)+import "monad-logger" Control.Monad.Logger (NoLoggingT(..))+import Data.IORef (newIORef)+import Data.Map qualified as Map+import Language.PureScript.Ide (handleCommand)+import Language.PureScript.Ide.Command (Command)+import Language.PureScript.Ide.Error (IdeError)+import Language.PureScript.Ide.Types+import Protolude+import System.Directory (doesDirectoryExist, getCurrentDirectory, makeAbsolute, removeDirectoryRecursive, setCurrentDirectory)+import System.FilePath ((</>))+import System.Process (createProcess, getProcessExitCode, shell)++import Language.PureScript qualified as P++defConfig :: IdeConfiguration+defConfig =+ IdeConfiguration+ { confLogLevel = LogNone+ , confOutputPath = "output/"+ , confGlobs = ["src/**/*.purs"]+ , confGlobsFromFile = Nothing+ , confGlobsExclude = []+ }++runIde' :: IdeConfiguration -> IdeState -> [Command] -> IO ([Either IdeError Success], IdeState)+runIde' conf s cs = do+ stateVar <- newTVarIO s+ ts <- newIORef Nothing+ let env' = IdeEnvironment {ideStateVar = stateVar, ideConfiguration = conf, ideCacheDbTimestamp = ts}+ r <- runNoLoggingT (runReaderT (traverse (runExceptT . handleCommand) cs) env')+ newState <- readTVarIO stateVar+ pure (r, newState)++runIde :: [Command] -> IO ([Either IdeError Success], IdeState)+runIde = runIde' defConfig emptyIdeState++volatileState :: IdeState -> [(Text, [IdeDeclarationAnn])] -> IdeState+volatileState s ds =+ s {ideVolatileState = vs}+ where+ vs = IdeVolatileState (AstData Map.empty) (Map.fromList decls) Nothing+ decls = map (first P.moduleNameFromString) ds++annLoc :: IdeDeclarationAnn -> P.SourceSpan -> IdeDeclarationAnn+annLoc (IdeDeclarationAnn a d) loc = IdeDeclarationAnn a {_annLocation = Just loc} d++annExp :: IdeDeclarationAnn -> Text -> IdeDeclarationAnn+annExp (IdeDeclarationAnn a d) e = IdeDeclarationAnn a {_annExportedFrom = Just (mn e)} d+++ida :: IdeDeclaration -> IdeDeclarationAnn+ida = IdeDeclarationAnn emptyAnn++-- | Builders for Ide declarations+ideValue :: Text -> Maybe P.SourceType -> IdeDeclarationAnn+ideValue i ty = ida (IdeDeclValue (IdeValue (P.Ident i) (fromMaybe P.tyString ty)))++ideType :: Text -> Maybe P.SourceType -> [(P.ProperName 'P.ConstructorName, P.SourceType)] -> IdeDeclarationAnn+ideType pn ki dtors = ida (IdeDeclType (IdeType (P.ProperName pn) (fromMaybe P.kindType ki) dtors))++ideSynonym :: Text -> Maybe P.SourceType -> Maybe P.SourceType -> IdeDeclarationAnn+ideSynonym pn ty kind = ida (IdeDeclTypeSynonym (IdeTypeSynonym (P.ProperName pn) (fromMaybe P.tyString ty) (fromMaybe P.kindType kind)))++ideTypeClass :: Text -> P.SourceType -> [IdeInstance] -> IdeDeclarationAnn+ideTypeClass pn kind instances = ida (IdeDeclTypeClass (IdeTypeClass (P.ProperName pn) kind instances))++ideDtor :: Text -> Text -> Maybe P.SourceType -> IdeDeclarationAnn+ideDtor pn tn ty = ida (IdeDeclDataConstructor (IdeDataConstructor (P.ProperName pn) (P.ProperName tn) (fromMaybe P.tyString ty)))++ideValueOp :: Text -> P.Qualified (Either Text Text) -> Integer -> Maybe P.Associativity -> Maybe P.SourceType -> IdeDeclarationAnn+ideValueOp opName ident precedence assoc t =+ ida (IdeDeclValueOperator+ (IdeValueOperator+ (P.OpName opName)+ (bimap P.Ident P.ProperName <$> ident)+ precedence+ (fromMaybe P.Infix assoc)+ t))++ideTypeOp :: Text -> P.Qualified Text -> Integer -> Maybe P.Associativity -> Maybe P.SourceType -> IdeDeclarationAnn+ideTypeOp opName ident precedence assoc k =+ ida (IdeDeclTypeOperator+ (IdeTypeOperator+ (P.OpName opName)+ (P.ProperName <$> ident)+ precedence+ (fromMaybe P.Infix assoc)+ k))++ideKind :: Text -> IdeDeclarationAnn+ideKind pn = ideType pn (Just P.kindType) []++ideModule :: Text -> IdeDeclarationAnn+ideModule name = ida (IdeDeclModule (mn name))++moduleSS, valueSS, synonymSS, typeSS, classSS, valueOpSS, typeOpSS :: P.SourceSpan+moduleSS = ss 1 1+valueSS = ss 3 1+synonymSS = ss 5 1+typeSS = ss 7 1+classSS = ss 8 1+valueOpSS = ss 12 1+typeOpSS = ss 13 1++ss :: Int -> Int -> P.SourceSpan+ss x y = P.SourceSpan "Test.purs" (P.SourcePos x y) (P.SourcePos x y)++mn :: Text -> P.ModuleName+mn = P.moduleNameFromString++projectDir :: FilePath+projectDir = "." </> "tests" </> "support" </> "pscide"++getProjectDirectory :: IO FilePath+getProjectDirectory = makeAbsolute projectDir++inProject :: IO a -> IO a+inProject f = do+ cwd' <- getCurrentDirectory+ setCurrentDirectory projectDir+ a <- f+ setCurrentDirectory cwd'+ pure a++compileTestProject :: IO Bool+compileTestProject = inProject $ do+ (_, _, _, procHandle) <-+ createProcess $ shell "purs compile \"src/**/*.purs\""+ r <- tryNTimes 10 (getProcessExitCode procHandle)+ pure (maybe False isSuccess r)++isSuccess :: ExitCode -> Bool+isSuccess ExitSuccess = True+isSuccess (ExitFailure _) = False++tryNTimes :: Int -> IO (Maybe a) -> IO (Maybe a)+tryNTimes 0 _ = pure Nothing+tryNTimes n action = do+ r <- action+ case r of+ Nothing -> do+ threadDelay 500000+ tryNTimes (n - 1) action+ Just a -> pure (Just a)++deleteOutputFolder :: IO ()+deleteOutputFolder = inProject $+ whenM (doesDirectoryExist "output") (removeDirectoryRecursive "output")
+ tests/Language/PureScript/Ide/UsageSpec.hs view
@@ -0,0 +1,78 @@+module Language.PureScript.Ide.UsageSpec where++import Protolude++import Data.Text qualified as Text+import Language.PureScript.Ide.Command (Command(..))+import Language.PureScript.Ide.Types (IdeNamespace(..), Success(..))+import Language.PureScript.Ide.Test qualified as Test+import Language.PureScript qualified as P+import Test.Hspec (Expectation, Spec, describe, it, shouldBe)+import Data.Text.Read (decimal)+import System.FilePath ((</>))++load :: [Text] -> Command+load = LoadSync . map Test.mn++usage :: P.ModuleName -> Text -> IdeNamespace -> Command+usage = FindUsages++shouldBeUsage :: P.SourceSpan -> (FilePath, Text) -> Expectation+shouldBeUsage usage' (fp, range) =+ let+ [ start, end] = Text.splitOn "-" range+ unsafeReadInt = fst . either (panic "") identity . decimal+ [ startLine, startColumn ] = map unsafeReadInt (Text.splitOn ":" start)+ [ endLine, endColumn ] = map unsafeReadInt (Text.splitOn ":" end)+ in+ do+ projectDir <- Test.getProjectDirectory+ projectDir </> fp `shouldBe` P.spanName usage'++ (P.sourcePosLine (P.spanStart usage'), P.sourcePosColumn (P.spanStart usage'))+ `shouldBe`+ (startLine, startColumn)++ (P.sourcePosLine (P.spanEnd usage'), P.sourcePosColumn (P.spanEnd usage'))+ `shouldBe`+ (endLine, endColumn)++spec :: Spec+spec = describe "Finding Usages" $ do+ it "finds a simple usage" $ do+ ([_, Right (UsagesResult [usage1, usage2])], _) <- Test.inProject $+ Test.runIde [ load ["FindUsage", "FindUsage.Definition", "FindUsage.Reexport"]+ , usage (Test.mn "FindUsage.Definition") "usageId" IdeNSValue+ ]+ usage1 `shouldBeUsage` ("src" </> "FindUsage.purs", "12:11-12:18")+ usage2 `shouldBeUsage` ("src" </> "FindUsage" </> "Definition.purs", "13:18-13:25")+ it "finds a simple recursive usage" $ do+ ([_, Right (UsagesResult [usage1])], _) <- Test.inProject $+ Test.runIde [ load ["FindUsage.Recursive"]+ , usage (Test.mn "FindUsage.Recursive") "recursiveUsage" IdeNSValue+ ]+ usage1 `shouldBeUsage` ("src" </> "FindUsage" </> "Recursive.purs", "7:12-7:26")+ it "ignores a locally shadowed recursive usage" $ do+ ([_, Right (UsagesResult usageResult)], _) <- Test.inProject $+ Test.runIde [ load ["FindUsage.RecursiveShadowed"]+ , usage (Test.mn "FindUsage.RecursiveShadowed") "recursiveUsage" IdeNSValue+ ]+ usageResult `shouldBe` []+ it "finds a constructor usage" $ do+ ([_, Right (UsagesResult [usage1])], _) <- Test.inProject $+ Test.runIde [ load ["FindUsage", "FindUsage.Definition", "FindUsage.Reexport"]+ , usage (Test.mn "FindUsage.Definition") "Used" IdeNSValue+ ]+ usage1 `shouldBeUsage` ("src" </> "FindUsage.purs", "8:3-8:9")+ it "finds a constructor alias usage" $ do+ ([_, Right (UsagesResult [usage1])], _) <- Test.inProject $+ Test.runIde [ load ["FindUsage", "FindUsage.Definition", "FindUsage.Reexport"]+ , usage (Test.mn "FindUsage.Definition") "$%" IdeNSValue+ ]+ usage1 `shouldBeUsage` ("src" </> "FindUsage.purs", "9:5-9:7")+ it "finds a reexported usage" $ do+ ([_, Right (UsagesResult [usage1])], _) <- Test.inProject $+ Test.runIde [ load ["FindUsage", "FindUsage.Definition", "FindUsage.Reexport"]+ , usage (Test.mn "FindUsage.Reexport") "toBeReexported" IdeNSValue+ ]+ usage1 `shouldBeUsage` ("src" </> "FindUsage.purs", "12:19-12:33")
tests/Main.hs view
@@ -1,108 +1,48 @@------------------------------------------------------------------------------------ Module : Main--- Copyright : (c) Phil Freeman 2013--- License : MIT------ Maintainer : Phil Freeman <paf31@cantab.net>--- Stability : experimental--- Portability :------ |-----------------------------------------------------------------------------------{-# LANGUAGE DataKinds, DoAndIfThenElse #-}+{-# LANGUAGE DoAndIfThenElse #-} module Main (main) where -import qualified Language.PureScript as P--import Data.List (isSuffixOf)-import Data.Traversable (traverse)-import Control.Monad-import Control.Monad.Trans.Maybe (MaybeT(..), runMaybeT)-import Control.Monad.Reader (runReaderT)-import Control.Applicative-import System.Exit-import System.Process-import System.FilePath (pathSeparator)-import System.Directory (getCurrentDirectory, getTemporaryDirectory, getDirectoryContents, findExecutable)-import Text.Parsec (ParseError)--readInput :: [FilePath] -> IO [(FilePath, String)]-readInput inputFiles = forM inputFiles $ \inputFile -> do- text <- readFile inputFile- return (inputFile, text)--loadPrelude :: Either String (String, String, P.Environment)-loadPrelude =- case P.parseModulesFromFiles id [("", P.prelude)] of- Left parseError -> Left (show parseError)- Right ms -> runReaderT (P.compile (map snd ms) []) $ P.defaultCompileOptions { P.optionsAdditional = P.CompileOptions "Tests" [] [] }--compile :: P.Options P.Compile -> [FilePath] -> IO (Either String (String, String, P.Environment))-compile opts inputFiles = do- modules <- P.parseModulesFromFiles id <$> readInput inputFiles- case modules of- Left parseError ->- return (Left $ show parseError)- Right ms -> return $ runReaderT (P.compile (map snd ms) []) opts--assert :: FilePath -> P.Options P.Compile -> FilePath -> (Either String (String, String, P.Environment) -> IO (Maybe String)) -> IO ()-assert preludeExterns opts inputFile f = do- e <- compile opts [preludeExterns, inputFile]- maybeErr <- f e- case maybeErr of- Just err -> putStrLn err >> exitFailure- Nothing -> return ()+import Prelude -assertCompiles :: String -> FilePath -> FilePath -> IO ()-assertCompiles preludeJs preludeExterns inputFile = do- putStrLn $ "Assert " ++ inputFile ++ " compiles successfully"- let options = P.defaultCompileOptions- { P.optionsMain = Just "Main"- , P.optionsAdditional = P.CompileOptions "Tests" ["Main"] ["Main"]- }- assert preludeExterns options inputFile $ either (return . Just) $ \(js, _, _) -> do- process <- findNodeProcess- result <- traverse (\node -> readProcessWithExitCode node [] (preludeJs ++ js)) process- case result of- Just (ExitSuccess, out, _) -> putStrLn out >> return Nothing- Just (ExitFailure _, _, err) -> return $ Just err- Nothing -> return $ Just "Couldn't find node.js executable"+import Test.Hspec -assertDoesNotCompile :: FilePath -> FilePath -> IO ()-assertDoesNotCompile preludeExterns inputFile = do- putStrLn $ "Assert " ++ inputFile ++ " does not compile"- assert preludeExterns (P.defaultCompileOptions { P.optionsAdditional = P.CompileOptions "Tests" [] [] }) inputFile $ \e ->- case e of- Left err -> putStrLn err >> return Nothing- Right _ -> return $ Just "Should not have compiled"+import TestAst qualified+import TestCompiler qualified+import TestCoreFn qualified+import TestCst qualified+import TestDocs qualified+import TestHierarchy qualified+import TestPrimDocs qualified+import TestPsci qualified+import TestIde qualified+import TestPscPublish qualified+import TestSourceMaps qualified+-- import TestBundle qualified+import TestMake qualified+import TestUtils qualified+import TestGraph qualified -findNodeProcess :: IO (Maybe String)-findNodeProcess = runMaybeT . msum $ map (MaybeT . findExecutable) names- where names = ["nodejs", "node"]+import System.IO (hSetEncoding, stdout, stderr, utf8) main :: IO () main = do- putStrLn "Compiling Prelude"- case loadPrelude of- Left err -> putStrLn err >> exitFailure- Right (preludeJs, exts, _) -> do- tmp <- getTemporaryDirectory- let preludeExterns = tmp ++ pathSeparator : "prelude.externs"- writeFile preludeExterns exts- putStrLn $ "Wrote " ++ preludeExterns- cd <- getCurrentDirectory- let examples = cd ++ pathSeparator : "examples"- let passing = examples ++ pathSeparator : "passing"- passingTestCases <- getDirectoryContents passing- forM_ passingTestCases $ \inputFile -> when (".purs" `isSuffixOf` inputFile) $- assertCompiles preludeJs preludeExterns (passing ++ pathSeparator : inputFile)- let failing = examples ++ pathSeparator : "failing"- failingTestCases <- getDirectoryContents failing- forM_ failingTestCases $ \inputFile -> when (".purs" `isSuffixOf` inputFile) $- assertDoesNotCompile preludeExterns (failing ++ pathSeparator : inputFile)- exitSuccess+ hSetEncoding stdout utf8+ hSetEncoding stderr utf8 + TestUtils.updateSupportCode++ hspec $ do+ describe "cst" TestCst.spec+ describe "ast" TestAst.spec+ describe "ide" TestIde.spec+ beforeAll TestUtils.setupSupportModules $ do+ describe "compiler" TestCompiler.spec+ describe "sourcemaps" TestSourceMaps.spec+ describe "make" TestMake.spec+ describe "psci" TestPsci.spec+ describe "corefn" TestCoreFn.spec+ describe "docs" TestDocs.spec+ describe "prim-docs" TestPrimDocs.spec+ describe "publish" TestPscPublish.spec+ describe "hierarchy" TestHierarchy.spec+ describe "graph" TestGraph.spec
+ tests/PscIdeSpec.hs view
@@ -0,0 +1,1 @@+{-# OPTIONS_GHC -F -pgmF hspec-discover -optF --module-name=PscIdeSpec #-}
+ tests/TestAst.hs view
@@ -0,0 +1,98 @@+{-# LANGUAGE TypeApplications #-}+module TestAst where++import Protolude hiding (Constraint, Type, (:+))++import Control.Lens ((+~))+import Control.Newtype (ala')+import Generic.Random (genericArbitraryRecG, genericArbitraryUG, listOf', uniform, withBaseCase, (:+)(..))+import Test.Hspec (Spec, describe, it)+import Test.QuickCheck (Arbitrary(..), Gen, Property, Testable, counterexample, forAllShrink, subterms, (===))++import Language.PureScript.Label (Label(..))+import Language.PureScript.Names (pattern ByNullSourcePos, OpName(..), OpNameType(..), ProperName(..), ProperNameType(..), Qualified(..))+import Language.PureScript.PSString (PSString)+import Language.PureScript.Types (Constraint, ConstraintData, SkolemScope(..), Type(..), TypeVarVisibility(..), WildcardData, annForType, everythingOnTypes, everythingWithContextOnTypes, everywhereOnTypes, everywhereOnTypesM, everywhereOnTypesTopDownM, getAnnForType)++spec :: Spec+spec = do+ describe "Language.PureScript.Types" $ do+ describe "everywhereOnTypes" $ do+ everywhereOnTypesSpec everywhereOnTypes+ describe "everywhereOnTypesM" $ do+ everywhereOnTypesSpec $ ala' Identity everywhereOnTypesM+ describe "everywhereOnTypesTopDownM" $ do+ everywhereOnTypesSpec $ ala' Identity everywhereOnTypesTopDownM+ describe "everythingOnTypes" $ do+ everythingOnTypesSpec everythingOnTypes+ describe "everythingWithContextOnTypes" $ do+ everythingOnTypesSpec $ \f g -> everythingWithContextOnTypes () [] f $ \s -> (s, ) . g++everywhereOnTypesSpec :: ((Type Int -> Type Int) -> Type Int -> Type Int) -> Spec+everywhereOnTypesSpec everywhereOnTypesUnderTest = do+ it "should visit each type once" $+ forAllShrink (genTypeAnnotatedWith (pure 0) (pure 1)) subterms $ \t ->+ all (== 1) `isSatisfiedBy` everywhereOnTypesUnderTest (annForType +~ 1) t++everythingOnTypesSpec :: (([Int] -> [Int] -> [Int]) -> (Type Int -> [Int]) -> Type Int -> [Int]) -> Spec+everythingOnTypesSpec everythingOnTypesUnderTest = do+ it "should visit each type once" $+ forAllShrink (genTypeAnnotatedWith (pure 1) (pure 0)) subterms $ \t ->+ everythingOnTypesUnderTest (++) (pure . getAnnForType) t ===+ filter (== 1) (toList t)+++infixr 0 `isSatisfiedBy`+isSatisfiedBy :: forall a p. Show a => Testable p => (a -> p) -> a -> Property+isSatisfiedBy = liftA2 counterexample show++genTypeAnnotatedWith :: forall a. Gen a -> Gen a -> Gen (Type a)+genTypeAnnotatedWith genTypeAnn genConstraintAnn = genType where+ generatorEnvironment+ = genConstraint+ :+ maybeOf genConstraintData+ :+ Label <$> genPSString+ :+ genPSString+ :+ genQualified (OpName @'TypeOpName)+ :+ genQualified (ProperName @'ClassName)+ :+ genQualified (ProperName @'TypeName)+ :+ genSkolemScope+ :+ maybeOf genSkolemScope+ :+ genText+ :+ listOf' (listOf' genText)+ :+ maybeOf genText+ :+ genType+ :+ listOf' genType+ :+ maybeOf genType+ :+ genWildcardData+ :+ genVisibility++ genConstraint :: Gen (Constraint a)+ genConstraint = genericArbitraryUG (genConstraintAnn :+ generatorEnvironment)++ genConstraintData :: Gen ConstraintData+ genConstraintData = genericArbitraryUG generatorEnvironment++ genQualified :: forall b. (Text -> b) -> Gen (Qualified b)+ genQualified ctor = Qualified ByNullSourcePos . ctor <$> genText++ genSkolemScope :: Gen SkolemScope+ genSkolemScope = SkolemScope <$> arbitrary++ genType :: Gen (Type a)+ genType = genericArbitraryRecG (genTypeAnn :+ generatorEnvironment) uniform `withBaseCase` (TypeVar <$> genTypeAnn <*> genText)++ genWildcardData :: Gen WildcardData+ genWildcardData = genericArbitraryUG genText++ maybeOf :: forall b. Gen b -> Gen (Maybe b)+ maybeOf = genericArbitraryUG++ genText :: Gen Text+ genText = pure "x" -- Feel free to make this random if it matters at some point.++ genPSString :: Gen PSString+ genPSString = pure "x" -- Ditto.++ genVisibility :: Gen TypeVarVisibility+ genVisibility = pure TypeVarInvisible
+ tests/TestCompiler.hs view
@@ -0,0 +1,263 @@+{-# LANGUAGE DoAndIfThenElse #-}++module TestCompiler where++-- Failing tests can specify the kind of error that should be thrown with a+-- @shouldFailWith declaration. For example:+--+-- "-- @shouldFailWith TypesDoNotUnify"+--+-- will cause the test to fail unless that module fails to compile with exactly+-- one TypesDoNotUnify error.+--+-- If a module is expected to produce multiple type errors, then use multiple+-- @shouldFailWith lines; for example:+--+-- -- @shouldFailWith TypesDoNotUnify+-- -- @shouldFailWith TypesDoNotUnify+-- -- @shouldFailWith TransitiveExportError+--+-- Warning and failing tests also check their output against the relative+-- golden files (`.out`). The golden files are generated automatically when+-- missing, and can be updated by setting the "HSPEC_ACCEPT" environment+-- variable, e.g. by running `HSPEC_ACCEPT=true stack test`.++import Prelude++import Language.PureScript qualified as P+import Language.PureScript.Interactive.IO (readNodeProcessWithExitCode)++import Control.Arrow ((>>>))+import Data.ByteString qualified as BS+import Data.Function (on)+import Data.List (sort, stripPrefix, minimumBy)+import Data.Maybe (mapMaybe)+import Data.Text qualified as T+import Data.Text.Encoding qualified as T+++import Control.Monad (forM_, when)++import System.Exit (ExitCode(..))+import System.FilePath (pathSeparator, replaceExtension, takeFileName, (</>))+import System.IO (Handle, hPutStr, hPutStrLn)+import System.IO.UTF8 (readUTF8File)++import Text.Regex.Base (RegexContext(..), RegexMaker(..))+import Text.Regex.TDFA (Regex)++import TestUtils (ExpectedModuleName(..), SupportModules, compile, createOutputFile, getTestFiles, goldenVsString, modulesDir, trim)+import Test.Hspec (Expectation, SpecWith, beforeAllWith, describe, expectationFailure, it, runIO)++spec :: SpecWith SupportModules+spec = do+ passingTests+ warningTests+ failingTests+ optimizeTests++passingTests :: SpecWith SupportModules+passingTests = do+ passingTestCases <- runIO $ getTestFiles "passing"++ describe "Passing examples" $+ beforeAllWith ((<$> createOutputFile logfile) . (,)) $+ forM_ passingTestCases $ \testPurs ->+ it ("'" <> takeFileName (getTestMain testPurs) <> "' should compile and run without error") $ \(support, outputFile) ->+ assertCompiles support testPurs outputFile++warningTests :: SpecWith SupportModules+warningTests = do+ warningTestCases <- runIO $ getTestFiles "warning"++ describe "Warning examples" $+ forM_ warningTestCases $ \testPurs -> do+ let mainPath = getTestMain testPurs+ it ("'" <> takeFileName mainPath <> "' should compile with expected warning(s)") $ \support -> do+ expectedWarnings <- getShouldWarnWith mainPath+ assertCompilesWithWarnings support testPurs expectedWarnings++failingTests :: SpecWith SupportModules+failingTests = do+ failingTestCases <- runIO $ getTestFiles "failing"++ describe "Failing examples" $ do+ forM_ failingTestCases $ \testPurs -> do+ let mainPath = getTestMain testPurs+ it ("'" <> takeFileName mainPath <> "' should fail to compile") $ \support -> do+ expectedFailures <- getShouldFailWith mainPath+ assertDoesNotCompile support testPurs expectedFailures++optimizeTests :: SpecWith SupportModules+optimizeTests = do+ optimizeTestCases <- runIO $ getTestFiles "optimize"++ describe "Optimization examples" $+ forM_ optimizeTestCases $ \testPurs ->+ it ("'" <> takeFileName (getTestMain testPurs) <> "' should compile to expected output") $ \support ->+ assertCompilesToExpectedOutput support testPurs++checkShouldReport :: [String] -> (P.MultipleErrors -> String) -> P.MultipleErrors -> Expectation+checkShouldReport expected prettyPrintDiagnostics errs =+ let actual = map P.errorCode $ P.runMultipleErrors errs+ in if sort expected == sort (map T.unpack actual)+ then checkPositioned errs+ else expectationFailure $ "Expected these diagnostics: " ++ show expected ++ ", but got these: "+ ++ show actual ++ ", full diagnostic messages: \n"+ ++ prettyPrintDiagnostics errs++checkPositioned :: P.MultipleErrors -> Expectation+checkPositioned errs =+ case mapMaybe guardSpans (P.runMultipleErrors errs) of+ [] ->+ pure ()+ errs' ->+ expectationFailure+ $ "Found diagnostics with missing source spans:\n"+ ++ unlines (map (P.renderBox . P.prettyPrintSingleError P.defaultPPEOptions) errs')+ where+ guardSpans :: P.ErrorMessage -> Maybe P.ErrorMessage+ guardSpans err = case P.errorSpan err of+ Just ss | not $ all isNonsenseSpan ss -> Nothing+ _ -> Just err++ isNonsenseSpan :: P.SourceSpan -> Bool+ isNonsenseSpan (P.SourceSpan spanName spanStart spanEnd) =+ spanName == "" || spanName == "<module>" || (spanStart == emptyPos && spanEnd == emptyPos)++ emptyPos :: P.SourcePos+ emptyPos = P.SourcePos 0 0++assertCompiles+ :: SupportModules+ -> [FilePath]+ -> Handle+ -> Expectation+assertCompiles support inputFiles outputFile = do+ (fileContents, (result, _)) <- compile (Just IsMain) support inputFiles+ let errorOptions = P.defaultPPEOptions { P.ppeFileContents = fileContents }+ case result of+ Left errs -> expectationFailure . P.prettyPrintMultipleErrors errorOptions $ errs+ Right _ -> do+ let entryPoint = modulesDir </> "index.js"+ writeFile entryPoint "import('./Main/index.js').then(({ main }) => main());"+ nodeResult <- readNodeProcessWithExitCode Nothing [entryPoint] ""+ hPutStrLn outputFile $ "\n" <> takeFileName (last inputFiles) <> ":"+ case nodeResult of+ Right (ExitSuccess, out, err)+ | not (null err) -> expectationFailure $ "Test wrote to stderr:\n\n" <> err+ | not (null out) && trim (last (lines out)) == "Done" -> hPutStr outputFile out+ | otherwise -> expectationFailure $ "Test did not finish with 'Done':\n\n" <> out+ Right (ExitFailure _, _, err) -> expectationFailure err+ Left err -> expectationFailure err++assertCompilesWithWarnings+ :: SupportModules+ -> [FilePath]+ -> [String]+ -> Expectation+assertCompilesWithWarnings support inputFiles shouldWarnWith = do+ (fileContents, result'@(result, warnings)) <- compile Nothing support inputFiles+ let errorOptions = P.defaultPPEOptions { P.ppeFileContents = fileContents }+ case result of+ Left errs ->+ expectationFailure . P.prettyPrintMultipleErrors errorOptions $ errs+ Right _ -> do+ checkShouldReport shouldWarnWith (P.prettyPrintMultipleWarnings errorOptions) warnings+ goldenVsString+ (replaceExtension (getTestMain inputFiles) ".out")+ (return . T.encodeUtf8 . T.pack $ printDiagnosticsForGoldenTest fileContents result')++assertDoesNotCompile+ :: SupportModules+ -> [FilePath]+ -> [String]+ -> Expectation+assertDoesNotCompile support inputFiles shouldFailWith = do+ (fileContents, result) <- compile Nothing support inputFiles+ let errorOptions = P.defaultPPEOptions { P.ppeFileContents = fileContents }+ case fst result of+ Left errs -> do+ when (null shouldFailWith)+ (expectationFailure $+ "shouldFailWith declaration is missing (errors were: "+ ++ show (map P.errorCode (P.runMultipleErrors errs))+ ++ ")")+ checkShouldReport shouldFailWith (P.prettyPrintMultipleErrors errorOptions) errs+ goldenVsString+ (replaceExtension (getTestMain inputFiles) ".out")+ (return . T.encodeUtf8 . T.pack $ printDiagnosticsForGoldenTest fileContents result)+ Right _ ->+ expectationFailure "Should not have compiled"++assertCompilesToExpectedOutput+ :: SupportModules+ -> [FilePath]+ -> Expectation+assertCompilesToExpectedOutput support inputFiles = do+ (fileContents, (result, _)) <- compile Nothing support inputFiles+ let errorOptions = P.defaultPPEOptions { P.ppeFileContents = fileContents }+ case result of+ Left errs -> expectationFailure . P.prettyPrintMultipleErrors errorOptions $ errs+ Right _ ->+ goldenVsString+ (replaceExtension (getTestMain inputFiles) ".out.js")+ (BS.readFile $ modulesDir </> "Main/index.js")++-- Prints a set of diagnostics (i.e. errors or warnings) as a string, in order+-- to compare it to the contents of a golden test file.+printDiagnosticsForGoldenTest :: [(FilePath, T.Text)] -> (Either P.MultipleErrors a, P.MultipleErrors) -> String+printDiagnosticsForGoldenTest fileContents (result, warnings) =+ normalizePaths $ case result of+ Left errs ->+ -- TODO: should probably include warnings when failing?+ P.prettyPrintMultipleErrors errorOptions errs+ Right _ ->+ P.prettyPrintMultipleWarnings errorOptions warnings+ where+ errorOptions = P.defaultPPEOptions { P.ppeFileContents = fileContents }++-- Replaces Windows-style paths in an error or warning with POSIX paths+normalizePaths :: String -> String+normalizePaths = if pathSeparator == '\\'+ then replaceMatches " [0-9A-Za-z_-]+(\\\\[0-9A-Za-z_-]+)+\\.[A-Za-z]+\\>" (map turnSlash)+ else id+ where+ turnSlash '\\' = '/'+ turnSlash c = c++-- Uses a function to replace all matches of a regular expression in a string+replaceMatches :: String -> (String -> String) -> String -> String+replaceMatches reString phi = go+ where+ re :: Regex+ re = makeRegex reString+ go :: String -> String+ go haystack =+ let (prefix, needle, suffix) = match re haystack+ in prefix ++ (if null needle then "" else phi needle ++ go suffix)++-- Takes the test entry point from a group of purs files - this is determined+-- by the file with the shortest path name, as everything but the main file+-- will be under a subdirectory.+getTestMain :: [FilePath] -> FilePath+getTestMain = minimumBy (compare `on` length)++-- Scans a file for @shouldFailWith directives in the comments, used to+-- determine expected failures+getShouldFailWith :: FilePath -> IO [String]+getShouldFailWith = extractPragma "shouldFailWith"++-- Scans a file for @shouldWarnWith directives in the comments, used to+-- determine expected warnings+getShouldWarnWith :: FilePath -> IO [String]+getShouldWarnWith = extractPragma "shouldWarnWith"++extractPragma :: String -> FilePath -> IO [String]+extractPragma pragma = fmap go . readUTF8File+ where+ go = lines >>> mapMaybe (stripPrefix ("-- @" ++ pragma ++ " ")) >>> map trim+++logfile :: FilePath+logfile = "psc-tests.out"
+ tests/TestCoreFn.hs view
@@ -0,0 +1,267 @@+{-# LANGUAGE DoAndIfThenElse #-}++module TestCoreFn (spec) where++import Prelude++import Data.Aeson (Result(..), Value)+import Data.Aeson.Types (parse)+import Data.Map as M+import Data.Version (Version(..))++import Language.PureScript.AST.Literals (Literal(..))+import Language.PureScript.AST.SourcePos (SourcePos(..), SourceSpan(..))+import Language.PureScript.Comments (Comment(..))+import Language.PureScript.CoreFn (Ann, Bind(..), Binder(..), CaseAlternative(..), ConstructorType(..), Expr(..), Meta(..), Module(..), ssAnn)+import Language.PureScript.CoreFn.FromJSON (moduleFromJSON)+import Language.PureScript.CoreFn.ToJSON (moduleToJSON)+import Language.PureScript.Names (pattern ByNullSourcePos, Ident(..), ModuleName(..), ProperName(..), Qualified(..), QualifiedBy(..))+import Language.PureScript.PSString (mkString)++import Test.Hspec (Spec, context, shouldBe, shouldSatisfy, specify)++parseModule :: Value -> Result (Version, Module Ann)+parseModule = parse moduleFromJSON++-- convert a module to its json CoreFn representation and back+parseMod :: Module Ann -> Result (Module Ann)+parseMod m =+ let v = Version [0] []+ in snd <$> parseModule (moduleToJSON v m)++isSuccess :: Result a -> Bool+isSuccess (Success _) = True+isSuccess _ = False++spec :: Spec+spec = context "CoreFnFromJson" $ do+ let mn = ModuleName "Example.Main"+ mp = "src/Example/Main.purs"+ ss = SourceSpan mp (SourcePos 0 0) (SourcePos 0 0)+ ann = ssAnn ss++ specify "should parse version" $ do+ let v = Version [0, 13, 6] []+ m = Module ss [] mn mp [] [] M.empty [] []+ r = fst <$> parseModule (moduleToJSON v m)+ r `shouldSatisfy` isSuccess+ case r of+ Error _ -> return ()+ Success v' -> v' `shouldBe` v++ specify "should parse an empty module" $ do+ let r = parseMod $ Module ss [] mn mp [] [] M.empty [] []+ r `shouldSatisfy` isSuccess+ case r of+ Error _ -> return ()+ Success m -> moduleName m `shouldBe` mn++ specify "should parse source span" $ do+ let r = parseMod $ Module ss [] mn mp [] [] M.empty [] []+ r `shouldSatisfy` isSuccess+ case r of+ Error _ -> return ()+ Success m -> moduleSourceSpan m `shouldBe` ss++ specify "should parse module path" $ do+ let r = parseMod $ Module ss [] mn mp [] [] M.empty [] []+ r `shouldSatisfy` isSuccess+ case r of+ Error _ -> return ()+ Success m -> modulePath m `shouldBe` mp++ specify "should parse imports" $ do+ let r = parseMod $ Module ss [] mn mp [(ann, mn)] [] M.empty [] []+ r `shouldSatisfy` isSuccess+ case r of+ Error _ -> return ()+ Success m -> moduleImports m `shouldBe` [(ann, mn)]++ specify "should parse exports" $ do+ let r = parseMod $ Module ss [] mn mp [] [Ident "exp"] M.empty [] []+ r `shouldSatisfy` isSuccess+ case r of+ Error _ -> return ()+ Success m -> moduleExports m `shouldBe` [Ident "exp"]++ specify "should parse re-exports" $ do+ let r = parseMod $ Module ss [] mn mp [] [] (M.singleton (ModuleName "Example.A") [Ident "exp"]) [] []+ r `shouldSatisfy` isSuccess+ case r of+ Error _ -> return ()+ Success m -> moduleReExports m `shouldBe` M.singleton (ModuleName "Example.A") [Ident "exp"]+++ specify "should parse foreign" $ do+ let r = parseMod $ Module ss [] mn mp [] [] M.empty [Ident "exp"] []+ r `shouldSatisfy` isSuccess+ case r of+ Error _ -> return ()+ Success m -> moduleForeign m `shouldBe` [Ident "exp"]++ context "Expr" $ do+ specify "should parse literals" $ do+ let m = Module ss [] mn mp [] [] M.empty []+ [ NonRec ann (Ident "x1") $ Literal ann (NumericLiteral (Left 1))+ , NonRec ann (Ident "x2") $ Literal ann (NumericLiteral (Right 1.0))+ , NonRec ann (Ident "x3") $ Literal ann (StringLiteral (mkString "abc"))+ , NonRec ann (Ident "x4") $ Literal ann (CharLiteral 'c')+ , NonRec ann (Ident "x5") $ Literal ann (BooleanLiteral True)+ , NonRec ann (Ident "x6") $ Literal ann (ArrayLiteral [Literal ann (CharLiteral 'a')])+ , NonRec ann (Ident "x7") $ Literal ann (ObjectLiteral [(mkString "a", Literal ann (CharLiteral 'a'))])+ ]+ parseMod m `shouldSatisfy` isSuccess++ specify "should parse Constructor" $ do+ let m = Module ss [] mn mp [] [] M.empty []+ [ NonRec ann (Ident "constructor") $ Constructor ann (ProperName "Either") (ProperName "Left") [Ident "value0"] ]+ parseMod m `shouldSatisfy` isSuccess++ specify "should parse Accessor" $ do+ let m = Module ss [] mn mp [] [] M.empty []+ [ NonRec ann (Ident "x") $+ Accessor ann (mkString "field") (Literal ann $ ObjectLiteral [(mkString "field", Literal ann (NumericLiteral (Left 1)))]) ]+ parseMod m `shouldSatisfy` isSuccess++ specify "should parse ObjectUpdate" $ do+ let m = Module ss [] mn mp [] [] M.empty []+ [ NonRec ann (Ident "objectUpdate") $+ ObjectUpdate ann+ (Literal ann $ ObjectLiteral [(mkString "field", Literal ann (StringLiteral (mkString "abc")))])+ (Just [mkString "unchangedField"])+ [(mkString "field", Literal ann (StringLiteral (mkString "xyz")))]+ ]+ parseMod m `shouldSatisfy` isSuccess++ specify "should parse Abs" $ do+ let m = Module ss [] mn mp [] [] M.empty []+ [ NonRec ann (Ident "abs")+ $ Abs ann (Ident "x") (Var ann (Qualified (ByModuleName mn) (Ident "x")))+ ]+ parseMod m `shouldSatisfy` isSuccess++ specify "should parse App" $ do+ let m = Module ss [] mn mp [] [] M.empty []+ [ NonRec ann (Ident "app")+ $ App ann+ (Abs ann (Ident "x") (Var ann (Qualified ByNullSourcePos (Ident "x"))))+ (Literal ann (CharLiteral 'c'))+ ]+ parseMod m `shouldSatisfy` isSuccess++ specify "should parse UnusedIdent in Abs" $ do+ let i = NonRec ann (Ident "f") (Abs ann UnusedIdent (Var ann (Qualified ByNullSourcePos (Ident "x"))))+ let r = parseMod $ Module ss [] mn mp [] [] M.empty [] [i]+ r `shouldSatisfy` isSuccess+ case r of+ Error _ -> pure ()+ Success Module{..} ->+ moduleDecls `shouldBe` [i]++ specify "should parse Case" $ do+ let m = Module ss [] mn mp [] [] M.empty []+ [ NonRec ann (Ident "case") $+ Case ann [Var ann (Qualified ByNullSourcePos (Ident "x"))]+ [ CaseAlternative+ [ NullBinder ann ]+ (Right (Literal ann (CharLiteral 'a')))+ ]+ ]+ parseMod m `shouldSatisfy` isSuccess++ specify "should parse Case with guards" $ do+ let m = Module ss [] mn mp [] [] M.empty []+ [ NonRec ann (Ident "case") $+ Case ann [Var ann (Qualified ByNullSourcePos (Ident "x"))]+ [ CaseAlternative+ [ NullBinder ann ]+ (Left [(Literal ann (BooleanLiteral True), Literal ann (CharLiteral 'a'))])+ ]+ ]+ parseMod m `shouldSatisfy` isSuccess++ specify "should parse Let" $ do+ let m = Module ss [] mn mp [] [] M.empty []+ [ NonRec ann (Ident "case") $+ Let ann+ [ Rec [((ann, Ident "a"), Var ann (Qualified ByNullSourcePos (Ident "x")))] ]+ (Literal ann (BooleanLiteral True))+ ]+ parseMod m `shouldSatisfy` isSuccess++ context "Meta" $ do+ specify "should parse IsConstructor" $ do+ let m = Module ss [] mn mp [] [] M.empty []+ [ NonRec (ss, [], Just (IsConstructor ProductType [Ident "x"])) (Ident "x") $+ Literal (ss, [], Just (IsConstructor SumType [])) (CharLiteral 'a')+ ]+ parseMod m `shouldSatisfy` isSuccess++ specify "should parse IsNewtype" $ do+ let m = Module ss [] mn mp [] [] M.empty []+ [ NonRec (ss, [], Just IsNewtype) (Ident "x") $+ Literal ann (CharLiteral 'a')+ ]+ parseMod m `shouldSatisfy` isSuccess++ specify "should parse IsTypeClassConstructor" $ do+ let m = Module ss [] mn mp [] [] M.empty []+ [ NonRec (ss, [], Just IsTypeClassConstructor) (Ident "x") $+ Literal ann (CharLiteral 'a')+ ]+ parseMod m `shouldSatisfy` isSuccess++ specify "should parse IsForeign" $ do+ let m = Module ss [] mn mp [] [] M.empty []+ [ NonRec (ss, [], Just IsForeign) (Ident "x") $+ Literal ann (CharLiteral 'a')+ ]+ parseMod m `shouldSatisfy` isSuccess++ context "Binders" $ do+ specify "should parse LiteralBinder" $ do+ let m = Module ss [] mn mp [] [] M.empty []+ [ NonRec ann (Ident "case") $+ Case ann [Var ann (Qualified ByNullSourcePos (Ident "x"))]+ [ CaseAlternative+ [ LiteralBinder ann (BooleanLiteral True) ]+ (Right (Literal ann (CharLiteral 'a')))+ ]+ ]+ parseMod m `shouldSatisfy` isSuccess++ specify "should parse VarBinder" $ do+ let m = Module ss [] mn mp [] [] M.empty []+ [ NonRec ann (Ident "case") $+ Case ann [Var ann (Qualified ByNullSourcePos (Ident "x"))]+ [ CaseAlternative+ [ ConstructorBinder+ ann+ (Qualified (ByModuleName (ModuleName "Data.Either")) (ProperName "Either"))+ (Qualified ByNullSourcePos (ProperName "Left"))+ [VarBinder ann (Ident "z")]+ ]+ (Right (Literal ann (CharLiteral 'a')))+ ]+ ]+ parseMod m `shouldSatisfy` isSuccess++ specify "should parse NamedBinder" $ do+ let m = Module ss [] mn mp [] [] M.empty []+ [ NonRec ann (Ident "case") $+ Case ann [Var ann (Qualified ByNullSourcePos (Ident "x"))]+ [ CaseAlternative+ [ NamedBinder ann (Ident "w") (NamedBinder ann (Ident "w'") (VarBinder ann (Ident "w''"))) ]+ (Right (Literal ann (CharLiteral 'a')))+ ]+ ]+ parseMod m `shouldSatisfy` isSuccess++ context "Comments" $ do+ specify "should parse LineComment" $ do+ let m = Module ss [ LineComment "line" ] mn mp [] [] M.empty [] []+ parseMod m `shouldSatisfy` isSuccess++ specify "should parse BlockComment" $ do+ let m = Module ss [ BlockComment "block" ] mn mp [] [] M.empty [] []+ parseMod m `shouldSatisfy` isSuccess
+ tests/TestCst.hs view
@@ -0,0 +1,222 @@+module TestCst where++import Prelude++import Control.Monad (when, forM_)+import Data.Maybe (fromMaybe)+import Data.Text (Text)+import Data.Text qualified as Text+import Data.Text.Encoding qualified as Text+import Data.Text.IO qualified as Text+import Test.Hspec (Spec, describe, it, runIO, specify)+import Test.QuickCheck (Arbitrary(..), Gen, Testable(..), arbitrarySizedNatural, arbitraryUnicodeChar, discard, elements, frequency, listOf, listOf1, oneof, resize)+import TestUtils (getTestFiles, goldenVsString)+import Text.Read (readMaybe)+import Language.PureScript.CST.Errors as CST+import Language.PureScript.CST.Lexer as CST+import Language.PureScript.CST.Print as CST+import Language.PureScript.CST.Types (SourceToken(..), Token(..))+import System.FilePath (takeBaseName, replaceExtension)++spec :: Spec+spec = do+ layoutSpec+ literalsSpec++layoutSpec :: Spec+layoutSpec = do+ pursFiles <- runIO $ concat <$> getTestFiles "layout"+ describe "Layout golden tests" $ do+ forM_ pursFiles $ \file ->+ it (takeBaseName file) $+ goldenVsString+ (replaceExtension file ".out")+ (Text.encodeUtf8 <$> runLexer file)+ where+ runLexer file = do+ src <- Text.readFile file+ case sequence $ CST.lex src of+ Left (_, err) ->+ pure $ Text.pack $ CST.prettyPrintError err+ Right toks -> do+ pure $ CST.printTokens toks++literalsSpec :: Spec+literalsSpec = describe "Literals" $ do+ testProperty "Integer" $+ checkTok checkReadNum (\case TokInt _ a -> Just a; _ -> Nothing) . unInt+ testProperty "Hex" $+ checkTok checkReadNum (\case TokInt _ a -> Just a; _ -> Nothing) . unHex+ testProperty "Number" $+ checkTok checkReadNum (\case TokNumber _ a -> Just a; _ -> Nothing) . unFloat+ testProperty "Exponent" $+ checkTok checkReadNum (\case TokNumber _ a -> Just a; _ -> Nothing) . unExponent++ testProperty "Integer (round trip)" $ roundTripTok . unInt+ testProperty "Hex (round trip)" $ roundTripTok . unHex+ testProperty "Number (round trip)" $ roundTripTok . unFloat+ testProperty "Exponent (round trip)" $ roundTripTok . unExponent+ testProperty "Char (round trip)" $ roundTripTok . unChar+ testProperty "String (round trip)" $ roundTripTok . unString+ testProperty "Raw String (round trip)" $ roundTripTok . unRawString++ where+ testProperty name test = specify name (property test)++readTok' :: String -> Text -> Gen SourceToken+readTok' failMsg t = case CST.lex t of+ Right tok : _ ->+ pure tok+ Left (_, err) : _ ->+ error $ failMsg <> ": " <> CST.prettyPrintError err+ [] ->+ error "Empty token stream"++readTok :: Text -> Gen SourceToken+readTok = readTok' "Failed to parse"++checkTok+ :: (Text -> a -> Gen Bool)+ -> (Token -> Maybe a)+ -> Text+ -> Gen Bool+checkTok p f t = do+ SourceToken _ tok <- readTok t+ case f tok of+ Just a -> p t a+ Nothing -> error $ "Failed to lex correctly: " <> show tok++roundTripTok :: Text -> Gen Bool+roundTripTok t = do+ tok <- readTok t+ let t' = CST.printTokens [tok]+ tok' <- readTok' "Failed to re-parse" t'+ pure $ tok == tok'++checkReadNum :: (Eq a, Read a) => Text -> a -> Gen Bool+checkReadNum t a = do+ let+ chs = case Text.unpack $ Text.replace ".e" ".0e" $ Text.replace "_" "" t of+ chs' | last chs' == '.' -> chs' <> "0"+ chs' -> chs'+ case (== a) <$> readMaybe chs of+ Just a' -> pure a'+ Nothing -> error "Failed to `read`"++newtype PSSourceInt = PSSourceInt { unInt :: Text }+ deriving (Show, Eq)++instance Arbitrary PSSourceInt where+ arbitrary = resize 16 genInt++newtype PSSourceFloat = PSSourceFloat { unFloat :: Text }+ deriving (Show, Eq)++instance Arbitrary PSSourceFloat where+ arbitrary = resize 16 genFloat++newtype PSSourceExponent = PSSourceExponent { unExponent :: Text }+ deriving (Show, Eq)++instance Arbitrary PSSourceExponent where+ arbitrary = PSSourceExponent <$> do+ floatPart <- unFloat <$> resize 5 genFloat+ signPart <- fromMaybe "" <$> elements [ Just "+", Just "-", Nothing ]+ expPart <- unInt <$> resize 1 genInt+ pure $ floatPart <> "e" <> signPart <> expPart++newtype PSSourceHex = PSSourceHex { unHex :: Text }+ deriving (Show, Eq)++instance Arbitrary PSSourceHex where+ arbitrary = resize 16 genHex++newtype PSSourceChar = PSSourceChar { unChar :: Text }+ deriving (Show, Eq)++instance Arbitrary PSSourceChar where+ arbitrary = genChar++newtype PSSourceString = PSSourceString { unString :: Text }+ deriving (Show, Eq)++instance Arbitrary PSSourceString where+ arbitrary = resize 256 genString++newtype PSSourceRawString = PSSourceRawString { unRawString :: Text }+ deriving (Show, Eq)++instance Arbitrary PSSourceRawString where+ arbitrary = resize 256 genRawString++genInt :: Gen PSSourceInt+genInt = PSSourceInt . Text.pack <$> do+ (:) <$> nonZeroChar+ <*> listOf numChar++genFloat :: Gen PSSourceFloat+genFloat = PSSourceFloat <$> do+ intPart <- unInt <$> genInt+ floatPart <- Text.pack <$> listOf1 numChar+ pure $ intPart <> "." <> floatPart++genHex :: Gen PSSourceHex+genHex = PSSourceHex <$> do+ nums <- listOf1 hexDigit+ pure $ "0x" <> Text.pack nums++genChar :: Gen PSSourceChar+genChar = PSSourceChar <$> do+ ch <- resize 0xFFFF arbitrarySizedNatural >>= (genStringChar '\'' . toEnum)+ pure $ "'" <> ch <> "'"++genString :: Gen PSSourceString+genString = PSSourceString <$> do+ chs <- listOf $ arbitraryUnicodeChar >>= genStringChar '"'+ pure $ "\"" <> Text.concat chs <> "\""++genStringChar :: Char -> Char -> Gen Text+genStringChar delimiter ch = frequency+ [ (1, genCharEscape)+ , (10, if ch `elem` [delimiter, '\n', '\r', '\\']+ then discard+ else pure $ Text.singleton ch+ )+ ]++genRawString :: Gen PSSourceRawString+genRawString = PSSourceRawString <$> do+ chs <- listOf arbitraryUnicodeChar+ let+ k1 acc qs cs = do+ let (cs', q) = span (/= '"') cs+ k2 (acc <> cs') qs q+ k2 acc qs [] = acc <> qs+ k2 acc qs cs = do+ let (q, cs') = span (== '"') cs+ k1 (acc <> take 2 q) (qs <> drop 2 q) cs'+ chs' = k1 [] [] chs+ when (all (== '"') chs') discard+ pure $ "\"\"\"" <> Text.pack chs' <> "\"\"\""++genCharEscape :: Gen Text+genCharEscape = oneof+ [ pure "\\t"+ , pure "\\r"+ , pure "\\n"+ , pure "\\\""+ , pure "\\'"+ , pure "\\\\"+ , do+ chs <- resize 4 $ listOf1 hexDigit+ pure $ "\\x" <> Text.pack chs+ ]++numChar :: Gen Char+numChar = elements "0123456789_"++nonZeroChar :: Gen Char+nonZeroChar = elements "123456789"++hexDigit :: Gen Char+hexDigit = elements $ ['a'..'f'] <> ['A'..'F'] <> ['0'..'9']
+ tests/TestDocs.hs view
@@ -0,0 +1,989 @@+module TestDocs where++import Prelude++import Data.Bifunctor (first)+import Data.List (findIndex)+import Data.Foldable (find, forM_)+import Safe (headMay)+import Data.Map qualified as Map+import Data.Maybe (fromMaybe, isNothing, mapMaybe)+import Data.Monoid (Any(..), First(..))+import Data.Text (Text)+import Data.Text qualified as T+import Text.PrettyPrint.Boxes qualified as Boxes++import Language.PureScript qualified as P+import Language.PureScript.Docs qualified as Docs+import Language.PureScript.Docs.AsMarkdown (codeToString)+import Language.PureScript.Publish.ErrorsWarnings qualified as Publish++import Web.Bower.PackageMeta (parsePackageName, runPackageName)++import TestPscPublish (preparePackage)++import Test.Hspec (Spec, beforeAll, context, expectationFailure, it)++spec :: Spec+spec = beforeAll (handleDocPrepFailure <$> preparePackage "tests/purs/docs" "purs.json" "resolutions.json") $+ context "Language.PureScript.Docs" $ do+ context "Doc generation tests:" $+ mkSpec testCases displayAssertion $ \a pkg mdl ->+ case runAssertion a (Docs.getLinksContext pkg) mdl of+ Pass ->+ pure ()+ Fail reason ->+ expectationFailure (T.unpack (displayAssertionFailure reason))++ context "Tag generation tests:" $+ mkSpec testTagsCases displayTagsAssertion $ \a _ mdl ->+ case runTagsAssertion a (Map.fromList $ Docs.tags mdl) of+ TagsPass ->+ pure ()+ TagsFail reason ->+ expectationFailure (T.unpack (displayTagsAssertionFailure reason))+ where+ handleDocPrepFailure = first (expectationFailure . ("failed to produce docs: " <>) . Boxes.render . Publish.renderError)++ mkSpec cases displayAssertion' runner =+ forM_ cases $ \(mnString, assertions) -> do+ let mn = P.moduleNameFromString mnString+ context ("in module " ++ T.unpack mnString) $+ forM_ assertions $ \a ->+ it (T.unpack (displayAssertion' a)) . either id $ \pkg@Docs.Package{..} ->+ case find ((==) mn . Docs.modName) pkgModules of+ Nothing ->+ expectationFailure ("module not found in docs: " ++ T.unpack mnString)+ Just mdl ->+ runner a pkg mdl++data DocsAssertion+ -- | Assert that a particular declaration is documented with the given+ -- children+ = ShouldBeDocumented P.ModuleName Text [Text]+ -- | Assert that a particular declaration is not documented+ | ShouldNotBeDocumented P.ModuleName Text+ -- | Assert that a particular declaration exists, but without a particular+ -- child.+ | ChildShouldNotBeDocumented P.ModuleName Text Text+ -- | Assert that a particular declaration has a particular type class+ -- constraint.+ | ShouldBeConstrained P.ModuleName Text Text+ -- | Assert that a particular typeclass declaration has a functional+ -- dependency list.+ | ShouldHaveFunDeps P.ModuleName Text [([Text],[Text])]+ -- | Assert that a particular value declaration exists, and its type+ -- satisfies the given predicate.+ | ValueShouldHaveTypeSignature P.ModuleName Text (Docs.Type' -> Bool)+ -- | Assert that a particular instance declaration exists under some class or+ -- type declaration, and that its type satisfies the given predicate.+ | InstanceShouldHaveTypeSignature P.ModuleName Text Text (Docs.Type' -> Bool)+ -- | Assert that a particular type alias exists, and its corresponding+ -- type, when rendered, matches a given string exactly+ -- fields: module, type synonym name, expected type+ | TypeSynonymShouldRenderAs P.ModuleName Text Text+ -- | Assert that a documented declaration includes a documentation comment+ -- containing a particular string+ | ShouldHaveDocComment P.ModuleName Text Text+ -- | Assert that a documented data declaration includes a documentation comment+ -- | containing a particular string+ | ShouldHaveDataConstructorDocComment P.ModuleName Text Text Text+ -- | Assert that a documented data declaration has no documentation comment+ | ShouldHaveNoDataConstructorDocComment P.ModuleName Text Text+ -- | Assert that a documented class method includes a documentation comment+ -- | containing a particular string+ | ShouldHaveClassMethodDocComment P.ModuleName Text Text Text+ -- | Assert that a class method has no documentation comment+ | ShouldNotHaveClassMethodDocComment P.ModuleName Text Text+ -- | Assert that there should be some declarations re-exported from a+ -- particular module in a particular package.+ | ShouldHaveReExport (Docs.InPackage P.ModuleName)+ -- | Assert that a link to some specific declaration exists within the+ -- rendered code for a declaration. Fields are: local module, local+ -- declaration title, title of linked declaration, namespace of linked+ -- declaration, destination of link.+ | ShouldHaveLink P.ModuleName Text Text Docs.Namespace Docs.LinkLocation+ -- | Assert that a given declaration comes before another in the output+ | ShouldComeBefore P.ModuleName Text Text+ -- | Assert that a given declaration has the given kind signature+ | ShouldHaveKindSignature P.ModuleName Text Text+ -- | Assert that a given declaration does not have a kind signature+ | ShouldNotHaveKindSignature P.ModuleName Text+ -- | Assert that a given declaration with doc-comments on its+ -- kind signature, type declaration, and role declaration are properly+ -- merged into one doc-comment.+ | ShouldMergeDocComments P.ModuleName Text (Maybe Text)+ -- | Assert that a given declaration's type parameters have the+ -- given role annotations+ | ShouldHaveRoleAnnotation P.ModuleName Text [P.Role]+ -- | Assert that a given module has the expected doc comments+ | ShouldHaveModuleDocs P.ModuleName (Maybe Text)++data TagsAssertion+ -- | Assert that a particular declaration is tagged+ = ShouldBeTagged Text Int+ -- | Assert that a particular declaration is not tagged+ | ShouldNotBeTagged Text++displayAssertion :: DocsAssertion -> Text+displayAssertion = \case+ ShouldBeDocumented mn decl children ->+ showQual mn decl <> " should be documented" <>+ (if not (null children)+ then " with children: " <> T.pack (show children)+ else "")+ ShouldNotBeDocumented mn decl ->+ showQual mn decl <> " should not be documented"+ ChildShouldNotBeDocumented mn decl child ->+ showQual mn decl <> " should not have " <> child <> " as a child declaration"+ ShouldBeConstrained mn decl constraint ->+ showQual mn decl <> " should have a " <> constraint <> " constraint"+ ShouldHaveFunDeps mn decl fundeps ->+ showQual mn decl <> " should have fundeps: " <> T.pack (show fundeps)+ ValueShouldHaveTypeSignature mn decl _ ->+ "the type signature for " <> showQual mn decl <>+ " should satisfy the given predicate"+ InstanceShouldHaveTypeSignature _ parent instName _ ->+ "the instance " <> instName <> " (under " <> parent <> ") should have" <>+ " a type signature satisfying the given predicate"+ TypeSynonymShouldRenderAs mn synName code ->+ "the RHS of the type synonym " <> showQual mn synName <>+ " should be rendered as " <> code+ ShouldHaveDocComment mn decl excerpt ->+ "the string " <> T.pack (show excerpt) <> " should appear in the" <>+ " doc-comments for " <> showQual mn decl+ ShouldHaveDataConstructorDocComment mn decl constr excerpt ->+ "the string " <> T.pack (show excerpt) <> " should appear in the" <>+ " doc-comments for data constructor " <> T.pack (show constr) <> " for " <> showQual mn decl+ ShouldHaveNoDataConstructorDocComment mn decl constr ->+ "Doc-comments for data constructor " <> T.pack (show constr) <> " for " <> showQual mn decl <>+ " should be empty"+ ShouldHaveClassMethodDocComment mn decl method excerpt ->+ "the string " <> T.pack (show excerpt) <> " should appear in the" <>+ " doc-comment for class method " <> T.pack (show method) <> " for " <> showQual mn decl+ ShouldNotHaveClassMethodDocComment mn decl method ->+ "Doc-comments for class method " <> T.pack (show method) <> " for " <> showQual mn decl <>+ " should be empty"+ ShouldHaveReExport inPkg ->+ "there should be some re-exports from " <>+ showInPkg P.runModuleName inPkg+ ShouldHaveLink mn decl targetTitle targetNs _ ->+ "the rendered code for " <> showQual mn decl <> " should contain a link" <>+ " to " <> targetTitle <> " (" <> T.pack (show targetNs) <> ")"+ ShouldComeBefore mn declA declB ->+ showQual mn declA <> " should come before " <> showQual mn declB <>+ " in the docs"+ ShouldHaveKindSignature mn decl expected ->+ showQual mn decl <> " should have the kind signature `" <> expected <> "`"+ ShouldNotHaveKindSignature mn decl ->+ showQual mn decl <> " should not have a kind signature."+ ShouldMergeDocComments mn decl _ ->+ showQual mn decl <> " should merge the doc-comments of its kind " <>+ "declaration (if any), type declaration, and role declaration (if any) " <>+ "into one doc-comment."+ ShouldHaveRoleAnnotation mn decl expected ->+ showQual mn decl <> " should have the expected role annotations: " <>+ T.intercalate ", " (fmap P.displayRole expected)+ ShouldHaveModuleDocs mn expected ->+ "Module doc comments for module `" <> P.runModuleName mn <> "` should be " <>+ maybe "empty" (\t -> "'" <> t <> "`") expected++displayTagsAssertion :: TagsAssertion -> Text+displayTagsAssertion = \case+ ShouldBeTagged decl l ->+ decl <> " should be tagged at line " <> T.pack (show l)+ ShouldNotBeTagged decl ->+ decl <> " should not be tagged"++data DocsAssertionFailure+ -- | A declaration was not documented, but should have been+ = NotDocumented P.ModuleName Text+ -- | The expected list of child declarations did not match the actual list+ | ChildrenNotDocumented P.ModuleName Text [Text]+ -- | A declaration was documented, but should not have been+ | Documented P.ModuleName Text+ -- | A child declaration was documented, but should not have been+ | ChildDocumented P.ModuleName Text Text+ -- | A constraint was missing.+ | ConstraintMissing P.ModuleName Text Text+ -- | A functional dependency was missing.+ | FunDepMissing P.ModuleName Text [([Text], [Text])]+ -- | A declaration had the wrong "type" (ie, value, type, type class)+ -- Fields: declaration title, expected "type", actual "type".+ | WrongDeclarationType P.ModuleName Text Text Text+ -- | A declaration had the wrong type (in the sense of "type checking"), eg,+ -- because the inferred type was used when the explicit type should have+ -- been.+ -- Fields: module name, declaration name, actual type.+ | DeclarationWrongType P.ModuleName Text Docs.Type'+ -- | A Type synonym has been rendered in an unexpected format+ -- Fields: module name, declaration name, expected rendering, actual rendering+ | TypeSynonymMismatch P.ModuleName Text Text Text+ -- | A doc comment was not found or did not match what was expected+ -- Fields: module name, declaration, actual comments+ | DocCommentMissing P.ModuleName Text (Maybe Text)+ -- | A doc comment was found where none was expected+ -- Fields: module name, declaration, actual comments+ | DocCommentPresent P.ModuleName Text (Maybe Text)+ -- | A module was missing re-exports from a particular module.+ -- Fields: module name, expected re-export, actual re-exports.+ | ReExportMissing P.ModuleName (Docs.InPackage P.ModuleName) [Docs.InPackage P.ModuleName]+ -- | Expected to find some other declaration mentioned in this declaration's+ -- rendered code, but did not find anything.+ -- Fields: module name, declaration title, title of declaration which was+ -- expected but not found in.+ | LinkedDeclarationMissing P.ModuleName Text Text+ -- | Expected one link location for a declaration mentioned in some other+ -- declaration's rendered code, but found a different one. Fields: module+ -- name, title of the local declaration which links to some other+ -- declaration, title of the linked declaration, expected location, actual+ -- location.+ | BadLinkLocation P.ModuleName Text Text Docs.LinkLocation Docs.LinkLocation+ -- | Declarations were in the wrong order+ | WrongOrder P.ModuleName Text Text+ -- | Expected a kind signature for a declaration, but did not find one+ -- Fields: module name, declaration title.+ | KindSignatureMissing P.ModuleName Text+ -- | The rendered kind signature did not match the expected one.+ -- Fields: module name, declaration title, expected kind signature (text),+ -- actual kind signature (text), actual kind signature (structure)+ | KindSignatureMismatch P.ModuleName Text Text Text (P.Type ())+ -- | A kind signature was found where none was expected.+ -- Fields: module name, declaration title, actual kind signature (text),+ -- actual kind signature (structure)+ | KindSignaturePresent P.ModuleName Text Text (P.Type ())+ -- | The doc comments for the kind signature (if any), type declaration, and+ -- role declaration (if any) were not properly merged into the expected one.+ -- Fields: module name, declaration title, expected doc-comments,+ -- actual doc-comments+ | DocCommentMergeFailure P.ModuleName Text Text Text+ -- | The given declaration cannot have role annotations.+ -- Fields: module name, declaration title+ | CannotHaveRoles P.ModuleName Text+ -- | The list of expected roles did not match the list of actual roles+ -- fields: module name, declaration title, expected role list,+ -- actual role list+ | RoleMismatch P.ModuleName Text [P.Role] [P.Role]+ -- | The module's doc comments should be the expected+ -- fields: module name, expected docs, actual docs+ | WrongModuleDocs P.ModuleName (Maybe Text) (Maybe Text)++data TagsAssertionFailure+ -- | A declaration was not tagged, but should have been+ = NotTagged Text+ -- | A declaration was tagged, but should not have been+ | Tagged Text Int+ -- | A declaration was tagged on the wrong line+ | TaggedWrongLine Text Int Int++displayAssertionFailure :: DocsAssertionFailure -> Text+displayAssertionFailure = \case+ NotDocumented _ decl ->+ decl <> " was not documented, but should have been"+ ChildrenNotDocumented _ decl children ->+ decl <> " had the wrong children; got " <> T.pack (show children)+ Documented _ decl ->+ decl <> " was documented, but should not have been"+ ChildDocumented _ decl child ->+ decl <> " had " <> child <> " as a child"+ ConstraintMissing _ decl constraint ->+ decl <> " did not have a " <> constraint <> " constraint"+ FunDepMissing _ decl fundeps ->+ decl <> " had the wrong fundeps; got " <> T.pack (show fundeps)+ WrongDeclarationType _ decl expected actual ->+ "expected " <> decl <> " to be a " <> expected <> " declaration, but it" <>+ " was a " <> actual <> " declaration"+ DeclarationWrongType _ decl actual ->+ decl <> " had the wrong type; got " <> T.pack (P.prettyPrintType maxBound actual)+ TypeSynonymMismatch _ decl expected actual ->+ "expected the RHS of " <> decl <> " to be " <> expected <>+ "; got " <> actual+ DocCommentMissing _ decl actual ->+ "the doc-comment for " <> decl <> " did not contain the expected substring;" <>+ " got " <> T.pack (show actual)+ DocCommentPresent _ decl actual ->+ "the doc-comment for " <> decl <> " was not empty. Got " <> T.pack (show actual)+ ReExportMissing _ expected actuals ->+ "expected to see some re-exports from " <>+ showInPkg P.runModuleName expected <>+ "; instead only saw re-exports from " <>+ T.pack (show (map (showInPkg P.runModuleName) actuals))+ LinkedDeclarationMissing _ decl target ->+ "expected to find a link to " <> target <> " within the rendered code" <>+ " for " <> decl <> ", but no such link was found"+ BadLinkLocation _ decl target expected actual ->+ "in rendered code for " <> decl <> ", bad link location for " <> target <>+ ": expected " <> T.pack (show expected) <>+ " got " <> T.pack (show actual)+ WrongOrder _ before' after' ->+ "expected to see " <> before' <> " before " <> after'+ KindSignatureMissing _ decl ->+ "the kind signature for " <> decl <> " is missing."+ KindSignatureMismatch _ decl expected actualTxt actualKind ->+ "expected the kind signature for " <> decl <> "\n" <>+ "to be `" <> expected <> "`\n" <>+ " got `" <> actualTxt <> "`\n" <>+ "Structure of kind: " <> T.pack (show actualKind)+ KindSignaturePresent _ decl actualTxt actualKind ->+ "the kind signature for " <> decl <> " was not empty.\n" <>+ "got `" <> actualTxt <> "`\n" <>+ "Structure of kind: " <> T.pack (show actualKind)+ DocCommentMergeFailure _ decl expected actual ->+ "Expected the doc-comment for " <> decl <> " to merge comments and be `" <>+ expected <> "`; got `" <> actual <> "`"+ CannotHaveRoles _ decl ->+ decl <> " is a type of declaration that cannot have roles."+ RoleMismatch _ decl expected actual ->+ "Expected the role annotations for " <> decl <> " to be \n" <>+ "`" <> displayRoleList expected <> "`, but got\n" <>+ "`" <> displayRoleList actual <> "`"+ where+ displayRoleList = T.intercalate ", " . fmap P.displayRole+ WrongModuleDocs mn expected actual ->+ "Expected module docs for " <> P.runModuleName mn <> "\n" <>+ "to be `" <> fromMaybe "<Nothing>" expected <> "`\n" <>+ " got `" <> fromMaybe "<Nothing>" actual <> "`"++displayTagsAssertionFailure :: TagsAssertionFailure -> Text+displayTagsAssertionFailure = \case+ NotTagged decl ->+ decl <> " was not tagged, but should have been"+ Tagged decl line ->+ decl <> " was tagged at line " <> T.pack (show line) <>+ ", but should not have been"+ TaggedWrongLine decl taggedLine desiredLine ->+ decl <> " was tagged at line " <> T.pack (show taggedLine) <>+ ", but should have been tagged at line " <> T.pack (show desiredLine)++data DocsAssertionResult+ = Pass+ | Fail DocsAssertionFailure++data TagsAssertionResult+ = TagsPass+ | TagsFail TagsAssertionFailure++runAssertion :: DocsAssertion -> Docs.LinksContext -> Docs.Module -> DocsAssertionResult+runAssertion assertion linksCtx Docs.Module{..} =+ case assertion of+ ShouldBeDocumented mn decl children ->+ case findChildren decl (declarationsFor mn) of+ Nothing ->+ Fail (NotDocumented mn decl)+ Just actualChildren ->+ if children == actualChildren+ then Pass+ else Fail (ChildrenNotDocumented mn decl actualChildren)++ ShouldNotBeDocumented mn decl ->+ case findChildren decl (declarationsFor mn) of+ Just _ ->+ Fail (Documented mn decl)+ Nothing ->+ Pass++ ChildShouldNotBeDocumented mn decl child ->+ case findChildren decl (declarationsFor mn) of+ Just children ->+ if child `elem` children+ then Fail (ChildDocumented mn decl child)+ else Pass+ Nothing ->+ Fail (NotDocumented mn decl)++ ShouldBeConstrained mn decl tyClass ->+ findDecl mn decl $ \Docs.Declaration{..} ->+ case declInfo of+ Docs.ValueDeclaration ty ->+ if checkConstrained ty tyClass+ then Pass+ else Fail (ConstraintMissing mn decl tyClass)+ _ ->+ Fail (WrongDeclarationType mn decl "value"+ (Docs.declInfoToString declInfo))++ ShouldHaveFunDeps mn decl fds ->+ findDecl mn decl $ \Docs.Declaration{..} ->+ case declInfo of+ Docs.TypeClassDeclaration _ _ fundeps ->+ if fundeps == fds+ then Pass+ else Fail (FunDepMissing mn decl fds)+ _ ->+ Fail (WrongDeclarationType mn decl "value"+ (Docs.declInfoToString declInfo))++ ValueShouldHaveTypeSignature mn decl tyPredicate ->+ findDecl mn decl $ \Docs.Declaration{..} ->+ case declInfo of+ Docs.ValueDeclaration ty ->+ if tyPredicate ty+ then Pass+ else Fail (DeclarationWrongType mn decl ty)+ _ ->+ Fail (WrongDeclarationType mn decl "value"+ (Docs.declInfoToString declInfo))++ InstanceShouldHaveTypeSignature mn parent decl tyPredicate ->+ case find ((==) parent . Docs.declTitle) (declarationsFor mn) >>= findTarget of+ Just ty ->+ if tyPredicate ty+ then Pass+ else Fail (DeclarationWrongType mn decl ty)+ Nothing ->+ Fail (NotDocumented mn decl)++ where+ findTarget =+ headMay .+ mapMaybe (extractInstanceType . Docs.cdeclInfo) .+ filter (\cdecl -> Docs.cdeclTitle cdecl == decl) .+ Docs.declChildren++ extractInstanceType = \case+ (Docs.ChildInstance _ ty) ->+ Just ty+ _ ->+ Nothing++ TypeSynonymShouldRenderAs mn decl expected ->+ findDecl mn decl $ \Docs.Declaration{..} ->+ case declInfo of+ Docs.TypeSynonymDeclaration [] ty ->+ let actual = codeToString (Docs.renderType ty) in+ if actual == expected+ then Pass+ else Fail (TypeSynonymMismatch mn decl expected actual)+ _ ->+ Fail (WrongDeclarationType mn decl "synonym"+ (Docs.declInfoToString declInfo))++ ShouldHaveDocComment mn decl expected ->+ findDecl mn decl $ \Docs.Declaration{..} ->+ if maybe False (expected `T.isInfixOf`) declComments+ then Pass+ else Fail (DocCommentMissing mn decl declComments)++ ShouldHaveDataConstructorDocComment mn decl constr expected ->+ findDeclChildrenComment mn decl constr expected++ ShouldHaveNoDataConstructorDocComment mn decl constr ->+ findDeclChildrenNoComment mn decl constr++ ShouldHaveClassMethodDocComment mn decl constr expected ->+ findDeclChildrenComment mn decl constr expected++ ShouldNotHaveClassMethodDocComment mn decl method ->+ findDeclChildrenNoComment mn decl method++ ShouldHaveReExport reExp ->+ let+ reExps = map fst modReExports+ in+ if reExp `elem` reExps+ then Pass+ else Fail (ReExportMissing modName reExp reExps)++ ShouldHaveLink mn decl destTitle destNs expectedLoc ->+ findDecl mn decl $ \decl' ->+ let+ rendered = Docs.renderDeclaration decl'+ in+ case extract rendered destNs destTitle of+ Just (Docs.linkLocation -> actualLoc) ->+ if expectedLoc == actualLoc+ then Pass+ else Fail (BadLinkLocation mn decl destTitle expectedLoc actualLoc)+ Nothing ->+ Fail (LinkedDeclarationMissing mn decl destTitle)++ ShouldComeBefore mn before' after' ->+ let+ decls = declarationsFor mn++ indexOf :: Text -> Maybe Int+ indexOf title = findIndex ((==) title . Docs.declTitle) decls+ in+ case (indexOf before', indexOf after') of+ (Just i, Just j) ->+ if i < j+ then Pass+ else Fail (WrongOrder mn before' after')+ (Nothing, _) ->+ Fail (NotDocumented mn before')+ (_, Nothing) ->+ Fail (NotDocumented mn after')++ ShouldHaveKindSignature mn decl expected ->+ findDeclKinds mn decl $ \case+ Just Docs.KindInfo{..} ->+ if expected /= actual+ then Fail (KindSignatureMismatch mn decl expected actual kiKind)+ else Pass+ where+ actual = codeToString $ Docs.renderKindSig decl $+ Docs.KindInfo kiKeyword kiKind+ Nothing -> Fail (KindSignatureMissing mn decl)++ ShouldNotHaveKindSignature mn decl ->+ findDeclKinds mn decl $ \case+ Just Docs.KindInfo{..} ->+ Fail (KindSignaturePresent mn decl actual kiKind)+ where+ actual = codeToString $ Docs.renderKindSig decl $+ Docs.KindInfo kiKeyword kiKind+ Nothing -> Pass++ ShouldMergeDocComments mn decl expected ->+ findDecl mn decl $ \Docs.Declaration{..} ->+ if expected == declComments+ then Pass+ else Fail (DocCommentMergeFailure mn decl (display expected) (display declComments))+ where+ display = fromMaybe ""++ ShouldHaveRoleAnnotation mn decl expected ->+ findDeclRoles mn decl $ \actual ->+ if expected == actual+ then Pass+ else Fail (RoleMismatch mn decl expected actual)++ ShouldHaveModuleDocs mn expected ->+ if expected == modComments then+ Pass+ else+ Fail (WrongModuleDocs mn expected modComments)+ where+ declarationsFor mn =+ if mn == modName+ then modDeclarations+ else fromMaybe [] (lookup mn (map (first Docs.ignorePackage) modReExports))++ findChildren title =+ fmap childrenTitles . find ((==) title . Docs.declTitle)++ findDecl mn title f =+ case find ((==) title . Docs.declTitle) (declarationsFor mn) of+ Nothing ->+ Fail (NotDocumented mn title)+ Just decl ->+ f decl++ findDeclKinds mn title f =+ case find ((==) title . Docs.declTitle) (declarationsFor mn) of+ Nothing ->+ Fail (NotDocumented mn title)+ Just Docs.Declaration{..} ->+ f declKind++ findDeclRoles mn title f =+ case find ((==) title . Docs.declTitle) (declarationsFor mn) of+ Nothing ->+ Fail (NotDocumented mn title)+ Just Docs.Declaration{..} ->+ case getRoles declInfo of+ Nothing ->+ Fail (CannotHaveRoles mn title)+ Just roles ->+ f roles++ findDeclChildren mn title child f =+ findDecl mn title $ \Docs.Declaration{..} ->+ case find ((==) child . Docs.cdeclTitle) declChildren of+ Nothing ->+ Fail (NotDocumented mn child)+ Just decl ->+ f decl++ findDeclChildrenComment mn decl constr expected =+ findDeclChildren mn decl constr $ \Docs.ChildDeclaration{..} ->+ if maybe False (expected `T.isInfixOf`) cdeclComments+ then Pass+ else Fail (DocCommentMissing mn constr cdeclComments)++ findDeclChildrenNoComment mn decl constr =+ findDeclChildren mn decl constr $ \Docs.ChildDeclaration{..} ->+ if isNothing cdeclComments+ then Pass+ else Fail (DocCommentPresent mn constr cdeclComments)++ childrenTitles = map Docs.cdeclTitle . Docs.declChildren++ getRoles :: Docs.DeclarationInfo -> Maybe [P.Role]+ getRoles = \case+ Docs.DataDeclaration _ _ roles -> Just roles+ _ -> Nothing++ extract :: Docs.RenderedCode -> Docs.Namespace -> Text -> Maybe Docs.DocLink+ extract rc ns title = getFirst (Docs.outputWith (First . go) rc) >>= getLink+ where+ getLink =+ Docs.getLink linksCtx (P.moduleNameFromString "$DocsTest") ns title+ go = \case+ Docs.Symbol ns' title' (Docs.Link containingMod)+ | ns' == ns && title' == title -> Just containingMod+ _ ->+ Nothing++runTagsAssertion :: TagsAssertion -> Map.Map String Int -> TagsAssertionResult+runTagsAssertion assertion tags =+ case assertion of+ ShouldBeTagged decl line ->+ case Map.lookup (T.unpack decl) tags of+ Just taggedLine ->+ if taggedLine == line+ then TagsPass+ else TagsFail $ TaggedWrongLine decl taggedLine line+ Nothing -> TagsFail $ NotTagged decl++ ShouldNotBeTagged decl ->+ case Map.lookup (T.unpack decl) tags of+ Just taggedLine -> TagsFail $ Tagged decl taggedLine+ Nothing -> TagsPass++checkConstrained :: P.Type a -> Text -> Bool+checkConstrained ty tyClass =+ case ty of+ P.ConstrainedType _ c ty'+ | matches tyClass c -> True+ | otherwise -> checkConstrained ty' tyClass+ P.ForAll _ _ _ _ ty' _ ->+ checkConstrained ty' tyClass+ _ ->+ False+ where+ matches className =+ (==) className . P.runProperName . P.disqualify . P.constraintClass++testCases :: [(Text, [DocsAssertion])]+testCases =+ [ ("Example",+ [ -- From dependencies+ ShouldBeDocumented (n "Prelude") "Unit" []+ , ShouldNotBeDocumented (n "Prelude") "unit"++ -- From local files+ , ShouldBeDocumented (n "Example2") "one" []+ , ShouldNotBeDocumented (n "Example2") "two"++ -- Re-exports+ , ShouldHaveReExport (Docs.FromDep (pkg "purescript-prelude") (n "Prelude"))+ , ShouldHaveReExport (Docs.Local (n "Example2"))+ ])++ , ("Example2",+ [ ShouldBeDocumented (n "Example2") "one" []+ , ShouldBeDocumented (n "Example2") "two" []++ , ShouldHaveLink (n "Example2") "one" "Int" Docs.TypeLevel (Docs.BuiltinModule (n "Prim"))+ ])++ , ("UTF8",+ [ ShouldBeDocumented (n "UTF8") "thing" []+ ])++ , ("Transitive1",+ [ ShouldBeDocumented (n "Transitive2") "transitive3" []+ ])++ , ("NotAllCtors",+ [ ShouldBeDocumented (n "Prelude") "Boolean2" ["True"]+ , ChildShouldNotBeDocumented (n "Prelude") "Boolean2" "False"+ ])++ , ("DuplicateNames",+ [ ShouldBeDocumented (n "Prelude") "Unit" []+ , ShouldBeDocumented (n "DuplicateNames") "unit" []+ , ShouldNotBeDocumented (n "Prelude") "unit"+ ])++ , ("MultiVirtual",+ [ ShouldBeDocumented (n "MultiVirtual1") "foo" []+ , ShouldBeDocumented (n "MultiVirtual2") "bar" []+ , ShouldBeDocumented (n "MultiVirtual2") "baz" []+ ])++ , ("Clash",+ [ ShouldBeDocumented (n "Clash1") "value" []+ , ShouldBeDocumented (n "Clash1") "Type'" []+ , ShouldBeDocumented (n "Clash1") "TypeClass" ["typeClassMember"]+ ])++ , ("SolitaryTypeClassMember",+ [ ShouldBeDocumented (n "SomeTypeClass") "member" []+ , ShouldNotBeDocumented (n "SomeTypeClass") "SomeClass"+ , ShouldBeConstrained (n "SomeTypeClass") "member" "SomeClass"+ ])++ , ("ReExportedTypeClass",+ [ ShouldBeDocumented (n "SomeTypeClass") "SomeClass" ["member"]+ ])++ , ("TypeClassWithoutMembers",+ [ ShouldBeDocumented (n "TypeClassWithoutMembersIntermediate") "SomeClass" []+ , ChildShouldNotBeDocumented (n "TypeClassWithoutMembersIntermediate") "SomeClass" "member"+ ])++ , ("TypeClassWithFunDeps",+ [ ShouldHaveFunDeps (n "TypeClassWithFunDeps") "TypeClassWithFunDeps" [(["a","b"], ["c"]), (["c"], ["d","e"])]+ ])++ , ("NewOperators",+ [ ShouldBeDocumented (n "NewOperators2") "(>>>)" []+ ])++ , ("ExplicitTypeSignatures",+ [ ValueShouldHaveTypeSignature (n "ExplicitTypeSignatures") "explicit" (hasTypeVar "something")+ , ValueShouldHaveTypeSignature (n "ExplicitTypeSignatures") "anInt" (P.tyInt `P.eqType`)+ , ValueShouldHaveTypeSignature (n "ExplicitTypeSignatures") "aNumber" (P.tyNumber `P.eqType`)+ ])++ , ("ConstrainedArgument",+ [ TypeSynonymShouldRenderAs (n "ConstrainedArgument") "WithoutArgs" "forall a. (Partial => a) -> a"+ , TypeSynonymShouldRenderAs (n "ConstrainedArgument") "WithArgs" "forall a. (Foo a => a) -> a"+ , TypeSynonymShouldRenderAs (n "ConstrainedArgument") "MultiWithoutArgs" "forall a. (Partial => Partial => a) -> a"+ , TypeSynonymShouldRenderAs (n "ConstrainedArgument") "MultiWithArgs" "forall a b. (Foo a => Foo b => a) -> a"+ ])++ , ("TypeOpAliases",+ [ ValueShouldHaveTypeSignature (n "TypeOpAliases") "test1" (renderedType "forall a b. a ~> b")+ , ValueShouldHaveTypeSignature (n "TypeOpAliases") "test2" (renderedType "forall a b c. a ~> b ~> c")+ , ValueShouldHaveTypeSignature (n "TypeOpAliases") "test3" (renderedType "forall a b c d. a ~> (b ~> c) ~> d")+ , ValueShouldHaveTypeSignature (n "TypeOpAliases") "test4" (renderedType "forall a b c d. ((a ~> b) ~> c) ~> d")+ , ValueShouldHaveTypeSignature (n "TypeOpAliases") "third" (renderedType "forall a b c. a × b × c -> c")++ , ShouldBeDocumented (n "TypeOpAliases") "Tuple" ["Tuple","showTuple", "testLEither", "testREither"]+ , ShouldBeDocumented (n "TypeOpAliases") "Either" ["Left", "Right","testLEither", "testREither"]+ , ShouldBeDocumented (n "TypeOpAliases") "Show" ["show","showTuple"]++ , InstanceShouldHaveTypeSignature (n "TypeOpAliases") "Either" "testLEither" (renderedType "TestL (Either Int (Tuple Int String))")+ , InstanceShouldHaveTypeSignature (n "TypeOpAliases") "Either" "testREither" (renderedType "TestR (Either (Tuple Int Int) String)")+ ])++ , ("DocComments",+ [ ShouldHaveDocComment (n "DocComments") "example" " example == 0"+ ])++ , ("DocCommentsDataConstructor",+ [ ShouldHaveDataConstructorDocComment (n "DocCommentsDataConstructor") "Foo" "Bar" "data constructor comment"+ , ShouldHaveNoDataConstructorDocComment (n "DocCommentsDataConstructor") "Foo" "Baz"+ , ShouldHaveNoDataConstructorDocComment (n "DocCommentsDataConstructor") "ComplexFoo" "ComplexBar"+ , ShouldHaveDataConstructorDocComment (n "DocCommentsDataConstructor") "ComplexFoo" "ComplexBaz" "another data constructor comment"+ , ShouldHaveDataConstructorDocComment (n "DocCommentsDataConstructor") "NewtypeFoo" "NewtypeFoo" "newtype data constructor comment"+ ])++ , ("DocCommentsClassMethod",+ [ ShouldHaveClassMethodDocComment (n "DocCommentsClassMethod") "Foo" "bar" "class method comment"+ , ShouldNotHaveClassMethodDocComment (n "DocCommentsClassMethod") "Foo" "baz"+ ])++ , ("TypeLevelString",+ [ ShouldBeDocumented (n "TypeLevelString") "Foo" ["fooBar"]+ ])++ , ("Desugar",+ [ ValueShouldHaveTypeSignature (n "Desugar") "test" (renderedType "forall a b. X (a -> b) a -> b")+ ])++ , ("ChildDeclOrder",+ [ ShouldBeDocumented (n "ChildDeclOrder") "Two" ["First", "Second", "showTwo", "fooTwo"]+ , ShouldBeDocumented (n "ChildDeclOrder") "Foo" ["foo1", "foo2", "fooTwo", "fooInt"]+ ])++ , ("DeclOrder",+ shouldBeOrdered (n "DeclOrder")+ ["A", "x1", "X2", "x3", "X4", "B"])++ , ("DeclOrderNoExportList",+ shouldBeOrdered (n "DeclOrderNoExportList")+ [ "x1", "x3", "X2", "X4", "A", "B" ])++ , ("Ado",+ [ ValueShouldHaveTypeSignature (n "Ado") "test" (renderedType "Int")+ ]+ )++ , ("TypeSynonymInstance",+ [ ShouldBeDocumented (n "TypeSynonymInstance") "MyNT" ["MyNT", "ntMyNT"]+ ]+ )+ , ("KindSignatureDocs",+ -- expected kind signatures+ [ ShouldHaveKindSignature (n "KindSignatureDocs") "DKindAndType" "data DKindAndType :: forall k. k -> Type"+ , ShouldHaveKindSignature (n "KindSignatureDocs") "TKindAndType" "type TKindAndType :: forall k. k -> Type"+ , ShouldHaveKindSignature (n "KindSignatureDocs") "NKindAndType" "newtype NKindAndType :: forall k. k -> Type"+ , ShouldHaveKindSignature (n "KindSignatureDocs") "CKindAndType" "class CKindAndType :: forall k. (k -> Type) -> k -> Constraint"++ , ShouldHaveKindSignature (n "KindSignatureDocs") "DKindOnly" "data DKindOnly :: forall k. k -> Type"+ , ShouldHaveKindSignature (n "KindSignatureDocs") "TKindOnly" "type TKindOnly :: forall k. k -> Type"+ , ShouldHaveKindSignature (n "KindSignatureDocs") "NKindOnly" "newtype NKindOnly :: forall k. k -> Type"+ , ShouldHaveKindSignature (n "KindSignatureDocs") "CKindOnly" "class CKindOnly :: forall k. (k -> Type) -> k -> Constraint"++ , ShouldHaveKindSignature (n "KindSignatureDocs") "DTypeOnly" "data DTypeOnly :: forall k. k -> Type"+ , ShouldHaveKindSignature (n "KindSignatureDocs") "TTypeOnly" "type TTypeOnly :: forall k. k -> Type"+ , ShouldHaveKindSignature (n "KindSignatureDocs") "NTypeOnly" "newtype NTypeOnly :: forall k. k -> Type"+ , ShouldHaveKindSignature (n "KindSignatureDocs") "CTypeOnly" "class CTypeOnly :: forall k. (k -> Type) -> k -> Constraint"++ -- Declarations with no explicit kind signatures should still have+ -- their inferred kind signatures displayed as long as at least one+ -- type parameter does not have kind `Type`.+ , ShouldHaveKindSignature (n "KindSignatureDocs") "DImplicit" "data DImplicit :: forall k. k -> Type"+ , ShouldHaveKindSignature (n "KindSignatureDocs") "TImplicit" "type TImplicit :: forall k. k -> Type"+ , ShouldHaveKindSignature (n "KindSignatureDocs") "NImplicit" "newtype NImplicit :: forall k. k -> Type"+ , ShouldHaveKindSignature (n "KindSignatureDocs") "CImplicit" "class CImplicit :: forall k1. (k1 -> Type) -> k1 -> Constraint"++ -- Declarations with no explicit kind signatures should not be displayed+ -- if each type parameter in their inferred kind signature+ -- has kind `Type`.+ , ShouldNotHaveKindSignature (n "KindSignatureDocs") "DHidden"+ , ShouldNotHaveKindSignature (n "KindSignatureDocs") "DNothing"+ , ShouldNotHaveKindSignature (n "KindSignatureDocs") "THidden"+ , ShouldNotHaveKindSignature (n "KindSignatureDocs") "NHidden"+ , ShouldNotHaveKindSignature (n "KindSignatureDocs") "CHidden"+ , ShouldNotHaveKindSignature (n "KindSignatureDocs") "CNothing"++ -- FFI declarations always have an explicit kind signature+ -- but only show them if they are "interesting."+ , ShouldNotHaveKindSignature (n "KindSignatureDocs") "FFI_Hidden"+ , ShouldHaveKindSignature (n "KindSignatureDocs") "FFI_Shown" "data FFI_Shown :: (Type -> Type) -> Type"++ -- Declarations with an explicit kind signature that is wrapped+ -- in parenthesis at various points, but which "desugars" so to speak+ -- to an uninteresting kind signature should not be displayed.+ , ShouldNotHaveKindSignature (n "KindSignatureDocs") "FFI_RedundantParenthesis"+ , ShouldNotHaveKindSignature (n "KindSignatureDocs") "DataRedundantParenthesis"+ , ShouldNotHaveKindSignature (n "KindSignatureDocs") "ClassRedundantParenthesis"+ , ShouldNotHaveKindSignature (n "KindSignatureDocs") "DataHeadParens"+ , ShouldNotHaveKindSignature (n "KindSignatureDocs") "DataTailParens"+ , ShouldNotHaveKindSignature (n "KindSignatureDocs") "DataWholeParens"+ , ShouldNotHaveKindSignature (n "KindSignatureDocs") "DataSelfParens"+ , ShouldNotHaveKindSignature (n "KindSignatureDocs") "ClassSelfParens"+ , ShouldNotHaveKindSignature (n "KindSignatureDocs") "DataKindAnnotation"+ , ShouldNotHaveKindSignature (n "KindSignatureDocs") "DataKindAnnotationWithParens"+ , ShouldNotHaveKindSignature (n "KindSignatureDocs") "FunctionParens1"+ , ShouldNotHaveKindSignature (n "KindSignatureDocs") "FunctionParens2"+ , ShouldNotHaveKindSignature (n "KindSignatureDocs") "FunctionParens3"++ -- Declarations with no explicit kind signatures should be displayed+ -- if at least one type parameter has a kind other than `Type`+ -- despite all others having kind `Type`.+ , ShouldHaveKindSignature (n "KindSignatureDocs") "DShown" "data DShown :: Type -> Type -> (Type -> Type) -> Type"+ , ShouldHaveKindSignature (n "KindSignatureDocs") "TShown" "type TShown :: (Type -> Type) -> Type -> Type -> Type"+ , ShouldHaveKindSignature (n "KindSignatureDocs") "NShown" "newtype NShown :: Type -> (Type -> Type) -> Type -> Type"+ , ShouldHaveKindSignature (n "KindSignatureDocs") "CShown" "class CShown :: (Type -> Type) -> Type -> Type -> Constraint"+ ]+ )+ , ("RoleAnnotationDocs",+ [ ShouldHaveRoleAnnotation (n "RoleAnnotationDocs") "D_RNP" [P.Representational, P.Nominal, P.Phantom]+ , ShouldHaveRoleAnnotation (n "RoleAnnotationDocs") "D_NPR" [P.Nominal, P.Phantom, P.Representational]+ , ShouldHaveRoleAnnotation (n "RoleAnnotationDocs") "D_PRN" [P.Phantom, P.Representational, P.Nominal]+ , ShouldHaveRoleAnnotation (n "RoleAnnotationDocs") "FFI_NNN" [P.Nominal, P.Nominal, P.Nominal]+ , ShouldHaveRoleAnnotation (n "RoleAnnotationDocs") "FFI_RNP" [P.Representational, P.Nominal, P.Phantom]++ , ShouldHaveRoleAnnotation (n "RoleAnnotationDocs") "FFI_Higher1" [P.Representational, P.Nominal, P.Phantom]+ , ShouldHaveRoleAnnotation (n "RoleAnnotationDocs") "FFI_Higher2" [P.Representational, P.Nominal, P.Phantom]+ , ShouldHaveRoleAnnotation (n "RoleAnnotationDocs") "FFI_Higher3" [P.Representational, P.Nominal, P.Phantom]+ , ShouldHaveRoleAnnotation (n "RoleAnnotationDocs") "FFI_Higher4" [P.Representational, P.Nominal, P.Phantom]++ , ShouldHaveRoleAnnotation (n "RoleAnnotationDocs") "FFI_HeadParens" [P.Representational, P.Nominal, P.Phantom]+ , ShouldHaveRoleAnnotation (n "RoleAnnotationDocs") "FFI_TailParens" [P.Representational, P.Nominal, P.Phantom]+ , ShouldHaveRoleAnnotation (n "RoleAnnotationDocs") "FFI_WholeParens" [P.Representational, P.Nominal, P.Phantom]+ ]+ )+ , ("DocCommentsMerge",+ [ ShouldMergeDocComments (n "DocCommentsMerge") "DataOnly" $ Just "decl\n"+ , ShouldMergeDocComments (n "DocCommentsMerge") "KindOnlyData" $ Just "kind\n"+ , ShouldMergeDocComments (n "DocCommentsMerge") "KindAndData" $ Just "kind\n\ndecl\n"+ , ShouldMergeDocComments (n "DocCommentsMerge") "DataRoleOnly" $ Just "role\n"+ , ShouldMergeDocComments (n "DocCommentsMerge") "DataAndRole" $ Just "decl\n\nrole\n"+ , ShouldMergeDocComments (n "DocCommentsMerge") "KindOnlyDataRoleOnly" $ Just "kind\n\nrole\n"+ , ShouldMergeDocComments (n "DocCommentsMerge") "KindDataAndRole" $ Just "kind\n\ndecl\n\nrole\n"++ , ShouldMergeDocComments (n "DocCommentsMerge") "FFIOnly" $ Just "decl\n"+ , ShouldMergeDocComments (n "DocCommentsMerge") "FFIRoleOnly" $ Just "role\n"+ , ShouldMergeDocComments (n "DocCommentsMerge") "FFIAndRole" $ Just "decl\n\nrole\n"++ , ShouldMergeDocComments (n "DocCommentsMerge") "NewtypeOnly" $ Just "decl\n"+ , ShouldMergeDocComments (n "DocCommentsMerge") "KindOnlyNewtype" $ Just "kind\n"+ , ShouldMergeDocComments (n "DocCommentsMerge") "KindAndNewtype" $ Just "kind\n\ndecl\n"+ , ShouldMergeDocComments (n "DocCommentsMerge") "NewtypeRoleOnly" $ Just "role\n"+ , ShouldMergeDocComments (n "DocCommentsMerge") "NewtypeAndRole" $ Just "decl\n\nrole\n"+ , ShouldMergeDocComments (n "DocCommentsMerge") "KindOnlyNewtypeRoleOnly" $ Just "kind\n\nrole\n"+ , ShouldMergeDocComments (n "DocCommentsMerge") "KindNewtypeAndRole" $ Just "kind\n\ndecl\n\nrole\n"++ , ShouldMergeDocComments (n "DocCommentsMerge") "TypeOnly" $ Just "decl\n"+ , ShouldMergeDocComments (n "DocCommentsMerge") "KindOnlyType" $ Just "kind\n"+ , ShouldMergeDocComments (n "DocCommentsMerge") "KindAndType" $ Just "kind\n\ndecl\n"++ , ShouldMergeDocComments (n "DocCommentsMerge") "ClassOnly" $ Just "decl\n"+ , ShouldMergeDocComments (n "DocCommentsMerge") "KindOnlyClass" $ Just "kind\n"+ , ShouldMergeDocComments (n "DocCommentsMerge") "KindAndClass" $ Just "kind\n\ndecl\n"+ ]+ )+ , ("Shebang1Undocumented",+ [ ShouldHaveModuleDocs (n "Shebang1Undocumented") Nothing+ ]+ )+ , ("Shebang2Undocumented",+ [ ShouldHaveModuleDocs (n "Shebang2Undocumented") Nothing+ ]+ )+ , ("Shebang3Undocumented",+ [ ShouldHaveModuleDocs (n "Shebang3Undocumented") $ Just "Normal doc comment\n"+ ]+ )+ , ("Shebang4Undocumented",+ [ ShouldHaveModuleDocs (n "Shebang4Undocumented") $ Just "Normal doc comment\n"+ ]+ )+ ]++ where+ n = P.moduleNameFromString+ pkg str = let Right p = parsePackageName str in p++ hasTypeVar varName =+ getAny . P.everythingOnTypes (<>) (Any . isVar varName)++ isVar varName (P.TypeVar _ name) | varName == T.unpack name = True+ isVar _ _ = False++ renderedType expected ty =+ codeToString (Docs.renderType ty) == expected++ shouldBeOrdered mn declNames =+ zipWith (ShouldComeBefore mn) declNames (tail declNames)++testTagsCases :: [(Text, [TagsAssertion])]+testTagsCases =+ [ ("DeclOrder",+ [ -- explicit exports+ ShouldBeTagged "x1" 10+ , ShouldBeTagged "x3" 11+ , ShouldBeTagged "X2" 13+ , ShouldBeTagged "X4" 14+ , ShouldBeTagged "A" 16+ , ShouldBeTagged "B" 17+ ])+ , ("Example2",+ [ -- all symbols exported+ ShouldBeTagged "one" 3+ , ShouldBeTagged "two" 6+ ])+ , ("ExplicitExport",+ [ -- only one of two symbols exported+ ShouldBeTagged "one" 3+ , ShouldNotBeTagged "two"+ ])+ ]++showQual :: P.ModuleName -> Text -> Text+showQual mn decl =+ P.runModuleName mn <> "." <> decl++showInPkg :: (a -> Text) -> Docs.InPackage a -> Text+showInPkg f = \case+ Docs.Local x ->+ f x <> " (local)"+ Docs.FromDep pkgName x ->+ f x <> " (from dep: " <> runPackageName pkgName <> ")"
+ tests/TestGraph.hs view
@@ -0,0 +1,28 @@+module TestGraph where++import Prelude++import Test.Hspec (Spec, it, shouldBe, shouldSatisfy)+import Data.Either (isLeft)++import Data.Aeson qualified as Json+import Language.PureScript qualified as P++spec :: Spec+spec = do+ let baseDir = "tests/purs/graph/"+ let sourcesDir = baseDir <> "src/"+ it "should match the graph fixture" $ do+ let modulePaths = (sourcesDir <>) <$> ["Module.purs", "Module2.purs", "Module3.purs"]+ let graphFixtureName = "graph.json"++ graphFixture <- Json.decodeFileStrict' (baseDir <> graphFixtureName)+ eitherGraph <- fst <$> P.graph modulePaths+ case eitherGraph of+ Left err -> error $ "Graph creation failed. Errors: " <> show err+ Right res -> graphFixture `shouldBe` Just res++ it "should fail when trying to include non-existing modules in the graph" $ do+ let modulePath = sourcesDir <> "ModuleFailing.purs"+ graph <- fst <$> P.graph [modulePath]+ graph `shouldSatisfy` isLeft
+ tests/TestHierarchy.hs view
@@ -0,0 +1,67 @@+module TestHierarchy where++import Prelude++import Language.PureScript.Hierarchy (Digraph(..), Graph(..), GraphName(..), SuperMap(..), prettyPrint, typeClassGraph)+import Language.PureScript qualified as P++import Test.Hspec (Spec, describe, it, shouldBe)++spec :: Spec+spec = describe "hierarchy" $ do+ describe "Language.PureScript.Hierarchy" $ do+ describe "prettyPrint" $ do+ it "creates just the node when there is no relation" $ do+ let superMap = SuperMap (Left $ P.ProperName "A")++ let prettyPrinted = prettyPrint superMap++ prettyPrinted `shouldBe` " A;"++ it "creates a relation when there is one" $ do+ let superMap = SuperMap (Right (P.ProperName "A", P.ProperName "B"))++ let prettyPrinted = prettyPrint superMap++ prettyPrinted `shouldBe` " A -> B;"++ describe "typeClassGraph" $ do+ it "doesn't generate a graph if there are no type classes" $ do+ let mainModule = P.Module+ (P.internalModuleSourceSpan "<hierarchy>")+ []+ (P.ModuleName "Main")+ []+ Nothing++ let graph = typeClassGraph mainModule++ graph `shouldBe` Nothing++ it "generates usable graphviz graphs" $ do+ let declarations =+ [ P.TypeClassDeclaration+ (P.internalModuleSourceSpan "<A>", [])+ (P.ProperName "A")+ []+ []+ []+ []+ , P.TypeClassDeclaration+ (P.internalModuleSourceSpan "<B>", [])+ (P.ProperName "B")+ []+ [P.srcConstraint (P.Qualified P.ByNullSourcePos $ P.ProperName "A") [] [] Nothing]+ []+ []+ ]+ let mainModule = P.Module+ (P.internalModuleSourceSpan "<hierarchy>")+ []+ (P.ModuleName "Main")+ declarations+ Nothing++ let graph = typeClassGraph mainModule++ graph `shouldBe` Just (Graph (GraphName "Main") (Digraph "digraph Main {\n A;\n A -> B;\n}"))
+ tests/TestIde.hs view
@@ -0,0 +1,18 @@+module TestIde where++import Prelude++import Control.Monad (unless)+import Language.PureScript.Ide.Test+import PscIdeSpec qualified+import Test.Hspec++spec :: Spec+spec =+ beforeAll_ setup PscIdeSpec.spec+ where+ setup = do+ deleteOutputFolder+ s <- compileTestProject+ unless s (fail "Failed to compile .purs sources")+
+ tests/TestMake.hs view
@@ -0,0 +1,276 @@+-- Tests for the compiler's handling of incremental builds, i.e. the code in+-- Language.PureScript.Make.++module TestMake where++import Prelude++import Language.PureScript qualified as P+import Language.PureScript.CST qualified as CST++import Control.Concurrent (threadDelay)+import Control.Monad (guard, void)+import Control.Exception (tryJust)+import Control.Monad.IO.Class (liftIO)+import Control.Concurrent.MVar (readMVar, newMVar, modifyMVar_)+import Data.Time.Calendar (fromGregorian)+import Data.Time.Clock (UTCTime(..), secondsToDiffTime)+import Data.Text qualified as T+import Data.Set (Set)+import Data.Set qualified as Set+import Data.Map qualified as M++import System.FilePath ((</>))+import System.Directory (createDirectory, removeDirectoryRecursive, removeFile, setModificationTime)+import System.IO.Error (isDoesNotExistError)+import System.IO.UTF8 (readUTF8FilesT, writeUTF8FileT)++import Test.Hspec (Spec, before_, it, shouldReturn)++utcMidnightOnDate :: Integer -> Int -> Int -> UTCTime+utcMidnightOnDate year month day = UTCTime (fromGregorian year month day) (secondsToDiffTime 0)++timestampA, timestampB, timestampC, timestampD :: UTCTime+timestampA = utcMidnightOnDate 2019 1 1+timestampB = utcMidnightOnDate 2019 1 2+timestampC = utcMidnightOnDate 2019 1 3+timestampD = utcMidnightOnDate 2019 1 4++spec :: Spec+spec = do+ let sourcesDir = "tests/purs/make"+ let moduleNames = Set.fromList . map P.moduleNameFromString+ before_ (rimraf modulesDir >> rimraf sourcesDir >> createDirectory sourcesDir) $ do+ it "does not recompile if there are no changes" $ do+ let modulePath = sourcesDir </> "Module.purs"++ writeFileWithTimestamp modulePath timestampA "module Module where\nfoo = 0\n"+ compile [modulePath] `shouldReturn` moduleNames ["Module"]+ compile [modulePath] `shouldReturn` moduleNames []++ it "recompiles if files have changed" $ do+ let modulePath = sourcesDir </> "Module.purs"++ writeFileWithTimestamp modulePath timestampA "module Module where\nfoo = 0\n"+ compile [modulePath] `shouldReturn` moduleNames ["Module"]+ writeFileWithTimestamp modulePath timestampB "module Module where\nfoo = 1\n"+ compile [modulePath] `shouldReturn` moduleNames ["Module"]++ it "does not recompile if hashes have not changed" $ do+ let modulePath = sourcesDir </> "Module.purs"+ moduleContent = "module Module where\nfoo = 0\n"++ writeFileWithTimestamp modulePath timestampA moduleContent+ compile [modulePath] `shouldReturn` moduleNames ["Module"]+ writeFileWithTimestamp modulePath timestampB moduleContent+ compile [modulePath] `shouldReturn` moduleNames []++ it "recompiles if the file path for a module has changed" $ do+ let modulePath1 = sourcesDir </> "Module1.purs"+ modulePath2 = sourcesDir </> "Module2.purs"+ moduleContent = "module Module where\nfoo = 0\n"++ writeFileWithTimestamp modulePath1 timestampA moduleContent+ writeFileWithTimestamp modulePath2 timestampA moduleContent++ compile [modulePath1] `shouldReturn` moduleNames ["Module"]+ compile [modulePath2] `shouldReturn` moduleNames ["Module"]++ it "recompiles if an FFI file was added" $ do+ let moduleBasePath = sourcesDir </> "Module"+ modulePath = moduleBasePath ++ ".purs"+ moduleFFIPath = moduleBasePath ++ ".js"+ moduleContent = "module Module where\nfoo = 0\n"++ writeFileWithTimestamp modulePath timestampA moduleContent+ compile [modulePath] `shouldReturn` moduleNames ["Module"]++ writeFileWithTimestamp moduleFFIPath timestampB "export var bar = 1;\n"+ compile [modulePath] `shouldReturn` moduleNames ["Module"]++ it "recompiles if an FFI file was removed" $ do+ let moduleBasePath = sourcesDir </> "Module"+ modulePath = moduleBasePath ++ ".purs"+ moduleFFIPath = moduleBasePath ++ ".js"+ moduleContent = "module Module where\nfoo = 0\n"++ writeFileWithTimestamp modulePath timestampA moduleContent+ writeFileWithTimestamp moduleFFIPath timestampB "export var bar = 1;\n"+ compile [modulePath] `shouldReturn` moduleNames ["Module"]++ removeFile moduleFFIPath+ compile [modulePath] `shouldReturn` moduleNames ["Module"]++ it "recompiles downstream modules when a module is rebuilt" $ do+ let moduleAPath = sourcesDir </> "A.purs"+ moduleBPath = sourcesDir </> "B.purs"+ moduleAContent1 = "module A where\nfoo = 0\n"+ moduleAContent2 = "module A where\nfoo = 1\n"+ moduleBContent = "module B where\nimport A (foo)\nbar = foo\n"++ writeFileWithTimestamp moduleAPath timestampA moduleAContent1+ writeFileWithTimestamp moduleBPath timestampB moduleBContent+ compile [moduleAPath, moduleBPath] `shouldReturn` moduleNames ["A", "B"]++ writeFileWithTimestamp moduleAPath timestampC moduleAContent2+ compile [moduleAPath, moduleBPath] `shouldReturn` moduleNames ["A", "B"]++ it "only recompiles downstream modules when a module is rebuilt" $ do+ let moduleAPath = sourcesDir </> "A.purs"+ moduleBPath = sourcesDir </> "B.purs"+ moduleCPath = sourcesDir </> "C.purs"+ modulePaths = [moduleAPath, moduleBPath, moduleCPath]+ moduleAContent1 = "module A where\nfoo = 0\n"+ moduleAContent2 = "module A where\nfoo = 1\n"+ moduleBContent = "module B where\nimport A (foo)\nbar = foo\n"+ moduleCContent = "module C where\nbaz = 3\n"++ writeFileWithTimestamp moduleAPath timestampA moduleAContent1+ writeFileWithTimestamp moduleBPath timestampB moduleBContent+ writeFileWithTimestamp moduleCPath timestampC moduleCContent+ compile modulePaths `shouldReturn` moduleNames ["A", "B", "C"]++ writeFileWithTimestamp moduleAPath timestampD moduleAContent2+ compile modulePaths `shouldReturn` moduleNames ["A", "B"]++ it "does not necessarily recompile modules which were not part of the previous batch" $ do+ let moduleAPath = sourcesDir </> "A.purs"+ moduleBPath = sourcesDir </> "B.purs"+ moduleCPath = sourcesDir </> "C.purs"+ modulePaths = [moduleAPath, moduleBPath, moduleCPath]+ batch1 = [moduleAPath, moduleBPath]+ batch2 = [moduleAPath, moduleCPath]+ moduleAContent = "module A where\nfoo = 0\n"+ moduleBContent = "module B where\nimport A (foo)\nbar = foo\n"+ moduleCContent = "module C where\nbaz = 3\n"++ writeFileWithTimestamp moduleAPath timestampA moduleAContent+ writeFileWithTimestamp moduleBPath timestampB moduleBContent+ writeFileWithTimestamp moduleCPath timestampC moduleCContent+ compile modulePaths `shouldReturn` moduleNames ["A", "B", "C"]++ compile batch1 `shouldReturn` moduleNames []+ compile batch2 `shouldReturn` moduleNames []++ it "recompiles if a module fails to compile" $ do+ let modulePath = sourcesDir </> "Module.purs"+ moduleContent = "module Module where\nfoo :: Int\nfoo = \"not an int\"\n"++ writeFileWithTimestamp modulePath timestampA moduleContent+ compileAllowingFailures [modulePath] `shouldReturn` moduleNames ["Module"]+ compileAllowingFailures [modulePath] `shouldReturn` moduleNames ["Module"]++ it "recompiles if docs are requested but not up to date" $ do+ let modulePath = sourcesDir </> "Module.purs"+ moduleContent1 = "module Module where\nx :: Int\nx = 1"+ moduleContent2 = moduleContent1 <> "\ny :: Int\ny = 1"+ optsWithDocs = P.defaultOptions { P.optionsCodegenTargets = Set.fromList [P.JS, P.Docs] }+ go opts = compileWithOptions opts [modulePath] >>= assertSuccess+ oneSecond = 10 ^ (6::Int) -- microseconds.++ writeFileWithTimestamp modulePath timestampA moduleContent1+ go optsWithDocs `shouldReturn` moduleNames ["Module"]+ writeFileWithTimestamp modulePath timestampB moduleContent2+ -- See Note [Sleeping to avoid flaky tests]+ threadDelay oneSecond+ go P.defaultOptions `shouldReturn` moduleNames ["Module"]+ -- Since the existing docs.json is now outdated, the module should be+ -- recompiled.+ go optsWithDocs `shouldReturn` moduleNames ["Module"]++ it "recompiles if corefn is requested but not up to date" $ do+ let modulePath = sourcesDir </> "Module.purs"+ moduleContent1 = "module Module where\nx :: Int\nx = 1"+ moduleContent2 = moduleContent1 <> "\ny :: Int\ny = 1"+ optsCorefnOnly = P.defaultOptions { P.optionsCodegenTargets = Set.singleton P.CoreFn }+ go opts = compileWithOptions opts [modulePath] >>= assertSuccess+ oneSecond = 10 ^ (6::Int) -- microseconds.++ writeFileWithTimestamp modulePath timestampA moduleContent1+ go optsCorefnOnly `shouldReturn` moduleNames ["Module"]+ writeFileWithTimestamp modulePath timestampB moduleContent2+ -- See Note [Sleeping to avoid flaky tests]+ threadDelay oneSecond+ go P.defaultOptions `shouldReturn` moduleNames ["Module"]+ -- Since the existing corefn.json is now outdated, the module should be+ -- recompiled.+ go optsCorefnOnly `shouldReturn` moduleNames ["Module"]++-- Note [Sleeping to avoid flaky tests]+--+-- One of the things we want to test here is that all requested output files+-- (via the --codegen CLI option) must be up to date if we are to skip+-- recompiling a particular module. Since we check for outdatedness by+-- comparing the timestamp of the output files (eg. corefn.json, index.js) to+-- the timestamp of the externs file, this check is susceptible to flakiness+-- if the timestamp resolution is sufficiently coarse. To get around this, we+-- delay for one second.+--+-- Note that most of the compiler behaviour here doesn't depend on file+-- timestamps (instead, content hashes are usually more important) and so+-- sleeping should not be necessary in most of these tests.+--+-- See also discussion on https://github.com/purescript/purescript/pull/4053++rimraf :: FilePath -> IO ()+rimraf =+ void . tryJust (guard . isDoesNotExistError) . removeDirectoryRecursive++-- | Compile a group of modules, returning a set of the modules for which a+-- rebuild was attempted, allowing the caller to set the compiler options and+-- including the make result in the return value.+compileWithOptions ::+ P.Options ->+ [FilePath] ->+ IO (Either P.MultipleErrors [P.ExternsFile], Set P.ModuleName)+compileWithOptions opts input = do+ recompiled <- newMVar Set.empty+ moduleFiles <- readUTF8FilesT input+ (makeResult, _) <- P.runMake opts $ do+ ms <- CST.parseModulesFromFiles id moduleFiles+ let filePathMap = M.fromList $ map (\(fp, pm) -> (P.getModuleName $ CST.resPartial pm, Right fp)) ms+ foreigns <- P.inferForeignModules filePathMap+ let makeActions =+ (P.buildMakeActions modulesDir filePathMap foreigns True)+ { P.progress = \(P.CompilingModule mn _) ->+ liftIO $ modifyMVar_ recompiled (return . Set.insert mn)+ }+ P.make makeActions (map snd ms)++ recompiledModules <- readMVar recompiled+ pure (makeResult, recompiledModules)++-- | Compile a group of modules using the default options, and including the+-- make result in the return value.+compileWithResult ::+ [FilePath] ->+ IO (Either P.MultipleErrors [P.ExternsFile], Set P.ModuleName)+compileWithResult = compileWithOptions P.defaultOptions++assertSuccess :: (Either P.MultipleErrors a, Set P.ModuleName) -> IO (Set P.ModuleName)+assertSuccess (result, recompiled) =+ case result of+ Left errs ->+ fail (P.prettyPrintMultipleErrors P.defaultPPEOptions errs)+ Right _ ->+ pure recompiled++-- | Compile, returning the set of modules which were rebuilt, and failing if+-- any errors occurred.+compile :: [FilePath] -> IO (Set P.ModuleName)+compile input =+ compileWithResult input >>= assertSuccess++compileAllowingFailures :: [FilePath] -> IO (Set P.ModuleName)+compileAllowingFailures input = fmap snd (compileWithResult input)++writeFileWithTimestamp :: FilePath -> UTCTime -> T.Text -> IO ()+writeFileWithTimestamp path mtime contents = do+ writeUTF8FileT path contents+ setModificationTime path mtime++-- | Use a different output directory to ensure that we don't get interference+-- from other test results+modulesDir :: FilePath+modulesDir = ".test_modules" </> "make"+
+ tests/TestPrimDocs.hs view
@@ -0,0 +1,37 @@+module TestPrimDocs where++import Prelude++import Data.List (sort)+import Control.Exception (evaluate)+import Control.DeepSeq (force)+import Data.Map qualified as Map+import Data.Text qualified as Text+import Language.PureScript qualified as P+import Language.PureScript.Docs qualified as D++import Test.Hspec (Spec, it, shouldBe)++spec :: Spec+spec = do+ it "there are no bottoms hiding in primModules" $ do+ _ <- evaluate (force D.primModules)+ return ()++ it "all Prim modules are fully documented" $ do+ let actualPrimNames =+ -- note that prim type classes are listed in P.primTypes+ filter (not . Text.any (== '$')) . map (P.runProperName . P.disqualify . fst) $ Map.toList+ ( P.primTypes <>+ P.primBooleanTypes <>+ P.primCoerceTypes <>+ P.primOrderingTypes <>+ P.primRowTypes <>+ P.primRowListTypes <>+ P.primTypeErrorTypes <>+ P.primSymbolTypes <>+ P.primIntTypes )+ let documentedPrimNames =+ map D.declTitle (concatMap D.modDeclarations D.primModules)++ sort documentedPrimNames `shouldBe` sort actualPrimNames
+ tests/TestPscPublish.hs view
@@ -0,0 +1,120 @@+module TestPscPublish where++import Prelude++import Control.Exception (tryJust)+import Control.Monad (void, guard)+import Control.Monad.IO.Class (liftIO)+import Data.ByteString.Lazy (ByteString)+import Data.Time.Clock (getCurrentTime)+import Data.Aeson qualified as A+import Data.Version (Version(..))+import Data.Foldable (forM_)+import Text.PrettyPrint.Boxes qualified as Boxes+import System.Directory (listDirectory, removeDirectoryRecursive)+import System.FilePath ((</>))+import System.IO.Error (isDoesNotExistError)++import Language.PureScript.Docs (UploadedPackage, VerifiedPackage)+import Language.PureScript.Publish (PublishOptions(..), defaultPublishOptions)+import Language.PureScript.Publish qualified as Publish+import Language.PureScript.Publish.ErrorsWarnings qualified as Publish++import Test.Hspec (Expectation, Spec, context, expectationFailure, it, runIO)+import TestUtils (pushd)++spec :: Spec+spec = do+ context "preparePackage with json roundtrips" $ do+ it "purescript-prelude" $ do+ testPackage+ "tests/support/bower_components/purescript-prelude"+ "bower.json"+ "../../prelude-resolutions.json"++ it "basic example (bower.json)" $ do+ testPackage+ "tests/purs/publish/basic-example"+ "bower.json"+ "resolutions.json"++ it "basic example (purs.json)" $ do+ testPackage+ "tests/purs/publish/basic-example"+ "purs.json"+ "resolutions.json"++ context "json compatibility" $ do+ let compatDir = "tests" </> "json-compat"+ versions <- runIO $ listDirectory compatDir+ forM_ versions $ \version -> do+ context ("json produced by " ++ version) $ do+ files <- runIO $ listDirectory (compatDir </> version)+ forM_ files $ \file -> do+ it file $ do+ result <- A.eitherDecodeFileStrict' (compatDir </> version </> file)+ case result of+ Right (_ :: VerifiedPackage) ->+ pure ()+ Left err ->+ expectationFailure ("JSON parsing failed: " ++ err)++data TestResult+ = ParseFailed String+ | Mismatch ByteString ByteString -- ^ encoding before, encoding after+ | Pass ByteString+ deriving (Show)++roundTrip :: UploadedPackage -> TestResult+roundTrip pkg =+ let before' = A.encode pkg+ in case A.eitherDecode before' of+ Left err -> ParseFailed err+ Right parsed -> do+ let after' = A.encode (parsed :: UploadedPackage)+ if before' == after'+ then Pass before'+ else Mismatch before' after'++testRunOptions :: FilePath -> FilePath -> PublishOptions+testRunOptions manifestFile resolutionsFile = defaultPublishOptions+ { publishResolutionsFile = resolutionsFile+ , publishManifestFile = manifestFile+ , publishGetVersion = return testVersion+ , publishGetTagTime = const (liftIO getCurrentTime)+ , publishWorkingTreeDirty = return ()+ }+ where testVersion = ("v999.0.0", Version [999,0,0] [])++-- | Given a directory which contains a package, produce JSON from it, and then+-- | attempt to parse it again, and ensure that it doesn't change.+testPackage :: FilePath -> FilePath -> FilePath -> Expectation+testPackage packageDir manifestFile resolutionsFile = do+ res <- preparePackage packageDir manifestFile resolutionsFile+ case res of+ Left err ->+ expectationFailure $+ "Failed to produce JSON from " ++ packageDir ++ ":\n" +++ Boxes.render (Publish.renderError err)+ Right package ->+ case roundTrip package of+ Pass _ ->+ pure ()+ ParseFailed msg ->+ expectationFailure ("Failed to re-parse: " ++ msg)+ Mismatch _ _ ->+ expectationFailure "JSON did not match"++-- A version of Publish.preparePackage suitable for use in tests. We remove the+-- output directory each time to ensure that we are actually testing the docs+-- code in the working tree as it is now (as opposed to how it was at some+-- point in the past when the tests were previously successfully run).+preparePackage :: FilePath -> FilePath -> FilePath -> IO (Either Publish.PackageError UploadedPackage)+preparePackage packageDir manifestFile resolutionsFile =+ pushd packageDir $ do+ removeDirectoryRecursiveIfPresent "output"+ Publish.preparePackage (testRunOptions manifestFile resolutionsFile)++removeDirectoryRecursiveIfPresent :: FilePath -> IO ()+removeDirectoryRecursiveIfPresent =+ void . tryJust (guard . isDoesNotExistError) . removeDirectoryRecursive
+ tests/TestPsci.hs view
@@ -0,0 +1,14 @@+module TestPsci where+++import TestPsci.CommandTest (commandTests)+import TestPsci.CompletionTest (completionTests)+import TestPsci.EvalTest (evalTests)++import Test.Hspec (Spec)++spec :: Spec+spec = do+ completionTests+ commandTests+ evalTests
+ tests/TestPsci/CommandTest.hs view
@@ -0,0 +1,79 @@+module TestPsci.CommandTest where++import Prelude++import Control.Monad.IO.Class (liftIO)+import Control.Monad.Trans.RWS.Strict (get)+import Language.PureScript (moduleNameFromString)+import Language.PureScript.Interactive (psciImportedModules, psciInteractivePrint)+import System.FilePath ((</>))+import System.Directory (getCurrentDirectory)+import Test.Hspec (Spec, context, shouldContain, shouldNotContain, specify)+import TestPsci.TestEnv (TestPSCi, equalsTo, execTestPSCi, printed, prints, run, simulateModuleEdit)++specPSCi :: String -> TestPSCi () -> Spec+specPSCi label = specify label . execTestPSCi++commandTests :: Spec+commandTests = context "commandTests" $ do+ specPSCi ":clear" $ do+ run "import Prelude"+ run "import Data.Functor"+ run "import Control.Monad"+ ms <- psciImportedModules <$> get+ length ms `equalsTo` 3+ run ":clear"+ ms' <- psciImportedModules <$> get+ length ms' `equalsTo` 0++ specPSCi ":reload" $ do+ run "import Prelude"+ run "import Data.Functor"+ run "import Control.Monad"+ ms <- psciImportedModules <$> get+ length ms `equalsTo` 3+ run ":reload"+ ms' <- psciImportedModules <$> get+ length ms' `equalsTo` 3++ specPSCi ":complete" $ do+ ":complete ma" `prints` []+ ":complete Data.Functor.ma" `prints` []+ run "import Data.Functor"+ ":complete ma" `prints` unlines ["map", "mapFlipped"]+ run "import Control.Monad as M"+ ":complete M.a" `prints` unlines ["M.ap", "M.apply"]++ specPSCi ":browse" $ do+ ":browse Data.Void" `printed` flip shouldContain "data Void"+ ":browse Data.Void" `printed` flip shouldContain "absurd ::"++ specPSCi ":reload, :browse" $ do+ cwd <- liftIO getCurrentDirectory+ let new = cwd </> "tests" </> "support" </> "psci" </> "Reload.edit"++ ":browse Reload" `printed` flip shouldContain "reload ::"+ ":browse Reload" `printed` flip shouldNotContain "edited ::"++ simulateModuleEdit (moduleNameFromString "Reload") new $ do+ run ":reload"+ ":browse Reload" `printed` flip shouldNotContain "reload ::"+ ":browse Reload" `printed` flip shouldContain "edited ::"++ ":browse Mirp" `printed` flip shouldContain "is not valid"+ ":browse Prim" `printed` flip shouldContain "class Partial"++ specPSCi ":print" $ do+ let failMsg = "Unable to set the repl's printing function"+ let interactivePrintModuleShouldBe modName = do+ modName' <- fst . psciInteractivePrint <$> get+ modName' `equalsTo` modName++ run "import Prelude"+ ":print Prelude.show" `printed` flip shouldContain failMsg+ interactivePrintModuleShouldBe (moduleNameFromString "PSCI.Support")++ ":print InteractivePrint.unsafeEval" `printed` flip shouldNotContain failMsg+ "(identity :: _ -> _)" `printed` flip shouldContain "[Function]"+ interactivePrintModuleShouldBe (moduleNameFromString "InteractivePrint")+ ":print" `printed` flip shouldContain "InteractivePrint"
+ tests/TestPsci/CompletionTest.hs view
@@ -0,0 +1,135 @@+module TestPsci.CompletionTest where++import Prelude++import Test.Hspec (Spec, SpecWith, beforeAll, context, shouldBe, specify)++import Control.Monad.Trans.State.Strict (evalStateT)+import Data.Functor ((<&>))+import Data.List (sort)+import Data.Text qualified as T+import Language.PureScript qualified as P+import Language.PureScript.Interactive (CompletionM, PSCiState, completion', formatCompletions, liftCompletionM, updateImportedModules)+import TestPsci.TestEnv (initTestPSCiEnv)+import TestUtils (getSupportModuleNames)++completionTests :: Spec+completionTests = context "completionTests" $+ beforeAll getPSCiStateForCompletion $+ mapM_ assertCompletedOk completionTestData++-- If the cursor is at the right end of the line, with the 1st element of the+-- pair as the text in the line, then pressing tab should offer all the+-- elements of the list (which is the 2nd element) as completions.+completionTestData :: [(String, IO [String])]+completionTestData =+ -- basic directives+ [ (":h", pure [":help"])+ , (":r", pure [":reload"])+ , (":c", pure [":clear", ":complete"])+ , (":q", pure [":quit"])+ , (":b", pure [":browse"])++ -- :browse should complete module names+ , (":b Eff", pure $ map (":b Effect" ++) ["", ".Unsafe", ".Class", ".Class.Console", ".Console", ".Uncurried", ".Ref"])+ , (":b Effect.", pure $ map (":b Effect" ++) [".Unsafe", ".Class", ".Class.Console", ".Console", ".Uncurried", ".Ref"])++ -- import should complete module names+ , ("import Eff", pure $ map ("import Effect" ++) ["", ".Unsafe", ".Class", ".Class.Console", ".Console", ".Uncurried", ".Ref"])+ , ("import Effect.", pure $ map ("import Effect" ++) [".Unsafe", ".Class", ".Class.Console", ".Console", ".Uncurried", ".Ref"])++ -- :quit, :help, :reload, :clear should not complete+ , (":help ", pure [])+ , (":quit ", pure [])+ , (":reload ", pure [])+ , (":clear ", pure [])++ -- :show should complete its available arguments+ , (":show ", pure [":show import", ":show loaded", ":show print"])+ , (":show a", pure [])++ -- :type should complete next word from values and constructors in scope+ , (":type uni", pure [":type unit"])+ , (":type E", pure [":type EQ"])+ , (":type P.", pure $ map (":type P." ++) ["EQ", "GT", "LT", "unit"]) -- import Prelude (unit, Ordering(..)) as P+ , (":type Effect.Console.lo", pure [])+ , (":type voi", pure [])++ -- :kind should complete next word from types in scope+ , (":kind Str", pure [":kind String"])+ , (":kind ST.", pure [":kind ST.Region", ":kind ST.ST"]) -- import Control.Monad.ST as ST+ , (":kind STRef.", pure [":kind STRef.STRef"]) -- import Control.Monad.ST.Ref as STRef+ , (":kind Effect.", pure [])++ -- Only one argument for these directives should be completed+ , (":show import ", pure [])+ , (":browse Data.List ", pure [])++ -- These directives take any number of completable terms+ , (":type const compa", pure [":type const compare", ":type const comparing"])+ , (":kind Array In", pure [":kind Array Int"])++ -- a few other import tests+ , ("impor", pure ["import"])+ , ("import ", getSupportModuleNames <&> map (T.unpack . mappend "import "))+ , ("import Prelude ", pure [])++ -- String and number literals should not be completed+ , ("\"hi", pure [])+ , ("34", pure [])++ -- Identifiers and data constructors in scope should be completed+ , ("uni", pure ["unit"])+ , ("G", pure ["GT"])+ , ("P.G", pure ["P.GT"])+ , ("P.uni", pure ["P.unit"])+ , ("voi", pure []) -- import Prelude hiding (void)+ , ("Effect.Class.", pure [])++ -- complete first name after type annotation symbol+ , ("1 :: I", pure ["1 :: Int"])+ , ("1 ::I", pure ["1 ::Int"])+ , ("1:: I", pure ["1:: Int"])+ , ("1::I", pure ["1::Int"])+ , ("(1::Int) uni", pure ["(1::Int) unit"]) -- back to completing values++ -- Parens and brackets aren't considered part of the current identifier+ , ("map id [uni", pure ["map id [unit"])+ , ("map (cons", pure ["map (const"])+ ]++assertCompletedOk :: (String, IO [String]) -> SpecWith PSCiState+assertCompletedOk (line, expectedsM) = specify line $ \psciState -> do+ expecteds <- expectedsM+ results <- runCM psciState (completion' (reverse line, ""))+ let actuals = formatCompletions results+ sort actuals `shouldBe` sort expecteds++runCM :: PSCiState -> CompletionM a -> IO a+runCM psciState act = evalStateT (liftCompletionM act) psciState++getPSCiStateForCompletion :: IO PSCiState+getPSCiStateForCompletion = do+ (st, _) <- initTestPSCiEnv+ let imports = [-- import Control.Monad.ST as S+ (qualName "Control.Monad.ST"+ ,P.Implicit+ ,Just (qualName "ST"))+ , -- import Control.Monad.ST.Ref as STRef+ (qualName "Control.Monad.ST.Ref"+ ,P.Implicit+ ,Just (qualName "STRef"))+ -- import Prelude hiding (void)+ ,(qualName "Prelude"+ ,P.Hiding [valName "void"]+ ,Nothing)+ -- import Prelude (unit, Ordering(..)) as P+ ,(qualName "Prelude"+ ,P.Explicit [valName "unit", typeName "Ordering"]+ ,Just (qualName "P"))]+ return $ updateImportedModules (const imports) st+ where+ qualName = P.moduleNameFromString+ valName = P.ValueRef srcSpan . P.Ident+ typeName t = P.TypeRef srcSpan (P.ProperName t) Nothing+ srcSpan = P.internalModuleSourceSpan "<internal>"
+ tests/TestPsci/EvalTest.hs view
@@ -0,0 +1,65 @@+module TestPsci.EvalTest where++import Prelude++import Control.Monad (forM_, foldM_)+import Control.Monad.IO.Class (liftIO)+import Data.List (stripPrefix, intercalate)+import Data.List.Split (splitOn)+import System.Directory (getCurrentDirectory)+import System.Exit (exitFailure)+import System.FilePath ((</>), takeFileName)+import System.FilePath.Glob qualified as Glob+import System.IO.UTF8 (readUTF8File)+import Test.Hspec (Spec, context, runIO, specify)+import TestPsci.TestEnv (TestPSCi, evaluatesTo, execTestPSCi, run)++evalTests :: Spec+evalTests = context "evalTests" $ do+ testFiles <- runIO evalTestFiles+ forM_ testFiles evalTest++evalTestFiles :: IO [FilePath]+evalTestFiles = do+ cwd <- getCurrentDirectory+ let psciExamples = cwd </> "tests" </> "purs" </> "psci"+ Glob.globDir1 (Glob.compile "**/*.purs") psciExamples++data EvalLine = Line String+ | Comment EvalContext+ | Empty+ | Invalid String+ deriving (Show)++data EvalContext = ShouldEvaluateTo String+ | Paste [String]+ | None+ deriving (Show)++evalCommentPrefix :: String+evalCommentPrefix = "-- @"++parseEvalLine :: String -> EvalLine+parseEvalLine "" = Empty+parseEvalLine line =+ case stripPrefix evalCommentPrefix line of+ Just rest ->+ case splitOn " " rest of+ "shouldEvaluateTo" : args -> Comment (ShouldEvaluateTo $ unwords args)+ ["paste"] -> Comment (Paste [])+ _ -> Invalid line+ Nothing -> Line line++evalTest :: FilePath -> Spec+evalTest f = specify (takeFileName f) $ do+ evalLines <- map parseEvalLine . lines <$> readUTF8File f+ execTestPSCi $ foldM_ handleLine None evalLines++handleLine :: EvalContext -> EvalLine -> TestPSCi EvalContext+handleLine ctx Empty = pure ctx+handleLine None (Line stmt) = run stmt >> pure None+handleLine None (Comment ctx) = pure ctx+handleLine (ShouldEvaluateTo expected) (Line expr) = expr `evaluatesTo` expected >> pure None+handleLine (Paste ls) (Line l) = pure . Paste $ ls ++ [l]+handleLine (Paste ls) (Comment (Paste _)) = run (intercalate "\n" ls) >> pure None+handleLine _ line = liftIO $ putStrLn ("unexpected: " ++ show line) >> exitFailure
+ tests/TestPsci/TestEnv.hs view
@@ -0,0 +1,125 @@+module TestPsci.TestEnv where++import Prelude++import Control.Exception.Lifted (bracket_)+import Control.Monad (void, when)+import Control.Monad.IO.Class (liftIO)+import Control.Monad.Trans.RWS.Strict (evalRWST, asks, local, RWST)+import Data.Foldable (traverse_)+import Data.List (isSuffixOf)+import Data.Text qualified as T+import Language.PureScript qualified as P+import Language.PureScript.CST qualified as CST+import Language.PureScript.Interactive (Command(..), PSCiConfig(..), PSCiState, handleCommand, indexFile, initialPSCiState, loadAllModules, make, modulesDir, parseCommand, readNodeProcessWithExitCode, runMake, updateLoadedExterns)+import System.Directory (getCurrentDirectory, doesPathExist, removeFile)+import System.Exit+import System.FilePath ((</>), pathSeparator)+import System.FilePath.Glob qualified as Glob+import Test.Hspec (shouldBe, Expectation)++-- | A monad transformer for handle PSCi actions in tests+type TestPSCi a = RWST PSCiConfig () PSCiState IO a++-- | Initialise PSCi state and config for tests+initTestPSCiEnv :: IO (PSCiState, PSCiConfig)+initTestPSCiEnv = do+ -- Load test support packages+ cwd <- getCurrentDirectory+ let supportDir = cwd </> "tests" </> "support"+ psciFiles <- Glob.globDir1 (Glob.compile "**/*.purs") (supportDir </> "psci")+ libraries <- Glob.globDir1 (Glob.compile "purescript-*/src/**/*.purs") (supportDir </> "bower_components")+ let pursFiles = psciFiles ++ libraries+ modulesOrError <- loadAllModules pursFiles+ case modulesOrError of+ Left err ->+ print err >> exitFailure+ Right modules -> do+ -- Make modules+ makeResultOrError <- runMake . make $ fmap CST.pureResult <$> modules+ case makeResultOrError of+ Left errs -> putStrLn (P.prettyPrintMultipleErrors P.defaultPPEOptions errs) >> exitFailure+ Right (externs, _) ->+ return (updateLoadedExterns (const (zip (map snd modules) externs)) initialPSCiState, PSCiConfig pursFiles)++-- | Execute a TestPSCi, returning IO+execTestPSCi :: TestPSCi a -> IO a+execTestPSCi i = do+ (s, c) <- initTestPSCiEnv -- init state and config+ fst <$> evalRWST i c s++-- | Evaluate JS to which a PSCi input is compiled. The actual JS input is not+-- needed as an argument, as it is already written in the file during the+-- command evaluation.+jsEval :: TestPSCi String+jsEval = liftIO $ do+ writeFile indexFile "import('./$PSCI/index.js').then(({ $main }) => $main());"+ result <- readNodeProcessWithExitCode Nothing [indexFile] ""+ case result of+ Right (ExitSuccess, out, _) -> return out+ Right (ExitFailure _, _, err) -> putStrLn err >> exitFailure+ Left err -> putStrLn err >> exitFailure++-- | Run a PSCi command and evaluate its outputs:+-- * jsOutputEval is used to evaluate compiled JS output by PSCi+-- * printedOutputEval is used to evaluate text printed directly by PSCi itself+runAndEval :: String -> TestPSCi () -> (String -> TestPSCi ()) -> TestPSCi ()+runAndEval comm jsOutputEval textOutputEval =+ case parseCommand comm of+ Left errStr -> liftIO $ putStrLn errStr >> exitFailure+ Right commands ->+ -- The JS result is ignored, as it's already written in a JS source file.+ -- For the detail, please refer to Interactive.hs+ traverse_ (handleCommand (const jsOutputEval) (return ()) textOutputEval) commands++-- | Run a PSCi command, evaluate compiled JS, and ignore evaluation output and printed output+run :: String -> TestPSCi ()+run comm = runAndEval comm (void jsEval) ignorePrinted+ where+ ignorePrinted _ = return ()++-- | A lifted evaluation of Hspec 'shouldBe' for the TestPSCi+equalsTo :: (Eq a, Show a) => a -> a -> TestPSCi ()+equalsTo x y = liftIO $ x `shouldBe` y++-- | An assertion to check command evaluated javascript output against a given string+evaluatesTo :: String -> String -> TestPSCi ()+evaluatesTo command expected = runAndEval command evalJsAndCompare ignorePrinted+ where+ evalJsAndCompare = do+ actual <- jsEval+ actual `equalsTo` (expected ++ "\n")+ ignorePrinted _ = return ()++-- | An assertion to check command PSCi printed output against a given string+prints :: String -> String -> TestPSCi ()+prints command expected = printed command (`shouldBe` expected)++printed :: String -> (String -> Expectation) -> TestPSCi ()+printed command f = runAndEval command (void jsEval) (liftIO . f)++simulateModuleEdit :: P.ModuleName -> FilePath -> TestPSCi a -> TestPSCi a+simulateModuleEdit mn newPath action = do+ ms <- asks psciFileGlobs+ case replacePath ms of+ Nothing -> fail $ "Did not find " ++ inputPath ++ " in psciFileGlobs"+ Just xs' -> local (\c -> c { psciFileGlobs = xs' }) temporarily <* rebuild++ where+ outputPath = modulesDir </> T.unpack (P.runModuleName mn) </> "index.js"+ inputPath = T.unpack (T.replace "." slash (P.runModuleName mn)) ++ ".purs"+ slash = T.singleton pathSeparator++ replacePath :: [String] -> Maybe [String]+ replacePath (x:xs)+ | inputPath `isSuffixOf` x = Just (newPath : xs)+ | otherwise = fmap (x:) (replacePath xs)+ replacePath [] = Nothing++ -- Simply adding the file to `PSCiConfig.fileGlobs` isn't sufficient; running+ -- ":reload" might not rebuild because the compiled JS artifact has a more+ -- recent timestamp than the "new" source file `newPath`.+ temporarily = bracket_ enableRebuild enableRebuild action+ enableRebuild = liftIO $ do { b <- doesPathExist outputPath; when b (removeFile outputPath) }+ rebuild = handleCommand discard (return ()) discard ReloadState+ discard _ = return ()
+ tests/TestSourceMaps.hs view
@@ -0,0 +1,77 @@+module TestSourceMaps where++import Prelude++import Control.Monad (void, forM_)+import Data.Aeson as Json+import Test.Hspec (Expectation, SpecWith, describe, expectationFailure, it, runIO, shouldBe)+import System.FilePath (replaceExtension, takeFileName, (</>), (<.>))+import Language.PureScript qualified as P+import Data.ByteString qualified as BS+import Data.ByteString.Lazy qualified as LBS+import Data.Foldable (fold)+import TestUtils (getTestFiles, SupportModules (..), compile', ExpectedModuleName (IsSourceMap))+import Data.Set qualified as Set+import TestCompiler (getTestMain)+import System.Process.Typed (proc, readProcess_)++spec :: SpecWith SupportModules+spec =+ goldenFiles++-- See the CONTRIBUTING.md file for why the below requirements are needed.+-- Test files and their module names must abide by the following requirements:+-- - Test files must reside in the @tests/purs/sourcemaps/@ directory+-- - Module names must be prefixed with "SourceMaps." with the remainder+-- matching the file name. For example:+-- - File Name: @tests/purs/sourcemaps/Test123.purs@+-- - Module Name: @SourceMaps.Test123@+-- - File Name: @tests/purs/sourcemaps/Bug1234.purs@+-- - Module Name: @SourceMaps.Bug1234@+goldenFiles :: SpecWith SupportModules+goldenFiles = do+ sourceMapsFiles <- runIO $ getTestFiles "sourcemaps"++ describe "golden files" $+ forM_ sourceMapsFiles $ \inputFiles -> do+ let+ testName = fold+ [ "'"+ , takeFileName (getTestMain inputFiles)+ , "' should compile to expected output and produce a valid source map file"+ ]+ it testName $ \support -> do+ assertCompilesToExpectedValidOutput support inputFiles++assertCompilesToExpectedValidOutput+ :: SupportModules+ -> [FilePath]+ -> Expectation+assertCompilesToExpectedValidOutput support inputFiles = do++ let+ modulePath = getTestMain inputFiles++ (fileContents, (result, _)) <- compile' compilationOptions (Just (IsSourceMap modulePath)) support inputFiles+ let errorOptions = P.defaultPPEOptions { P.ppeFileContents = fileContents }+ case result of+ Left errs -> expectationFailure . P.prettyPrintMultipleErrors errorOptions $ errs+ Right actualSourceMapFile -> do+ let+ readAndDecode :: FilePath -> IO (Maybe Json.Value)+ readAndDecode = fmap (Json.decode . LBS.fromStrict) . BS.readFile+ goldenFile <- readAndDecode $ replaceExtension modulePath ".out.js.map"+ actualFile <- readAndDecode actualSourceMapFile+ goldenFile `shouldBe` actualFile+ sourceMapIsValid actualSourceMapFile++ where+ compilationOptions :: P.Options+ compilationOptions = P.defaultOptions { P.optionsCodegenTargets = Set.fromList [P.JS, P.JSSourceMap] }++-- | Fails the test if the produced source maps are not valid.+sourceMapIsValid :: FilePath -> Expectation+sourceMapIsValid sourceMapFilePath = do+ let+ scriptPath = "tests" </> "support" </> "checkSourceMapValidity" <.> "js"+ void $ readProcess_ (proc "node" [scriptPath, sourceMapFilePath])
+ tests/TestUtils.hs view
@@ -0,0 +1,318 @@+module TestUtils where++import Prelude++import Language.PureScript qualified as P+import Language.PureScript.CST qualified as CST+import Language.PureScript.AST qualified as AST+import Language.PureScript.Names qualified as N+import Language.PureScript.Interactive.IO (findNodeProcess)++import Control.Arrow ((***), (>>>))+import Control.Monad (forM, guard, unless)+import Control.Monad.Reader (MonadIO(..), MonadTrans(..))+import Control.Monad.Trans.Except (ExceptT(..), runExceptT)+import Control.Monad.Trans.Maybe (MaybeT(..))+import Control.Monad.Writer.Class (tell)+import Control.Exception (IOException, catch, throw, throwIO, try, tryJust)+import Data.ByteString (ByteString)+import Data.ByteString qualified as BS+import Data.Char (isSpace)+import Data.Function (on)+import Data.List (sort, sortBy, stripPrefix, groupBy, find)+import Data.Map qualified as M+import Data.Maybe (isJust)+import Data.Text qualified as T+import Data.Text.Encoding qualified as T+import Data.Time.Clock (UTCTime(), diffUTCTime, getCurrentTime, nominalDay)+import Data.Tuple (swap)+import System.Directory (createDirectoryIfMissing, doesDirectoryExist, getCurrentDirectory, getModificationTime, getTemporaryDirectory, listDirectory, setCurrentDirectory, withCurrentDirectory)+import System.Exit (exitFailure)+import System.Environment (lookupEnv)+import System.FilePath (dropExtensions, makeRelative, takeDirectory, takeExtensions, takeFileName, (</>))+import System.IO.Error (isDoesNotExistError)+import System.IO.UTF8 (readUTF8FileT)+import System.Process (callCommand, callProcess)+import System.FilePath.Glob qualified as Glob+import System.IO (Handle, IOMode(..), hPutStrLn, openFile, stderr)+import Test.Hspec (Expectation, HasCallStack, expectationFailure, pendingWith)++-- |+-- Fetches code necessary to run the tests with. The resulting support code+-- should then be checked in, so that npm/bower etc is not required to run the+-- tests.+--+-- Simply rerun this (via ghci is probably easiest) when the support code needs+-- updating.+--+updateSupportCode :: IO ()+updateSupportCode = withCurrentDirectory "tests/support" $ do+ let lastUpdatedFile = ".last_updated"+ skipUpdate <- fmap isJust . runMaybeT $ do+ -- We skip the update if: `.last_updated` exists,+ lastUpdated <- MaybeT $ getModificationTimeMaybe lastUpdatedFile++ -- ... and it was modified less than a day ago (no particular reason why+ -- "one day" specifically),+ now <- lift getCurrentTime+ guard $ now `diffUTCTime` lastUpdated < nominalDay++ -- ... and the needed directories exist,+ contents <- lift $ listDirectory "."+ guard $ "node_modules" `elem` contents && "bower_components" `elem` contents++ -- ... and everything else in `tests/support` is at least as old as+ -- `.last_updated`.+ modTimes <- lift $ traverse getModificationTime . filter (/= lastUpdatedFile) $ contents+ guard $ all (<= lastUpdated) modTimes++ pure ()++ unless skipUpdate $ do+ heading "Updating support code"+ callCommand "npm install"+ -- bower uses shebang "/usr/bin/env node", but we might have nodejs+ node <- either cannotFindNode pure =<< findNodeProcess+ -- Sometimes we run as a root (e.g. in simple docker containers)+ -- And we are non-interactive: https://github.com/bower/bower/issues/1162+ callProcess node ["node_modules/bower/bin/bower", "--allow-root", "install", "--config.interactive=false"]+ writeFile lastUpdatedFile ""+ where+ cannotFindNode :: String -> IO a+ cannotFindNode message = do+ hPutStrLn stderr message+ exitFailure++ getModificationTimeMaybe :: FilePath -> IO (Maybe UTCTime)+ getModificationTimeMaybe f = catch (Just <$> getModificationTime f) $ \case+ e | isDoesNotExistError e -> pure Nothing+ | otherwise -> throw e++ heading msg = do+ putStrLn ""+ putStrLn $ replicate 79 '#'+ putStrLn $ "# " ++ msg+ putStrLn $ replicate 79 '#'+ putStrLn ""++readInput :: [FilePath] -> IO [(FilePath, T.Text)]+readInput inputFiles = forM inputFiles $ \inputFile -> do+ text <- readUTF8FileT inputFile+ return (inputFile, text)++-- |+-- The support modules that should be cached between test cases, to avoid+-- excessive rebuilding.+--+getSupportModuleTuples :: IO [(FilePath, P.Module)]+getSupportModuleTuples = do+ cd <- getCurrentDirectory+ let supportDir = cd </> "tests" </> "support"+ psciFiles <- Glob.globDir1 (Glob.compile "**/*.purs") (supportDir </> "psci")+ libraries <- Glob.globDir1 (Glob.compile "purescript-*/src/**/*.purs") (supportDir </> "bower_components")+ let pursFiles = psciFiles ++ libraries+ fileContents <- readInput pursFiles+ modules <- runExceptT $ ExceptT . return $ CST.parseFromFiles id fileContents+ case modules of+ Right ms -> return (fmap (fmap snd) ms)+ Left errs -> fail (P.prettyPrintMultipleErrors P.defaultPPEOptions errs)++getSupportModuleNames :: IO [T.Text]+getSupportModuleNames = sort . map (P.runModuleName . P.getModuleName . snd) <$> getSupportModuleTuples++pushd :: forall a. FilePath -> IO a -> IO a+pushd dir act = do+ original <- getCurrentDirectory+ setCurrentDirectory dir+ result <- try act :: IO (Either IOException a)+ setCurrentDirectory original+ either throwIO return result+++createOutputFile :: FilePath -> IO Handle+createOutputFile logfileName = do+ tmp <- getTemporaryDirectory+ createDirectoryIfMissing False (tmp </> logpath)+ openFile (tmp </> logpath </> logfileName) WriteMode++data SupportModules = SupportModules+ { supportModules :: [P.Module]+ , supportExterns :: [P.ExternsFile]+ , supportForeigns :: M.Map P.ModuleName FilePath+ }++setupSupportModules :: IO SupportModules+setupSupportModules = do+ ms <- getSupportModuleTuples+ let modules = map snd ms+ supportExterns <- runExceptT $ do+ foreigns <- inferForeignModules ms+ externs <- ExceptT . fmap fst . runTest $ P.make (makeActions modules foreigns) (CST.pureResult <$> modules)+ return (externs, foreigns)+ case supportExterns of+ Left errs -> fail (P.prettyPrintMultipleErrors P.defaultPPEOptions errs)+ Right (externs, foreigns) -> return $ SupportModules modules externs foreigns++getTestFiles :: FilePath -> IO [[FilePath]]+getTestFiles testDir = do+ let dir = "tests" </> "purs" </> testDir+ getFiles dir <$> testGlob dir+ where+ -- A glob for all purs and js files within a test directory+ testGlob :: FilePath -> IO [FilePath]+ testGlob = Glob.globDir1 (Glob.compile "**/*.purs")+ -- Groups the test files so that a top-level file can have dependencies in a+ -- subdirectory of the same name. The inner tuple contains a list of the+ -- .purs files and the .js files for the test case.+ getFiles :: FilePath -> [FilePath] -> [[FilePath]]+ getFiles baseDir+ = map (filter ((== ".purs") . takeExtensions) . map (baseDir </>))+ . groupBy ((==) `on` extractPrefix)+ . sortBy (compare `on` extractPrefix)+ . map (makeRelative baseDir)+ -- Extracts the filename part of a .purs file, or if the file is in a+ -- subdirectory, the first part of that directory path.+ extractPrefix :: FilePath -> FilePath+ extractPrefix fp =+ let dir = takeDirectory fp+ ext = reverse ".purs"+ in if dir == "."+ then maybe fp reverse $ stripPrefix ext $ reverse fp+ else dir++data ExpectedModuleName+ = IsMain+ | IsSourceMap FilePath++compile+ :: Maybe ExpectedModuleName+ -> SupportModules+ -> [FilePath]+ -> IO ([(FilePath, T.Text)], (Either P.MultipleErrors FilePath, P.MultipleErrors))+compile = compile' P.defaultOptions++compile'+ :: P.Options+ -> Maybe ExpectedModuleName+ -> SupportModules+ -> [FilePath]+ -> IO ([(FilePath, T.Text)], (Either P.MultipleErrors FilePath, P.MultipleErrors))+compile' options expectedModule SupportModules{..} inputFiles = do+ -- Sorting the input files makes some messages (e.g., duplicate module) deterministic+ fs <- readInput (sort inputFiles)+ fmap (fs, ) . P.runMake options $ do+ msWithWarnings <- CST.parseFromFiles id fs+ tell $ foldMap (\(fp, (ws, _)) -> CST.toMultipleWarnings fp ws) msWithWarnings+ let ms = fmap snd <$> msWithWarnings+ foreigns <- inferForeignModules ms+ let+ actions = makeActions supportModules (foreigns `M.union` supportForeigns)+ (hasExpectedModuleName, expectedModuleName, compiledModulePath) = case expectedModule of+ -- Check if there is one (and only one) module called "Main"+ Just IsMain ->+ let+ moduleName = "Main"+ compiledPath = modulesDir </> moduleName </> "index.js"+ in ((==) 1 $ length $ filter (== moduleName) $ fmap (T.unpack . getPsModuleName) ms, moduleName, compiledPath)+ -- Check if main sourcemap module starts with "SourceMaps." and matches its file name+ Just (IsSourceMap modulePath) ->+ let+ moduleName = "SourceMaps." <> (dropExtensions . takeFileName $ modulePath)+ compiledPath = modulesDir </> moduleName </> "index.js.map"+ in (maybe False ((==) moduleName . T.unpack . getPsModuleName) (find ((==) modulePath . fst) ms), moduleName, compiledPath)+ Nothing -> (True, mempty, mempty)++ case ms of+ [singleModule] -> do+ unless hasExpectedModuleName $+ error ("While testing a single PureScript file, the expected module name was '" <> expectedModuleName <>+ "' but got '" <> T.unpack (getPsModuleName singleModule) <> "'.")+ compiledModulePath <$ P.rebuildModule actions supportExterns (snd singleModule)+ _ -> do+ unless hasExpectedModuleName $+ error $ "While testing multiple PureScript files, the expected main module was not found: '" <> expectedModuleName <> "'."+ compiledModulePath <$ P.make actions (CST.pureResult <$> supportModules ++ map snd ms)++getPsModuleName :: (a, AST.Module) -> T.Text+getPsModuleName psModule = case snd psModule of+ AST.Module _ _ (N.ModuleName t) _ _ -> t++makeActions :: [P.Module] -> M.Map P.ModuleName FilePath -> P.MakeActions P.Make+makeActions modules foreigns = (P.buildMakeActions modulesDir (P.internalError "makeActions: input file map was read.") foreigns False)+ { P.getInputTimestampsAndHashes = getInputTimestampsAndHashes+ , P.getOutputTimestamp = getOutputTimestamp+ , P.progress = const (pure ())+ }+ where+ getInputTimestampsAndHashes :: P.ModuleName -> P.Make (Either P.RebuildPolicy a)+ getInputTimestampsAndHashes mn+ | isSupportModule (P.runModuleName mn) = return (Left P.RebuildNever)+ | otherwise = return (Left P.RebuildAlways)+ where+ isSupportModule = flip elem (map (P.runModuleName . P.getModuleName) modules)++ getOutputTimestamp :: P.ModuleName -> P.Make (Maybe UTCTime)+ getOutputTimestamp mn = do+ let filePath = modulesDir </> T.unpack (P.runModuleName mn)+ exists <- liftIO $ doesDirectoryExist filePath+ return (if exists then Just (P.internalError "getOutputTimestamp: read timestamp") else Nothing)+++runTest :: P.Make a -> IO (Either P.MultipleErrors a, P.MultipleErrors)+runTest = P.runMake P.defaultOptions++inferForeignModules+ :: MonadIO m+ => [(FilePath, P.Module)]+ -> m (M.Map P.ModuleName FilePath)+inferForeignModules = P.inferForeignModules . fromList+ where+ fromList :: [(FilePath, P.Module)] -> M.Map P.ModuleName (Either P.RebuildPolicy FilePath)+ fromList = M.fromList . map ((P.getModuleName *** Right) . swap)++trim :: String -> String+trim = dropWhile isSpace >>> reverse >>> dropWhile isSpace >>> reverse++modulesDir :: FilePath+modulesDir = ".test_modules"++logpath :: FilePath+logpath = "purescript-output"++-- | Assert that the contents of the provided file path match the result of the+-- provided action. If the "HSPEC_ACCEPT" environment variable is set, or if the+-- file does not already exist, we write the resulting ByteString out to the+-- provided file path instead. However, if the "CI" environment variable is+-- set, "HSPEC_ACCEPT" is ignored and we require that the file does exist with+-- the correct contents (see #3808). Based (very loosely) on the tasty-golden+-- package.+goldenVsString+ :: HasCallStack -- For expectationFailure; use the call site for better failure locations+ => FilePath+ -> IO ByteString+ -> Expectation+goldenVsString goldenFile testAction = do+ accept <- isJust <$> lookupEnv "HSPEC_ACCEPT"+ ci <- isJust <$> lookupEnv "CI"+ goldenContents <- tryJust (guard . isDoesNotExistError) (BS.readFile goldenFile)+ case goldenContents of+ Left () ->+ -- The golden file does not exist+ if ci+ then expectationFailure $ "Missing golden file: " ++ goldenFile+ else createOrReplaceGoldenFile++ Right _ | not ci && accept ->+ createOrReplaceGoldenFile++ Right expected -> do+ actual <- testAction+ if expected == actual+ then pure ()+ else expectationFailure $+ "Test output differed from '" ++ goldenFile ++ "'; got:\n" +++ T.unpack (T.decodeUtf8With (\_ _ -> Just '\xFFFD') actual)+ where+ createOrReplaceGoldenFile = do+ testAction >>= BS.writeFile goldenFile+ pendingWith "Accepting new output"
+ tests/json-compat/v0.11.3/generics-4.0.0.json view
@@ -0,0 +1,1 @@+{"uploader":"paf31","packageMeta":{"homepage":"https://github.com/purescript-contrib/purescript-generics","repository":{"url":"git://github.com/purescript/purescript-generics.git","type":"git"},"ignore":["**/.*","bower_components","node_modules","output","test","bower.json","package.json"],"devDependencies":{"purescript-console":"^3.0.0","purescript-assert":"^3.0.0"},"authors":[{"email":"gershomb@gmail.com","name":"Gershom Bazerman"}],"dependencies":{"purescript-proxy":"^2.0.0","purescript-either":"^3.0.0","purescript-arrays":"^4.0.0","purescript-strings":"^3.0.0","purescript-identity":"^3.0.0","purescript-lists":"^4.0.0"},"name":"purescript-generics","license":["MIT"],"description":"Generic programming for PureScript"},"tagTime":"2017-03-26T22:17:38+0000","modules":[{"reExports":[],"name":"Data.Generic","comments":null,"declarations":[{"children":[{"comments":null,"title":"toSpine","info":{"declType":"typeClassMember","type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeVar","contents":"a"}]},{"tag":"TypeConstructor","contents":[["Data","Generic"],"GenericSpine"]}]}},"sourceSpan":null},{"comments":null,"title":"toSignature","info":{"declType":"typeClassMember","type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"tag":"TypeVar","contents":"a"}]}]},{"tag":"TypeConstructor","contents":[["Data","Generic"],"GenericSignature"]}]}},"sourceSpan":null},{"comments":null,"title":"fromSpine","info":{"declType":"typeClassMember","type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeConstructor","contents":[["Data","Generic"],"GenericSpine"]}]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Maybe"],"Maybe"]},{"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":null},{"comments":null,"title":"genericNumber","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Generic"],"Generic"]},{"tag":"TypeConstructor","contents":[["Prim"],"Number"]}]}},"sourceSpan":{"start":[44,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[48,24]}},{"comments":null,"title":"genericInt","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Generic"],"Generic"]},{"tag":"TypeConstructor","contents":[["Prim"],"Int"]}]}},"sourceSpan":{"start":[50,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[54,24]}},{"comments":null,"title":"genericString","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Generic"],"Generic"]},{"tag":"TypeConstructor","contents":[["Prim"],"String"]}]}},"sourceSpan":{"start":[56,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[60,24]}},{"comments":null,"title":"genericChar","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Generic"],"Generic"]},{"tag":"TypeConstructor","contents":[["Prim"],"Char"]}]}},"sourceSpan":{"start":[62,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[66,24]}},{"comments":null,"title":"genericBool","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Generic"],"Generic"]},{"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}},"sourceSpan":{"start":[68,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[72,24]}},{"comments":null,"title":"genericArray","info":{"declType":"instance","dependencies":[{"constraintClass":[["Data","Generic"],"Generic"],"constraintArgs":[{"tag":"TypeVar","contents":"a"}],"constraintData":null}],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Generic"],"Generic"]},{"tag":"ParensInType","contents":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Array"]},{"tag":"TypeVar","contents":"a"}]}}]}},"sourceSpan":{"start":[74,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[81,24]}},{"comments":null,"title":"genericUnit","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Generic"],"Generic"]},{"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}},"sourceSpan":{"start":[83,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[87,24]}},{"comments":null,"title":"genericVoid","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Generic"],"Generic"]},{"tag":"TypeConstructor","contents":[["Data","Void"],"Void"]}]}},"sourceSpan":{"start":[89,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[92,24]}},{"comments":null,"title":"genericTuple","info":{"declType":"instance","dependencies":[{"constraintClass":[["Data","Generic"],"Generic"],"constraintArgs":[{"tag":"TypeVar","contents":"a"}],"constraintData":null},{"constraintClass":[["Data","Generic"],"Generic"],"constraintArgs":[{"tag":"TypeVar","contents":"b"}],"constraintData":null}],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Generic"],"Generic"]},{"tag":"ParensInType","contents":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Tuple"],"Tuple"]},{"tag":"TypeVar","contents":"a"}]},{"tag":"TypeVar","contents":"b"}]}}]}},"sourceSpan":{"start":[94,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[114,24]}},{"comments":null,"title":"genericList","info":{"declType":"instance","dependencies":[{"constraintClass":[["Data","Generic"],"Generic"],"constraintArgs":[{"tag":"TypeVar","contents":"a"}],"constraintData":null}],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Generic"],"Generic"]},{"tag":"ParensInType","contents":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","List","Types"],"List"]},{"tag":"TypeVar","contents":"a"}]}}]}},"sourceSpan":{"start":[116,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[141,24]}},{"comments":null,"title":"genericNonEmptyList","info":{"declType":"instance","dependencies":[{"constraintClass":[["Data","Generic"],"Generic"],"constraintArgs":[{"tag":"TypeVar","contents":"a"}],"constraintData":null}],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Generic"],"Generic"]},{"tag":"ParensInType","contents":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","List","Types"],"NonEmptyList"]},{"tag":"TypeVar","contents":"a"}]}}]}},"sourceSpan":{"start":[143,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[158,24]}},{"comments":null,"title":"genericMaybe","info":{"declType":"instance","dependencies":[{"constraintClass":[["Data","Generic"],"Generic"],"constraintArgs":[{"tag":"TypeVar","contents":"a"}],"constraintData":null}],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Generic"],"Generic"]},{"tag":"ParensInType","contents":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Maybe"],"Maybe"]},{"tag":"TypeVar","contents":"a"}]}}]}},"sourceSpan":{"start":[160,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[178,24]}},{"comments":null,"title":"genericEither","info":{"declType":"instance","dependencies":[{"constraintClass":[["Data","Generic"],"Generic"],"constraintArgs":[{"tag":"TypeVar","contents":"a"}],"constraintData":null},{"constraintClass":[["Data","Generic"],"Generic"],"constraintArgs":[{"tag":"TypeVar","contents":"b"}],"constraintData":null}],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Generic"],"Generic"]},{"tag":"ParensInType","contents":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Either"],"Either"]},{"tag":"TypeVar","contents":"a"}]},{"tag":"TypeVar","contents":"b"}]}}]}},"sourceSpan":{"start":[180,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[200,24]}},{"comments":null,"title":"genericIdentity","info":{"declType":"instance","dependencies":[{"constraintClass":[["Data","Generic"],"Generic"],"constraintArgs":[{"tag":"TypeVar","contents":"a"}],"constraintData":null}],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Generic"],"Generic"]},{"tag":"ParensInType","contents":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Identity"],"Identity"]},{"tag":"TypeVar","contents":"a"}]}}]}},"sourceSpan":{"start":[202,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[215,24]}},{"comments":null,"title":"genericOrdering","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Generic"],"Generic"]},{"tag":"TypeConstructor","contents":[["Data","Ordering"],"Ordering"]}]}},"sourceSpan":{"start":[217,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[233,17]}},{"comments":null,"title":"genericNonEmpty","info":{"declType":"instance","dependencies":[{"constraintClass":[["Data","Generic"],"Generic"],"constraintArgs":[{"tag":"ParensInType","contents":{"tag":"TypeApp","contents":[{"tag":"TypeVar","contents":"f"},{"tag":"TypeVar","contents":"a"}]}}],"constraintData":null},{"constraintClass":[["Data","Generic"],"Generic"],"constraintArgs":[{"tag":"TypeVar","contents":"a"}],"constraintData":null}],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Generic"],"Generic"]},{"tag":"ParensInType","contents":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","NonEmpty"],"NonEmpty"]},{"tag":"TypeVar","contents":"f"}]},{"tag":"TypeVar","contents":"a"}]}}]}},"sourceSpan":{"start":[235,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[255,24]}}],"comments":"The Generic typeclass provides methods for sending data to/from spine\nrepresentations, as well as querying about the signatures of spine\nrepresentations.\n\nFor standard data structures, you can simply write\n`derive instance genericFoo :: Generic Foo` in the module they are\ndeclared, and the instance methods will be filled in for you.\n","title":"Generic","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[39,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[42,39]}},{"children":[{"comments":null,"title":"SProd","info":{"arguments":[{"tag":"TypeConstructor","contents":[["Prim"],"String"]},{"tag":"ParensInType","contents":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Array"]},{"tag":"ParensInType","contents":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]},{"tag":"TypeConstructor","contents":[["Data","Generic"],"GenericSpine"]}]}}]}}],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"SRecord","info":{"arguments":[{"tag":"ParensInType","contents":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Array"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"tag":"RCons","contents":["recLabel",{"tag":"TypeConstructor","contents":[["Prim"],"String"]},{"tag":"RCons","contents":["recValue",{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]},{"tag":"TypeConstructor","contents":[["Data","Generic"],"GenericSpine"]}]},{"tag":"REmpty"}]}]}]}]}}],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"SNumber","info":{"arguments":[{"tag":"TypeConstructor","contents":[["Prim"],"Number"]}],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"SBoolean","info":{"arguments":[{"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"SInt","info":{"arguments":[{"tag":"TypeConstructor","contents":[["Prim"],"Int"]}],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"SString","info":{"arguments":[{"tag":"TypeConstructor","contents":[["Prim"],"String"]}],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"SChar","info":{"arguments":[{"tag":"TypeConstructor","contents":[["Prim"],"Char"]}],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"SArray","info":{"arguments":[{"tag":"ParensInType","contents":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Array"]},{"tag":"ParensInType","contents":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]},{"tag":"TypeConstructor","contents":[["Data","Generic"],"GenericSpine"]}]}}]}}],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"SUnit","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"showGenericSpine","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"tag":"TypeConstructor","contents":[["Data","Generic"],"GenericSpine"]}]}},"sourceSpan":{"start":[270,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[284,97]}},{"comments":null,"title":"eqGenericSpine","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq"]},{"tag":"TypeConstructor","contents":[["Data","Generic"],"GenericSpine"]}]}},"sourceSpan":{"start":[290,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[301,17]}},{"comments":null,"title":"ordGenericSpine","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"tag":"TypeConstructor","contents":[["Data","Generic"],"GenericSpine"]}]}},"sourceSpan":{"start":[303,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[336,27]}}],"comments":"A GenericSpine is a universal representation of an arbitrary data\nstructure (that does not contain function arrows).\n","title":"GenericSpine","info":{"declType":"data","dataDeclType":"data","typeArguments":[]},"sourceSpan":{"start":[259,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[268,10]}},{"children":[{"comments":null,"title":"SigProd","info":{"arguments":[{"tag":"TypeConstructor","contents":[["Prim"],"String"]},{"tag":"ParensInType","contents":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Array"]},{"tag":"TypeConstructor","contents":[["Data","Generic"],"DataConstructor"]}]}}],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"SigRecord","info":{"arguments":[{"tag":"ParensInType","contents":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Array"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"tag":"RCons","contents":["recLabel",{"tag":"TypeConstructor","contents":[["Prim"],"String"]},{"tag":"RCons","contents":["recValue",{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]},{"tag":"TypeConstructor","contents":[["Data","Generic"],"GenericSignature"]}]},{"tag":"REmpty"}]}]}]}]}}],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"SigNumber","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"SigBoolean","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"SigInt","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"SigString","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"SigChar","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"SigArray","info":{"arguments":[{"tag":"ParensInType","contents":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]},{"tag":"TypeConstructor","contents":[["Data","Generic"],"GenericSignature"]}]}}],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"SigUnit","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"eqGenericSignature","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq"]},{"tag":"TypeConstructor","contents":[["Data","Generic"],"GenericSignature"]}]}},"sourceSpan":{"start":[351,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[362,17]}},{"comments":null,"title":"showGenericSignature","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"tag":"TypeConstructor","contents":[["Data","Generic"],"GenericSignature"]}]}},"sourceSpan":{"start":[364,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[365,23]}}],"comments":"A GenericSignature is a universal representation of the structure of an\narbitrary data structure (that does not contain function arrows).\n","title":"GenericSignature","info":{"declType":"data","dataDeclType":"data","typeArguments":[]},"sourceSpan":{"start":[340,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[349,12]}},{"children":[],"comments":"Identifies a data constructor.\n","title":"DataConstructor","info":{"arguments":[],"declType":"typeSynonym","type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"tag":"RCons","contents":["sigConstructor",{"tag":"TypeConstructor","contents":[["Prim"],"String"]},{"tag":"RCons","contents":["sigValues",{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Array"]},{"tag":"ParensInType","contents":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]},{"tag":"TypeConstructor","contents":[["Data","Generic"],"GenericSignature"]}]}}]},{"tag":"REmpty"}]}]}]}},"sourceSpan":{"start":[368,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[371,4]}},{"children":[],"comments":null,"title":"showDataConstructor","info":{"declType":"value","type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeConstructor","contents":[["Data","Generic"],"DataConstructor"]}]},{"tag":"TypeConstructor","contents":[["Prim"],"String"]}]}},"sourceSpan":{"start":[378,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[378,49]}},{"children":[],"comments":null,"title":"showSignature","info":{"declType":"value","type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeConstructor","contents":[["Data","Generic"],"GenericSignature"]}]},{"tag":"TypeConstructor","contents":[["Prim"],"String"]}]}},"sourceSpan":{"start":[384,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[384,44]}},{"children":[],"comments":"Checks that the spine follows the structure defined by the signature\n","title":"isValidSpine","info":{"declType":"value","type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeConstructor","contents":[["Data","Generic"],"GenericSignature"]}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeConstructor","contents":[["Data","Generic"],"GenericSpine"]}]},{"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}]}},"sourceSpan":{"start":[429,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[429,60]}},{"children":[],"comments":"This function can be used as the default instance for Show for any\ninstance of Generic\n","title":"gShow","info":{"declType":"value","type":{"tag":"ForAll","contents":["a",{"tag":"ConstrainedType","contents":[{"constraintClass":[["Data","Generic"],"Generic"],"constraintArgs":[{"tag":"TypeVar","contents":"a"}],"constraintData":null},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeVar","contents":"a"}]},{"tag":"TypeConstructor","contents":[["Prim"],"String"]}]}]},null]}},"sourceSpan":{"start":[457,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[457,44]}},{"children":[],"comments":"This function can be used as an implementation of the `eq` function of `Eq`\nfor any type with a `Generic` instance.\n\n**Note**: It is preferrable to use `derive instance` for `Eq` instances\nrather than relying on `gEq`, where possible.\n","title":"gEq","info":{"declType":"value","type":{"tag":"ForAll","contents":["a",{"tag":"ConstrainedType","contents":[{"constraintClass":[["Data","Generic"],"Generic"],"constraintArgs":[{"tag":"TypeVar","contents":"a"}],"constraintData":null},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeVar","contents":"a"}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeVar","contents":"a"}]},{"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}]}]},null]}},"sourceSpan":{"start":[487,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[487,48]}},{"children":[],"comments":"This function can be used as an implementation of the `compare` function\nof `Ord` for any type with a `Generic` instance.\n\n**Note**: It is preferrable to use `derive instance` for `Ord` instances\nrather than relying on `gCompare`, where possible.\n","title":"gCompare","info":{"declType":"value","type":{"tag":"ForAll","contents":["a",{"tag":"ConstrainedType","contents":[{"constraintClass":[["Data","Generic"],"Generic"],"constraintArgs":[{"tag":"TypeVar","contents":"a"}],"constraintData":null},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeVar","contents":"a"}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeVar","contents":"a"}]},{"tag":"TypeConstructor","contents":[["Data","Ordering"],"Ordering"]}]}]}]},null]}},"sourceSpan":{"start":[495,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/generics/v4.0.0/src/Data/Generic.purs","end":[495,54]}}]}],"resolvedDependencies":{"purescript-proxy":"2.0.0","purescript-newtype":"2.0.0","purescript-control":"3.0.0","purescript-either":"3.0.0","purescript-arrays":"4.0.1","purescript-maybe":"3.0.0","purescript-unfoldable":"3.0.0","purescript-invariant":"3.0.0","purescript-lazy":"3.0.0","purescript-monoid":"3.0.0","purescript-foldable-traversable":"3.0.0","purescript-tailrec":"3.0.0","purescript-prelude":"3.0.0","purescript-st":"3.0.0","purescript-bifunctors":"3.0.0","purescript-nonempty":"4.0.0","purescript-unsafe-coerce":"3.0.0","purescript-eff":"3.1.0","purescript-tuples":"4.0.0","purescript-partial":"1.2.0","purescript-strings":"3.0.0","purescript-identity":"3.0.0","purescript-lists":"4.0.1"},"version":"4.0.0","github":["purescript","purescript-generics"],"versionTag":"v4.0.0","moduleMap":{"Data.BooleanAlgebra":"purescript-prelude","Data.Ring":"purescript-prelude","Data.NonEmpty":"purescript-nonempty","Control.Monad.Eff.Unsafe":"purescript-eff","Data.Bifunctor.Flip":"purescript-bifunctors","Data.Ord":"purescript-prelude","Data.Monoid.Dual":"purescript-monoid","Control.Monad.Rec.Class":"purescript-tailrec","Data.Bitraversable":"purescript-foldable-traversable","Data.Boolean":"purescript-prelude","Control.Biapplicative":"purescript-bifunctors","Type.Proxy":"purescript-proxy","Data.Array.ST.Iterator":"purescript-arrays","Data.Bounded":"purescript-prelude","Data.Show":"purescript-prelude","Data.Bifunctor.Clown":"purescript-bifunctors","Data.Foldable":"purescript-foldable-traversable","Control.Apply":"purescript-prelude","Data.Tuple.Nested":"purescript-tuples","Control.Monad":"purescript-prelude","Data.Lazy":"purescript-lazy","Data.Monoid":"purescript-monoid","Control.Monad.Eff.Uncurried":"purescript-eff","Data.Maybe.First":"purescript-maybe","Control.Bind":"purescript-prelude","Data.Monoid.Additive":"purescript-monoid","Data.String.Regex":"purescript-strings","Data.HeytingAlgebra":"purescript-prelude","Control.Alt":"purescript-control","Data.List.ZipList":"purescript-lists","Data.Ord.Unsafe":"purescript-prelude","Data.Semigroup":"purescript-prelude","Control.Monad.Eff":"purescript-eff","Data.Tuple":"purescript-tuples","Control.Biapply":"purescript-bifunctors","Control.Alternative":"purescript-control","Data.Semiring":"purescript-prelude","Data.CommutativeRing":"purescript-prelude","Data.NaturalTransformation":"purescript-prelude","Data.Monoid.Conj":"purescript-monoid","Data.Unfoldable":"purescript-unfoldable","Control.Monad.ST":"purescript-st","Data.List.Types":"purescript-lists","Data.Functor":"purescript-prelude","Unsafe.Coerce":"purescript-unsafe-coerce","Data.List.Lazy.Types":"purescript-lists","Control.Category":"purescript-prelude","Data.Maybe":"purescript-maybe","Data.String.Regex.Unsafe":"purescript-strings","Control.Comonad":"purescript-control","Data.Function":"purescript-prelude","Data.List":"purescript-lists","Data.Field":"purescript-prelude","Data.List.Lazy":"purescript-lists","Data.EuclideanRing":"purescript-prelude","Data.Functor.Invariant":"purescript-invariant","Data.String.Unsafe":"purescript-strings","Prelude":"purescript-prelude","Partial.Unsafe":"purescript-partial","Data.Array":"purescript-arrays","Data.Bifunctor.Product":"purescript-bifunctors","Control.Extend":"purescript-control","Control.Lazy":"purescript-control","Data.Eq":"purescript-prelude","Data.Either.Nested":"purescript-either","Data.Newtype":"purescript-newtype","Data.Bifunctor":"purescript-bifunctors","Data.Monoid.Disj":"purescript-monoid","Data.Array.Partial":"purescript-arrays","Data.String.CaseInsensitive":"purescript-strings","Control.MonadPlus":"purescript-control","Data.Void":"purescript-prelude","Control.MonadZero":"purescript-control","Data.Bifunctor.Joker":"purescript-bifunctors","Data.Bifunctor.Wrap":"purescript-bifunctors","Data.Maybe.Last":"purescript-maybe","Data.Unit":"purescript-prelude","Data.List.NonEmpty":"purescript-lists","Data.List.Lazy.NonEmpty":"purescript-lists","Data.Ordering":"purescript-prelude","Data.Identity":"purescript-identity","Data.String":"purescript-strings","Control.Plus":"purescript-control","Control.Monad.Eff.Class":"purescript-eff","Partial":"purescript-partial","Data.Monoid.Multiplicative":"purescript-monoid","Data.Array.ST":"purescript-arrays","Control.Semigroupoid":"purescript-prelude","Data.Monoid.Alternate":"purescript-monoid","Data.Char":"purescript-strings","Data.Bifunctor.Join":"purescript-bifunctors","Data.Bifoldable":"purescript-foldable-traversable","Data.Monoid.Endo":"purescript-monoid","Data.List.Partial":"purescript-lists","Data.String.Regex.Flags":"purescript-strings","Data.Either":"purescript-either","Control.Applicative":"purescript-prelude","Data.Traversable":"purescript-foldable-traversable"},"compilerVersion":"0.11.3"}
+ tests/json-compat/v0.11.3/symbols-3.0.0.json view
@@ -0,0 +1,1 @@+{"uploader":"paf31","packageMeta":{"homepage":"https://github.com/purescript/purescript-symbols","repository":{"url":"git://github.com/purescript/purescript-symbols.git","type":"git"},"ignore":["**/.*","bower_components","node_modules","output","test","bower.json","package.json"],"dependencies":{"purescript-prelude":"^3.0.0","purescript-unsafe-coerce":"^3.0.0"},"name":"purescript-symbols","license":["MIT"],"description":"Utilities for working with type-level strings"},"tagTime":"2017-03-26T00:59:23+0000","modules":[{"reExports":[],"name":"Data.Symbol","comments":null,"declarations":[{"children":[{"comments":null,"title":"SProxy","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null}],"comments":"A value-level proxy for a type-level symbol.\n","title":"SProxy","info":{"declType":"data","dataDeclType":"data","typeArguments":[["sym",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}]]},"sourceSpan":{"start":[12,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/symbols/v3.0.0/src/Data/Symbol.purs","end":[12,37]}},{"children":[{"comments":null,"title":"reflectSymbol","info":{"declType":"typeClassMember","type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"sym"}]}]},{"tag":"TypeConstructor","contents":[["Prim"],"String"]}]}},"sourceSpan":null},{"comments":null,"title":"isSymbolTypeConcat","info":{"declType":"instance","dependencies":[{"constraintClass":[["Data","Symbol"],"IsSymbol"],"constraintArgs":[{"tag":"TypeVar","contents":"left"}],"constraintData":null},{"constraintClass":[["Data","Symbol"],"IsSymbol"],"constraintArgs":[{"tag":"TypeVar","contents":"right"}],"constraintData":null}],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"IsSymbol"]},{"tag":"ParensInType","contents":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"TypeConcat"]},{"tag":"TypeVar","contents":"left"}]},{"tag":"TypeVar","contents":"right"}]}}]}},"sourceSpan":{"start":[18,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/symbols/v3.0.0/src/Data/Symbol.purs","end":[19,100]}}],"comments":"A class for known symbols\n","title":"IsSymbol","info":{"fundeps":[],"arguments":[["sym",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[15,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/symbols/v3.0.0/src/Data/Symbol.purs","end":[16,40]}},{"children":[],"comments":null,"title":"reifySymbol","info":{"declType":"value","type":{"tag":"ForAll","contents":["r",{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeConstructor","contents":[["Prim"],"String"]}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"ParensInType","contents":{"tag":"ForAll","contents":["sym",{"tag":"ConstrainedType","contents":[{"constraintClass":[["Data","Symbol"],"IsSymbol"],"constraintArgs":[{"tag":"TypeVar","contents":"sym"}],"constraintData":null},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"sym"}]}]},{"tag":"TypeVar","contents":"r"}]}]},null]}}]},{"tag":"TypeVar","contents":"r"}]}]},null]}},"sourceSpan":{"start":[21,1],"name":"/private/tmp/pursuit-staging/.psc-package/psc-0.11.3/symbols/v3.0.0/src/Data/Symbol.purs","end":[21,86]}}]}],"resolvedDependencies":{"purescript-prelude":"3.0.0","purescript-unsafe-coerce":"3.0.0"},"version":"3.0.0","github":["purescript","purescript-symbols"],"versionTag":"v3.0.0","moduleMap":{"Data.BooleanAlgebra":"purescript-prelude","Data.Ring":"purescript-prelude","Data.Ord":"purescript-prelude","Data.Boolean":"purescript-prelude","Data.Bounded":"purescript-prelude","Data.Show":"purescript-prelude","Control.Apply":"purescript-prelude","Control.Monad":"purescript-prelude","Control.Bind":"purescript-prelude","Data.HeytingAlgebra":"purescript-prelude","Data.Ord.Unsafe":"purescript-prelude","Data.Semigroup":"purescript-prelude","Data.Semiring":"purescript-prelude","Data.CommutativeRing":"purescript-prelude","Data.NaturalTransformation":"purescript-prelude","Data.Functor":"purescript-prelude","Unsafe.Coerce":"purescript-unsafe-coerce","Control.Category":"purescript-prelude","Data.Function":"purescript-prelude","Data.Field":"purescript-prelude","Data.EuclideanRing":"purescript-prelude","Prelude":"purescript-prelude","Data.Eq":"purescript-prelude","Data.Void":"purescript-prelude","Data.Unit":"purescript-prelude","Data.Ordering":"purescript-prelude","Control.Semigroupoid":"purescript-prelude","Control.Applicative":"purescript-prelude"},"compilerVersion":"0.11.3"}
+ tests/json-compat/v0.12.1/typelevel-prelude-3.0.0.json view
@@ -0,0 +1,1 @@+{"uploader":"hdgarrood","packageMeta":{"homepage":"https://github.com/purescript/purescript-typelevel-prelude","repository":{"url":"git://github.com/purescript/purescript-typelevel-prelude.git","type":"git"},"ignore":["**/.*","bower_components","node_modules","output","bower.json","package.json"],"dependencies":{"purescript-proxy":"^3.0.0","purescript-type-equality":"^3.0.0","purescript-prelude":"^4.0.0"},"name":"purescript-typelevel-prelude","license":["BSD-3-Clause"],"description":"Types and kinds for basic type-level programming"},"tagTime":"2018-05-22T23:33:44+0000","modules":[{"reExports":[],"name":"Type.Data.Boolean","comments":null,"declarations":[{"children":[],"comments":null,"title":"Boolean","info":{"declType":"kind"},"sourceSpan":{"start":[21,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[21,28]}},{"children":[{"comments":null,"title":"isBooleanTrue","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"IsBoolean"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]}},"sourceSpan":{"start":[32,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[32,41]}},{"comments":null,"title":"andTrue","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"And"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]},{"tag":"TypeVar","contents":"rhs"}]},{"tag":"TypeVar","contents":"rhs"}]}},"sourceSpan":{"start":[45,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[45,37]}},{"comments":null,"title":"orTrue","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"Or"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]},{"tag":"TypeVar","contents":"rhs"}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]}},"sourceSpan":{"start":[56,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[56,36]}},{"comments":null,"title":"notTrue","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"Not"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]}},"sourceSpan":{"start":[66,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[66,35]}},{"comments":null,"title":"notFalse","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"Not"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]}},"sourceSpan":{"start":[67,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[67,36]}},{"comments":null,"title":"ifTrue","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"If"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]},{"tag":"TypeVar","contents":"onTrue"}]},{"tag":"TypeVar","contents":"onFalse"}]},{"tag":"TypeVar","contents":"onTrue"}]}},"sourceSpan":{"start":[78,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[78,49]}}],"comments":null,"title":"True","info":{"kind":{"tag":"NamedKind","contents":[["Type","Data","Boolean"],"Boolean"]},"declType":"externData"},"sourceSpan":{"start":[22,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[22,36]}},{"children":[{"comments":null,"title":"isBooleanFalse","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"IsBoolean"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]}},"sourceSpan":{"start":[33,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[33,43]}},{"comments":null,"title":"andFalse","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"And"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]},{"tag":"TypeVar","contents":"rhs"}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]}},"sourceSpan":{"start":[46,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[46,41]}},{"comments":null,"title":"orFalse","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"Or"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]},{"tag":"TypeVar","contents":"rhs"}]},{"tag":"TypeVar","contents":"rhs"}]}},"sourceSpan":{"start":[57,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[57,37]}},{"comments":null,"title":"notTrue","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"Not"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]}},"sourceSpan":{"start":[66,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[66,35]}},{"comments":null,"title":"notFalse","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"Not"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]}},"sourceSpan":{"start":[67,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[67,36]}},{"comments":null,"title":"ifFalse","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"If"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]},{"tag":"TypeVar","contents":"onTrue"}]},{"tag":"TypeVar","contents":"onFalse"}]},{"tag":"TypeVar","contents":"onFalse"}]}},"sourceSpan":{"start":[79,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[79,52]}}],"comments":null,"title":"False","info":{"kind":{"tag":"NamedKind","contents":[["Type","Data","Boolean"],"Boolean"]},"declType":"externData"},"sourceSpan":{"start":[23,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[23,37]}},{"children":[{"comments":null,"title":"BProxy","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null}],"comments":"Value proxy for `Boolean` types\n","title":"BProxy","info":{"declType":"data","dataDeclType":"data","typeArguments":[["bool",{"tag":"NamedKind","contents":[["Type","Data","Boolean"],"Boolean"]}]]},"sourceSpan":{"start":[26,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[26,39]}},{"children":[{"comments":null,"title":"reflectBoolean","info":{"declType":"typeClassMember","type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"BProxy"]},{"tag":"TypeVar","contents":"bool"}]}]},{"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}},"sourceSpan":{"start":[30,3],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[30,43]}},{"comments":null,"title":"isBooleanTrue","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"IsBoolean"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]}},"sourceSpan":{"start":[32,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[32,41]}},{"comments":null,"title":"isBooleanFalse","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"IsBoolean"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]}},"sourceSpan":{"start":[33,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[33,43]}}],"comments":"Class for reflecting a type level `Boolean` at the value level\n","title":"IsBoolean","info":{"fundeps":[],"arguments":[["bool",{"tag":"NamedKind","contents":[["Type","Data","Boolean"],"Boolean"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[29,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[30,43]}},{"children":[],"comments":"Use a value level `Boolean` as a type-level `Boolean`\n","title":"reifyBoolean","info":{"declType":"value","type":{"tag":"ForAll","contents":["r",{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"ParensInType","contents":{"tag":"ForAll","contents":["o",{"tag":"ConstrainedType","contents":[{"constraintClass":[["Type","Data","Boolean"],"IsBoolean"],"constraintArgs":[{"tag":"TypeVar","contents":"o"}],"constraintData":null},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"BProxy"]},{"tag":"TypeVar","contents":"o"}]}]},{"tag":"TypeVar","contents":"r"}]}]},null]}}]},{"tag":"TypeVar","contents":"r"}]}]},null]}},"sourceSpan":{"start":[36,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[36,83]}},{"children":[{"comments":null,"title":"andTrue","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"And"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]},{"tag":"TypeVar","contents":"rhs"}]},{"tag":"TypeVar","contents":"rhs"}]}},"sourceSpan":{"start":[45,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[45,37]}},{"comments":null,"title":"andFalse","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"And"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]},{"tag":"TypeVar","contents":"rhs"}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]}},"sourceSpan":{"start":[46,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[46,41]}}],"comments":"And two `Boolean` types together\n","title":"And","info":{"fundeps":[[["lhs","rhs"],["output"]]],"arguments":[["lhs",{"tag":"NamedKind","contents":[["Type","Data","Boolean"],"Boolean"]}],["rhs",{"tag":"NamedKind","contents":[["Type","Data","Boolean"],"Boolean"]}],["output",{"tag":"NamedKind","contents":[["Type","Data","Boolean"],"Boolean"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[41,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[44,28]}},{"children":[],"comments":null,"title":"and","info":{"declType":"value","type":{"tag":"ForAll","contents":["o",{"tag":"ForAll","contents":["r",{"tag":"ForAll","contents":["l",{"tag":"ConstrainedType","contents":[{"constraintClass":[["Type","Data","Boolean"],"And"],"constraintArgs":[{"tag":"TypeVar","contents":"l"},{"tag":"TypeVar","contents":"r"},{"tag":"TypeVar","contents":"o"}],"constraintData":null},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"BProxy"]},{"tag":"TypeVar","contents":"l"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"BProxy"]},{"tag":"TypeVar","contents":"r"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"BProxy"]},{"tag":"TypeVar","contents":"o"}]}]}]}]},null]},null]},null]}},"sourceSpan":{"start":[48,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[48,67]}},{"children":[{"comments":null,"title":"orTrue","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"Or"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]},{"tag":"TypeVar","contents":"rhs"}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]}},"sourceSpan":{"start":[56,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[56,36]}},{"comments":null,"title":"orFalse","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"Or"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]},{"tag":"TypeVar","contents":"rhs"}]},{"tag":"TypeVar","contents":"rhs"}]}},"sourceSpan":{"start":[57,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[57,37]}}],"comments":"Or two `Boolean` types together\n","title":"Or","info":{"fundeps":[[["lhs","rhs"],["output"]]],"arguments":[["lhs",{"tag":"NamedKind","contents":[["Type","Data","Boolean"],"Boolean"]}],["rhs",{"tag":"NamedKind","contents":[["Type","Data","Boolean"],"Boolean"]}],["output",{"tag":"NamedKind","contents":[["Type","Data","Boolean"],"Boolean"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[52,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[55,27]}},{"children":[],"comments":null,"title":"or","info":{"declType":"value","type":{"tag":"ForAll","contents":["o",{"tag":"ForAll","contents":["r",{"tag":"ForAll","contents":["l",{"tag":"ConstrainedType","contents":[{"constraintClass":[["Type","Data","Boolean"],"Or"],"constraintArgs":[{"tag":"TypeVar","contents":"l"},{"tag":"TypeVar","contents":"r"},{"tag":"TypeVar","contents":"o"}],"constraintData":null},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"BProxy"]},{"tag":"TypeVar","contents":"l"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"BProxy"]},{"tag":"TypeVar","contents":"r"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"BProxy"]},{"tag":"TypeVar","contents":"o"}]}]}]}]},null]},null]},null]}},"sourceSpan":{"start":[59,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[59,65]}},{"children":[{"comments":null,"title":"notTrue","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"Not"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]}},"sourceSpan":{"start":[66,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[66,35]}},{"comments":null,"title":"notFalse","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"Not"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]}},"sourceSpan":{"start":[67,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[67,36]}}],"comments":"Not a `Boolean`\n","title":"Not","info":{"fundeps":[[["bool"],["output"]]],"arguments":[["bool",{"tag":"NamedKind","contents":[["Type","Data","Boolean"],"Boolean"]}],["output",{"tag":"NamedKind","contents":[["Type","Data","Boolean"],"Boolean"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[63,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[65,25]}},{"children":[],"comments":null,"title":"not","info":{"declType":"value","type":{"tag":"ForAll","contents":["o",{"tag":"ForAll","contents":["i",{"tag":"ConstrainedType","contents":[{"constraintClass":[["Type","Data","Boolean"],"Not"],"constraintArgs":[{"tag":"TypeVar","contents":"i"},{"tag":"TypeVar","contents":"o"}],"constraintData":null},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"BProxy"]},{"tag":"TypeVar","contents":"i"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"BProxy"]},{"tag":"TypeVar","contents":"o"}]}]}]},null]},null]}},"sourceSpan":{"start":[69,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[69,51]}},{"children":[{"comments":null,"title":"ifTrue","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"If"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]},{"tag":"TypeVar","contents":"onTrue"}]},{"tag":"TypeVar","contents":"onFalse"}]},{"tag":"TypeVar","contents":"onTrue"}]}},"sourceSpan":{"start":[78,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[78,49]}},{"comments":null,"title":"ifFalse","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"If"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]},{"tag":"TypeVar","contents":"onTrue"}]},{"tag":"TypeVar","contents":"onFalse"}]},{"tag":"TypeVar","contents":"onFalse"}]}},"sourceSpan":{"start":[79,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[79,52]}}],"comments":"If - dispatch based on a boolean\n","title":"If","info":{"fundeps":[[["bool","onTrue","onFalse"],["output"]]],"arguments":[["bool",{"tag":"NamedKind","contents":[["Type","Data","Boolean"],"Boolean"]}],["onTrue",{"tag":"NamedKind","contents":[["Prim"],"Type"]}],["onFalse",{"tag":"NamedKind","contents":[["Prim"],"Type"]}],["output",{"tag":"NamedKind","contents":[["Prim"],"Type"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[73,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[77,39]}},{"children":[],"comments":null,"title":"if_","info":{"declType":"value","type":{"tag":"ForAll","contents":["o",{"tag":"ForAll","contents":["e",{"tag":"ForAll","contents":["t",{"tag":"ForAll","contents":["b",{"tag":"ConstrainedType","contents":[{"constraintClass":[["Type","Data","Boolean"],"If"],"constraintArgs":[{"tag":"TypeVar","contents":"b"},{"tag":"TypeVar","contents":"t"},{"tag":"TypeVar","contents":"e"},{"tag":"TypeVar","contents":"o"}],"constraintData":null},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"BProxy"]},{"tag":"TypeVar","contents":"b"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"tag":"TypeVar","contents":"t"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"tag":"TypeVar","contents":"e"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"tag":"TypeVar","contents":"o"}]}]}]}]}]},null]},null]},null]},null]}},"sourceSpan":{"start":[81,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[81,79]}}]},{"reExports":[{"moduleName":{"package":null,"item":["Prim","Ordering"]},"declarations":[{"children":[],"comments":"The 'less than' ordering type.\n","title":"LT","info":{"kind":{"tag":"NamedKind","contents":[["Prim","Ordering"],"Ordering"]},"declType":"externData"},"sourceSpan":null},{"children":[],"comments":"The 'greater than' ordering type.\n","title":"GT","info":{"kind":{"tag":"NamedKind","contents":[["Prim","Ordering"],"Ordering"]},"declType":"externData"},"sourceSpan":null},{"children":[],"comments":"The 'equal to' ordering type.\n","title":"EQ","info":{"kind":{"tag":"NamedKind","contents":[["Prim","Ordering"],"Ordering"]},"declType":"externData"},"sourceSpan":null},{"children":[],"comments":"The `Ordering` kind represents the three possibilites of comparing two\ntypes of the same kind: `LT` (less than), `EQ` (equal to), and\n`GT` (greater than).\n","title":"Ordering","info":{"declType":"kind"},"sourceSpan":null}]}],"name":"Type.Data.Ordering","comments":null,"declarations":[{"children":[{"comments":null,"title":"OProxy","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null}],"comments":"Value proxy for `Ordering` types\n","title":"OProxy","info":{"declType":"data","dataDeclType":"data","typeArguments":[["ordering",{"tag":"NamedKind","contents":[["Prim","Ordering"],"Ordering"]}]]},"sourceSpan":{"start":[20,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[20,44]}},{"children":[{"comments":null,"title":"reflectOrdering","info":{"declType":"typeClassMember","type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"OProxy"]},{"tag":"TypeVar","contents":"ordering"}]}]},{"tag":"TypeConstructor","contents":[["Data","Ordering"],"Ordering"]}]}},"sourceSpan":{"start":[24,3],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[24,49]}},{"comments":null,"title":"isOrderingLT","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"IsOrdering"]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"LT"]}]}},"sourceSpan":{"start":[26,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[26,39]}},{"comments":null,"title":"isOrderingEQ","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"IsOrdering"]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"EQ"]}]}},"sourceSpan":{"start":[27,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[27,39]}},{"comments":null,"title":"isOrderingGT","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"IsOrdering"]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"GT"]}]}},"sourceSpan":{"start":[28,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[28,39]}}],"comments":"Class for reflecting a type level `Ordering` at the value level\n","title":"IsOrdering","info":{"fundeps":[],"arguments":[["ordering",{"tag":"NamedKind","contents":[["Prim","Ordering"],"Ordering"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[23,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[24,49]}},{"children":[],"comments":"Use a value level `Ordering` as a type-level `Ordering`\n","title":"reifyOrdering","info":{"declType":"value","type":{"tag":"ForAll","contents":["r",{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeConstructor","contents":[["Data","Ordering"],"Ordering"]}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"ParensInType","contents":{"tag":"ForAll","contents":["o",{"tag":"ConstrainedType","contents":[{"constraintClass":[["Type","Data","Ordering"],"IsOrdering"],"constraintArgs":[{"tag":"TypeVar","contents":"o"}],"constraintData":null},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"OProxy"]},{"tag":"TypeVar","contents":"o"}]}]},{"tag":"TypeVar","contents":"r"}]}]},null]}}]},{"tag":"TypeVar","contents":"r"}]}]},null]}},"sourceSpan":{"start":[31,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[31,86]}},{"children":[{"comments":null,"title":"appendOrderingLT","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"Append"]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"LT"]}]},{"tag":"TypeVar","contents":"rhs"}]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"LT"]}]}},"sourceSpan":{"start":[42,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[42,46]}},{"comments":null,"title":"appendOrderingEQ","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"Append"]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"EQ"]}]},{"tag":"TypeVar","contents":"rhs"}]},{"tag":"TypeVar","contents":"rhs"}]}},"sourceSpan":{"start":[43,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[43,47]}},{"comments":null,"title":"appendOrderingGT","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"Append"]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"GT"]}]},{"tag":"TypeVar","contents":"rhs"}]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"GT"]}]}},"sourceSpan":{"start":[44,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[44,46]}}],"comments":"Append two `Ordering` types together\nReflective of the semigroup for value level `Ordering`\n","title":"Append","info":{"fundeps":[[["lhs"],["rhs","output"]]],"arguments":[["lhs",{"tag":"NamedKind","contents":[["Prim","Ordering"],"Ordering"]}],["rhs",{"tag":"NamedKind","contents":[["Prim","Ordering"],"Ordering"]}],["output",{"tag":"NamedKind","contents":[["Prim","Ordering"],"Ordering"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[38,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[41,31]}},{"children":[],"comments":null,"title":"append","info":{"declType":"value","type":{"tag":"ForAll","contents":["o",{"tag":"ForAll","contents":["r",{"tag":"ForAll","contents":["l",{"tag":"ConstrainedType","contents":[{"constraintClass":[["Type","Data","Ordering"],"Append"],"constraintArgs":[{"tag":"TypeVar","contents":"l"},{"tag":"TypeVar","contents":"r"},{"tag":"TypeVar","contents":"o"}],"constraintData":null},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"OProxy"]},{"tag":"TypeVar","contents":"l"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"OProxy"]},{"tag":"TypeVar","contents":"r"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"OProxy"]},{"tag":"TypeVar","contents":"o"}]}]}]}]},null]},null]},null]}},"sourceSpan":{"start":[46,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[46,73]}},{"children":[{"comments":null,"title":"invertOrderingLT","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"Invert"]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"LT"]}]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"GT"]}]}},"sourceSpan":{"start":[53,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[53,42]}},{"comments":null,"title":"invertOrderingEQ","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"Invert"]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"EQ"]}]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"EQ"]}]}},"sourceSpan":{"start":[54,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[54,42]}},{"comments":null,"title":"invertOrderingGT","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"Invert"]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"GT"]}]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"LT"]}]}},"sourceSpan":{"start":[55,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[55,42]}}],"comments":"Invert an `Ordering`\n","title":"Invert","info":{"fundeps":[[["ordering"],["result"]]],"arguments":[["ordering",{"tag":"NamedKind","contents":[["Prim","Ordering"],"Ordering"]}],["result",{"tag":"NamedKind","contents":[["Prim","Ordering"],"Ordering"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[50,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[52,32]}},{"children":[],"comments":null,"title":"invert","info":{"declType":"value","type":{"tag":"ForAll","contents":["o",{"tag":"ForAll","contents":["i",{"tag":"ConstrainedType","contents":[{"constraintClass":[["Type","Data","Ordering"],"Invert"],"constraintArgs":[{"tag":"TypeVar","contents":"i"},{"tag":"TypeVar","contents":"o"}],"constraintData":null},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"OProxy"]},{"tag":"TypeVar","contents":"i"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"OProxy"]},{"tag":"TypeVar","contents":"o"}]}]}]},null]},null]}},"sourceSpan":{"start":[57,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[57,57]}},{"children":[{"comments":null,"title":"equalsEQEQ","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"Equals"]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"EQ"]}]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"EQ"]}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]}},"sourceSpan":{"start":[65,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[65,41]}},{"comments":null,"title":"equalsLTLT","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"Equals"]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"LT"]}]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"LT"]}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]}},"sourceSpan":{"start":[66,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[66,41]}},{"comments":null,"title":"equalsGTGT","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"Equals"]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"GT"]}]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"GT"]}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]}},"sourceSpan":{"start":[67,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[67,41]}},{"comments":null,"title":"equalsEQLT","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"Equals"]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"EQ"]}]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"LT"]}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]}},"sourceSpan":{"start":[68,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[68,42]}},{"comments":null,"title":"equalsEQGT","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"Equals"]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"EQ"]}]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"GT"]}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]}},"sourceSpan":{"start":[69,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[69,42]}},{"comments":null,"title":"equalsLTEQ","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"Equals"]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"LT"]}]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"EQ"]}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]}},"sourceSpan":{"start":[70,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[70,42]}},{"comments":null,"title":"equalsLTGT","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"Equals"]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"LT"]}]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"GT"]}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]}},"sourceSpan":{"start":[71,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[71,42]}},{"comments":null,"title":"equalsGTLT","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"Equals"]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"GT"]}]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"LT"]}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]}},"sourceSpan":{"start":[72,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[72,42]}},{"comments":null,"title":"equalsGTEQ","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"Equals"]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"GT"]}]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"EQ"]}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]}},"sourceSpan":{"start":[73,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[73,42]}}],"comments":null,"title":"Equals","info":{"fundeps":[[["lhs","rhs"],["out"]]],"arguments":[["lhs",{"tag":"NamedKind","contents":[["Prim","Ordering"],"Ordering"]}],["rhs",{"tag":"NamedKind","contents":[["Prim","Ordering"],"Ordering"]}],["out",{"tag":"NamedKind","contents":[["Type","Data","Boolean"],"Boolean"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[60,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[63,28]}},{"children":[],"comments":null,"title":"equals","info":{"declType":"value","type":{"tag":"ForAll","contents":["o",{"tag":"ForAll","contents":["r",{"tag":"ForAll","contents":["l",{"tag":"ConstrainedType","contents":[{"constraintClass":[["Type","Data","Ordering"],"Equals"],"constraintArgs":[{"tag":"TypeVar","contents":"l"},{"tag":"TypeVar","contents":"r"},{"tag":"TypeVar","contents":"o"}],"constraintData":null},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"OProxy"]},{"tag":"TypeVar","contents":"l"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"OProxy"]},{"tag":"TypeVar","contents":"r"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"BProxy"]},{"tag":"TypeVar","contents":"o"}]}]}]}]},null]},null]},null]}},"sourceSpan":{"start":[75,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[75,73]}}]},{"reExports":[{"moduleName":{"package":"purescript-prelude","item":["Data","Symbol"]},"declarations":[{"children":[{"comments":null,"title":"SProxy","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null}],"comments":"A value-level proxy for a type-level symbol.\n","title":"SProxy","info":{"declType":"data","dataDeclType":"data","typeArguments":[["sym",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}]]},"sourceSpan":{"start":[9,1],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-prelude/src/Data/Symbol.purs","end":[9,37]}},{"children":[{"comments":null,"title":"reflectSymbol","info":{"declType":"typeClassMember","type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"sym"}]}]},{"tag":"TypeConstructor","contents":[["Prim"],"String"]}]}},"sourceSpan":{"start":[13,3],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-prelude/src/Data/Symbol.purs","end":[13,40]}}],"comments":"A class for known symbols\n","title":"IsSymbol","info":{"fundeps":[],"arguments":[["sym",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[12,1],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-prelude/src/Data/Symbol.purs","end":[13,40]}},{"children":[],"comments":null,"title":"reifySymbol","info":{"declType":"value","type":{"tag":"ForAll","contents":["r",{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeConstructor","contents":[["Prim"],"String"]}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"ParensInType","contents":{"tag":"ForAll","contents":["sym",{"tag":"ConstrainedType","contents":[{"constraintClass":[["Data","Symbol"],"IsSymbol"],"constraintArgs":[{"tag":"TypeVar","contents":"sym"}],"constraintData":null},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"sym"}]}]},{"tag":"TypeVar","contents":"r"}]}]},null]}}]},{"tag":"TypeVar","contents":"r"}]}]},null]}},"sourceSpan":{"start":[18,1],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-prelude/src/Data/Symbol.purs","end":[18,86]}}]},{"moduleName":{"package":null,"item":["Prim","Symbol"]},"declarations":[{"children":[],"comments":"Compiler solved type class for appending `Symbol`s together.\n","title":"Append","info":{"fundeps":[[["left","right"],["appended"]],[["right","appended"],["left"]],[["appended","left"],["right"]]],"arguments":[["left",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}],["right",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}],["appended",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":null},{"children":[],"comments":"Compiler solved type class for comparing two `Symbol`s.\nProduces an `Ordering`.\n","title":"Compare","info":{"fundeps":[[["left","right"],["ordering"]]],"arguments":[["left",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}],["right",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}],["ordering",{"tag":"NamedKind","contents":[["Prim","Ordering"],"Ordering"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":null},{"children":[],"comments":"Compiler solved type class for either splitting up a symbol into its\nhead and tail or for combining a head and tail into a new symbol.\nRequires the head to be a single character and the combined string\ncannot be empty.\n","title":"Cons","info":{"fundeps":[[["head","tail"],["symbol"]],[["symbol"],["head","tail"]]],"arguments":[["head",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}],["tail",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}],["symbol",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":null}]}],"name":"Type.Data.Symbol","comments":null,"declarations":[{"children":[],"comments":null,"title":"append","info":{"declType":"value","type":{"tag":"ForAll","contents":["o",{"tag":"ForAll","contents":["r",{"tag":"ForAll","contents":["l",{"tag":"ConstrainedType","contents":[{"constraintClass":[["Prim","Symbol"],"Append"],"constraintArgs":[{"tag":"TypeVar","contents":"l"},{"tag":"TypeVar","contents":"r"},{"tag":"TypeVar","contents":"o"}],"constraintData":null},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"l"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"r"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"o"}]}]}]}]},null]},null]},null]}},"sourceSpan":{"start":[20,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Symbol.purs","end":[20,73]}},{"children":[],"comments":null,"title":"compare","info":{"declType":"value","type":{"tag":"ForAll","contents":["o",{"tag":"ForAll","contents":["r",{"tag":"ForAll","contents":["l",{"tag":"ConstrainedType","contents":[{"constraintClass":[["Prim","Symbol"],"Compare"],"constraintArgs":[{"tag":"TypeVar","contents":"l"},{"tag":"TypeVar","contents":"r"},{"tag":"TypeVar","contents":"o"}],"constraintData":null},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"l"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"r"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"OProxy"]},{"tag":"TypeVar","contents":"o"}]}]}]}]},null]},null]},null]}},"sourceSpan":{"start":[17,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Symbol.purs","end":[17,75]}},{"children":[],"comments":null,"title":"uncons","info":{"declType":"value","type":{"tag":"ForAll","contents":["s",{"tag":"ForAll","contents":["t",{"tag":"ForAll","contents":["h",{"tag":"ConstrainedType","contents":[{"constraintClass":[["Prim","Symbol"],"Cons"],"constraintArgs":[{"tag":"TypeVar","contents":"h"},{"tag":"TypeVar","contents":"t"},{"tag":"TypeVar","contents":"s"}],"constraintData":null},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"s"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"tag":"RCons","contents":["head",{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"h"}]},{"tag":"RCons","contents":["tail",{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"t"}]},{"tag":"REmpty"}]}]}]}]}]},null]},null]},null]}},"sourceSpan":{"start":[23,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Symbol.purs","end":[23,87]}},{"children":[{"comments":null,"title":"equalsSymbol","info":{"declType":"instance","dependencies":[{"constraintClass":[["Prim","Symbol"],"Compare"],"constraintArgs":[{"tag":"TypeVar","contents":"lhs"},{"tag":"TypeVar","contents":"rhs"},{"tag":"TypeVar","contents":"ord"}],"constraintData":null},{"constraintClass":[["Type","Data","Ordering"],"Equals"],"constraintArgs":[{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"EQ"]},{"tag":"TypeVar","contents":"ord"},{"tag":"TypeVar","contents":"out"}],"constraintData":null}],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Symbol"],"Equals"]},{"tag":"TypeVar","contents":"lhs"}]},{"tag":"TypeVar","contents":"rhs"}]},{"tag":"TypeVar","contents":"out"}]}},"sourceSpan":{"start":[31,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Symbol.purs","end":[34,24]}}],"comments":null,"title":"Equals","info":{"fundeps":[[["lhs","rhs"],["out"]]],"arguments":[["lhs",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}],["rhs",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}],["out",{"tag":"NamedKind","contents":[["Type","Data","Boolean"],"Boolean"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[26,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Symbol.purs","end":[29,28]}},{"children":[],"comments":null,"title":"equals","info":{"declType":"value","type":{"tag":"ForAll","contents":["o",{"tag":"ForAll","contents":["r",{"tag":"ForAll","contents":["l",{"tag":"ConstrainedType","contents":[{"constraintClass":[["Type","Data","Symbol"],"Equals"],"constraintArgs":[{"tag":"TypeVar","contents":"l"},{"tag":"TypeVar","contents":"r"},{"tag":"TypeVar","contents":"o"}],"constraintData":null},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"l"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"r"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"BProxy"]},{"tag":"TypeVar","contents":"o"}]}]}]}]},null]},null]},null]}},"sourceSpan":{"start":[36,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Symbol.purs","end":[36,73]}}]},{"reExports":[{"moduleName":{"package":null,"item":["Type","Data","Boolean"]},"declarations":[{"children":[{"comments":null,"title":"isBooleanTrue","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"IsBoolean"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]}},"sourceSpan":{"start":[32,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[32,41]}},{"comments":null,"title":"andTrue","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"And"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]},{"tag":"TypeVar","contents":"rhs"}]},{"tag":"TypeVar","contents":"rhs"}]}},"sourceSpan":{"start":[45,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[45,37]}},{"comments":null,"title":"orTrue","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"Or"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]},{"tag":"TypeVar","contents":"rhs"}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]}},"sourceSpan":{"start":[56,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[56,36]}},{"comments":null,"title":"notTrue","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"Not"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]}},"sourceSpan":{"start":[66,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[66,35]}},{"comments":null,"title":"notFalse","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"Not"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]}},"sourceSpan":{"start":[67,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[67,36]}},{"comments":null,"title":"ifTrue","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"If"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]},{"tag":"TypeVar","contents":"onTrue"}]},{"tag":"TypeVar","contents":"onFalse"}]},{"tag":"TypeVar","contents":"onTrue"}]}},"sourceSpan":{"start":[78,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[78,49]}}],"comments":null,"title":"True","info":{"kind":{"tag":"NamedKind","contents":[["Type","Data","Boolean"],"Boolean"]},"declType":"externData"},"sourceSpan":{"start":[22,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[22,36]}},{"children":[{"comments":null,"title":"isBooleanFalse","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"IsBoolean"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]}},"sourceSpan":{"start":[33,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[33,43]}},{"comments":null,"title":"andFalse","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"And"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]},{"tag":"TypeVar","contents":"rhs"}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]}},"sourceSpan":{"start":[46,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[46,41]}},{"comments":null,"title":"orFalse","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"Or"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]},{"tag":"TypeVar","contents":"rhs"}]},{"tag":"TypeVar","contents":"rhs"}]}},"sourceSpan":{"start":[57,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[57,37]}},{"comments":null,"title":"notTrue","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"Not"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]}},"sourceSpan":{"start":[66,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[66,35]}},{"comments":null,"title":"notFalse","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"Not"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]}},"sourceSpan":{"start":[67,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[67,36]}},{"comments":null,"title":"ifFalse","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"If"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]},{"tag":"TypeVar","contents":"onTrue"}]},{"tag":"TypeVar","contents":"onFalse"}]},{"tag":"TypeVar","contents":"onFalse"}]}},"sourceSpan":{"start":[79,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[79,52]}}],"comments":null,"title":"False","info":{"kind":{"tag":"NamedKind","contents":[["Type","Data","Boolean"],"Boolean"]},"declType":"externData"},"sourceSpan":{"start":[23,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[23,37]}},{"children":[{"comments":null,"title":"BProxy","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null}],"comments":"Value proxy for `Boolean` types\n","title":"BProxy","info":{"declType":"data","dataDeclType":"data","typeArguments":[["bool",{"tag":"NamedKind","contents":[["Type","Data","Boolean"],"Boolean"]}]]},"sourceSpan":{"start":[26,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[26,39]}},{"children":[{"comments":null,"title":"reflectBoolean","info":{"declType":"typeClassMember","type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"BProxy"]},{"tag":"TypeVar","contents":"bool"}]}]},{"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}},"sourceSpan":{"start":[30,3],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[30,43]}},{"comments":null,"title":"isBooleanTrue","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"IsBoolean"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"True"]}]}},"sourceSpan":{"start":[32,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[32,41]}},{"comments":null,"title":"isBooleanFalse","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"IsBoolean"]},{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"False"]}]}},"sourceSpan":{"start":[33,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[33,43]}}],"comments":"Class for reflecting a type level `Boolean` at the value level\n","title":"IsBoolean","info":{"fundeps":[],"arguments":[["bool",{"tag":"NamedKind","contents":[["Type","Data","Boolean"],"Boolean"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[29,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[30,43]}},{"children":[],"comments":"Use a value level `Boolean` as a type-level `Boolean`\n","title":"reifyBoolean","info":{"declType":"value","type":{"tag":"ForAll","contents":["r",{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"ParensInType","contents":{"tag":"ForAll","contents":["o",{"tag":"ConstrainedType","contents":[{"constraintClass":[["Type","Data","Boolean"],"IsBoolean"],"constraintArgs":[{"tag":"TypeVar","contents":"o"}],"constraintData":null},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Boolean"],"BProxy"]},{"tag":"TypeVar","contents":"o"}]}]},{"tag":"TypeVar","contents":"r"}]}]},null]}}]},{"tag":"TypeVar","contents":"r"}]}]},null]}},"sourceSpan":{"start":[36,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[36,83]}},{"children":[],"comments":null,"title":"Boolean","info":{"declType":"kind"},"sourceSpan":{"start":[21,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Boolean.purs","end":[21,28]}}]},{"moduleName":{"package":null,"item":["Type","Data","Ordering"]},"declarations":[{"children":[{"comments":null,"title":"OProxy","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null}],"comments":"Value proxy for `Ordering` types\n","title":"OProxy","info":{"declType":"data","dataDeclType":"data","typeArguments":[["ordering",{"tag":"NamedKind","contents":[["Prim","Ordering"],"Ordering"]}]]},"sourceSpan":{"start":[20,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[20,44]}},{"children":[],"comments":"The 'less than' ordering type.\n","title":"LT","info":{"kind":{"tag":"NamedKind","contents":[["Prim","Ordering"],"Ordering"]},"declType":"externData"},"sourceSpan":null},{"children":[],"comments":"The 'greater than' ordering type.\n","title":"GT","info":{"kind":{"tag":"NamedKind","contents":[["Prim","Ordering"],"Ordering"]},"declType":"externData"},"sourceSpan":null},{"children":[],"comments":"The 'equal to' ordering type.\n","title":"EQ","info":{"kind":{"tag":"NamedKind","contents":[["Prim","Ordering"],"Ordering"]},"declType":"externData"},"sourceSpan":null},{"children":[{"comments":null,"title":"reflectOrdering","info":{"declType":"typeClassMember","type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"OProxy"]},{"tag":"TypeVar","contents":"ordering"}]}]},{"tag":"TypeConstructor","contents":[["Data","Ordering"],"Ordering"]}]}},"sourceSpan":{"start":[24,3],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[24,49]}},{"comments":null,"title":"isOrderingLT","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"IsOrdering"]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"LT"]}]}},"sourceSpan":{"start":[26,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[26,39]}},{"comments":null,"title":"isOrderingEQ","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"IsOrdering"]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"EQ"]}]}},"sourceSpan":{"start":[27,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[27,39]}},{"comments":null,"title":"isOrderingGT","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"IsOrdering"]},{"tag":"TypeConstructor","contents":[["Prim","Ordering"],"GT"]}]}},"sourceSpan":{"start":[28,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[28,39]}}],"comments":"Class for reflecting a type level `Ordering` at the value level\n","title":"IsOrdering","info":{"fundeps":[],"arguments":[["ordering",{"tag":"NamedKind","contents":[["Prim","Ordering"],"Ordering"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[23,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[24,49]}},{"children":[],"comments":"Use a value level `Ordering` as a type-level `Ordering`\n","title":"reifyOrdering","info":{"declType":"value","type":{"tag":"ForAll","contents":["r",{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeConstructor","contents":[["Data","Ordering"],"Ordering"]}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"ParensInType","contents":{"tag":"ForAll","contents":["o",{"tag":"ConstrainedType","contents":[{"constraintClass":[["Type","Data","Ordering"],"IsOrdering"],"constraintArgs":[{"tag":"TypeVar","contents":"o"}],"constraintData":null},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"OProxy"]},{"tag":"TypeVar","contents":"o"}]}]},{"tag":"TypeVar","contents":"r"}]}]},null]}}]},{"tag":"TypeVar","contents":"r"}]}]},null]}},"sourceSpan":{"start":[31,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Ordering.purs","end":[31,86]}},{"children":[],"comments":"The `Ordering` kind represents the three possibilites of comparing two\ntypes of the same kind: `LT` (less than), `EQ` (equal to), and\n`GT` (greater than).\n","title":"Ordering","info":{"declType":"kind"},"sourceSpan":null}]},{"moduleName":{"package":null,"item":["Type","Data","Symbol"]},"declarations":[{"children":[{"comments":null,"title":"SProxy","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null}],"comments":"A value-level proxy for a type-level symbol.\n","title":"SProxy","info":{"declType":"data","dataDeclType":"data","typeArguments":[["sym",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}]]},"sourceSpan":{"start":[9,1],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-prelude/src/Data/Symbol.purs","end":[9,37]}},{"children":[],"comments":"Compiler solved type class for appending `Symbol`s together.\n","title":"Append","info":{"fundeps":[[["left","right"],["appended"]],[["right","appended"],["left"]],[["appended","left"],["right"]]],"arguments":[["left",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}],["right",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}],["appended",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":null},{"children":[],"comments":"Compiler solved type class for comparing two `Symbol`s.\nProduces an `Ordering`.\n","title":"Compare","info":{"fundeps":[[["left","right"],["ordering"]]],"arguments":[["left",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}],["right",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}],["ordering",{"tag":"NamedKind","contents":[["Prim","Ordering"],"Ordering"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":null},{"children":[{"comments":null,"title":"reflectSymbol","info":{"declType":"typeClassMember","type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"sym"}]}]},{"tag":"TypeConstructor","contents":[["Prim"],"String"]}]}},"sourceSpan":{"start":[13,3],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-prelude/src/Data/Symbol.purs","end":[13,40]}}],"comments":"A class for known symbols\n","title":"IsSymbol","info":{"fundeps":[],"arguments":[["sym",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[12,1],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-prelude/src/Data/Symbol.purs","end":[13,40]}},{"children":[],"comments":null,"title":"reifySymbol","info":{"declType":"value","type":{"tag":"ForAll","contents":["r",{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeConstructor","contents":[["Prim"],"String"]}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"ParensInType","contents":{"tag":"ForAll","contents":["sym",{"tag":"ConstrainedType","contents":[{"constraintClass":[["Data","Symbol"],"IsSymbol"],"constraintArgs":[{"tag":"TypeVar","contents":"sym"}],"constraintData":null},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"sym"}]}]},{"tag":"TypeVar","contents":"r"}]}]},null]}}]},{"tag":"TypeVar","contents":"r"}]}]},null]}},"sourceSpan":{"start":[18,1],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-prelude/src/Data/Symbol.purs","end":[18,86]}},{"children":[],"comments":null,"title":"compare","info":{"declType":"value","type":{"tag":"ForAll","contents":["o",{"tag":"ForAll","contents":["r",{"tag":"ForAll","contents":["l",{"tag":"ConstrainedType","contents":[{"constraintClass":[["Prim","Symbol"],"Compare"],"constraintArgs":[{"tag":"TypeVar","contents":"l"},{"tag":"TypeVar","contents":"r"},{"tag":"TypeVar","contents":"o"}],"constraintData":null},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"l"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"r"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Data","Ordering"],"OProxy"]},{"tag":"TypeVar","contents":"o"}]}]}]}]},null]},null]},null]}},"sourceSpan":{"start":[17,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Symbol.purs","end":[17,75]}},{"children":[],"comments":null,"title":"append","info":{"declType":"value","type":{"tag":"ForAll","contents":["o",{"tag":"ForAll","contents":["r",{"tag":"ForAll","contents":["l",{"tag":"ConstrainedType","contents":[{"constraintClass":[["Prim","Symbol"],"Append"],"constraintArgs":[{"tag":"TypeVar","contents":"l"},{"tag":"TypeVar","contents":"r"},{"tag":"TypeVar","contents":"o"}],"constraintData":null},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"l"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"r"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"o"}]}]}]}]},null]},null]},null]}},"sourceSpan":{"start":[20,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Data/Symbol.purs","end":[20,73]}}]},{"moduleName":{"package":"purescript-type-equality","item":["Type","Equality"]},"declarations":[{"children":[{"comments":null,"title":"to","info":{"declType":"typeClassMember","type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeVar","contents":"a"}]},{"tag":"TypeVar","contents":"b"}]}},"sourceSpan":{"start":[18,3],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-type-equality/src/Type/Equality.purs","end":[18,15]}},{"comments":null,"title":"from","info":{"declType":"typeClassMember","type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"tag":"TypeVar","contents":"b"}]},{"tag":"TypeVar","contents":"a"}]}},"sourceSpan":{"start":[19,3],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-type-equality/src/Type/Equality.purs","end":[19,17]}},{"comments":null,"title":"refl","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Equality"],"TypeEquals"]},{"tag":"TypeVar","contents":"a"}]},{"tag":"TypeVar","contents":"a"}]}},"sourceSpan":{"start":[21,1],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-type-equality/src/Type/Equality.purs","end":[21,32]}}],"comments":"This type class asserts that types `a` and `b`\nare equal.\n\nThe functional dependencies and the single\ninstance below will force the two type arguments\nto unify when either one is known.\n\nNote: any instance will necessarily overlap with\n`refl` below, so instances of this class should\nnot be defined in libraries.\n","title":"TypeEquals","info":{"fundeps":[[["a"],["b"]],[["b"],["a"]]],"arguments":[["a",null],["b",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[17,1],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-type-equality/src/Type/Equality.purs","end":[19,17]}}]},{"moduleName":{"package":"purescript-proxy","item":["Type","Proxy"]},"declarations":[{"children":[{"comments":null,"title":"Proxy","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"eqProxy","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[56,8],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-proxy/src/Type/Proxy.purs","end":[56,40]}},{"comments":null,"title":"functorProxy","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Functor"],"Functor"]},{"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]}]}},"sourceSpan":{"start":[58,8],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-proxy/src/Type/Proxy.purs","end":[58,46]}},{"comments":null,"title":"ordProxy","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[60,8],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-proxy/src/Type/Proxy.purs","end":[60,42]}},{"comments":null,"title":"applicativeProxy","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Control","Applicative"],"Applicative"]},{"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]}]}},"sourceSpan":{"start":[62,1],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-proxy/src/Type/Proxy.purs","end":[62,47]}},{"comments":null,"title":"applyProxy","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Control","Apply"],"Apply"]},{"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]}]}},"sourceSpan":{"start":[65,1],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-proxy/src/Type/Proxy.purs","end":[65,35]}},{"comments":null,"title":"bindProxy","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Control","Bind"],"Bind"]},{"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]}]}},"sourceSpan":{"start":[68,1],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-proxy/src/Type/Proxy.purs","end":[68,33]}},{"comments":null,"title":"booleanAlgebraProxy","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","BooleanAlgebra"],"BooleanAlgebra"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[71,1],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-proxy/src/Type/Proxy.purs","end":[71,57]}},{"comments":null,"title":"boundedProxy","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Bounded"],"Bounded"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[73,1],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-proxy/src/Type/Proxy.purs","end":[73,43]}},{"comments":null,"title":"commutativeRingProxy","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","CommutativeRing"],"CommutativeRing"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[77,1],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-proxy/src/Type/Proxy.purs","end":[77,59]}},{"comments":null,"title":"discardProxy","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Control","Bind"],"Discard"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[79,1],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-proxy/src/Type/Proxy.purs","end":[79,43]}},{"comments":null,"title":"heytingAlgebraProxy","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","HeytingAlgebra"],"HeytingAlgebra"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[82,1],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-proxy/src/Type/Proxy.purs","end":[82,57]}},{"comments":null,"title":"monadProxy","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Control","Monad"],"Monad"]},{"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]}]}},"sourceSpan":{"start":[90,1],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-proxy/src/Type/Proxy.purs","end":[90,35]}},{"comments":null,"title":"ringProxy","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[92,1],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-proxy/src/Type/Proxy.purs","end":[92,37]}},{"comments":null,"title":"semigroupProxy","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Semigroup"],"Semigroup"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[95,1],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-proxy/src/Type/Proxy.purs","end":[95,47]}},{"comments":null,"title":"semiringProxy","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[98,1],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-proxy/src/Type/Proxy.purs","end":[98,45]}},{"comments":null,"title":"showProxy","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[104,1],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-proxy/src/Type/Proxy.purs","end":[104,37]}}],"comments":"Value proxy for kind `Type` types.\n","title":"Proxy","info":{"declType":"data","dataDeclType":"data","typeArguments":[["a",null]]},"sourceSpan":{"start":[54,1],"name":"/home/harry/code/purescript-typelevel-prelude/bower_components/purescript-proxy/src/Type/Proxy.purs","end":[54,21]}}]},{"moduleName":{"package":null,"item":["Type","Row"]},"declarations":[{"children":[{"comments":null,"title":"RProxy","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null}],"comments":null,"title":"RProxy","info":{"declType":"data","dataDeclType":"data","typeArguments":[["row",{"tag":"Row","contents":{"tag":"NamedKind","contents":[["Prim"],"Type"]}}]]},"sourceSpan":{"start":[21,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row.purs","end":[21,37]}},{"children":[{"comments":null,"title":"RLProxy","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null}],"comments":null,"title":"RLProxy","info":{"declType":"data","dataDeclType":"data","typeArguments":[["rowList",{"tag":"NamedKind","contents":[["Prim","RowList"],"RowList"]}]]},"sourceSpan":{"start":[23,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row.purs","end":[23,44]}},{"children":[],"comments":"The Lacks type class asserts that a label does not occur in a given row.\n","title":"Lacks","info":{"fundeps":[],"arguments":[["label",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}],["row",{"tag":"Row","contents":{"tag":"NamedKind","contents":[["Prim"],"Type"]}}]],"declType":"typeClass","superclasses":[]},"sourceSpan":null},{"children":[{"comments":null,"title":"listToRowNil","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Row"],"ListToRow"]},{"tag":"TypeConstructor","contents":[["Prim","RowList"],"Nil"]}]},{"tag":"REmpty"}]}},"sourceSpan":{"start":[31,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row.purs","end":[32,22]}},{"comments":null,"title":"listToCons","info":{"declType":"instance","dependencies":[{"constraintClass":[["Type","Row"],"ListToRow"],"constraintArgs":[{"tag":"TypeVar","contents":"tail"},{"tag":"TypeVar","contents":"tailRow"}],"constraintData":null},{"constraintClass":[["Prim","Row"],"Cons"],"constraintArgs":[{"tag":"TypeVar","contents":"label"},{"tag":"TypeVar","contents":"ty"},{"tag":"TypeVar","contents":"tailRow"},{"tag":"TypeVar","contents":"row"}],"constraintData":null}],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Row"],"ListToRow"]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim","RowList"],"Cons"]},{"tag":"TypeVar","contents":"label"}]},{"tag":"TypeVar","contents":"ty"}]},{"tag":"TypeVar","contents":"tail"}]}]},{"tag":"TypeVar","contents":"row"}]}},"sourceSpan":{"start":[34,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row.purs","end":[37,40]}}],"comments":"Convert a RowList to a row of types.\nThe inverse of this operation is `RowToList`.\n","title":"ListToRow","info":{"fundeps":[[["list"],["row"]]],"arguments":[["list",{"tag":"NamedKind","contents":[["Prim","RowList"],"RowList"]}],["row",{"tag":"Row","contents":{"tag":"NamedKind","contents":[["Prim"],"Type"]}}]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[27,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row.purs","end":[29,28]}},{"children":[],"comments":"Compiler solved type class for generating a `RowList` from a closed row\nof types. Entries are sorted by label and duplicates are preserved in\nthe order they appeared in the row.\n","title":"RowToList","info":{"fundeps":[[["row"],["list"]]],"arguments":[["row",{"tag":"Row","contents":{"tag":"NamedKind","contents":[["Prim"],"Type"]}}],["list",{"tag":"NamedKind","contents":[["Prim","RowList"],"RowList"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":null},{"children":[],"comments":"The Union type class is used to compute the union of two rows of types\n(left-biased, including duplicates).\n\nThe third type argument represents the union of the first two.\n","title":"Union","info":{"fundeps":[[["left","right"],["union"]],[["right","union"],["left"]],[["union","left"],["right"]]],"arguments":[["left",{"tag":"Row","contents":{"tag":"NamedKind","contents":[["Prim"],"Type"]}}],["right",{"tag":"Row","contents":{"tag":"NamedKind","contents":[["Prim"],"Type"]}}],["union",{"tag":"Row","contents":{"tag":"NamedKind","contents":[["Prim"],"Type"]}}]],"declType":"typeClass","superclasses":[]},"sourceSpan":null}]}],"name":"Type.Prelude","comments":null,"declarations":[]},{"reExports":[{"moduleName":{"package":null,"item":["Prim","Row"]},"declarations":[{"children":[],"comments":"The Cons type class is a 4-way relation which asserts that one row of\ntypes can be obtained from another by inserting a new label/type pair on\nthe left.\n","title":"Cons","info":{"fundeps":[[["label","a","tail"],["row"]],[["label","row"],["a","tail"]]],"arguments":[["label",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}],["a",{"tag":"NamedKind","contents":[["Prim"],"Type"]}],["tail",{"tag":"Row","contents":{"tag":"NamedKind","contents":[["Prim"],"Type"]}}],["row",{"tag":"Row","contents":{"tag":"NamedKind","contents":[["Prim"],"Type"]}}]],"declType":"typeClass","superclasses":[]},"sourceSpan":null},{"children":[],"comments":"The Lacks type class asserts that a label does not occur in a given row.\n","title":"Lacks","info":{"fundeps":[],"arguments":[["label",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}],["row",{"tag":"Row","contents":{"tag":"NamedKind","contents":[["Prim"],"Type"]}}]],"declType":"typeClass","superclasses":[]},"sourceSpan":null},{"children":[],"comments":"The Nub type class is used to remove duplicate labels from rows.\n","title":"Nub","info":{"fundeps":[[["original"],["nubbed"]]],"arguments":[["original",{"tag":"Row","contents":{"tag":"NamedKind","contents":[["Prim"],"Type"]}}],["nubbed",{"tag":"Row","contents":{"tag":"NamedKind","contents":[["Prim"],"Type"]}}]],"declType":"typeClass","superclasses":[]},"sourceSpan":null},{"children":[],"comments":"The Union type class is used to compute the union of two rows of types\n(left-biased, including duplicates).\n\nThe third type argument represents the union of the first two.\n","title":"Union","info":{"fundeps":[[["left","right"],["union"]],[["right","union"],["left"]],[["union","left"],["right"]]],"arguments":[["left",{"tag":"Row","contents":{"tag":"NamedKind","contents":[["Prim"],"Type"]}}],["right",{"tag":"Row","contents":{"tag":"NamedKind","contents":[["Prim"],"Type"]}}],["union",{"tag":"Row","contents":{"tag":"NamedKind","contents":[["Prim"],"Type"]}}]],"declType":"typeClass","superclasses":[]},"sourceSpan":null}]},{"moduleName":{"package":null,"item":["Prim","RowList"]},"declarations":[{"children":[],"comments":"The empty `RowList`.\n","title":"Nil","info":{"kind":{"tag":"NamedKind","contents":[["Prim","RowList"],"RowList"]},"declType":"externData"},"sourceSpan":null},{"children":[],"comments":"Constructs a new `RowList` from a label, a type, and an existing tail\n`RowList`. E.g: `Cons \"x\" Int (Cons \"y\" Int Nil)`.\n","title":"Cons","info":{"kind":{"tag":"FunKind","contents":[{"tag":"NamedKind","contents":[["Prim"],"Symbol"]},{"tag":"FunKind","contents":[{"tag":"NamedKind","contents":[["Prim"],"Type"]},{"tag":"FunKind","contents":[{"tag":"NamedKind","contents":[["Prim","RowList"],"RowList"]},{"tag":"NamedKind","contents":[["Prim","RowList"],"RowList"]}]}]}]},"declType":"externData"},"sourceSpan":null},{"children":[],"comments":"Compiler solved type class for generating a `RowList` from a closed row\nof types. Entries are sorted by label and duplicates are preserved in\nthe order they appeared in the row.\n","title":"RowToList","info":{"fundeps":[[["row"],["list"]]],"arguments":[["row",{"tag":"Row","contents":{"tag":"NamedKind","contents":[["Prim"],"Type"]}}],["list",{"tag":"NamedKind","contents":[["Prim","RowList"],"RowList"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":null},{"children":[],"comments":"A type level list representation of a row of types.\n","title":"RowList","info":{"declType":"kind"},"sourceSpan":null}]}],"name":"Type.Row","comments":null,"declarations":[{"children":[{"comments":null,"title":"RProxy","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null}],"comments":null,"title":"RProxy","info":{"declType":"data","dataDeclType":"data","typeArguments":[["row",{"tag":"Row","contents":{"tag":"NamedKind","contents":[["Prim"],"Type"]}}]]},"sourceSpan":{"start":[21,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row.purs","end":[21,37]}},{"children":[{"comments":null,"title":"RLProxy","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null}],"comments":null,"title":"RLProxy","info":{"declType":"data","dataDeclType":"data","typeArguments":[["rowList",{"tag":"NamedKind","contents":[["Prim","RowList"],"RowList"]}]]},"sourceSpan":{"start":[23,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row.purs","end":[23,44]}},{"children":[{"comments":null,"title":"listToRowNil","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Row"],"ListToRow"]},{"tag":"TypeConstructor","contents":[["Prim","RowList"],"Nil"]}]},{"tag":"REmpty"}]}},"sourceSpan":{"start":[31,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row.purs","end":[32,22]}},{"comments":null,"title":"listToCons","info":{"declType":"instance","dependencies":[{"constraintClass":[["Type","Row"],"ListToRow"],"constraintArgs":[{"tag":"TypeVar","contents":"tail"},{"tag":"TypeVar","contents":"tailRow"}],"constraintData":null},{"constraintClass":[["Prim","Row"],"Cons"],"constraintArgs":[{"tag":"TypeVar","contents":"label"},{"tag":"TypeVar","contents":"ty"},{"tag":"TypeVar","contents":"tailRow"},{"tag":"TypeVar","contents":"row"}],"constraintData":null}],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Row"],"ListToRow"]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim","RowList"],"Cons"]},{"tag":"TypeVar","contents":"label"}]},{"tag":"TypeVar","contents":"ty"}]},{"tag":"TypeVar","contents":"tail"}]}]},{"tag":"TypeVar","contents":"row"}]}},"sourceSpan":{"start":[34,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row.purs","end":[37,40]}}],"comments":"Convert a RowList to a row of types.\nThe inverse of this operation is `RowToList`.\n","title":"ListToRow","info":{"fundeps":[[["list"],["row"]]],"arguments":[["list",{"tag":"NamedKind","contents":[["Prim","RowList"],"RowList"]}],["row",{"tag":"Row","contents":{"tag":"NamedKind","contents":[["Prim"],"Type"]}}]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[27,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row.purs","end":[29,28]}},{"children":[{"comments":null,"title":"rowListRemoveNil","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Row"],"RowListRemove"]},{"tag":"TypeVar","contents":"label"}]},{"tag":"TypeConstructor","contents":[["Prim","RowList"],"Nil"]}]},{"tag":"TypeConstructor","contents":[["Prim","RowList"],"Nil"]}]}},"sourceSpan":{"start":[45,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row.purs","end":[46,33]}},{"comments":null,"title":"rowListRemoveCons","info":{"declType":"instance","dependencies":[{"constraintClass":[["Type","Row"],"RowListRemove"],"constraintArgs":[{"tag":"TypeVar","contents":"label"},{"tag":"TypeVar","contents":"tail"},{"tag":"TypeVar","contents":"tailOutput"}],"constraintData":null},{"constraintClass":[["Type","Data","Symbol"],"Equals"],"constraintArgs":[{"tag":"TypeVar","contents":"label"},{"tag":"TypeVar","contents":"key"},{"tag":"TypeVar","contents":"eq"}],"constraintData":null},{"constraintClass":[["Type","Data","Boolean"],"If"],"constraintArgs":[{"tag":"TypeVar","contents":"eq"},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Row"],"RLProxy"]},{"tag":"TypeVar","contents":"tailOutput"}]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Row"],"RLProxy"]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim","RowList"],"Cons"]},{"tag":"TypeVar","contents":"key"}]},{"tag":"TypeVar","contents":"head"}]},{"tag":"TypeVar","contents":"tailOutput"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Row"],"RLProxy"]},{"tag":"TypeVar","contents":"output"}]}],"constraintData":null}],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Row"],"RowListRemove"]},{"tag":"TypeVar","contents":"label"}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim","RowList"],"Cons"]},{"tag":"TypeVar","contents":"key"}]},{"tag":"TypeVar","contents":"head"}]},{"tag":"TypeVar","contents":"tail"}]}]},{"tag":"TypeVar","contents":"output"}]}},"sourceSpan":{"start":[48,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row.purs","end":[56,53]}}],"comments":"Remove all occurences of a given label from a RowList\n","title":"RowListRemove","info":{"fundeps":[[["label","input"],["output"]]],"arguments":[["label",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}],["input",{"tag":"NamedKind","contents":[["Prim","RowList"],"RowList"]}],["output",{"tag":"NamedKind","contents":[["Prim","RowList"],"RowList"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[40,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row.purs","end":[43,44]}},{"children":[{"comments":null,"title":"rowListSetImpl","info":{"declType":"instance","dependencies":[{"constraintClass":[["Type","Equality"],"TypeEquals"],"constraintArgs":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"label"}]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"label'"}]}],"constraintData":null},{"constraintClass":[["Type","Equality"],"TypeEquals"],"constraintArgs":[{"tag":"TypeVar","contents":"typ"},{"tag":"TypeVar","contents":"typ'"}],"constraintData":null},{"constraintClass":[["Type","Row"],"RowListRemove"],"constraintArgs":[{"tag":"TypeVar","contents":"label"},{"tag":"TypeVar","contents":"input"},{"tag":"TypeVar","contents":"lacking"}],"constraintData":null}],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Row"],"RowListSet"]},{"tag":"TypeVar","contents":"label"}]},{"tag":"TypeVar","contents":"typ"}]},{"tag":"TypeVar","contents":"input"}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim","RowList"],"Cons"]},{"tag":"TypeVar","contents":"label'"}]},{"tag":"TypeVar","contents":"typ'"}]},{"tag":"TypeVar","contents":"lacking"}]}]}},"sourceSpan":{"start":[65,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row.purs","end":[69,59]}}],"comments":"Add a label to a RowList after removing other occurences.\n","title":"RowListSet","info":{"fundeps":[[["label","typ","input"],["output"]]],"arguments":[["label",{"tag":"NamedKind","contents":[["Prim"],"Symbol"]}],["typ",{"tag":"NamedKind","contents":[["Prim"],"Type"]}],["input",{"tag":"NamedKind","contents":[["Prim","RowList"],"RowList"]}],["output",{"tag":"NamedKind","contents":[["Prim","RowList"],"RowList"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[59,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row.purs","end":[63,45]}},{"children":[{"comments":null,"title":"rowListNubNil","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Row"],"RowListNub"]},{"tag":"TypeConstructor","contents":[["Prim","RowList"],"Nil"]}]},{"tag":"TypeConstructor","contents":[["Prim","RowList"],"Nil"]}]}},"sourceSpan":{"start":[76,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row.purs","end":[77,24]}},{"comments":null,"title":"rowListNubCons","info":{"declType":"instance","dependencies":[{"constraintClass":[["Type","Equality"],"TypeEquals"],"constraintArgs":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"label"}]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Data","Symbol"],"SProxy"]},{"tag":"TypeVar","contents":"label'"}]}],"constraintData":null},{"constraintClass":[["Type","Equality"],"TypeEquals"],"constraintArgs":[{"tag":"TypeVar","contents":"head"},{"tag":"TypeVar","contents":"head'"}],"constraintData":null},{"constraintClass":[["Type","Equality"],"TypeEquals"],"constraintArgs":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Row"],"RLProxy"]},{"tag":"TypeVar","contents":"nubbed"}]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Row"],"RLProxy"]},{"tag":"TypeVar","contents":"nubbed'"}]}],"constraintData":null},{"constraintClass":[["Type","Row"],"RowListRemove"],"constraintArgs":[{"tag":"TypeVar","contents":"label"},{"tag":"TypeVar","contents":"tail"},{"tag":"TypeVar","contents":"removed"}],"constraintData":null},{"constraintClass":[["Type","Row"],"RowListNub"],"constraintArgs":[{"tag":"TypeVar","contents":"removed"},{"tag":"TypeVar","contents":"nubbed"}],"constraintData":null}],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Row"],"RowListNub"]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim","RowList"],"Cons"]},{"tag":"TypeVar","contents":"label"}]},{"tag":"TypeVar","contents":"head"}]},{"tag":"TypeVar","contents":"tail"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim","RowList"],"Cons"]},{"tag":"TypeVar","contents":"label'"}]},{"tag":"TypeVar","contents":"head'"}]},{"tag":"TypeVar","contents":"nubbed'"}]}]}},"sourceSpan":{"start":[79,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row.purs","end":[85,67]}}],"comments":"Remove label duplicates, keeps earlier occurrences.\n","title":"RowListNub","info":{"fundeps":[[["input"],["output"]]],"arguments":[["input",{"tag":"NamedKind","contents":[["Prim","RowList"],"RowList"]}],["output",{"tag":"NamedKind","contents":[["Prim","RowList"],"RowList"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[72,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row.purs","end":[74,35]}},{"children":[{"comments":null,"title":"rowListAppendNil","info":{"declType":"instance","dependencies":[{"constraintClass":[["Type","Equality"],"TypeEquals"],"constraintArgs":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Row"],"RLProxy"]},{"tag":"TypeVar","contents":"rhs"}]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Row"],"RLProxy"]},{"tag":"TypeVar","contents":"out"}]}],"constraintData":null}],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Row"],"RowListAppend"]},{"tag":"TypeConstructor","contents":[["Prim","RowList"],"Nil"]}]},{"tag":"TypeVar","contents":"rhs"}]},{"tag":"TypeVar","contents":"out"}]}},"sourceSpan":{"start":[93,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row.purs","end":[95,31]}},{"comments":null,"title":"rowListAppendCons","info":{"declType":"instance","dependencies":[{"constraintClass":[["Type","Row"],"RowListAppend"],"constraintArgs":[{"tag":"TypeVar","contents":"tail"},{"tag":"TypeVar","contents":"rhs"},{"tag":"TypeVar","contents":"out'"}],"constraintData":null},{"constraintClass":[["Type","Equality"],"TypeEquals"],"constraintArgs":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Row"],"RLProxy"]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim","RowList"],"Cons"]},{"tag":"TypeVar","contents":"label"}]},{"tag":"TypeVar","contents":"head"}]},{"tag":"TypeVar","contents":"out'"}]}]},{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Row"],"RLProxy"]},{"tag":"TypeVar","contents":"out"}]}],"constraintData":null}],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Row"],"RowListAppend"]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim","RowList"],"Cons"]},{"tag":"TypeVar","contents":"label"}]},{"tag":"TypeVar","contents":"head"}]},{"tag":"TypeVar","contents":"tail"}]}]},{"tag":"TypeVar","contents":"rhs"}]},{"tag":"TypeVar","contents":"out"}]}},"sourceSpan":{"start":[97,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row.purs","end":[100,50]}}],"comments":null,"title":"RowListAppend","info":{"fundeps":[[["lhs","rhs"],["out"]]],"arguments":[["lhs",{"tag":"NamedKind","contents":[["Prim","RowList"],"RowList"]}],["rhs",{"tag":"NamedKind","contents":[["Prim","RowList"],"RowList"]}],["out",{"tag":"NamedKind","contents":[["Prim","RowList"],"RowList"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[88,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row.purs","end":[91,37]}},{"children":[],"comments":"Type application for rows.\n","title":"RowApply","info":{"arguments":[["f",{"tag":"FunKind","contents":[{"tag":"Row","contents":{"tag":"NamedKind","contents":[["Prim"],"Type"]}},{"tag":"Row","contents":{"tag":"NamedKind","contents":[["Prim"],"Type"]}}]}],["a",{"tag":"Row","contents":{"tag":"NamedKind","contents":[["Prim"],"Type"]}}]],"declType":"typeSynonym","type":{"tag":"TypeApp","contents":[{"tag":"TypeVar","contents":"f"},{"tag":"TypeVar","contents":"a"}]}},"sourceSpan":{"start":[103,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row.purs","end":[103,58]}},{"children":[],"comments":"Applies a type alias of open rows to a set of rows. The primary use case\nthis operator is as convenient sugar for combining open rows without\nparentheses.\n```purescript\ntype Rows1 r = (a :: Int, b :: String | r)\ntype Rows2 r = (c :: Boolean | r)\ntype Rows3 r = (Rows1 + Rows2 + r)\ntype Rows4 r = (d :: String | Rows1 + Rows2 + r)\n```\n","title":"type (+)","info":{"declType":"alias","alias":[["Type","Row"],{"Left":"RowApply"}],"fixity":{"associativity":"infixr","precedence":0}},"sourceSpan":{"start":[114,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row.purs","end":[114,27]}}]},{"reExports":[],"name":"Type.Row.Homogeneous","comments":null,"declarations":[{"children":[{"comments":null,"title":"homogeneous","info":{"declType":"instance","dependencies":[{"constraintClass":[["Prim","RowList"],"RowToList"],"constraintArgs":[{"tag":"TypeVar","contents":"row"},{"tag":"TypeVar","contents":"fields"}],"constraintData":null},{"constraintClass":[["Type","Row","Homogeneous"],"HomogeneousRowList"],"constraintArgs":[{"tag":"TypeVar","contents":"fields"},{"tag":"TypeVar","contents":"fieldType"}],"constraintData":null}],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Row","Homogeneous"],"Homogeneous"]},{"tag":"TypeVar","contents":"row"}]},{"tag":"TypeVar","contents":"fieldType"}]}},"sourceSpan":{"start":[11,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row/Homogeneous.purs","end":[14,31]}}],"comments":"Ensure that every field in a row has the same type.\n","title":"Homogeneous","info":{"fundeps":[[["row"],["fieldType"]]],"arguments":[["row",{"tag":"Row","contents":{"tag":"NamedKind","contents":[["Prim"],"Type"]}}],["fieldType",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[10,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row/Homogeneous.purs","end":[10,63]}},{"children":[{"comments":null,"title":"homogeneousRowListCons","info":{"declType":"instance","dependencies":[{"constraintClass":[["Type","Row","Homogeneous"],"HomogeneousRowList"],"constraintArgs":[{"tag":"TypeVar","contents":"tail"},{"tag":"TypeVar","contents":"fieldType"}],"constraintData":null},{"constraintClass":[["Type","Equality"],"TypeEquals"],"constraintArgs":[{"tag":"TypeVar","contents":"fieldType"},{"tag":"TypeVar","contents":"fieldType2"}],"constraintData":null}],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Row","Homogeneous"],"HomogeneousRowList"]},{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Prim","RowList"],"Cons"]},{"tag":"TypeVar","contents":"symbol"}]},{"tag":"TypeVar","contents":"fieldType"}]},{"tag":"TypeVar","contents":"tail"}]}]},{"tag":"TypeVar","contents":"fieldType2"}]}},"sourceSpan":{"start":[17,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row/Homogeneous.purs","end":[20,64]}},{"comments":null,"title":"homogeneousRowListNil","info":{"declType":"instance","dependencies":[],"type":{"tag":"TypeApp","contents":[{"tag":"TypeApp","contents":[{"tag":"TypeConstructor","contents":[["Type","Row","Homogeneous"],"HomogeneousRowList"]},{"tag":"TypeConstructor","contents":[["Prim","RowList"],"Nil"]}]},{"tag":"TypeVar","contents":"fieldType"}]}},"sourceSpan":{"start":[21,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row/Homogeneous.purs","end":[21,58]}}],"comments":null,"title":"HomogeneousRowList","info":{"fundeps":[[["rowList"],["fieldType"]]],"arguments":[["rowList",{"tag":"NamedKind","contents":[["Prim","RowList"],"RowList"]}],["fieldType",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[16,1],"name":"/home/harry/code/purescript-typelevel-prelude/src/Type/Row/Homogeneous.purs","end":[16,79]}}]}],"resolvedDependencies":{"purescript-proxy":"3.0.0","purescript-type-equality":"3.0.0","purescript-prelude":"4.1.0"},"version":"3.0.0","github":["purescript","purescript-typelevel-prelude"],"versionTag":"v3.0.0","moduleMap":{"Data.BooleanAlgebra":"purescript-prelude","Data.Ring":"purescript-prelude","Data.Ord":"purescript-prelude","Type.Data.Row":"purescript-prelude","Data.Monoid.Dual":"purescript-prelude","Data.Boolean":"purescript-prelude","Type.Proxy":"purescript-proxy","Data.Bounded":"purescript-prelude","Data.Show":"purescript-prelude","Control.Apply":"purescript-prelude","Control.Monad":"purescript-prelude","Data.Monoid":"purescript-prelude","Control.Bind":"purescript-prelude","Data.Monoid.Additive":"purescript-prelude","Data.Symbol":"purescript-prelude","Data.HeytingAlgebra":"purescript-prelude","Type.Data.RowList":"purescript-prelude","Data.Ord.Unsafe":"purescript-prelude","Data.Semigroup":"purescript-prelude","Type.Equality":"purescript-type-equality","Data.Semiring":"purescript-prelude","Data.CommutativeRing":"purescript-prelude","Data.NaturalTransformation":"purescript-prelude","Data.Monoid.Conj":"purescript-prelude","Data.Functor":"purescript-prelude","Control.Category":"purescript-prelude","Data.Function":"purescript-prelude","Data.Field":"purescript-prelude","Data.EuclideanRing":"purescript-prelude","Data.Semigroup.Last":"purescript-prelude","Data.Semigroup.First":"purescript-prelude","Prelude":"purescript-prelude","Data.Eq":"purescript-prelude","Data.Monoid.Disj":"purescript-prelude","Data.Void":"purescript-prelude","Data.DivisionRing":"purescript-prelude","Data.Unit":"purescript-prelude","Data.Ordering":"purescript-prelude","Data.Monoid.Multiplicative":"purescript-prelude","Control.Semigroupoid":"purescript-prelude","Data.Monoid.Endo":"purescript-prelude","Control.Applicative":"purescript-prelude","Record.Unsafe":"purescript-prelude"},"compilerVersion":"0.12.1"}
+ tests/json-compat/v0.14.0/prelude-5.0.1.json view
@@ -0,0 +1,1 @@+{"uploader":"thomashoneyman","packageMeta":{"homepage":"https://github.com/purescript/purescript-prelude","repository":{"url":"https://github.com/purescript/purescript-prelude.git","type":"git"},"ignore":["**/.*","bower_components","node_modules","output","test","bower.json","package.json"],"name":"purescript-prelude","license":["BSD-3-Clause"],"description":"The PureScript Prelude"},"tagTime":"2021-05-11T21:10:31+0000","modules":[{"reExports":[{"moduleName":{"package":null,"item":["Control","Apply"]},"declarations":[{"children":[{"comments":null,"title":"apply","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}]},null]},null]}},"sourceSpan":{"start":[46,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Apply.purs","end":[46,48]}},{"comments":null,"title":"applyFn","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Apply"],"Apply"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"r"}]}]}},"sourceSpan":{"start":[50,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Apply.purs","end":[51,26]}},{"comments":null,"title":"applyArray","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Apply"],"Apply"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Array"]}]}},"sourceSpan":{"start":[53,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Apply.purs","end":[54,21]}},{"comments":null,"title":"applyProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Apply"],"Apply"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]}]}},"sourceSpan":{"start":[58,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Apply.purs","end":[59,20]}}],"comments":"The `Apply` class provides the `(<*>)` which is used to apply a function\nto an argument under a type constructor.\n\n`Apply` can be used to lift functions of two or more arguments to work on\nvalues wrapped with the type constructor `f`. It might also be understood\nin terms of the `lift2` function:\n\n```purescript\nlift2 :: forall f a b c. Apply f => (a -> b -> c) -> f a -> f b -> f c\nlift2 f a b = f <$> a <*> b\n```\n\n`(<*>)` is recovered from `lift2` as `lift2 ($)`. That is, `(<*>)` lifts\nthe function application operator `($)` to arguments wrapped with the\ntype constructor `f`.\n\nPut differently...\n```\nfoo =\n functionTakingNArguments <$> computationProducingArg1\n <*> computationProducingArg2\n <*> ...\n <*> computationProducingArgN\n```\n\nInstances must satisfy the following law in addition to the `Functor`\nlaws:\n\n- Associative composition: `(<<<) <$> f <*> g <*> h = f <*> (g <*> h)`\n\nFormally, `Apply` represents a strong lax semi-monoidal endofunctor.\n","title":"Apply","info":{"fundeps":[],"arguments":[["f",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Data","Functor"],"Functor"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"f"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[45,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Apply.purs","end":[46,48]}},{"children":[],"comments":null,"title":"(<*>)","info":{"declType":"alias","alias":[["Control","Apply"],{"Right":{"Left":{"Ident":"apply"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[48,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Apply.purs","end":[48,22]}},{"children":[],"comments":null,"title":"(<*)","info":{"declType":"alias","alias":[["Control","Apply"],{"Right":{"Left":{"Ident":"applyFirst"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[65,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Apply.purs","end":[65,26]}},{"children":[],"comments":null,"title":"(*>)","info":{"declType":"alias","alias":[["Control","Apply"],{"Right":{"Left":{"Ident":"applySecond"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[71,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Apply.purs","end":[71,27]}}]},{"moduleName":{"package":null,"item":["Data","Functor"]},"declarations":[{"children":[{"comments":null,"title":"map","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}]},null]},null]}},"sourceSpan":{"start":[26,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[26,44]}},{"comments":null,"title":"functorFn","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Functor"],"Functor"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"r"}]}]}},"sourceSpan":{"start":[40,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[41,16]}},{"comments":null,"title":"functorArray","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Functor"],"Functor"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Array"]}]}},"sourceSpan":{"start":[43,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[44,17]}},{"comments":null,"title":"functorProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Functor"],"Functor"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]}]}},"sourceSpan":{"start":[46,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[47,18]}}],"comments":"A `Functor` is a type constructor which supports a mapping operation\n`map`.\n\n`map` can be used to turn functions `a -> b` into functions\n`f a -> f b` whose argument and return types use the type constructor `f`\nto represent some computational context.\n\nInstances must satisfy the following laws:\n\n- Identity: `map identity = identity`\n- Composition: `map (f <<< g) = map f <<< map g`\n","title":"Functor","info":{"fundeps":[],"arguments":[["f",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[25,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[26,44]}},{"children":[],"comments":"The `void` function is used to ignore the type wrapped by a\n[`Functor`](#functor), replacing it with `Unit` and keeping only the type\ninformation provided by the type constructor itself.\n\n`void` is often useful when using `do` notation to change the return type\nof a monadic computation:\n\n```purescript\nmain = forE 1 10 \\n -> void do\n print n\n print (n * n)\n```\n","title":"void","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["f",{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Functor"],"Functor"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"f"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}]}]},null]},null]}},"sourceSpan":{"start":[63,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[63,47]}},{"children":[],"comments":null,"title":"(<$>)","info":{"declType":"alias","alias":[["Data","Functor"],{"Right":{"Left":{"Ident":"map"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[28,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[28,20]}},{"children":[],"comments":null,"title":"(<$)","info":{"declType":"alias","alias":[["Data","Functor"],{"Right":{"Left":{"Ident":"voidRight"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[71,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[71,25]}},{"children":[],"comments":null,"title":"(<#>)","info":{"declType":"alias","alias":[["Data","Functor"],{"Right":{"Left":{"Ident":"mapFlipped"}}}],"fixity":{"associativity":"infixl","precedence":1}},"sourceSpan":{"start":[38,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[38,27]}},{"children":[],"comments":null,"title":"($>)","info":{"declType":"alias","alias":[["Data","Functor"],{"Right":{"Left":{"Ident":"voidLeft"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[77,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[77,24]}}]}],"name":"Control.Applicative","comments":null,"declarations":[{"children":[{"comments":null,"title":"pure","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},null]}},"sourceSpan":{"start":[34,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Applicative.purs","end":[34,29]}},{"comments":null,"title":"applicativeFn","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Applicative"],"Applicative"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"r"}]}]}},"sourceSpan":{"start":[36,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Applicative.purs","end":[37,15]}},{"comments":null,"title":"applicativeArray","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Applicative"],"Applicative"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Array"]}]}},"sourceSpan":{"start":[39,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Applicative.purs","end":[40,15]}},{"comments":null,"title":"applicativeProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Applicative"],"Applicative"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]}]}},"sourceSpan":{"start":[42,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Applicative.purs","end":[43,17]}}],"comments":"The `Applicative` type class extends the [`Apply`](#apply) type class\nwith a `pure` function, which can be used to create values of type `f a`\nfrom values of type `a`.\n\nWhere [`Apply`](#apply) provides the ability to lift functions of two or\nmore arguments to functions whose arguments are wrapped using `f`, and\n[`Functor`](#functor) provides the ability to lift functions of one\nargument, `pure` can be seen as the function which lifts functions of\n_zero_ arguments. That is, `Applicative` functors support a lifting\noperation for any number of function arguments.\n\nInstances must satisfy the following laws in addition to the `Apply`\nlaws:\n\n- Identity: `(pure identity) <*> v = v`\n- Composition: `pure (<<<) <*> f <*> g <*> h = f <*> (g <*> h)`\n- Homomorphism: `(pure f) <*> (pure x) = pure (f x)`\n- Interchange: `u <*> (pure y) = (pure (_ $ y)) <*> u`\n","title":"Applicative","info":{"fundeps":[],"arguments":[["f",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Control","Apply"],"Apply"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"f"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[33,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Applicative.purs","end":[34,29]}},{"children":[],"comments":"`liftA1` provides a default implementation of `(<$>)` for any\n[`Applicative`](#applicative) functor, without using `(<$>)` as provided\nby the [`Functor`](#functor)-[`Applicative`](#applicative) superclass\nrelationship.\n\n`liftA1` can therefore be used to write [`Functor`](#functor) instances\nas follows:\n\n```purescript\ninstance functorF :: Functor F where\n map = liftA1\n```\n","title":"liftA1","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["f",{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Control","Applicative"],"Applicative"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"f"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}]}]},null]},null]},null]}},"sourceSpan":{"start":[57,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Applicative.purs","end":[57,64]}},{"children":[],"comments":"Perform an applicative action unless a condition is true.\n","title":"unless","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["m",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Control","Applicative"],"Applicative"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"m"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}]}]}]},null]}},"sourceSpan":{"start":[66,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Applicative.purs","end":[66,65]}},{"children":[],"comments":"Perform an applicative action when a condition is true.\n","title":"when","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["m",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Control","Applicative"],"Applicative"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"m"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}]}]}]},null]}},"sourceSpan":{"start":[61,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Applicative.purs","end":[61,63]}}]},{"reExports":[{"moduleName":{"package":null,"item":["Data","Functor"]},"declarations":[{"children":[{"comments":null,"title":"map","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}]},null]},null]}},"sourceSpan":{"start":[26,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[26,44]}},{"comments":null,"title":"functorFn","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Functor"],"Functor"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"r"}]}]}},"sourceSpan":{"start":[40,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[41,16]}},{"comments":null,"title":"functorArray","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Functor"],"Functor"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Array"]}]}},"sourceSpan":{"start":[43,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[44,17]}},{"comments":null,"title":"functorProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Functor"],"Functor"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]}]}},"sourceSpan":{"start":[46,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[47,18]}}],"comments":"A `Functor` is a type constructor which supports a mapping operation\n`map`.\n\n`map` can be used to turn functions `a -> b` into functions\n`f a -> f b` whose argument and return types use the type constructor `f`\nto represent some computational context.\n\nInstances must satisfy the following laws:\n\n- Identity: `map identity = identity`\n- Composition: `map (f <<< g) = map f <<< map g`\n","title":"Functor","info":{"fundeps":[],"arguments":[["f",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[25,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[26,44]}},{"children":[],"comments":"The `void` function is used to ignore the type wrapped by a\n[`Functor`](#functor), replacing it with `Unit` and keeping only the type\ninformation provided by the type constructor itself.\n\n`void` is often useful when using `do` notation to change the return type\nof a monadic computation:\n\n```purescript\nmain = forE 1 10 \\n -> void do\n print n\n print (n * n)\n```\n","title":"void","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["f",{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Functor"],"Functor"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"f"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}]}]},null]},null]}},"sourceSpan":{"start":[63,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[63,47]}},{"children":[],"comments":null,"title":"(<$>)","info":{"declType":"alias","alias":[["Data","Functor"],{"Right":{"Left":{"Ident":"map"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[28,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[28,20]}},{"children":[],"comments":null,"title":"(<$)","info":{"declType":"alias","alias":[["Data","Functor"],{"Right":{"Left":{"Ident":"voidRight"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[71,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[71,25]}},{"children":[],"comments":null,"title":"(<#>)","info":{"declType":"alias","alias":[["Data","Functor"],{"Right":{"Left":{"Ident":"mapFlipped"}}}],"fixity":{"associativity":"infixl","precedence":1}},"sourceSpan":{"start":[38,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[38,27]}},{"children":[],"comments":null,"title":"($>)","info":{"declType":"alias","alias":[["Data","Functor"],{"Right":{"Left":{"Ident":"voidLeft"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[77,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[77,24]}}]}],"name":"Control.Apply","comments":null,"declarations":[{"children":[{"comments":null,"title":"apply","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}]},null]},null]}},"sourceSpan":{"start":[46,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Apply.purs","end":[46,48]}},{"comments":null,"title":"applyFn","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Apply"],"Apply"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"r"}]}]}},"sourceSpan":{"start":[50,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Apply.purs","end":[51,26]}},{"comments":null,"title":"applyArray","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Apply"],"Apply"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Array"]}]}},"sourceSpan":{"start":[53,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Apply.purs","end":[54,21]}},{"comments":null,"title":"applyProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Apply"],"Apply"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]}]}},"sourceSpan":{"start":[58,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Apply.purs","end":[59,20]}}],"comments":"The `Apply` class provides the `(<*>)` which is used to apply a function\nto an argument under a type constructor.\n\n`Apply` can be used to lift functions of two or more arguments to work on\nvalues wrapped with the type constructor `f`. It might also be understood\nin terms of the `lift2` function:\n\n```purescript\nlift2 :: forall f a b c. Apply f => (a -> b -> c) -> f a -> f b -> f c\nlift2 f a b = f <$> a <*> b\n```\n\n`(<*>)` is recovered from `lift2` as `lift2 ($)`. That is, `(<*>)` lifts\nthe function application operator `($)` to arguments wrapped with the\ntype constructor `f`.\n\nPut differently...\n```\nfoo =\n functionTakingNArguments <$> computationProducingArg1\n <*> computationProducingArg2\n <*> ...\n <*> computationProducingArgN\n```\n\nInstances must satisfy the following law in addition to the `Functor`\nlaws:\n\n- Associative composition: `(<<<) <$> f <*> g <*> h = f <*> (g <*> h)`\n\nFormally, `Apply` represents a strong lax semi-monoidal endofunctor.\n","title":"Apply","info":{"fundeps":[],"arguments":[["f",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Data","Functor"],"Functor"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"f"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[45,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Apply.purs","end":[46,48]}},{"children":[],"comments":null,"title":"(<*>)","info":{"declType":"alias","alias":[["Control","Apply"],{"Right":{"Left":{"Ident":"apply"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[48,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Apply.purs","end":[48,22]}},{"children":[],"comments":"Combine two effectful actions, keeping only the result of the first.\n","title":"applyFirst","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"ForAll","contents":["f",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Control","Apply"],"Apply"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"f"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}]}]},null]},null]},null]}},"sourceSpan":{"start":[62,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Apply.purs","end":[62,57]}},{"children":[],"comments":null,"title":"(<*)","info":{"declType":"alias","alias":[["Control","Apply"],{"Right":{"Left":{"Ident":"applyFirst"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[65,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Apply.purs","end":[65,26]}},{"children":[],"comments":"Combine two effectful actions, keeping only the result of the second.\n","title":"applySecond","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"ForAll","contents":["f",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Control","Apply"],"Apply"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"f"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}]}]},null]},null]},null]}},"sourceSpan":{"start":[68,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Apply.purs","end":[68,58]}},{"children":[],"comments":null,"title":"(*>)","info":{"declType":"alias","alias":[["Control","Apply"],{"Right":{"Left":{"Ident":"applySecond"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[71,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Apply.purs","end":[71,27]}},{"children":[],"comments":"Lift a function of two arguments to a function which accepts and returns\nvalues wrapped with the type constructor `f`.\n\n```purescript\nlift2 add (Just 1) (Just 2) == Just 3\nlift2 add Nothing (Just 2) == Nothing\n```\n\n","title":"lift2","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"ForAll","contents":["c",{"annotation":[],"tag":"ForAll","contents":["f",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Control","Apply"],"Apply"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"f"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"b"}]},{"annotation":[],"tag":"TypeVar","contents":"c"}]}]}}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"c"}]}]}]}]}]},null]},null]},null]},null]}},"sourceSpan":{"start":[81,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Apply.purs","end":[81,71]}},{"children":[],"comments":"Lift a function of three arguments to a function which accepts and returns\nvalues wrapped with the type constructor `f`.\n","title":"lift3","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"ForAll","contents":["c",{"annotation":[],"tag":"ForAll","contents":["d",{"annotation":[],"tag":"ForAll","contents":["f",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Control","Apply"],"Apply"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"f"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"b"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"c"}]},{"annotation":[],"tag":"TypeVar","contents":"d"}]}]}]}}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"c"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"d"}]}]}]}]}]}]},null]},null]},null]},null]},null]}},"sourceSpan":{"start":[86,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Apply.purs","end":[86,85]}},{"children":[],"comments":"Lift a function of four arguments to a function which accepts and returns\nvalues wrapped with the type constructor `f`.\n","title":"lift4","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"ForAll","contents":["c",{"annotation":[],"tag":"ForAll","contents":["d",{"annotation":[],"tag":"ForAll","contents":["e",{"annotation":[],"tag":"ForAll","contents":["f",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Control","Apply"],"Apply"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"f"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"b"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"c"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"d"}]},{"annotation":[],"tag":"TypeVar","contents":"e"}]}]}]}]}}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"c"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"d"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"e"}]}]}]}]}]}]}]},null]},null]},null]},null]},null]},null]}},"sourceSpan":{"start":[91,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Apply.purs","end":[91,99]}},{"children":[],"comments":"Lift a function of five arguments to a function which accepts and returns\nvalues wrapped with the type constructor `f`.\n","title":"lift5","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"ForAll","contents":["c",{"annotation":[],"tag":"ForAll","contents":["d",{"annotation":[],"tag":"ForAll","contents":["e",{"annotation":[],"tag":"ForAll","contents":["f",{"annotation":[],"tag":"ForAll","contents":["g",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Control","Apply"],"Apply"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"f"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"b"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"c"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"d"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"e"}]},{"annotation":[],"tag":"TypeVar","contents":"g"}]}]}]}]}]}}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"c"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"d"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"e"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"g"}]}]}]}]}]}]}]}]},null]},null]},null]},null]},null]},null]},null]}},"sourceSpan":{"start":[96,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Apply.purs","end":[96,113]}}]},{"reExports":[{"moduleName":{"package":null,"item":["Control","Applicative"]},"declarations":[{"children":[{"comments":null,"title":"pure","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},null]}},"sourceSpan":{"start":[34,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Applicative.purs","end":[34,29]}},{"comments":null,"title":"applicativeFn","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Applicative"],"Applicative"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"r"}]}]}},"sourceSpan":{"start":[36,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Applicative.purs","end":[37,15]}},{"comments":null,"title":"applicativeArray","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Applicative"],"Applicative"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Array"]}]}},"sourceSpan":{"start":[39,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Applicative.purs","end":[40,15]}},{"comments":null,"title":"applicativeProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Applicative"],"Applicative"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]}]}},"sourceSpan":{"start":[42,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Applicative.purs","end":[43,17]}}],"comments":"The `Applicative` type class extends the [`Apply`](#apply) type class\nwith a `pure` function, which can be used to create values of type `f a`\nfrom values of type `a`.\n\nWhere [`Apply`](#apply) provides the ability to lift functions of two or\nmore arguments to functions whose arguments are wrapped using `f`, and\n[`Functor`](#functor) provides the ability to lift functions of one\nargument, `pure` can be seen as the function which lifts functions of\n_zero_ arguments. That is, `Applicative` functors support a lifting\noperation for any number of function arguments.\n\nInstances must satisfy the following laws in addition to the `Apply`\nlaws:\n\n- Identity: `(pure identity) <*> v = v`\n- Composition: `pure (<<<) <*> f <*> g <*> h = f <*> (g <*> h)`\n- Homomorphism: `(pure f) <*> (pure x) = pure (f x)`\n- Interchange: `u <*> (pure y) = (pure (_ $ y)) <*> u`\n","title":"Applicative","info":{"fundeps":[],"arguments":[["f",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Control","Apply"],"Apply"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"f"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[33,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Applicative.purs","end":[34,29]}},{"children":[],"comments":"Perform an applicative action when a condition is true.\n","title":"when","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["m",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Control","Applicative"],"Applicative"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"m"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}]}]}]},null]}},"sourceSpan":{"start":[61,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Applicative.purs","end":[61,63]}},{"children":[],"comments":"Perform an applicative action unless a condition is true.\n","title":"unless","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["m",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Control","Applicative"],"Applicative"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"m"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}]}]}]},null]}},"sourceSpan":{"start":[66,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Applicative.purs","end":[66,65]}},{"children":[],"comments":"`liftA1` provides a default implementation of `(<$>)` for any\n[`Applicative`](#applicative) functor, without using `(<$>)` as provided\nby the [`Functor`](#functor)-[`Applicative`](#applicative) superclass\nrelationship.\n\n`liftA1` can therefore be used to write [`Functor`](#functor) instances\nas follows:\n\n```purescript\ninstance functorF :: Functor F where\n map = liftA1\n```\n","title":"liftA1","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["f",{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Control","Applicative"],"Applicative"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"f"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}]}]},null]},null]},null]}},"sourceSpan":{"start":[57,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Applicative.purs","end":[57,64]}}]},{"moduleName":{"package":null,"item":["Control","Apply"]},"declarations":[{"children":[{"comments":null,"title":"apply","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}]},null]},null]}},"sourceSpan":{"start":[46,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Apply.purs","end":[46,48]}},{"comments":null,"title":"applyFn","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Apply"],"Apply"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"r"}]}]}},"sourceSpan":{"start":[50,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Apply.purs","end":[51,26]}},{"comments":null,"title":"applyArray","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Apply"],"Apply"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Array"]}]}},"sourceSpan":{"start":[53,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Apply.purs","end":[54,21]}},{"comments":null,"title":"applyProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Apply"],"Apply"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]}]}},"sourceSpan":{"start":[58,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Apply.purs","end":[59,20]}}],"comments":"The `Apply` class provides the `(<*>)` which is used to apply a function\nto an argument under a type constructor.\n\n`Apply` can be used to lift functions of two or more arguments to work on\nvalues wrapped with the type constructor `f`. It might also be understood\nin terms of the `lift2` function:\n\n```purescript\nlift2 :: forall f a b c. Apply f => (a -> b -> c) -> f a -> f b -> f c\nlift2 f a b = f <$> a <*> b\n```\n\n`(<*>)` is recovered from `lift2` as `lift2 ($)`. That is, `(<*>)` lifts\nthe function application operator `($)` to arguments wrapped with the\ntype constructor `f`.\n\nPut differently...\n```\nfoo =\n functionTakingNArguments <$> computationProducingArg1\n <*> computationProducingArg2\n <*> ...\n <*> computationProducingArgN\n```\n\nInstances must satisfy the following law in addition to the `Functor`\nlaws:\n\n- Associative composition: `(<<<) <$> f <*> g <*> h = f <*> (g <*> h)`\n\nFormally, `Apply` represents a strong lax semi-monoidal endofunctor.\n","title":"Apply","info":{"fundeps":[],"arguments":[["f",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Data","Functor"],"Functor"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"f"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[45,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Apply.purs","end":[46,48]}},{"children":[],"comments":null,"title":"(<*>)","info":{"declType":"alias","alias":[["Control","Apply"],{"Right":{"Left":{"Ident":"apply"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[48,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Apply.purs","end":[48,22]}},{"children":[],"comments":null,"title":"(<*)","info":{"declType":"alias","alias":[["Control","Apply"],{"Right":{"Left":{"Ident":"applyFirst"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[65,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Apply.purs","end":[65,26]}},{"children":[],"comments":null,"title":"(*>)","info":{"declType":"alias","alias":[["Control","Apply"],{"Right":{"Left":{"Ident":"applySecond"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[71,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Apply.purs","end":[71,27]}}]},{"moduleName":{"package":null,"item":["Data","Functor"]},"declarations":[{"children":[{"comments":null,"title":"map","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}]},null]},null]}},"sourceSpan":{"start":[26,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[26,44]}},{"comments":null,"title":"functorFn","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Functor"],"Functor"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"r"}]}]}},"sourceSpan":{"start":[40,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[41,16]}},{"comments":null,"title":"functorArray","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Functor"],"Functor"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Array"]}]}},"sourceSpan":{"start":[43,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[44,17]}},{"comments":null,"title":"functorProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Functor"],"Functor"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]}]}},"sourceSpan":{"start":[46,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[47,18]}}],"comments":"A `Functor` is a type constructor which supports a mapping operation\n`map`.\n\n`map` can be used to turn functions `a -> b` into functions\n`f a -> f b` whose argument and return types use the type constructor `f`\nto represent some computational context.\n\nInstances must satisfy the following laws:\n\n- Identity: `map identity = identity`\n- Composition: `map (f <<< g) = map f <<< map g`\n","title":"Functor","info":{"fundeps":[],"arguments":[["f",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[25,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[26,44]}},{"children":[],"comments":"The `void` function is used to ignore the type wrapped by a\n[`Functor`](#functor), replacing it with `Unit` and keeping only the type\ninformation provided by the type constructor itself.\n\n`void` is often useful when using `do` notation to change the return type\nof a monadic computation:\n\n```purescript\nmain = forE 1 10 \\n -> void do\n print n\n print (n * n)\n```\n","title":"void","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["f",{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Functor"],"Functor"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"f"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}]}]},null]},null]}},"sourceSpan":{"start":[63,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[63,47]}},{"children":[],"comments":null,"title":"(<$>)","info":{"declType":"alias","alias":[["Data","Functor"],{"Right":{"Left":{"Ident":"map"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[28,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[28,20]}},{"children":[],"comments":null,"title":"(<$)","info":{"declType":"alias","alias":[["Data","Functor"],{"Right":{"Left":{"Ident":"voidRight"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[71,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[71,25]}},{"children":[],"comments":null,"title":"(<#>)","info":{"declType":"alias","alias":[["Data","Functor"],{"Right":{"Left":{"Ident":"mapFlipped"}}}],"fixity":{"associativity":"infixl","precedence":1}},"sourceSpan":{"start":[38,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[38,27]}},{"children":[],"comments":null,"title":"($>)","info":{"declType":"alias","alias":[["Data","Functor"],{"Right":{"Left":{"Ident":"voidLeft"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[77,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[77,24]}}]}],"name":"Control.Bind","comments":null,"declarations":[{"children":[{"comments":null,"title":"bind","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}]},null]},null]}},"sourceSpan":{"start":[51,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[51,47]}},{"comments":null,"title":"bindFn","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Bind"],"Bind"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"r"}]}]}},"sourceSpan":{"start":[65,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[66,25]}},{"comments":"The `bind`/`>>=` function for `Array` works by applying a function to\neach element in the array, and flattening the results into a single,\nnew array.\n\nArray's `bind`/`>>=` works like a nested for loop. Each `bind` adds\nanother level of nesting in the loop. For example:\n```\nfoo :: Array String\nfoo =\n [\"a\", \"b\"] >>= \\eachElementInArray1 ->\n [\"c\", \"d\"] >>= \\eachElementInArray2\n pure (eachElementInArray1 <> eachElementInArray2)\n\n-- In other words...\nfoo\n-- ... is the same as...\n[ (\"a\" <> \"c\"), (\"a\" <> \"d\"), (\"b\" <> \"c\"), (\"b\" <> \"d\") ]\n-- which simplifies to...\n[ \"ac\", \"ad\", \"bc\", \"bd\" ]\n```\n","title":"bindArray","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Bind"],"Bind"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Array"]}]}},"sourceSpan":{"start":[88,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[89,19]}},{"comments":null,"title":"bindProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Bind"],"Bind"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]}]}},"sourceSpan":{"start":[93,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[94,19]}}],"comments":"The `Bind` type class extends the [`Apply`](#apply) type class with a\n\"bind\" operation `(>>=)` which composes computations in sequence, using\nthe return value of one computation to determine the next computation.\n\nThe `>>=` operator can also be expressed using `do` notation, as follows:\n\n```purescript\nx >>= f = do y <- x\n f y\n```\n\nwhere the function argument of `f` is given the name `y`.\n\nInstances must satisfy the following laws in addition to the `Apply`\nlaws:\n\n- Associativity: `(x >>= f) >>= g = x >>= (\\k -> f k >>= g)`\n- Apply Superclass: `apply f x = f >>= \\f’ -> map f’ x`\n\nAssociativity tells us that we can regroup operations which use `do`\nnotation so that we can unambiguously write, for example:\n\n```purescript\ndo x <- m1\n y <- m2 x\n m3 x y\n```\n","title":"Bind","info":{"fundeps":[],"arguments":[["m",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Control","Apply"],"Apply"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"m"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[50,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[51,47]}},{"children":[],"comments":null,"title":"(>>=)","info":{"declType":"alias","alias":[["Control","Bind"],{"Right":{"Left":{"Ident":"bind"}}}],"fixity":{"associativity":"infixl","precedence":1}},"sourceSpan":{"start":[53,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[53,21]}},{"children":[],"comments":"`bindFlipped` is `bind` with its arguments reversed. For example:\n\n```purescript\nprint =<< random\n```\n","title":"bindFlipped","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["m",{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Control","Bind"],"Bind"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"m"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}]}]},null]},null]},null]}},"sourceSpan":{"start":[60,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[60,64]}},{"children":[],"comments":null,"title":"(=<<)","info":{"declType":"alias","alias":[["Control","Bind"],{"Right":{"Left":{"Ident":"bindFlipped"}}}],"fixity":{"associativity":"infixr","precedence":1}},"sourceSpan":{"start":[63,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[63,28]}},{"children":[{"comments":null,"title":"discard","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"ForAll","contents":["f",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Control","Bind"],"Bind"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"f"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}]}]},null]},null]}},"sourceSpan":{"start":[102,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[102,60]}},{"comments":null,"title":"discardUnit","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Bind"],"Discard"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}},"sourceSpan":{"start":[104,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[105,17]}},{"comments":null,"title":"discardProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Bind"],"Discard"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[107,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[108,17]}},{"comments":null,"title":"discardProxy2","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Bind"],"Discard"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy2"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[110,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[111,17]}},{"comments":null,"title":"discardProxy3","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Bind"],"Discard"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy3"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[113,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[114,17]}}],"comments":"A class for types whose values can safely be discarded\nin a `do` notation block.\n\nAn example is the `Unit` type, since there is only one\npossible value which can be returned.\n","title":"Discard","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[101,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[102,60]}},{"children":[],"comments":"Collapse two applications of a monadic type constructor into one.\n","title":"join","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["m",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Control","Bind"],"Bind"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"m"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}]},null]},null]}},"sourceSpan":{"start":[117,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[117,45]}},{"children":[],"comments":"Forwards Kleisli composition.\n\nFor example:\n\n```purescript\nimport Data.Array (head, tail)\n\nthird = tail >=> tail >=> head\n```\n","title":"composeKleisli","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"ForAll","contents":["c",{"annotation":[],"tag":"ForAll","contents":["m",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Control","Bind"],"Bind"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"m"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"b"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeVar","contents":"c"}]}]}}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeVar","contents":"c"}]}]}]}]}]},null]},null]},null]},null]}},"sourceSpan":{"start":[129,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[129,81]}},{"children":[],"comments":null,"title":"(>=>)","info":{"declType":"alias","alias":[["Control","Bind"],{"Right":{"Left":{"Ident":"composeKleisli"}}}],"fixity":{"associativity":"infixr","precedence":1}},"sourceSpan":{"start":[132,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[132,31]}},{"children":[],"comments":"Backwards Kleisli composition.\n","title":"composeKleisliFlipped","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"ForAll","contents":["c",{"annotation":[],"tag":"ForAll","contents":["m",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Control","Bind"],"Bind"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"m"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"b"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeVar","contents":"c"}]}]}}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeVar","contents":"c"}]}]}]}]}]},null]},null]},null]},null]}},"sourceSpan":{"start":[135,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[135,88]}},{"children":[],"comments":null,"title":"(<=<)","info":{"declType":"alias","alias":[["Control","Bind"],{"Right":{"Left":{"Ident":"composeKleisliFlipped"}}}],"fixity":{"associativity":"infixr","precedence":1}},"sourceSpan":{"start":[138,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[138,38]}},{"children":[],"comments":"Execute a monadic action if a condition holds.\n\nFor example:\n\n```purescript\nmain = ifM ((< 0.5) <$> random)\n (trace \"Heads\")\n (trace \"Tails\")\n```\n","title":"ifM","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["m",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Control","Bind"],"Bind"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"m"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}]}]}]},null]},null]}},"sourceSpan":{"start":[149,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[149,60]}}]},{"reExports":[{"moduleName":{"package":null,"item":["Control","Semigroupoid"]},"declarations":[{"children":[{"comments":null,"title":"compose","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"ForAll","contents":["c",{"annotation":[],"tag":"ForAll","contents":["d",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"a"},{"annotation":[],"tag":"TypeVar","contents":"c"}]},{"annotation":[],"tag":"TypeVar","contents":"d"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"a"},{"annotation":[],"tag":"TypeVar","contents":"b"}]},{"annotation":[],"tag":"TypeVar","contents":"c"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"a"},{"annotation":[],"tag":"TypeVar","contents":"b"}]},{"annotation":[],"tag":"TypeVar","contents":"d"}]}]}]},null]},null]},null]}},"sourceSpan":{"start":[14,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Semigroupoid.purs","end":[14,51]}},{"comments":null,"title":"semigroupoidFn","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Semigroupoid"],"Semigroupoid"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]}]}},"sourceSpan":{"start":[16,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Semigroupoid.purs","end":[17,26]}}],"comments":null,"title":"Semigroupoid","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[13,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Semigroupoid.purs","end":[14,51]}},{"children":[],"comments":null,"title":"(>>>)","info":{"declType":"alias","alias":[["Control","Semigroupoid"],{"Right":{"Left":{"Ident":"composeFlipped"}}}],"fixity":{"associativity":"infixr","precedence":9}},"sourceSpan":{"start":[25,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Semigroupoid.purs","end":[25,31]}},{"children":[],"comments":null,"title":"(<<<)","info":{"declType":"alias","alias":[["Control","Semigroupoid"],{"Right":{"Left":{"Ident":"compose"}}}],"fixity":{"associativity":"infixr","precedence":9}},"sourceSpan":{"start":[19,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Semigroupoid.purs","end":[19,24]}}]}],"name":"Control.Category","comments":null,"declarations":[{"children":[{"comments":null,"title":"identity","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"ForAll","contents":["t",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"a"},{"annotation":[],"tag":"TypeVar","contents":"t"}]},{"annotation":[],"tag":"TypeVar","contents":"t"}]},null]}},"sourceSpan":{"start":[18,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Category.purs","end":[18,30]}},{"comments":null,"title":"categoryFn","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Category"],"Category"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]}]}},"sourceSpan":{"start":[20,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Category.purs","end":[21,17]}}],"comments":null,"title":"Category","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Control","Semigroupoid"],"Semigroupoid"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[17,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Category.purs","end":[18,30]}}]},{"reExports":[{"moduleName":{"package":null,"item":["Control","Applicative"]},"declarations":[{"children":[{"comments":null,"title":"pure","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},null]}},"sourceSpan":{"start":[34,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Applicative.purs","end":[34,29]}},{"comments":null,"title":"applicativeFn","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Applicative"],"Applicative"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"r"}]}]}},"sourceSpan":{"start":[36,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Applicative.purs","end":[37,15]}},{"comments":null,"title":"applicativeArray","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Applicative"],"Applicative"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Array"]}]}},"sourceSpan":{"start":[39,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Applicative.purs","end":[40,15]}},{"comments":null,"title":"applicativeProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Applicative"],"Applicative"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]}]}},"sourceSpan":{"start":[42,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Applicative.purs","end":[43,17]}}],"comments":"The `Applicative` type class extends the [`Apply`](#apply) type class\nwith a `pure` function, which can be used to create values of type `f a`\nfrom values of type `a`.\n\nWhere [`Apply`](#apply) provides the ability to lift functions of two or\nmore arguments to functions whose arguments are wrapped using `f`, and\n[`Functor`](#functor) provides the ability to lift functions of one\nargument, `pure` can be seen as the function which lifts functions of\n_zero_ arguments. That is, `Applicative` functors support a lifting\noperation for any number of function arguments.\n\nInstances must satisfy the following laws in addition to the `Apply`\nlaws:\n\n- Identity: `(pure identity) <*> v = v`\n- Composition: `pure (<<<) <*> f <*> g <*> h = f <*> (g <*> h)`\n- Homomorphism: `(pure f) <*> (pure x) = pure (f x)`\n- Interchange: `u <*> (pure y) = (pure (_ $ y)) <*> u`\n","title":"Applicative","info":{"fundeps":[],"arguments":[["f",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Control","Apply"],"Apply"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"f"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[33,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Applicative.purs","end":[34,29]}},{"children":[],"comments":"Perform an applicative action when a condition is true.\n","title":"when","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["m",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Control","Applicative"],"Applicative"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"m"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}]}]}]},null]}},"sourceSpan":{"start":[61,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Applicative.purs","end":[61,63]}},{"children":[],"comments":"Perform an applicative action unless a condition is true.\n","title":"unless","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["m",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Control","Applicative"],"Applicative"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"m"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}]}]}]},null]}},"sourceSpan":{"start":[66,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Applicative.purs","end":[66,65]}},{"children":[],"comments":"`liftA1` provides a default implementation of `(<$>)` for any\n[`Applicative`](#applicative) functor, without using `(<$>)` as provided\nby the [`Functor`](#functor)-[`Applicative`](#applicative) superclass\nrelationship.\n\n`liftA1` can therefore be used to write [`Functor`](#functor) instances\nas follows:\n\n```purescript\ninstance functorF :: Functor F where\n map = liftA1\n```\n","title":"liftA1","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["f",{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Control","Applicative"],"Applicative"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"f"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}]}]},null]},null]},null]}},"sourceSpan":{"start":[57,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Applicative.purs","end":[57,64]}}]},{"moduleName":{"package":null,"item":["Control","Apply"]},"declarations":[{"children":[{"comments":null,"title":"apply","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}]},null]},null]}},"sourceSpan":{"start":[46,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Apply.purs","end":[46,48]}},{"comments":null,"title":"applyFn","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Apply"],"Apply"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"r"}]}]}},"sourceSpan":{"start":[50,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Apply.purs","end":[51,26]}},{"comments":null,"title":"applyArray","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Apply"],"Apply"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Array"]}]}},"sourceSpan":{"start":[53,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Apply.purs","end":[54,21]}},{"comments":null,"title":"applyProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Apply"],"Apply"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]}]}},"sourceSpan":{"start":[58,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Apply.purs","end":[59,20]}}],"comments":"The `Apply` class provides the `(<*>)` which is used to apply a function\nto an argument under a type constructor.\n\n`Apply` can be used to lift functions of two or more arguments to work on\nvalues wrapped with the type constructor `f`. It might also be understood\nin terms of the `lift2` function:\n\n```purescript\nlift2 :: forall f a b c. Apply f => (a -> b -> c) -> f a -> f b -> f c\nlift2 f a b = f <$> a <*> b\n```\n\n`(<*>)` is recovered from `lift2` as `lift2 ($)`. That is, `(<*>)` lifts\nthe function application operator `($)` to arguments wrapped with the\ntype constructor `f`.\n\nPut differently...\n```\nfoo =\n functionTakingNArguments <$> computationProducingArg1\n <*> computationProducingArg2\n <*> ...\n <*> computationProducingArgN\n```\n\nInstances must satisfy the following law in addition to the `Functor`\nlaws:\n\n- Associative composition: `(<<<) <$> f <*> g <*> h = f <*> (g <*> h)`\n\nFormally, `Apply` represents a strong lax semi-monoidal endofunctor.\n","title":"Apply","info":{"fundeps":[],"arguments":[["f",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Data","Functor"],"Functor"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"f"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[45,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Apply.purs","end":[46,48]}},{"children":[],"comments":null,"title":"(<*>)","info":{"declType":"alias","alias":[["Control","Apply"],{"Right":{"Left":{"Ident":"apply"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[48,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Apply.purs","end":[48,22]}},{"children":[],"comments":null,"title":"(<*)","info":{"declType":"alias","alias":[["Control","Apply"],{"Right":{"Left":{"Ident":"applyFirst"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[65,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Apply.purs","end":[65,26]}},{"children":[],"comments":null,"title":"(*>)","info":{"declType":"alias","alias":[["Control","Apply"],{"Right":{"Left":{"Ident":"applySecond"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[71,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Apply.purs","end":[71,27]}}]},{"moduleName":{"package":null,"item":["Control","Bind"]},"declarations":[{"children":[{"comments":null,"title":"bind","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}]},null]},null]}},"sourceSpan":{"start":[51,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[51,47]}},{"comments":null,"title":"bindFn","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Bind"],"Bind"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"r"}]}]}},"sourceSpan":{"start":[65,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[66,25]}},{"comments":"The `bind`/`>>=` function for `Array` works by applying a function to\neach element in the array, and flattening the results into a single,\nnew array.\n\nArray's `bind`/`>>=` works like a nested for loop. Each `bind` adds\nanother level of nesting in the loop. For example:\n```\nfoo :: Array String\nfoo =\n [\"a\", \"b\"] >>= \\eachElementInArray1 ->\n [\"c\", \"d\"] >>= \\eachElementInArray2\n pure (eachElementInArray1 <> eachElementInArray2)\n\n-- In other words...\nfoo\n-- ... is the same as...\n[ (\"a\" <> \"c\"), (\"a\" <> \"d\"), (\"b\" <> \"c\"), (\"b\" <> \"d\") ]\n-- which simplifies to...\n[ \"ac\", \"ad\", \"bc\", \"bd\" ]\n```\n","title":"bindArray","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Bind"],"Bind"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Array"]}]}},"sourceSpan":{"start":[88,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[89,19]}},{"comments":null,"title":"bindProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Bind"],"Bind"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]}]}},"sourceSpan":{"start":[93,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[94,19]}}],"comments":"The `Bind` type class extends the [`Apply`](#apply) type class with a\n\"bind\" operation `(>>=)` which composes computations in sequence, using\nthe return value of one computation to determine the next computation.\n\nThe `>>=` operator can also be expressed using `do` notation, as follows:\n\n```purescript\nx >>= f = do y <- x\n f y\n```\n\nwhere the function argument of `f` is given the name `y`.\n\nInstances must satisfy the following laws in addition to the `Apply`\nlaws:\n\n- Associativity: `(x >>= f) >>= g = x >>= (\\k -> f k >>= g)`\n- Apply Superclass: `apply f x = f >>= \\f’ -> map f’ x`\n\nAssociativity tells us that we can regroup operations which use `do`\nnotation so that we can unambiguously write, for example:\n\n```purescript\ndo x <- m1\n y <- m2 x\n m3 x y\n```\n","title":"Bind","info":{"fundeps":[],"arguments":[["m",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Control","Apply"],"Apply"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"m"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[50,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[51,47]}},{"children":[],"comments":"Collapse two applications of a monadic type constructor into one.\n","title":"join","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["m",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Control","Bind"],"Bind"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"m"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}]},null]},null]}},"sourceSpan":{"start":[117,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[117,45]}},{"children":[],"comments":"Execute a monadic action if a condition holds.\n\nFor example:\n\n```purescript\nmain = ifM ((< 0.5) <$> random)\n (trace \"Heads\")\n (trace \"Tails\")\n```\n","title":"ifM","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["m",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Control","Bind"],"Bind"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"m"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}]}]}]},null]},null]}},"sourceSpan":{"start":[149,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[149,60]}},{"children":[],"comments":null,"title":"(>>=)","info":{"declType":"alias","alias":[["Control","Bind"],{"Right":{"Left":{"Ident":"bind"}}}],"fixity":{"associativity":"infixl","precedence":1}},"sourceSpan":{"start":[53,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[53,21]}},{"children":[],"comments":null,"title":"(>=>)","info":{"declType":"alias","alias":[["Control","Bind"],{"Right":{"Left":{"Ident":"composeKleisli"}}}],"fixity":{"associativity":"infixr","precedence":1}},"sourceSpan":{"start":[132,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[132,31]}},{"children":[],"comments":null,"title":"(=<<)","info":{"declType":"alias","alias":[["Control","Bind"],{"Right":{"Left":{"Ident":"bindFlipped"}}}],"fixity":{"associativity":"infixr","precedence":1}},"sourceSpan":{"start":[63,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[63,28]}},{"children":[],"comments":null,"title":"(<=<)","info":{"declType":"alias","alias":[["Control","Bind"],{"Right":{"Left":{"Ident":"composeKleisliFlipped"}}}],"fixity":{"associativity":"infixr","precedence":1}},"sourceSpan":{"start":[138,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[138,38]}}]},{"moduleName":{"package":null,"item":["Data","Functor"]},"declarations":[{"children":[{"comments":null,"title":"map","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}]},null]},null]}},"sourceSpan":{"start":[26,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[26,44]}},{"comments":null,"title":"functorFn","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Functor"],"Functor"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"r"}]}]}},"sourceSpan":{"start":[40,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[41,16]}},{"comments":null,"title":"functorArray","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Functor"],"Functor"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Array"]}]}},"sourceSpan":{"start":[43,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[44,17]}},{"comments":null,"title":"functorProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Functor"],"Functor"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]}]}},"sourceSpan":{"start":[46,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[47,18]}}],"comments":"A `Functor` is a type constructor which supports a mapping operation\n`map`.\n\n`map` can be used to turn functions `a -> b` into functions\n`f a -> f b` whose argument and return types use the type constructor `f`\nto represent some computational context.\n\nInstances must satisfy the following laws:\n\n- Identity: `map identity = identity`\n- Composition: `map (f <<< g) = map f <<< map g`\n","title":"Functor","info":{"fundeps":[],"arguments":[["f",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[25,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[26,44]}},{"children":[],"comments":"The `void` function is used to ignore the type wrapped by a\n[`Functor`](#functor), replacing it with `Unit` and keeping only the type\ninformation provided by the type constructor itself.\n\n`void` is often useful when using `do` notation to change the return type\nof a monadic computation:\n\n```purescript\nmain = forE 1 10 \\n -> void do\n print n\n print (n * n)\n```\n","title":"void","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["f",{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Functor"],"Functor"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"f"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}]}]},null]},null]}},"sourceSpan":{"start":[63,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[63,47]}},{"children":[],"comments":null,"title":"(<$>)","info":{"declType":"alias","alias":[["Data","Functor"],{"Right":{"Left":{"Ident":"map"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[28,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[28,20]}},{"children":[],"comments":null,"title":"(<$)","info":{"declType":"alias","alias":[["Data","Functor"],{"Right":{"Left":{"Ident":"voidRight"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[71,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[71,25]}},{"children":[],"comments":null,"title":"(<#>)","info":{"declType":"alias","alias":[["Data","Functor"],{"Right":{"Left":{"Ident":"mapFlipped"}}}],"fixity":{"associativity":"infixl","precedence":1}},"sourceSpan":{"start":[38,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[38,27]}},{"children":[],"comments":null,"title":"($>)","info":{"declType":"alias","alias":[["Data","Functor"],{"Right":{"Left":{"Ident":"voidLeft"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[77,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[77,24]}}]}],"name":"Control.Monad","comments":null,"declarations":[{"children":[{"comments":null,"title":"monadFn","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Monad"],"Monad"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"r"}]}]}},"sourceSpan":{"start":[33,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Monad.purs","end":[33,35]}},{"comments":null,"title":"monadArray","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Monad"],"Monad"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Array"]}]}},"sourceSpan":{"start":[35,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Monad.purs","end":[35,35]}},{"comments":null,"title":"monadProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Monad"],"Monad"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]}]}},"sourceSpan":{"start":[37,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Monad.purs","end":[37,35]}}],"comments":"The `Monad` type class combines the operations of the `Bind` and\n`Applicative` type classes. Therefore, `Monad` instances represent type\nconstructors which support sequential composition, and also lifting of\nfunctions of arbitrary arity.\n\nInstances must satisfy the following laws in addition to the\n`Applicative` and `Bind` laws:\n\n- Left Identity: `pure x >>= f = f x`\n- Right Identity: `x >>= pure = x`\n","title":"Monad","info":{"fundeps":[],"arguments":[["m",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Control","Applicative"],"Applicative"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"m"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Control","Bind"],"Bind"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"m"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[31,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Monad.purs","end":[31,41]}},{"children":[],"comments":"`liftM1` provides a default implementation of `(<$>)` for any\n[`Monad`](#monad), without using `(<$>)` as provided by the\n[`Functor`](#functor)-[`Monad`](#monad) superclass relationship.\n\n`liftM1` can therefore be used to write [`Functor`](#functor) instances\nas follows:\n\n```purescript\ninstance functorF :: Functor F where\n map = liftM1\n```\n","title":"liftM1","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["m",{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Control","Monad"],"Monad"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"m"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}]}]},null]},null]},null]}},"sourceSpan":{"start":[50,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Monad.purs","end":[50,58]}},{"children":[],"comments":"Perform a monadic action when a condition is true, where the conditional\nvalue is also in a monadic context.\n","title":"whenM","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["m",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Control","Monad"],"Monad"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"m"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}]}]}]},null]}},"sourceSpan":{"start":[57,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Monad.purs","end":[57,60]}},{"children":[],"comments":"Perform a monadic action unless a condition is true, where the conditional\nvalue is also in a monadic context.\n","title":"unlessM","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["m",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Control","Monad"],"Monad"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"m"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}]}]}]},null]}},"sourceSpan":{"start":[64,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Monad.purs","end":[64,62]}},{"children":[],"comments":"`ap` provides a default implementation of `(<*>)` for any `Monad`, without\nusing `(<*>)` as provided by the `Apply`-`Monad` superclass relationship.\n\n`ap` can therefore be used to write `Apply` instances as follows:\n\n```purescript\ninstance applyF :: Apply F where\n apply = ap\n```\n","title":"ap","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["m",{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Control","Monad"],"Monad"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"m"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}]}]},null]},null]},null]}},"sourceSpan":{"start":[82,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Monad.purs","end":[82,56]}}]},{"reExports":[],"name":"Control.Semigroupoid","comments":null,"declarations":[{"children":[{"comments":null,"title":"compose","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"ForAll","contents":["c",{"annotation":[],"tag":"ForAll","contents":["d",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"a"},{"annotation":[],"tag":"TypeVar","contents":"c"}]},{"annotation":[],"tag":"TypeVar","contents":"d"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"a"},{"annotation":[],"tag":"TypeVar","contents":"b"}]},{"annotation":[],"tag":"TypeVar","contents":"c"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"a"},{"annotation":[],"tag":"TypeVar","contents":"b"}]},{"annotation":[],"tag":"TypeVar","contents":"d"}]}]}]},null]},null]},null]}},"sourceSpan":{"start":[14,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Semigroupoid.purs","end":[14,51]}},{"comments":null,"title":"semigroupoidFn","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Semigroupoid"],"Semigroupoid"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]}]}},"sourceSpan":{"start":[16,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Semigroupoid.purs","end":[17,26]}}],"comments":null,"title":"Semigroupoid","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[13,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Semigroupoid.purs","end":[14,51]}},{"children":[],"comments":null,"title":"(<<<)","info":{"declType":"alias","alias":[["Control","Semigroupoid"],{"Right":{"Left":{"Ident":"compose"}}}],"fixity":{"associativity":"infixr","precedence":9}},"sourceSpan":{"start":[19,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Semigroupoid.purs","end":[19,24]}},{"children":[],"comments":"Forwards composition, or `compose` with its arguments reversed.\n","title":"composeFlipped","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"ForAll","contents":["c",{"annotation":[],"tag":"ForAll","contents":["d",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Control","Semigroupoid"],"Semigroupoid"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"a"},{"annotation":[],"tag":"TypeVar","contents":"b"}]},{"annotation":[],"tag":"TypeVar","contents":"c"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"a"},{"annotation":[],"tag":"TypeVar","contents":"c"}]},{"annotation":[],"tag":"TypeVar","contents":"d"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"a"},{"annotation":[],"tag":"TypeVar","contents":"b"}]},{"annotation":[],"tag":"TypeVar","contents":"d"}]}]}]}]},null]},null]},null]},null]}},"sourceSpan":{"start":[22,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Semigroupoid.purs","end":[22,76]}},{"children":[],"comments":null,"title":"(>>>)","info":{"declType":"alias","alias":[["Control","Semigroupoid"],{"Right":{"Left":{"Ident":"composeFlipped"}}}],"fixity":{"associativity":"infixr","precedence":9}},"sourceSpan":{"start":[25,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Semigroupoid.purs","end":[25,31]}}]},{"reExports":[],"name":"Data.Boolean","comments":null,"declarations":[{"children":[],"comments":"An alias for `true`, which can be useful in guard clauses:\n\n```purescript\nmax x y | x >= y = x\n | otherwise = y\n```\n","title":"otherwise","info":{"declType":"value","type":{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}},"sourceSpan":{"start":[9,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Boolean.purs","end":[9,21]}}]},{"reExports":[{"moduleName":{"package":null,"item":["Data","HeytingAlgebra"]},"declarations":[{"children":[{"comments":null,"title":"ff","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeVar","contents":"a"}},"sourceSpan":{"start":[39,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[39,10]}},{"comments":null,"title":"tt","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeVar","contents":"a"}},"sourceSpan":{"start":[40,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[40,10]}},{"comments":null,"title":"implies","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[41,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[41,25]}},{"comments":null,"title":"conj","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[42,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[42,22]}},{"comments":null,"title":"disj","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[43,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[43,22]}},{"comments":null,"title":"not","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}},"sourceSpan":{"start":[44,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[44,16]}},{"comments":null,"title":"heytingAlgebraBoolean","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","HeytingAlgebra"],"HeytingAlgebra"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}},"sourceSpan":{"start":[49,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[55,16]}},{"comments":null,"title":"heytingAlgebraUnit","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","HeytingAlgebra"],"HeytingAlgebra"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}},"sourceSpan":{"start":[57,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[63,15]}},{"comments":null,"title":"heytingAlgebraFunction","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","HeytingAlgebra"],"HeytingAlgebra"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"b"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","HeytingAlgebra"],"HeytingAlgebra"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}},"sourceSpan":{"start":[65,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[71,22]}},{"comments":null,"title":"heytingAlgebraProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","HeytingAlgebra"],"HeytingAlgebra"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[73,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[79,13]}},{"comments":null,"title":"heytingAlgebraProxy2","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","HeytingAlgebra"],"HeytingAlgebra"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy2"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[81,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[87,14]}},{"comments":null,"title":"heytingAlgebraProxy3","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","HeytingAlgebra"],"HeytingAlgebra"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy3"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[89,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[95,14]}},{"comments":null,"title":"heytingAlgebraRecord","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"list"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","HeytingAlgebra"],"HeytingAlgebraRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"list"},{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"row"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","HeytingAlgebra"],"HeytingAlgebra"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]}},"sourceSpan":{"start":[97,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[103,41]}}],"comments":"The `HeytingAlgebra` type class represents types that are bounded lattices with\nan implication operator such that the following laws hold:\n\n- Associativity:\n - `a || (b || c) = (a || b) || c`\n - `a && (b && c) = (a && b) && c`\n- Commutativity:\n - `a || b = b || a`\n - `a && b = b && a`\n- Absorption:\n - `a || (a && b) = a`\n - `a && (a || b) = a`\n- Idempotent:\n - `a || a = a`\n - `a && a = a`\n- Identity:\n - `a || ff = a`\n - `a && tt = a`\n- Implication:\n - ``a `implies` a = tt``\n - ``a && (a `implies` b) = a && b``\n - ``b && (a `implies` b) = b``\n - ``a `implies` (b && c) = (a `implies` b) && (a `implies` c)``\n- Complemented:\n - ``not a = a `implies` ff``\n","title":"HeytingAlgebra","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[38,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[44,16]}},{"children":[{"comments":null,"title":"heytingAlgebraRecordNil","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","HeytingAlgebra"],"HeytingAlgebraRecord"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim","RowList"],"Nil"]}]},{"annotation":[],"tag":"TypeVar","contents":"row"}]},{"annotation":[],"tag":"REmpty"}]}},"sourceSpan":{"start":[120,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[126,20]}},{"comments":null,"title":"heytingAlgebraRecordCons","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Symbol"],"IsSymbol"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"key"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Prim","Row"],"Cons"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"key"},{"annotation":[],"tag":"TypeVar","contents":"focus"},{"annotation":[],"tag":"TypeVar","contents":"subrowTail"},{"annotation":[],"tag":"TypeVar","contents":"subrow"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","HeytingAlgebra"],"HeytingAlgebraRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"rowlistTail"},{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"subrowTail"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","HeytingAlgebra"],"HeytingAlgebra"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"focus"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","HeytingAlgebra"],"HeytingAlgebraRecord"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim","RowList"],"Cons"]},{"annotation":[],"tag":"TypeVar","contents":"key"}]},{"annotation":[],"tag":"TypeVar","contents":"focus"}]},{"annotation":[],"tag":"TypeVar","contents":"rowlistTail"}]}]},{"annotation":[],"tag":"TypeVar","contents":"row"}]},{"annotation":[],"tag":"TypeVar","contents":"subrow"}]}},"sourceSpan":{"start":[128,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[174,55]}}],"comments":null,"title":"HeytingAlgebraRecord","info":{"fundeps":[[["rowlist"],["subrow"]]],"arguments":[["rowlist",null],["row",null],["subrow",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[112,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[118,78]}},{"children":[],"comments":null,"title":"(||)","info":{"declType":"alias","alias":[["Data","HeytingAlgebra"],{"Right":{"Left":{"Ident":"disj"}}}],"fixity":{"associativity":"infixr","precedence":2}},"sourceSpan":{"start":[47,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[47,20]}},{"children":[],"comments":null,"title":"(&&)","info":{"declType":"alias","alias":[["Data","HeytingAlgebra"],{"Right":{"Left":{"Ident":"conj"}}}],"fixity":{"associativity":"infixr","precedence":3}},"sourceSpan":{"start":[46,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[46,20]}}]}],"name":"Data.BooleanAlgebra","comments":null,"declarations":[{"children":[{"comments":null,"title":"booleanAlgebraBoolean","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","BooleanAlgebra"],"BooleanAlgebra"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}},"sourceSpan":{"start":[24,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/BooleanAlgebra.purs","end":[24,57]}},{"comments":null,"title":"booleanAlgebraUnit","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","BooleanAlgebra"],"BooleanAlgebra"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}},"sourceSpan":{"start":[25,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/BooleanAlgebra.purs","end":[25,51]}},{"comments":null,"title":"booleanAlgebraFn","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","BooleanAlgebra"],"BooleanAlgebra"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"b"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","BooleanAlgebra"],"BooleanAlgebra"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}},"sourceSpan":{"start":[26,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/BooleanAlgebra.purs","end":[26,73]}},{"comments":null,"title":"booleanAlgebraRecord","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"list"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","BooleanAlgebra"],"BooleanAlgebraRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"list"},{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"row"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","BooleanAlgebra"],"BooleanAlgebra"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]}},"sourceSpan":{"start":[27,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/BooleanAlgebra.purs","end":[27,123]}},{"comments":null,"title":"booleanAlgebraProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","BooleanAlgebra"],"BooleanAlgebra"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[28,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/BooleanAlgebra.purs","end":[28,57]}},{"comments":null,"title":"booleanAlgebraProxy2","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","BooleanAlgebra"],"BooleanAlgebra"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy2"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[29,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/BooleanAlgebra.purs","end":[29,59]}},{"comments":null,"title":"booleanAlgebraProxy3","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","BooleanAlgebra"],"BooleanAlgebra"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy3"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[30,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/BooleanAlgebra.purs","end":[30,59]}}],"comments":"The `BooleanAlgebra` type class represents types that behave like boolean\nvalues.\n\nInstances should satisfy the following laws in addition to the\n`HeytingAlgebra` law:\n\n- Excluded middle:\n - `a || not a = tt`\n","title":"BooleanAlgebra","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Data","HeytingAlgebra"],"HeytingAlgebra"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[22,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/BooleanAlgebra.purs","end":[22,43]}},{"children":[{"comments":null,"title":"booleanAlgebraRecordNil","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","BooleanAlgebra"],"BooleanAlgebraRecord"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim","RowList"],"Nil"]}]},{"annotation":[],"tag":"TypeVar","contents":"row"}]},{"annotation":[],"tag":"REmpty"}]}},"sourceSpan":{"start":[37,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/BooleanAlgebra.purs","end":[37,71]}},{"comments":null,"title":"booleanAlgebraRecordCons","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Symbol"],"IsSymbol"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"key"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Prim","Row"],"Cons"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"key"},{"annotation":[],"tag":"TypeVar","contents":"focus"},{"annotation":[],"tag":"TypeVar","contents":"subrowTail"},{"annotation":[],"tag":"TypeVar","contents":"subrow"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","BooleanAlgebra"],"BooleanAlgebraRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"rowlistTail"},{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"subrowTail"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","BooleanAlgebra"],"BooleanAlgebra"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"focus"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","BooleanAlgebra"],"BooleanAlgebraRecord"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim","RowList"],"Cons"]},{"annotation":[],"tag":"TypeVar","contents":"key"}]},{"annotation":[],"tag":"TypeVar","contents":"focus"}]},{"annotation":[],"tag":"TypeVar","contents":"rowlistTail"}]}]},{"annotation":[],"tag":"TypeVar","contents":"row"}]},{"annotation":[],"tag":"TypeVar","contents":"subrow"}]}},"sourceSpan":{"start":[39,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/BooleanAlgebra.purs","end":[45,71]}}],"comments":null,"title":"BooleanAlgebraRecord","info":{"fundeps":[[["rowlist"],["subrow"]]],"arguments":[["rowlist",null],["row",null],["subrow",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Data","HeytingAlgebra"],"HeytingAlgebraRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"rowlist"},{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"subrow"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[35,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/BooleanAlgebra.purs","end":[35,109]}}]},{"reExports":[{"moduleName":{"package":null,"item":["Data","Ord"]},"declarations":[{"children":[{"comments":null,"title":"LT","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"GT","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"EQ","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"eqOrdering","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ordering"],"Ordering"]}]}},"sourceSpan":{"start":[15,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ordering.purs","end":[19,19]}},{"comments":null,"title":"semigroupOrdering","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup"],"Semigroup"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ordering"],"Ordering"]}]}},"sourceSpan":{"start":[21,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ordering.purs","end":[24,18]}},{"comments":null,"title":"showOrdering","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ordering"],"Ordering"]}]}},"sourceSpan":{"start":[26,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ordering.purs","end":[29,17]}}],"comments":"The `Ordering` data type represents the three possible outcomes of\ncomparing two values:\n\n`LT` - The first value is _less than_ the second.\n`GT` - The first value is _greater than_ the second.\n`EQ` - The first value is _equal to_ the second.\n","title":"Ordering","info":{"declType":"data","dataDeclType":"data","typeArguments":[]},"sourceSpan":{"start":[13,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ordering.purs","end":[13,29]}},{"children":[{"comments":null,"title":"compare","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ordering"],"Ordering"]}]}]}},"sourceSpan":{"start":[38,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[38,32]}},{"comments":null,"title":"ordBoolean","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}},"sourceSpan":{"start":[40,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[41,36]}},{"comments":null,"title":"ordInt","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Int"]}]}},"sourceSpan":{"start":[43,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[44,32]}},{"comments":null,"title":"ordNumber","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Number"]}]}},"sourceSpan":{"start":[46,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[47,35]}},{"comments":null,"title":"ordString","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"String"]}]}},"sourceSpan":{"start":[49,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[50,35]}},{"comments":null,"title":"ordChar","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Char"]}]}},"sourceSpan":{"start":[52,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[53,33]}},{"comments":null,"title":"ordUnit","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}},"sourceSpan":{"start":[55,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[56,19]}},{"comments":null,"title":"ordVoid","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Void"],"Void"]}]}},"sourceSpan":{"start":[58,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[59,19]}},{"comments":null,"title":"ordProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[61,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[62,19]}},{"comments":null,"title":"ordProxy2","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy2"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[64,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[65,19]}},{"comments":null,"title":"ordProxy3","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy3"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[67,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[68,19]}},{"comments":null,"title":"ordArray","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Ord"],"Ord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Array"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[70,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[77,17]}},{"comments":null,"title":"ordOrdering","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ordering"],"Ordering"]}]}},"sourceSpan":{"start":[121,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[128,21]}},{"comments":null,"title":"ordRecord","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"list"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Ord"],"OrdRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"list"},{"annotation":[],"tag":"TypeVar","contents":"row"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]}},"sourceSpan":{"start":[249,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[254,48]}}],"comments":"The `Ord` type class represents types which support comparisons with a\n_total order_.\n\n`Ord` instances should satisfy the laws of total orderings:\n\n- Reflexivity: `a <= a`\n- Antisymmetry: if `a <= b` and `b <= a` then `a = b`\n- Transitivity: if `a <= b` and `b <= c` then `a <= c`\n","title":"Ord","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Data","Eq"],"Eq"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[37,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[38,32]}},{"children":[{"comments":null,"title":"ordRecordNil","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"OrdRecord"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim","RowList"],"Nil"]}]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}},"sourceSpan":{"start":[230,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[231,27]}},{"comments":null,"title":"ordRecordCons","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Ord"],"OrdRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"rowlistTail"},{"annotation":[],"tag":"TypeVar","contents":"row"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Prim","Row"],"Cons"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"key"},{"annotation":[],"tag":"TypeVar","contents":"focus"},{"annotation":[],"tag":"TypeVar","contents":"rowTail"},{"annotation":[],"tag":"TypeVar","contents":"row"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Symbol"],"IsSymbol"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"key"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Ord"],"Ord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"focus"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"OrdRecord"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim","RowList"],"Cons"]},{"annotation":[],"tag":"TypeVar","contents":"key"}]},{"annotation":[],"tag":"TypeVar","contents":"focus"}]},{"annotation":[],"tag":"TypeVar","contents":"rowlistTail"}]}]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}},"sourceSpan":{"start":[233,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[247,59]}}],"comments":null,"title":"OrdRecord","info":{"fundeps":[],"arguments":[["rowlist",null],["row",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Data","Eq"],"EqRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"rowlist"},{"annotation":[],"tag":"TypeVar","contents":"row"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[227,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[228,91]}},{"children":[],"comments":null,"title":"(>=)","info":{"declType":"alias","alias":[["Data","Ord"],{"Right":{"Left":{"Ident":"greaterThanOrEq"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[157,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[157,31]}},{"children":[],"comments":null,"title":"(>)","info":{"declType":"alias","alias":[["Data","Ord"],{"Right":{"Left":{"Ident":"greaterThan"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[156,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[156,26]}},{"children":[],"comments":null,"title":"(<=)","info":{"declType":"alias","alias":[["Data","Ord"],{"Right":{"Left":{"Ident":"lessThanOrEq"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[155,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[155,28]}},{"children":[],"comments":null,"title":"(<)","info":{"declType":"alias","alias":[["Data","Ord"],{"Right":{"Left":{"Ident":"lessThan"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[154,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[154,23]}}]}],"name":"Data.Bounded","comments":null,"declarations":[{"children":[{"comments":null,"title":"top","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeVar","contents":"a"}},"sourceSpan":{"start":[24,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded.purs","end":[24,11]}},{"comments":null,"title":"bottom","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeVar","contents":"a"}},"sourceSpan":{"start":[25,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded.purs","end":[25,14]}},{"comments":null,"title":"boundedBoolean","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Bounded"],"Bounded"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}},"sourceSpan":{"start":[27,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded.purs","end":[29,17]}},{"comments":"The `Bounded` `Int` instance has `top :: Int` equal to 2^31 - 1,\nand `bottom :: Int` equal to -2^31, since these are the largest and smallest\nintegers representable by twos-complement 32-bit integers, respectively.\n","title":"boundedInt","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Bounded"],"Bounded"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Int"]}]}},"sourceSpan":{"start":[34,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded.purs","end":[36,21]}},{"comments":"Characters fall within the Unicode range.\n","title":"boundedChar","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Bounded"],"Bounded"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Char"]}]}},"sourceSpan":{"start":[42,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded.purs","end":[44,22]}},{"comments":null,"title":"boundedOrdering","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Bounded"],"Bounded"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ordering"],"Ordering"]}]}},"sourceSpan":{"start":[49,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded.purs","end":[51,14]}},{"comments":null,"title":"boundedUnit","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Bounded"],"Bounded"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}},"sourceSpan":{"start":[53,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded.purs","end":[55,16]}},{"comments":null,"title":"boundedNumber","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Bounded"],"Bounded"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Number"]}]}},"sourceSpan":{"start":[60,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded.purs","end":[62,24]}},{"comments":null,"title":"boundedProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Bounded"],"Bounded"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[64,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded.purs","end":[66,14]}},{"comments":null,"title":"boundedProxy2","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Bounded"],"Bounded"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy2"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[68,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded.purs","end":[70,15]}},{"comments":null,"title":"boundedProxy3","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Bounded"],"Bounded"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy3"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[72,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded.purs","end":[74,15]}},{"comments":null,"title":"boundedRecord","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"list"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Bounded"],"BoundedRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"list"},{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"row"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Bounded"],"Bounded"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]}},"sourceSpan":{"start":[107,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded.purs","end":[113,67]}}],"comments":"The `Bounded` type class represents totally ordered types that have an\nupper and lower boundary.\n\nInstances should satisfy the following law in addition to the `Ord` laws:\n\n- Bounded: `bottom <= a <= top`\n","title":"Bounded","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Data","Ord"],"Ord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[23,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded.purs","end":[25,14]}},{"children":[{"comments":null,"title":"topRecord","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"ForAll","contents":["rlproxy",{"annotation":[],"tag":"ForAll","contents":["rproxy",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"rlproxy"},{"annotation":[],"tag":"TypeVar","contents":"rowlist"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"rproxy"},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"subrow"}]}]}]},null]},null]}},"sourceSpan":{"start":[78,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded.purs","end":[78,85]}},{"comments":null,"title":"bottomRecord","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"ForAll","contents":["rlproxy",{"annotation":[],"tag":"ForAll","contents":["rproxy",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"rlproxy"},{"annotation":[],"tag":"TypeVar","contents":"rowlist"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"rproxy"},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"subrow"}]}]}]},null]},null]}},"sourceSpan":{"start":[79,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded.purs","end":[79,88]}},{"comments":null,"title":"boundedRecordNil","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Bounded"],"BoundedRecord"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim","RowList"],"Nil"]}]},{"annotation":[],"tag":"TypeVar","contents":"row"}]},{"annotation":[],"tag":"REmpty"}]}},"sourceSpan":{"start":[81,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded.purs","end":[83,24]}},{"comments":null,"title":"boundedRecordCons","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Symbol"],"IsSymbol"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"key"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Bounded"],"Bounded"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"focus"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Prim","Row"],"Cons"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"key"},{"annotation":[],"tag":"TypeVar","contents":"focus"},{"annotation":[],"tag":"TypeVar","contents":"rowTail"},{"annotation":[],"tag":"TypeVar","contents":"row"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Prim","Row"],"Cons"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"key"},{"annotation":[],"tag":"TypeVar","contents":"focus"},{"annotation":[],"tag":"TypeVar","contents":"subrowTail"},{"annotation":[],"tag":"TypeVar","contents":"subrow"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Bounded"],"BoundedRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"rowlistTail"},{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"subrowTail"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Bounded"],"BoundedRecord"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim","RowList"],"Cons"]},{"annotation":[],"tag":"TypeVar","contents":"key"}]},{"annotation":[],"tag":"TypeVar","contents":"focus"}]},{"annotation":[],"tag":"TypeVar","contents":"rowlistTail"}]}]},{"annotation":[],"tag":"TypeVar","contents":"row"}]},{"annotation":[],"tag":"TypeVar","contents":"subrow"}]}},"sourceSpan":{"start":[85,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded.purs","end":[105,64]}}],"comments":null,"title":"BoundedRecord","info":{"fundeps":[[["rowlist"],["subrow"]]],"arguments":[["rowlist",null],["row",null],["subrow",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Data","Ord"],"OrdRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"rowlist"},{"annotation":[],"tag":"TypeVar","contents":"row"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[77,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded.purs","end":[79,88]}}]},{"reExports":[],"name":"Data.Bounded.Generic","comments":null,"declarations":[{"children":[{"comments":null,"title":"genericBottom'","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeVar","contents":"a"}},"sourceSpan":{"start":[15,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded/Generic.purs","end":[15,22]}},{"comments":null,"title":"genericBottomNoArguments","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Bounded","Generic"],"GenericBottom"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"NoArguments"]}]}},"sourceSpan":{"start":[17,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded/Generic.purs","end":[18,31]}},{"comments":null,"title":"genericBottomArgument","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Bounded"],"Bounded"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Bounded","Generic"],"GenericBottom"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"Argument"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[20,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded/Generic.purs","end":[21,35]}},{"comments":null,"title":"genericBottomSum","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Bounded","Generic"],"GenericBottom"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Bounded","Generic"],"GenericBottom"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"Sum"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}},"sourceSpan":{"start":[23,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded/Generic.purs","end":[24,38]}},{"comments":null,"title":"genericBottomProduct","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Bounded","Generic"],"GenericBottom"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Bounded","Generic"],"GenericBottom"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"b"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Bounded","Generic"],"GenericBottom"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"Product"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}},"sourceSpan":{"start":[26,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded/Generic.purs","end":[27,57]}},{"comments":null,"title":"genericBottomConstructor","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Bounded","Generic"],"GenericBottom"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Bounded","Generic"],"GenericBottom"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"Constructor"]},{"annotation":[],"tag":"TypeVar","contents":"name"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[29,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded/Generic.purs","end":[30,46]}}],"comments":null,"title":"GenericBottom","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[14,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded/Generic.purs","end":[15,22]}},{"children":[],"comments":"A `Generic` implementation of the `bottom` member from the `Bounded` type class.\n","title":"genericBottom","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["rep",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Generic","Rep"],"Generic"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"},{"annotation":[],"tag":"TypeVar","contents":"rep"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Bounded","Generic"],"GenericBottom"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"rep"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},null]},null]}},"sourceSpan":{"start":[51,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded/Generic.purs","end":[51,71]}},{"children":[{"comments":null,"title":"genericTop'","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeVar","contents":"a"}},"sourceSpan":{"start":[33,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded/Generic.purs","end":[33,19]}},{"comments":null,"title":"genericTopNoArguments","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Bounded","Generic"],"GenericTop"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"NoArguments"]}]}},"sourceSpan":{"start":[35,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded/Generic.purs","end":[36,28]}},{"comments":null,"title":"genericTopArgument","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Bounded"],"Bounded"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Bounded","Generic"],"GenericTop"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"Argument"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[38,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded/Generic.purs","end":[39,29]}},{"comments":null,"title":"genericTopSum","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Bounded","Generic"],"GenericTop"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"b"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Bounded","Generic"],"GenericTop"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"Sum"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}},"sourceSpan":{"start":[41,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded/Generic.purs","end":[42,32]}},{"comments":null,"title":"genericTopProduct","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Bounded","Generic"],"GenericTop"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Bounded","Generic"],"GenericTop"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"b"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Bounded","Generic"],"GenericTop"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"Product"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}},"sourceSpan":{"start":[44,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded/Generic.purs","end":[45,48]}},{"comments":null,"title":"genericTopConstructor","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Bounded","Generic"],"GenericTop"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Bounded","Generic"],"GenericTop"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"Constructor"]},{"annotation":[],"tag":"TypeVar","contents":"name"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[47,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded/Generic.purs","end":[48,40]}}],"comments":null,"title":"GenericTop","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[32,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded/Generic.purs","end":[33,19]}},{"children":[],"comments":"A `Generic` implementation of the `top` member from the `Bounded` type class.\n","title":"genericTop","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["rep",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Generic","Rep"],"Generic"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"},{"annotation":[],"tag":"TypeVar","contents":"rep"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Bounded","Generic"],"GenericTop"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"rep"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},null]},null]}},"sourceSpan":{"start":[55,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded/Generic.purs","end":[55,65]}}]},{"reExports":[{"moduleName":{"package":null,"item":["Data","Ring"]},"declarations":[{"children":[{"comments":null,"title":"ringInt","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Int"]}]}},"sourceSpan":{"start":[28,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[29,15]}},{"comments":null,"title":"ringNumber","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Number"]}]}},"sourceSpan":{"start":[31,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[32,15]}},{"comments":null,"title":"ringUnit","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}},"sourceSpan":{"start":[34,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[35,17]}},{"comments":null,"title":"ringFn","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Ring"],"Ring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"b"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}},"sourceSpan":{"start":[37,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[38,24]}},{"comments":null,"title":"ringProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[40,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[41,18]}},{"comments":null,"title":"ringProxy2","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy2"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[43,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[44,19]}},{"comments":null,"title":"ringProxy3","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy3"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[46,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[47,19]}},{"comments":null,"title":"ringRecord","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"list"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Ring"],"RingRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"list"},{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"row"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]}},"sourceSpan":{"start":[49,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[50,40]}}],"comments":"The `Ring` class is for types that support addition, multiplication,\nand subtraction operations.\n\nInstances must satisfy the following laws in addition to the `Semiring`\nlaws:\n\n- Additive inverse: `a - a = zero`\n- Compatibility of `sub` and `negate`: `a - b = a + (zero - b)`\n","title":"Ring","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Data","Semiring"],"Semiring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[23,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[24,21]}},{"children":[{"comments":null,"title":"ringRecordNil","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"RingRecord"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim","RowList"],"Nil"]}]},{"annotation":[],"tag":"TypeVar","contents":"row"}]},{"annotation":[],"tag":"REmpty"}]}},"sourceSpan":{"start":[65,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[66,23]}},{"comments":null,"title":"ringRecordCons","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Symbol"],"IsSymbol"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"key"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Prim","Row"],"Cons"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"key"},{"annotation":[],"tag":"TypeVar","contents":"focus"},{"annotation":[],"tag":"TypeVar","contents":"subrowTail"},{"annotation":[],"tag":"TypeVar","contents":"subrow"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Ring"],"RingRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"rowlistTail"},{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"subrowTail"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Ring"],"Ring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"focus"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"RingRecord"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim","RowList"],"Cons"]},{"annotation":[],"tag":"TypeVar","contents":"key"}]},{"annotation":[],"tag":"TypeVar","contents":"focus"}]},{"annotation":[],"tag":"TypeVar","contents":"rowlistTail"}]}]},{"annotation":[],"tag":"TypeVar","contents":"row"}]},{"annotation":[],"tag":"TypeVar","contents":"subrow"}]}},"sourceSpan":{"start":[68,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[80,58]}}],"comments":null,"title":"RingRecord","info":{"fundeps":[[["rowlist"],["subrow"]]],"arguments":[["rowlist",null],["row",null],["subrow",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Data","Semiring"],"SemiringRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"rowlist"},{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"subrow"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[62,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[63,92]}}]},{"moduleName":{"package":null,"item":["Data","Semiring"]},"declarations":[{"children":[{"comments":null,"title":"add","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[35,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[35,22]}},{"comments":null,"title":"zero","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeVar","contents":"a"}},"sourceSpan":{"start":[36,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[36,12]}},{"comments":null,"title":"mul","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[37,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[37,22]}},{"comments":null,"title":"one","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeVar","contents":"a"}},"sourceSpan":{"start":[38,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[38,12]}},{"comments":null,"title":"semiringInt","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Int"]}]}},"sourceSpan":{"start":[43,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[47,10]}},{"comments":null,"title":"semiringNumber","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Number"]}]}},"sourceSpan":{"start":[49,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[53,12]}},{"comments":null,"title":"semiringFn","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Semiring"],"Semiring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"b"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}},"sourceSpan":{"start":[55,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[59,18]}},{"comments":null,"title":"semiringUnit","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}},"sourceSpan":{"start":[61,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[65,13]}},{"comments":null,"title":"semiringProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[67,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[71,15]}},{"comments":null,"title":"semiringProxy2","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy2"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[73,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[77,16]}},{"comments":null,"title":"semiringProxy3","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy3"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[79,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[83,16]}},{"comments":null,"title":"semiringRecord","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"list"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Semiring"],"SemiringRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"list"},{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"row"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]}},"sourceSpan":{"start":[85,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[89,63]}}],"comments":"The `Semiring` class is for types that support an addition and\nmultiplication operation.\n\nInstances must satisfy the following laws:\n\n- Commutative monoid under addition:\n - Associativity: `(a + b) + c = a + (b + c)`\n - Identity: `zero + a = a + zero = a`\n - Commutative: `a + b = b + a`\n- Monoid under multiplication:\n - Associativity: `(a * b) * c = a * (b * c)`\n - Identity: `one * a = a * one = a`\n- Multiplication distributes over addition:\n - Left distributivity: `a * (b + c) = (a * b) + (a * c)`\n - Right distributivity: `(a + b) * c = (a * c) + (b * c)`\n- Annihilation: `zero * a = a * zero = zero`\n\n**Note:** The `Number` and `Int` types are not fully law abiding\nmembers of this class hierarchy due to the potential for arithmetic\noverflows, and in the case of `Number`, the presence of `NaN` and\n`Infinity` values. The behaviour is unspecified in these cases.\n","title":"Semiring","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[34,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[38,12]}},{"children":[],"comments":null,"title":"(+)","info":{"declType":"alias","alias":[["Data","Semiring"],{"Right":{"Left":{"Ident":"add"}}}],"fixity":{"associativity":"infixl","precedence":6}},"sourceSpan":{"start":[40,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[40,18]}},{"children":[],"comments":null,"title":"(*)","info":{"declType":"alias","alias":[["Data","Semiring"],{"Right":{"Left":{"Ident":"mul"}}}],"fixity":{"associativity":"infixl","precedence":7}},"sourceSpan":{"start":[41,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[41,18]}}]}],"name":"Data.CommutativeRing","comments":null,"declarations":[{"children":[{"comments":null,"title":"commutativeRingInt","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","CommutativeRing"],"CommutativeRing"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Int"]}]}},"sourceSpan":{"start":[25,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/CommutativeRing.purs","end":[25,51]}},{"comments":null,"title":"commutativeRingNumber","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","CommutativeRing"],"CommutativeRing"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Number"]}]}},"sourceSpan":{"start":[26,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/CommutativeRing.purs","end":[26,57]}},{"comments":null,"title":"commutativeRingUnit","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","CommutativeRing"],"CommutativeRing"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}},"sourceSpan":{"start":[27,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/CommutativeRing.purs","end":[27,53]}},{"comments":null,"title":"commutativeRingFn","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","CommutativeRing"],"CommutativeRing"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"b"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","CommutativeRing"],"CommutativeRing"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}},"sourceSpan":{"start":[28,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/CommutativeRing.purs","end":[28,76]}},{"comments":null,"title":"commutativeRingRecord","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"list"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","CommutativeRing"],"CommutativeRingRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"list"},{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"row"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","CommutativeRing"],"CommutativeRing"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]}},"sourceSpan":{"start":[29,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/CommutativeRing.purs","end":[29,126]}},{"comments":null,"title":"commutativeRingProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","CommutativeRing"],"CommutativeRing"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[30,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/CommutativeRing.purs","end":[30,59]}},{"comments":null,"title":"commutativeRingProxy2","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","CommutativeRing"],"CommutativeRing"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy2"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[31,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/CommutativeRing.purs","end":[31,61]}},{"comments":null,"title":"commutativeRingProxy3","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","CommutativeRing"],"CommutativeRing"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy3"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[32,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/CommutativeRing.purs","end":[32,61]}}],"comments":"The `CommutativeRing` class is for rings where multiplication is\ncommutative.\n\nInstances must satisfy the following law in addition to the `Ring`\nlaws:\n\n- Commutative multiplication: `a * b = b * a`\n","title":"CommutativeRing","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Data","Ring"],"Ring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[23,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/CommutativeRing.purs","end":[23,34]}},{"children":[{"comments":null,"title":"commutativeRingRecordNil","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","CommutativeRing"],"CommutativeRingRecord"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim","RowList"],"Nil"]}]},{"annotation":[],"tag":"TypeVar","contents":"row"}]},{"annotation":[],"tag":"REmpty"}]}},"sourceSpan":{"start":[38,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/CommutativeRing.purs","end":[38,73]}},{"comments":null,"title":"commutativeRingRecordCons","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Symbol"],"IsSymbol"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"key"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Prim","Row"],"Cons"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"key"},{"annotation":[],"tag":"TypeVar","contents":"focus"},{"annotation":[],"tag":"TypeVar","contents":"subrowTail"},{"annotation":[],"tag":"TypeVar","contents":"subrow"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","CommutativeRing"],"CommutativeRingRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"rowlistTail"},{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"subrowTail"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","CommutativeRing"],"CommutativeRing"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"focus"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","CommutativeRing"],"CommutativeRingRecord"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim","RowList"],"Cons"]},{"annotation":[],"tag":"TypeVar","contents":"key"}]},{"annotation":[],"tag":"TypeVar","contents":"focus"}]},{"annotation":[],"tag":"TypeVar","contents":"rowlistTail"}]}]},{"annotation":[],"tag":"TypeVar","contents":"row"}]},{"annotation":[],"tag":"TypeVar","contents":"subrow"}]}},"sourceSpan":{"start":[40,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/CommutativeRing.purs","end":[46,72]}}],"comments":"A class for records where all fields have `CommutativeRing` instances, used\nto implement the `CommutativeRing` instance for records.\n","title":"CommutativeRingRecord","info":{"fundeps":[[["rowlist"],["subrow"]]],"arguments":[["rowlist",null],["row",null],["subrow",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Data","Ring"],"RingRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"rowlist"},{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"subrow"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[36,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/CommutativeRing.purs","end":[36,100]}}]},{"reExports":[{"moduleName":{"package":null,"item":["Data","Ring"]},"declarations":[{"children":[{"comments":null,"title":"sub","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[24,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[24,21]}},{"comments":null,"title":"ringInt","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Int"]}]}},"sourceSpan":{"start":[28,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[29,15]}},{"comments":null,"title":"ringNumber","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Number"]}]}},"sourceSpan":{"start":[31,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[32,15]}},{"comments":null,"title":"ringUnit","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}},"sourceSpan":{"start":[34,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[35,17]}},{"comments":null,"title":"ringFn","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Ring"],"Ring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"b"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}},"sourceSpan":{"start":[37,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[38,24]}},{"comments":null,"title":"ringProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[40,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[41,18]}},{"comments":null,"title":"ringProxy2","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy2"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[43,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[44,19]}},{"comments":null,"title":"ringProxy3","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy3"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[46,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[47,19]}},{"comments":null,"title":"ringRecord","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"list"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Ring"],"RingRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"list"},{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"row"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]}},"sourceSpan":{"start":[49,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[50,40]}}],"comments":"The `Ring` class is for types that support addition, multiplication,\nand subtraction operations.\n\nInstances must satisfy the following laws in addition to the `Semiring`\nlaws:\n\n- Additive inverse: `a - a = zero`\n- Compatibility of `sub` and `negate`: `a - b = a + (zero - b)`\n","title":"Ring","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Data","Semiring"],"Semiring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[23,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[24,21]}},{"children":[],"comments":"`negate x` can be used as a shorthand for `zero - x`.\n","title":"negate","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Ring"],"Ring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},null]}},"sourceSpan":{"start":[53,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[53,37]}}]},{"moduleName":{"package":null,"item":["Data","Semiring"]},"declarations":[{"children":[{"comments":null,"title":"add","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[35,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[35,22]}},{"comments":null,"title":"zero","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeVar","contents":"a"}},"sourceSpan":{"start":[36,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[36,12]}},{"comments":null,"title":"mul","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[37,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[37,22]}},{"comments":null,"title":"one","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeVar","contents":"a"}},"sourceSpan":{"start":[38,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[38,12]}},{"comments":null,"title":"semiringInt","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Int"]}]}},"sourceSpan":{"start":[43,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[47,10]}},{"comments":null,"title":"semiringNumber","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Number"]}]}},"sourceSpan":{"start":[49,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[53,12]}},{"comments":null,"title":"semiringFn","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Semiring"],"Semiring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"b"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}},"sourceSpan":{"start":[55,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[59,18]}},{"comments":null,"title":"semiringUnit","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}},"sourceSpan":{"start":[61,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[65,13]}},{"comments":null,"title":"semiringProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[67,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[71,15]}},{"comments":null,"title":"semiringProxy2","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy2"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[73,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[77,16]}},{"comments":null,"title":"semiringProxy3","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy3"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[79,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[83,16]}},{"comments":null,"title":"semiringRecord","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"list"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Semiring"],"SemiringRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"list"},{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"row"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]}},"sourceSpan":{"start":[85,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[89,63]}}],"comments":"The `Semiring` class is for types that support an addition and\nmultiplication operation.\n\nInstances must satisfy the following laws:\n\n- Commutative monoid under addition:\n - Associativity: `(a + b) + c = a + (b + c)`\n - Identity: `zero + a = a + zero = a`\n - Commutative: `a + b = b + a`\n- Monoid under multiplication:\n - Associativity: `(a * b) * c = a * (b * c)`\n - Identity: `one * a = a * one = a`\n- Multiplication distributes over addition:\n - Left distributivity: `a * (b + c) = (a * b) + (a * c)`\n - Right distributivity: `(a + b) * c = (a * c) + (b * c)`\n- Annihilation: `zero * a = a * zero = zero`\n\n**Note:** The `Number` and `Int` types are not fully law abiding\nmembers of this class hierarchy due to the potential for arithmetic\noverflows, and in the case of `Number`, the presence of `NaN` and\n`Infinity` values. The behaviour is unspecified in these cases.\n","title":"Semiring","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[34,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[38,12]}},{"children":[],"comments":null,"title":"(+)","info":{"declType":"alias","alias":[["Data","Semiring"],{"Right":{"Left":{"Ident":"add"}}}],"fixity":{"associativity":"infixl","precedence":6}},"sourceSpan":{"start":[40,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[40,18]}},{"children":[],"comments":null,"title":"(*)","info":{"declType":"alias","alias":[["Data","Semiring"],{"Right":{"Left":{"Ident":"mul"}}}],"fixity":{"associativity":"infixl","precedence":7}},"sourceSpan":{"start":[41,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[41,18]}}]}],"name":"Data.DivisionRing","comments":null,"declarations":[{"children":[{"comments":null,"title":"recip","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}},"sourceSpan":{"start":[30,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/DivisionRing.purs","end":[30,18]}},{"comments":null,"title":"divisionringNumber","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","DivisionRing"],"DivisionRing"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Number"]}]}},"sourceSpan":{"start":[54,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/DivisionRing.purs","end":[55,20]}}],"comments":"The `DivisionRing` class is for non-zero rings in which every non-zero\nelement has a multiplicative inverse. Division rings are sometimes also\ncalled *skew fields*.\n\nInstances must satisfy the following laws in addition to the `Ring` laws:\n\n- Non-zero ring: `one /= zero`\n- Non-zero multiplicative inverse: `recip a * a = a * recip a = one` for\n all non-zero `a`\n\nThe result of `recip zero` is left undefined; individual instances may\nchoose how to handle this case.\n\nIf a type has both `DivisionRing` and `CommutativeRing` instances, then\nit is a field and should have a `Field` instance.\n","title":"DivisionRing","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Data","Ring"],"Ring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[29,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/DivisionRing.purs","end":[30,18]}},{"children":[],"comments":"Left division, defined as `leftDiv a b = recip b * a`. Left and right\ndivision are distinct in this module because a `DivisionRing` is not\nnecessarily commutative.\n\nIf the type `a` is also a `EuclideanRing`, then this function is\nequivalent to `div` from the `EuclideanRing` class. When working\nabstractly, `div` should generally be preferred, unless you know that you\nneed your code to work with noncommutative rings.\n","title":"leftDiv","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","DivisionRing"],"DivisionRing"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}]},null]}},"sourceSpan":{"start":[40,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/DivisionRing.purs","end":[40,51]}},{"children":[],"comments":"Right division, defined as `rightDiv a b = a * recip b`. Left and right\ndivision are distinct in this module because a `DivisionRing` is not\nnecessarily commutative.\n\nIf the type `a` is also a `EuclideanRing`, then this function is\nequivalent to `div` from the `EuclideanRing` class. When working\nabstractly, `div` should generally be preferred, unless you know that you\nneed your code to work with noncommutative rings.\n","title":"rightDiv","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","DivisionRing"],"DivisionRing"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}]},null]}},"sourceSpan":{"start":[51,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/DivisionRing.purs","end":[51,52]}}]},{"reExports":[],"name":"Data.Eq","comments":null,"declarations":[{"children":[{"comments":null,"title":"eq","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}]}},"sourceSpan":{"start":[29,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq.purs","end":[29,26]}},{"comments":null,"title":"eqBoolean","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}},"sourceSpan":{"start":[40,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq.purs","end":[41,21]}},{"comments":null,"title":"eqInt","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Int"]}]}},"sourceSpan":{"start":[43,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq.purs","end":[44,17]}},{"comments":null,"title":"eqNumber","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Number"]}]}},"sourceSpan":{"start":[46,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq.purs","end":[47,20]}},{"comments":null,"title":"eqChar","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Char"]}]}},"sourceSpan":{"start":[49,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq.purs","end":[50,18]}},{"comments":null,"title":"eqString","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"String"]}]}},"sourceSpan":{"start":[52,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq.purs","end":[53,20]}},{"comments":null,"title":"eqUnit","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}},"sourceSpan":{"start":[55,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq.purs","end":[56,16]}},{"comments":null,"title":"eqVoid","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Void"],"Void"]}]}},"sourceSpan":{"start":[58,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq.purs","end":[59,16]}},{"comments":null,"title":"eqArray","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Eq"],"Eq"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Array"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[61,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq.purs","end":[62,22]}},{"comments":null,"title":"eqRec","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"list"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Eq"],"EqRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"list"},{"annotation":[],"tag":"TypeVar","contents":"row"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]}},"sourceSpan":{"start":[64,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq.purs","end":[65,38]}},{"comments":null,"title":"eqProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[67,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq.purs","end":[68,16]}},{"comments":null,"title":"eqProxy2","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy2"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[70,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq.purs","end":[71,16]}},{"comments":null,"title":"eqProxy3","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy3"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[73,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq.purs","end":[74,16]}}],"comments":"The `Eq` type class represents types which support decidable equality.\n\n`Eq` instances should satisfy the following laws:\n\n- Reflexivity: `x == x = true`\n- Symmetry: `x == y = y == x`\n- Transitivity: if `x == y` and `y == z` then `x == z`\n\n**Note:** The `Number` type is not an entirely law abiding member of this\nclass due to the presence of `NaN`, since `NaN /= NaN`. Additionally,\ncomputing with `Number` can result in a loss of precision, so sometimes\nvalues that should be equivalent are not.\n","title":"Eq","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[28,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq.purs","end":[29,26]}},{"children":[],"comments":null,"title":"(==)","info":{"declType":"alias","alias":[["Data","Eq"],{"Right":{"Left":{"Ident":"eq"}}}],"fixity":{"associativity":"infix","precedence":4}},"sourceSpan":{"start":[31,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq.purs","end":[31,17]}},{"children":[],"comments":"`notEq` tests whether one value is _not equal_ to another. Shorthand for\n`not (eq x y)`.\n","title":"notEq","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Eq"],"Eq"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}]}]},null]}},"sourceSpan":{"start":[35,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq.purs","end":[35,45]}},{"children":[],"comments":null,"title":"(/=)","info":{"declType":"alias","alias":[["Data","Eq"],{"Right":{"Left":{"Ident":"notEq"}}}],"fixity":{"associativity":"infix","precedence":4}},"sourceSpan":{"start":[38,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq.purs","end":[38,20]}},{"children":[{"comments":null,"title":"eq1","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Eq"],"Eq"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}]}]},null]}},"sourceSpan":{"start":[86,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq.purs","end":[86,49]}},{"comments":null,"title":"eq1Array","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq1"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Array"]}]}},"sourceSpan":{"start":[88,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq.purs","end":[89,11]}}],"comments":"The `Eq1` type class represents type constructors with decidable equality.\n","title":"Eq1","info":{"fundeps":[],"arguments":[["f",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[85,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq.purs","end":[86,49]}},{"children":[],"comments":null,"title":"notEq1","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["f",{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Eq"],"Eq1"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"f"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Eq"],"Eq"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}]}]}]},null]},null]}},"sourceSpan":{"start":[91,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq.purs","end":[91,61]}},{"children":[{"comments":null,"title":"eqRecord","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"ForAll","contents":["rlproxy",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"rlproxy"},{"annotation":[],"tag":"TypeVar","contents":"rowlist"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}]}]},null]}},"sourceSpan":{"start":[98,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq.purs","end":[98,85]}},{"comments":null,"title":"eqRowNil","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq"],"EqRecord"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim","RowList"],"Nil"]}]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}},"sourceSpan":{"start":[100,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq.purs","end":[101,24]}},{"comments":null,"title":"eqRowCons","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Eq"],"EqRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"rowlistTail"},{"annotation":[],"tag":"TypeVar","contents":"row"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Prim","Row"],"Cons"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"key"},{"annotation":[],"tag":"TypeVar","contents":"focus"},{"annotation":[],"tag":"TypeVar","contents":"rowTail"},{"annotation":[],"tag":"TypeVar","contents":"row"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Symbol"],"IsSymbol"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"key"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Eq"],"Eq"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"focus"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq"],"EqRecord"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim","RowList"],"Cons"]},{"annotation":[],"tag":"TypeVar","contents":"key"}]},{"annotation":[],"tag":"TypeVar","contents":"focus"}]},{"annotation":[],"tag":"TypeVar","contents":"rowlistTail"}]}]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}},"sourceSpan":{"start":[103,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq.purs","end":[114,57]}}],"comments":null,"title":"EqRecord","info":{"fundeps":[],"arguments":[["rowlist",null],["row",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[97,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq.purs","end":[98,85]}}]},{"reExports":[],"name":"Data.Eq.Generic","comments":null,"declarations":[{"children":[{"comments":null,"title":"genericEq'","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}]}},"sourceSpan":{"start":[11,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq/Generic.purs","end":[11,34]}},{"comments":null,"title":"genericEqNoConstructors","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq","Generic"],"GenericEq"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"NoConstructors"]}]}},"sourceSpan":{"start":[13,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq/Generic.purs","end":[14,24]}},{"comments":null,"title":"genericEqNoArguments","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq","Generic"],"GenericEq"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"NoArguments"]}]}},"sourceSpan":{"start":[16,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq/Generic.purs","end":[17,24]}},{"comments":null,"title":"genericEqSum","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Eq","Generic"],"GenericEq"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Eq","Generic"],"GenericEq"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"b"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq","Generic"],"GenericEq"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"Sum"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}},"sourceSpan":{"start":[19,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq/Generic.purs","end":[22,25]}},{"comments":null,"title":"genericEqProduct","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Eq","Generic"],"GenericEq"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Eq","Generic"],"GenericEq"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"b"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq","Generic"],"GenericEq"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"Product"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}},"sourceSpan":{"start":[24,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq/Generic.purs","end":[25,84]}},{"comments":null,"title":"genericEqConstructor","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Eq","Generic"],"GenericEq"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq","Generic"],"GenericEq"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"Constructor"]},{"annotation":[],"tag":"TypeVar","contents":"name"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[27,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq/Generic.purs","end":[28,66]}},{"comments":null,"title":"genericEqArgument","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Eq"],"Eq"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq","Generic"],"GenericEq"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"Argument"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[30,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq/Generic.purs","end":[31,52]}}],"comments":null,"title":"GenericEq","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[10,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq/Generic.purs","end":[11,34]}},{"children":[],"comments":"A `Generic` implementation of the `eq` member from the `Eq` type class.\n","title":"genericEq","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["rep",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Generic","Rep"],"Generic"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"},{"annotation":[],"tag":"TypeVar","contents":"rep"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Eq","Generic"],"GenericEq"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"rep"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}]}]}]},null]},null]}},"sourceSpan":{"start":[34,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq/Generic.purs","end":[34,79]}}]},{"reExports":[{"moduleName":{"package":null,"item":["Data","CommutativeRing"]},"declarations":[{"children":[{"comments":null,"title":"commutativeRingInt","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","CommutativeRing"],"CommutativeRing"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Int"]}]}},"sourceSpan":{"start":[25,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/CommutativeRing.purs","end":[25,51]}},{"comments":null,"title":"commutativeRingNumber","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","CommutativeRing"],"CommutativeRing"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Number"]}]}},"sourceSpan":{"start":[26,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/CommutativeRing.purs","end":[26,57]}},{"comments":null,"title":"commutativeRingUnit","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","CommutativeRing"],"CommutativeRing"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}},"sourceSpan":{"start":[27,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/CommutativeRing.purs","end":[27,53]}},{"comments":null,"title":"commutativeRingFn","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","CommutativeRing"],"CommutativeRing"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"b"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","CommutativeRing"],"CommutativeRing"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}},"sourceSpan":{"start":[28,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/CommutativeRing.purs","end":[28,76]}},{"comments":null,"title":"commutativeRingRecord","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"list"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","CommutativeRing"],"CommutativeRingRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"list"},{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"row"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","CommutativeRing"],"CommutativeRing"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]}},"sourceSpan":{"start":[29,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/CommutativeRing.purs","end":[29,126]}},{"comments":null,"title":"commutativeRingProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","CommutativeRing"],"CommutativeRing"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[30,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/CommutativeRing.purs","end":[30,59]}},{"comments":null,"title":"commutativeRingProxy2","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","CommutativeRing"],"CommutativeRing"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy2"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[31,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/CommutativeRing.purs","end":[31,61]}},{"comments":null,"title":"commutativeRingProxy3","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","CommutativeRing"],"CommutativeRing"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy3"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[32,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/CommutativeRing.purs","end":[32,61]}}],"comments":"The `CommutativeRing` class is for rings where multiplication is\ncommutative.\n\nInstances must satisfy the following law in addition to the `Ring`\nlaws:\n\n- Commutative multiplication: `a * b = b * a`\n","title":"CommutativeRing","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Data","Ring"],"Ring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[23,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/CommutativeRing.purs","end":[23,34]}}]},{"moduleName":{"package":null,"item":["Data","Ring"]},"declarations":[{"children":[{"comments":null,"title":"sub","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[24,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[24,21]}},{"comments":null,"title":"ringInt","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Int"]}]}},"sourceSpan":{"start":[28,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[29,15]}},{"comments":null,"title":"ringNumber","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Number"]}]}},"sourceSpan":{"start":[31,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[32,15]}},{"comments":null,"title":"ringUnit","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}},"sourceSpan":{"start":[34,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[35,17]}},{"comments":null,"title":"ringFn","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Ring"],"Ring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"b"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}},"sourceSpan":{"start":[37,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[38,24]}},{"comments":null,"title":"ringProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[40,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[41,18]}},{"comments":null,"title":"ringProxy2","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy2"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[43,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[44,19]}},{"comments":null,"title":"ringProxy3","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy3"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[46,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[47,19]}},{"comments":null,"title":"ringRecord","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"list"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Ring"],"RingRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"list"},{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"row"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]}},"sourceSpan":{"start":[49,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[50,40]}}],"comments":"The `Ring` class is for types that support addition, multiplication,\nand subtraction operations.\n\nInstances must satisfy the following laws in addition to the `Semiring`\nlaws:\n\n- Additive inverse: `a - a = zero`\n- Compatibility of `sub` and `negate`: `a - b = a + (zero - b)`\n","title":"Ring","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Data","Semiring"],"Semiring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[23,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[24,21]}},{"children":[],"comments":null,"title":"(-)","info":{"declType":"alias","alias":[["Data","Ring"],{"Right":{"Left":{"Ident":"sub"}}}],"fixity":{"associativity":"infixl","precedence":6}},"sourceSpan":{"start":[26,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[26,18]}}]},{"moduleName":{"package":null,"item":["Data","Semiring"]},"declarations":[{"children":[{"comments":null,"title":"add","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[35,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[35,22]}},{"comments":null,"title":"zero","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeVar","contents":"a"}},"sourceSpan":{"start":[36,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[36,12]}},{"comments":null,"title":"mul","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[37,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[37,22]}},{"comments":null,"title":"one","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeVar","contents":"a"}},"sourceSpan":{"start":[38,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[38,12]}},{"comments":null,"title":"semiringInt","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Int"]}]}},"sourceSpan":{"start":[43,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[47,10]}},{"comments":null,"title":"semiringNumber","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Number"]}]}},"sourceSpan":{"start":[49,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[53,12]}},{"comments":null,"title":"semiringFn","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Semiring"],"Semiring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"b"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}},"sourceSpan":{"start":[55,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[59,18]}},{"comments":null,"title":"semiringUnit","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}},"sourceSpan":{"start":[61,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[65,13]}},{"comments":null,"title":"semiringProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[67,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[71,15]}},{"comments":null,"title":"semiringProxy2","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy2"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[73,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[77,16]}},{"comments":null,"title":"semiringProxy3","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy3"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[79,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[83,16]}},{"comments":null,"title":"semiringRecord","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"list"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Semiring"],"SemiringRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"list"},{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"row"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]}},"sourceSpan":{"start":[85,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[89,63]}}],"comments":"The `Semiring` class is for types that support an addition and\nmultiplication operation.\n\nInstances must satisfy the following laws:\n\n- Commutative monoid under addition:\n - Associativity: `(a + b) + c = a + (b + c)`\n - Identity: `zero + a = a + zero = a`\n - Commutative: `a + b = b + a`\n- Monoid under multiplication:\n - Associativity: `(a * b) * c = a * (b * c)`\n - Identity: `one * a = a * one = a`\n- Multiplication distributes over addition:\n - Left distributivity: `a * (b + c) = (a * b) + (a * c)`\n - Right distributivity: `(a + b) * c = (a * c) + (b * c)`\n- Annihilation: `zero * a = a * zero = zero`\n\n**Note:** The `Number` and `Int` types are not fully law abiding\nmembers of this class hierarchy due to the potential for arithmetic\noverflows, and in the case of `Number`, the presence of `NaN` and\n`Infinity` values. The behaviour is unspecified in these cases.\n","title":"Semiring","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[34,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[38,12]}},{"children":[],"comments":null,"title":"(+)","info":{"declType":"alias","alias":[["Data","Semiring"],{"Right":{"Left":{"Ident":"add"}}}],"fixity":{"associativity":"infixl","precedence":6}},"sourceSpan":{"start":[40,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[40,18]}},{"children":[],"comments":null,"title":"(*)","info":{"declType":"alias","alias":[["Data","Semiring"],{"Right":{"Left":{"Ident":"mul"}}}],"fixity":{"associativity":"infixl","precedence":7}},"sourceSpan":{"start":[41,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[41,18]}}]}],"name":"Data.EuclideanRing","comments":null,"declarations":[{"children":[{"comments":null,"title":"degree","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Int"]}]}},"sourceSpan":{"start":[64,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/EuclideanRing.purs","end":[64,21]}},{"comments":null,"title":"div","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[65,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/EuclideanRing.purs","end":[65,21]}},{"comments":null,"title":"mod","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[66,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/EuclideanRing.purs","end":[66,21]}},{"comments":null,"title":"euclideanRingInt","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","EuclideanRing"],"EuclideanRing"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Int"]}]}},"sourceSpan":{"start":[70,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/EuclideanRing.purs","end":[73,15]}},{"comments":null,"title":"euclideanRingNumber","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","EuclideanRing"],"EuclideanRing"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Number"]}]}},"sourceSpan":{"start":[75,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/EuclideanRing.purs","end":[78,16]}}],"comments":"The `EuclideanRing` class is for commutative rings that support division.\nThe mathematical structure this class is based on is sometimes also called\na *Euclidean domain*.\n\nInstances must satisfy the following laws in addition to the `Ring`\nlaws:\n\n- Integral domain: `one /= zero`, and if `a` and `b` are both nonzero then\n so is their product `a * b`\n- Euclidean function `degree`:\n - Nonnegativity: For all nonzero `a`, `degree a >= 0`\n - Quotient/remainder: For all `a` and `b`, where `b` is nonzero,\n let `q = a / b` and ``r = a `mod` b``; then `a = q*b + r`, and also\n either `r = zero` or `degree r < degree b`\n- Submultiplicative euclidean function:\n - For all nonzero `a` and `b`, `degree a <= degree (a * b)`\n\nThe behaviour of division by `zero` is unconstrained by these laws,\nmeaning that individual instances are free to choose how to behave in this\ncase. Similarly, there are no restrictions on what the result of\n`degree zero` is; it doesn't make sense to ask for `degree zero` in the\nsame way that it doesn't make sense to divide by `zero`, so again,\nindividual instances may choose how to handle this case.\n\nFor any `EuclideanRing` which is also a `Field`, one valid choice\nfor `degree` is simply `const 1`. In fact, unless there's a specific\nreason not to, `Field` types should normally use this definition of\n`degree`.\n\nThe `EuclideanRing Int` instance is one of the most commonly used\n`EuclideanRing` instances and deserves a little more discussion. In\nparticular, there are a few different sensible law-abiding implementations\nto choose from, with slightly different behaviour in the presence of\nnegative dividends or divisors. The most common definitions are \"truncating\"\ndivision, where the result of `a / b` is rounded towards 0, and \"Knuthian\"\nor \"flooring\" division, where the result of `a / b` is rounded towards\nnegative infinity. A slightly less common, but arguably more useful, option\nis \"Euclidean\" division, which is defined so as to ensure that ``a `mod` b``\nis always nonnegative. With Euclidean division, `a / b` rounds towards\nnegative infinity if the divisor is positive, and towards positive infinity\nif the divisor is negative. Note that all three definitions are identical if\nwe restrict our attention to nonnegative dividends and divisors.\n\nIn versions 1.x, 2.x, and 3.x of the Prelude, the `EuclideanRing Int`\ninstance used truncating division. As of 4.x, the `EuclideanRing Int`\ninstance uses Euclidean division. Additional functions `quot` and `rem` are\nsupplied if truncating division is desired.\n","title":"EuclideanRing","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Data","CommutativeRing"],"CommutativeRing"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[63,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/EuclideanRing.purs","end":[66,21]}},{"children":[],"comments":null,"title":"(/)","info":{"declType":"alias","alias":[["Data","EuclideanRing"],{"Right":{"Left":{"Ident":"div"}}}],"fixity":{"associativity":"infixl","precedence":7}},"sourceSpan":{"start":[68,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/EuclideanRing.purs","end":[68,18]}},{"children":[],"comments":"The *greatest common divisor* of two values.\n","title":"gcd","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Eq"],"Eq"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","EuclideanRing"],"EuclideanRing"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}]}]},null]}},"sourceSpan":{"start":[87,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/EuclideanRing.purs","end":[87,56]}},{"children":[],"comments":"The *least common multiple* of two values.\n","title":"lcm","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Eq"],"Eq"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","EuclideanRing"],"EuclideanRing"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}]}]},null]}},"sourceSpan":{"start":[94,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/EuclideanRing.purs","end":[94,56]}}]},{"reExports":[{"moduleName":{"package":null,"item":["Data","CommutativeRing"]},"declarations":[{"children":[{"comments":null,"title":"commutativeRingInt","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","CommutativeRing"],"CommutativeRing"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Int"]}]}},"sourceSpan":{"start":[25,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/CommutativeRing.purs","end":[25,51]}},{"comments":null,"title":"commutativeRingNumber","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","CommutativeRing"],"CommutativeRing"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Number"]}]}},"sourceSpan":{"start":[26,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/CommutativeRing.purs","end":[26,57]}},{"comments":null,"title":"commutativeRingUnit","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","CommutativeRing"],"CommutativeRing"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}},"sourceSpan":{"start":[27,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/CommutativeRing.purs","end":[27,53]}},{"comments":null,"title":"commutativeRingFn","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","CommutativeRing"],"CommutativeRing"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"b"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","CommutativeRing"],"CommutativeRing"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}},"sourceSpan":{"start":[28,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/CommutativeRing.purs","end":[28,76]}},{"comments":null,"title":"commutativeRingRecord","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"list"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","CommutativeRing"],"CommutativeRingRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"list"},{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"row"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","CommutativeRing"],"CommutativeRing"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]}},"sourceSpan":{"start":[29,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/CommutativeRing.purs","end":[29,126]}},{"comments":null,"title":"commutativeRingProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","CommutativeRing"],"CommutativeRing"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[30,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/CommutativeRing.purs","end":[30,59]}},{"comments":null,"title":"commutativeRingProxy2","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","CommutativeRing"],"CommutativeRing"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy2"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[31,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/CommutativeRing.purs","end":[31,61]}},{"comments":null,"title":"commutativeRingProxy3","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","CommutativeRing"],"CommutativeRing"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy3"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[32,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/CommutativeRing.purs","end":[32,61]}}],"comments":"The `CommutativeRing` class is for rings where multiplication is\ncommutative.\n\nInstances must satisfy the following law in addition to the `Ring`\nlaws:\n\n- Commutative multiplication: `a * b = b * a`\n","title":"CommutativeRing","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Data","Ring"],"Ring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[23,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/CommutativeRing.purs","end":[23,34]}}]},{"moduleName":{"package":null,"item":["Data","DivisionRing"]},"declarations":[{"children":[{"comments":null,"title":"recip","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}},"sourceSpan":{"start":[30,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/DivisionRing.purs","end":[30,18]}},{"comments":null,"title":"divisionringNumber","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","DivisionRing"],"DivisionRing"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Number"]}]}},"sourceSpan":{"start":[54,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/DivisionRing.purs","end":[55,20]}}],"comments":"The `DivisionRing` class is for non-zero rings in which every non-zero\nelement has a multiplicative inverse. Division rings are sometimes also\ncalled *skew fields*.\n\nInstances must satisfy the following laws in addition to the `Ring` laws:\n\n- Non-zero ring: `one /= zero`\n- Non-zero multiplicative inverse: `recip a * a = a * recip a = one` for\n all non-zero `a`\n\nThe result of `recip zero` is left undefined; individual instances may\nchoose how to handle this case.\n\nIf a type has both `DivisionRing` and `CommutativeRing` instances, then\nit is a field and should have a `Field` instance.\n","title":"DivisionRing","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Data","Ring"],"Ring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[29,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/DivisionRing.purs","end":[30,18]}}]},{"moduleName":{"package":null,"item":["Data","EuclideanRing"]},"declarations":[{"children":[{"comments":null,"title":"degree","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Int"]}]}},"sourceSpan":{"start":[64,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/EuclideanRing.purs","end":[64,21]}},{"comments":null,"title":"div","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[65,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/EuclideanRing.purs","end":[65,21]}},{"comments":null,"title":"mod","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[66,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/EuclideanRing.purs","end":[66,21]}},{"comments":null,"title":"euclideanRingInt","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","EuclideanRing"],"EuclideanRing"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Int"]}]}},"sourceSpan":{"start":[70,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/EuclideanRing.purs","end":[73,15]}},{"comments":null,"title":"euclideanRingNumber","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","EuclideanRing"],"EuclideanRing"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Number"]}]}},"sourceSpan":{"start":[75,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/EuclideanRing.purs","end":[78,16]}}],"comments":"The `EuclideanRing` class is for commutative rings that support division.\nThe mathematical structure this class is based on is sometimes also called\na *Euclidean domain*.\n\nInstances must satisfy the following laws in addition to the `Ring`\nlaws:\n\n- Integral domain: `one /= zero`, and if `a` and `b` are both nonzero then\n so is their product `a * b`\n- Euclidean function `degree`:\n - Nonnegativity: For all nonzero `a`, `degree a >= 0`\n - Quotient/remainder: For all `a` and `b`, where `b` is nonzero,\n let `q = a / b` and ``r = a `mod` b``; then `a = q*b + r`, and also\n either `r = zero` or `degree r < degree b`\n- Submultiplicative euclidean function:\n - For all nonzero `a` and `b`, `degree a <= degree (a * b)`\n\nThe behaviour of division by `zero` is unconstrained by these laws,\nmeaning that individual instances are free to choose how to behave in this\ncase. Similarly, there are no restrictions on what the result of\n`degree zero` is; it doesn't make sense to ask for `degree zero` in the\nsame way that it doesn't make sense to divide by `zero`, so again,\nindividual instances may choose how to handle this case.\n\nFor any `EuclideanRing` which is also a `Field`, one valid choice\nfor `degree` is simply `const 1`. In fact, unless there's a specific\nreason not to, `Field` types should normally use this definition of\n`degree`.\n\nThe `EuclideanRing Int` instance is one of the most commonly used\n`EuclideanRing` instances and deserves a little more discussion. In\nparticular, there are a few different sensible law-abiding implementations\nto choose from, with slightly different behaviour in the presence of\nnegative dividends or divisors. The most common definitions are \"truncating\"\ndivision, where the result of `a / b` is rounded towards 0, and \"Knuthian\"\nor \"flooring\" division, where the result of `a / b` is rounded towards\nnegative infinity. A slightly less common, but arguably more useful, option\nis \"Euclidean\" division, which is defined so as to ensure that ``a `mod` b``\nis always nonnegative. With Euclidean division, `a / b` rounds towards\nnegative infinity if the divisor is positive, and towards positive infinity\nif the divisor is negative. Note that all three definitions are identical if\nwe restrict our attention to nonnegative dividends and divisors.\n\nIn versions 1.x, 2.x, and 3.x of the Prelude, the `EuclideanRing Int`\ninstance used truncating division. As of 4.x, the `EuclideanRing Int`\ninstance uses Euclidean division. Additional functions `quot` and `rem` are\nsupplied if truncating division is desired.\n","title":"EuclideanRing","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Data","CommutativeRing"],"CommutativeRing"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[63,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/EuclideanRing.purs","end":[66,21]}},{"children":[],"comments":"The *least common multiple* of two values.\n","title":"lcm","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Eq"],"Eq"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","EuclideanRing"],"EuclideanRing"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}]}]},null]}},"sourceSpan":{"start":[94,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/EuclideanRing.purs","end":[94,56]}},{"children":[],"comments":"The *greatest common divisor* of two values.\n","title":"gcd","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Eq"],"Eq"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","EuclideanRing"],"EuclideanRing"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}]}]},null]}},"sourceSpan":{"start":[87,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/EuclideanRing.purs","end":[87,56]}},{"children":[],"comments":null,"title":"(/)","info":{"declType":"alias","alias":[["Data","EuclideanRing"],{"Right":{"Left":{"Ident":"div"}}}],"fixity":{"associativity":"infixl","precedence":7}},"sourceSpan":{"start":[68,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/EuclideanRing.purs","end":[68,18]}}]},{"moduleName":{"package":null,"item":["Data","Ring"]},"declarations":[{"children":[{"comments":null,"title":"sub","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[24,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[24,21]}},{"comments":null,"title":"ringInt","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Int"]}]}},"sourceSpan":{"start":[28,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[29,15]}},{"comments":null,"title":"ringNumber","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Number"]}]}},"sourceSpan":{"start":[31,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[32,15]}},{"comments":null,"title":"ringUnit","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}},"sourceSpan":{"start":[34,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[35,17]}},{"comments":null,"title":"ringFn","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Ring"],"Ring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"b"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}},"sourceSpan":{"start":[37,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[38,24]}},{"comments":null,"title":"ringProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[40,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[41,18]}},{"comments":null,"title":"ringProxy2","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy2"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[43,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[44,19]}},{"comments":null,"title":"ringProxy3","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy3"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[46,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[47,19]}},{"comments":null,"title":"ringRecord","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"list"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Ring"],"RingRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"list"},{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"row"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]}},"sourceSpan":{"start":[49,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[50,40]}}],"comments":"The `Ring` class is for types that support addition, multiplication,\nand subtraction operations.\n\nInstances must satisfy the following laws in addition to the `Semiring`\nlaws:\n\n- Additive inverse: `a - a = zero`\n- Compatibility of `sub` and `negate`: `a - b = a + (zero - b)`\n","title":"Ring","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Data","Semiring"],"Semiring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[23,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[24,21]}},{"children":[],"comments":"`negate x` can be used as a shorthand for `zero - x`.\n","title":"negate","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Ring"],"Ring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},null]}},"sourceSpan":{"start":[53,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[53,37]}}]},{"moduleName":{"package":null,"item":["Data","Semiring"]},"declarations":[{"children":[{"comments":null,"title":"add","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[35,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[35,22]}},{"comments":null,"title":"zero","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeVar","contents":"a"}},"sourceSpan":{"start":[36,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[36,12]}},{"comments":null,"title":"mul","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[37,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[37,22]}},{"comments":null,"title":"one","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeVar","contents":"a"}},"sourceSpan":{"start":[38,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[38,12]}},{"comments":null,"title":"semiringInt","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Int"]}]}},"sourceSpan":{"start":[43,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[47,10]}},{"comments":null,"title":"semiringNumber","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Number"]}]}},"sourceSpan":{"start":[49,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[53,12]}},{"comments":null,"title":"semiringFn","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Semiring"],"Semiring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"b"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}},"sourceSpan":{"start":[55,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[59,18]}},{"comments":null,"title":"semiringUnit","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}},"sourceSpan":{"start":[61,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[65,13]}},{"comments":null,"title":"semiringProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[67,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[71,15]}},{"comments":null,"title":"semiringProxy2","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy2"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[73,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[77,16]}},{"comments":null,"title":"semiringProxy3","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy3"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[79,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[83,16]}},{"comments":null,"title":"semiringRecord","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"list"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Semiring"],"SemiringRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"list"},{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"row"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]}},"sourceSpan":{"start":[85,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[89,63]}}],"comments":"The `Semiring` class is for types that support an addition and\nmultiplication operation.\n\nInstances must satisfy the following laws:\n\n- Commutative monoid under addition:\n - Associativity: `(a + b) + c = a + (b + c)`\n - Identity: `zero + a = a + zero = a`\n - Commutative: `a + b = b + a`\n- Monoid under multiplication:\n - Associativity: `(a * b) * c = a * (b * c)`\n - Identity: `one * a = a * one = a`\n- Multiplication distributes over addition:\n - Left distributivity: `a * (b + c) = (a * b) + (a * c)`\n - Right distributivity: `(a + b) * c = (a * c) + (b * c)`\n- Annihilation: `zero * a = a * zero = zero`\n\n**Note:** The `Number` and `Int` types are not fully law abiding\nmembers of this class hierarchy due to the potential for arithmetic\noverflows, and in the case of `Number`, the presence of `NaN` and\n`Infinity` values. The behaviour is unspecified in these cases.\n","title":"Semiring","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[34,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[38,12]}},{"children":[],"comments":null,"title":"(+)","info":{"declType":"alias","alias":[["Data","Semiring"],{"Right":{"Left":{"Ident":"add"}}}],"fixity":{"associativity":"infixl","precedence":6}},"sourceSpan":{"start":[40,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[40,18]}},{"children":[],"comments":null,"title":"(*)","info":{"declType":"alias","alias":[["Data","Semiring"],{"Right":{"Left":{"Ident":"mul"}}}],"fixity":{"associativity":"infixl","precedence":7}},"sourceSpan":{"start":[41,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[41,18]}}]}],"name":"Data.Field","comments":null,"declarations":[{"children":[{"comments":null,"title":"field","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","EuclideanRing"],"EuclideanRing"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","DivisionRing"],"DivisionRing"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Field"],"Field"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}},"sourceSpan":{"start":[41,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Field.purs","end":[41,63]}}],"comments":"The `Field` class is for types that are (commutative) fields.\n\nMathematically, a field is a ring which is commutative and in which every\nnonzero element has a multiplicative inverse; these conditions correspond\nto the `CommutativeRing` and `DivisionRing` classes in PureScript\nrespectively. However, the `Field` class has `EuclideanRing` and\n`DivisionRing` as superclasses, which seems like a stronger requirement\n(since `CommutativeRing` is a superclass of `EuclideanRing`). In fact, it\nis not stronger, since any type which has law-abiding `CommutativeRing`\nand `DivisionRing` instances permits exactly one law-abiding\n`EuclideanRing` instance. We use a `EuclideanRing` superclass here in\norder to ensure that a `Field` constraint on a function permits you to use\n`div` on that type, since `div` is a member of `EuclideanRing`.\n\nThis class has no laws or members of its own; it exists as a convenience,\nso a single constraint can be used when field-like behaviour is expected.\n\nThis module also defines a single `Field` instance for any type which has\nboth `EuclideanRing` and `DivisionRing` instances. Any other instance\nwould overlap with this instance, so no other `Field` instances should be\ndefined in libraries. Instead, simply define `EuclideanRing` and\n`DivisionRing` instances, and this will permit your type to be used with a\n`Field` constraint.\n","title":"Field","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Data","EuclideanRing"],"EuclideanRing"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","DivisionRing"],"DivisionRing"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[39,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Field.purs","end":[39,51]}}]},{"reExports":[{"moduleName":{"package":null,"item":["Control","Category"]},"declarations":[{"children":[],"comments":null,"title":"compose","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"ForAll","contents":["c",{"annotation":[],"tag":"ForAll","contents":["d",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[null,"Semigroupoid"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"a"},{"annotation":[],"tag":"TypeVar","contents":"c"}]},{"annotation":[],"tag":"TypeVar","contents":"d"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"a"},{"annotation":[],"tag":"TypeVar","contents":"b"}]},{"annotation":[],"tag":"TypeVar","contents":"c"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"a"},{"annotation":[],"tag":"TypeVar","contents":"b"}]},{"annotation":[],"tag":"TypeVar","contents":"d"}]}]}]}]},null]},null]},null]},null]}},"sourceSpan":{"start":[14,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Semigroupoid.purs","end":[14,51]}},{"children":[],"comments":null,"title":"identity","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["t",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[null,"Category"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"a"},{"annotation":[],"tag":"TypeVar","contents":"t"}]},{"annotation":[],"tag":"TypeVar","contents":"t"}]}]},null]},null]}},"sourceSpan":{"start":[18,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Category.purs","end":[18,30]}},{"children":[],"comments":null,"title":"(>>>)","info":{"declType":"alias","alias":[["Control","Semigroupoid"],{"Right":{"Left":{"Ident":"composeFlipped"}}}],"fixity":{"associativity":"infixr","precedence":9}},"sourceSpan":{"start":[25,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Semigroupoid.purs","end":[25,31]}},{"children":[],"comments":null,"title":"(<<<)","info":{"declType":"alias","alias":[["Control","Semigroupoid"],{"Right":{"Left":{"Ident":"compose"}}}],"fixity":{"associativity":"infixr","precedence":9}},"sourceSpan":{"start":[19,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Semigroupoid.purs","end":[19,24]}}]}],"name":"Data.Function","comments":null,"declarations":[{"children":[],"comments":"Flips the order of the arguments to a function of two arguments.\n\n```purescript\nflip const 1 2 = const 2 1 = 2\n```\n","title":"flip","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"ForAll","contents":["c",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"b"}]},{"annotation":[],"tag":"TypeVar","contents":"c"}]}]}}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"b"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"c"}]}]}]},null]},null]},null]}},"sourceSpan":{"start":[21,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Function.purs","end":[21,51]}},{"children":[],"comments":"Returns its first argument and ignores its second.\n\n```purescript\nconst 1 \"hello\" = 1\n```\n\nIt can also be thought of as creating a function that ignores its argument:\n\n```purescript\nconst 1 = \\_ -> 1\n```\n","title":"const","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"b"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},null]},null]}},"sourceSpan":{"start":[35,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Function.purs","end":[35,33]}},{"children":[],"comments":"Applies a function to an argument. This is primarily used as the operator\n`($)` which allows parentheses to be omitted in some cases, or as a\nnatural way to apply a chain of composed functions to a value.\n","title":"apply","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]},null]},null]}},"sourceSpan":{"start":[41,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Function.purs","end":[41,40]}},{"children":[],"comments":"Applies a function to an argument: the reverse of `(#)`.\n\n```purescript\nlength $ groupBy productCategory $ filter isInStock $ products\n```\n\nis equivalent to:\n\n```purescript\nlength (groupBy productCategory (filter isInStock products))\n```\n\nOr another alternative equivalent, applying chain of composed functions to\na value:\n\n```purescript\nlength <<< groupBy productCategory <<< filter isInStock $ products\n```\n","title":"($)","info":{"declType":"alias","alias":[["Data","Function"],{"Right":{"Left":{"Ident":"apply"}}}],"fixity":{"associativity":"infixr","precedence":0}},"sourceSpan":{"start":[62,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Function.purs","end":[62,20]}},{"children":[],"comments":"Applies an argument to a function. This is primarily used as the `(#)`\noperator, which allows parentheses to be omitted in some cases, or as a\nnatural way to apply a value to a chain of composed functions.\n","title":"applyFlipped","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]},null]},null]}},"sourceSpan":{"start":[67,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Function.purs","end":[67,47]}},{"children":[],"comments":"Applies an argument to a function: the reverse of `($)`.\n\n```purescript\nproducts # filter isInStock # groupBy productCategory # length\n```\n\nis equivalent to:\n\n```purescript\nlength (groupBy productCategory (filter isInStock products))\n```\n\nOr another alternative equivalent, applying a value to a chain of composed\nfunctions:\n\n```purescript\nproducts # filter isInStock >>> groupBy productCategory >>> length\n```\n","title":"(#)","info":{"declType":"alias","alias":[["Data","Function"],{"Right":{"Left":{"Ident":"applyFlipped"}}}],"fixity":{"associativity":"infixl","precedence":1}},"sourceSpan":{"start":[88,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Function.purs","end":[88,27]}},{"children":[],"comments":"`applyN f n` applies the function `f` to its argument `n` times.\n\nIf n is less than or equal to 0, the function is not applied.\n\n```purescript\napplyN (_ + 1) 10 0 == 10\n```\n","title":"applyN","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Int"]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}]},null]}},"sourceSpan":{"start":[97,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Function.purs","end":[97,46]}},{"children":[],"comments":"The `on` function is used to change the domain of a binary operator.\n\nFor example, we can create a function which compares two records based on the values of their `x` properties:\n\n```purescript\ncompareX :: forall r. { x :: Number | r } -> { x :: Number | r } -> Ordering\ncompareX = compare `on` _.x\n```\n","title":"on","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"ForAll","contents":["c",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"b"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"b"}]},{"annotation":[],"tag":"TypeVar","contents":"c"}]}]}}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"c"}]}]}]}]},null]},null]},null]}},"sourceSpan":{"start":[112,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Function.purs","end":[112,61]}}]},{"reExports":[],"name":"Data.Functor","comments":null,"declarations":[{"children":[{"comments":null,"title":"map","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}]},null]},null]}},"sourceSpan":{"start":[26,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[26,44]}},{"comments":null,"title":"functorFn","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Functor"],"Functor"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"r"}]}]}},"sourceSpan":{"start":[40,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[41,16]}},{"comments":null,"title":"functorArray","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Functor"],"Functor"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Array"]}]}},"sourceSpan":{"start":[43,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[44,17]}},{"comments":null,"title":"functorProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Functor"],"Functor"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]}]}},"sourceSpan":{"start":[46,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[47,18]}}],"comments":"A `Functor` is a type constructor which supports a mapping operation\n`map`.\n\n`map` can be used to turn functions `a -> b` into functions\n`f a -> f b` whose argument and return types use the type constructor `f`\nto represent some computational context.\n\nInstances must satisfy the following laws:\n\n- Identity: `map identity = identity`\n- Composition: `map (f <<< g) = map f <<< map g`\n","title":"Functor","info":{"fundeps":[],"arguments":[["f",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[25,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[26,44]}},{"children":[],"comments":null,"title":"(<$>)","info":{"declType":"alias","alias":[["Data","Functor"],{"Right":{"Left":{"Ident":"map"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[28,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[28,20]}},{"children":[],"comments":"`mapFlipped` is `map` with its arguments reversed. For example:\n\n```purescript\n[1, 2, 3] <#> \\n -> n * n\n```\n","title":"mapFlipped","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["f",{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Functor"],"Functor"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"f"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}]}]},null]},null]},null]}},"sourceSpan":{"start":[35,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[35,64]}},{"children":[],"comments":null,"title":"(<#>)","info":{"declType":"alias","alias":[["Data","Functor"],{"Right":{"Left":{"Ident":"mapFlipped"}}}],"fixity":{"associativity":"infixl","precedence":1}},"sourceSpan":{"start":[38,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[38,27]}},{"children":[],"comments":"The `void` function is used to ignore the type wrapped by a\n[`Functor`](#functor), replacing it with `Unit` and keeping only the type\ninformation provided by the type constructor itself.\n\n`void` is often useful when using `do` notation to change the return type\nof a monadic computation:\n\n```purescript\nmain = forE 1 10 \\n -> void do\n print n\n print (n * n)\n```\n","title":"void","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["f",{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Functor"],"Functor"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"f"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}]}]},null]},null]}},"sourceSpan":{"start":[63,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[63,47]}},{"children":[],"comments":"Ignore the return value of a computation, using the specified return value\ninstead.\n","title":"voidRight","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["f",{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Functor"],"Functor"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"f"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}]}]},null]},null]},null]}},"sourceSpan":{"start":[68,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[68,56]}},{"children":[],"comments":null,"title":"(<$)","info":{"declType":"alias","alias":[["Data","Functor"],{"Right":{"Left":{"Ident":"voidRight"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[71,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[71,25]}},{"children":[],"comments":"A version of `voidRight` with its arguments flipped.\n","title":"voidLeft","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["f",{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Functor"],"Functor"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"f"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"b"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}]}]},null]},null]},null]}},"sourceSpan":{"start":[74,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[74,55]}},{"children":[],"comments":null,"title":"($>)","info":{"declType":"alias","alias":[["Data","Functor"],{"Right":{"Left":{"Ident":"voidLeft"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[77,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[77,24]}},{"children":[],"comments":"Apply a value in a computational context to a value in no context.\n\nGeneralizes `flip`.\n\n```purescript\nlongEnough :: String -> Bool\nhasSymbol :: String -> Bool\nhasDigit :: String -> Bool\npassword :: String\n\nvalidate :: String -> Array Bool\nvalidate = flap [longEnough, hasSymbol, hasDigit]\n```\n\n```purescript\nflap (-) 3 4 == 1\nthreeve <$> Just 1 <@> 'a' <*> Just true == Just (threeve 1 'a' true)\n```\n","title":"flap","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["f",{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Functor"],"Functor"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"f"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}]}]},null]},null]},null]}},"sourceSpan":{"start":[97,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[97,58]}},{"children":[],"comments":null,"title":"(<@>)","info":{"declType":"alias","alias":[["Data","Functor"],{"Right":{"Left":{"Ident":"flap"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[100,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[100,21]}}]},{"reExports":[],"name":"Data.Generic.Rep","comments":null,"declarations":[{"children":[{"comments":null,"title":"to","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"rep"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}},"sourceSpan":{"start":[57,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Generic/Rep.purs","end":[57,17]}},{"comments":null,"title":"from","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"rep"}]}},"sourceSpan":{"start":[58,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Generic/Rep.purs","end":[58,19]}}],"comments":"The `Generic` class asserts the existence of a type function from types\nto their representations using the type constructors defined in this module.\n","title":"Generic","info":{"fundeps":[[["a"],["rep"]]],"arguments":[["a",null],["rep",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[56,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Generic/Rep.purs","end":[58,19]}},{"children":[],"comments":null,"title":"repOf","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["rep",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Generic","Rep"],"Generic"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"},{"annotation":[],"tag":"TypeVar","contents":"rep"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"annotation":[],"tag":"TypeVar","contents":"rep"}]}]}]},null]},null]}},"sourceSpan":{"start":[60,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Generic/Rep.purs","end":[60,61]}},{"children":[],"comments":"A representation for types with no constructors.\n","title":"NoConstructors","info":{"declType":"data","dataDeclType":"data","typeArguments":[]},"sourceSpan":{"start":[20,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Generic/Rep.purs","end":[20,20]}},{"children":[{"comments":null,"title":"NoArguments","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"showNoArguments","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"NoArguments"]}]}},"sourceSpan":{"start":[25,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Generic/Rep.purs","end":[26,25]}}],"comments":"A representation for constructors with no arguments.\n","title":"NoArguments","info":{"declType":"data","dataDeclType":"data","typeArguments":[]},"sourceSpan":{"start":[23,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Generic/Rep.purs","end":[23,31]}},{"children":[{"comments":null,"title":"Inl","info":{"arguments":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"Inr","info":{"arguments":[{"annotation":[],"tag":"TypeVar","contents":"b"}],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"showSum","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Show"],"Show"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Show"],"Show"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"b"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"Sum"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}},"sourceSpan":{"start":[31,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Generic/Rep.purs","end":[33,42]}}],"comments":"A representation for types with multiple constructors.\n","title":"Sum","info":{"declType":"data","dataDeclType":"data","typeArguments":[["a",null],["b",null]]},"sourceSpan":{"start":[29,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Generic/Rep.purs","end":[29,29]}},{"children":[{"comments":null,"title":"Product","info":{"arguments":[{"annotation":[],"tag":"TypeVar","contents":"a"},{"annotation":[],"tag":"TypeVar","contents":"b"}],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"showProduct","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Show"],"Show"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Show"],"Show"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"b"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"Product"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}},"sourceSpan":{"start":[38,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Generic/Rep.purs","end":[39,69]}}],"comments":"A representation for constructors with multiple fields.\n","title":"Product","info":{"declType":"data","dataDeclType":"data","typeArguments":[["a",null],["b",null]]},"sourceSpan":{"start":[36,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Generic/Rep.purs","end":[36,31]}},{"children":[{"comments":null,"title":"Constructor","info":{"arguments":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"showConstructor","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Symbol"],"IsSymbol"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"name"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Show"],"Show"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"Constructor"]},{"annotation":[],"tag":"TypeVar","contents":"name"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[45,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Generic/Rep.purs","end":[46,112]}}],"comments":"A representation for constructors which includes the data constructor name\nas a type-level string.\n","title":"Constructor","info":{"declType":"data","dataDeclType":"newtype","typeArguments":[["name",{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Symbol"]}],["a",null]]},"sourceSpan":{"start":[43,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Generic/Rep.purs","end":[43,55]}},{"children":[{"comments":null,"title":"Argument","info":{"arguments":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"showArgument","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Show"],"Show"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"Argument"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[51,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Generic/Rep.purs","end":[52,52]}}],"comments":"A representation for an argument in a data constructor.\n","title":"Argument","info":{"declType":"data","dataDeclType":"newtype","typeArguments":[["a",null]]},"sourceSpan":{"start":[49,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Generic/Rep.purs","end":[49,32]}}]},{"reExports":[],"name":"Data.HeytingAlgebra","comments":null,"declarations":[{"children":[{"comments":null,"title":"ff","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeVar","contents":"a"}},"sourceSpan":{"start":[39,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[39,10]}},{"comments":null,"title":"tt","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeVar","contents":"a"}},"sourceSpan":{"start":[40,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[40,10]}},{"comments":null,"title":"implies","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[41,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[41,25]}},{"comments":null,"title":"conj","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[42,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[42,22]}},{"comments":null,"title":"disj","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[43,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[43,22]}},{"comments":null,"title":"not","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}},"sourceSpan":{"start":[44,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[44,16]}},{"comments":null,"title":"heytingAlgebraBoolean","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","HeytingAlgebra"],"HeytingAlgebra"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}},"sourceSpan":{"start":[49,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[55,16]}},{"comments":null,"title":"heytingAlgebraUnit","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","HeytingAlgebra"],"HeytingAlgebra"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}},"sourceSpan":{"start":[57,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[63,15]}},{"comments":null,"title":"heytingAlgebraFunction","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","HeytingAlgebra"],"HeytingAlgebra"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"b"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","HeytingAlgebra"],"HeytingAlgebra"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}},"sourceSpan":{"start":[65,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[71,22]}},{"comments":null,"title":"heytingAlgebraProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","HeytingAlgebra"],"HeytingAlgebra"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[73,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[79,13]}},{"comments":null,"title":"heytingAlgebraProxy2","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","HeytingAlgebra"],"HeytingAlgebra"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy2"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[81,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[87,14]}},{"comments":null,"title":"heytingAlgebraProxy3","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","HeytingAlgebra"],"HeytingAlgebra"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy3"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[89,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[95,14]}},{"comments":null,"title":"heytingAlgebraRecord","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"list"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","HeytingAlgebra"],"HeytingAlgebraRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"list"},{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"row"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","HeytingAlgebra"],"HeytingAlgebra"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]}},"sourceSpan":{"start":[97,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[103,41]}}],"comments":"The `HeytingAlgebra` type class represents types that are bounded lattices with\nan implication operator such that the following laws hold:\n\n- Associativity:\n - `a || (b || c) = (a || b) || c`\n - `a && (b && c) = (a && b) && c`\n- Commutativity:\n - `a || b = b || a`\n - `a && b = b && a`\n- Absorption:\n - `a || (a && b) = a`\n - `a && (a || b) = a`\n- Idempotent:\n - `a || a = a`\n - `a && a = a`\n- Identity:\n - `a || ff = a`\n - `a && tt = a`\n- Implication:\n - ``a `implies` a = tt``\n - ``a && (a `implies` b) = a && b``\n - ``b && (a `implies` b) = b``\n - ``a `implies` (b && c) = (a `implies` b) && (a `implies` c)``\n- Complemented:\n - ``not a = a `implies` ff``\n","title":"HeytingAlgebra","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[38,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[44,16]}},{"children":[],"comments":null,"title":"(&&)","info":{"declType":"alias","alias":[["Data","HeytingAlgebra"],{"Right":{"Left":{"Ident":"conj"}}}],"fixity":{"associativity":"infixr","precedence":3}},"sourceSpan":{"start":[46,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[46,20]}},{"children":[],"comments":null,"title":"(||)","info":{"declType":"alias","alias":[["Data","HeytingAlgebra"],{"Right":{"Left":{"Ident":"disj"}}}],"fixity":{"associativity":"infixr","precedence":2}},"sourceSpan":{"start":[47,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[47,20]}},{"children":[{"comments":null,"title":"ffRecord","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"ForAll","contents":["rlproxy",{"annotation":[],"tag":"ForAll","contents":["rproxy",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"rlproxy"},{"annotation":[],"tag":"TypeVar","contents":"rowlist"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"rproxy"},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"subrow"}]}]}]},null]},null]}},"sourceSpan":{"start":[113,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[113,84]}},{"comments":null,"title":"ttRecord","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"ForAll","contents":["rlproxy",{"annotation":[],"tag":"ForAll","contents":["rproxy",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"rlproxy"},{"annotation":[],"tag":"TypeVar","contents":"rowlist"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"rproxy"},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"subrow"}]}]}]},null]},null]}},"sourceSpan":{"start":[114,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[114,84]}},{"comments":null,"title":"impliesRecord","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"ForAll","contents":["rlproxy",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"rlproxy"},{"annotation":[],"tag":"TypeVar","contents":"rowlist"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"subrow"}]}]}]}]},null]}},"sourceSpan":{"start":[115,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[115,96]}},{"comments":null,"title":"disjRecord","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"ForAll","contents":["rlproxy",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"rlproxy"},{"annotation":[],"tag":"TypeVar","contents":"rowlist"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"subrow"}]}]}]}]},null]}},"sourceSpan":{"start":[116,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[116,93]}},{"comments":null,"title":"conjRecord","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"ForAll","contents":["rlproxy",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"rlproxy"},{"annotation":[],"tag":"TypeVar","contents":"rowlist"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"subrow"}]}]}]}]},null]}},"sourceSpan":{"start":[117,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[117,93]}},{"comments":null,"title":"notRecord","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"ForAll","contents":["rlproxy",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"rlproxy"},{"annotation":[],"tag":"TypeVar","contents":"rowlist"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"subrow"}]}]}]},null]}},"sourceSpan":{"start":[118,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[118,78]}},{"comments":null,"title":"heytingAlgebraRecordNil","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","HeytingAlgebra"],"HeytingAlgebraRecord"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim","RowList"],"Nil"]}]},{"annotation":[],"tag":"TypeVar","contents":"row"}]},{"annotation":[],"tag":"REmpty"}]}},"sourceSpan":{"start":[120,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[126,20]}},{"comments":null,"title":"heytingAlgebraRecordCons","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Symbol"],"IsSymbol"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"key"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Prim","Row"],"Cons"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"key"},{"annotation":[],"tag":"TypeVar","contents":"focus"},{"annotation":[],"tag":"TypeVar","contents":"subrowTail"},{"annotation":[],"tag":"TypeVar","contents":"subrow"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","HeytingAlgebra"],"HeytingAlgebraRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"rowlistTail"},{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"subrowTail"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","HeytingAlgebra"],"HeytingAlgebra"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"focus"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","HeytingAlgebra"],"HeytingAlgebraRecord"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim","RowList"],"Cons"]},{"annotation":[],"tag":"TypeVar","contents":"key"}]},{"annotation":[],"tag":"TypeVar","contents":"focus"}]},{"annotation":[],"tag":"TypeVar","contents":"rowlistTail"}]}]},{"annotation":[],"tag":"TypeVar","contents":"row"}]},{"annotation":[],"tag":"TypeVar","contents":"subrow"}]}},"sourceSpan":{"start":[128,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[174,55]}}],"comments":null,"title":"HeytingAlgebraRecord","info":{"fundeps":[[["rowlist"],["subrow"]]],"arguments":[["rowlist",null],["row",null],["subrow",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[112,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[118,78]}}]},{"reExports":[],"name":"Data.HeytingAlgebra.Generic","comments":null,"declarations":[{"children":[{"comments":null,"title":"genericFF'","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeVar","contents":"a"}},"sourceSpan":{"start":[9,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra/Generic.purs","end":[9,18]}},{"comments":null,"title":"genericTT'","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeVar","contents":"a"}},"sourceSpan":{"start":[10,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra/Generic.purs","end":[10,18]}},{"comments":null,"title":"genericImplies'","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[11,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra/Generic.purs","end":[11,33]}},{"comments":null,"title":"genericConj'","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[12,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra/Generic.purs","end":[12,30]}},{"comments":null,"title":"genericDisj'","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[13,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra/Generic.purs","end":[13,30]}},{"comments":null,"title":"genericNot'","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}},"sourceSpan":{"start":[14,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra/Generic.purs","end":[14,24]}},{"comments":null,"title":"genericHeytingAlgebraNoArguments","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","HeytingAlgebra","Generic"],"GenericHeytingAlgebra"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"NoArguments"]}]}},"sourceSpan":{"start":[16,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra/Generic.purs","end":[22,30]}},{"comments":null,"title":"genericHeytingAlgebraArgument","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","HeytingAlgebra"],"HeytingAlgebra"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","HeytingAlgebra","Generic"],"GenericHeytingAlgebra"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"Argument"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[24,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra/Generic.purs","end":[30,46]}},{"comments":null,"title":"genericHeytingAlgebraProduct","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","HeytingAlgebra","Generic"],"GenericHeytingAlgebra"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","HeytingAlgebra","Generic"],"GenericHeytingAlgebra"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"b"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","HeytingAlgebra","Generic"],"GenericHeytingAlgebra"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"Product"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}},"sourceSpan":{"start":[32,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra/Generic.purs","end":[38,70]}},{"comments":null,"title":"genericHeytingAlgebraConstructor","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","HeytingAlgebra","Generic"],"GenericHeytingAlgebra"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","HeytingAlgebra","Generic"],"GenericHeytingAlgebra"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"Constructor"]},{"annotation":[],"tag":"TypeVar","contents":"name"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[40,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra/Generic.purs","end":[46,60]}}],"comments":null,"title":"GenericHeytingAlgebra","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[8,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra/Generic.purs","end":[14,24]}},{"children":[],"comments":"A `Generic` implementation of the `ff` member from the `HeytingAlgebra` type class.\n","title":"genericFF","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["rep",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Generic","Rep"],"Generic"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"},{"annotation":[],"tag":"TypeVar","contents":"rep"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","HeytingAlgebra","Generic"],"GenericHeytingAlgebra"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"rep"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},null]},null]}},"sourceSpan":{"start":[49,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra/Generic.purs","end":[49,75]}},{"children":[],"comments":"A `Generic` implementation of the `tt` member from the `HeytingAlgebra` type class.\n","title":"genericTT","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["rep",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Generic","Rep"],"Generic"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"},{"annotation":[],"tag":"TypeVar","contents":"rep"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","HeytingAlgebra","Generic"],"GenericHeytingAlgebra"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"rep"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},null]},null]}},"sourceSpan":{"start":[53,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra/Generic.purs","end":[53,75]}},{"children":[],"comments":"A `Generic` implementation of the `implies` member from the `HeytingAlgebra` type class.\n","title":"genericImplies","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["rep",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Generic","Rep"],"Generic"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"},{"annotation":[],"tag":"TypeVar","contents":"rep"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","HeytingAlgebra","Generic"],"GenericHeytingAlgebra"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"rep"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}]}]},null]},null]}},"sourceSpan":{"start":[57,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra/Generic.purs","end":[57,90]}},{"children":[],"comments":"A `Generic` implementation of the `conj` member from the `HeytingAlgebra` type class.\n","title":"genericConj","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["rep",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Generic","Rep"],"Generic"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"},{"annotation":[],"tag":"TypeVar","contents":"rep"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","HeytingAlgebra","Generic"],"GenericHeytingAlgebra"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"rep"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}]}]},null]},null]}},"sourceSpan":{"start":[61,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra/Generic.purs","end":[61,87]}},{"children":[],"comments":"A `Generic` implementation of the `disj` member from the `HeytingAlgebra` type class.\n","title":"genericDisj","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["rep",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Generic","Rep"],"Generic"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"},{"annotation":[],"tag":"TypeVar","contents":"rep"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","HeytingAlgebra","Generic"],"GenericHeytingAlgebra"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"rep"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}]}]},null]},null]}},"sourceSpan":{"start":[65,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra/Generic.purs","end":[65,87]}},{"children":[],"comments":"A `Generic` implementation of the `not` member from the `HeytingAlgebra` type class.\n","title":"genericNot","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["rep",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Generic","Rep"],"Generic"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"},{"annotation":[],"tag":"TypeVar","contents":"rep"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","HeytingAlgebra","Generic"],"GenericHeytingAlgebra"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"rep"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}]},null]},null]}},"sourceSpan":{"start":[69,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra/Generic.purs","end":[69,81]}}]},{"reExports":[{"moduleName":{"package":null,"item":["Data","Semigroup"]},"declarations":[{"children":[{"comments":null,"title":"semigroupString","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup"],"Semigroup"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"String"]}]}},"sourceSpan":{"start":[36,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup.purs","end":[37,24]}},{"comments":null,"title":"semigroupUnit","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup"],"Semigroup"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}},"sourceSpan":{"start":[39,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup.purs","end":[40,20]}},{"comments":null,"title":"semigroupVoid","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup"],"Semigroup"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Void"],"Void"]}]}},"sourceSpan":{"start":[42,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup.purs","end":[43,20]}},{"comments":null,"title":"semigroupFn","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Semigroup"],"Semigroup"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"s'"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup"],"Semigroup"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"s"}]},{"annotation":[],"tag":"TypeVar","contents":"s'"}]}]}},"sourceSpan":{"start":[45,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup.purs","end":[46,28]}},{"comments":null,"title":"semigroupArray","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup"],"Semigroup"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Array"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[48,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup.purs","end":[49,23]}},{"comments":null,"title":"semigroupProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup"],"Semigroup"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[51,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup.purs","end":[52,21]}},{"comments":null,"title":"semigroupProxy2","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup"],"Semigroup"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy2"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[54,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup.purs","end":[55,22]}},{"comments":null,"title":"semigroupProxy3","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup"],"Semigroup"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy3"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[57,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup.purs","end":[58,22]}},{"comments":null,"title":"semigroupRecord","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"list"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Semigroup"],"SemigroupRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"list"},{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"row"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup"],"Semigroup"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]}},"sourceSpan":{"start":[60,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup.purs","end":[61,46]}}],"comments":"The `Semigroup` type class identifies an associative operation on a type.\n\nInstances are required to satisfy the following law:\n\n- Associativity: `(x <> y) <> z = x <> (y <> z)`\n\nOne example of a `Semigroup` is `String`, with `(<>)` defined as string\nconcatenation. Another example is `List a`, with `(<>)` defined as\nlist concatenation.\n\n### Newtypes for Semigroup\n\nThere are two other ways to implement an instance for this type class\nregardless of which type is used. These instances can be used by\nwrapping the values in one of the two newtypes below:\n1. `First` - Use the first argument every time: `append first _ = first`.\n2. `Last` - Use the last argument every time: `append _ last = last`.\n","title":"Semigroup","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[31,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup.purs","end":[32,24]}},{"children":[{"comments":null,"title":"semigroupRecordNil","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup"],"SemigroupRecord"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim","RowList"],"Nil"]}]},{"annotation":[],"tag":"TypeVar","contents":"row"}]},{"annotation":[],"tag":"REmpty"}]}},"sourceSpan":{"start":[72,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup.purs","end":[73,26]}},{"comments":null,"title":"semigroupRecordCons","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Symbol"],"IsSymbol"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"key"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Prim","Row"],"Cons"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"key"},{"annotation":[],"tag":"TypeVar","contents":"focus"},{"annotation":[],"tag":"TypeVar","contents":"subrowTail"},{"annotation":[],"tag":"TypeVar","contents":"subrow"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Semigroup"],"SemigroupRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"rowlistTail"},{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"subrowTail"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Semigroup"],"Semigroup"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"focus"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup"],"SemigroupRecord"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim","RowList"],"Cons"]},{"annotation":[],"tag":"TypeVar","contents":"key"}]},{"annotation":[],"tag":"TypeVar","contents":"focus"}]},{"annotation":[],"tag":"TypeVar","contents":"rowlistTail"}]}]},{"annotation":[],"tag":"TypeVar","contents":"row"}]},{"annotation":[],"tag":"TypeVar","contents":"subrow"}]}},"sourceSpan":{"start":[75,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup.purs","end":[87,61]}}],"comments":null,"title":"SemigroupRecord","info":{"fundeps":[[["rowlist"],["subrow"]]],"arguments":[["rowlist",null],["row",null],["subrow",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[69,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup.purs","end":[70,95]}},{"children":[],"comments":null,"title":"(<>)","info":{"declType":"alias","alias":[["Data","Semigroup"],{"Right":{"Left":{"Ident":"append"}}}],"fixity":{"associativity":"infixr","precedence":5}},"sourceSpan":{"start":[34,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup.purs","end":[34,22]}}]}],"name":"Data.Monoid","comments":null,"declarations":[{"children":[{"comments":null,"title":"mempty","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeVar","contents":"m"}},"sourceSpan":{"start":[45,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid.purs","end":[45,14]}},{"comments":null,"title":"monoidUnit","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid"],"Monoid"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}},"sourceSpan":{"start":[47,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid.purs","end":[48,16]}},{"comments":null,"title":"monoidOrdering","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid"],"Monoid"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ordering"],"Ordering"]}]}},"sourceSpan":{"start":[50,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid.purs","end":[51,14]}},{"comments":null,"title":"monoidFn","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Monoid"],"Monoid"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"b"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid"],"Monoid"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}},"sourceSpan":{"start":[53,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid.purs","end":[54,20]}},{"comments":null,"title":"monoidString","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid"],"Monoid"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"String"]}]}},"sourceSpan":{"start":[56,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid.purs","end":[57,14]}},{"comments":null,"title":"monoidArray","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid"],"Monoid"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Array"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[59,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid.purs","end":[60,14]}},{"comments":null,"title":"monoidRecord","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"list"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Monoid"],"MonoidRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"list"},{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"row"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid"],"Monoid"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]}},"sourceSpan":{"start":[62,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid.purs","end":[63,46]}}],"comments":"A `Monoid` is a `Semigroup` with a value `mempty`, which is both a\nleft and right unit for the associative operation `<>`:\n\n- Left unit: `(mempty <> x) = x`\n- Right unit: `(x <> mempty) = x`\n\n`Monoid`s are commonly used as the result of fold operations, where\n`<>` is used to combine individual results, and `mempty` gives the result\nof folding an empty collection of elements.\n\n### Newtypes for Monoid\n\nSome types (e.g. `Int`, `Boolean`) can implement multiple law-abiding\ninstances for `Monoid`. Let's use `Int` as an example\n1. `<>` could be `+` and `mempty` could be `0`\n2. `<>` could be `*` and `mempty` could be `1`.\n\nTo clarify these ambiguous situations, one should use the newtypes\ndefined in `Data.Monoid.<NewtypeName>` modules.\n\nIn the above ambiguous situation, we could use `Additive`\nfor the first situation or `Multiplicative` for the second one.\n","title":"Monoid","info":{"fundeps":[],"arguments":[["m",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Data","Semigroup"],"Semigroup"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"m"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[44,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid.purs","end":[45,14]}},{"children":[],"comments":"Append a value to itself a certain number of times. For the\n`Multiplicative` type, and for a non-negative power, this is the same as\nnormal number exponentiation.\n\nIf the second argument is negative this function will return `mempty`\n(*unlike* normal number exponentiation). The `Monoid` constraint alone\nis not enough to write a `power` function with the property that `power x\nn` cancels with `power x (-n)`, i.e. `power x n <> power x (-n) = mempty`.\nFor that, we would additionally need the ability to invert elements, i.e.\na Group.\n\n```purescript\npower [1,2] 3 == [1,2,1,2,1,2]\npower [1,2] 1 == [1,2]\npower [1,2] 0 == []\npower [1,2] (-3) == []\n```\n\n","title":"power","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["m",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Monoid"],"Monoid"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"m"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"m"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Int"]}]},{"annotation":[],"tag":"TypeVar","contents":"m"}]}]}]},null]}},"sourceSpan":{"start":[83,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid.purs","end":[83,45]}},{"children":[],"comments":"Allow or \"truncate\" a Monoid to its `mempty` value based on a condition.\n","title":"guard","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["m",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Monoid"],"Monoid"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"m"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"m"}]},{"annotation":[],"tag":"TypeVar","contents":"m"}]}]}]},null]}},"sourceSpan":{"start":[94,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid.purs","end":[94,49]}},{"children":[{"comments":null,"title":"memptyRecord","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"ForAll","contents":["rlproxy",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"rlproxy"},{"annotation":[],"tag":"TypeVar","contents":"rowlist"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"subrow"}]}]},null]}},"sourceSpan":{"start":[102,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid.purs","end":[102,67]}},{"comments":null,"title":"monoidRecordNil","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid"],"MonoidRecord"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim","RowList"],"Nil"]}]},{"annotation":[],"tag":"TypeVar","contents":"row"}]},{"annotation":[],"tag":"REmpty"}]}},"sourceSpan":{"start":[104,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid.purs","end":[105,22]}},{"comments":null,"title":"monoidRecordCons","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Symbol"],"IsSymbol"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"key"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Monoid"],"Monoid"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"focus"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Prim","Row"],"Cons"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"key"},{"annotation":[],"tag":"TypeVar","contents":"focus"},{"annotation":[],"tag":"TypeVar","contents":"subrowTail"},{"annotation":[],"tag":"TypeVar","contents":"subrow"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Monoid"],"MonoidRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"rowlistTail"},{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"subrowTail"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid"],"MonoidRecord"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim","RowList"],"Cons"]},{"annotation":[],"tag":"TypeVar","contents":"key"}]},{"annotation":[],"tag":"TypeVar","contents":"focus"}]},{"annotation":[],"tag":"TypeVar","contents":"rowlistTail"}]}]},{"annotation":[],"tag":"TypeVar","contents":"row"}]},{"annotation":[],"tag":"TypeVar","contents":"subrow"}]}},"sourceSpan":{"start":[107,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid.purs","end":[119,55]}}],"comments":null,"title":"MonoidRecord","info":{"fundeps":[[["rowlist"],["row","subrow"]]],"arguments":[["rowlist",null],["row",null],["subrow",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Data","Semigroup"],"SemigroupRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"rowlist"},{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"subrow"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[101,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid.purs","end":[102,67]}}]},{"reExports":[],"name":"Data.Monoid.Additive","comments":null,"declarations":[{"children":[{"comments":null,"title":"Additive","info":{"arguments":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"eqAdditive","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Eq"],"Eq"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Additive"],"Additive"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[16,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Additive.purs","end":[16,62]}},{"comments":null,"title":"eq1Additive","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq1"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Additive"],"Additive"]}]}},"sourceSpan":{"start":[17,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Additive.purs","end":[17,44]}},{"comments":null,"title":"ordAdditive","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Ord"],"Ord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Additive"],"Additive"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[19,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Additive.purs","end":[19,65]}},{"comments":null,"title":"ord1Additive","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord1"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Additive"],"Additive"]}]}},"sourceSpan":{"start":[20,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Additive.purs","end":[20,46]}},{"comments":null,"title":"boundedAdditive","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Bounded"],"Bounded"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Bounded"],"Bounded"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Additive"],"Additive"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[22,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Additive.purs","end":[22,77]}},{"comments":null,"title":"showAdditive","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Show"],"Show"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Additive"],"Additive"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[24,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Additive.purs","end":[25,52]}},{"comments":null,"title":"functorAdditive","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Functor"],"Functor"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Additive"],"Additive"]}]}},"sourceSpan":{"start":[27,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Additive.purs","end":[27,52]}},{"comments":null,"title":"applyAdditive","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Apply"],"Apply"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Additive"],"Additive"]}]}},"sourceSpan":{"start":[29,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Additive.purs","end":[30,51]}},{"comments":null,"title":"applicativeAdditive","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Applicative"],"Applicative"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Additive"],"Additive"]}]}},"sourceSpan":{"start":[32,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Additive.purs","end":[33,18]}},{"comments":null,"title":"bindAdditive","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Bind"],"Bind"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Additive"],"Additive"]}]}},"sourceSpan":{"start":[35,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Additive.purs","end":[36,28]}},{"comments":null,"title":"monadAdditive","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Monad"],"Monad"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Additive"],"Additive"]}]}},"sourceSpan":{"start":[38,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Additive.purs","end":[38,41]}},{"comments":null,"title":"semigroupAdditive","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Semiring"],"Semiring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup"],"Semigroup"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Additive"],"Additive"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[40,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Additive.purs","end":[41,54]}},{"comments":null,"title":"monoidAdditive","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Semiring"],"Semiring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid"],"Monoid"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Additive"],"Additive"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[43,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Additive.purs","end":[44,25]}}],"comments":"Monoid and semigroup for semirings under addition.\n\n``` purescript\nAdditive x <> Additive y == Additive (x + y)\n(mempty :: Additive _) == Additive zero\n```\n","title":"Additive","info":{"declType":"data","dataDeclType":"newtype","typeArguments":[["a",null]]},"sourceSpan":{"start":[14,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Additive.purs","end":[14,32]}}]},{"reExports":[],"name":"Data.Monoid.Conj","comments":null,"declarations":[{"children":[{"comments":null,"title":"Conj","info":{"arguments":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"eqConj","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Eq"],"Eq"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Conj"],"Conj"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[17,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Conj.purs","end":[17,54]}},{"comments":null,"title":"eq1Conj","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq1"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Conj"],"Conj"]}]}},"sourceSpan":{"start":[18,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Conj.purs","end":[18,36]}},{"comments":null,"title":"ordConj","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Ord"],"Ord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Conj"],"Conj"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[20,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Conj.purs","end":[20,57]}},{"comments":null,"title":"ord1Conj","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord1"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Conj"],"Conj"]}]}},"sourceSpan":{"start":[21,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Conj.purs","end":[21,38]}},{"comments":null,"title":"boundedConj","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Bounded"],"Bounded"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Bounded"],"Bounded"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Conj"],"Conj"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[23,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Conj.purs","end":[23,69]}},{"comments":null,"title":"showConj","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Show"],"Show"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Conj"],"Conj"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[25,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Conj.purs","end":[26,44]}},{"comments":null,"title":"functorConj","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Functor"],"Functor"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Conj"],"Conj"]}]}},"sourceSpan":{"start":[28,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Conj.purs","end":[28,44]}},{"comments":null,"title":"applyConj","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Apply"],"Apply"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Conj"],"Conj"]}]}},"sourceSpan":{"start":[30,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Conj.purs","end":[31,39]}},{"comments":null,"title":"applicativeConj","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Applicative"],"Applicative"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Conj"],"Conj"]}]}},"sourceSpan":{"start":[33,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Conj.purs","end":[34,14]}},{"comments":null,"title":"bindConj","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Bind"],"Bind"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Conj"],"Conj"]}]}},"sourceSpan":{"start":[36,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Conj.purs","end":[37,24]}},{"comments":null,"title":"monadConj","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Monad"],"Monad"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Conj"],"Conj"]}]}},"sourceSpan":{"start":[39,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Conj.purs","end":[39,33]}},{"comments":null,"title":"semigroupConj","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","HeytingAlgebra"],"HeytingAlgebra"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup"],"Semigroup"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Conj"],"Conj"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[41,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Conj.purs","end":[42,45]}},{"comments":null,"title":"monoidConj","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","HeytingAlgebra"],"HeytingAlgebra"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid"],"Monoid"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Conj"],"Conj"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[44,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Conj.purs","end":[45,19]}},{"comments":null,"title":"semiringConj","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","HeytingAlgebra"],"HeytingAlgebra"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Conj"],"Conj"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[47,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Conj.purs","end":[51,42]}}],"comments":"Monoid and semigroup for conjunction.\n\n``` purescript\nConj x <> Conj y == Conj (x && y)\n(mempty :: Conj _) == Conj tt\n```\n","title":"Conj","info":{"declType":"data","dataDeclType":"newtype","typeArguments":[["a",null]]},"sourceSpan":{"start":[15,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Conj.purs","end":[15,24]}}]},{"reExports":[],"name":"Data.Monoid.Disj","comments":null,"declarations":[{"children":[{"comments":null,"title":"Disj","info":{"arguments":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"eqDisj","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Eq"],"Eq"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Disj"],"Disj"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[17,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Disj.purs","end":[17,54]}},{"comments":null,"title":"eq1Disj","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq1"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Disj"],"Disj"]}]}},"sourceSpan":{"start":[18,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Disj.purs","end":[18,36]}},{"comments":null,"title":"ordDisj","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Ord"],"Ord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Disj"],"Disj"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[20,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Disj.purs","end":[20,57]}},{"comments":null,"title":"ord1Disj","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord1"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Disj"],"Disj"]}]}},"sourceSpan":{"start":[21,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Disj.purs","end":[21,38]}},{"comments":null,"title":"boundedDisj","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Bounded"],"Bounded"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Bounded"],"Bounded"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Disj"],"Disj"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[23,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Disj.purs","end":[23,69]}},{"comments":null,"title":"showDisj","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Show"],"Show"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Disj"],"Disj"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[25,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Disj.purs","end":[26,44]}},{"comments":null,"title":"functorDisj","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Functor"],"Functor"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Disj"],"Disj"]}]}},"sourceSpan":{"start":[28,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Disj.purs","end":[28,44]}},{"comments":null,"title":"applyDisj","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Apply"],"Apply"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Disj"],"Disj"]}]}},"sourceSpan":{"start":[30,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Disj.purs","end":[31,39]}},{"comments":null,"title":"applicativeDisj","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Applicative"],"Applicative"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Disj"],"Disj"]}]}},"sourceSpan":{"start":[33,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Disj.purs","end":[34,14]}},{"comments":null,"title":"bindDisj","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Bind"],"Bind"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Disj"],"Disj"]}]}},"sourceSpan":{"start":[36,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Disj.purs","end":[37,24]}},{"comments":null,"title":"monadDisj","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Monad"],"Monad"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Disj"],"Disj"]}]}},"sourceSpan":{"start":[39,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Disj.purs","end":[39,33]}},{"comments":null,"title":"semigroupDisj","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","HeytingAlgebra"],"HeytingAlgebra"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup"],"Semigroup"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Disj"],"Disj"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[41,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Disj.purs","end":[42,45]}},{"comments":null,"title":"monoidDisj","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","HeytingAlgebra"],"HeytingAlgebra"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid"],"Monoid"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Disj"],"Disj"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[44,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Disj.purs","end":[45,19]}},{"comments":null,"title":"semiringDisj","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","HeytingAlgebra"],"HeytingAlgebra"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Disj"],"Disj"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[47,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Disj.purs","end":[51,42]}}],"comments":"Monoid and semigroup for disjunction.\n\n``` purescript\nDisj x <> Disj y == Disj (x || y)\n(mempty :: Disj _) == Disj bottom\n```\n","title":"Disj","info":{"declType":"data","dataDeclType":"newtype","typeArguments":[["a",null]]},"sourceSpan":{"start":[15,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Disj.purs","end":[15,24]}}]},{"reExports":[],"name":"Data.Monoid.Dual","comments":null,"declarations":[{"children":[{"comments":null,"title":"Dual","info":{"arguments":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"eqDual","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Eq"],"Eq"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Dual"],"Dual"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[16,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Dual.purs","end":[16,54]}},{"comments":null,"title":"eq1Dual","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq1"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Dual"],"Dual"]}]}},"sourceSpan":{"start":[17,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Dual.purs","end":[17,36]}},{"comments":null,"title":"ordDual","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Ord"],"Ord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Dual"],"Dual"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[19,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Dual.purs","end":[19,57]}},{"comments":null,"title":"ord1Dual","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord1"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Dual"],"Dual"]}]}},"sourceSpan":{"start":[20,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Dual.purs","end":[20,38]}},{"comments":null,"title":"boundedDual","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Bounded"],"Bounded"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Bounded"],"Bounded"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Dual"],"Dual"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[22,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Dual.purs","end":[22,69]}},{"comments":null,"title":"showDual","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Show"],"Show"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Dual"],"Dual"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[24,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Dual.purs","end":[25,44]}},{"comments":null,"title":"functorDual","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Functor"],"Functor"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Dual"],"Dual"]}]}},"sourceSpan":{"start":[27,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Dual.purs","end":[27,44]}},{"comments":null,"title":"applyDual","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Apply"],"Apply"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Dual"],"Dual"]}]}},"sourceSpan":{"start":[29,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Dual.purs","end":[30,39]}},{"comments":null,"title":"applicativeDual","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Applicative"],"Applicative"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Dual"],"Dual"]}]}},"sourceSpan":{"start":[32,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Dual.purs","end":[33,14]}},{"comments":null,"title":"bindDual","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Bind"],"Bind"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Dual"],"Dual"]}]}},"sourceSpan":{"start":[35,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Dual.purs","end":[36,24]}},{"comments":null,"title":"monadDual","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Monad"],"Monad"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Dual"],"Dual"]}]}},"sourceSpan":{"start":[38,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Dual.purs","end":[38,33]}},{"comments":null,"title":"semigroupDual","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Semigroup"],"Semigroup"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup"],"Semigroup"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Dual"],"Dual"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[40,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Dual.purs","end":[41,43]}},{"comments":null,"title":"monoidDual","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Monoid"],"Monoid"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid"],"Monoid"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Dual"],"Dual"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[43,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Dual.purs","end":[44,23]}}],"comments":"The dual of a monoid.\n\n``` purescript\nDual x <> Dual y == Dual (y <> x)\n(mempty :: Dual _) == Dual mempty\n```\n","title":"Dual","info":{"declType":"data","dataDeclType":"newtype","typeArguments":[["a",null]]},"sourceSpan":{"start":[14,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Dual.purs","end":[14,24]}}]},{"reExports":[],"name":"Data.Monoid.Endo","comments":null,"declarations":[{"children":[{"comments":null,"title":"Endo","info":{"arguments":[{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"c"},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}}],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"eqEndo","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Eq"],"Eq"],"constraintArgs":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"c"},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Endo"],"Endo"]},{"annotation":[],"tag":"TypeVar","contents":"c"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[17,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Endo.purs","end":[17,62]}},{"comments":null,"title":"ordEndo","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Ord"],"Ord"],"constraintArgs":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"c"},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Endo"],"Endo"]},{"annotation":[],"tag":"TypeVar","contents":"c"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[19,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Endo.purs","end":[19,65]}},{"comments":null,"title":"boundedEndo","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Bounded"],"Bounded"],"constraintArgs":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"c"},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Bounded"],"Bounded"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Endo"],"Endo"]},{"annotation":[],"tag":"TypeVar","contents":"c"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[21,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Endo.purs","end":[21,77]}},{"comments":null,"title":"showEndo","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Show"],"Show"],"constraintArgs":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"c"},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Endo"],"Endo"]},{"annotation":[],"tag":"TypeVar","contents":"c"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[23,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Endo.purs","end":[24,44]}},{"comments":null,"title":"semigroupEndo","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Control","Semigroupoid"],"Semigroupoid"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"c"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup"],"Semigroup"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Endo"],"Endo"]},{"annotation":[],"tag":"TypeVar","contents":"c"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[26,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Endo.purs","end":[27,44]}},{"comments":null,"title":"monoidEndo","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Control","Category"],"Category"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"c"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid"],"Monoid"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Endo"],"Endo"]},{"annotation":[],"tag":"TypeVar","contents":"c"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[29,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Endo.purs","end":[30,25]}}],"comments":null,"title":"Endo","info":{"declType":"data","dataDeclType":"newtype","typeArguments":[["c",null],["a",null]]},"sourceSpan":{"start":[15,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Endo.purs","end":[15,32]}}]},{"reExports":[],"name":"Data.Monoid.Generic","comments":null,"declarations":[{"children":[{"comments":null,"title":"genericMempty'","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeVar","contents":"a"}},"sourceSpan":{"start":[11,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Generic.purs","end":[11,22]}},{"comments":null,"title":"genericMonoidNoArguments","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Generic"],"GenericMonoid"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"NoArguments"]}]}},"sourceSpan":{"start":[13,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Generic.purs","end":[14,31]}},{"comments":null,"title":"genericMonoidProduct","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Monoid","Generic"],"GenericMonoid"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Monoid","Generic"],"GenericMonoid"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"b"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Generic"],"GenericMonoid"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"Product"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}},"sourceSpan":{"start":[16,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Generic.purs","end":[17,57]}},{"comments":null,"title":"genericMonoidConstructor","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Monoid","Generic"],"GenericMonoid"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Generic"],"GenericMonoid"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"Constructor"]},{"annotation":[],"tag":"TypeVar","contents":"name"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[19,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Generic.purs","end":[20,46]}},{"comments":null,"title":"genericMonoidArgument","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Monoid"],"Monoid"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Generic"],"GenericMonoid"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"Argument"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[22,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Generic.purs","end":[23,35]}}],"comments":null,"title":"GenericMonoid","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[10,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Generic.purs","end":[11,22]}},{"children":[],"comments":"A `Generic` implementation of the `mempty` member from the `Monoid` type class.\n","title":"genericMempty","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["rep",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Generic","Rep"],"Generic"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"},{"annotation":[],"tag":"TypeVar","contents":"rep"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Monoid","Generic"],"GenericMonoid"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"rep"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},null]},null]}},"sourceSpan":{"start":[26,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Generic.purs","end":[26,71]}}]},{"reExports":[],"name":"Data.Monoid.Multiplicative","comments":null,"declarations":[{"children":[{"comments":null,"title":"Multiplicative","info":{"arguments":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"eqMultiplicative","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Eq"],"Eq"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Multiplicative"],"Multiplicative"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[16,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Multiplicative.purs","end":[16,74]}},{"comments":null,"title":"eq1Multiplicative","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq1"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Multiplicative"],"Multiplicative"]}]}},"sourceSpan":{"start":[17,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Multiplicative.purs","end":[17,56]}},{"comments":null,"title":"ordMultiplicative","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Ord"],"Ord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Multiplicative"],"Multiplicative"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[19,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Multiplicative.purs","end":[19,77]}},{"comments":null,"title":"ord1Multiplicative","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord1"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Multiplicative"],"Multiplicative"]}]}},"sourceSpan":{"start":[20,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Multiplicative.purs","end":[20,58]}},{"comments":null,"title":"boundedMultiplicative","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Bounded"],"Bounded"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Bounded"],"Bounded"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Multiplicative"],"Multiplicative"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[22,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Multiplicative.purs","end":[22,89]}},{"comments":null,"title":"showMultiplicative","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Show"],"Show"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Multiplicative"],"Multiplicative"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[24,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Multiplicative.purs","end":[25,64]}},{"comments":null,"title":"functorMultiplicative","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Functor"],"Functor"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Multiplicative"],"Multiplicative"]}]}},"sourceSpan":{"start":[27,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Multiplicative.purs","end":[27,64]}},{"comments":null,"title":"applyMultiplicative","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Apply"],"Apply"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Multiplicative"],"Multiplicative"]}]}},"sourceSpan":{"start":[29,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Multiplicative.purs","end":[30,69]}},{"comments":null,"title":"applicativeMultiplicative","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Applicative"],"Applicative"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Multiplicative"],"Multiplicative"]}]}},"sourceSpan":{"start":[32,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Multiplicative.purs","end":[33,24]}},{"comments":null,"title":"bindMultiplicative","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Bind"],"Bind"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Multiplicative"],"Multiplicative"]}]}},"sourceSpan":{"start":[35,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Multiplicative.purs","end":[36,34]}},{"comments":null,"title":"monadMultiplicative","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Monad"],"Monad"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Multiplicative"],"Multiplicative"]}]}},"sourceSpan":{"start":[38,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Multiplicative.purs","end":[38,53]}},{"comments":null,"title":"semigroupMultiplicative","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Semiring"],"Semiring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup"],"Semigroup"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Multiplicative"],"Multiplicative"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[40,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Multiplicative.purs","end":[41,72]}},{"comments":null,"title":"monoidMultiplicative","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Semiring"],"Semiring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid"],"Monoid"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid","Multiplicative"],"Multiplicative"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[43,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Multiplicative.purs","end":[44,30]}}],"comments":"Monoid and semigroup for semirings under multiplication.\n\n``` purescript\nMultiplicative x <> Multiplicative y == Multiplicative (x * y)\n(mempty :: Multiplicative _) == Multiplicative one\n```\n","title":"Multiplicative","info":{"declType":"data","dataDeclType":"newtype","typeArguments":[["a",null]]},"sourceSpan":{"start":[14,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid/Multiplicative.purs","end":[14,44]}}]},{"reExports":[],"name":"Data.NaturalTransformation","comments":null,"declarations":[{"children":[],"comments":null,"title":"NaturalTransformation","info":{"arguments":[["f",null],["g",null]],"declType":"typeSynonym","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"g"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},null]}},"sourceSpan":{"start":[18,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/NaturalTransformation.purs","end":[18,54]}},{"children":[],"comments":null,"title":"type (~>)","info":{"declType":"alias","alias":[["Data","NaturalTransformation"],{"Left":"NaturalTransformation"}],"fixity":{"associativity":"infixr","precedence":4}},"sourceSpan":{"start":[20,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/NaturalTransformation.purs","end":[20,42]}}]},{"reExports":[{"moduleName":{"package":null,"item":["Data","Ordering"]},"declarations":[{"children":[{"comments":null,"title":"LT","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"GT","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"EQ","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"eqOrdering","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ordering"],"Ordering"]}]}},"sourceSpan":{"start":[15,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ordering.purs","end":[19,19]}},{"comments":null,"title":"semigroupOrdering","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup"],"Semigroup"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ordering"],"Ordering"]}]}},"sourceSpan":{"start":[21,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ordering.purs","end":[24,18]}},{"comments":null,"title":"showOrdering","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ordering"],"Ordering"]}]}},"sourceSpan":{"start":[26,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ordering.purs","end":[29,17]}}],"comments":"The `Ordering` data type represents the three possible outcomes of\ncomparing two values:\n\n`LT` - The first value is _less than_ the second.\n`GT` - The first value is _greater than_ the second.\n`EQ` - The first value is _equal to_ the second.\n","title":"Ordering","info":{"declType":"data","dataDeclType":"data","typeArguments":[]},"sourceSpan":{"start":[13,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ordering.purs","end":[13,29]}}]}],"name":"Data.Ord","comments":null,"declarations":[{"children":[{"comments":null,"title":"compare","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ordering"],"Ordering"]}]}]}},"sourceSpan":{"start":[38,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[38,32]}},{"comments":null,"title":"ordBoolean","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}},"sourceSpan":{"start":[40,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[41,36]}},{"comments":null,"title":"ordInt","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Int"]}]}},"sourceSpan":{"start":[43,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[44,32]}},{"comments":null,"title":"ordNumber","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Number"]}]}},"sourceSpan":{"start":[46,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[47,35]}},{"comments":null,"title":"ordString","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"String"]}]}},"sourceSpan":{"start":[49,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[50,35]}},{"comments":null,"title":"ordChar","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Char"]}]}},"sourceSpan":{"start":[52,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[53,33]}},{"comments":null,"title":"ordUnit","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}},"sourceSpan":{"start":[55,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[56,19]}},{"comments":null,"title":"ordVoid","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Void"],"Void"]}]}},"sourceSpan":{"start":[58,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[59,19]}},{"comments":null,"title":"ordProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[61,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[62,19]}},{"comments":null,"title":"ordProxy2","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy2"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[64,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[65,19]}},{"comments":null,"title":"ordProxy3","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy3"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[67,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[68,19]}},{"comments":null,"title":"ordArray","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Ord"],"Ord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Array"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[70,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[77,17]}},{"comments":null,"title":"ordOrdering","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ordering"],"Ordering"]}]}},"sourceSpan":{"start":[121,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[128,21]}},{"comments":null,"title":"ordRecord","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"list"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Ord"],"OrdRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"list"},{"annotation":[],"tag":"TypeVar","contents":"row"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]}},"sourceSpan":{"start":[249,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[254,48]}}],"comments":"The `Ord` type class represents types which support comparisons with a\n_total order_.\n\n`Ord` instances should satisfy the laws of total orderings:\n\n- Reflexivity: `a <= a`\n- Antisymmetry: if `a <= b` and `b <= a` then `a = b`\n- Transitivity: if `a <= b` and `b <= c` then `a <= c`\n","title":"Ord","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Data","Eq"],"Eq"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[37,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[38,32]}},{"children":[{"comments":null,"title":"compare1","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Ord"],"Ord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ordering"],"Ordering"]}]}]}]},null]}},"sourceSpan":{"start":[221,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[221,56]}},{"comments":null,"title":"ord1Array","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord1"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Array"]}]}},"sourceSpan":{"start":[223,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[224,21]}}],"comments":"The `Ord1` type class represents totally ordered type constructors.\n","title":"Ord1","info":{"fundeps":[],"arguments":[["f",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Data","Eq"],"Eq1"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"f"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[220,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[221,56]}},{"children":[],"comments":"Test whether one value is _strictly less than_ another.\n","title":"lessThan","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Ord"],"Ord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}]}]},null]}},"sourceSpan":{"start":[131,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[131,49]}},{"children":[],"comments":null,"title":"(<)","info":{"declType":"alias","alias":[["Data","Ord"],{"Right":{"Left":{"Ident":"lessThan"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[154,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[154,23]}},{"children":[],"comments":"Test whether one value is _non-strictly less than_ another.\n","title":"lessThanOrEq","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Ord"],"Ord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}]}]},null]}},"sourceSpan":{"start":[143,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[143,53]}},{"children":[],"comments":null,"title":"(<=)","info":{"declType":"alias","alias":[["Data","Ord"],{"Right":{"Left":{"Ident":"lessThanOrEq"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[155,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[155,28]}},{"children":[],"comments":"Test whether one value is _strictly greater than_ another.\n","title":"greaterThan","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Ord"],"Ord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}]}]},null]}},"sourceSpan":{"start":[137,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[137,52]}},{"children":[],"comments":null,"title":"(>)","info":{"declType":"alias","alias":[["Data","Ord"],{"Right":{"Left":{"Ident":"greaterThan"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[156,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[156,26]}},{"children":[],"comments":"Test whether one value is _non-strictly greater than_ another.\n","title":"greaterThanOrEq","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Ord"],"Ord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}]}]},null]}},"sourceSpan":{"start":[149,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[149,56]}},{"children":[],"comments":null,"title":"(>=)","info":{"declType":"alias","alias":[["Data","Ord"],{"Right":{"Left":{"Ident":"greaterThanOrEq"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[157,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[157,31]}},{"children":[],"comments":"Compares two values by mapping them to a type with an `Ord` instance.\n","title":"comparing","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Ord"],"Ord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"b"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}}]},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ordering"],"Ordering"]}]}]}}]}]},null]},null]}},"sourceSpan":{"start":[160,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[160,67]}},{"children":[],"comments":"Take the minimum of two values. If they are considered equal, the first\nargument is chosen.\n","title":"min","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Ord"],"Ord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}]},null]}},"sourceSpan":{"start":[165,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[165,38]}},{"children":[],"comments":"Take the maximum of two values. If they are considered equal, the first\nargument is chosen.\n","title":"max","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Ord"],"Ord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}]},null]}},"sourceSpan":{"start":[174,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[174,38]}},{"children":[],"comments":"Clamp a value between a minimum and a maximum. For example:\n\n``` purescript\nlet f = clamp 0 10\nf (-5) == 0\nf 5 == 5\nf 15 == 10\n```\n","title":"clamp","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Ord"],"Ord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}]}]},null]}},"sourceSpan":{"start":[189,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[189,45]}},{"children":[],"comments":"Test whether a value is between a minimum and a maximum (inclusive).\nFor example:\n\n``` purescript\nlet f = between 0 10\nf 0 == true\nf (-5) == false\nf 5 == true\nf 10 == true\nf 15 == false\n```\n","title":"between","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Ord"],"Ord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}]}]}]},null]}},"sourceSpan":{"start":[203,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[203,53]}},{"children":[],"comments":"The absolute value function. `abs x` is defined as `if x >= zero then x\nelse negate x`.\n","title":"abs","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Ord"],"Ord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Ring"],"Ring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}]},null]}},"sourceSpan":{"start":[211,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[211,43]}},{"children":[],"comments":"The sign function; always evaluates to either `one` or `negate one`. For\nany `x`, we should have `signum x * abs x == x`.\n","title":"signum","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Ord"],"Ord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Ring"],"Ring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}]},null]}},"sourceSpan":{"start":[216,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[216,46]}},{"children":[{"comments":null,"title":"compareRecord","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"ForAll","contents":["rlproxy",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"rlproxy"},{"annotation":[],"tag":"TypeVar","contents":"rowlist"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ordering"],"Ordering"]}]}]}]},null]}},"sourceSpan":{"start":[228,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[228,91]}},{"comments":null,"title":"ordRecordNil","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"OrdRecord"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim","RowList"],"Nil"]}]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}},"sourceSpan":{"start":[230,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[231,27]}},{"comments":null,"title":"ordRecordCons","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Ord"],"OrdRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"rowlistTail"},{"annotation":[],"tag":"TypeVar","contents":"row"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Prim","Row"],"Cons"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"key"},{"annotation":[],"tag":"TypeVar","contents":"focus"},{"annotation":[],"tag":"TypeVar","contents":"rowTail"},{"annotation":[],"tag":"TypeVar","contents":"row"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Symbol"],"IsSymbol"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"key"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Ord"],"Ord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"focus"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"OrdRecord"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim","RowList"],"Cons"]},{"annotation":[],"tag":"TypeVar","contents":"key"}]},{"annotation":[],"tag":"TypeVar","contents":"focus"}]},{"annotation":[],"tag":"TypeVar","contents":"rowlistTail"}]}]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}},"sourceSpan":{"start":[233,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[247,59]}}],"comments":null,"title":"OrdRecord","info":{"fundeps":[],"arguments":[["rowlist",null],["row",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Data","Eq"],"EqRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"rowlist"},{"annotation":[],"tag":"TypeVar","contents":"row"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[227,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[228,91]}}]},{"reExports":[],"name":"Data.Ord.Generic","comments":null,"declarations":[{"children":[{"comments":null,"title":"genericCompare'","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ordering"],"Ordering"]}]}]}},"sourceSpan":{"start":[11,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord/Generic.purs","end":[11,40]}},{"comments":null,"title":"genericOrdNoConstructors","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord","Generic"],"GenericOrd"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"NoConstructors"]}]}},"sourceSpan":{"start":[13,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord/Generic.purs","end":[14,27]}},{"comments":null,"title":"genericOrdNoArguments","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord","Generic"],"GenericOrd"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"NoArguments"]}]}},"sourceSpan":{"start":[16,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord/Generic.purs","end":[17,27]}},{"comments":null,"title":"genericOrdSum","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Ord","Generic"],"GenericOrd"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Ord","Generic"],"GenericOrd"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"b"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord","Generic"],"GenericOrd"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"Sum"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}},"sourceSpan":{"start":[19,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord/Generic.purs","end":[23,39]}},{"comments":null,"title":"genericOrdProduct","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Ord","Generic"],"GenericOrd"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Ord","Generic"],"GenericOrd"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"b"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord","Generic"],"GenericOrd"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"Product"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}},"sourceSpan":{"start":[25,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord/Generic.purs","end":[29,21]}},{"comments":null,"title":"genericOrdConstructor","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Ord","Generic"],"GenericOrd"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord","Generic"],"GenericOrd"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"Constructor"]},{"annotation":[],"tag":"TypeVar","contents":"name"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[31,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord/Generic.purs","end":[32,76]}},{"comments":null,"title":"genericOrdArgument","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Ord"],"Ord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord","Generic"],"GenericOrd"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"Argument"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[34,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord/Generic.purs","end":[35,62]}}],"comments":null,"title":"GenericOrd","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[10,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord/Generic.purs","end":[11,40]}},{"children":[],"comments":"A `Generic` implementation of the `compare` member from the `Ord` type class.\n","title":"genericCompare","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["rep",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Generic","Rep"],"Generic"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"},{"annotation":[],"tag":"TypeVar","contents":"rep"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Ord","Generic"],"GenericOrd"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"rep"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ordering"],"Ordering"]}]}]}]}]},null]},null]}},"sourceSpan":{"start":[38,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord/Generic.purs","end":[38,86]}}]},{"reExports":[],"name":"Data.Ordering","comments":null,"declarations":[{"children":[{"comments":null,"title":"LT","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"GT","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"EQ","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"eqOrdering","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ordering"],"Ordering"]}]}},"sourceSpan":{"start":[15,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ordering.purs","end":[19,19]}},{"comments":null,"title":"semigroupOrdering","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup"],"Semigroup"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ordering"],"Ordering"]}]}},"sourceSpan":{"start":[21,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ordering.purs","end":[24,18]}},{"comments":null,"title":"showOrdering","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ordering"],"Ordering"]}]}},"sourceSpan":{"start":[26,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ordering.purs","end":[29,17]}}],"comments":"The `Ordering` data type represents the three possible outcomes of\ncomparing two values:\n\n`LT` - The first value is _less than_ the second.\n`GT` - The first value is _greater than_ the second.\n`EQ` - The first value is _equal to_ the second.\n","title":"Ordering","info":{"declType":"data","dataDeclType":"data","typeArguments":[]},"sourceSpan":{"start":[13,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ordering.purs","end":[13,29]}},{"children":[],"comments":"Reverses an `Ordering` value, flipping greater than for less than while\npreserving equality.\n","title":"invert","info":{"declType":"value","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ordering"],"Ordering"]}]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ordering"],"Ordering"]}]}},"sourceSpan":{"start":[33,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ordering.purs","end":[33,31]}}]},{"reExports":[{"moduleName":{"package":null,"item":["Data","Semiring"]},"declarations":[{"children":[{"comments":null,"title":"add","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[35,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[35,22]}},{"comments":null,"title":"zero","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeVar","contents":"a"}},"sourceSpan":{"start":[36,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[36,12]}},{"comments":null,"title":"mul","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[37,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[37,22]}},{"comments":null,"title":"one","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeVar","contents":"a"}},"sourceSpan":{"start":[38,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[38,12]}},{"comments":null,"title":"semiringInt","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Int"]}]}},"sourceSpan":{"start":[43,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[47,10]}},{"comments":null,"title":"semiringNumber","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Number"]}]}},"sourceSpan":{"start":[49,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[53,12]}},{"comments":null,"title":"semiringFn","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Semiring"],"Semiring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"b"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}},"sourceSpan":{"start":[55,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[59,18]}},{"comments":null,"title":"semiringUnit","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}},"sourceSpan":{"start":[61,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[65,13]}},{"comments":null,"title":"semiringProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[67,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[71,15]}},{"comments":null,"title":"semiringProxy2","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy2"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[73,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[77,16]}},{"comments":null,"title":"semiringProxy3","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy3"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[79,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[83,16]}},{"comments":null,"title":"semiringRecord","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"list"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Semiring"],"SemiringRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"list"},{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"row"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]}},"sourceSpan":{"start":[85,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[89,63]}}],"comments":"The `Semiring` class is for types that support an addition and\nmultiplication operation.\n\nInstances must satisfy the following laws:\n\n- Commutative monoid under addition:\n - Associativity: `(a + b) + c = a + (b + c)`\n - Identity: `zero + a = a + zero = a`\n - Commutative: `a + b = b + a`\n- Monoid under multiplication:\n - Associativity: `(a * b) * c = a * (b * c)`\n - Identity: `one * a = a * one = a`\n- Multiplication distributes over addition:\n - Left distributivity: `a * (b + c) = (a * b) + (a * c)`\n - Right distributivity: `(a + b) * c = (a * c) + (b * c)`\n- Annihilation: `zero * a = a * zero = zero`\n\n**Note:** The `Number` and `Int` types are not fully law abiding\nmembers of this class hierarchy due to the potential for arithmetic\noverflows, and in the case of `Number`, the presence of `NaN` and\n`Infinity` values. The behaviour is unspecified in these cases.\n","title":"Semiring","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[34,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[38,12]}},{"children":[{"comments":null,"title":"semiringRecordNil","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"SemiringRecord"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim","RowList"],"Nil"]}]},{"annotation":[],"tag":"TypeVar","contents":"row"}]},{"annotation":[],"tag":"REmpty"}]}},"sourceSpan":{"start":[105,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[109,22]}},{"comments":null,"title":"semiringRecordCons","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Symbol"],"IsSymbol"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"key"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Prim","Row"],"Cons"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"key"},{"annotation":[],"tag":"TypeVar","contents":"focus"},{"annotation":[],"tag":"TypeVar","contents":"subrowTail"},{"annotation":[],"tag":"TypeVar","contents":"subrow"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Semiring"],"SemiringRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"rowlistTail"},{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"subrowTail"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Semiring"],"Semiring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"focus"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"SemiringRecord"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim","RowList"],"Cons"]},{"annotation":[],"tag":"TypeVar","contents":"key"}]},{"annotation":[],"tag":"TypeVar","contents":"focus"}]},{"annotation":[],"tag":"TypeVar","contents":"rowlistTail"}]}]},{"annotation":[],"tag":"TypeVar","contents":"row"}]},{"annotation":[],"tag":"TypeVar","contents":"subrow"}]}},"sourceSpan":{"start":[111,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[142,76]}}],"comments":null,"title":"SemiringRecord","info":{"fundeps":[[["rowlist"],["subrow"]]],"arguments":[["rowlist",null],["row",null],["subrow",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[99,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[103,86]}},{"children":[],"comments":null,"title":"(+)","info":{"declType":"alias","alias":[["Data","Semiring"],{"Right":{"Left":{"Ident":"add"}}}],"fixity":{"associativity":"infixl","precedence":6}},"sourceSpan":{"start":[40,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[40,18]}},{"children":[],"comments":null,"title":"(*)","info":{"declType":"alias","alias":[["Data","Semiring"],{"Right":{"Left":{"Ident":"mul"}}}],"fixity":{"associativity":"infixl","precedence":7}},"sourceSpan":{"start":[41,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[41,18]}}]}],"name":"Data.Ring","comments":null,"declarations":[{"children":[{"comments":null,"title":"sub","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[24,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[24,21]}},{"comments":null,"title":"ringInt","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Int"]}]}},"sourceSpan":{"start":[28,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[29,15]}},{"comments":null,"title":"ringNumber","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Number"]}]}},"sourceSpan":{"start":[31,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[32,15]}},{"comments":null,"title":"ringUnit","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}},"sourceSpan":{"start":[34,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[35,17]}},{"comments":null,"title":"ringFn","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Ring"],"Ring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"b"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}},"sourceSpan":{"start":[37,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[38,24]}},{"comments":null,"title":"ringProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[40,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[41,18]}},{"comments":null,"title":"ringProxy2","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy2"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[43,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[44,19]}},{"comments":null,"title":"ringProxy3","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy3"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[46,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[47,19]}},{"comments":null,"title":"ringRecord","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"list"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Ring"],"RingRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"list"},{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"row"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]}},"sourceSpan":{"start":[49,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[50,40]}}],"comments":"The `Ring` class is for types that support addition, multiplication,\nand subtraction operations.\n\nInstances must satisfy the following laws in addition to the `Semiring`\nlaws:\n\n- Additive inverse: `a - a = zero`\n- Compatibility of `sub` and `negate`: `a - b = a + (zero - b)`\n","title":"Ring","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Data","Semiring"],"Semiring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[23,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[24,21]}},{"children":[],"comments":"`negate x` can be used as a shorthand for `zero - x`.\n","title":"negate","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Ring"],"Ring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},null]}},"sourceSpan":{"start":[53,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[53,37]}},{"children":[],"comments":null,"title":"(-)","info":{"declType":"alias","alias":[["Data","Ring"],{"Right":{"Left":{"Ident":"sub"}}}],"fixity":{"associativity":"infixl","precedence":6}},"sourceSpan":{"start":[26,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[26,18]}},{"children":[{"comments":null,"title":"subRecord","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"ForAll","contents":["rlproxy",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"rlproxy"},{"annotation":[],"tag":"TypeVar","contents":"rowlist"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"subrow"}]}]}]}]},null]}},"sourceSpan":{"start":[63,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[63,92]}},{"comments":null,"title":"ringRecordNil","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"RingRecord"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim","RowList"],"Nil"]}]},{"annotation":[],"tag":"TypeVar","contents":"row"}]},{"annotation":[],"tag":"REmpty"}]}},"sourceSpan":{"start":[65,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[66,23]}},{"comments":null,"title":"ringRecordCons","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Symbol"],"IsSymbol"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"key"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Prim","Row"],"Cons"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"key"},{"annotation":[],"tag":"TypeVar","contents":"focus"},{"annotation":[],"tag":"TypeVar","contents":"subrowTail"},{"annotation":[],"tag":"TypeVar","contents":"subrow"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Ring"],"RingRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"rowlistTail"},{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"subrowTail"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Ring"],"Ring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"focus"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"RingRecord"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim","RowList"],"Cons"]},{"annotation":[],"tag":"TypeVar","contents":"key"}]},{"annotation":[],"tag":"TypeVar","contents":"focus"}]},{"annotation":[],"tag":"TypeVar","contents":"rowlistTail"}]}]},{"annotation":[],"tag":"TypeVar","contents":"row"}]},{"annotation":[],"tag":"TypeVar","contents":"subrow"}]}},"sourceSpan":{"start":[68,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[80,58]}}],"comments":null,"title":"RingRecord","info":{"fundeps":[[["rowlist"],["subrow"]]],"arguments":[["rowlist",null],["row",null],["subrow",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Data","Semiring"],"SemiringRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"rowlist"},{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"subrow"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[62,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[63,92]}}]},{"reExports":[],"name":"Data.Ring.Generic","comments":null,"declarations":[{"children":[{"comments":null,"title":"genericSub'","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[8,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring/Generic.purs","end":[8,29]}},{"comments":null,"title":"genericRingNoArguments","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring","Generic"],"GenericRing"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"NoArguments"]}]}},"sourceSpan":{"start":[10,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring/Generic.purs","end":[11,32]}},{"comments":null,"title":"genericRingArgument","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Ring"],"Ring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring","Generic"],"GenericRing"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"Argument"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[13,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring/Generic.purs","end":[14,61]}},{"comments":null,"title":"genericRingProduct","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Ring","Generic"],"GenericRing"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Ring","Generic"],"GenericRing"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"b"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring","Generic"],"GenericRing"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"Product"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}},"sourceSpan":{"start":[16,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring/Generic.purs","end":[17,96]}},{"comments":null,"title":"genericRingConstructor","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Ring","Generic"],"GenericRing"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring","Generic"],"GenericRing"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"Constructor"]},{"annotation":[],"tag":"TypeVar","contents":"name"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[19,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring/Generic.purs","end":[20,82]}}],"comments":null,"title":"GenericRing","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[7,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring/Generic.purs","end":[8,29]}},{"children":[],"comments":"A `Generic` implementation of the `sub` member from the `Ring` type class.\n","title":"genericSub","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["rep",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Generic","Rep"],"Generic"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"},{"annotation":[],"tag":"TypeVar","contents":"rep"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Ring","Generic"],"GenericRing"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"rep"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}]}]},null]},null]}},"sourceSpan":{"start":[23,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring/Generic.purs","end":[23,76]}}]},{"reExports":[],"name":"Data.Semigroup","comments":null,"declarations":[{"children":[{"comments":null,"title":"append","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[32,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup.purs","end":[32,24]}},{"comments":null,"title":"semigroupString","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup"],"Semigroup"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"String"]}]}},"sourceSpan":{"start":[36,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup.purs","end":[37,24]}},{"comments":null,"title":"semigroupUnit","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup"],"Semigroup"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}},"sourceSpan":{"start":[39,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup.purs","end":[40,20]}},{"comments":null,"title":"semigroupVoid","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup"],"Semigroup"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Void"],"Void"]}]}},"sourceSpan":{"start":[42,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup.purs","end":[43,20]}},{"comments":null,"title":"semigroupFn","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Semigroup"],"Semigroup"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"s'"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup"],"Semigroup"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"s"}]},{"annotation":[],"tag":"TypeVar","contents":"s'"}]}]}},"sourceSpan":{"start":[45,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup.purs","end":[46,28]}},{"comments":null,"title":"semigroupArray","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup"],"Semigroup"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Array"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[48,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup.purs","end":[49,23]}},{"comments":null,"title":"semigroupProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup"],"Semigroup"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[51,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup.purs","end":[52,21]}},{"comments":null,"title":"semigroupProxy2","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup"],"Semigroup"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy2"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[54,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup.purs","end":[55,22]}},{"comments":null,"title":"semigroupProxy3","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup"],"Semigroup"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy3"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[57,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup.purs","end":[58,22]}},{"comments":null,"title":"semigroupRecord","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"list"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Semigroup"],"SemigroupRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"list"},{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"row"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup"],"Semigroup"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]}},"sourceSpan":{"start":[60,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup.purs","end":[61,46]}}],"comments":"The `Semigroup` type class identifies an associative operation on a type.\n\nInstances are required to satisfy the following law:\n\n- Associativity: `(x <> y) <> z = x <> (y <> z)`\n\nOne example of a `Semigroup` is `String`, with `(<>)` defined as string\nconcatenation. Another example is `List a`, with `(<>)` defined as\nlist concatenation.\n\n### Newtypes for Semigroup\n\nThere are two other ways to implement an instance for this type class\nregardless of which type is used. These instances can be used by\nwrapping the values in one of the two newtypes below:\n1. `First` - Use the first argument every time: `append first _ = first`.\n2. `Last` - Use the last argument every time: `append _ last = last`.\n","title":"Semigroup","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[31,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup.purs","end":[32,24]}},{"children":[],"comments":null,"title":"(<>)","info":{"declType":"alias","alias":[["Data","Semigroup"],{"Right":{"Left":{"Ident":"append"}}}],"fixity":{"associativity":"infixr","precedence":5}},"sourceSpan":{"start":[34,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup.purs","end":[34,22]}},{"children":[{"comments":null,"title":"appendRecord","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"ForAll","contents":["rlproxy",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"rlproxy"},{"annotation":[],"tag":"TypeVar","contents":"rowlist"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"subrow"}]}]}]}]},null]}},"sourceSpan":{"start":[70,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup.purs","end":[70,95]}},{"comments":null,"title":"semigroupRecordNil","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup"],"SemigroupRecord"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim","RowList"],"Nil"]}]},{"annotation":[],"tag":"TypeVar","contents":"row"}]},{"annotation":[],"tag":"REmpty"}]}},"sourceSpan":{"start":[72,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup.purs","end":[73,26]}},{"comments":null,"title":"semigroupRecordCons","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Symbol"],"IsSymbol"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"key"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Prim","Row"],"Cons"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"key"},{"annotation":[],"tag":"TypeVar","contents":"focus"},{"annotation":[],"tag":"TypeVar","contents":"subrowTail"},{"annotation":[],"tag":"TypeVar","contents":"subrow"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Semigroup"],"SemigroupRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"rowlistTail"},{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"subrowTail"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Semigroup"],"Semigroup"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"focus"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup"],"SemigroupRecord"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim","RowList"],"Cons"]},{"annotation":[],"tag":"TypeVar","contents":"key"}]},{"annotation":[],"tag":"TypeVar","contents":"focus"}]},{"annotation":[],"tag":"TypeVar","contents":"rowlistTail"}]}]},{"annotation":[],"tag":"TypeVar","contents":"row"}]},{"annotation":[],"tag":"TypeVar","contents":"subrow"}]}},"sourceSpan":{"start":[75,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup.purs","end":[87,61]}}],"comments":null,"title":"SemigroupRecord","info":{"fundeps":[[["rowlist"],["subrow"]]],"arguments":[["rowlist",null],["row",null],["subrow",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[69,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup.purs","end":[70,95]}}]},{"reExports":[],"name":"Data.Semigroup.First","comments":null,"declarations":[{"children":[{"comments":null,"title":"First","info":{"arguments":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"eqFirst","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Eq"],"Eq"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup","First"],"First"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[15,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup/First.purs","end":[15,56]}},{"comments":null,"title":"eq1First","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq1"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup","First"],"First"]}]}},"sourceSpan":{"start":[16,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup/First.purs","end":[16,38]}},{"comments":null,"title":"ordFirst","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Ord"],"Ord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup","First"],"First"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[18,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup/First.purs","end":[18,59]}},{"comments":null,"title":"ord1First","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord1"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup","First"],"First"]}]}},"sourceSpan":{"start":[19,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup/First.purs","end":[19,40]}},{"comments":null,"title":"boundedFirst","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Bounded"],"Bounded"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Bounded"],"Bounded"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup","First"],"First"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[21,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup/First.purs","end":[21,71]}},{"comments":null,"title":"showFirst","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Show"],"Show"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup","First"],"First"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[23,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup/First.purs","end":[24,46]}},{"comments":null,"title":"functorFirst","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Functor"],"Functor"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup","First"],"First"]}]}},"sourceSpan":{"start":[26,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup/First.purs","end":[26,46]}},{"comments":null,"title":"applyFirst","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Apply"],"Apply"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup","First"],"First"]}]}},"sourceSpan":{"start":[28,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup/First.purs","end":[29,42]}},{"comments":null,"title":"applicativeFirst","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Applicative"],"Applicative"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup","First"],"First"]}]}},"sourceSpan":{"start":[31,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup/First.purs","end":[32,15]}},{"comments":null,"title":"bindFirst","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Bind"],"Bind"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup","First"],"First"]}]}},"sourceSpan":{"start":[34,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup/First.purs","end":[35,25]}},{"comments":null,"title":"monadFirst","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Monad"],"Monad"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup","First"],"First"]}]}},"sourceSpan":{"start":[37,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup/First.purs","end":[37,35]}},{"comments":null,"title":"semigroupFirst","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup"],"Semigroup"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup","First"],"First"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[39,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup/First.purs","end":[40,17]}}],"comments":"Semigroup where `append` always takes the first option.\n\n``` purescript\nFirst x <> First y == First x\n```\n","title":"First","info":{"declType":"data","dataDeclType":"newtype","typeArguments":[["a",null]]},"sourceSpan":{"start":[13,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup/First.purs","end":[13,26]}}]},{"reExports":[],"name":"Data.Semigroup.Generic","comments":null,"declarations":[{"children":[{"comments":null,"title":"genericAppend'","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[11,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup/Generic.purs","end":[11,32]}},{"comments":null,"title":"genericSemigroupNoConstructors","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup","Generic"],"GenericSemigroup"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"NoConstructors"]}]}},"sourceSpan":{"start":[13,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup/Generic.purs","end":[14,25]}},{"comments":null,"title":"genericSemigroupNoArguments","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup","Generic"],"GenericSemigroup"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"NoArguments"]}]}},"sourceSpan":{"start":[16,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup/Generic.purs","end":[17,25]}},{"comments":null,"title":"genericSemigroupProduct","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Semigroup","Generic"],"GenericSemigroup"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Semigroup","Generic"],"GenericSemigroup"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"b"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup","Generic"],"GenericSemigroup"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"Product"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}},"sourceSpan":{"start":[19,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup/Generic.purs","end":[21,58]}},{"comments":null,"title":"genericSemigroupConstructor","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Semigroup","Generic"],"GenericSemigroup"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup","Generic"],"GenericSemigroup"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"Constructor"]},{"annotation":[],"tag":"TypeVar","contents":"name"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[23,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup/Generic.purs","end":[24,88]}},{"comments":null,"title":"genericSemigroupArgument","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Semigroup"],"Semigroup"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup","Generic"],"GenericSemigroup"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"Argument"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[26,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup/Generic.purs","end":[27,71]}}],"comments":null,"title":"GenericSemigroup","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[10,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup/Generic.purs","end":[11,32]}},{"children":[],"comments":"A `Generic` implementation of the `append` member from the `Semigroup` type class.\n","title":"genericAppend","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["rep",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Generic","Rep"],"Generic"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"},{"annotation":[],"tag":"TypeVar","contents":"rep"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Semigroup","Generic"],"GenericSemigroup"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"rep"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}]}]},null]},null]}},"sourceSpan":{"start":[30,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup/Generic.purs","end":[30,84]}}]},{"reExports":[],"name":"Data.Semigroup.Last","comments":null,"declarations":[{"children":[{"comments":null,"title":"Last","info":{"arguments":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"eqLast","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Eq"],"Eq"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup","Last"],"Last"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[15,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup/Last.purs","end":[15,54]}},{"comments":null,"title":"eq1Last","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq1"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup","Last"],"Last"]}]}},"sourceSpan":{"start":[16,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup/Last.purs","end":[16,36]}},{"comments":null,"title":"ordLast","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Ord"],"Ord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup","Last"],"Last"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[18,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup/Last.purs","end":[18,57]}},{"comments":null,"title":"ord1Last","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord1"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup","Last"],"Last"]}]}},"sourceSpan":{"start":[19,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup/Last.purs","end":[19,38]}},{"comments":null,"title":"boundedLast","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Bounded"],"Bounded"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Bounded"],"Bounded"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup","Last"],"Last"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[21,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup/Last.purs","end":[21,69]}},{"comments":null,"title":"showLast","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Show"],"Show"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup","Last"],"Last"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[23,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup/Last.purs","end":[24,44]}},{"comments":null,"title":"functorLast","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Functor"],"Functor"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup","Last"],"Last"]}]}},"sourceSpan":{"start":[26,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup/Last.purs","end":[26,44]}},{"comments":null,"title":"applyLast","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Apply"],"Apply"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup","Last"],"Last"]}]}},"sourceSpan":{"start":[28,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup/Last.purs","end":[29,39]}},{"comments":null,"title":"applicativeLast","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Applicative"],"Applicative"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup","Last"],"Last"]}]}},"sourceSpan":{"start":[31,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup/Last.purs","end":[32,14]}},{"comments":null,"title":"bindLast","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Bind"],"Bind"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup","Last"],"Last"]}]}},"sourceSpan":{"start":[34,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup/Last.purs","end":[35,24]}},{"comments":null,"title":"monadLast","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Monad"],"Monad"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup","Last"],"Last"]}]}},"sourceSpan":{"start":[37,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup/Last.purs","end":[37,33]}},{"comments":null,"title":"semigroupLast","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup"],"Semigroup"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup","Last"],"Last"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[39,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup/Last.purs","end":[40,17]}}],"comments":"Semigroup where `append` always takes the second option.\n\n``` purescript\nLast x <> Last y == Last y\n```\n","title":"Last","info":{"declType":"data","dataDeclType":"newtype","typeArguments":[["a",null]]},"sourceSpan":{"start":[13,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup/Last.purs","end":[13,24]}}]},{"reExports":[],"name":"Data.Semiring","comments":null,"declarations":[{"children":[{"comments":null,"title":"add","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[35,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[35,22]}},{"comments":null,"title":"zero","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeVar","contents":"a"}},"sourceSpan":{"start":[36,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[36,12]}},{"comments":null,"title":"mul","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[37,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[37,22]}},{"comments":null,"title":"one","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeVar","contents":"a"}},"sourceSpan":{"start":[38,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[38,12]}},{"comments":null,"title":"semiringInt","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Int"]}]}},"sourceSpan":{"start":[43,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[47,10]}},{"comments":null,"title":"semiringNumber","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Number"]}]}},"sourceSpan":{"start":[49,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[53,12]}},{"comments":null,"title":"semiringFn","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Semiring"],"Semiring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"b"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}},"sourceSpan":{"start":[55,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[59,18]}},{"comments":null,"title":"semiringUnit","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}},"sourceSpan":{"start":[61,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[65,13]}},{"comments":null,"title":"semiringProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[67,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[71,15]}},{"comments":null,"title":"semiringProxy2","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy2"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[73,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[77,16]}},{"comments":null,"title":"semiringProxy3","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy3"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[79,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[83,16]}},{"comments":null,"title":"semiringRecord","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"list"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Semiring"],"SemiringRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"list"},{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"row"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]}},"sourceSpan":{"start":[85,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[89,63]}}],"comments":"The `Semiring` class is for types that support an addition and\nmultiplication operation.\n\nInstances must satisfy the following laws:\n\n- Commutative monoid under addition:\n - Associativity: `(a + b) + c = a + (b + c)`\n - Identity: `zero + a = a + zero = a`\n - Commutative: `a + b = b + a`\n- Monoid under multiplication:\n - Associativity: `(a * b) * c = a * (b * c)`\n - Identity: `one * a = a * one = a`\n- Multiplication distributes over addition:\n - Left distributivity: `a * (b + c) = (a * b) + (a * c)`\n - Right distributivity: `(a + b) * c = (a * c) + (b * c)`\n- Annihilation: `zero * a = a * zero = zero`\n\n**Note:** The `Number` and `Int` types are not fully law abiding\nmembers of this class hierarchy due to the potential for arithmetic\noverflows, and in the case of `Number`, the presence of `NaN` and\n`Infinity` values. The behaviour is unspecified in these cases.\n","title":"Semiring","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[34,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[38,12]}},{"children":[],"comments":null,"title":"(+)","info":{"declType":"alias","alias":[["Data","Semiring"],{"Right":{"Left":{"Ident":"add"}}}],"fixity":{"associativity":"infixl","precedence":6}},"sourceSpan":{"start":[40,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[40,18]}},{"children":[],"comments":null,"title":"(*)","info":{"declType":"alias","alias":[["Data","Semiring"],{"Right":{"Left":{"Ident":"mul"}}}],"fixity":{"associativity":"infixl","precedence":7}},"sourceSpan":{"start":[41,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[41,18]}},{"children":[{"comments":null,"title":"addRecord","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"ForAll","contents":["rlproxy",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"rlproxy"},{"annotation":[],"tag":"TypeVar","contents":"rowlist"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"subrow"}]}]}]}]},null]}},"sourceSpan":{"start":[100,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[100,92]}},{"comments":null,"title":"mulRecord","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"ForAll","contents":["rlproxy",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"rlproxy"},{"annotation":[],"tag":"TypeVar","contents":"rowlist"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"subrow"}]}]}]}]},null]}},"sourceSpan":{"start":[101,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[101,92]}},{"comments":null,"title":"oneRecord","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"ForAll","contents":["rlproxy",{"annotation":[],"tag":"ForAll","contents":["rproxy",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"rlproxy"},{"annotation":[],"tag":"TypeVar","contents":"rowlist"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"rproxy"},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"subrow"}]}]}]},null]},null]}},"sourceSpan":{"start":[102,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[102,85]}},{"comments":null,"title":"zeroRecord","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"ForAll","contents":["rlproxy",{"annotation":[],"tag":"ForAll","contents":["rproxy",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"rlproxy"},{"annotation":[],"tag":"TypeVar","contents":"rowlist"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"rproxy"},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"subrow"}]}]}]},null]},null]}},"sourceSpan":{"start":[103,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[103,86]}},{"comments":null,"title":"semiringRecordNil","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"SemiringRecord"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim","RowList"],"Nil"]}]},{"annotation":[],"tag":"TypeVar","contents":"row"}]},{"annotation":[],"tag":"REmpty"}]}},"sourceSpan":{"start":[105,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[109,22]}},{"comments":null,"title":"semiringRecordCons","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Symbol"],"IsSymbol"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"key"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Prim","Row"],"Cons"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"key"},{"annotation":[],"tag":"TypeVar","contents":"focus"},{"annotation":[],"tag":"TypeVar","contents":"subrowTail"},{"annotation":[],"tag":"TypeVar","contents":"subrow"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Semiring"],"SemiringRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"rowlistTail"},{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"subrowTail"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Semiring"],"Semiring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"focus"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"SemiringRecord"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim","RowList"],"Cons"]},{"annotation":[],"tag":"TypeVar","contents":"key"}]},{"annotation":[],"tag":"TypeVar","contents":"focus"}]},{"annotation":[],"tag":"TypeVar","contents":"rowlistTail"}]}]},{"annotation":[],"tag":"TypeVar","contents":"row"}]},{"annotation":[],"tag":"TypeVar","contents":"subrow"}]}},"sourceSpan":{"start":[111,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[142,76]}}],"comments":null,"title":"SemiringRecord","info":{"fundeps":[[["rowlist"],["subrow"]]],"arguments":[["rowlist",null],["row",null],["subrow",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[99,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[103,86]}}]},{"reExports":[],"name":"Data.Semiring.Generic","comments":null,"declarations":[{"children":[{"comments":null,"title":"genericAdd'","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[8,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring/Generic.purs","end":[8,30]}},{"comments":null,"title":"genericZero'","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeVar","contents":"a"}},"sourceSpan":{"start":[9,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring/Generic.purs","end":[9,20]}},{"comments":null,"title":"genericMul'","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[10,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring/Generic.purs","end":[10,30]}},{"comments":null,"title":"genericOne'","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeVar","contents":"a"}},"sourceSpan":{"start":[11,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring/Generic.purs","end":[11,20]}},{"comments":null,"title":"genericSemiringNoArguments","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring","Generic"],"GenericSemiring"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"NoArguments"]}]}},"sourceSpan":{"start":[13,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring/Generic.purs","end":[17,28]}},{"comments":null,"title":"genericSemiringArgument","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Semiring"],"Semiring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring","Generic"],"GenericSemiring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"Argument"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[19,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring/Generic.purs","end":[23,29]}},{"comments":null,"title":"genericSemiringProduct","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Semiring","Generic"],"GenericSemiring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Semiring","Generic"],"GenericSemiring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"b"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring","Generic"],"GenericSemiring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"Product"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}},"sourceSpan":{"start":[25,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring/Generic.purs","end":[29,48]}},{"comments":null,"title":"genericSemiringConstructor","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Semiring","Generic"],"GenericSemiring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring","Generic"],"GenericSemiring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"Constructor"]},{"annotation":[],"tag":"TypeVar","contents":"name"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[31,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring/Generic.purs","end":[35,40]}}],"comments":null,"title":"GenericSemiring","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[7,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring/Generic.purs","end":[11,20]}},{"children":[],"comments":"A `Generic` implementation of the `zero` member from the `Semiring` type class.\n","title":"genericZero","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["rep",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Generic","Rep"],"Generic"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"},{"annotation":[],"tag":"TypeVar","contents":"rep"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Semiring","Generic"],"GenericSemiring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"rep"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},null]},null]}},"sourceSpan":{"start":[38,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring/Generic.purs","end":[38,71]}},{"children":[],"comments":"A `Generic` implementation of the `one` member from the `Semiring` type class.\n","title":"genericOne","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["rep",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Generic","Rep"],"Generic"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"},{"annotation":[],"tag":"TypeVar","contents":"rep"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Semiring","Generic"],"GenericSemiring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"rep"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},null]},null]}},"sourceSpan":{"start":[42,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring/Generic.purs","end":[42,70]}},{"children":[],"comments":"A `Generic` implementation of the `add` member from the `Semiring` type class.\n","title":"genericAdd","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["rep",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Generic","Rep"],"Generic"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"},{"annotation":[],"tag":"TypeVar","contents":"rep"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Semiring","Generic"],"GenericSemiring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"rep"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}]}]},null]},null]}},"sourceSpan":{"start":[46,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring/Generic.purs","end":[46,80]}},{"children":[],"comments":"A `Generic` implementation of the `mul` member from the `Semiring` type class.\n","title":"genericMul","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["rep",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Generic","Rep"],"Generic"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"},{"annotation":[],"tag":"TypeVar","contents":"rep"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Semiring","Generic"],"GenericSemiring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"rep"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}]}]},null]},null]}},"sourceSpan":{"start":[50,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring/Generic.purs","end":[50,80]}}]},{"reExports":[],"name":"Data.Show","comments":null,"declarations":[{"children":[{"comments":null,"title":"show","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"String"]}]}},"sourceSpan":{"start":[18,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Show.purs","end":[18,22]}},{"comments":null,"title":"showBoolean","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}},"sourceSpan":{"start":[20,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Show.purs","end":[22,23]}},{"comments":null,"title":"showInt","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Int"]}]}},"sourceSpan":{"start":[24,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Show.purs","end":[25,21]}},{"comments":null,"title":"showNumber","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Number"]}]}},"sourceSpan":{"start":[27,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Show.purs","end":[28,24]}},{"comments":null,"title":"showChar","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Char"]}]}},"sourceSpan":{"start":[30,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Show.purs","end":[31,22]}},{"comments":null,"title":"showString","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"String"]}]}},"sourceSpan":{"start":[33,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Show.purs","end":[34,24]}},{"comments":null,"title":"showArray","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Show"],"Show"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Array"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[36,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Show.purs","end":[37,28]}},{"comments":null,"title":"showProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[39,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Show.purs","end":[40,19]}},{"comments":null,"title":"showProxy2","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy2"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[42,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Show.purs","end":[43,20]}},{"comments":null,"title":"showProxy3","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy3"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[45,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Show.purs","end":[46,20]}},{"comments":null,"title":"showRecord","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"rs"},{"annotation":[],"tag":"TypeVar","contents":"ls"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Show"],"ShowRecordFields"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"ls"},{"annotation":[],"tag":"TypeVar","contents":"rs"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"rs"}]}]}},"sourceSpan":{"start":[48,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Show.purs","end":[51,52]}}],"comments":"The `Show` type class represents those types which can be converted into\na human-readable `String` representation.\n\nWhile not required, it is recommended that for any expression `x`, the\nstring `show x` be executable PureScript code which evaluates to the same\nvalue as the expression `x`.\n","title":"Show","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[17,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Show.purs","end":[18,22]}},{"children":[{"comments":null,"title":"showRecordFields","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"ForAll","contents":["rlproxy",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"rlproxy"},{"annotation":[],"tag":"TypeVar","contents":"rowlist"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Array"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"String"]}]}]}]},null]}},"sourceSpan":{"start":[57,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Show.purs","end":[57,84]}},{"comments":null,"title":"showRecordFieldsNil","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show"],"ShowRecordFields"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim","RowList"],"Nil"]}]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}},"sourceSpan":{"start":[59,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Show.purs","end":[60,28]}},{"comments":null,"title":"showRecordFieldsCons","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Symbol"],"IsSymbol"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"key"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Show"],"ShowRecordFields"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"rowlistTail"},{"annotation":[],"tag":"TypeVar","contents":"row"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Show"],"Show"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"focus"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show"],"ShowRecordFields"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim","RowList"],"Cons"]},{"annotation":[],"tag":"TypeVar","contents":"key"}]},{"annotation":[],"tag":"TypeVar","contents":"focus"}]},{"annotation":[],"tag":"TypeVar","contents":"rowlistTail"}]}]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}},"sourceSpan":{"start":[62,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Show.purs","end":[73,66]}}],"comments":null,"title":"ShowRecordFields","info":{"fundeps":[],"arguments":[["rowlist",null],["row",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[56,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Show.purs","end":[57,84]}}]},{"reExports":[],"name":"Data.Show.Generic","comments":null,"declarations":[{"children":[{"comments":null,"title":"genericShow'","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"String"]}]}},"sourceSpan":{"start":[15,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Show/Generic.purs","end":[15,30]}},{"comments":null,"title":"genericShowNoConstructors","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show","Generic"],"GenericShow"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"NoConstructors"]}]}},"sourceSpan":{"start":[20,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Show/Generic.purs","end":[21,34]}},{"comments":null,"title":"genericShowSum","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Show","Generic"],"GenericShow"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Show","Generic"],"GenericShow"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"b"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show","Generic"],"GenericShow"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"Sum"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}},"sourceSpan":{"start":[26,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Show/Generic.purs","end":[28,40]}},{"comments":null,"title":"genericShowConstructor","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Show","Generic"],"GenericShowArgs"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Symbol"],"IsSymbol"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"name"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show","Generic"],"GenericShow"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"Constructor"]},{"annotation":[],"tag":"TypeVar","contents":"name"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[35,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Show/Generic.purs","end":[44,49]}}],"comments":null,"title":"GenericShow","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[14,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Show/Generic.purs","end":[15,30]}},{"children":[],"comments":"A `Generic` implementation of the `show` member from the `Show` type class.\n","title":"genericShow","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["rep",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Generic","Rep"],"Generic"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"},{"annotation":[],"tag":"TypeVar","contents":"rep"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Show","Generic"],"GenericShow"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"rep"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"String"]}]}]}]},null]},null]}},"sourceSpan":{"start":[50,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Show/Generic.purs","end":[50,77]}},{"children":[{"comments":null,"title":"genericShowArgs","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Array"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"String"]}]}]}},"sourceSpan":{"start":[18,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Show/Generic.purs","end":[18,39]}},{"comments":null,"title":"genericShowArgsNoArguments","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show","Generic"],"GenericShowArgs"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"NoArguments"]}]}},"sourceSpan":{"start":[23,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Show/Generic.purs","end":[24,25]}},{"comments":null,"title":"genericShowArgsProduct","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Show","Generic"],"GenericShowArgs"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Show","Generic"],"GenericShowArgs"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"b"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show","Generic"],"GenericShowArgs"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"Product"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}},"sourceSpan":{"start":[30,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Show/Generic.purs","end":[33,73]}},{"comments":null,"title":"genericShowArgsArgument","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Show"],"Show"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show","Generic"],"GenericShowArgs"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Generic","Rep"],"Argument"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[46,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Show/Generic.purs","end":[47,42]}}],"comments":null,"title":"GenericShowArgs","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[17,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Show/Generic.purs","end":[18,39]}}]},{"reExports":[],"name":"Data.Symbol","comments":null,"declarations":[{"children":[{"comments":null,"title":"reflectSymbol","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"ForAll","contents":["proxy",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"proxy"},{"annotation":[],"tag":"TypeVar","contents":"sym"}]}]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"String"]}]},null]}},"sourceSpan":{"start":[24,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Symbol.purs","end":[24,53]}}],"comments":"A class for known symbols\n","title":"IsSymbol","info":{"fundeps":[],"arguments":[["sym",{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Symbol"]}]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[16,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Symbol.purs","end":[24,53]}},{"children":[],"comments":null,"title":"reifySymbol","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["proxy",{"annotation":[],"tag":"ForAll","contents":["r",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"String"]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"ForAll","contents":["sym",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Symbol"],"IsSymbol"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"sym"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"proxy"},{"annotation":[],"tag":"TypeVar","contents":"sym"}]}]},{"annotation":[],"tag":"TypeVar","contents":"r"}]}]},null]}}]},{"annotation":[],"tag":"TypeVar","contents":"r"}]}]},null]},null]}},"sourceSpan":{"start":[29,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Symbol.purs","end":[29,91]}},{"children":[{"comments":null,"title":"SProxy","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null}],"comments":null,"title":"SProxy","info":{"declType":"data","dataDeclType":"data","typeArguments":[["sym",null]]},"sourceSpan":{"start":[13,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Symbol.purs","end":[13,25]}}]},{"reExports":[],"name":"Data.Unit","comments":null,"declarations":[{"children":[{"comments":null,"title":"showUnit","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}},"sourceSpan":{"start":[18,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Unit.purs","end":[19,18]}}],"comments":"The `Unit` type has a single inhabitant, called `unit`. It represents\nvalues with no computational content.\n\n`Unit` is often used, wrapped in a monadic type constructor, as the\nreturn type of a computation where only the _effects_ are important.\n\nWhen returning a value of type `Unit` from an FFI function, it is\nrecommended to use `undefined`, or not return a value at all.\n","title":"Unit","info":{"kind":{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Type"]},"declType":"externData"},"sourceSpan":{"start":[13,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Unit.purs","end":[13,33]}},{"children":[],"comments":"`unit` is the sole inhabitant of the `Unit` type.\n","title":"unit","info":{"declType":"value","type":{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}},"sourceSpan":{"start":[16,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Unit.purs","end":[16,28]}}]},{"reExports":[],"name":"Data.Void","comments":null,"declarations":[{"children":[{"comments":null,"title":"showVoid","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Void"],"Void"]}]}},"sourceSpan":{"start":[24,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Void.purs","end":[25,16]}}],"comments":"An uninhabited data type. In other words, one can never create\na runtime value of type `Void` becaue no such value exists.\n\n`Void` is useful to eliminate the possibility of a value being created.\nFor example, a value of type `Either Void Boolean` can never have\na Left value created in PureScript.\n\nThis should not be confused with the keyword `void` that commonly appears in\nC-family languages, such as Java:\n```\npublic class Foo {\n void doSomething() { System.out.println(\"hello world!\"); }\n}\n```\n\nIn PureScript, one often uses `Unit` to achieve similar effects as\nthe `void` of C-family languages above.\n","title":"Void","info":{"declType":"data","dataDeclType":"newtype","typeArguments":[]},"sourceSpan":{"start":[22,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Void.purs","end":[22,25]}},{"children":[],"comments":"Eliminator for the `Void` type.\nUseful for stating that some code branch is impossible because you've\n\"acquired\" a value of type `Void` (which you can't).\n\n```purescript\nrightOnly :: forall t . Either Void t -> t\nrightOnly (Left v) = absurd v\nrightOnly (Right t) = t\n```\n","title":"absurd","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Void"],"Void"]}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},null]}},"sourceSpan":{"start":[36,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Void.purs","end":[36,30]}}]},{"reExports":[{"moduleName":{"package":null,"item":["Control","Applicative"]},"declarations":[{"children":[{"comments":null,"title":"pure","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},null]}},"sourceSpan":{"start":[34,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Applicative.purs","end":[34,29]}},{"comments":null,"title":"applicativeFn","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Applicative"],"Applicative"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"r"}]}]}},"sourceSpan":{"start":[36,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Applicative.purs","end":[37,15]}},{"comments":null,"title":"applicativeArray","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Applicative"],"Applicative"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Array"]}]}},"sourceSpan":{"start":[39,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Applicative.purs","end":[40,15]}},{"comments":null,"title":"applicativeProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Applicative"],"Applicative"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]}]}},"sourceSpan":{"start":[42,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Applicative.purs","end":[43,17]}}],"comments":"The `Applicative` type class extends the [`Apply`](#apply) type class\nwith a `pure` function, which can be used to create values of type `f a`\nfrom values of type `a`.\n\nWhere [`Apply`](#apply) provides the ability to lift functions of two or\nmore arguments to functions whose arguments are wrapped using `f`, and\n[`Functor`](#functor) provides the ability to lift functions of one\nargument, `pure` can be seen as the function which lifts functions of\n_zero_ arguments. That is, `Applicative` functors support a lifting\noperation for any number of function arguments.\n\nInstances must satisfy the following laws in addition to the `Apply`\nlaws:\n\n- Identity: `(pure identity) <*> v = v`\n- Composition: `pure (<<<) <*> f <*> g <*> h = f <*> (g <*> h)`\n- Homomorphism: `(pure f) <*> (pure x) = pure (f x)`\n- Interchange: `u <*> (pure y) = (pure (_ $ y)) <*> u`\n","title":"Applicative","info":{"fundeps":[],"arguments":[["f",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Control","Apply"],"Apply"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"f"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[33,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Applicative.purs","end":[34,29]}},{"children":[],"comments":"Perform an applicative action when a condition is true.\n","title":"when","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["m",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Control","Applicative"],"Applicative"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"m"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}]}]}]},null]}},"sourceSpan":{"start":[61,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Applicative.purs","end":[61,63]}},{"children":[],"comments":"Perform an applicative action unless a condition is true.\n","title":"unless","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["m",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Control","Applicative"],"Applicative"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"m"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}]}]}]},null]}},"sourceSpan":{"start":[66,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Applicative.purs","end":[66,65]}},{"children":[],"comments":"`liftA1` provides a default implementation of `(<$>)` for any\n[`Applicative`](#applicative) functor, without using `(<$>)` as provided\nby the [`Functor`](#functor)-[`Applicative`](#applicative) superclass\nrelationship.\n\n`liftA1` can therefore be used to write [`Functor`](#functor) instances\nas follows:\n\n```purescript\ninstance functorF :: Functor F where\n map = liftA1\n```\n","title":"liftA1","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["f",{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Control","Applicative"],"Applicative"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"f"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}]}]},null]},null]},null]}},"sourceSpan":{"start":[57,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Applicative.purs","end":[57,64]}}]},{"moduleName":{"package":null,"item":["Control","Apply"]},"declarations":[{"children":[{"comments":null,"title":"apply","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}]},null]},null]}},"sourceSpan":{"start":[46,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Apply.purs","end":[46,48]}},{"comments":null,"title":"applyFn","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Apply"],"Apply"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"r"}]}]}},"sourceSpan":{"start":[50,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Apply.purs","end":[51,26]}},{"comments":null,"title":"applyArray","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Apply"],"Apply"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Array"]}]}},"sourceSpan":{"start":[53,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Apply.purs","end":[54,21]}},{"comments":null,"title":"applyProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Apply"],"Apply"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]}]}},"sourceSpan":{"start":[58,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Apply.purs","end":[59,20]}}],"comments":"The `Apply` class provides the `(<*>)` which is used to apply a function\nto an argument under a type constructor.\n\n`Apply` can be used to lift functions of two or more arguments to work on\nvalues wrapped with the type constructor `f`. It might also be understood\nin terms of the `lift2` function:\n\n```purescript\nlift2 :: forall f a b c. Apply f => (a -> b -> c) -> f a -> f b -> f c\nlift2 f a b = f <$> a <*> b\n```\n\n`(<*>)` is recovered from `lift2` as `lift2 ($)`. That is, `(<*>)` lifts\nthe function application operator `($)` to arguments wrapped with the\ntype constructor `f`.\n\nPut differently...\n```\nfoo =\n functionTakingNArguments <$> computationProducingArg1\n <*> computationProducingArg2\n <*> ...\n <*> computationProducingArgN\n```\n\nInstances must satisfy the following law in addition to the `Functor`\nlaws:\n\n- Associative composition: `(<<<) <$> f <*> g <*> h = f <*> (g <*> h)`\n\nFormally, `Apply` represents a strong lax semi-monoidal endofunctor.\n","title":"Apply","info":{"fundeps":[],"arguments":[["f",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Data","Functor"],"Functor"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"f"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[45,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Apply.purs","end":[46,48]}},{"children":[],"comments":null,"title":"(<*>)","info":{"declType":"alias","alias":[["Control","Apply"],{"Right":{"Left":{"Ident":"apply"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[48,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Apply.purs","end":[48,22]}},{"children":[],"comments":null,"title":"(<*)","info":{"declType":"alias","alias":[["Control","Apply"],{"Right":{"Left":{"Ident":"applyFirst"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[65,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Apply.purs","end":[65,26]}},{"children":[],"comments":null,"title":"(*>)","info":{"declType":"alias","alias":[["Control","Apply"],{"Right":{"Left":{"Ident":"applySecond"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[71,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Apply.purs","end":[71,27]}}]},{"moduleName":{"package":null,"item":["Control","Bind"]},"declarations":[{"children":[{"comments":null,"title":"bind","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}]},null]},null]}},"sourceSpan":{"start":[51,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[51,47]}},{"comments":null,"title":"bindFn","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Bind"],"Bind"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"r"}]}]}},"sourceSpan":{"start":[65,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[66,25]}},{"comments":"The `bind`/`>>=` function for `Array` works by applying a function to\neach element in the array, and flattening the results into a single,\nnew array.\n\nArray's `bind`/`>>=` works like a nested for loop. Each `bind` adds\nanother level of nesting in the loop. For example:\n```\nfoo :: Array String\nfoo =\n [\"a\", \"b\"] >>= \\eachElementInArray1 ->\n [\"c\", \"d\"] >>= \\eachElementInArray2\n pure (eachElementInArray1 <> eachElementInArray2)\n\n-- In other words...\nfoo\n-- ... is the same as...\n[ (\"a\" <> \"c\"), (\"a\" <> \"d\"), (\"b\" <> \"c\"), (\"b\" <> \"d\") ]\n-- which simplifies to...\n[ \"ac\", \"ad\", \"bc\", \"bd\" ]\n```\n","title":"bindArray","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Bind"],"Bind"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Array"]}]}},"sourceSpan":{"start":[88,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[89,19]}},{"comments":null,"title":"bindProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Bind"],"Bind"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]}]}},"sourceSpan":{"start":[93,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[94,19]}}],"comments":"The `Bind` type class extends the [`Apply`](#apply) type class with a\n\"bind\" operation `(>>=)` which composes computations in sequence, using\nthe return value of one computation to determine the next computation.\n\nThe `>>=` operator can also be expressed using `do` notation, as follows:\n\n```purescript\nx >>= f = do y <- x\n f y\n```\n\nwhere the function argument of `f` is given the name `y`.\n\nInstances must satisfy the following laws in addition to the `Apply`\nlaws:\n\n- Associativity: `(x >>= f) >>= g = x >>= (\\k -> f k >>= g)`\n- Apply Superclass: `apply f x = f >>= \\f’ -> map f’ x`\n\nAssociativity tells us that we can regroup operations which use `do`\nnotation so that we can unambiguously write, for example:\n\n```purescript\ndo x <- m1\n y <- m2 x\n m3 x y\n```\n","title":"Bind","info":{"fundeps":[],"arguments":[["m",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Control","Apply"],"Apply"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"m"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[50,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[51,47]}},{"children":[{"comments":null,"title":"discard","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"ForAll","contents":["f",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Control","Bind"],"Bind"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"f"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}]}]},null]},null]}},"sourceSpan":{"start":[102,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[102,60]}},{"comments":null,"title":"discardUnit","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Bind"],"Discard"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}},"sourceSpan":{"start":[104,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[105,17]}},{"comments":null,"title":"discardProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Bind"],"Discard"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[107,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[108,17]}},{"comments":null,"title":"discardProxy2","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Bind"],"Discard"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy2"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[110,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[111,17]}},{"comments":null,"title":"discardProxy3","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Bind"],"Discard"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy3"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[113,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[114,17]}}],"comments":"A class for types whose values can safely be discarded\nin a `do` notation block.\n\nAn example is the `Unit` type, since there is only one\npossible value which can be returned.\n","title":"Discard","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[101,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[102,60]}},{"children":[],"comments":"Collapse two applications of a monadic type constructor into one.\n","title":"join","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["m",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Control","Bind"],"Bind"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"m"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}]},null]},null]}},"sourceSpan":{"start":[117,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[117,45]}},{"children":[],"comments":"Execute a monadic action if a condition holds.\n\nFor example:\n\n```purescript\nmain = ifM ((< 0.5) <$> random)\n (trace \"Heads\")\n (trace \"Tails\")\n```\n","title":"ifM","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["m",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Control","Bind"],"Bind"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"m"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}]}]}]},null]},null]}},"sourceSpan":{"start":[149,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[149,60]}},{"children":[],"comments":null,"title":"(>>=)","info":{"declType":"alias","alias":[["Control","Bind"],{"Right":{"Left":{"Ident":"bind"}}}],"fixity":{"associativity":"infixl","precedence":1}},"sourceSpan":{"start":[53,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[53,21]}},{"children":[],"comments":null,"title":"(>=>)","info":{"declType":"alias","alias":[["Control","Bind"],{"Right":{"Left":{"Ident":"composeKleisli"}}}],"fixity":{"associativity":"infixr","precedence":1}},"sourceSpan":{"start":[132,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[132,31]}},{"children":[],"comments":null,"title":"(=<<)","info":{"declType":"alias","alias":[["Control","Bind"],{"Right":{"Left":{"Ident":"bindFlipped"}}}],"fixity":{"associativity":"infixr","precedence":1}},"sourceSpan":{"start":[63,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[63,28]}},{"children":[],"comments":null,"title":"(<=<)","info":{"declType":"alias","alias":[["Control","Bind"],{"Right":{"Left":{"Ident":"composeKleisliFlipped"}}}],"fixity":{"associativity":"infixr","precedence":1}},"sourceSpan":{"start":[138,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Bind.purs","end":[138,38]}}]},{"moduleName":{"package":null,"item":["Control","Category"]},"declarations":[{"children":[{"comments":null,"title":"identity","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"ForAll","contents":["t",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"a"},{"annotation":[],"tag":"TypeVar","contents":"t"}]},{"annotation":[],"tag":"TypeVar","contents":"t"}]},null]}},"sourceSpan":{"start":[18,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Category.purs","end":[18,30]}},{"comments":null,"title":"categoryFn","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Category"],"Category"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]}]}},"sourceSpan":{"start":[20,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Category.purs","end":[21,17]}}],"comments":null,"title":"Category","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Control","Semigroupoid"],"Semigroupoid"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[17,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Category.purs","end":[18,30]}}]},{"moduleName":{"package":null,"item":["Control","Monad"]},"declarations":[{"children":[{"comments":null,"title":"monadFn","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Monad"],"Monad"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"r"}]}]}},"sourceSpan":{"start":[33,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Monad.purs","end":[33,35]}},{"comments":null,"title":"monadArray","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Monad"],"Monad"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Array"]}]}},"sourceSpan":{"start":[35,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Monad.purs","end":[35,35]}},{"comments":null,"title":"monadProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Monad"],"Monad"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]}]}},"sourceSpan":{"start":[37,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Monad.purs","end":[37,35]}}],"comments":"The `Monad` type class combines the operations of the `Bind` and\n`Applicative` type classes. Therefore, `Monad` instances represent type\nconstructors which support sequential composition, and also lifting of\nfunctions of arbitrary arity.\n\nInstances must satisfy the following laws in addition to the\n`Applicative` and `Bind` laws:\n\n- Left Identity: `pure x >>= f = f x`\n- Right Identity: `x >>= pure = x`\n","title":"Monad","info":{"fundeps":[],"arguments":[["m",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Control","Applicative"],"Applicative"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"m"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Control","Bind"],"Bind"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"m"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[31,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Monad.purs","end":[31,41]}},{"children":[],"comments":"Perform a monadic action when a condition is true, where the conditional\nvalue is also in a monadic context.\n","title":"whenM","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["m",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Control","Monad"],"Monad"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"m"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}]}]}]},null]}},"sourceSpan":{"start":[57,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Monad.purs","end":[57,60]}},{"children":[],"comments":"Perform a monadic action unless a condition is true, where the conditional\nvalue is also in a monadic context.\n","title":"unlessM","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["m",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Control","Monad"],"Monad"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"m"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}]}]}]},null]}},"sourceSpan":{"start":[64,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Monad.purs","end":[64,62]}},{"children":[],"comments":"`liftM1` provides a default implementation of `(<$>)` for any\n[`Monad`](#monad), without using `(<$>)` as provided by the\n[`Functor`](#functor)-[`Monad`](#monad) superclass relationship.\n\n`liftM1` can therefore be used to write [`Functor`](#functor) instances\nas follows:\n\n```purescript\ninstance functorF :: Functor F where\n map = liftM1\n```\n","title":"liftM1","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["m",{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Control","Monad"],"Monad"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"m"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}]}]},null]},null]},null]}},"sourceSpan":{"start":[50,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Monad.purs","end":[50,58]}},{"children":[],"comments":"`ap` provides a default implementation of `(<*>)` for any `Monad`, without\nusing `(<*>)` as provided by the `Apply`-`Monad` superclass relationship.\n\n`ap` can therefore be used to write `Apply` instances as follows:\n\n```purescript\ninstance applyF :: Apply F where\n apply = ap\n```\n","title":"ap","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["m",{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Control","Monad"],"Monad"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"m"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"m"},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}]}]},null]},null]},null]}},"sourceSpan":{"start":[82,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Monad.purs","end":[82,56]}}]},{"moduleName":{"package":null,"item":["Control","Semigroupoid"]},"declarations":[{"children":[{"comments":null,"title":"compose","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"ForAll","contents":["c",{"annotation":[],"tag":"ForAll","contents":["d",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"a"},{"annotation":[],"tag":"TypeVar","contents":"c"}]},{"annotation":[],"tag":"TypeVar","contents":"d"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"a"},{"annotation":[],"tag":"TypeVar","contents":"b"}]},{"annotation":[],"tag":"TypeVar","contents":"c"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"a"},{"annotation":[],"tag":"TypeVar","contents":"b"}]},{"annotation":[],"tag":"TypeVar","contents":"d"}]}]}]},null]},null]},null]}},"sourceSpan":{"start":[14,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Semigroupoid.purs","end":[14,51]}},{"comments":null,"title":"semigroupoidFn","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Control","Semigroupoid"],"Semigroupoid"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]}]}},"sourceSpan":{"start":[16,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Semigroupoid.purs","end":[17,26]}}],"comments":null,"title":"Semigroupoid","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[13,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Semigroupoid.purs","end":[14,51]}},{"children":[],"comments":null,"title":"(>>>)","info":{"declType":"alias","alias":[["Control","Semigroupoid"],{"Right":{"Left":{"Ident":"composeFlipped"}}}],"fixity":{"associativity":"infixr","precedence":9}},"sourceSpan":{"start":[25,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Semigroupoid.purs","end":[25,31]}},{"children":[],"comments":null,"title":"(<<<)","info":{"declType":"alias","alias":[["Control","Semigroupoid"],{"Right":{"Left":{"Ident":"compose"}}}],"fixity":{"associativity":"infixr","precedence":9}},"sourceSpan":{"start":[19,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Control/Semigroupoid.purs","end":[19,24]}}]},{"moduleName":{"package":null,"item":["Data","Boolean"]},"declarations":[{"children":[],"comments":"An alias for `true`, which can be useful in guard clauses:\n\n```purescript\nmax x y | x >= y = x\n | otherwise = y\n```\n","title":"otherwise","info":{"declType":"value","type":{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}},"sourceSpan":{"start":[9,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Boolean.purs","end":[9,21]}}]},{"moduleName":{"package":null,"item":["Data","BooleanAlgebra"]},"declarations":[{"children":[{"comments":null,"title":"booleanAlgebraBoolean","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","BooleanAlgebra"],"BooleanAlgebra"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}},"sourceSpan":{"start":[24,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/BooleanAlgebra.purs","end":[24,57]}},{"comments":null,"title":"booleanAlgebraUnit","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","BooleanAlgebra"],"BooleanAlgebra"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}},"sourceSpan":{"start":[25,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/BooleanAlgebra.purs","end":[25,51]}},{"comments":null,"title":"booleanAlgebraFn","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","BooleanAlgebra"],"BooleanAlgebra"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"b"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","BooleanAlgebra"],"BooleanAlgebra"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}},"sourceSpan":{"start":[26,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/BooleanAlgebra.purs","end":[26,73]}},{"comments":null,"title":"booleanAlgebraRecord","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"list"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","BooleanAlgebra"],"BooleanAlgebraRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"list"},{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"row"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","BooleanAlgebra"],"BooleanAlgebra"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]}},"sourceSpan":{"start":[27,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/BooleanAlgebra.purs","end":[27,123]}},{"comments":null,"title":"booleanAlgebraProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","BooleanAlgebra"],"BooleanAlgebra"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[28,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/BooleanAlgebra.purs","end":[28,57]}},{"comments":null,"title":"booleanAlgebraProxy2","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","BooleanAlgebra"],"BooleanAlgebra"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy2"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[29,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/BooleanAlgebra.purs","end":[29,59]}},{"comments":null,"title":"booleanAlgebraProxy3","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","BooleanAlgebra"],"BooleanAlgebra"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy3"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[30,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/BooleanAlgebra.purs","end":[30,59]}}],"comments":"The `BooleanAlgebra` type class represents types that behave like boolean\nvalues.\n\nInstances should satisfy the following laws in addition to the\n`HeytingAlgebra` law:\n\n- Excluded middle:\n - `a || not a = tt`\n","title":"BooleanAlgebra","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Data","HeytingAlgebra"],"HeytingAlgebra"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[22,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/BooleanAlgebra.purs","end":[22,43]}}]},{"moduleName":{"package":null,"item":["Data","Bounded"]},"declarations":[{"children":[{"comments":null,"title":"top","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeVar","contents":"a"}},"sourceSpan":{"start":[24,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded.purs","end":[24,11]}},{"comments":null,"title":"bottom","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeVar","contents":"a"}},"sourceSpan":{"start":[25,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded.purs","end":[25,14]}},{"comments":null,"title":"boundedBoolean","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Bounded"],"Bounded"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}},"sourceSpan":{"start":[27,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded.purs","end":[29,17]}},{"comments":"The `Bounded` `Int` instance has `top :: Int` equal to 2^31 - 1,\nand `bottom :: Int` equal to -2^31, since these are the largest and smallest\nintegers representable by twos-complement 32-bit integers, respectively.\n","title":"boundedInt","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Bounded"],"Bounded"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Int"]}]}},"sourceSpan":{"start":[34,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded.purs","end":[36,21]}},{"comments":"Characters fall within the Unicode range.\n","title":"boundedChar","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Bounded"],"Bounded"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Char"]}]}},"sourceSpan":{"start":[42,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded.purs","end":[44,22]}},{"comments":null,"title":"boundedOrdering","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Bounded"],"Bounded"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ordering"],"Ordering"]}]}},"sourceSpan":{"start":[49,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded.purs","end":[51,14]}},{"comments":null,"title":"boundedUnit","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Bounded"],"Bounded"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}},"sourceSpan":{"start":[53,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded.purs","end":[55,16]}},{"comments":null,"title":"boundedNumber","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Bounded"],"Bounded"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Number"]}]}},"sourceSpan":{"start":[60,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded.purs","end":[62,24]}},{"comments":null,"title":"boundedProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Bounded"],"Bounded"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[64,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded.purs","end":[66,14]}},{"comments":null,"title":"boundedProxy2","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Bounded"],"Bounded"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy2"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[68,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded.purs","end":[70,15]}},{"comments":null,"title":"boundedProxy3","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Bounded"],"Bounded"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy3"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[72,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded.purs","end":[74,15]}},{"comments":null,"title":"boundedRecord","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"list"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Bounded"],"BoundedRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"list"},{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"row"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Bounded"],"Bounded"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]}},"sourceSpan":{"start":[107,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded.purs","end":[113,67]}}],"comments":"The `Bounded` type class represents totally ordered types that have an\nupper and lower boundary.\n\nInstances should satisfy the following law in addition to the `Ord` laws:\n\n- Bounded: `bottom <= a <= top`\n","title":"Bounded","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Data","Ord"],"Ord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[23,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Bounded.purs","end":[25,14]}}]},{"moduleName":{"package":null,"item":["Data","CommutativeRing"]},"declarations":[{"children":[{"comments":null,"title":"commutativeRingInt","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","CommutativeRing"],"CommutativeRing"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Int"]}]}},"sourceSpan":{"start":[25,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/CommutativeRing.purs","end":[25,51]}},{"comments":null,"title":"commutativeRingNumber","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","CommutativeRing"],"CommutativeRing"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Number"]}]}},"sourceSpan":{"start":[26,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/CommutativeRing.purs","end":[26,57]}},{"comments":null,"title":"commutativeRingUnit","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","CommutativeRing"],"CommutativeRing"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}},"sourceSpan":{"start":[27,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/CommutativeRing.purs","end":[27,53]}},{"comments":null,"title":"commutativeRingFn","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","CommutativeRing"],"CommutativeRing"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"b"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","CommutativeRing"],"CommutativeRing"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}},"sourceSpan":{"start":[28,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/CommutativeRing.purs","end":[28,76]}},{"comments":null,"title":"commutativeRingRecord","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"list"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","CommutativeRing"],"CommutativeRingRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"list"},{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"row"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","CommutativeRing"],"CommutativeRing"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]}},"sourceSpan":{"start":[29,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/CommutativeRing.purs","end":[29,126]}},{"comments":null,"title":"commutativeRingProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","CommutativeRing"],"CommutativeRing"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[30,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/CommutativeRing.purs","end":[30,59]}},{"comments":null,"title":"commutativeRingProxy2","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","CommutativeRing"],"CommutativeRing"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy2"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[31,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/CommutativeRing.purs","end":[31,61]}},{"comments":null,"title":"commutativeRingProxy3","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","CommutativeRing"],"CommutativeRing"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy3"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[32,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/CommutativeRing.purs","end":[32,61]}}],"comments":"The `CommutativeRing` class is for rings where multiplication is\ncommutative.\n\nInstances must satisfy the following law in addition to the `Ring`\nlaws:\n\n- Commutative multiplication: `a * b = b * a`\n","title":"CommutativeRing","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Data","Ring"],"Ring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[23,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/CommutativeRing.purs","end":[23,34]}}]},{"moduleName":{"package":null,"item":["Data","DivisionRing"]},"declarations":[{"children":[{"comments":null,"title":"recip","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}},"sourceSpan":{"start":[30,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/DivisionRing.purs","end":[30,18]}},{"comments":null,"title":"divisionringNumber","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","DivisionRing"],"DivisionRing"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Number"]}]}},"sourceSpan":{"start":[54,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/DivisionRing.purs","end":[55,20]}}],"comments":"The `DivisionRing` class is for non-zero rings in which every non-zero\nelement has a multiplicative inverse. Division rings are sometimes also\ncalled *skew fields*.\n\nInstances must satisfy the following laws in addition to the `Ring` laws:\n\n- Non-zero ring: `one /= zero`\n- Non-zero multiplicative inverse: `recip a * a = a * recip a = one` for\n all non-zero `a`\n\nThe result of `recip zero` is left undefined; individual instances may\nchoose how to handle this case.\n\nIf a type has both `DivisionRing` and `CommutativeRing` instances, then\nit is a field and should have a `Field` instance.\n","title":"DivisionRing","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Data","Ring"],"Ring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[29,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/DivisionRing.purs","end":[30,18]}}]},{"moduleName":{"package":null,"item":["Data","Eq"]},"declarations":[{"children":[{"comments":null,"title":"eq","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}]}},"sourceSpan":{"start":[29,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq.purs","end":[29,26]}},{"comments":null,"title":"eqBoolean","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}},"sourceSpan":{"start":[40,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq.purs","end":[41,21]}},{"comments":null,"title":"eqInt","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Int"]}]}},"sourceSpan":{"start":[43,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq.purs","end":[44,17]}},{"comments":null,"title":"eqNumber","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Number"]}]}},"sourceSpan":{"start":[46,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq.purs","end":[47,20]}},{"comments":null,"title":"eqChar","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Char"]}]}},"sourceSpan":{"start":[49,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq.purs","end":[50,18]}},{"comments":null,"title":"eqString","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"String"]}]}},"sourceSpan":{"start":[52,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq.purs","end":[53,20]}},{"comments":null,"title":"eqUnit","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}},"sourceSpan":{"start":[55,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq.purs","end":[56,16]}},{"comments":null,"title":"eqVoid","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Void"],"Void"]}]}},"sourceSpan":{"start":[58,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq.purs","end":[59,16]}},{"comments":null,"title":"eqArray","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Eq"],"Eq"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Array"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[61,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq.purs","end":[62,22]}},{"comments":null,"title":"eqRec","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"list"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Eq"],"EqRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"list"},{"annotation":[],"tag":"TypeVar","contents":"row"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]}},"sourceSpan":{"start":[64,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq.purs","end":[65,38]}},{"comments":null,"title":"eqProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[67,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq.purs","end":[68,16]}},{"comments":null,"title":"eqProxy2","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy2"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[70,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq.purs","end":[71,16]}},{"comments":null,"title":"eqProxy3","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy3"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[73,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq.purs","end":[74,16]}}],"comments":"The `Eq` type class represents types which support decidable equality.\n\n`Eq` instances should satisfy the following laws:\n\n- Reflexivity: `x == x = true`\n- Symmetry: `x == y = y == x`\n- Transitivity: if `x == y` and `y == z` then `x == z`\n\n**Note:** The `Number` type is not an entirely law abiding member of this\nclass due to the presence of `NaN`, since `NaN /= NaN`. Additionally,\ncomputing with `Number` can result in a loss of precision, so sometimes\nvalues that should be equivalent are not.\n","title":"Eq","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[28,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq.purs","end":[29,26]}},{"children":[],"comments":"`notEq` tests whether one value is _not equal_ to another. Shorthand for\n`not (eq x y)`.\n","title":"notEq","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Eq"],"Eq"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}]}]},null]}},"sourceSpan":{"start":[35,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq.purs","end":[35,45]}},{"children":[],"comments":null,"title":"(==)","info":{"declType":"alias","alias":[["Data","Eq"],{"Right":{"Left":{"Ident":"eq"}}}],"fixity":{"associativity":"infix","precedence":4}},"sourceSpan":{"start":[31,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq.purs","end":[31,17]}},{"children":[],"comments":null,"title":"(/=)","info":{"declType":"alias","alias":[["Data","Eq"],{"Right":{"Left":{"Ident":"notEq"}}}],"fixity":{"associativity":"infix","precedence":4}},"sourceSpan":{"start":[38,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Eq.purs","end":[38,20]}}]},{"moduleName":{"package":null,"item":["Data","EuclideanRing"]},"declarations":[{"children":[{"comments":null,"title":"degree","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Int"]}]}},"sourceSpan":{"start":[64,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/EuclideanRing.purs","end":[64,21]}},{"comments":null,"title":"div","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[65,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/EuclideanRing.purs","end":[65,21]}},{"comments":null,"title":"mod","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[66,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/EuclideanRing.purs","end":[66,21]}},{"comments":null,"title":"euclideanRingInt","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","EuclideanRing"],"EuclideanRing"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Int"]}]}},"sourceSpan":{"start":[70,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/EuclideanRing.purs","end":[73,15]}},{"comments":null,"title":"euclideanRingNumber","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","EuclideanRing"],"EuclideanRing"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Number"]}]}},"sourceSpan":{"start":[75,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/EuclideanRing.purs","end":[78,16]}}],"comments":"The `EuclideanRing` class is for commutative rings that support division.\nThe mathematical structure this class is based on is sometimes also called\na *Euclidean domain*.\n\nInstances must satisfy the following laws in addition to the `Ring`\nlaws:\n\n- Integral domain: `one /= zero`, and if `a` and `b` are both nonzero then\n so is their product `a * b`\n- Euclidean function `degree`:\n - Nonnegativity: For all nonzero `a`, `degree a >= 0`\n - Quotient/remainder: For all `a` and `b`, where `b` is nonzero,\n let `q = a / b` and ``r = a `mod` b``; then `a = q*b + r`, and also\n either `r = zero` or `degree r < degree b`\n- Submultiplicative euclidean function:\n - For all nonzero `a` and `b`, `degree a <= degree (a * b)`\n\nThe behaviour of division by `zero` is unconstrained by these laws,\nmeaning that individual instances are free to choose how to behave in this\ncase. Similarly, there are no restrictions on what the result of\n`degree zero` is; it doesn't make sense to ask for `degree zero` in the\nsame way that it doesn't make sense to divide by `zero`, so again,\nindividual instances may choose how to handle this case.\n\nFor any `EuclideanRing` which is also a `Field`, one valid choice\nfor `degree` is simply `const 1`. In fact, unless there's a specific\nreason not to, `Field` types should normally use this definition of\n`degree`.\n\nThe `EuclideanRing Int` instance is one of the most commonly used\n`EuclideanRing` instances and deserves a little more discussion. In\nparticular, there are a few different sensible law-abiding implementations\nto choose from, with slightly different behaviour in the presence of\nnegative dividends or divisors. The most common definitions are \"truncating\"\ndivision, where the result of `a / b` is rounded towards 0, and \"Knuthian\"\nor \"flooring\" division, where the result of `a / b` is rounded towards\nnegative infinity. A slightly less common, but arguably more useful, option\nis \"Euclidean\" division, which is defined so as to ensure that ``a `mod` b``\nis always nonnegative. With Euclidean division, `a / b` rounds towards\nnegative infinity if the divisor is positive, and towards positive infinity\nif the divisor is negative. Note that all three definitions are identical if\nwe restrict our attention to nonnegative dividends and divisors.\n\nIn versions 1.x, 2.x, and 3.x of the Prelude, the `EuclideanRing Int`\ninstance used truncating division. As of 4.x, the `EuclideanRing Int`\ninstance uses Euclidean division. Additional functions `quot` and `rem` are\nsupplied if truncating division is desired.\n","title":"EuclideanRing","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Data","CommutativeRing"],"CommutativeRing"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[63,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/EuclideanRing.purs","end":[66,21]}},{"children":[],"comments":"The *least common multiple* of two values.\n","title":"lcm","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Eq"],"Eq"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","EuclideanRing"],"EuclideanRing"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}]}]},null]}},"sourceSpan":{"start":[94,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/EuclideanRing.purs","end":[94,56]}},{"children":[],"comments":"The *greatest common divisor* of two values.\n","title":"gcd","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Eq"],"Eq"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","EuclideanRing"],"EuclideanRing"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}]}]},null]}},"sourceSpan":{"start":[87,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/EuclideanRing.purs","end":[87,56]}},{"children":[],"comments":null,"title":"(/)","info":{"declType":"alias","alias":[["Data","EuclideanRing"],{"Right":{"Left":{"Ident":"div"}}}],"fixity":{"associativity":"infixl","precedence":7}},"sourceSpan":{"start":[68,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/EuclideanRing.purs","end":[68,18]}}]},{"moduleName":{"package":null,"item":["Data","Field"]},"declarations":[{"children":[{"comments":null,"title":"field","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","EuclideanRing"],"EuclideanRing"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","DivisionRing"],"DivisionRing"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Field"],"Field"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}},"sourceSpan":{"start":[41,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Field.purs","end":[41,63]}}],"comments":"The `Field` class is for types that are (commutative) fields.\n\nMathematically, a field is a ring which is commutative and in which every\nnonzero element has a multiplicative inverse; these conditions correspond\nto the `CommutativeRing` and `DivisionRing` classes in PureScript\nrespectively. However, the `Field` class has `EuclideanRing` and\n`DivisionRing` as superclasses, which seems like a stronger requirement\n(since `CommutativeRing` is a superclass of `EuclideanRing`). In fact, it\nis not stronger, since any type which has law-abiding `CommutativeRing`\nand `DivisionRing` instances permits exactly one law-abiding\n`EuclideanRing` instance. We use a `EuclideanRing` superclass here in\norder to ensure that a `Field` constraint on a function permits you to use\n`div` on that type, since `div` is a member of `EuclideanRing`.\n\nThis class has no laws or members of its own; it exists as a convenience,\nso a single constraint can be used when field-like behaviour is expected.\n\nThis module also defines a single `Field` instance for any type which has\nboth `EuclideanRing` and `DivisionRing` instances. Any other instance\nwould overlap with this instance, so no other `Field` instances should be\ndefined in libraries. Instead, simply define `EuclideanRing` and\n`DivisionRing` instances, and this will permit your type to be used with a\n`Field` constraint.\n","title":"Field","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Data","EuclideanRing"],"EuclideanRing"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","DivisionRing"],"DivisionRing"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[39,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Field.purs","end":[39,51]}}]},{"moduleName":{"package":null,"item":["Data","Function"]},"declarations":[{"children":[],"comments":"Flips the order of the arguments to a function of two arguments.\n\n```purescript\nflip const 1 2 = const 2 1 = 2\n```\n","title":"flip","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"ForAll","contents":["c",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"b"}]},{"annotation":[],"tag":"TypeVar","contents":"c"}]}]}}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"b"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"c"}]}]}]},null]},null]},null]}},"sourceSpan":{"start":[21,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Function.purs","end":[21,51]}},{"children":[],"comments":"Returns its first argument and ignores its second.\n\n```purescript\nconst 1 \"hello\" = 1\n```\n\nIt can also be thought of as creating a function that ignores its argument:\n\n```purescript\nconst 1 = \\_ -> 1\n```\n","title":"const","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"b"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},null]},null]}},"sourceSpan":{"start":[35,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Function.purs","end":[35,33]}},{"children":[],"comments":"Applies a function to an argument: the reverse of `(#)`.\n\n```purescript\nlength $ groupBy productCategory $ filter isInStock $ products\n```\n\nis equivalent to:\n\n```purescript\nlength (groupBy productCategory (filter isInStock products))\n```\n\nOr another alternative equivalent, applying chain of composed functions to\na value:\n\n```purescript\nlength <<< groupBy productCategory <<< filter isInStock $ products\n```\n","title":"($)","info":{"declType":"alias","alias":[["Data","Function"],{"Right":{"Left":{"Ident":"apply"}}}],"fixity":{"associativity":"infixr","precedence":0}},"sourceSpan":{"start":[62,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Function.purs","end":[62,20]}},{"children":[],"comments":"Applies an argument to a function: the reverse of `($)`.\n\n```purescript\nproducts # filter isInStock # groupBy productCategory # length\n```\n\nis equivalent to:\n\n```purescript\nlength (groupBy productCategory (filter isInStock products))\n```\n\nOr another alternative equivalent, applying a value to a chain of composed\nfunctions:\n\n```purescript\nproducts # filter isInStock >>> groupBy productCategory >>> length\n```\n","title":"(#)","info":{"declType":"alias","alias":[["Data","Function"],{"Right":{"Left":{"Ident":"applyFlipped"}}}],"fixity":{"associativity":"infixl","precedence":1}},"sourceSpan":{"start":[88,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Function.purs","end":[88,27]}}]},{"moduleName":{"package":null,"item":["Data","Functor"]},"declarations":[{"children":[{"comments":null,"title":"map","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}]},null]},null]}},"sourceSpan":{"start":[26,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[26,44]}},{"comments":null,"title":"functorFn","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Functor"],"Functor"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"r"}]}]}},"sourceSpan":{"start":[40,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[41,16]}},{"comments":null,"title":"functorArray","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Functor"],"Functor"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Array"]}]}},"sourceSpan":{"start":[43,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[44,17]}},{"comments":null,"title":"functorProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Functor"],"Functor"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]}]}},"sourceSpan":{"start":[46,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[47,18]}}],"comments":"A `Functor` is a type constructor which supports a mapping operation\n`map`.\n\n`map` can be used to turn functions `a -> b` into functions\n`f a -> f b` whose argument and return types use the type constructor `f`\nto represent some computational context.\n\nInstances must satisfy the following laws:\n\n- Identity: `map identity = identity`\n- Composition: `map (f <<< g) = map f <<< map g`\n","title":"Functor","info":{"fundeps":[],"arguments":[["f",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[25,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[26,44]}},{"children":[],"comments":"The `void` function is used to ignore the type wrapped by a\n[`Functor`](#functor), replacing it with `Unit` and keeping only the type\ninformation provided by the type constructor itself.\n\n`void` is often useful when using `do` notation to change the return type\nof a monadic computation:\n\n```purescript\nmain = forE 1 10 \\n -> void do\n print n\n print (n * n)\n```\n","title":"void","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["f",{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Functor"],"Functor"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"f"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}]}]},null]},null]}},"sourceSpan":{"start":[63,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[63,47]}},{"children":[],"comments":"Apply a value in a computational context to a value in no context.\n\nGeneralizes `flip`.\n\n```purescript\nlongEnough :: String -> Bool\nhasSymbol :: String -> Bool\nhasDigit :: String -> Bool\npassword :: String\n\nvalidate :: String -> Array Bool\nvalidate = flap [longEnough, hasSymbol, hasDigit]\n```\n\n```purescript\nflap (-) 3 4 == 1\nthreeve <$> Just 1 <@> 'a' <*> Just true == Just (threeve 1 'a' true)\n```\n","title":"flap","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["f",{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Functor"],"Functor"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"f"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeVar","contents":"f"},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}]}]},null]},null]},null]}},"sourceSpan":{"start":[97,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[97,58]}},{"children":[],"comments":null,"title":"(<@>)","info":{"declType":"alias","alias":[["Data","Functor"],{"Right":{"Left":{"Ident":"flap"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[100,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[100,21]}},{"children":[],"comments":null,"title":"(<$>)","info":{"declType":"alias","alias":[["Data","Functor"],{"Right":{"Left":{"Ident":"map"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[28,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[28,20]}},{"children":[],"comments":null,"title":"(<$)","info":{"declType":"alias","alias":[["Data","Functor"],{"Right":{"Left":{"Ident":"voidRight"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[71,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[71,25]}},{"children":[],"comments":null,"title":"(<#>)","info":{"declType":"alias","alias":[["Data","Functor"],{"Right":{"Left":{"Ident":"mapFlipped"}}}],"fixity":{"associativity":"infixl","precedence":1}},"sourceSpan":{"start":[38,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[38,27]}},{"children":[],"comments":null,"title":"($>)","info":{"declType":"alias","alias":[["Data","Functor"],{"Right":{"Left":{"Ident":"voidLeft"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[77,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Functor.purs","end":[77,24]}}]},{"moduleName":{"package":null,"item":["Data","HeytingAlgebra"]},"declarations":[{"children":[{"comments":null,"title":"conj","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[42,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[42,22]}},{"comments":null,"title":"disj","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[43,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[43,22]}},{"comments":null,"title":"not","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}},"sourceSpan":{"start":[44,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[44,16]}},{"comments":null,"title":"heytingAlgebraBoolean","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","HeytingAlgebra"],"HeytingAlgebra"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}},"sourceSpan":{"start":[49,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[55,16]}},{"comments":null,"title":"heytingAlgebraUnit","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","HeytingAlgebra"],"HeytingAlgebra"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}},"sourceSpan":{"start":[57,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[63,15]}},{"comments":null,"title":"heytingAlgebraFunction","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","HeytingAlgebra"],"HeytingAlgebra"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"b"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","HeytingAlgebra"],"HeytingAlgebra"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}},"sourceSpan":{"start":[65,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[71,22]}},{"comments":null,"title":"heytingAlgebraProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","HeytingAlgebra"],"HeytingAlgebra"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[73,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[79,13]}},{"comments":null,"title":"heytingAlgebraProxy2","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","HeytingAlgebra"],"HeytingAlgebra"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy2"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[81,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[87,14]}},{"comments":null,"title":"heytingAlgebraProxy3","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","HeytingAlgebra"],"HeytingAlgebra"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy3"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[89,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[95,14]}},{"comments":null,"title":"heytingAlgebraRecord","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"list"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","HeytingAlgebra"],"HeytingAlgebraRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"list"},{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"row"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","HeytingAlgebra"],"HeytingAlgebra"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]}},"sourceSpan":{"start":[97,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[103,41]}}],"comments":"The `HeytingAlgebra` type class represents types that are bounded lattices with\nan implication operator such that the following laws hold:\n\n- Associativity:\n - `a || (b || c) = (a || b) || c`\n - `a && (b && c) = (a && b) && c`\n- Commutativity:\n - `a || b = b || a`\n - `a && b = b && a`\n- Absorption:\n - `a || (a && b) = a`\n - `a && (a || b) = a`\n- Idempotent:\n - `a || a = a`\n - `a && a = a`\n- Identity:\n - `a || ff = a`\n - `a && tt = a`\n- Implication:\n - ``a `implies` a = tt``\n - ``a && (a `implies` b) = a && b``\n - ``b && (a `implies` b) = b``\n - ``a `implies` (b && c) = (a `implies` b) && (a `implies` c)``\n- Complemented:\n - ``not a = a `implies` ff``\n","title":"HeytingAlgebra","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[38,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[44,16]}},{"children":[],"comments":null,"title":"(||)","info":{"declType":"alias","alias":[["Data","HeytingAlgebra"],{"Right":{"Left":{"Ident":"disj"}}}],"fixity":{"associativity":"infixr","precedence":2}},"sourceSpan":{"start":[47,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[47,20]}},{"children":[],"comments":null,"title":"(&&)","info":{"declType":"alias","alias":[["Data","HeytingAlgebra"],{"Right":{"Left":{"Ident":"conj"}}}],"fixity":{"associativity":"infixr","precedence":3}},"sourceSpan":{"start":[46,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/HeytingAlgebra.purs","end":[46,20]}}]},{"moduleName":{"package":null,"item":["Data","Monoid"]},"declarations":[{"children":[{"comments":null,"title":"mempty","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeVar","contents":"m"}},"sourceSpan":{"start":[45,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid.purs","end":[45,14]}},{"comments":null,"title":"monoidUnit","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid"],"Monoid"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}},"sourceSpan":{"start":[47,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid.purs","end":[48,16]}},{"comments":null,"title":"monoidOrdering","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid"],"Monoid"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ordering"],"Ordering"]}]}},"sourceSpan":{"start":[50,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid.purs","end":[51,14]}},{"comments":null,"title":"monoidFn","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Monoid"],"Monoid"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"b"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid"],"Monoid"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}},"sourceSpan":{"start":[53,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid.purs","end":[54,20]}},{"comments":null,"title":"monoidString","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid"],"Monoid"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"String"]}]}},"sourceSpan":{"start":[56,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid.purs","end":[57,14]}},{"comments":null,"title":"monoidArray","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid"],"Monoid"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Array"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[59,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid.purs","end":[60,14]}},{"comments":null,"title":"monoidRecord","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"list"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Monoid"],"MonoidRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"list"},{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"row"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Monoid"],"Monoid"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]}},"sourceSpan":{"start":[62,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid.purs","end":[63,46]}}],"comments":"A `Monoid` is a `Semigroup` with a value `mempty`, which is both a\nleft and right unit for the associative operation `<>`:\n\n- Left unit: `(mempty <> x) = x`\n- Right unit: `(x <> mempty) = x`\n\n`Monoid`s are commonly used as the result of fold operations, where\n`<>` is used to combine individual results, and `mempty` gives the result\nof folding an empty collection of elements.\n\n### Newtypes for Monoid\n\nSome types (e.g. `Int`, `Boolean`) can implement multiple law-abiding\ninstances for `Monoid`. Let's use `Int` as an example\n1. `<>` could be `+` and `mempty` could be `0`\n2. `<>` could be `*` and `mempty` could be `1`.\n\nTo clarify these ambiguous situations, one should use the newtypes\ndefined in `Data.Monoid.<NewtypeName>` modules.\n\nIn the above ambiguous situation, we could use `Additive`\nfor the first situation or `Multiplicative` for the second one.\n","title":"Monoid","info":{"fundeps":[],"arguments":[["m",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Data","Semigroup"],"Semigroup"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"m"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[44,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Monoid.purs","end":[45,14]}}]},{"moduleName":{"package":null,"item":["Data","NaturalTransformation"]},"declarations":[{"children":[],"comments":null,"title":"type (~>)","info":{"declType":"alias","alias":[["Data","NaturalTransformation"],{"Left":"NaturalTransformation"}],"fixity":{"associativity":"infixr","precedence":4}},"sourceSpan":{"start":[20,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/NaturalTransformation.purs","end":[20,42]}}]},{"moduleName":{"package":null,"item":["Data","Ord"]},"declarations":[{"children":[{"comments":null,"title":"compare","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ordering"],"Ordering"]}]}]}},"sourceSpan":{"start":[38,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[38,32]}},{"comments":null,"title":"ordBoolean","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}},"sourceSpan":{"start":[40,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[41,36]}},{"comments":null,"title":"ordInt","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Int"]}]}},"sourceSpan":{"start":[43,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[44,32]}},{"comments":null,"title":"ordNumber","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Number"]}]}},"sourceSpan":{"start":[46,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[47,35]}},{"comments":null,"title":"ordString","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"String"]}]}},"sourceSpan":{"start":[49,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[50,35]}},{"comments":null,"title":"ordChar","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Char"]}]}},"sourceSpan":{"start":[52,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[53,33]}},{"comments":null,"title":"ordUnit","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}},"sourceSpan":{"start":[55,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[56,19]}},{"comments":null,"title":"ordVoid","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Void"],"Void"]}]}},"sourceSpan":{"start":[58,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[59,19]}},{"comments":null,"title":"ordProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[61,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[62,19]}},{"comments":null,"title":"ordProxy2","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy2"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[64,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[65,19]}},{"comments":null,"title":"ordProxy3","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy3"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[67,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[68,19]}},{"comments":null,"title":"ordArray","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Ord"],"Ord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Array"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[70,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[77,17]}},{"comments":null,"title":"ordOrdering","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ordering"],"Ordering"]}]}},"sourceSpan":{"start":[121,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[128,21]}},{"comments":null,"title":"ordRecord","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"list"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Ord"],"OrdRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"list"},{"annotation":[],"tag":"TypeVar","contents":"row"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ord"],"Ord"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]}},"sourceSpan":{"start":[249,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[254,48]}}],"comments":"The `Ord` type class represents types which support comparisons with a\n_total order_.\n\n`Ord` instances should satisfy the laws of total orderings:\n\n- Reflexivity: `a <= a`\n- Antisymmetry: if `a <= b` and `b <= a` then `a = b`\n- Transitivity: if `a <= b` and `b <= c` then `a <= c`\n","title":"Ord","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Data","Eq"],"Eq"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[37,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[38,32]}},{"children":[],"comments":"Take the minimum of two values. If they are considered equal, the first\nargument is chosen.\n","title":"min","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Ord"],"Ord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}]},null]}},"sourceSpan":{"start":[165,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[165,38]}},{"children":[],"comments":"Take the maximum of two values. If they are considered equal, the first\nargument is chosen.\n","title":"max","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Ord"],"Ord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}]},null]}},"sourceSpan":{"start":[174,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[174,38]}},{"children":[],"comments":"Compares two values by mapping them to a type with an `Ord` instance.\n","title":"comparing","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ForAll","contents":["b",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Ord"],"Ord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"b"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}}]},{"annotation":[],"tag":"ParensInType","contents":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ordering"],"Ordering"]}]}]}}]}]},null]},null]}},"sourceSpan":{"start":[160,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[160,67]}},{"children":[],"comments":"Clamp a value between a minimum and a maximum. For example:\n\n``` purescript\nlet f = clamp 0 10\nf (-5) == 0\nf 5 == 5\nf 15 == 10\n```\n","title":"clamp","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Ord"],"Ord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}]}]},null]}},"sourceSpan":{"start":[189,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[189,45]}},{"children":[],"comments":"Test whether a value is between a minimum and a maximum (inclusive).\nFor example:\n\n``` purescript\nlet f = between 0 10\nf 0 == true\nf (-5) == false\nf 5 == true\nf 10 == true\nf 15 == false\n```\n","title":"between","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Ord"],"Ord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}]}]}]},null]}},"sourceSpan":{"start":[203,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[203,53]}},{"children":[],"comments":null,"title":"(>=)","info":{"declType":"alias","alias":[["Data","Ord"],{"Right":{"Left":{"Ident":"greaterThanOrEq"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[157,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[157,31]}},{"children":[],"comments":null,"title":"(>)","info":{"declType":"alias","alias":[["Data","Ord"],{"Right":{"Left":{"Ident":"greaterThan"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[156,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[156,26]}},{"children":[],"comments":null,"title":"(<=)","info":{"declType":"alias","alias":[["Data","Ord"],{"Right":{"Left":{"Ident":"lessThanOrEq"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[155,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[155,28]}},{"children":[],"comments":null,"title":"(<)","info":{"declType":"alias","alias":[["Data","Ord"],{"Right":{"Left":{"Ident":"lessThan"}}}],"fixity":{"associativity":"infixl","precedence":4}},"sourceSpan":{"start":[154,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ord.purs","end":[154,23]}}]},{"moduleName":{"package":null,"item":["Data","Ordering"]},"declarations":[{"children":[{"comments":null,"title":"LT","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"GT","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"EQ","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null},{"comments":null,"title":"eqOrdering","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Eq"],"Eq"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ordering"],"Ordering"]}]}},"sourceSpan":{"start":[15,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ordering.purs","end":[19,19]}},{"comments":null,"title":"semigroupOrdering","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup"],"Semigroup"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ordering"],"Ordering"]}]}},"sourceSpan":{"start":[21,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ordering.purs","end":[24,18]}},{"comments":null,"title":"showOrdering","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ordering"],"Ordering"]}]}},"sourceSpan":{"start":[26,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ordering.purs","end":[29,17]}}],"comments":"The `Ordering` data type represents the three possible outcomes of\ncomparing two values:\n\n`LT` - The first value is _less than_ the second.\n`GT` - The first value is _greater than_ the second.\n`EQ` - The first value is _equal to_ the second.\n","title":"Ordering","info":{"declType":"data","dataDeclType":"data","typeArguments":[]},"sourceSpan":{"start":[13,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ordering.purs","end":[13,29]}}]},{"moduleName":{"package":null,"item":["Data","Ring"]},"declarations":[{"children":[{"comments":null,"title":"sub","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[24,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[24,21]}},{"comments":null,"title":"ringInt","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Int"]}]}},"sourceSpan":{"start":[28,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[29,15]}},{"comments":null,"title":"ringNumber","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Number"]}]}},"sourceSpan":{"start":[31,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[32,15]}},{"comments":null,"title":"ringUnit","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}},"sourceSpan":{"start":[34,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[35,17]}},{"comments":null,"title":"ringFn","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Ring"],"Ring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"b"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}},"sourceSpan":{"start":[37,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[38,24]}},{"comments":null,"title":"ringProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[40,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[41,18]}},{"comments":null,"title":"ringProxy2","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy2"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[43,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[44,19]}},{"comments":null,"title":"ringProxy3","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy3"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[46,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[47,19]}},{"comments":null,"title":"ringRecord","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"list"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Ring"],"RingRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"list"},{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"row"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Ring"],"Ring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]}},"sourceSpan":{"start":[49,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[50,40]}}],"comments":"The `Ring` class is for types that support addition, multiplication,\nand subtraction operations.\n\nInstances must satisfy the following laws in addition to the `Semiring`\nlaws:\n\n- Additive inverse: `a - a = zero`\n- Compatibility of `sub` and `negate`: `a - b = a + (zero - b)`\n","title":"Ring","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[{"constraintAnn":[],"constraintClass":[["Data","Semiring"],"Semiring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}]},"sourceSpan":{"start":[23,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[24,21]}},{"children":[],"comments":"`negate x` can be used as a shorthand for `zero - x`.\n","title":"negate","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"ConstrainedType","contents":[{"constraintAnn":[],"constraintClass":[["Data","Ring"],"Ring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},null]}},"sourceSpan":{"start":[53,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[53,37]}},{"children":[],"comments":null,"title":"(-)","info":{"declType":"alias","alias":[["Data","Ring"],{"Right":{"Left":{"Ident":"sub"}}}],"fixity":{"associativity":"infixl","precedence":6}},"sourceSpan":{"start":[26,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Ring.purs","end":[26,18]}}]},{"moduleName":{"package":null,"item":["Data","Semigroup"]},"declarations":[{"children":[{"comments":null,"title":"append","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[32,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup.purs","end":[32,24]}},{"comments":null,"title":"semigroupString","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup"],"Semigroup"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"String"]}]}},"sourceSpan":{"start":[36,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup.purs","end":[37,24]}},{"comments":null,"title":"semigroupUnit","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup"],"Semigroup"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}},"sourceSpan":{"start":[39,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup.purs","end":[40,20]}},{"comments":null,"title":"semigroupVoid","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup"],"Semigroup"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Void"],"Void"]}]}},"sourceSpan":{"start":[42,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup.purs","end":[43,20]}},{"comments":null,"title":"semigroupFn","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Semigroup"],"Semigroup"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"s'"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup"],"Semigroup"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"s"}]},{"annotation":[],"tag":"TypeVar","contents":"s'"}]}]}},"sourceSpan":{"start":[45,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup.purs","end":[46,28]}},{"comments":null,"title":"semigroupArray","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup"],"Semigroup"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Array"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[48,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup.purs","end":[49,23]}},{"comments":null,"title":"semigroupProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup"],"Semigroup"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[51,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup.purs","end":[52,21]}},{"comments":null,"title":"semigroupProxy2","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup"],"Semigroup"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy2"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[54,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup.purs","end":[55,22]}},{"comments":null,"title":"semigroupProxy3","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup"],"Semigroup"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy3"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[57,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup.purs","end":[58,22]}},{"comments":null,"title":"semigroupRecord","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"list"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Semigroup"],"SemigroupRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"list"},{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"row"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semigroup"],"Semigroup"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]}},"sourceSpan":{"start":[60,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup.purs","end":[61,46]}}],"comments":"The `Semigroup` type class identifies an associative operation on a type.\n\nInstances are required to satisfy the following law:\n\n- Associativity: `(x <> y) <> z = x <> (y <> z)`\n\nOne example of a `Semigroup` is `String`, with `(<>)` defined as string\nconcatenation. Another example is `List a`, with `(<>)` defined as\nlist concatenation.\n\n### Newtypes for Semigroup\n\nThere are two other ways to implement an instance for this type class\nregardless of which type is used. These instances can be used by\nwrapping the values in one of the two newtypes below:\n1. `First` - Use the first argument every time: `append first _ = first`.\n2. `Last` - Use the last argument every time: `append _ last = last`.\n","title":"Semigroup","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[31,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup.purs","end":[32,24]}},{"children":[],"comments":null,"title":"(<>)","info":{"declType":"alias","alias":[["Data","Semigroup"],{"Right":{"Left":{"Ident":"append"}}}],"fixity":{"associativity":"infixr","precedence":5}},"sourceSpan":{"start":[34,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semigroup.purs","end":[34,22]}}]},{"moduleName":{"package":null,"item":["Data","Semiring"]},"declarations":[{"children":[{"comments":null,"title":"add","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[35,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[35,22]}},{"comments":null,"title":"zero","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeVar","contents":"a"}},"sourceSpan":{"start":[36,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[36,12]}},{"comments":null,"title":"mul","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[37,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[37,22]}},{"comments":null,"title":"one","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeVar","contents":"a"}},"sourceSpan":{"start":[38,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[38,12]}},{"comments":null,"title":"semiringInt","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Int"]}]}},"sourceSpan":{"start":[43,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[47,10]}},{"comments":null,"title":"semiringNumber","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Number"]}]}},"sourceSpan":{"start":[49,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[53,12]}},{"comments":null,"title":"semiringFn","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Semiring"],"Semiring"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"b"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeVar","contents":"b"}]}]}},"sourceSpan":{"start":[55,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[59,18]}},{"comments":null,"title":"semiringUnit","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}},"sourceSpan":{"start":[61,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[65,13]}},{"comments":null,"title":"semiringProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[67,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[71,15]}},{"comments":null,"title":"semiringProxy2","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy2"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[73,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[77,16]}},{"comments":null,"title":"semiringProxy3","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy3"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[79,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[83,16]}},{"comments":null,"title":"semiringRecord","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"list"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Semiring"],"SemiringRecord"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"list"},{"annotation":[],"tag":"TypeVar","contents":"row"},{"annotation":[],"tag":"TypeVar","contents":"row"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Semiring"],"Semiring"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"row"}]}]}},"sourceSpan":{"start":[85,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[89,63]}}],"comments":"The `Semiring` class is for types that support an addition and\nmultiplication operation.\n\nInstances must satisfy the following laws:\n\n- Commutative monoid under addition:\n - Associativity: `(a + b) + c = a + (b + c)`\n - Identity: `zero + a = a + zero = a`\n - Commutative: `a + b = b + a`\n- Monoid under multiplication:\n - Associativity: `(a * b) * c = a * (b * c)`\n - Identity: `one * a = a * one = a`\n- Multiplication distributes over addition:\n - Left distributivity: `a * (b + c) = (a * b) + (a * c)`\n - Right distributivity: `(a + b) * c = (a * c) + (b * c)`\n- Annihilation: `zero * a = a * zero = zero`\n\n**Note:** The `Number` and `Int` types are not fully law abiding\nmembers of this class hierarchy due to the potential for arithmetic\noverflows, and in the case of `Number`, the presence of `NaN` and\n`Infinity` values. The behaviour is unspecified in these cases.\n","title":"Semiring","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[34,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[38,12]}},{"children":[],"comments":null,"title":"(+)","info":{"declType":"alias","alias":[["Data","Semiring"],{"Right":{"Left":{"Ident":"add"}}}],"fixity":{"associativity":"infixl","precedence":6}},"sourceSpan":{"start":[40,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[40,18]}},{"children":[],"comments":null,"title":"(*)","info":{"declType":"alias","alias":[["Data","Semiring"],{"Right":{"Left":{"Ident":"mul"}}}],"fixity":{"associativity":"infixl","precedence":7}},"sourceSpan":{"start":[41,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Semiring.purs","end":[41,18]}}]},{"moduleName":{"package":null,"item":["Data","Show"]},"declarations":[{"children":[{"comments":null,"title":"show","info":{"declType":"typeClassMember","type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"String"]}]}},"sourceSpan":{"start":[18,3],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Show.purs","end":[18,22]}},{"comments":null,"title":"showBoolean","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}},"sourceSpan":{"start":[20,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Show.purs","end":[22,23]}},{"comments":null,"title":"showInt","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Int"]}]}},"sourceSpan":{"start":[24,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Show.purs","end":[25,21]}},{"comments":null,"title":"showNumber","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Number"]}]}},"sourceSpan":{"start":[27,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Show.purs","end":[28,24]}},{"comments":null,"title":"showChar","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Char"]}]}},"sourceSpan":{"start":[30,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Show.purs","end":[31,22]}},{"comments":null,"title":"showString","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"String"]}]}},"sourceSpan":{"start":[33,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Show.purs","end":[34,24]}},{"comments":null,"title":"showArray","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Data","Show"],"Show"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"a"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Array"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[36,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Show.purs","end":[37,28]}},{"comments":null,"title":"showProxy","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[39,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Show.purs","end":[40,19]}},{"comments":null,"title":"showProxy2","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy2"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[42,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Show.purs","end":[43,20]}},{"comments":null,"title":"showProxy3","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Type","Proxy"],"Proxy3"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]}},"sourceSpan":{"start":[45,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Show.purs","end":[46,20]}},{"comments":null,"title":"showRecord","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"rs"},{"annotation":[],"tag":"TypeVar","contents":"ls"}],"constraintKindArgs":[],"constraintData":null},{"constraintAnn":[],"constraintClass":[["Data","Show"],"ShowRecordFields"],"constraintArgs":[{"annotation":[],"tag":"TypeVar","contents":"ls"},{"annotation":[],"tag":"TypeVar","contents":"rs"}],"constraintKindArgs":[],"constraintData":null}],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"rs"}]}]}},"sourceSpan":{"start":[48,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Show.purs","end":[51,52]}}],"comments":"The `Show` type class represents those types which can be converted into\na human-readable `String` representation.\n\nWhile not required, it is recommended that for any expression `x`, the\nstring `show x` be executable PureScript code which evaluates to the same\nvalue as the expression `x`.\n","title":"Show","info":{"fundeps":[],"arguments":[["a",null]],"declType":"typeClass","superclasses":[]},"sourceSpan":{"start":[17,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Show.purs","end":[18,22]}}]},{"moduleName":{"package":null,"item":["Data","Unit"]},"declarations":[{"children":[{"comments":null,"title":"showUnit","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}]}},"sourceSpan":{"start":[18,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Unit.purs","end":[19,18]}}],"comments":"The `Unit` type has a single inhabitant, called `unit`. It represents\nvalues with no computational content.\n\n`Unit` is often used, wrapped in a monadic type constructor, as the\nreturn type of a computation where only the _effects_ are important.\n\nWhen returning a value of type `Unit` from an FFI function, it is\nrecommended to use `undefined`, or not return a value at all.\n","title":"Unit","info":{"kind":{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Type"]},"declType":"externData"},"sourceSpan":{"start":[13,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Unit.purs","end":[13,33]}},{"children":[],"comments":"`unit` is the sole inhabitant of the `Unit` type.\n","title":"unit","info":{"declType":"value","type":{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Unit"],"Unit"]}},"sourceSpan":{"start":[16,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Unit.purs","end":[16,28]}}]},{"moduleName":{"package":null,"item":["Data","Void"]},"declarations":[{"children":[{"comments":null,"title":"showVoid","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Show"],"Show"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Void"],"Void"]}]}},"sourceSpan":{"start":[24,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Void.purs","end":[25,16]}}],"comments":"An uninhabited data type. In other words, one can never create\na runtime value of type `Void` becaue no such value exists.\n\n`Void` is useful to eliminate the possibility of a value being created.\nFor example, a value of type `Either Void Boolean` can never have\na Left value created in PureScript.\n\nThis should not be confused with the keyword `void` that commonly appears in\nC-family languages, such as Java:\n```\npublic class Foo {\n void doSomething() { System.out.println(\"hello world!\"); }\n}\n```\n\nIn PureScript, one often uses `Unit` to achieve similar effects as\nthe `void` of C-family languages above.\n","title":"Void","info":{"declType":"data","dataDeclType":"newtype","typeArguments":[]},"sourceSpan":{"start":[22,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Void.purs","end":[22,25]}},{"children":[],"comments":"Eliminator for the `Void` type.\nUseful for stating that some code branch is impossible because you've\n\"acquired\" a value of type `Void` (which you can't).\n\n```purescript\nrightOnly :: forall t . Either Void t -> t\nrightOnly (Left v) = absurd v\nrightOnly (Right t) = t\n```\n","title":"absurd","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Data","Void"],"Void"]}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},null]}},"sourceSpan":{"start":[36,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Data/Void.purs","end":[36,30]}}]}],"name":"Prelude","comments":null,"declarations":[]},{"reExports":[],"name":"Record.Unsafe","comments":"The functions in this module are highly unsafe as they treat records like\nstringly-keyed maps and can coerce the row of labels that a record has.\n\nThese function are intended for situations where there is some other way of\nproving things about the structure of the record - for example, when using\n`RowToList`. **They should never be used for general record manipulation.**\n","declarations":[{"children":[],"comments":"Checks if a record has a key, using a string for the key.\n","title":"unsafeHas","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["r1",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"String"]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"r1"}]}]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Boolean"]}]}]},null]}},"sourceSpan":{"start":[10,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Record/Unsafe.purs","end":[10,70]}},{"children":[],"comments":"Unsafely gets a value from a record, using a string for the key.\n\nIf the key does not exist this will cause a runtime error elsewhere.\n","title":"unsafeGet","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["r",{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"String"]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"r"}]}]},{"annotation":[],"tag":"TypeVar","contents":"a"}]}]},null]},null]}},"sourceSpan":{"start":[15,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Record/Unsafe.purs","end":[15,64]}},{"children":[],"comments":"Unsafely sets a value on a record, using a string for the key.\n\nThe output record's row is unspecified so can be coerced to any row. If the\noutput type is incorrect it will cause a runtime error elsewhere.\n","title":"unsafeSet","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["r1",{"annotation":[],"tag":"ForAll","contents":["r2",{"annotation":[],"tag":"ForAll","contents":["a",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"String"]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeVar","contents":"a"}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"r1"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"r2"}]}]}]}]},null]},null]},null]}},"sourceSpan":{"start":[21,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Record/Unsafe.purs","end":[21,82]}},{"children":[],"comments":"Unsafely removes a value on a record, using a string for the key.\n\nThe output record's row is unspecified so can be coerced to any row. If the\noutput type is incorrect it will cause a runtime error elsewhere.\n","title":"unsafeDelete","info":{"declType":"value","type":{"annotation":[],"tag":"ForAll","contents":["r1",{"annotation":[],"tag":"ForAll","contents":["r2",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"String"]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"r1"}]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Record"]},{"annotation":[],"tag":"TypeVar","contents":"r2"}]}]}]},null]},null]}},"sourceSpan":{"start":[27,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Record/Unsafe.purs","end":[27,78]}}]},{"reExports":[],"name":"Type.Data.Row","comments":null,"declarations":[{"children":[{"comments":null,"title":"RProxy","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null}],"comments":null,"title":"RProxy","info":{"declType":"data","dataDeclType":"data","typeArguments":[["row",null]]},"sourceSpan":{"start":[22,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Type/Data/Row.purs","end":[22,25]}}]},{"reExports":[],"name":"Type.Data.RowList","comments":null,"declarations":[{"children":[{"comments":null,"title":"RLProxy","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null}],"comments":null,"title":"RLProxy","info":{"declType":"data","dataDeclType":"data","typeArguments":[["rowlist",null]]},"sourceSpan":{"start":[8,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Type/Data/RowList.purs","end":[8,31]}}]},{"reExports":[],"name":"Type.Proxy","comments":"The `Proxy` type and values are for situations where type information is\nrequired for an input to determine the type of an output, but where it is\nnot possible or convenient to provide a _value_ for the input.\n\nA hypothetical example: if you have a class that is used to handle the\nresult of an AJAX request, you may want to use this information to set the\nexpected content type of the request, so you might have a class something\nlike this:\n\n``` purescript\nclass AjaxResponse a where\n responseType :: a -> ResponseType\n fromResponse :: Foreign -> a\n```\n\nThe problem here is `responseType` requires a value of type `a`, but we\nwon't have a value of that type until the request has been completed. The\nsolution is to use a `Proxy` type instead:\n\n``` purescript\nclass AjaxResponse a where\n responseType :: Proxy a -> ResponseType\n fromResponse :: Foreign -> a\n```\n\nWe can now call `responseType (Proxy :: Proxy SomeContentType)` to produce\na `ResponseType` for `SomeContentType` without having to construct some\nempty version of `SomeContentType` first. In situations like this where\nthe `Proxy` type can be statically determined, it is recommended to pull\nout the definition to the top level and make a declaration like:\n\n``` purescript\n_SomeContentType :: Proxy SomeContentType\n_SomeContentType = Proxy\n```\n\nThat way the proxy value can be used as `responseType _SomeContentType`\nfor improved readability. However, this is not always possible, sometimes\nthe type required will be determined by a type variable. As PureScript has\nscoped type variables, we can do things like this:\n\n``` purescript\nmakeRequest :: URL -> ResponseType -> Aff _ Foreign\nmakeRequest = ...\n\nfetchData :: forall a. (AjaxResponse a) => URL -> Aff _ a\nfetchData url = fromResponse <$> makeRequest url (responseType (Proxy :: Proxy a))\n```\n","declarations":[{"children":[{"comments":null,"title":"Proxy","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null}],"comments":null,"title":"Proxy","info":{"declType":"data","dataDeclType":"data","typeArguments":[["a",null]]},"sourceSpan":{"start":[53,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Type/Proxy.purs","end":[53,21]}},{"children":[{"comments":null,"title":"Proxy2","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null}],"comments":null,"title":"Proxy2","info":{"declType":"data","dataDeclType":"data","typeArguments":[["f",null]]},"sourceSpan":{"start":[58,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Type/Proxy.purs","end":[58,23]}},{"children":[{"comments":null,"title":"Proxy3","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":null}],"comments":"Value proxy for kind `Type -> Type -> Type` types.\n**Deprecated as of v0.14.0 PureScript release**: use `Proxy` instead.\n","title":"Proxy3","info":{"declType":"data","dataDeclType":"data","typeArguments":[["a",{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Type"]}]},{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeApp","contents":[{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Function"]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Type"]}]},{"annotation":[],"tag":"TypeConstructor","contents":[["Prim"],"Type"]}]}]}]]},"sourceSpan":{"start":[62,1],"name":"/Users/trh/Desktop/release/purescript-prelude/src/Type/Proxy.purs","end":[62,49]}}]}],"resolvedDependencies":{},"version":"5.0.1","github":["purescript","purescript-prelude"],"versionTag":"v5.0.1","moduleMap":{},"compilerVersion":"0.14.0"}
+ tests/purs/docs/bower.json view
@@ -0,0 +1,21 @@+{+ "name": "docs-test-package",+ "version": "1.0.0",+ "moduleType": [+ "node"+ ],+ "repository": {+ "type": "git",+ "url": "git://github.com/not-real/not-a-real-repo.git"+ },+ "ignore": [+ "**/.*",+ "node_modules",+ "bower_components",+ "output"+ ],+ "dependencies": {+ "purescript-prelude": "./bower_components/purescript-prelude"+ },+ "license": "MIT"+}
+ tests/purs/docs/bower_components/purescript-newtype/src/Data/Newtype.purs view
@@ -0,0 +1,6 @@+module Data.Newtype where++import Prim.Coerce (class Coercible)++class Newtype :: Type -> Type -> Constraint+class Coercible t a <= Newtype t a | t -> a
+ tests/purs/docs/bower_components/purescript-prelude/src/Prelude.purs view
@@ -0,0 +1,8 @@+module Prelude where++newtype Unit = Unit {}++unit :: Unit+unit = Unit {}++data Boolean2 = True | False
+ tests/purs/docs/output/Ado/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[9,16],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/Ado.purs","start":[4,1]},"title":"test"}],"name":"Ado","reExports":[]}
+ tests/purs/docs/output/ChildDeclOrder/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":{"end":[8,10],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/ChildDeclOrder.purs","start":[8,3]},"title":"First"},{"comments":null,"info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":{"end":[9,11],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/ChildDeclOrder.purs","start":[9,3]},"title":"Second"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["ChildDeclOrder"],"Show"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["ChildDeclOrder"],"Two"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[19,15],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/ChildDeclOrder.purs","start":[18,1]},"title":"showTwo"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["ChildDeclOrder"],"Foo"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["ChildDeclOrder"],"Two"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[23,16],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/ChildDeclOrder.purs","start":[21,1]},"title":"fooTwo"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":[],"typeArguments":[]},"kind":null,"sourceSpan":{"end":[9,11],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/ChildDeclOrder.purs","start":[7,1]},"title":"Two"},{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[12,22],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/ChildDeclOrder.purs","start":[12,3]},"title":"show"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["ChildDeclOrder"],"Show"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["ChildDeclOrder"],"Two"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[19,15],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/ChildDeclOrder.purs","start":[18,1]},"title":"showTwo"}],"comments":null,"info":{"arguments":[["a",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[12,22],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/ChildDeclOrder.purs","start":[11,1]},"title":"Show"},{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":"a","tag":"TypeVar"}},"sourceSpan":{"end":[15,12],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/ChildDeclOrder.purs","start":[15,3]},"title":"foo1"},{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":"a","tag":"TypeVar"}},"sourceSpan":{"end":[16,12],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/ChildDeclOrder.purs","start":[16,3]},"title":"foo2"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["ChildDeclOrder"],"Foo"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["ChildDeclOrder"],"Two"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[23,16],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/ChildDeclOrder.purs","start":[21,1]},"title":"fooTwo"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["ChildDeclOrder"],"Foo"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[27,11],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/ChildDeclOrder.purs","start":[25,1]},"title":"fooInt"}],"comments":null,"info":{"arguments":[["a",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[16,12],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/ChildDeclOrder.purs","start":[14,1]},"title":"Foo"}],"name":"ChildDeclOrder","reExports":[]}
+ tests/purs/docs/output/Clash/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[],"name":"Clash","reExports":[]}
+ tests/purs/docs/output/Clash1/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[],"name":"Clash1","reExports":[]}
+ tests/purs/docs/output/Clash1a/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[3,13],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/Clash1a.purs","start":[3,1]},"title":"value"},{"children":[],"comments":null,"info":{"arguments":[],"declType":"typeSynonym","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[6,17],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/Clash1a.purs","start":[6,1]},"title":"Type'"},{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":"a","tag":"TypeVar"}},"sourceSpan":{"end":[9,23],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/Clash1a.purs","start":[9,3]},"title":"typeClassMember"}],"comments":null,"info":{"arguments":[["a",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[9,23],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/Clash1a.purs","start":[8,1]},"title":"TypeClass"}],"name":"Clash1a","reExports":[]}
+ tests/purs/docs/output/Clash2/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[],"name":"Clash2","reExports":[]}
+ tests/purs/docs/output/Clash2a/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[3,16],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/Clash2a.purs","start":[3,1]},"title":"value"},{"children":[],"comments":null,"info":{"arguments":[],"declType":"typeSynonym","type":{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[6,20],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/Clash2a.purs","start":[6,1]},"title":"Type'"},{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}},"sourceSpan":{"end":[9,28],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/Clash2a.purs","start":[9,3]},"title":"typeClassMember"}],"comments":null,"info":{"arguments":[["a",null],["b",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[9,28],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/Clash2a.purs","start":[8,1]},"title":"TypeClass"}],"name":"Clash2a","reExports":[]}
+ tests/purs/docs/output/ConstrainedArgument/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[],"comments":null,"info":{"arguments":[["t",{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[3,22],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/ConstrainedArgument.purs","start":[3,1]},"title":"Foo"},{"children":[],"comments":null,"info":{"arguments":[],"declType":"typeSynonym","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[],"constraintClass":[["Prim"],"Partial"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"ConstrainedType"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[5,54],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/ConstrainedArgument.purs","start":[5,1]},"title":"WithoutArgs"},{"children":[],"comments":null,"info":{"arguments":[],"declType":"typeSynonym","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["ConstrainedArgument"],"Foo"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"ConstrainedType"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[6,52],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/ConstrainedArgument.purs","start":[6,1]},"title":"WithArgs"},{"children":[],"comments":null,"info":{"arguments":[],"declType":"typeSynonym","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[],"constraintClass":[["Prim"],"Partial"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[],"constraintClass":[["Prim"],"Partial"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[7,65],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/ConstrainedArgument.purs","start":[7,1]},"title":"MultiWithoutArgs"},{"children":[],"comments":null,"info":{"arguments":[],"declType":"typeSynonym","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["ConstrainedArgument"],"Foo"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"b","tag":"TypeVar"}],"constraintClass":[["ConstrainedArgument"],"Foo"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[8,63],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/ConstrainedArgument.purs","start":[8,1]},"title":"MultiWithArgs"}],"name":"ConstrainedArgument","reExports":[]}
+ tests/purs/docs/output/Data.Newtype/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[],"comments":null,"info":{"arguments":[["t",null],["a",null]],"declType":"typeClass","fundeps":[[["t"],["a"]]],"superclasses":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"t","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Prim","Coerce"],"Coercible"],"constraintData":null,"constraintKindArgs":[]}]},"kind":null,"sourceSpan":{"end":[6,44],"name":"bower_components/purescript-newtype/src/Data/Newtype.purs","start":[6,1]},"title":"Newtype"}],"name":"Data.Newtype","reExports":[]}
+ tests/purs/docs/output/DeclOrder/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[],"comments":null,"info":{"arguments":[],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[16,8],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DeclOrder.purs","start":[16,1]},"title":"A"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[10,7],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DeclOrder.purs","start":[10,1]},"title":"x1"},{"children":[],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":[],"typeArguments":[]},"kind":null,"sourceSpan":{"end":[13,8],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DeclOrder.purs","start":[13,1]},"title":"X2"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[11,7],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DeclOrder.purs","start":[11,1]},"title":"x3"},{"children":[],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":[],"typeArguments":[]},"kind":null,"sourceSpan":{"end":[14,8],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DeclOrder.purs","start":[14,1]},"title":"X4"},{"children":[],"comments":null,"info":{"arguments":[],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[17,8],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DeclOrder.purs","start":[17,1]},"title":"B"}],"name":"DeclOrder","reExports":[]}
+ tests/purs/docs/output/DeclOrderNoExportList/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[3,7],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DeclOrderNoExportList.purs","start":[3,1]},"title":"x1"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[4,7],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DeclOrderNoExportList.purs","start":[4,1]},"title":"x3"},{"children":[],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":[],"typeArguments":[]},"kind":null,"sourceSpan":{"end":[6,8],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DeclOrderNoExportList.purs","start":[6,1]},"title":"X2"},{"children":[],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":[],"typeArguments":[]},"kind":null,"sourceSpan":{"end":[7,8],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DeclOrderNoExportList.purs","start":[7,1]},"title":"X4"},{"children":[],"comments":null,"info":{"arguments":[],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[9,8],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DeclOrderNoExportList.purs","start":[9,1]},"title":"A"},{"children":[],"comments":null,"info":{"arguments":[],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[10,8],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DeclOrderNoExportList.purs","start":[10,1]},"title":"B"}],"name":"DeclOrderNoExportList","reExports":[]}
+ tests/purs/docs/output/Desugar/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"declType":"dataConstructor"},"sourceSpan":{"end":[3,15],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/Desugar.purs","start":[3,12]},"title":"X"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Representational","Representational"],"typeArguments":[["a",null],["b",null]]},"kind":null,"sourceSpan":{"end":[3,19],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/Desugar.purs","start":[3,1]},"title":"X"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Desugar"],"X"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[5,38],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/Desugar.purs","start":[5,1]},"title":"test"}],"name":"Desugar","reExports":[]}
+ tests/purs/docs/output/DocComments/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[],"comments":"This declaration has a code block:\n\n example == 0\n\nHere we are really testing that the leading whitespace is not stripped, as\nthis ensures that we don't accidentally change code blocks into normal\nparagraphs.\n","info":{"declType":"value","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[10,15],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocComments.purs","start":[10,1]},"title":"example"}],"name":"DocComments","reExports":[]}
+ tests/purs/docs/output/DocCommentsClassMethod/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":"class method comment\n","info":{"declType":"typeClassMember","type":{"annotation":[],"contents":"a","tag":"TypeVar"}},"sourceSpan":{"end":[5,11],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsClassMethod.purs","start":[5,3]},"title":"bar"},{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}},"sourceSpan":{"end":[6,21],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsClassMethod.purs","start":[6,3]},"title":"baz"}],"comments":null,"info":{"arguments":[["a",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[6,21],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsClassMethod.purs","start":[3,1]},"title":"Foo"}],"name":"DocCommentsClassMethod","reExports":[]}
+ tests/purs/docs/output/DocCommentsDataConstructor/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":"data constructor comment\n","info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":{"end":[5,8],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsDataConstructor.purs","start":[5,3]},"title":"Bar"},{"comments":null,"info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":{"end":[6,8],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsDataConstructor.purs","start":[6,3]},"title":"Baz"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":[],"typeArguments":[]},"kind":null,"sourceSpan":{"end":[6,8],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsDataConstructor.purs","start":[3,1]},"title":"Foo"},{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"declType":"dataConstructor"},"sourceSpan":{"end":[9,15],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsDataConstructor.purs","start":[9,3]},"title":"ComplexBar"},{"comments":"another data constructor comment\n","info":{"arguments":[{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"declType":"dataConstructor"},"sourceSpan":{"end":[11,15],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsDataConstructor.purs","start":[11,3]},"title":"ComplexBaz"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Representational","Representational"],"typeArguments":[["a",null],["b",null]]},"kind":null,"sourceSpan":{"end":[11,19],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsDataConstructor.purs","start":[8,1]},"title":"ComplexFoo"},{"children":[{"comments":"newtype data constructor comment\n","info":{"arguments":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":["newtypeBar",{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"},{"annotation":[],"tag":"REmpty"}],"tag":"RCons"}],"tag":"TypeApp"}],"declType":"dataConstructor"},"sourceSpan":{"end":[15,40],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsDataConstructor.purs","start":[15,3]},"title":"NewtypeFoo"}],"comments":null,"info":{"dataDeclType":"newtype","declType":"data","roles":[],"typeArguments":[]},"kind":null,"sourceSpan":{"end":[15,40],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsDataConstructor.purs","start":[13,1]},"title":"NewtypeFoo"}],"name":"DocCommentsDataConstructor","reExports":[]}
+ tests/purs/docs/output/DocCommentsMerge/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":{"end":[4,25],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsMerge.purs","start":[4,15]},"title":"DataOnly"}],"comments":"decl\n","info":{"dataDeclType":"data","declType":"data","roles":[],"typeArguments":[]},"kind":null,"sourceSpan":{"end":[4,25],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsMerge.purs","start":[4,1]},"title":"DataOnly"},{"children":[{"comments":null,"info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":{"end":[8,33],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsMerge.purs","start":[8,19]},"title":"KindOnlyData"}],"comments":"kind\n","info":{"dataDeclType":"data","declType":"data","roles":[],"typeArguments":[]},"kind":null,"sourceSpan":{"end":[8,33],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsMerge.purs","start":[8,1]},"title":"KindOnlyData"},{"children":[{"comments":null,"info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":{"end":[13,31],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsMerge.purs","start":[13,18]},"title":"KindAndData"}],"comments":"kind\n\ndecl\n","info":{"dataDeclType":"data","declType":"data","roles":[],"typeArguments":[]},"kind":null,"sourceSpan":{"end":[13,31],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsMerge.purs","start":[13,1]},"title":"KindAndData"},{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"declType":"dataConstructor"},"sourceSpan":{"end":[15,37],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsMerge.purs","start":[15,23]},"title":"DataRoleOnly"}],"comments":"role\n","info":{"dataDeclType":"data","declType":"data","roles":["Representational","Representational"],"typeArguments":[["a",null],["b",null]]},"kind":null,"sourceSpan":{"end":[15,41],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsMerge.purs","start":[15,1]},"title":"DataRoleOnly"},{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"declType":"dataConstructor"},"sourceSpan":{"end":[20,35],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsMerge.purs","start":[20,22]},"title":"DataAndRole"}],"comments":"decl\n\nrole\n","info":{"dataDeclType":"data","declType":"data","roles":["Representational","Representational"],"typeArguments":[["a",null],["b",null]]},"kind":null,"sourceSpan":{"end":[20,39],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsMerge.purs","start":[20,1]},"title":"DataAndRole"},{"children":[{"comments":null,"info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":{"end":[26,51],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsMerge.purs","start":[26,29]},"title":"KindOnlyDataRoleOnly"}],"comments":"kind\n\nrole\n","info":{"dataDeclType":"data","declType":"data","roles":["Representational"],"typeArguments":[["a",null]]},"kind":null,"sourceSpan":{"end":[26,51],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsMerge.purs","start":[26,1]},"title":"KindOnlyDataRoleOnly"},{"children":[{"comments":null,"info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":{"end":[33,41],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsMerge.purs","start":[33,24]},"title":"KindDataAndRole"}],"comments":"kind\n\ndecl\n\nrole\n","info":{"dataDeclType":"data","declType":"data","roles":["Representational"],"typeArguments":[["a",null]]},"kind":null,"sourceSpan":{"end":[33,41],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsMerge.purs","start":[33,1]},"title":"KindDataAndRole"},{"children":[],"comments":"decl\n","info":{"dataDeclType":"data","declType":"data","roles":[],"typeArguments":[]},"kind":null,"sourceSpan":{"end":[40,36],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsMerge.purs","start":[40,1]},"title":"FFIOnly"},{"children":[],"comments":"role\n","info":{"dataDeclType":"data","declType":"data","roles":["Representational"],"typeArguments":[["t0",null]]},"kind":null,"sourceSpan":{"end":[42,48],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsMerge.purs","start":[42,1]},"title":"FFIRoleOnly"},{"children":[],"comments":"decl\n\nrole\n","info":{"dataDeclType":"data","declType":"data","roles":["Representational"],"typeArguments":[["t0",null]]},"kind":null,"sourceSpan":{"end":[47,47],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsMerge.purs","start":[47,1]},"title":"FFIAndRole"},{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"declType":"dataConstructor"},"sourceSpan":{"end":[54,38],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsMerge.purs","start":[54,21]},"title":"NewtypeOnly"}],"comments":"decl\n","info":{"dataDeclType":"newtype","declType":"data","roles":[],"typeArguments":[]},"kind":null,"sourceSpan":{"end":[54,38],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsMerge.purs","start":[54,1]},"title":"NewtypeOnly"},{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"declType":"dataConstructor"},"sourceSpan":{"end":[58,46],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsMerge.purs","start":[58,25]},"title":"KindOnlyNewtype"}],"comments":"kind\n","info":{"dataDeclType":"newtype","declType":"data","roles":[],"typeArguments":[]},"kind":null,"sourceSpan":{"end":[58,46],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsMerge.purs","start":[58,1]},"title":"KindOnlyNewtype"},{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"declType":"dataConstructor"},"sourceSpan":{"end":[63,48],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsMerge.purs","start":[63,28]},"title":"KindAndNewtype"}],"comments":"kind\n\ndecl\n","info":{"dataDeclType":"newtype","declType":"data","roles":["Phantom","Phantom"],"typeArguments":[["a",null],["b",null]]},"kind":null,"sourceSpan":{"end":[63,48],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsMerge.purs","start":[63,1]},"title":"KindAndNewtype"},{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"declType":"dataConstructor"},"sourceSpan":{"end":[65,50],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsMerge.purs","start":[65,29]},"title":"NewtypeRoleOnly"}],"comments":"role\n","info":{"dataDeclType":"newtype","declType":"data","roles":["Representational","Representational"],"typeArguments":[["a",null],["b",null]]},"kind":{"keyword":"newtype","kind":{"annotation":[],"contents":{"identifier":"k1","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"k2","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k1","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k2","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[65,50],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsMerge.purs","start":[65,1]},"title":"NewtypeRoleOnly"},{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"declType":"dataConstructor"},"sourceSpan":{"end":[70,48],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsMerge.purs","start":[70,28]},"title":"NewtypeAndRole"}],"comments":"decl\n\nrole\n","info":{"dataDeclType":"newtype","declType":"data","roles":["Representational","Representational"],"typeArguments":[["a",null],["b",null]]},"kind":{"keyword":"newtype","kind":{"annotation":[],"contents":{"identifier":"k1","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"k2","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k1","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k2","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[70,48],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsMerge.purs","start":[70,1]},"title":"NewtypeAndRole"},{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"declType":"dataConstructor"},"sourceSpan":{"end":[76,66],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsMerge.purs","start":[76,37]},"title":"KindOnlyNewtypeRoleOnly"}],"comments":"kind\n\nrole\n","info":{"dataDeclType":"newtype","declType":"data","roles":["Representational","Representational"],"typeArguments":[["a",null],["b",null]]},"kind":null,"sourceSpan":{"end":[76,66],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsMerge.purs","start":[76,1]},"title":"KindOnlyNewtypeRoleOnly"},{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"declType":"dataConstructor"},"sourceSpan":{"end":[83,56],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsMerge.purs","start":[83,32]},"title":"KindNewtypeAndRole"}],"comments":"kind\n\ndecl\n\nrole\n","info":{"dataDeclType":"newtype","declType":"data","roles":["Representational","Representational"],"typeArguments":[["a",null],["b",null]]},"kind":null,"sourceSpan":{"end":[83,56],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsMerge.purs","start":[83,1]},"title":"KindNewtypeAndRole"},{"children":[],"comments":"decl\n","info":{"arguments":[],"declType":"typeSynonym","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[90,20],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsMerge.purs","start":[90,1]},"title":"TypeOnly"},{"children":[],"comments":"kind\n","info":{"arguments":[["a",null],["b",null]],"declType":"typeSynonym","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[94,28],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsMerge.purs","start":[94,1]},"title":"KindOnlyType"},{"children":[],"comments":"kind\n\ndecl\n","info":{"arguments":[["a",null],["b",null]],"declType":"typeSynonym","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[99,27],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsMerge.purs","start":[99,1]},"title":"KindAndType"},{"children":[],"comments":"decl\n","info":{"arguments":[],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[106,16],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsMerge.purs","start":[106,1]},"title":"ClassOnly"},{"children":[],"comments":"kind\n","info":{"arguments":[],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[110,20],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsMerge.purs","start":[110,1]},"title":"KindOnlyClass"},{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[116,33],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsMerge.purs","start":[116,3]},"title":"fooKindAndClass"}],"comments":"kind\n\ndecl\n","info":{"arguments":[["a",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[116,33],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DocCommentsMerge.purs","start":[115,1]},"title":"KindAndClass"}],"name":"DocCommentsMerge","reExports":[]}
+ tests/purs/docs/output/DuplicateNames/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[8,12],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/DuplicateNames.purs","start":[8,1]},"title":"unit"}],"name":"DuplicateNames","reExports":[]}
+ tests/purs/docs/output/Example/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[],"name":"Example","reExports":[]}
+ tests/purs/docs/output/Example2/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[3,11],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/Example2.purs","start":[3,1]},"title":"one"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[6,11],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/Example2.purs","start":[6,1]},"title":"two"}],"name":"Example2","reExports":[]}
+ tests/purs/docs/output/ExplicitExport/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[3,11],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/ExplicitExport.purs","start":[3,1]},"title":"one"}],"name":"ExplicitExport","reExports":[]}
+ tests/purs/docs/output/ExplicitTypeSignatures/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"something","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"something","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"something","tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[6,53],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/ExplicitTypeSignatures.purs","start":[6,1]},"title":"explicit"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[12,11],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/ExplicitTypeSignatures.purs","start":[12,1]},"title":"anInt"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":[["Prim"],"Number"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[16,14],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/ExplicitTypeSignatures.purs","start":[16,1]},"title":"aNumber"}],"name":"ExplicitTypeSignatures","reExports":[]}
+ tests/purs/docs/output/ImportedTwice/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[],"name":"ImportedTwice","reExports":[]}
+ tests/purs/docs/output/ImportedTwiceA/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[],"name":"ImportedTwiceA","reExports":[]}
+ tests/purs/docs/output/ImportedTwiceB/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[3,11],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/ImportedTwiceB.purs","start":[3,1]},"title":"foo"}],"name":"ImportedTwiceB","reExports":[]}
+ tests/purs/docs/output/KindSignatureDocs/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":{"end":[4,35],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[4,21]},"title":"DKindAndType"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Phantom"],"typeArguments":[["a",null]]},"kind":{"keyword":"data","kind":{"annotation":[],"contents":{"identifier":"k","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[4,35],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[4,1]},"title":"DKindAndType"},{"children":[],"comments":null,"info":{"arguments":[["a",null]],"declType":"typeSynonym","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":{"keyword":"type","kind":{"annotation":[],"contents":{"identifier":"k","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[7,26],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[7,1]},"title":"TKindAndType"},{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"declType":"dataConstructor"},"sourceSpan":{"end":[10,42],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[10,24]},"title":"NKindAndType"}],"comments":null,"info":{"dataDeclType":"newtype","declType":"data","roles":["Phantom"],"typeArguments":[["a",null]]},"kind":{"keyword":"newtype","kind":{"annotation":[],"contents":{"identifier":"k","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[10,42],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[10,1]},"title":"NKindAndType"},{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[14,34],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[14,3]},"title":"fooKindAndType"}],"comments":null,"info":{"arguments":[["a",null],["k",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":{"keyword":"class","kind":{"annotation":[],"contents":{"identifier":"k","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Constraint"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[14,34],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[13,1]},"title":"CKindAndType"},{"children":[{"comments":null,"info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":{"end":[19,29],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[19,18]},"title":"DKindOnly"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Phantom"],"typeArguments":[["a",null]]},"kind":{"keyword":"data","kind":{"annotation":[],"contents":{"identifier":"k","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[19,29],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[19,1]},"title":"DKindOnly"},{"children":[],"comments":null,"info":{"arguments":[["a",null]],"declType":"typeSynonym","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":{"keyword":"type","kind":{"annotation":[],"contents":{"identifier":"k","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[22,23],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[22,1]},"title":"TKindOnly"},{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"declType":"dataConstructor"},"sourceSpan":{"end":[25,36],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[25,21]},"title":"NKindOnly"}],"comments":null,"info":{"dataDeclType":"newtype","declType":"data","roles":["Phantom"],"typeArguments":[["a",null]]},"kind":{"keyword":"newtype","kind":{"annotation":[],"contents":{"identifier":"k","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[25,36],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[25,1]},"title":"NKindOnly"},{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[29,31],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[29,3]},"title":"fooKindOnly"}],"comments":null,"info":{"arguments":[["a",null],["k",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":{"keyword":"class","kind":{"annotation":[],"contents":{"identifier":"k","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Constraint"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[29,31],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[28,1]},"title":"CKindOnly"},{"children":[{"comments":null,"info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":{"end":[34,29],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[34,18]},"title":"DTypeOnly"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Phantom"],"typeArguments":[["a",null]]},"kind":{"keyword":"data","kind":{"annotation":[],"contents":{"identifier":"k","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[34,29],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[34,1]},"title":"DTypeOnly"},{"children":[],"comments":null,"info":{"arguments":[["a",null]],"declType":"typeSynonym","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":{"keyword":"type","kind":{"annotation":[],"contents":{"identifier":"k","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[37,23],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[37,1]},"title":"TTypeOnly"},{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"declType":"dataConstructor"},"sourceSpan":{"end":[40,36],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[40,21]},"title":"NTypeOnly"}],"comments":null,"info":{"dataDeclType":"newtype","declType":"data","roles":["Phantom"],"typeArguments":[["a",null]]},"kind":{"keyword":"newtype","kind":{"annotation":[],"contents":{"identifier":"k","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[40,36],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[40,1]},"title":"NTypeOnly"},{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[44,31],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[44,3]},"title":"fooTypeOnly"}],"comments":null,"info":{"arguments":[["a",null],["k",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":{"keyword":"class","kind":{"annotation":[],"contents":{"identifier":"k","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Constraint"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[44,31],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[43,1]},"title":"CTypeOnly"},{"children":[{"comments":null,"info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":{"end":[48,29],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[48,18]},"title":"DImplicit"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Phantom"],"typeArguments":[["a",null]]},"kind":{"keyword":"data","kind":{"annotation":[],"contents":{"identifier":"k","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[48,29],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[48,1]},"title":"DImplicit"},{"children":[],"comments":null,"info":{"arguments":[["a",null]],"declType":"typeSynonym","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":{"keyword":"type","kind":{"annotation":[],"contents":{"identifier":"k","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[50,23],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[50,1]},"title":"TImplicit"},{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"declType":"dataConstructor"},"sourceSpan":{"end":[52,36],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[52,21]},"title":"NImplicit"}],"comments":null,"info":{"dataDeclType":"newtype","declType":"data","roles":["Phantom"],"typeArguments":[["a",null]]},"kind":{"keyword":"newtype","kind":{"annotation":[],"contents":{"identifier":"k","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[52,36],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[52,1]},"title":"NImplicit"},{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[55,31],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[55,3]},"title":"fooImplicit"}],"comments":null,"info":{"arguments":[["a",null],["k",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":{"keyword":"class","kind":{"annotation":[],"contents":{"identifier":"k1","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k1","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k1","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Constraint"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[55,31],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[54,1]},"title":"CImplicit"},{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"declType":"dataConstructor"},"sourceSpan":{"end":[59,29],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[59,20]},"title":"DHidden"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Representational","Representational","Representational"],"typeArguments":[["a",null],["b",null],["c",null]]},"kind":null,"sourceSpan":{"end":[59,35],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[59,1]},"title":"DHidden"},{"children":[],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":[],"typeArguments":[]},"kind":null,"sourceSpan":{"end":[61,14],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[61,1]},"title":"DNothing"},{"children":[],"comments":null,"info":{"arguments":[["a",null],["b",null],["c",null]],"declType":"typeSynonym","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["KindSignatureDocs"],"DHidden"],"tag":"TypeConstructor"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}},"kind":null,"sourceSpan":{"end":[63,35],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[63,1]},"title":"THidden"},{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["KindSignatureDocs"],"DHidden"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"declType":"dataConstructor"},"sourceSpan":{"end":[65,48],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[65,23]},"title":"NHidden"}],"comments":null,"info":{"dataDeclType":"newtype","declType":"data","roles":["Representational","Representational","Representational"],"typeArguments":[["a",null],["b",null],["c",null]]},"kind":null,"sourceSpan":{"end":[65,48],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[65,1]},"title":"NHidden"},{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[68,37],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[68,3]},"title":"fooHidden"}],"comments":null,"info":{"arguments":[["a",null],["b",null],["c",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[68,37],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[67,1]},"title":"CHidden"},{"children":[],"comments":null,"info":{"arguments":[],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[70,15],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[70,1]},"title":"CNothing"},{"children":[],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Nominal","Nominal"],"typeArguments":[["t0",null],["t1",null]]},"kind":null,"sourceSpan":{"end":[74,55],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[74,1]},"title":"FFI_Hidden"},{"children":[],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Nominal"],"typeArguments":[["t0",null]]},"kind":{"keyword":"data","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[75,56],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[75,1]},"title":"FFI_Shown"},{"children":[],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Nominal"],"typeArguments":[["t0",null]]},"kind":null,"sourceSpan":{"end":[79,63],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[79,1]},"title":"FFI_RedundantParenthesis"},{"children":[{"comments":null,"info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":{"end":[82,59],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[82,33]},"title":"DataRedundantParenthesis"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Phantom"],"typeArguments":[["a",null]]},"kind":null,"sourceSpan":{"end":[82,59],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[82,1]},"title":"DataRedundantParenthesis"},{"children":[],"comments":null,"info":{"arguments":[["a",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[85,34],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[85,1]},"title":"ClassRedundantParenthesis"},{"children":[{"comments":null,"info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":{"end":[88,41],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[88,25]},"title":"DataHeadParens"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Phantom","Phantom"],"typeArguments":[["a",null],["b",null]]},"kind":null,"sourceSpan":{"end":[88,41],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[88,1]},"title":"DataHeadParens"},{"children":[{"comments":null,"info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":{"end":[91,41],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[91,25]},"title":"DataTailParens"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Phantom","Phantom"],"typeArguments":[["a",null],["b",null]]},"kind":null,"sourceSpan":{"end":[91,41],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[91,1]},"title":"DataTailParens"},{"children":[{"comments":null,"info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":{"end":[94,43],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[94,26]},"title":"DataWholeParens"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Phantom","Phantom"],"typeArguments":[["a",null],["b",null]]},"kind":null,"sourceSpan":{"end":[94,43],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[94,1]},"title":"DataWholeParens"},{"children":[{"comments":null,"info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":{"end":[97,37],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[97,21]},"title":"DataSelfParens"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":[],"typeArguments":[]},"kind":null,"sourceSpan":{"end":[97,37],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[97,1]},"title":"DataSelfParens"},{"children":[],"comments":null,"info":{"arguments":[],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[100,22],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[100,1]},"title":"ClassSelfParens"},{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"declType":"dataConstructor"},"sourceSpan":{"end":[102,57],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[102,37]},"title":"DataKindAnnotation"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Representational"],"typeArguments":[["a",{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}]]},"kind":null,"sourceSpan":{"end":[102,59],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[102,1]},"title":"DataKindAnnotation"},{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"declType":"dataConstructor"},"sourceSpan":{"end":[104,79],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[104,49]},"title":"DataKindAnnotationWithParens"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Representational"],"typeArguments":[["a",{"annotation":[],"contents":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"tag":"ParensInType"}]]},"kind":null,"sourceSpan":{"end":[104,81],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[104,1]},"title":"DataKindAnnotationWithParens"},{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"declType":"dataConstructor"},"sourceSpan":{"end":[107,41],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[107,24]},"title":"FunctionParens1"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Representational"],"typeArguments":[["a",null]]},"kind":null,"sourceSpan":{"end":[107,43],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[107,1]},"title":"FunctionParens1"},{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"declType":"dataConstructor"},"sourceSpan":{"end":[110,41],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[110,24]},"title":"FunctionParens2"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Representational"],"typeArguments":[["a",null]]},"kind":null,"sourceSpan":{"end":[110,43],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[110,1]},"title":"FunctionParens2"},{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"declType":"dataConstructor"},"sourceSpan":{"end":[113,41],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[113,24]},"title":"FunctionParens3"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Representational"],"typeArguments":[["a",null]]},"kind":null,"sourceSpan":{"end":[113,43],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[113,1]},"title":"FunctionParens3"},{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"tag":"ParensInType"},{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"declType":"dataConstructor"},"sourceSpan":{"end":[116,27],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[116,19]},"title":"DShown"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Representational","Representational","Representational"],"typeArguments":[["a",null],["b",null],["f",null]]},"kind":{"keyword":"data","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[116,39],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[116,1]},"title":"DShown"},{"children":[],"comments":null,"info":{"arguments":[["f",null],["b",null],["c",null]],"declType":"typeSynonym","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["KindSignatureDocs"],"DShown"],"tag":"TypeConstructor"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"f","tag":"TypeVar"}],"tag":"TypeApp"}},"kind":{"keyword":"type","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[118,33],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[118,1]},"title":"TShown"},{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["KindSignatureDocs"],"DShown"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"f","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"declType":"dataConstructor"},"sourceSpan":{"end":[120,45],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[120,22]},"title":"NShown"}],"comments":null,"info":{"dataDeclType":"newtype","declType":"data","roles":["Representational","Representational","Representational"],"typeArguments":[["a",null],["f",null],["c",null]]},"kind":{"keyword":"newtype","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[120,45],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[120,1]},"title":"NShown"},{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[123,40],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[123,3]},"title":"fooShown"}],"comments":null,"info":{"arguments":[["f",null],["a",null],["b",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":{"keyword":"class","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Constraint"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[123,40],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/KindSignatureDocs.purs","start":[122,1]},"title":"CShown"}],"name":"KindSignatureDocs","reExports":[]}
+ tests/purs/docs/output/MultiVirtual/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[],"name":"MultiVirtual","reExports":[]}
+ tests/purs/docs/output/MultiVirtual1/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[3,11],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/MultiVirtual1.purs","start":[3,1]},"title":"foo"}],"name":"MultiVirtual1","reExports":[]}
+ tests/purs/docs/output/MultiVirtual2/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[8,11],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/MultiVirtual2.purs","start":[8,1]},"title":"bar"}],"name":"MultiVirtual2","reExports":[]}
+ tests/purs/docs/output/MultiVirtual3/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[3,11],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/MultiVirtual3.purs","start":[3,1]},"title":"baz"}],"name":"MultiVirtual3","reExports":[]}
+ tests/purs/docs/output/NewOperators/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[],"name":"NewOperators","reExports":[]}
+ tests/purs/docs/output/NewOperators2/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[],"comments":null,"info":{"alias":[["NewOperators2"],{"Right":{"Left":{"Ident":"_compose"}}}],"declType":"alias","fixity":{"associativity":"infixl","precedence":8}},"kind":null,"sourceSpan":{"end":[3,25],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/NewOperators2.purs","start":[3,1]},"title":"(>>>)"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"c","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[5,59],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/NewOperators2.purs","start":[5,1]},"title":"_compose"}],"name":"NewOperators2","reExports":[]}
+ tests/purs/docs/output/NotAllCtors/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[],"name":"NotAllCtors","reExports":[]}
+ tests/purs/docs/output/OperatorSection/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":{"end":[3,18],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/OperatorSection.purs","start":[3,13]},"title":"Nil"},{"comments":null,"info":{"arguments":[{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[["OperatorSection"],"List"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"declType":"dataConstructor"},"sourceSpan":{"end":[3,25],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/OperatorSection.purs","start":[3,19]},"title":"Cons"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["OperatorSection"],"Foldable"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["OperatorSection"],"List"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[16,21],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/OperatorSection.purs","start":[10,1]},"title":"<anonymous>"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Representational"],"typeArguments":[["a",null]]},"kind":null,"sourceSpan":{"end":[3,36],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/OperatorSection.purs","start":[3,1]},"title":"List"},{"children":[],"comments":null,"info":{"alias":[["OperatorSection"],{"Right":{"Right":"Cons"}}],"declType":"alias","fixity":{"associativity":"infixr","precedence":6}},"kind":null,"sourceSpan":{"end":[5,19],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/OperatorSection.purs","start":[5,1]},"title":"(:)"},{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[8,54],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/OperatorSection.purs","start":[8,3]},"title":"foldl"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["OperatorSection"],"Foldable"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["OperatorSection"],"List"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[16,21],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/OperatorSection.purs","start":[10,1]},"title":"<anonymous>"}],"comments":null,"info":{"arguments":[["f",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":{"keyword":"class","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Constraint"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[8,54],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/OperatorSection.purs","start":[7,1]},"title":"Foldable"}],"name":"OperatorSection","reExports":[]}
+ tests/purs/docs/output/Prelude/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"tag":"REmpty"}],"tag":"TypeApp"}],"declType":"dataConstructor"},"sourceSpan":{"end":[3,23],"name":"bower_components/purescript-prelude/src/Prelude.purs","start":[3,14]},"title":"Unit"}],"comments":null,"info":{"dataDeclType":"newtype","declType":"data","roles":[],"typeArguments":[]},"kind":null,"sourceSpan":{"end":[3,23],"name":"bower_components/purescript-prelude/src/Prelude.purs","start":[3,1]},"title":"Unit"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":[["Prelude"],"Unit"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[5,13],"name":"bower_components/purescript-prelude/src/Prelude.purs","start":[5,1]},"title":"unit"},{"children":[{"comments":null,"info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":{"end":[8,21],"name":"bower_components/purescript-prelude/src/Prelude.purs","start":[8,15]},"title":"True"},{"comments":null,"info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":{"end":[8,29],"name":"bower_components/purescript-prelude/src/Prelude.purs","start":[8,22]},"title":"False"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":[],"typeArguments":[]},"kind":null,"sourceSpan":{"end":[8,29],"name":"bower_components/purescript-prelude/src/Prelude.purs","start":[8,1]},"title":"Boolean2"}],"name":"Prelude","reExports":[]}
+ tests/purs/docs/output/Prim.Boolean/docs.json view
@@ -0,0 +1,1 @@+{"comments":"The Prim.Boolean module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains a type level `Boolean` data structure.","declarations":[{"children":[],"comments":"The 'True' boolean type.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"True"},{"children":[],"comments":"The 'False' boolean type.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"False"}],"name":"Prim.Boolean","reExports":[]}
+ tests/purs/docs/output/Prim.Coerce/docs.json view
@@ -0,0 +1,1 @@+{"comments":"The Prim.Coerce module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains an automatically solved type class for coercing types that have provably-identical runtime representations with [purescript-safe-coerce](https://pursuit.purescript.org/packages/purescript-safe-coerce).","declarations":[{"children":[],"comments":"Coercible is a two-parameter type class that has instances for types `a`\nand `b` if the compiler can infer that they have the same representation.\nCoercible constraints are solved according to the following rules:\n\n* _reflexivity_, any type has the same representation as itself:\n`Coercible a a` holds.\n\n* _symmetry_, if a type `a` can be coerced to some other type `b`, then `b`\ncan also be coerced back to `a`: `Coercible a b` implies `Coercible b a`.\n\n* _transitivity_, if a type `a` can be coerced to some other type `b` which\ncan be coerced to some other type `c`, then `a` can also be coerced to `c`:\n`Coercible a b` and `Coercible b c` imply `Coercible a c`.\n\n* Newtypes can be freely wrapped and unwrapped when their constructor is\nin scope:\n\n newtype Age = Age Int\n\n`Coercible Int Age` and `Coercible Age Int` hold since `Age` has the same\nruntime representation than `Int`.\n\nNewtype constructors have to be in scope to preserve abstraction. It's\ncommon to declare a newtype to encode some invariants (non emptiness of\narrays with `Data.Array.NonEmpty.NonEmptyArray` for example), hide its\nconstructor and export smart constructors instead. Without this restriction,\nthe guarantees provided by such newtypes would be void.\n\n* If none of the above are applicable, two types of kind `Type` may be\ncoercible, but only if their heads are the same. For example,\n`Coercible (Maybe a) (Either a b)` does not hold because `Maybe` and\n`Either` are different. Those types don't share a common runtime\nrepresentation so coercing between them would be unsafe. In addition their\narguments may need to be identical or coercible, depending on the _roles_\nof the head's type parameters. Roles are documented in [the PureScript\nlanguage reference](https://github.com/purescript/documentation/blob/master/language/Roles.md).\n\nCoercible being polykinded, we can also coerce more than types of kind `Type`:\n\n* Rows are coercible when they have the same labels, when the corresponding\npairs of types are coercible and when their tails are coercible:\n`Coercible ( label :: a | r ) ( label :: b | s )` holds when\n`Coercible a b` and `Coercible r s` do. Closed rows cannot be coerced to\nopen rows.\n\n* Higher kinded types are coercible if they are coercible when fully\nsaturated: `Coercible (f :: _ -> Type) (g :: _ -> Type)` holds when\n`Coercible (f a) (g a)` does.\n\nThis rule may seem puzzling since there is no term of type `_ -> Type` to\napply `coerce` to, but it is necessary when coercing types with higher\nkinded parameters.\n","info":{"arguments":[["a",{"annotation":[],"contents":"k","tag":"TypeVar"}],["b",{"annotation":[],"contents":"k","tag":"TypeVar"}]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Coercible"}],"name":"Prim.Coerce","reExports":[]}
+ tests/purs/docs/output/Prim.Int/docs.json view
@@ -0,0 +1,1 @@+{"comments":"The Prim.Int module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains automatically solved type classes for working with type-level intural numbers.","declarations":[{"children":[],"comments":"Compiler solved type class for adding type-level `Int`s.\n","info":{"arguments":[["left",{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],["right",{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],["sum",{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}]],"declType":"typeClass","fundeps":[[["left","right"],["sum"]],[["left","sum"],["right"]],[["right","sum"],["left"]]],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Add"},{"children":[],"comments":"Compiler solved type class for comparing two type-level `Int`s.\nProduces an `Ordering`.\n","info":{"arguments":[["left",{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],["right",{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],["ordering",{"annotation":[],"contents":[["Prim","Ordering"],"Ordering"],"tag":"TypeConstructor"}]],"declType":"typeClass","fundeps":[[["left","right"],["ordering"]]],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Compare"},{"children":[],"comments":"Compiler solved type class for multiplying type-level `Int`s.\n","info":{"arguments":[["left",{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],["right",{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],["product",{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}]],"declType":"typeClass","fundeps":[[["left","right"],["product"]]],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Mul"},{"children":[],"comments":"Compiler solved type class for converting a type-level `Int` into a type-level `String` (i.e. `Symbol`).\n","info":{"arguments":[["int",{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],["string",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}]],"declType":"typeClass","fundeps":[[["int"],["string"]]],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"ToString"}],"name":"Prim.Int","reExports":[]}
+ tests/purs/docs/output/Prim.Ordering/docs.json view
@@ -0,0 +1,1 @@+{"comments":"The Prim.Ordering module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains a type level `Ordering` data structure.","declarations":[{"children":[],"comments":"The `Ordering` kind represents the three possibilities of comparing two\ntypes of the same kind: `LT` (less than), `EQ` (equal to), and\n`GT` (greater than).\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Ordering"},{"children":[],"comments":"The 'less than' ordering type.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim","Ordering"],"Ordering"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"LT"},{"children":[],"comments":"The 'equal to' ordering type.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim","Ordering"],"Ordering"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"EQ"},{"children":[],"comments":"The 'greater than' ordering type.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim","Ordering"],"Ordering"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"GT"}],"name":"Prim.Ordering","reExports":[]}
+ tests/purs/docs/output/Prim.Row/docs.json view
@@ -0,0 +1,1 @@+{"comments":"The Prim.Row module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains automatically solved type classes for working with row types.","declarations":[{"children":[],"comments":"The Union type class is used to compute the union of two rows of types\n(left-biased, including duplicates).\n\nThe third type argument represents the union of the first two.\n","info":{"arguments":[["left",{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}],["right",{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}],["union",{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}]],"declType":"typeClass","fundeps":[[["left","right"],["union"]],[["right","union"],["left"]],[["union","left"],["right"]]],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Union"},{"children":[],"comments":"The Nub type class is used to remove duplicate labels from rows.\n","info":{"arguments":[["original",{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}],["nubbed",{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}]],"declType":"typeClass","fundeps":[[["original"],["nubbed"]]],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Nub"},{"children":[],"comments":"The Lacks type class asserts that a label does not occur in a given row.\n","info":{"arguments":[["label",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],["row",{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Lacks"},{"children":[],"comments":"The Cons type class is a 4-way relation which asserts that one row of\ntypes can be obtained from another by inserting a new label/type pair on\nthe left.\n","info":{"arguments":[["label",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],["a",{"annotation":[],"contents":"k","tag":"TypeVar"}],["tail",{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}],["row",{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}]],"declType":"typeClass","fundeps":[[["label","a","tail"],["row"]],[["label","row"],["a","tail"]]],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Cons"}],"name":"Prim.Row","reExports":[]}
+ tests/purs/docs/output/Prim.RowList/docs.json view
@@ -0,0 +1,1 @@+{"comments":"The Prim.RowList module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains a type level list (`RowList`) that represents an ordered view of a row of types.","declarations":[{"children":[],"comments":"A type level list representation of a row of types.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"roles":[]},"kind":null,"sourceSpan":null,"title":"RowList"},{"children":[],"comments":"Constructs a new `RowList` from a label, a type, and an existing tail\n`RowList`. E.g: `Cons \"x\" Int (Cons \"y\" Int Nil)`.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":{"identifier":"k","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim","RowList"],"RowList"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim","RowList"],"RowList"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Cons"},{"children":[],"comments":"The empty `RowList`.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":{"identifier":"k","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim","RowList"],"RowList"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Nil"},{"children":[],"comments":"Compiler solved type class for generating a `RowList` from a closed row\nof types. Entries are sorted by label and duplicates are preserved in\nthe order they appeared in the row.\n","info":{"arguments":[["row",{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}],["list",{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim","RowList"],"RowList"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}]],"declType":"typeClass","fundeps":[[["row"],["list"]]],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"RowToList"}],"name":"Prim.RowList","reExports":[]}
+ tests/purs/docs/output/Prim.Symbol/docs.json view
@@ -0,0 +1,1 @@+{"comments":"The Prim.Symbol module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains automatically solved type classes for working with `Symbols`.","declarations":[{"children":[],"comments":"Compiler solved type class for appending `Symbol`s together.\n","info":{"arguments":[["left",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],["right",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],["appended",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}]],"declType":"typeClass","fundeps":[[["left","right"],["appended"]],[["right","appended"],["left"]],[["appended","left"],["right"]]],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Append"},{"children":[],"comments":"Compiler solved type class for comparing two `Symbol`s.\nProduces an `Ordering`.\n","info":{"arguments":[["left",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],["right",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],["ordering",{"annotation":[],"contents":[["Prim","Ordering"],"Ordering"],"tag":"TypeConstructor"}]],"declType":"typeClass","fundeps":[[["left","right"],["ordering"]]],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Compare"},{"children":[],"comments":"Compiler solved type class for either splitting up a symbol into its\nhead and tail or for combining a head and tail into a new symbol.\nRequires the head to be a single character and the combined string\ncannot be empty.\n","info":{"arguments":[["head",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],["tail",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],["symbol",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}]],"declType":"typeClass","fundeps":[[["head","tail"],["symbol"]],[["symbol"],["head","tail"]]],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Cons"}],"name":"Prim.Symbol","reExports":[]}
+ tests/purs/docs/output/Prim.TypeError/docs.json view
@@ -0,0 +1,1 @@+{"comments":"The Prim.TypeError module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains type classes that provide custom type error and warning functionality.","declarations":[{"children":[],"comments":"The Warn type class allows a custom compiler warning to be displayed.\n\nFor more information, see\n[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md).\n","info":{"arguments":[["message",{"annotation":[],"contents":[["Prim","TypeError"],"Doc"],"tag":"TypeConstructor"}]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Warn"},{"children":[],"comments":"The Fail type class is part of the custom type errors feature. To provide\na custom type error when someone tries to use a particular instance,\nwrite that instance out with a Fail constraint.\n\nFor more information, see\n[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md).\n","info":{"arguments":[["message",{"annotation":[],"contents":[["Prim","TypeError"],"Doc"],"tag":"TypeConstructor"}]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Fail"},{"children":[],"comments":"`Doc` is the kind of type-level documents.\n\nThis kind is used with the `Fail` and `Warn` type classes.\nBuild up a `Doc` with `Text`, `Quote`, `QuoteLabel`, `Beside`, and `Above`.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Doc"},{"children":[],"comments":"The Text type constructor makes a Doc from a Symbol\nto be used in a custom type error.\n\nFor more information, see\n[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md).\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim","TypeError"],"Doc"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Text"},{"children":[],"comments":"The Quote type constructor renders any concrete type as a Doc\nto be used in a custom type error.\n\nFor more information, see\n[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md).\n","info":{"declType":"externData","kind":{"annotation":[],"contents":{"identifier":"k","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim","TypeError"],"Doc"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Quote"},{"children":[],"comments":"The `QuoteLabel` type constructor will produce a `Doc` when given a `Symbol`. When the resulting `Doc` is rendered\nfor a `Warn` or `Fail` constraint, a syntactically valid label will be produced, escaping with quotes as needed.\n\nFor more information, see\n[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md).\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim","TypeError"],"Doc"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"roles":[]},"kind":null,"sourceSpan":null,"title":"QuoteLabel"},{"children":[],"comments":"The Beside type constructor combines two Docs horizontally\nto be used in a custom type error.\n\nFor more information, see\n[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md).\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim","TypeError"],"Doc"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim","TypeError"],"Doc"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim","TypeError"],"Doc"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Beside"},{"children":[],"comments":"The Above type constructor combines two Docs vertically\nin a custom type error.\n\nFor more information, see\n[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md).\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim","TypeError"],"Doc"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim","TypeError"],"Doc"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim","TypeError"],"Doc"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Above"}],"name":"Prim.TypeError","reExports":[]}
+ tests/purs/docs/output/Prim/docs.json view
@@ -0,0 +1,1 @@+{"comments":"The `Prim` module is embedded in the PureScript compiler in order to provide compiler support for certain types — for example, value literals, or syntax sugar. It is implicitly imported unqualified in every module except those that list it as a qualified import.\n\n`Prim` does not include additional built-in types and kinds that are defined deeper in the compiler such as Type wildcards (e.g. `f :: _ -> Int`) and Quantified Types. Rather, these are documented in [the PureScript language reference](https://github.com/purescript/documentation/blob/master/language/Types.md).\n","declarations":[{"children":[],"comments":"A function, which takes values of the type specified by the first type\nparameter, and returns values of the type specified by the second.\nIn the JavaScript backend, this is a standard JavaScript Function.\n\nThe type constructor `(->)` is syntactic sugar for this type constructor.\nIt is recommended to use `(->)` rather than `Function`, where possible.\n\nThat is, prefer this:\n\n f :: Number -> Number\n\nto either of these:\n\n f :: Function Number Number\n f :: (->) Number Number\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Function"},{"children":[],"comments":"An Array: a data structure supporting efficient random access. In\nthe JavaScript backend, values of this type are represented as JavaScript\nArrays at runtime.\n\nConstruct values using literals:\n\n x = [1,2,3,4,5] :: Array Int\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Array"},{"children":[],"comments":"The type of records whose fields are known at compile time. In the\nJavaScript backend, values of this type are represented as JavaScript\nObjects at runtime.\n\nThe type signature here means that the `Record` type constructor takes\na row of concrete types. For example:\n\n type Person = Record (name :: String, age :: Number)\n\nThe syntactic sugar with curly braces `{ }` is generally preferred, though:\n\n type Person = { name :: String, age :: Number }\n\nThe row associates a type to each label which appears in the record.\n\n_Technical note_: PureScript allows duplicate labels in rows, and the\nmeaning of `Record r` is based on the _first_ occurrence of each label in\nthe row `r`.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Record"},{"children":[],"comments":"A double precision floating point number (IEEE 754).\n\nConstruct values of this type with literals.\nNegative literals must be wrapped in parentheses if the negation sign could be mistaken\nfor an infix operator:\n\n x = 35.23 :: Number\n y = -1.224e6 :: Number\n z = exp (-1.0) :: Number\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Number"},{"children":[],"comments":"A 32-bit signed integer. See the `purescript-integers` package for details\nof how this is accomplished when compiling to JavaScript.\n\nConstruct values of this type with literals. Hexadecimal syntax is supported.\nNegative literals must be wrapped in parentheses if the negation sign could be mistaken\nfor an infix operator:\n\n x = -23 :: Int\n y = 0x17 :: Int\n z = complement (-24) :: Int\n\nIntegers used as types are considered to have kind `Int`.\nUnlike value-level `Int`s, which must be representable as a 32-bit signed integer,\ntype-level `Int`s are unbounded. Hexadecimal support is also supported at the type level.\n\n type One :: Int\n type One = 1\n \n type Beyond32BitSignedInt :: Int\n type Beyond32BitSignedInt = 2147483648\n \n type HexInt :: Int\n type HexInt = 0x17\n\nNegative integer literals at the type level must be\nwrapped in parentheses if the negation sign could be mistaken for an infix operator.\n\n type NegativeOne = -1\n foo :: Proxy (-1) -> ...\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Int"},{"children":[],"comments":"A String. As in JavaScript, String values represent sequences of UTF-16\ncode units, which are not required to form a valid encoding of Unicode\ntext (for example, lone surrogates are permitted).\n\nConstruct values of this type with literals, using double quotes `\"`:\n\n x = \"hello, world\" :: String\n\nMulti-line string literals are also supported with triple quotes (`\"\"\"`):\n\n x = \"\"\"multi\n line\"\"\"\n\nAt the type level, string literals represent types with kind `Symbol`.\nThese types will have kind `String` in a future release:\n\n type Hello :: Symbol\n type Hello = \"Hello, world\"\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"String"},{"children":[],"comments":"A single character (UTF-16 code unit). The JavaScript representation is a\nnormal `String`, which is guaranteed to contain one code unit. This means\nthat astral plane characters (i.e. those with code point values greater\nthan `0xFFFF`) cannot be represented as `Char` values.\n\nConstruct values of this type with literals, using single quotes `'`:\n\n x = 'a' :: Char\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Char"},{"children":[],"comments":"A JavaScript Boolean value.\n\nConstruct values of this type with the literals `true` and `false`.\n\nThe `True` and `False` types defined in `Prim.Boolean` have this type as their kind.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Boolean"},{"children":[],"comments":"The Partial type class is used to indicate that a function is *partial,*\nthat is, it is not defined for all inputs. In practice, attempting to use\na partial function with a bad input will usually cause an error to be\nthrown, although it is not safe to assume that this will happen in all\ncases. For more information, see\n[purescript-partial](https://pursuit.purescript.org/packages/purescript-partial/).\n","info":{"arguments":[],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Partial"},{"children":[],"comments":"`Type` is the kind of all proper types: those that classify value-level terms.\nFor example the type `Boolean` has kind `Type`; denoted by `Boolean :: Type`.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Type"},{"children":[],"comments":"`Constraint` is the kind of type class constraints.\nFor example, a type class declaration like this:\n\n class Semigroup a where\n append :: a -> a -> a\n\nhas the kind signature:\n\n class Semigroup :: Type -> Constraint\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Constraint"},{"children":[],"comments":"`Symbol` is the kind of type-level strings.\n\nConstruct types of this kind using the same literal syntax as documented\nfor strings.\n\n type Hello :: Symbol\n type Hello = \"Hello, world\"\n\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Symbol"},{"children":[],"comments":"`Row` is the kind constructor of label-indexed types which map type-level strings to other types.\nThe most common use of `Row` is `Row Type`, a row mapping labels to basic (of kind `Type`) types:\n\n type ExampleRow :: Row Type\n type ExampleRow = ( name :: String, values :: Array Int )\n\nThis is the kind of `Row` expected by the `Record` type constructor.\nMore advanced row kinds like `Row (Type -> Type)` are used much less frequently.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Row"}],"name":"Prim","reExports":[]}
+ tests/purs/docs/output/PrimSubmodules/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"declType":"dataConstructor"},"sourceSpan":{"end":[5,33],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/PrimSubmodules.purs","start":[5,28]},"title":"Lol"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Phantom"],"typeArguments":[["a",{"annotation":[],"contents":[["Prim","Ordering"],"Ordering"],"tag":"TypeConstructor"}]]},"kind":{"keyword":"data","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim","Ordering"],"Ordering"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[5,37],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/PrimSubmodules.purs","start":[5,1]},"title":"Lol"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":[{"annotation":[],"contents":[["PrimSubmodules"],"Lol"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim","Ordering"],"LT"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":null,"sourceSpan":{"end":[7,14],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/PrimSubmodules.purs","start":[7,1]},"title":"x"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":[{"annotation":[],"contents":[["PrimSubmodules"],"Lol"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim","Ordering"],"EQ"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":null,"sourceSpan":{"end":[10,14],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/PrimSubmodules.purs","start":[10,1]},"title":"y"}],"name":"PrimSubmodules","reExports":[]}
+ tests/purs/docs/output/ReExportedTypeClass/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[],"name":"ReExportedTypeClass","reExports":[]}
+ tests/purs/docs/output/RoleAnnotationDocs/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":{"end":[3,25],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/RoleAnnotationDocs.purs","start":[3,18]},"title":"D_RNP"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Representational","Nominal","Phantom"],"typeArguments":[["a",null],["b",null],["c",null]]},"kind":{"keyword":"data","kind":{"annotation":[],"contents":{"identifier":"k1","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"k2","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"k3","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k1","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k2","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k3","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[3,25],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/RoleAnnotationDocs.purs","start":[3,1]},"title":"D_RNP"},{"children":[{"comments":null,"info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":{"end":[6,25],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/RoleAnnotationDocs.purs","start":[6,18]},"title":"D_NPR"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Nominal","Phantom","Representational"],"typeArguments":[["a",null],["b",null],["c",null]]},"kind":{"keyword":"data","kind":{"annotation":[],"contents":{"identifier":"k1","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"k2","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"k3","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k1","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k2","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k3","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[6,25],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/RoleAnnotationDocs.purs","start":[6,1]},"title":"D_NPR"},{"children":[{"comments":null,"info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":{"end":[9,25],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/RoleAnnotationDocs.purs","start":[9,18]},"title":"D_PRN"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Phantom","Representational","Nominal"],"typeArguments":[["a",null],["b",null],["c",null]]},"kind":{"keyword":"data","kind":{"annotation":[],"contents":{"identifier":"k1","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"k2","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"k3","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k1","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k2","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k3","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[9,25],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/RoleAnnotationDocs.purs","start":[9,1]},"title":"D_PRN"},{"children":[],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Nominal","Nominal","Nominal"],"typeArguments":[["t0",null],["t1",null],["t2",null]]},"kind":null,"sourceSpan":{"end":[12,60],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/RoleAnnotationDocs.purs","start":[12,1]},"title":"FFI_NNN"},{"children":[],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Representational","Nominal","Phantom"],"typeArguments":[["t0",null],["t1",null],["t2",null]]},"kind":null,"sourceSpan":{"end":[14,60],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/RoleAnnotationDocs.purs","start":[14,1]},"title":"FFI_RNP"},{"children":[],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Representational","Nominal","Phantom"],"typeArguments":[["t0",null],["t1",null],["t2",null]]},"kind":{"keyword":"data","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[17,74],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/RoleAnnotationDocs.purs","start":[17,1]},"title":"FFI_Higher1"},{"children":[],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Representational","Nominal","Phantom"],"typeArguments":[["t0",null],["t1",null],["t2",null]]},"kind":{"keyword":"data","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[20,74],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/RoleAnnotationDocs.purs","start":[20,1]},"title":"FFI_Higher2"},{"children":[],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Representational","Nominal","Phantom"],"typeArguments":[["t0",null],["t1",null],["t2",null]]},"kind":{"keyword":"data","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[23,74],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/RoleAnnotationDocs.purs","start":[23,1]},"title":"FFI_Higher3"},{"children":[],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Representational","Nominal","Phantom"],"typeArguments":[["t0",null],["t1",null],["t2",null]]},"kind":{"keyword":"data","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[26,84],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/RoleAnnotationDocs.purs","start":[26,1]},"title":"FFI_Higher4"},{"children":[],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Representational","Nominal","Phantom"],"typeArguments":[["t0",null],["t1",null],["t2",null]]},"kind":null,"sourceSpan":{"end":[29,69],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/RoleAnnotationDocs.purs","start":[29,1]},"title":"FFI_HeadParens"},{"children":[],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Representational","Nominal","Phantom"],"typeArguments":[["t0",null],["t1",null],["t2",null]]},"kind":null,"sourceSpan":{"end":[32,69],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/RoleAnnotationDocs.purs","start":[32,1]},"title":"FFI_TailParens"},{"children":[],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Representational","Nominal","Phantom"],"typeArguments":[["t0",null],["t1",null],["t2",null]]},"kind":null,"sourceSpan":{"end":[35,70],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/RoleAnnotationDocs.purs","start":[35,1]},"title":"FFI_WholeParens"}],"name":"RoleAnnotationDocs","reExports":[]}
+ tests/purs/docs/output/Shebang1Undocumented/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[],"name":"Shebang1Undocumented","reExports":[]}
+ tests/purs/docs/output/Shebang2Undocumented/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[],"name":"Shebang2Undocumented","reExports":[]}
+ tests/purs/docs/output/Shebang3Undocumented/docs.json view
@@ -0,0 +1,1 @@+{"comments":"Normal doc comment\n","declarations":[],"name":"Shebang3Undocumented","reExports":[]}
+ tests/purs/docs/output/Shebang4Undocumented/docs.json view
@@ -0,0 +1,1 @@+{"comments":"Normal doc comment\n","declarations":[],"name":"Shebang4Undocumented","reExports":[]}
+ tests/purs/docs/output/SolitaryTypeClassMember/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[],"name":"SolitaryTypeClassMember","reExports":[]}
+ tests/purs/docs/output/SomeTypeClass/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":"a","tag":"TypeVar"}},"sourceSpan":{"end":[5,14],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/SomeTypeClass.purs","start":[5,3]},"title":"member"}],"comments":null,"info":{"arguments":[["a",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[5,14],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/SomeTypeClass.purs","start":[4,1]},"title":"SomeClass"}],"name":"SomeTypeClass","reExports":[]}
+ tests/purs/docs/output/Transitive1/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[],"name":"Transitive1","reExports":[]}
+ tests/purs/docs/output/Transitive2/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[],"name":"Transitive2","reExports":[]}
+ tests/purs/docs/output/Transitive3/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[3,19],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/Transitive3.purs","start":[3,1]},"title":"transitive3"}],"name":"Transitive3","reExports":[]}
+ tests/purs/docs/output/TypeClassWithFunDeps/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}},"sourceSpan":{"end":[5,20],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/TypeClassWithFunDeps.purs","start":[5,3]},"title":"aMember"}],"comments":null,"info":{"arguments":[["a",null],["b",null],["c",null],["d",null],["e",null]],"declType":"typeClass","fundeps":[[["a","b"],["c"]],[["c"],["d","e"]]],"superclasses":[]},"kind":{"keyword":"class","kind":{"annotation":[],"contents":{"identifier":"k1","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"k2","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"k3","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k1","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k2","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k3","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Constraint"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[5,20],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/TypeClassWithFunDeps.purs","start":[4,1]},"title":"TypeClassWithFunDeps"}],"name":"TypeClassWithFunDeps","reExports":[]}
+ tests/purs/docs/output/TypeClassWithoutMembers/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[],"name":"TypeClassWithoutMembers","reExports":[]}
+ tests/purs/docs/output/TypeClassWithoutMembersIntermediate/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[],"name":"TypeClassWithoutMembersIntermediate","reExports":[]}
+ tests/purs/docs/output/TypeLevelString/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim","TypeError"],"Text"],"tag":"TypeConstructor"},{"annotation":[],"contents":"oops","tag":"TypeLevelString"}],"tag":"TypeApp"}],"constraintClass":[["Prim","TypeError"],"Fail"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["TypeLevelString"],"Bar"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["TypeLevelString"],"Foo"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[9,49],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/TypeLevelString.purs","start":[9,1]},"title":"fooBar"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":[],"typeArguments":[]},"kind":null,"sourceSpan":{"end":[5,9],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/TypeLevelString.purs","start":[5,1]},"title":"Foo"},{"children":[{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim","TypeError"],"Text"],"tag":"TypeConstructor"},{"annotation":[],"contents":"oops","tag":"TypeLevelString"}],"tag":"TypeApp"}],"constraintClass":[["Prim","TypeError"],"Fail"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["TypeLevelString"],"Bar"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["TypeLevelString"],"Foo"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[9,49],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/TypeLevelString.purs","start":[9,1]},"title":"fooBar"}],"comments":null,"info":{"arguments":[["a",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":{"keyword":"class","kind":{"annotation":[],"contents":{"identifier":"k","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Constraint"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[7,12],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/TypeLevelString.purs","start":[7,1]},"title":"Bar"}],"name":"TypeLevelString","reExports":[]}
+ tests/purs/docs/output/TypeOpAliases/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[],"comments":null,"info":{"arguments":[["a",null],["b",null]],"declType":"typeSynonym","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}},"kind":null,"sourceSpan":{"end":[3,24],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/TypeOpAliases.purs","start":[3,1]},"title":"AltFn"},{"children":[],"comments":null,"info":{"alias":[["TypeOpAliases"],{"Left":"AltFn"}],"declType":"alias","fixity":{"associativity":"infixr","precedence":6}},"kind":null,"sourceSpan":{"end":[5,26],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/TypeOpAliases.purs","start":[5,1]},"title":"type (~>)"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["TypeOpAliases"],"~>"],"tag":"TypeOp"},{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"BinaryNoParensType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[7,43],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/TypeOpAliases.purs","start":[7,1]},"title":"test1"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"c","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["TypeOpAliases"],"~>"],"tag":"TypeOp"},{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":[{"annotation":[],"contents":[["TypeOpAliases"],"~>"],"tag":"TypeOp"},{"annotation":[],"contents":"b","tag":"TypeVar"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"BinaryNoParensType"}],"tag":"BinaryNoParensType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[8,50],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/TypeOpAliases.purs","start":[8,1]},"title":"test2"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"c","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"d","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["TypeOpAliases"],"~>"],"tag":"TypeOp"},{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":[{"annotation":[],"contents":[["TypeOpAliases"],"~>"],"tag":"TypeOp"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[["TypeOpAliases"],"~>"],"tag":"TypeOp"},{"annotation":[],"contents":"b","tag":"TypeVar"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"BinaryNoParensType"},"tag":"ParensInType"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"BinaryNoParensType"}],"tag":"BinaryNoParensType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[9,59],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/TypeOpAliases.purs","start":[9,1]},"title":"test3"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"c","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"d","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["TypeOpAliases"],"~>"],"tag":"TypeOp"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[["TypeOpAliases"],"~>"],"tag":"TypeOp"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[["TypeOpAliases"],"~>"],"tag":"TypeOp"},{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"BinaryNoParensType"},"tag":"ParensInType"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"BinaryNoParensType"},"tag":"ParensInType"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"BinaryNoParensType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[10,61],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/TypeOpAliases.purs","start":[10,1]},"title":"test4"},{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"declType":"dataConstructor"},"sourceSpan":{"end":[12,23],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/TypeOpAliases.purs","start":[12,16]},"title":"Tuple"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["TypeOpAliases"],"Show"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["TypeOpAliases"],"Show"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["TypeOpAliases"],"Tuple"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[28,24],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/TypeOpAliases.purs","start":[27,1]},"title":"showTuple"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["TypeOpAliases"],"TestL"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["TypeOpAliases"],"Either"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["TypeOpAliases"],"Tuple"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[40,27],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/TypeOpAliases.purs","start":[39,1]},"title":"testLEither"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["TypeOpAliases"],"TestR"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["TypeOpAliases"],"Either"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["TypeOpAliases"],"Tuple"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[44,23],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/TypeOpAliases.purs","start":[43,1]},"title":"testREither"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Representational","Representational"],"typeArguments":[["a",null],["b",null]]},"kind":null,"sourceSpan":{"end":[12,27],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/TypeOpAliases.purs","start":[12,1]},"title":"Tuple"},{"children":[],"comments":null,"info":{"alias":[["TypeOpAliases"],{"Right":{"Right":"Tuple"}}],"declType":"alias","fixity":{"associativity":"infixl","precedence":6}},"kind":null,"sourceSpan":{"end":[14,20],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/TypeOpAliases.purs","start":[14,1]},"title":"(×)"},{"children":[],"comments":null,"info":{"alias":[["TypeOpAliases"],{"Left":"Tuple"}],"declType":"alias","fixity":{"associativity":"infixl","precedence":6}},"kind":null,"sourceSpan":{"end":[15,25],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/TypeOpAliases.purs","start":[15,1]},"title":"type (×)"},{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"declType":"dataConstructor"},"sourceSpan":{"end":[17,23],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/TypeOpAliases.purs","start":[17,17]},"title":"Left"},{"comments":null,"info":{"arguments":[{"annotation":[],"contents":"b","tag":"TypeVar"}],"declType":"dataConstructor"},"sourceSpan":{"end":[17,33],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/TypeOpAliases.purs","start":[17,26]},"title":"Right"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["TypeOpAliases"],"TestL"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["TypeOpAliases"],"Either"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["TypeOpAliases"],"Tuple"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[40,27],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/TypeOpAliases.purs","start":[39,1]},"title":"testLEither"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["TypeOpAliases"],"TestR"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["TypeOpAliases"],"Either"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["TypeOpAliases"],"Tuple"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[44,23],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/TypeOpAliases.purs","start":[43,1]},"title":"testREither"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Representational","Representational"],"typeArguments":[["a",null],["b",null]]},"kind":null,"sourceSpan":{"end":[17,35],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/TypeOpAliases.purs","start":[17,1]},"title":"Either"},{"children":[],"comments":null,"info":{"alias":[["TypeOpAliases"],{"Left":"Either"}],"declType":"alias","fixity":{"associativity":"infixl","precedence":5}},"kind":null,"sourceSpan":{"end":[19,26],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/TypeOpAliases.purs","start":[19,1]},"title":"type (⊕)"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"c","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["TypeOpAliases"],"×"],"tag":"TypeOp"},{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":[{"annotation":[],"contents":[["TypeOpAliases"],"×"],"tag":"TypeOp"},{"annotation":[],"contents":"b","tag":"TypeVar"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"BinaryNoParensType"}],"tag":"BinaryNoParensType"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[21,31],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/TypeOpAliases.purs","start":[21,1]},"title":"third"},{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[25,22],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/TypeOpAliases.purs","start":[25,3]},"title":"show"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["TypeOpAliases"],"Show"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["TypeOpAliases"],"Show"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["TypeOpAliases"],"Tuple"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[28,24],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/TypeOpAliases.purs","start":[27,1]},"title":"showTuple"}],"comments":null,"info":{"arguments":[["a",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[25,22],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/TypeOpAliases.purs","start":[24,1]},"title":"Show"},{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":"a","tag":"TypeVar"}},"sourceSpan":{"end":[33,13],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/TypeOpAliases.purs","start":[33,3]},"title":"testL"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["TypeOpAliases"],"TestL"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["TypeOpAliases"],"Either"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["TypeOpAliases"],"Tuple"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[40,27],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/TypeOpAliases.purs","start":[39,1]},"title":"testLEither"}],"comments":null,"info":{"arguments":[["a",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[33,13],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/TypeOpAliases.purs","start":[32,1]},"title":"TestL"},{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":"a","tag":"TypeVar"}},"sourceSpan":{"end":[36,13],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/TypeOpAliases.purs","start":[36,3]},"title":"testR"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["TypeOpAliases"],"TestR"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["TypeOpAliases"],"Either"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["TypeOpAliases"],"Tuple"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[44,23],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/TypeOpAliases.purs","start":[43,1]},"title":"testREither"}],"comments":null,"info":{"arguments":[["a",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[36,13],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/TypeOpAliases.purs","start":[35,1]},"title":"TestR"}],"name":"TypeOpAliases","reExports":[]}
+ tests/purs/docs/output/TypeSynonym/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[],"comments":null,"info":{"arguments":[],"declType":"typeSynonym","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[3,17],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/TypeSynonym.purs","start":[3,1]},"title":"MyInt"}],"name":"TypeSynonym","reExports":[]}
+ tests/purs/docs/output/TypeSynonymInstance/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":[["TypeSynonym"],"MyInt"],"tag":"TypeConstructor"}],"declType":"dataConstructor"},"sourceSpan":{"end":[7,26],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/TypeSynonymInstance.purs","start":[7,14]},"title":"MyNT"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Newtype"],"Newtype"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["TypeSynonymInstance"],"MyNT"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":null,"tag":"TypeWildcard"}],"tag":"TypeApp"}},"sourceSpan":{"end":[9,41],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/TypeSynonymInstance.purs","start":[9,1]},"title":"ntMyNT"}],"comments":null,"info":{"dataDeclType":"newtype","declType":"data","roles":[],"typeArguments":[]},"kind":null,"sourceSpan":{"end":[7,26],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/TypeSynonymInstance.purs","start":[7,1]},"title":"MyNT"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[11,8],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/TypeSynonymInstance.purs","start":[11,1]},"title":"foo"}],"name":"TypeSynonymInstance","reExports":[]}
+ tests/purs/docs/output/UTF8/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[],"comments":"üÜäÄ 😰\n","info":{"declType":"value","type":{"annotation":[],"contents":[["Prelude"],"Unit"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[6,14],"name":"/home/jordan/programming/purescript/tests/purs/docs/src/UTF8.purs","start":[6,1]},"title":"thing"}],"name":"UTF8","reExports":[]}
+ tests/purs/docs/output/Virtual/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[],"name":"Virtual","reExports":[]}
+ tests/purs/docs/output/cache-db.json view
@@ -0,0 +1,1 @@+{"Ado":{"src/Ado.purs":["2022-04-04T14:32:49Z","bd980ae20d61e0e34d23507b1d25598f27407a78cf70084327506f21cc02d85df1bd1b6937459665a8dd9df5bb43ec5947b6e94c16c852aba233747e05a9d58f"]},"ChildDeclOrder":{"src/ChildDeclOrder.purs":["2022-04-04T14:32:49Z","41a7be97fffe1bbbf925ccb56b68246abb8684b23529fc25e07827b57b32b60ccd82d5c9a2279dc23be1f8803cff8267fa296509b873ec337ffa15ee0e32e2c9"]},"Clash":{"src/Clash.purs":["2022-04-04T14:32:49Z","7b70d019ea46b72149e185d82bc1345113e8a3977a886aa31ac8a268c6c63c7b93553e1586c45e023e49e485d3f6523a4a11efc8dc70dd8bac5d8b9cac4e4c2d"]},"Clash1":{"src/Clash1.purs":["2022-04-04T14:32:49Z","bd09c1fd0308ce61d83bef03d3b2366601df559ef8cc9c09f17d963a1bfb2b2e373dcbf5729a3e465c635fbf0035ae09ea3ba58b7844b56586dc3baf9d857bb5"]},"Clash1a":{"src/Clash1a.purs":["2022-04-04T14:32:49Z","b5c374c74a46d3f633c948de256e299dc2713857ce09441b5ae2f03afdd0468610088f39854f69848c1c9aecf3441b1b39e0919e499280a19d69b83de07d5d0b"]},"Clash2":{"src/Clash2.purs":["2022-04-04T14:32:49Z","10c61c6600084fdcc0ee93608a354fd7efa7edab67ac8cce131e522b597080b2927dc7bb1a6c98765dfc9a30583dc5bea2514d2932554ab1657c664a81a0a81b"]},"Clash2a":{"src/Clash2a.purs":["2022-04-04T14:32:49Z","b002aac5be65ac1cb55d10518840293780ea6d4a42b045172544ab3478ea83252f0672f0e1d4ad1599db3955f55202738ba1ee254b8ad94e914fc43fc1f6750f"]},"ConstrainedArgument":{"src/ConstrainedArgument.purs":["2022-04-04T14:32:49Z","6caa6cc505c6574957afe8e703f6e9869211e9c0a0676ba36a79d2a8b7e3c2c1570aae714cd6acc37e5b206745941460c1cf370a3bbd783c79b89351681ec890"]},"Data.Newtype":{"bower_components/purescript-newtype/src/Data/Newtype.purs":["2022-08-10T02:48:53.297467233Z","408eb6f95efb52faff05d73c757d21cebdd3b58dce3f5b8cfb5f0772224ca7e6ff9b5df0ab9ea40ce0f8448664fe56028af844b2c5dc32e5712b7d9d1541f2b7"]},"DeclOrder":{"src/DeclOrder.purs":["2022-04-04T14:32:49Z","a8c6ab9c335037c255ae6e0124a107f2e2462c2eebc2ff3637273ba436f2f3589ae203919ff5c8c61106b0542114ba3eba66426d8b5e316089bc1f4efb72643a"]},"DeclOrderNoExportList":{"src/DeclOrderNoExportList.purs":["2022-04-04T14:32:49Z","379def50dfd7a01dd2b057c707ea8ee53147d41c7dc28083c3827ccc213816840fd26d784a78bd1eabd105231e5479c7bfeebfcb03d1e2f3e8174ab173d740c4"]},"Desugar":{"src/Desugar.purs":["2022-04-04T14:32:49Z","50ceefe5cbac286908cc7070f4e94f57c62b5c91245d5a8c66d7f4565e3d037e4cf11524c4c790664588a0a5c4216390b5138be9ec93e14d0f82a2c59c8f561a"]},"DocComments":{"src/DocComments.purs":["2022-04-04T14:32:49Z","220498626601722feb58dd23dd80ac970f6ba7df8e8c2ad604ed833933f6b36219fb5f1d0b9963ffc7e9314043760055ab547fac5784a28416a4851f257a635b"]},"DocCommentsClassMethod":{"src/DocCommentsClassMethod.purs":["2022-04-04T14:32:49Z","f55a03f2b2624a9ca01adc8372bad4b7e46e8ef1a52ec41c5992767146c9a2354320a3a38587cbf2e78fec118430f193fdcb1cdd9600cd9f755dbbc2e36e46b7"]},"DocCommentsDataConstructor":{"src/DocCommentsDataConstructor.purs":["2022-04-04T14:32:49Z","68d644ce63642bd55d8338e78e0070c409d3c970a2967338cf612d7a3217813fd98a08e1905776572819cadbc08cdd4bec4a7c1473974a9f3f5d5b1149d33257"]},"DocCommentsMerge":{"src/DocCommentsMerge.purs":["2022-04-04T14:32:49Z","08e74333f59b1991e5c044debca1b8d2be7193898cc501c6c422b2f3e4c6e6aba8562cfa7b38dac2363e567357722e79d0fcc4757ee91ed067e7179a3615bdbd"]},"DuplicateNames":{"src/DuplicateNames.purs":["2022-04-04T14:32:49Z","5652f5da0ae79185fb27bce13793bd7752779364e0d1c7c56be2d213853c26ad0abff8536a0d34090a079980e498c837026521efe4a8cfc1b1a16ec70c724eed"]},"Example":{"src/Example.purs":["2022-04-04T14:32:49Z","3b700a99cc5ee257009553d27a2d25f71f68f006e9deec2b3578f01c7fe4e77de1e929dc110dfcd51d68685ad3ab6b09b0147fe63719861e8a9e480a64e286d9"]},"Example2":{"src/Example2.purs":["2022-04-04T14:32:49Z","6a479db4e40f66b1e29889516a55cfb22b15b2b8c4531b9cf20307a965af3dc0a6dab4eccc31cca4eacaaa158a01c58ff995ac6f01b2e1ed5571c44fa3bf2536"]},"ExplicitExport":{"src/ExplicitExport.purs":["2022-04-04T14:32:49Z","fe733409eb325c971f84b6414a1fc9e08793d2271eebcd670ceefd5c5aef837ee76ec5cb5bed96d87ea791a7521c76668a71be5cd8fb14209414893dc20d3d47"]},"ExplicitTypeSignatures":{"src/ExplicitTypeSignatures.purs":["2022-04-04T14:32:49Z","78a70441c9966f04c6c32a74cbba299f0f8ea870c664e738eb0d8f8cc5929edb7bb697170fc306c9ee69fa4e2f0112af15c8bdb29d63645cdf6f2916a122a0bd"]},"ImportedTwice":{"src/ImportedTwice.purs":["2022-04-04T14:32:49Z","be9a0cb1e75c689c3af6817a5750862915e70a0017476cce4c539a3c7ce5b33554aa14d2668bd131b89bb28d65b5ddaa79abfb2a538d606f1b11b5ef0ec79067"]},"ImportedTwiceA":{"src/ImportedTwiceA.purs":["2022-04-04T14:32:49Z","883c8abaefe0dbacbcdea4c53eab41da26687680274419720b1e5d6510bf5127b7ba06df23515ad34f7ffc4626f0064d7867e2b4a5f255a6b573d219926364de"]},"ImportedTwiceB":{"src/ImportedTwiceB.purs":["2022-04-04T14:32:49Z","48cc2ac8ce40b1d0e3782fcb8ec798cf9c4838a595148055f1bb830d9b07d58780170ad3f8a90f43ac561aff2c52a5d8793480526a4768ebf1c8af1ff1b68751"]},"KindSignatureDocs":{"src/KindSignatureDocs.purs":["2022-04-04T14:32:49Z","c2a224affb04b4c5db4712d15bfa830999c634c135bf1595f4930dd682258f5a278477ffeba297c42af5d74878e73694180a932ee2ebf7ad8a2ff66c4df2135d"]},"MultiVirtual":{"src/MultiVirtual.purs":["2022-04-04T14:32:49Z","31bc7e2c2ebee39dbc89536db51493a2cb1843a9e1aed8b288ef16660877fd1abd5f4224d3325a415aabcf79bd5fe76ebb9257738b0193a50c79a20d48b5ab29"]},"MultiVirtual1":{"src/MultiVirtual1.purs":["2022-04-04T14:32:49Z","23f7975f7494bb84f9fc6fde9071ce04e86df774d81e2b027a85ab46c8237f9921ee926f4a4ad3e03c7799e485ce39e542d1dd94953c50c0d58ea0003cfc3842"]},"MultiVirtual2":{"src/MultiVirtual2.purs":["2022-04-04T14:32:49Z","f424ed7c0db709b6bb1e57f87069f484fd0db9dddd0475cd15d36bd58743e98729c42efd2df6ee8fbd18609c36c2247cf3428a5a7f1f5ed11e233a2b134990ba"]},"MultiVirtual3":{"src/MultiVirtual3.purs":["2022-04-04T14:32:49Z","a42415e3b8309bfa81ef127c61dba6f4001188dcee160a8e2f73399179a11262f12daf0205d6bec38fc605b637550f16b62e84a0f2a0f6999355d56ff2540405"]},"NewOperators":{"src/NewOperators.purs":["2022-04-04T14:32:49Z","f74cae05c73db1f629e199692c517866fb1683caab3c4509657a371733f30319f0c505ed57208757b3e43795aab5191000c834a501d9bd2bf0e58875873c5c40"]},"NewOperators2":{"src/NewOperators2.purs":["2022-04-04T14:32:49Z","c551a91aa792fb9ee4b5758c010761a53d4a14b8fbaa6b76b6bd9a318a28f245c9b090bdc4f77b904c873d9b71d59fbad3ccd9ad7c8773f5c1e57a22a0204844"]},"NotAllCtors":{"src/NotAllCtors.purs":["2022-04-04T14:32:49Z","6e0af26cf897b5dd6e8dd4d75988e5607118f6fdd5219aa192f477cc4d760d504bdec930d46af82a44950e3de4fe6c37664a4560a523a45097503b85c161bd96"]},"OperatorSection":{"src/OperatorSection.purs":["2022-05-27T04:56:24Z","64a9d1bdc2b7df3fe4124651fee37440b9c53b61d25fba7e9a1974c713c12679f227fdc700a6d97218c3628dce4ea9c8c3c5b4e30b5b8f8ecf6a5f6781599c7b"]},"Prelude":{"bower_components/purescript-prelude/src/Prelude.purs":["2022-08-10T02:48:53.301467266Z","7eb0b2f9b7aec29693f79be4642ccea792b1f54c7022a4f1395fb8f3a9b1ad6cbfb2e7685940b89ab21890c02949ec90d4823bd5c36a6b566ca9cb8ec561958f"]},"PrimSubmodules":{"src/PrimSubmodules.purs":["2022-05-27T04:56:24Z","6b03520e209171032fd18661077ef49b0547b488667b8316e8ec6104a49914fe58929d1dea64fde39ed5a88d814304d0db1d5cd56a3a4b2b5a625585666e42c6"]},"ReExportedTypeClass":{"src/ReExportedTypeClass.purs":["2022-04-04T14:32:49Z","1cc581d68e1ce113162ab851872e73645807f0deb1d2b970ebc04b314184fe30c3431212ffcf9eec09a56a2291e0050750ac6905f1884bc74d406d0323c4f804"]},"RoleAnnotationDocs":{"src/RoleAnnotationDocs.purs":["2022-04-04T14:32:49Z","87b1012eaa7e6312ca43aa23efa0ec76eefd72d9e306233a35d4ab9dd3d74ad2051ab11555a5d1136ea2c1800bbfadfa0b52bad30a5a4b9ef3a9aa6498474506"]},"Shebang1Undocumented":{"src/Shebang1Undocumented.purs":["2022-06-08T12:25:40Z","55cff97ade15395974b1d714467dd824c260851b08a4aa365abf1980e5e746b378379d6b62ac4f1174f20c56600df82b05ca17f21643d529d8f21cb54069d5dc"]},"Shebang2Undocumented":{"src/Shebang2Undocumented.purs":["2022-06-08T12:25:40Z","d64e34906077c41cc542cbd50a604fb5c311526805a8f62be192cd05c1f6c68b03b728cb9cb90ff005d99f6e60a2384b584800fc23cd0064104d077aa3e22108"]},"Shebang3Undocumented":{"src/Shebang3Undocumented.purs":["2022-06-08T12:25:40Z","b3f811c431e42fef7eb9682fd1312e49d60b0394df825dcc34c083b191ca0361250ad503d9e4bcb5e7da6c715dab6ad51e47f936a595a0e77b771d5b547a1e3d"]},"Shebang4Undocumented":{"src/Shebang4Undocumented.purs":["2022-06-08T12:25:40Z","96139bf4debfdfa7f7b250aec10644f819a017f87127acd0cac613da51402f88664f7aea99767cfdfc6658efbe7eba5fba57b127ea5a8d15ba70057f7b6ee0a6"]},"SolitaryTypeClassMember":{"src/SolitaryTypeClassMember.purs":["2022-04-04T14:32:49Z","f627c589b0a8f58d7bfdf28ecf87891a74e64e8399ce0ab645b7c58049fddc1ea3cbb3c34b862bec8576108d5258d9548ecfbbab98598671cc645a3f358ac852"]},"SomeTypeClass":{"src/SomeTypeClass.purs":["2022-04-04T14:32:49Z","d09fc77e6c6350e7e4941e2911e012271a49db4a75c57cf738d5865ca622d60b69337f969aa02b13fc869484cba00479212e4b8dbcb458c5723e7a5d73888368"]},"Transitive1":{"src/Transitive1.purs":["2022-04-04T14:32:49Z","42681f3d0fa143d36474d1cb2f464820bdb907bbc432cd91349f6acdd82657ecb4d9ad1d075c96c551bed37dada4615dd3ff64f912f2cc8a6d99b5e02ee51979"]},"Transitive2":{"src/Transitive2.purs":["2022-04-04T14:32:49Z","110a1bae420e0f0c05e9846fad483a1d035dfc3ba82c2cd81e44f548fd97965055b1a687ab86256f8cb6a3d79b4c4abe6f45d4728bbc04a7a1b0fedbca115b1e"]},"Transitive3":{"src/Transitive3.purs":["2022-04-04T14:32:49Z","65f7bb366ac8fab63084ff0229c9d55293db8126b539ff2cb53e511505995f426d50f4cca7d1f61fc53aaaaeed9d72791f9d9f12cc569d92e7bbe1d1908b093c"]},"TypeClassWithFunDeps":{"src/TypeClassWithFunDeps.purs":["2022-04-04T14:32:49Z","c828f194c8c679d97425ed7e04eb3c9bb04bc4c32542d7d6d7e4a36c6c734eb8ba1ef472ad2b0085d9a042a0724648b85a4605d8fe4995e1a32839b1fb1f0f23"]},"TypeClassWithoutMembers":{"src/TypeClassWithoutMembers.purs":["2022-04-04T14:32:49Z","3eac42652ce295ee47c340c4b86c91d0f6a8ad1f81824475fa4fc4ae8fd8bb77ceee6a46e31bebe9d2e8a980a7923432b41b0eff5cbf75580ee149e7d997e098"]},"TypeClassWithoutMembersIntermediate":{"src/TypeClassWithoutMembersIntermediate.purs":["2022-04-04T14:32:49Z","76d65083da1f6240b4c3b6c910af1326b9b9a538f4eb278b00ddf0bf67d9547c1cab0fae7661bbe4af6e7ecdea9fd26cc9ff9ea5b289d3c3994b3ccb3d099ba8"]},"TypeLevelString":{"src/TypeLevelString.purs":["2022-04-04T14:32:49Z","361dc3825ebd3efcd9a53dd900cc623f5eca14df82afc93f4d485d8b38e51eb0a72929b6cfb783b3d5c9bef46e6fd18c139fdbd10de484beb335e09ecee79388"]},"TypeOpAliases":{"src/TypeOpAliases.purs":["2022-04-04T14:32:49Z","5f1279d355f0e8f8c7d063950007ba060f0afdb83524fa10361f389d25fdacdf149c907cbdd94cf3d1a77751903701f22ba377203cd3b5d0c40e504699f94249"]},"TypeSynonym":{"src/TypeSynonym.purs":["2022-04-04T14:32:49Z","d1a0af1c2592e7f150bb0bf1dca4fc82ffe95b4f96be611408828d105d28bb6a4243a4c2799b1c35875a352e51a19464e4507b9c81d9cd34f0f55f8c94898ed9"]},"TypeSynonymInstance":{"src/TypeSynonymInstance.purs":["2022-04-04T14:32:49Z","336ba7262428a526f3824306f4ac472aebf637181b8aa23d823e6e70641539a14d57b52272d844af3e3a7fa85cdf4094042e464b61622a5a1c290ee8a6684733"]},"UTF8":{"src/UTF8.purs":["2022-04-04T14:32:49Z","60771c6d4974ef36414775e5a2511e99d08d5ba3945b010d7a399b77b88b310e10ad7d0016f7946ca3f524e7bbd1dce3575f7b2d81f8154bde197a3da411a624"]},"Virtual":{"src/Virtual.purs":["2022-04-04T14:32:49Z","a1e01c8b1a7c86c86942611649702ebf6689cf7559ce9ca0ba66052eafe64826b0770b33089e72cc26a3c90d75bcf62e0b75a6a90e085e70a6ec946b16456de2"]}}
+ tests/purs/docs/output/package.json view
@@ -0,0 +1,1 @@+{"type":"module"}
+ tests/purs/docs/purs.json view
@@ -0,0 +1,11 @@+{+ "name": "docs-test-package",+ "license": "MIT",+ "version": "1.0.0",+ "location": {+ "gitUrl": "https://github.com/not-real/not-a-real-repo.git"+ },+ "dependencies": {+ "prelude": ">=1.0.0 <2.0.0"+ }+}
+ tests/purs/docs/resolutions.json view
@@ -0,0 +1,10 @@+{+ "purescript-prelude": {+ "version": "1.0.0",+ "path": "bower_components/purescript-prelude"+ },+ "purescript-newtype": {+ "version": "1.0.0",+ "path": "bower_components/purescript-newtype"+ }+}
+ tests/purs/docs/src/Ado.purs view
@@ -0,0 +1,9 @@+-- See https://github.com/purescript/purescript/issues/3414 +module Ado where+ +test = + ado x <- 1+ in x++ where+ map f x = f x
+ tests/purs/docs/src/ChildDeclOrder.purs view
@@ -0,0 +1,27 @@+-- Tests should ensure that, in the docs:+-- - First should come before Second+-- - foo1 should be listed before foo2+-- - the instances should be listed in the same order as this source file+module ChildDeclOrder where++data Two+ = First+ | Second++class Show a where+ show :: a -> String++class Foo a where+ foo1 :: a+ foo2 :: a++instance showTwo :: Show Two where+ show _ = ""++instance fooTwo :: Foo Two where+ foo1 = First+ foo2 = Second++instance fooInt :: Foo Int where+ foo1 = 1+ foo2 = 2
+ tests/purs/docs/src/Clash.purs view
@@ -0,0 +1,4 @@+module Clash (module Clash1) where++import Clash1 as Clash1+import Clash2 as Clash2
+ tests/purs/docs/src/Clash1.purs view
@@ -0,0 +1,3 @@+module Clash1 (module Clash1a) where++import Clash1a
+ tests/purs/docs/src/Clash1a.purs view
@@ -0,0 +1,9 @@+module Clash1a where++value :: Int+value = 0++type Type' = Int++class TypeClass a where+ typeClassMember :: a
+ tests/purs/docs/src/Clash2.purs view
@@ -0,0 +1,3 @@+module Clash2 (module Clash2a) where++import Clash2a
+ tests/purs/docs/src/Clash2a.purs view
@@ -0,0 +1,9 @@+module Clash2a where++value :: String+value = "hello"++type Type' = String++class TypeClass a b where+ typeClassMember :: a -> b
+ tests/purs/docs/src/ConstrainedArgument.purs view
@@ -0,0 +1,8 @@+module ConstrainedArgument where++class Foo (t :: Type)++type WithoutArgs = forall a. (Partial => a) -> a+type WithArgs = forall a. (Foo a => a) -> a+type MultiWithoutArgs = forall a. (Partial => Partial => a) -> a+type MultiWithArgs = forall a b. (Foo a => Foo b => a) -> a
+ tests/purs/docs/src/DeclOrder.purs view
@@ -0,0 +1,17 @@+module DeclOrder+ ( class A+ , x1+ , X2+ , x3+ , X4+ , class B+ ) where++x1 = 0+x3 = 0++data X2+data X4++class A+class B
+ tests/purs/docs/src/DeclOrderNoExportList.purs view
@@ -0,0 +1,10 @@+module DeclOrderNoExportList where++x1 = 0+x3 = 0++data X2+data X4++class A+class B
+ tests/purs/docs/src/Desugar.purs view
@@ -0,0 +1,8 @@+module Desugar where++data X a b = X a b++test :: forall a b. X (a -> b) a -> b+test x =+ let X a b = x+ in a b
+ tests/purs/docs/src/DocComments.purs view
@@ -0,0 +1,11 @@+module DocComments where++-- | This declaration has a code block:+-- |+-- | example == 0+-- |+-- | Here we are really testing that the leading whitespace is not stripped, as+-- | this ensures that we don't accidentally change code blocks into normal+-- | paragraphs.+example :: Int+example = 0
+ tests/purs/docs/src/DocCommentsClassMethod.purs view
@@ -0,0 +1,6 @@+module DocCommentsClassMethod where++class Foo a where+ -- | class method comment+ bar :: a+ baz :: String -> a
+ tests/purs/docs/src/DocCommentsDataConstructor.purs view
@@ -0,0 +1,15 @@+module DocCommentsDataConstructor where++data Foo+ -- | data constructor comment+ = Bar+ | Baz++data ComplexFoo a b+ = ComplexBar a+ -- | another data constructor comment+ | ComplexBaz a b++newtype NewtypeFoo+ -- | newtype data constructor comment+ = NewtypeFoo { newtypeBar :: String }
+ tests/purs/docs/src/DocCommentsMerge.purs view
@@ -0,0 +1,118 @@+module DocCommentsMerge where++-- | decl+data DataOnly = DataOnly++-- | kind+data KindOnlyData :: Type+data KindOnlyData = KindOnlyData++-- | kind+data KindAndData :: Type+-- | decl+data KindAndData = KindAndData++data DataRoleOnly a b = DataRoleOnly a b+-- | role+type role DataRoleOnly representational representational++-- | decl+data DataAndRole a b = DataAndRole a b+-- | role+type role DataAndRole representational representational++-- | kind+data KindOnlyDataRoleOnly :: Type -> Type+data KindOnlyDataRoleOnly a = KindOnlyDataRoleOnly+-- | role+type role KindOnlyDataRoleOnly representational++-- | kind+data KindDataAndRole :: Type -> Type+-- | decl+data KindDataAndRole a = KindDataAndRole+-- | role+type role KindDataAndRole representational++---++-- | decl+foreign import data FFIOnly :: Type++foreign import data FFIRoleOnly :: Type -> Type+-- | role+type role FFIRoleOnly representational++-- | decl+foreign import data FFIAndRole :: Type -> Type+-- | role+type role FFIAndRole representational++---++-- | decl+newtype NewtypeOnly = NewtypeOnly Int++-- | kind+newtype KindOnlyNewtype :: Type+newtype KindOnlyNewtype = KindOnlyNewtype Int++-- | kind+newtype KindAndNewtype :: Type -> Type -> Type+-- | decl+newtype KindAndNewtype a b = KindAndNewtype Int++newtype NewtypeRoleOnly a b = NewtypeRoleOnly Int+-- | role+type role NewtypeRoleOnly representational representational++-- | decl+newtype NewtypeAndRole a b = NewtypeAndRole Int+-- | role+type role NewtypeAndRole representational representational++-- | kind+newtype KindOnlyNewtypeRoleOnly :: Type -> Type -> Type+newtype KindOnlyNewtypeRoleOnly a b = KindOnlyNewtypeRoleOnly Int+-- | role+type role KindOnlyNewtypeRoleOnly representational representational++-- | kind+newtype KindNewtypeAndRole :: Type -> Type -> Type+-- | decl+newtype KindNewtypeAndRole a b = KindNewtypeAndRole Int+-- | role+type role KindNewtypeAndRole representational representational++---++-- | decl+type TypeOnly = Int++-- | kind+type KindOnlyType :: Type -> Type -> Type+type KindOnlyType a b = Int++-- | kind+type KindAndType :: Type -> Type -> Type+-- | decl+type KindAndType a b = Int++-- type can't have role annotations++---++-- | decl+class ClassOnly++-- | kind+class KindOnlyClass :: Constraint+class KindOnlyClass++-- | kind+class KindAndClass :: Type -> Constraint+-- | decl+class KindAndClass a where+ fooKindAndClass :: a -> String++-- class can't have role declarations
+ tests/purs/docs/src/DuplicateNames.purs view
@@ -0,0 +1,9 @@+module DuplicateNames+ ( module DuplicateNames+ , module Prelude+ ) where++import Prelude (Unit)++unit :: Int+unit = 0
+ tests/purs/docs/src/Example.purs view
@@ -0,0 +1,7 @@+module Example+ ( module Prelude+ , module Example2+ ) where++import Prelude (Unit())+import Example2 (one)
+ tests/purs/docs/src/Example2.purs view
@@ -0,0 +1,7 @@+module Example2 where++one :: Int+one = 1++two :: Int+two = 2
+ tests/purs/docs/src/ExplicitExport.purs view
@@ -0,0 +1,7 @@+module ExplicitExport (one) where++one :: Int+one = 1++two :: Int+two = 2
+ tests/purs/docs/src/ExplicitTypeSignatures.purs view
@@ -0,0 +1,16 @@++module ExplicitTypeSignatures where++-- This should use the explicit type signature so that the type variable name+-- is preserved.+explicit :: forall something. something -> something+explicit x+ | true = x+ | false = x++-- This should use the inferred type.+anInt :: _+anInt = 0++-- This should infer a type.+aNumber = 1.0
+ tests/purs/docs/src/ImportedTwice.purs view
@@ -0,0 +1,13 @@+-- See also an example in the wild: purescript-transformers v0.8.4.+-- Control.Monad.RWS.Trans re-exports `lift` from both Control.Monad.Trans+-- (where it is originally defined) and Control.Monad.RWS.Class (which+-- re-exports it from Control.Monad.Trans).++module ImportedTwice+ ( module ImportedTwiceA+ , module ImportedTwiceB+ )+ where++import ImportedTwiceA+import ImportedTwiceB
+ tests/purs/docs/src/ImportedTwiceA.purs view
@@ -0,0 +1,8 @@+module ImportedTwiceA+ ( module ImportedTwiceB )+ where++import ImportedTwiceB++bar :: Int+bar = 1
+ tests/purs/docs/src/ImportedTwiceB.purs view
@@ -0,0 +1,4 @@+module ImportedTwiceB where++foo :: Int+foo = 0
+ tests/purs/docs/src/KindSignatureDocs.purs view
@@ -0,0 +1,123 @@+module KindSignatureDocs where++data DKindAndType :: forall k. k -> Type+data DKindAndType a = DKindAndType++type TKindAndType :: forall k. k -> Type+type TKindAndType a = Int++newtype NKindAndType :: forall k. k -> Type+newtype NKindAndType a = NKindAndType Int++class CKindAndType :: forall k. (k -> Type) -> k -> Constraint+class CKindAndType a k where+ fooKindAndType :: a k -> String++----------++data DKindOnly :: forall k. k -> Type+data DKindOnly a = DKindOnly++type TKindOnly :: forall k. k -> Type+type TKindOnly a = Int++newtype NKindOnly :: forall k. k -> Type+newtype NKindOnly a = NKindOnly Int++class CKindOnly :: forall k. (k -> Type) -> k -> Constraint+class CKindOnly a k where+ fooKindOnly :: a k -> String++----------++data DTypeOnly :: forall k. k -> Type+data DTypeOnly a = DTypeOnly++type TTypeOnly :: forall k. k -> Type+type TTypeOnly a = Int++newtype NTypeOnly :: forall k. k -> Type+newtype NTypeOnly a = NTypeOnly Int++class CTypeOnly :: forall k. (k -> Type) -> k -> Constraint+class CTypeOnly a k where+ fooTypeOnly :: a k -> String++----------++data DImplicit a = DImplicit++type TImplicit a = Int++newtype NImplicit a = NImplicit Int++class CImplicit a k where+ fooImplicit :: a k -> String++----------++data DHidden a b c = DHidden a b c++data DNothing++type THidden a b c = DHidden b c a++newtype NHidden a b c = NHidden (DHidden a c b)++class CHidden a b c where+ fooHidden :: a -> b -> c -> String++class CNothing++----------++foreign import data FFI_Hidden :: Type -> Type -> Type+foreign import data FFI_Shown :: (Type -> Type) -> Type++----------++foreign import data FFI_RedundantParenthesis :: (Type) -> Type++data DataRedundantParenthesis :: (Type) -> (Type)+data DataRedundantParenthesis a = DataRedundantParenthesis++class ClassRedundantParenthesis :: (Type) -> (Constraint)+class ClassRedundantParenthesis a++data DataHeadParens :: (Type) -> Type -> Type+data DataHeadParens a b = DataHeadParens++data DataTailParens :: Type -> (Type -> Type)+data DataTailParens a b = DataTailParens++data DataWholeParens :: (Type -> Type -> Type)+data DataWholeParens a b = DataWholeParens++data DataSelfParens :: (Type)+data DataSelfParens = DataSelfParens++class ClassSelfParens :: (Constraint)+class ClassSelfParens++data DataKindAnnotation (a :: Type) = DataKindAnnotation a++data DataKindAnnotationWithParens (a :: (Type)) = DataKindAnnotationWithParens a++data FunctionParens1 :: (->) Type Type+data FunctionParens1 a = FunctionParens1 a++data FunctionParens2 :: ((->) Type) Type+data FunctionParens2 a = FunctionParens2 a++data FunctionParens3 :: (((->) Type)) Type+data FunctionParens3 a = FunctionParens3 a+----------++data DShown a b f = DShown (f Int) a b++type TShown f b c = DShown b c f++newtype NShown a f c = NShown (DShown a c f)++class CShown f a b where+ fooShown :: f Int -> a -> b -> String
+ tests/purs/docs/src/MultiVirtual.purs view
@@ -0,0 +1,6 @@+module MultiVirtual+ ( module X )+ where++import MultiVirtual1 as X+import MultiVirtual2 as X
+ tests/purs/docs/src/MultiVirtual1.purs view
@@ -0,0 +1,4 @@+module MultiVirtual1 where++foo :: Int+foo = 1
+ tests/purs/docs/src/MultiVirtual2.purs view
@@ -0,0 +1,9 @@+module MultiVirtual2+ ( module MultiVirtual2+ , module MultiVirtual3+ ) where++import MultiVirtual3++bar :: Int+bar = 2
+ tests/purs/docs/src/MultiVirtual3.purs view
@@ -0,0 +1,4 @@+module MultiVirtual3 where++baz :: Int+baz = 3
+ tests/purs/docs/src/NewOperators.purs view
@@ -0,0 +1,5 @@+module NewOperators+ ( module NewOperators2 )+ where++import NewOperators2
+ tests/purs/docs/src/NewOperators2.purs view
@@ -0,0 +1,6 @@+module NewOperators2 where++infixl 8 _compose as >>>++_compose :: forall a b c. (b -> c) -> (a -> b) -> (a -> c)+_compose f g x = f (g x)
+ tests/purs/docs/src/NotAllCtors.purs view
@@ -0,0 +1,5 @@+module NotAllCtors+ ( module Prelude )+ where++import Prelude (Boolean2(True))
+ tests/purs/docs/src/OperatorSection.purs view
@@ -0,0 +1,16 @@+module OperatorSection where++data List a = Nil | Cons a (List a)++infixr 6 Cons as :++class Foldable f where+ foldl :: forall a b. (b -> a -> b) -> b -> f a -> b++instance Foldable List where+ -- Note: this is not a valid `Foldable` instance,+ -- but it verifies that producing docs for+ -- this file still works. See #4274 for more details.+ foldl f b = case _ of+ Nil -> b+ a : _as -> f b a
+ tests/purs/docs/src/PrimSubmodules.purs view
@@ -0,0 +1,11 @@+module PrimSubmodules (Lol(..), x, y, module O) where++import Prim.Ordering (Ordering, LT, EQ, GT) as O++data Lol (a :: O.Ordering) = Lol Int++x :: Lol O.LT+x = Lol 0++y :: Lol O.EQ+y = Lol 1
+ tests/purs/docs/src/ReExportedTypeClass.purs view
@@ -0,0 +1,5 @@+module ReExportedTypeClass+ ( module SomeTypeClass )+ where++import SomeTypeClass
+ tests/purs/docs/src/RoleAnnotationDocs.purs view
@@ -0,0 +1,36 @@+module RoleAnnotationDocs where++data D_RNP a b c = D_RNP+type role D_RNP representational nominal phantom++data D_NPR a b c = D_NPR+type role D_NPR nominal phantom representational++data D_PRN a b c = D_PRN+type role D_PRN phantom representational nominal++foreign import data FFI_NNN :: Type -> Type -> Type -> Type++foreign import data FFI_RNP :: Type -> Type -> Type -> Type+type role FFI_RNP representational nominal phantom++foreign import data FFI_Higher1 :: (Type -> Type) -> Type -> Type -> Type+type role FFI_Higher1 representational nominal phantom++foreign import data FFI_Higher2 :: Type -> (Type -> Type) -> Type -> Type+type role FFI_Higher2 representational nominal phantom++foreign import data FFI_Higher3 :: Type -> Type -> (Type -> Type) -> Type+type role FFI_Higher3 representational nominal phantom++foreign import data FFI_Higher4 :: Type -> (Type -> (Type -> Type)) -> Type -> Type+type role FFI_Higher4 representational nominal phantom++foreign import data FFI_HeadParens :: (Type) -> Type -> Type -> Type+type role FFI_HeadParens representational nominal phantom++foreign import data FFI_TailParens :: Type -> (Type -> Type -> Type)+type role FFI_TailParens representational nominal phantom++foreign import data FFI_WholeParens :: (Type -> Type -> Type -> Type)+type role FFI_WholeParens representational nominal phantom
+ tests/purs/docs/src/Shebang1Undocumented.purs view
@@ -0,0 +1,4 @@+#! a single shebang comment+module Shebang1Undocumented where++import Prelude
+ tests/purs/docs/src/Shebang2Undocumented.purs view
@@ -0,0 +1,8 @@+#! a+#! multi+#! line+#! shebang+#! comment+module Shebang2Undocumented where++import Prelude
+ tests/purs/docs/src/Shebang3Undocumented.purs view
@@ -0,0 +1,9 @@+#! a+#! multi+#! line+#! shebang+#! comment+-- | Normal doc comment+module Shebang3Undocumented where++import Prelude
+ tests/purs/docs/src/Shebang4Undocumented.purs view
@@ -0,0 +1,10 @@+#! a+#! multi+#! line+#! shebang+#! comment+-- Normal comment+-- | Normal doc comment+module Shebang4Undocumented where++import Prelude
+ tests/purs/docs/src/SolitaryTypeClassMember.purs view
@@ -0,0 +1,6 @@+module SolitaryTypeClassMember+ ( module SomeTypeClass )+ where++import SomeTypeClass (member)+
+ tests/purs/docs/src/SomeTypeClass.purs view
@@ -0,0 +1,5 @@++module SomeTypeClass where++class SomeClass a where+ member :: a
+ tests/purs/docs/src/Transitive1.purs view
@@ -0,0 +1,5 @@+module Transitive1+ ( module Transitive2 )+ where++import Transitive2
+ tests/purs/docs/src/Transitive2.purs view
@@ -0,0 +1,5 @@+module Transitive2+ ( module Transitive3 )+ where++import Transitive3
+ tests/purs/docs/src/Transitive3.purs view
@@ -0,0 +1,4 @@+module Transitive3 where++transitive3 :: Int+transitive3 = 0
+ tests/purs/docs/src/TypeClassWithFunDeps.purs view
@@ -0,0 +1,5 @@++module TypeClassWithFunDeps where++class TypeClassWithFunDeps a b c d e | a b -> c, c -> d e where+ aMember :: a -> b
+ tests/purs/docs/src/TypeClassWithoutMembers.purs view
@@ -0,0 +1,5 @@+module TypeClassWithoutMembers+ ( module TypeClassWithoutMembersIntermediate )+ where++import TypeClassWithoutMembersIntermediate
+ tests/purs/docs/src/TypeClassWithoutMembersIntermediate.purs view
@@ -0,0 +1,5 @@+module TypeClassWithoutMembersIntermediate+ ( module SomeTypeClass )+ where++import SomeTypeClass (class SomeClass)
+ tests/purs/docs/src/TypeLevelString.purs view
@@ -0,0 +1,9 @@+module TypeLevelString where++import Prim.TypeError (class Fail, Text)++data Foo++class Bar a++instance fooBar :: Fail (Text "oops") => Bar Foo
+ tests/purs/docs/src/TypeOpAliases.purs view
@@ -0,0 +1,44 @@+module TypeOpAliases where++type AltFn a b = a -> b++infixr 6 type AltFn as ~>++foreign import test1 :: forall a b. a ~> b+foreign import test2 :: forall a b c. a ~> b ~> c+foreign import test3 :: forall a b c d. a ~> (b ~> c) ~> d+foreign import test4 :: forall a b c d. ((a ~> b) ~> c) ~> d++data Tuple a b = Tuple a b++infixl 6 Tuple as ×+infixl 6 type Tuple as ×++data Either a b = Left a | Right b++infixl 5 type Either as ⊕++third ∷ ∀ a b c. a × b × c → c+third (a × b × c) = c++class Show a where+ show :: a -> String++instance showTuple :: Show a => Show (a × b) where+ show (a × _) = show a++-- Test that precedence is taken into account while desugaring type operators++class TestL a where+ testL :: a++class TestR a where+ testR :: a++-- Note: this type is Either Int (Tuple Int String)+instance testLEither :: TestL (Int ⊕ Int × String) where+ testL = Right (0 × "hi")++-- Note: this type is Either (Tuple Int Int) String+instance testREither :: TestR (Int × Int ⊕ String) where+ testR = Left (0 × 1)
+ tests/purs/docs/src/TypeSynonym.purs view
@@ -0,0 +1,3 @@+module TypeSynonym where++type MyInt = Int
+ tests/purs/docs/src/TypeSynonymInstance.purs view
@@ -0,0 +1,11 @@+-- see #3624+module TypeSynonymInstance where++import Data.Newtype (class Newtype)+import TypeSynonym (MyInt)++newtype MyNT = MyNT MyInt++derive instance ntMyNT :: Newtype MyNT _++foo = 0
+ tests/purs/docs/src/UTF8.purs view
@@ -0,0 +1,7 @@+module UTF8 where++import Prelude (Unit, unit)++-- | üÜäÄ 😰+thing :: Unit+thing = unit
+ tests/purs/docs/src/Virtual.purs view
@@ -0,0 +1,5 @@+module Virtual+ ( module VirtualPrelude )+ where++import Prelude as VirtualPrelude
+ tests/purs/failing/1071.out view
@@ -0,0 +1,22 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/1071.purs:7:18 - 7:23 (line 7, column 18 - line 7, column 23)++ Could not match kind+ [33m [0m+ [33m Type -> Constraint[0m+ [33m [0m+ with kind+ [33m [0m+ [33m Constraint[0m+ [33m [0m++while checking that type [33mFoo a[0m+ has kind [33mConstraint[0m+while inferring the kind of [33mFoo a => a -> a[0m+while inferring the kind of [33mforall a. Foo a => a -> a[0m+in value declaration [33mbar[0m++See https://github.com/purescript/documentation/blob/master/errors/KindsDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/1071.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith KindsDoNotUnify+module Main where++class Foo a b where+ foo :: a -> b++bar :: forall a. Foo a => a -> a+bar a = a
+ tests/purs/failing/1169.out view
@@ -0,0 +1,15 @@+Error found:+in module [33mTest[0m+at tests/purs/failing/1169.purs:12:8 - 12:15 (line 12, column 8 - line 12, column 15)++ Data constructor [33mTest.Inner[0m was given 1 arguments in a case expression, but expected 2 arguments.+ This problem can be fixed by giving [33mTest.Inner[0m 2 arguments.++while checking that expression [33mcase $1 of [0m+ [33m (Inner _) -> true[0m+ has type [33mBoolean[0m+in value declaration [33mtest2[0m++See https://github.com/purescript/documentation/blob/master/errors/IncorrectConstructorArity.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/1169.purs view
@@ -0,0 +1,12 @@+-- @shouldFailWith IncorrectConstructorArity +module Test where++data Outer a = Outer a+ +data Inner a b = Inner a b++test1 :: forall a b. Outer (Inner a b) -> Boolean+test1 (Outer (Inner _)) = true++test2 :: forall a b. Inner a b -> Boolean+test2 (Inner _) = true
+ tests/purs/failing/1175.out view
@@ -0,0 +1,22 @@+Error found:+in module [33mX[0m+at tests/purs/failing/1175.purs:11:11 - 11:12 (line 11, column 11 - line 11, column 12)++ Could not match type+ [33m [0m+ [33m Int[0m+ [33m [0m+ with type+ [33m [0m+ [33m String[0m+ [33m [0m++while checking that type [33mInt[0m+ is at least as general as type [33mString[0m+while checking that expression [33m1[0m+ has type [33mString[0m+in value declaration [33mf[0m++See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/1175.purs view
@@ -0,0 +1,11 @@+-- @shouldFailWith TypesDoNotUnify+module X where++class Foo where+ foo :: String++instance f :: Foo where+ foo = "a"+ where+ bar :: String+ bar = 1
+ tests/purs/failing/1310.out view
@@ -0,0 +1,25 @@+Error found:+in module [33mIssue1310[0m+at tests/purs/failing/1310.purs:18:8 - 18:31 (line 18, column 8 - line 18, column 31)++ No type class instance was found for+ [33m [0m+ [33m Issue1310.Inject Oops [0m+ [33m Effect[0m+ [33m [0m++while applying a function [33minj[0m+ of type [33mInject @t0 t1 t2 => t1 t3 -> t2 t3[0m+ to argument [33mOops (log "Oops")[0m+while checking that expression [33minj (Oops (log "Oops"))[0m+ has type [33mEffect Unit[0m+in value declaration [33mmain[0m++where [33mt0[0m is an unknown type+ [33mt1[0m is an unknown type+ [33mt2[0m is an unknown type+ [33mt3[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/1310.purs view
@@ -0,0 +1,18 @@+-- @shouldFailWith NoInstanceFound++module Issue1310 where++import Prelude+import Effect+import Effect.Console++class Inject f g where+ inj :: forall a. f a -> g a++instance inject :: Inject f f where+ inj x = x++newtype Oops a = Oops (Effect a)++main :: Effect Unit+main = inj (Oops (log "Oops"))
+ tests/purs/failing/1570.out view
@@ -0,0 +1,23 @@+Error found:+in module [33mM[0m+at tests/purs/failing/1570.purs:6:10 - 6:16 (line 6, column 10 - line 6, column 16)++ In a type-annotated expression [33mx :: t[0m, the type [33mt[0m must have kind [33mType[0m.+ The error arises from the type+ [33m [0m+ [33m F[0m+ [33m [0m+ having the kind+ [33m [0m+ [33m Type -> Type[0m+ [33m [0m+ instead.++while inferring the type of [33m\$0 -> [0m+ [33m case $0 of[0m+ [33m x -> x [0m+in value declaration [33mtest[0m++See https://github.com/purescript/documentation/blob/master/errors/ExpectedType.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/1570.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith ExpectedType+module M where++data F a = F a++test = \(x :: F) -> x
+ tests/purs/failing/1733.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/1733.purs:6:8 - 6:25 (line 6, column 8 - line 6, column 25)++ Unknown value [33mThing.doesntExist[0m+++See https://github.com/purescript/documentation/blob/master/errors/UnknownName.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/1733.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith UnknownName+module Main where++import Thingy as Thing++main = Thing.doesntExist "hi"
+ tests/purs/failing/1733/Thingy.purs view
@@ -0,0 +1,4 @@+module Thingy where++foo :: Int+foo = 1
+ tests/purs/failing/1825.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/1825.purs:8:11 - 8:12 (line 8, column 11 - line 8, column 12)++ Unknown value [33ma[0m+++See https://github.com/purescript/documentation/blob/master/errors/UnknownName.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/1825.purs view
@@ -0,0 +1,9 @@+-- @shouldFailWith UnknownName++module Main where++data W = X | Y | Z++bad X a = a+bad Y _ = a+bad Z a = a
+ tests/purs/failing/1881.out view
@@ -0,0 +1,10 @@+Error found:+at tests/purs/failing/1881.purs:5:1 - 5:1 (line 5, column 1 - line 5, column 1)++ Unable to parse module:+ Unexpected or mismatched indentation+++See https://github.com/purescript/documentation/blob/master/errors/ErrorParsingModule.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/1881.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith ErrorParsingModule+module Main where++foo =+bar :: Int+bar = 3
+ tests/purs/failing/2109-bind.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/2109-bind.purs:8:3 - 8:14 (line 8, column 3 - line 8, column 14)++ Unknown value [33mbind[0m. You're probably using do-notation, which the compiler replaces with calls to the [33mbind[0m and [33mdiscard[0m functions. Please import [33mbind[0m from module [33mPrelude[0m+++See https://github.com/purescript/documentation/blob/master/errors/UnknownName.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/2109-bind.purs view
@@ -0,0 +1,9 @@+-- @shouldFailWith UnknownName+module Main where++import Data.Maybe (Maybe(..))+import Prelude (pure)++x = do+ x <- Just 1+ pure x
+ tests/purs/failing/2109-discard.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/2109-discard.purs:7:3 - 7:12 (line 7, column 3 - line 7, column 12)++ Unknown value [33mdiscard[0m. You're probably using do-notation, which the compiler replaces with calls to the [33mbind[0m and [33mdiscard[0m functions. Please import [33mdiscard[0m from module [33mPrelude[0m+++See https://github.com/purescript/documentation/blob/master/errors/UnknownName.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/2109-discard.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith UnknownName+module Main where++import Prelude (unit, pure)++main = do+ pure unit+ pure unit
+ tests/purs/failing/2109-negate.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/2109-negate.purs:4:5 - 4:7 (line 4, column 5 - line 4, column 7)++ Unknown value [33mnegate[0m. You're probably using numeric negation (the unary [33m-[0m operator), which the compiler replaces with calls to the [33mnegate[0m function. Please import [33mnegate[0m from module [33mPrelude[0m+++See https://github.com/purescript/documentation/blob/master/errors/UnknownName.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/2109-negate.purs view
@@ -0,0 +1,4 @@+-- @shouldFailWith UnknownName+module Main where++x = -5
+ tests/purs/failing/2128-class.out view
@@ -0,0 +1,10 @@+Error found:+at tests/purs/failing/2128-class.purs:5:15 - 5:18 (line 5, column 15 - line 5, column 18)++ Unable to parse module:+ Unexpected token '!!!'+++See https://github.com/purescript/documentation/blob/master/errors/ErrorParsingModule.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/2128-class.purs view
@@ -0,0 +1,5 @@+-- @shouldFailWith ErrorParsingModule+module Main where++class Foo a where+ foo :: a -> !!!
+ tests/purs/failing/2128-instance.out view
@@ -0,0 +1,10 @@+Error found:+at tests/purs/failing/2128-instance.purs:8:9 - 8:12 (line 8, column 9 - line 8, column 12)++ Unable to parse module:+ Unexpected token '!!!'+++See https://github.com/purescript/documentation/blob/master/errors/ErrorParsingModule.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/2128-instance.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith ErrorParsingModule+module Main where++class Foo a where+ foo :: a++instance fooInt :: Foo Int where+ foo = !!!
+ tests/purs/failing/2197-shouldFail.out view
@@ -0,0 +1,14 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/2197-shouldFail.purs:9:6 - 9:12 (line 9, column 6 - line 9, column 12)++ Conflicting definitions are in scope for type [33mNumber[0m from the following modules:++ [33mMain[0m+ [33mPrim[0m++++See https://github.com/purescript/documentation/blob/master/errors/ScopeConflict.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/2197-shouldFail.purs view
@@ -0,0 +1,10 @@+-- @shouldFailWith ScopeConflict+module Main where++import Prim as P+import Prim (Number)++type Number = P.Number++z :: Number+z = 0.0
+ tests/purs/failing/2197-shouldFail2.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/2197-shouldFail2.purs:6:6 - 6:12 (line 6, column 6 - line 6, column 12)++ Unknown type [33mNumber[0m+++See https://github.com/purescript/documentation/blob/master/errors/UnknownName.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/2197-shouldFail2.purs view
@@ -0,0 +1,7 @@+-- @shouldFailWith UnknownName+module Main where++import Prim (Boolean)++z :: Number+z = 0.0
+ tests/purs/failing/2378.out view
@@ -0,0 +1,18 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/2378.purs:6:1 - 6:25 (line 6, column 1 - line 6, column 25)++ Orphan instance [33mfooX[0m found for+ [33m [0m+ [33m Lib.Foo "x"[0m+ [33m [0m+ This problem can be resolved by declaring the instance in [33mLib[0m, or by defining the instance on a newtype wrapper.++in type class instance+[33m [0m+[33m Lib.Foo "x"[0m+[33m [0m++See https://github.com/purescript/documentation/blob/master/errors/OrphanInstance.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/2378.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith OrphanInstance+module Main where++import Lib++instance fooX :: Foo "x"
+ tests/purs/failing/2378/Lib.purs view
@@ -0,0 +1,3 @@+module Lib (class Foo) where++class Foo (a :: Symbol)
+ tests/purs/failing/2379.out view
@@ -0,0 +1,31 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/2379.purs:6:8 - 6:19 (line 6, column 8 - line 6, column 19)++ No type class instance was found for class+ [33m [0m+ [33m Lib.Y[0m+ [33m [0m+ because the class was not in scope. Perhaps it was not exported.++while solving type class constraint+[33m [0m+[33m Lib.Y Int[0m+[33m [0m+while applying a function [33mx[0m+ of type [33mX t0 => t0 -> String[0m+ to argument [33m[ 1[0m+ [33m, 2[0m+ [33m, 3[0m+ [33m] [0m+while inferring the type of [33mx [ 1[0m+ [33m , 2[0m+ [33m , 3[0m+ [33m ] [0m+in value declaration [33mtest[0m++where [33mt0[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/UnknownClass.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/2379.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith UnknownClass+module Main where++import Lib++test = x [1, 2, 3]
+ tests/purs/failing/2379/Lib.purs view
@@ -0,0 +1,9 @@+module Lib (class X, x) where++class X a where+ x :: a -> String++class Y a++instance xArray :: Y a => X (Array a) where+ x _ = "[]"
+ tests/purs/failing/2434.out view
@@ -0,0 +1,10 @@+Error found:+at tests/purs/failing/2434.purs:5:13 - 5:14 (line 5, column 13 - line 5, column 14)++ Unable to parse module:+ Illegal astral code point in character literal+++See https://github.com/purescript/documentation/blob/master/errors/ErrorParsingModule.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/2434.purs view
@@ -0,0 +1,5 @@+-- @shouldFailWith ErrorParsingModule+module Main where++x :: Char+x = '\x10000'
+ tests/purs/failing/2534.out view
@@ -0,0 +1,21 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/2534.purs:8:14 - 8:18 (line 8, column 14 - line 8, column 18)++ An infinite type was inferred for an expression:+ [33m [0m+ [33m Array t0[0m+ [33m [0m++while trying to match type [33mArray t1[0m+ with type [33mt0[0m+while checking that expression [33mxs[0m+ has type [33mt0[0m+in value declaration [33mfoo[0m++where [33mt1[0m is an unknown type+ [33mt0[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/InfiniteType.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/2534.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith InfiniteType+module Main where++foo :: Array Int -> Int+foo xs = go xs where+ go :: Array _ -> Int+ go [] = 0+ go xs = go [xs]
+ tests/purs/failing/2542.out view
@@ -0,0 +1,22 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/2542.purs:8:16 - 8:17 (line 8, column 16 - line 8, column 17)++ Type variable [33ma[0m is undefined.++while inferring the kind of [33ma[0m+while checking that type [33ma[0m+ has kind [33mType[0m+while inferring the kind of [33mArray a[0m+while checking that expression [33mbar [0m+ [33m where [0m+ [33m bar = [][0m+ has type [33mArray a0[0m+in value declaration [33mfoo[0m++where [33ma0[0m is a rigid type variable+ bound at (line 7, column 7 - line 7, column 10)++See https://github.com/purescript/documentation/blob/master/errors/UndefinedTypeVariable.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/2542.purs view
@@ -0,0 +1,9 @@+-- @shouldFailWith UndefinedTypeVariable+module Main where++type T = forall a. Array a++foo :: T+foo = bar where+ bar :: Array a+ bar = []
+ tests/purs/failing/2567.out view
@@ -0,0 +1,18 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/2567.purs:7:8 - 7:67 (line 7, column 8 - line 7, column 67)++ Custom error:++ This constraint should be checked+++while checking that type [33mFail (Text "This constraint should be checked") => Int[0m+ is at least as general as type [33mInt[0m+while checking that expression [33m0[0m+ has type [33mInt[0m+in value declaration [33mfoo[0m++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/2567.purs view
@@ -0,0 +1,7 @@+-- @shouldFailWith NoInstanceFound+module Main where++import Prim.TypeError++foo :: Int+foo = (0 :: Fail (Text "This constraint should be checked") => Int)
+ tests/purs/failing/2601.out view
@@ -0,0 +1,21 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/2601.purs:6:12 - 6:15 (line 6, column 12 - line 6, column 15)++ Could not match kind+ [33m [0m+ [33m Type[0m+ [33m [0m+ with kind+ [33m [0m+ [33m Type -> Type[0m+ [33m [0m++while checking that type [33mInt[0m+ has kind [33mType -> Type[0m+while inferring the kind of [33mSyn Int[0m+in value declaration [33mval[0m++See https://github.com/purescript/documentation/blob/master/errors/KindsDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/2601.purs view
@@ -0,0 +1,7 @@+-- @shouldFailWith KindsDoNotUnify+module Main where++type Syn (a :: Type -> Type) = String++val :: Syn Int+val = "bad"
+ tests/purs/failing/2616.out view
@@ -0,0 +1,28 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/2616.purs:9:1 - 9:38 (line 9, column 1 - line 9, column 38)++ No type class instance was found for+ [33m [0m+ [33m Prim.RowList.RowToList r1[0m+ [33m t2[0m+ [33m [0m++while solving type class constraint+[33m [0m+[33m Data.Ord.Ord (Record r1)[0m+[33m [0m+while applying a function [33mcompare[0m+ of type [33mOrd t0 => t0 -> t0 -> Ordering[0m+ to argument [33m$l2[0m+while inferring the type of [33mcompare $l2[0m+in value declaration [33mordFoo[0m++where [33mr1[0m is a rigid type variable+ bound at (line 0, column 0 - line 0, column 0)+ [33mt0[0m is an unknown type+ [33mt2[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/2616.purs view
@@ -0,0 +1,9 @@+-- @shouldFailWith NoInstanceFound+module Main where++import Prelude++newtype Foo r = Foo { | r }++derive instance eqFoo :: Eq (Foo r)+derive instance ordFoo :: Ord (Foo r)
+ tests/purs/failing/2806.out view
@@ -0,0 +1,25 @@+Error found:+in module [33mX[0m+at tests/purs/failing/2806.purs:6:1 - 6:29 (line 6, column 1 - line 6, column 29)++ A case expression could not be determined to cover all inputs.+ The following additional cases are required to cover all inputs:++ [33m_[0m++ Alternatively, add a Partial constraint to the type of the enclosing value.++while checking that type [33mPartial => t1[0m+ is at least as general as type [33ma0[0m+while checking that expression [33mcase e of [0m+ [33m e | L x <- e -> x[0m+ has type [33ma0[0m+in value declaration [33mg[0m++where [33ma0[0m is a rigid type variable+ bound at (line 0, column 0 - line 0, column 0)+ [33mt1[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/2806.purs view
@@ -0,0 +1,7 @@+-- @shouldFailWith NoInstanceFound+module X where++data E a b = L a | R b++g :: forall a b . E a b -> a+g e | L x <- e = x
+ tests/purs/failing/2874-forall.out view
@@ -0,0 +1,10 @@+Error found:+at tests/purs/failing/2874-forall.purs:5:24 - 5:30 (line 5, column 24 - line 5, column 30)++ Unable to parse module:+ Unexpected token 'forall'+++See https://github.com/purescript/documentation/blob/master/errors/ErrorParsingModule.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/2874-forall.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith ErrorParsingModule+module Main where++class T a b | a -> b+instance tT :: (T Int (forall a. a)) => T Int String++ddd :: Int+ddd = 0 :: forall t. T Int t => Int
+ tests/purs/failing/2874-forall2.out view
@@ -0,0 +1,10 @@+Error found:+at tests/purs/failing/2874-forall2.purs:5:12 - 5:18 (line 5, column 12 - line 5, column 18)++ Unable to parse module:+ Unexpected token 'forall'+++See https://github.com/purescript/documentation/blob/master/errors/ErrorParsingModule.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/2874-forall2.purs view
@@ -0,0 +1,10 @@+-- @shouldFailWith ErrorParsingModule+module Main where++class X a b | a -> b+class X a (forall t. t) <= Y a b | a -> b+instance tX :: X Int String+instance tY :: Y Int Boolean++ggg :: Int+ggg = 0 :: forall t. Y Int t => Int
+ tests/purs/failing/2874-wildcard.out view
@@ -0,0 +1,10 @@+Error found:+at tests/purs/failing/2874-wildcard.purs:10:25 - 10:26 (line 10, column 25 - line 10, column 26)++ Unable to parse module:+ Unexpected wildcard in type; type wildcards are only allowed in value annotations+++See https://github.com/purescript/documentation/blob/master/errors/ErrorParsingModule.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/2874-wildcard.purs view
@@ -0,0 +1,11 @@+-- @shouldFailWith ErrorParsingModule+module Main where++class Foo a where+ foo :: a++class Baz b where+ baz :: b++instance bazFoo :: (Baz _) => Foo b where+ foo = baz
+ tests/purs/failing/2947.out view
@@ -0,0 +1,10 @@+Error found:+at tests/purs/failing/2947.purs:10:1 - 10:1 (line 10, column 1 - line 10, column 1)++ Unable to parse module:+ Unexpected or mismatched indentation+++See https://github.com/purescript/documentation/blob/master/errors/ErrorParsingModule.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/2947.purs view
@@ -0,0 +1,10 @@+-- @shouldFailWith ErrorParsingModule++module Main where++import Prelude++data Foo = Foo++instance eqFoo :: Eq Foo where+eq _ _ = true
+ tests/purs/failing/3077.out view
@@ -0,0 +1,25 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/3077.purs:11:14 - 11:38 (line 11, column 14 - line 11, column 38)++ Could not match kind+ [33m [0m+ [33m Type[0m+ [33m [0m+ with kind+ [33m [0m+ [33m Symbol[0m+ [33m [0m++while trying to match type [33mSProxy[0m+ with type [33mt0[0m+while checking that expression [33mSProxy[0m+ has type [33mt0 t1[0m+in value declaration [33mwrong[0m++where [33mt0[0m is an unknown type+ [33mt1[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/KindsDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/3077.purs view
@@ -0,0 +1,11 @@+-- @shouldFailWith KindsDoNotUnify+module Main where++data TProxy (t :: Type) = TProxy+data SProxy (s :: Symbol) = SProxy++put :: forall proxy a. proxy a -> TProxy a+put _ = TProxy++--wrong :: TProxy "apple"+wrong = put (SProxy :: SProxy "apple")
+ tests/purs/failing/3132.out view
@@ -0,0 +1,14 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/3132.purs:2:1 - 18:13 (line 2, column 1 - line 18, column 13)++ An export for [33mclass C3[0m requires the following to also be exported:++ [33mclass C1[0m+ [33mclass C2[0m++++See https://github.com/purescript/documentation/blob/master/errors/TransitiveExportError.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/3132.purs view
@@ -0,0 +1,18 @@+-- @shouldFailWith TransitiveExportError+module Main (class C3) where++import Prelude++import Effect (Effect)+import Effect.Console (log)++class C1+instance inst1 :: C1++class C1 <= C2 a++class (C2 a) <= C3 a b++main :: Effect Unit+main = do+ log "Done"
+ tests/purs/failing/3275-BindingGroupErrorPos.out view
@@ -0,0 +1,24 @@+Error found:+in module [33mBindingGroupErrorPos[0m+at tests/purs/failing/3275-BindingGroupErrorPos.purs:11:17 - 11:23 (line 11, column 17 - line 11, column 23)++ Could not match kind+ [33m [0m+ [33m Type[0m+ [33m [0m+ with kind+ [33m [0m+ [33m Type -> t3[0m+ [33m [0m++while checking that type [33mResult[0m+ has kind [33mType -> t0[0m+while inferring the kind of [33mResult String[0m+while inferring the kind of [33mInt -> Result String[0m+in binding group wrong++where [33mt0[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/KindsDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/3275-BindingGroupErrorPos.purs view
@@ -0,0 +1,12 @@+-- @shouldFailWith KindsDoNotUnify+module BindingGroupErrorPos where++-- This isn't really about KindsDoNotUnify, it's about positioning errors+-- that occur in binding groups++import Prelude++type Result = Array Int++wrong :: Int -> Result String+wrong n = wrong (n - 1)
+ tests/purs/failing/3275-DataBindingGroupErrorPos.out view
@@ -0,0 +1,24 @@+Error found:+in module [33mDataBindingGroupErrorPos[0m+at tests/purs/failing/3275-DataBindingGroupErrorPos.purs:7:19 - 7:22 (line 7, column 19 - line 7, column 22)++ Could not match kind+ [33m [0m+ [33m Type[0m+ [33m [0m+ with kind+ [33m [0m+ [33m t10 -> t11[0m+ [33m [0m++while checking that type [33mBar a[0m+ has kind [33mt0 -> t1[0m+while inferring the kind of [33mBar a a[0m+in data binding group Bar, Foo++where [33mt0[0m is an unknown type+ [33mt1[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/KindsDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/3275-DataBindingGroupErrorPos.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith KindsDoNotUnify+module DataBindingGroupErrorPos where++-- This isn't really about KindsDoNotUnify, it's about positioning errors+-- that occur in data binding groups++data Foo a = Foo (Bar a a)+data Bar a = Bar (Foo a)
+ tests/purs/failing/3329.out view
@@ -0,0 +1,28 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/3329.purs:24:8 - 24:11 (line 24, column 8 - line 24, column 11)++ No type class instance was found for+ [33m [0m+ [33m Main.Inject g0 [0m+ [33m (Either f1 g0)[0m+ [33m [0m+ The following instance partially overlaps the above constraint, which means the rest of its instance chain will not be considered:++ [33mMain.injectLeft[0m+++while checking that type [33mforall (@f :: Type) (@g :: Type). Inject f g => f -> g[0m+ is at least as general as type [33mg0 -> Either f1 g0[0m+while checking that expression [33minj[0m+ has type [33mg0 -> Either f1 g0[0m+in value declaration [33minjR[0m++where [33mf1[0m is a rigid type variable+ bound at (line 24, column 8 - line 24, column 11)+ [33mg0[0m is a rigid type variable+ bound at (line 24, column 8 - line 24, column 11)++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/3329.purs view
@@ -0,0 +1,24 @@+-- @shouldFailWith NoInstanceFound+module Main where++import Data.Either (Either(..))+import Data.Maybe (Maybe(..))++class Inject f g where+ inj :: f -> g+ prj :: g -> Maybe f++instance injectRefl :: Inject x x where+ inj x = x+ prj x = Just x+else instance injectLeft :: Inject l (Either l r) where+ inj x = Left x+ prj (Left x) = Just x+ prj _ = Nothing+else instance injectRight :: Inject x r => Inject x (Either l r) where+ inj x = Right (inj x)+ prj (Right x) = prj x+ prj _ = Nothing++injR :: forall f g. g -> Either f g+injR = inj
+ tests/purs/failing/3335-TypeOpAssociativityError.out view
@@ -0,0 +1,10 @@+Error found:+at tests/purs/failing/3335-TypeOpAssociativityError.purs:6:1 - 6:33 (line 6, column 1 - line 6, column 33)++ Cannot parse an expression that uses multiple instances of the non-associative operator [33mMain.(>>)[0m.+ Use parentheses to resolve this ambiguity.+++See https://github.com/purescript/documentation/blob/master/errors/NonAssociativeError.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/3335-TypeOpAssociativityError.purs view
@@ -0,0 +1,7 @@+-- @shouldFailWith NonAssociativeError+module Main where++infix 6 type Function as >>++const :: forall a b. a >> b >> a+const a _ = a
+ tests/purs/failing/3405.out view
@@ -0,0 +1,18 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/3405.purs:8:1 - 8:43 (line 8, column 1 - line 8, column 43)++ Orphan instance [33meqSomething[0m found for+ [33m [0m+ [33m Data.Eq.Eq Int[0m+ [33m [0m+ This problem can be resolved by declaring the instance in [33mData.Eq[0m, or by defining the instance on a newtype wrapper.++in type class instance+[33m [0m+[33m Data.Eq.Eq Something[0m+[33m [0m++See https://github.com/purescript/documentation/blob/master/errors/OrphanInstance.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/3405.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith OrphanInstance+module Main where++import Prelude++type Something = Int++derive instance eqSomething ∷ Eq Something
+ tests/purs/failing/3453.out view
@@ -0,0 +1,11 @@+Error found:+at tests/purs/failing/3453.purs:6:1 - 6:11 (line 6, column 1 - line 6, column 11)++ A cycle appears in the definition of type synonym [33mS[0m+ Cycles are disallowed because they can lead to loops in the type checker.+ Consider using a 'newtype' instead.+++See https://github.com/purescript/documentation/blob/master/errors/CycleInTypeSynonym.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/3453.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith CycleInTypeSynonym+module Main where++import Data.Newtype (class Newtype)++type S = S+newtype Z = Z S+derive instance newtypeZ :: Newtype Z _
+ tests/purs/failing/3510.out view
@@ -0,0 +1,18 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/3510.purs:7:1 - 7:28 (line 7, column 1 - line 7, column 28)++ Type class instance head is invalid due to use of type+ [33m [0m+ [33m ()[0m+ [33m [0m+ All types appearing in instance declarations must be of the form T a_1 .. a_n, where each type a_i is of the same form, unless the type is fully determined by other type class arguments via functional dependencies.++in type class instance+[33m [0m+[33m Data.Eq.Eq T[0m+[33m [0m++See https://github.com/purescript/documentation/blob/master/errors/InvalidInstanceHead.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/3510.purs view
@@ -0,0 +1,7 @@+-- @shouldFailWith InvalidInstanceHead+module Main where++import Prelude (class Eq)++type T = {}+derive instance eqT :: Eq T
+ tests/purs/failing/3531-2.out view
@@ -0,0 +1,27 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/3531-2.purs:22:11 - 22:22 (line 22, column 11 - line 22, column 22)++ No type class instance was found for+ [33m [0m+ [33m Main.C (X t2 Int)[0m+ [33m [0m+ The following instance partially overlaps the above constraint, which means the rest of its instance chain will not be considered:++ [33mMain.cx[0m++ The instance head contains unknown type variables. Consider adding a type annotation.++while applying a function [33mthing[0m+ of type [33mC t0 => t0 -> t0[0m+ to argument [33mtest1[0m+while inferring the type of [33mthing test1[0m+in value declaration [33mtest2[0m++where [33mt0[0m is an unknown type+ [33mt1[0m is an unknown type+ [33mt2[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/3531-2.purs view
@@ -0,0 +1,23 @@+-- @shouldFailWith NoInstanceFound+module Main where++import Prim.TypeError (class Fail, Text)++class C x where+ thing :: x -> x++data X a b = X++test1 :: forall a. X a Int+test1 = X++instance cx :: C (X x x) where+ thing x = x++else instance cxFail :: Fail (Text "Fell through") => C (X x y) where+ thing x = x++test2 :: Boolean+test2 = do+ let X = thing test1+ true
+ tests/purs/failing/3531-3.out view
@@ -0,0 +1,32 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/3531-3.purs:22:11 - 22:22 (line 22, column 11 - line 22, column 22)++ No type class instance was found for+ [33m [0m+ [33m Main.C (X [0m+ [33m { foo :: Int[0m+ [33m | t1 [0m+ [33m } [0m+ [33m { foo :: Int[0m+ [33m } [0m+ [33m ) [0m+ [33m [0m+ The following instance partially overlaps the above constraint, which means the rest of its instance chain will not be considered:++ [33mMain.cx[0m++ The instance head contains unknown type variables. Consider adding a type annotation.++while applying a function [33mthing[0m+ of type [33mC t0 => t0 -> t0[0m+ to argument [33mtest1[0m+while inferring the type of [33mthing test1[0m+in value declaration [33mtest2[0m++where [33mt0[0m is an unknown type+ [33mt1[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/3531-3.purs view
@@ -0,0 +1,23 @@+-- @shouldFailWith NoInstanceFound+module Main where++import Prim.TypeError (class Fail, Text)++class C x where+ thing :: x -> x++data X a b = X++test1 :: forall r. X { foo :: Int | r } { foo :: Int }+test1 = X++instance cx :: C (X x x) where+ thing x = x++else instance cxFail :: Fail (Text "Fell through") => C (X x y) where+ thing x = x++test2 :: Boolean+test2 = do+ let X = thing test1+ true
+ tests/purs/failing/3531-4.out view
@@ -0,0 +1,33 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/3531-4.purs:21:7 - 21:27 (line 21, column 7 - line 21, column 27)++ No type class instance was found for+ [33m [0m+ [33m Main.C a4[0m+ [33m b5[0m+ [33m [0m+ The following instances partially overlap the above constraint, which means the rest of their instance chains will not be considered:++ [33mMain.c1[0m+ [33mMain.c3[0m+++while applying a function [33mc[0m+ of type [33mC @t0 @t1 t2 t3 => Proxy @t0 t2 -> Proxy @t1 t3 -> Boolean[0m+ to argument [33mProxy[0m+while inferring the type of [33mc Proxy[0m+in value declaration [33mfn[0m++where [33ma4[0m is a rigid type variable+ bound at (line 0, column 0 - line 0, column 0)+ [33mb5[0m is a rigid type variable+ bound at (line 0, column 0 - line 0, column 0)+ [33mt0[0m is an unknown type+ [33mt1[0m is an unknown type+ [33mt2[0m is an unknown type+ [33mt3[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/3531-4.purs view
@@ -0,0 +1,21 @@+-- @shouldFailWith NoInstanceFound+module Main where++data Proxy a = Proxy++class C a b where+ c :: Proxy a -> Proxy b -> Boolean++instance c1 :: C String String where+ c _ _ = true+else instance c2 :: C String a where+ c _ _ = false++instance c3 :: C Int Int where+ c _ _ = true+else instance c4 :: C Int a where+ c _ _ = false++fn :: forall a b. Proxy a -> Proxy b -> Int+fn _ _ = 42 where+ x = c (Proxy :: Proxy a) (Proxy :: Proxy b)
+ tests/purs/failing/3531-5.out view
@@ -0,0 +1,32 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/3531-5.purs:16:7 - 16:27 (line 16, column 7 - line 16, column 27)++ No type class instance was found for+ [33m [0m+ [33m Main.C a4[0m+ [33m b5[0m+ [33m [0m+ The following instance partially overlaps the above constraint, which means the rest of its instance chain will not be considered:++ instance in module [33mMain[0m with type [33mforall a. C String (Array a)[0m (line 9, column 1 - line 10, column 15)+++while applying a function [33mc[0m+ of type [33mC @t0 @t1 t2 t3 => Proxy @t0 t2 -> Proxy @t1 t3 -> Boolean[0m+ to argument [33mProxy[0m+while inferring the type of [33mc Proxy[0m+in value declaration [33mfn[0m++where [33ma4[0m is a rigid type variable+ bound at (line 0, column 0 - line 0, column 0)+ [33mb5[0m is a rigid type variable+ bound at (line 0, column 0 - line 0, column 0)+ [33mt0[0m is an unknown type+ [33mt1[0m is an unknown type+ [33mt2[0m is an unknown type+ [33mt3[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/3531-5.purs view
@@ -0,0 +1,16 @@+-- @shouldFailWith NoInstanceFound+module Main where++data Proxy a = Proxy++class C a b where+ c :: Proxy a -> Proxy b -> Boolean++instance C String (Array a) where+ c _ _ = true+else instance c2 :: C String a where+ c _ _ = false++fn :: forall a b. Proxy a -> Proxy b -> Int+fn _ _ = 42 where+ x = c (Proxy :: Proxy a) (Proxy :: Proxy b)
+ tests/purs/failing/3531-6.out view
@@ -0,0 +1,33 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/3531-6.purs:21:7 - 21:27 (line 21, column 7 - line 21, column 27)++ No type class instance was found for+ [33m [0m+ [33m Main.C a4[0m+ [33m b5[0m+ [33m [0m+ The following instances partially overlap the above constraint, which means the rest of their instance chains will not be considered:++ instance in module [33mMain[0m with type [33mforall a. C String (Array a)[0m (line 9, column 1 - line 10, column 15)+ instance in module [33mMain[0m with type [33mC Int Int[0m (line 14, column 1 - line 15, column 15)+++while applying a function [33mc[0m+ of type [33mC @t0 @t1 t2 t3 => Proxy @t0 t2 -> Proxy @t1 t3 -> Boolean[0m+ to argument [33mProxy[0m+while inferring the type of [33mc Proxy[0m+in value declaration [33mfn[0m++where [33ma4[0m is a rigid type variable+ bound at (line 0, column 0 - line 0, column 0)+ [33mb5[0m is a rigid type variable+ bound at (line 0, column 0 - line 0, column 0)+ [33mt0[0m is an unknown type+ [33mt1[0m is an unknown type+ [33mt2[0m is an unknown type+ [33mt3[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/3531-6.purs view
@@ -0,0 +1,21 @@+-- @shouldFailWith NoInstanceFound+module Main where++data Proxy a = Proxy++class C a b where+ c :: Proxy a -> Proxy b -> Boolean++instance C String (Array a) where+ c _ _ = true+else instance c2 :: C String a where+ c _ _ = false++instance C Int Int where+ c _ _ = true+else instance c4 :: C Int a where+ c _ _ = false++fn :: forall a b. Proxy a -> Proxy b -> Int+fn _ _ = 42 where+ x = c (Proxy :: Proxy a) (Proxy :: Proxy b)
+ tests/purs/failing/3531.out view
@@ -0,0 +1,27 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/3531.purs:16:7 - 16:27 (line 16, column 7 - line 16, column 27)++ No type class instance was found for+ [33m [0m+ [33m Main.C a2[0m+ [33m [0m+ The following instance partially overlaps the above constraint, which means the rest of its instance chain will not be considered:++ [33mMain.c1[0m+++while applying a function [33mc[0m+ of type [33mC @t0 t1 => Proxy @t0 t1 -> Boolean[0m+ to argument [33mProxy[0m+while inferring the type of [33mc Proxy[0m+in value declaration [33mfn[0m++where [33ma2[0m is a rigid type variable+ bound at (line 0, column 0 - line 0, column 0)+ [33mt0[0m is an unknown type+ [33mt1[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/3531.purs view
@@ -0,0 +1,16 @@+-- @shouldFailWith NoInstanceFound+module Main where++data Proxy a = Proxy++class C a where+ c :: Proxy a -> Boolean++instance c1 :: C String where+ c _ = true+else instance c2 :: C a where+ c _ = false++fn :: forall a. Proxy a -> Int+fn _ = 42 where+ x = c (Proxy :: Proxy a)
+ tests/purs/failing/3549-a.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/3549-a.purs:6:26 - 6:29 (line 6, column 26 - line 6, column 29)++ Unknown type [33mTyp[0m+++See https://github.com/purescript/documentation/blob/master/errors/UnknownName.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/3549-a.purs view
@@ -0,0 +1,10 @@+-- @shouldFailWith UnknownName+module Main where++import Effect.Console (log)++identity :: forall (a :: Typ) . a -> a+identity x = x++main = log "Done"+
+ tests/purs/failing/3549.out view
@@ -0,0 +1,25 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/3549.purs:8:78 - 8:79 (line 8, column 78 - line 8, column 79)++ Could not match kind+ [33m [0m+ [33m Type -> Type[0m+ [33m [0m+ with kind+ [33m [0m+ [33m Type[0m+ [33m [0m++while checking that type [33mf[0m+ has kind [33mType -> Type[0m+while inferring the kind of [33mFunctor f[0m+while inferring the kind of [33mFunctor f => (a -> b) -> f a -> f b[0m+while inferring the kind of [33mforall (b :: Type). Functor f => (a -> b) -> f a -> f b[0m+while inferring the kind of [33mforall (a :: Type) (b :: Type). Functor f => (a -> b) -> f a -> f b[0m+while inferring the kind of [33mforall (f :: Type -> Type -> Type) (a :: Type) (b :: Type). Functor f => (a -> b) -> f a -> f b[0m+in value declaration [33mmap'[0m++See https://github.com/purescript/documentation/blob/master/errors/KindsDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/3549.purs view
@@ -0,0 +1,11 @@+-- @shouldFailWith KindsDoNotUnify+module Main where++import Prelude++import Effect.Console (log)++map' :: forall (f :: Type -> Type -> Type) (a :: Type) (b :: Type) . Functor f => (a -> b) -> f a -> f b+map' = map++main = log "Done"
+ tests/purs/failing/365.out view
@@ -0,0 +1,9 @@+Error found:+at tests/purs/failing/365.purs:10:1 - 12:8 (line 10, column 1 - line 12, column 8)++ The value of [33mcS[0m is undefined here, so this reference is not allowed.+++See https://github.com/purescript/documentation/blob/master/errors/CycleInDeclaration.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/365.purs view
@@ -0,0 +1,14 @@+-- @shouldFailWith CycleInDeclaration+module Main where++import Prelude++class C a where+ f :: a -> a+ g :: a -> a++instance cS :: C String where+ f s = s+ g = f++main = g "Done"
+ tests/purs/failing/3689.out view
@@ -0,0 +1,10 @@+Error found:+at tests/purs/failing/3689.purs:5:5 - 5:10 (line 5, column 5 - line 5, column 10)++ Unable to parse module:+ Unexpected quoted label in record pun, perhaps due to a missing ':'+++See https://github.com/purescript/documentation/blob/master/errors/ErrorParsingModule.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/3689.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith ErrorParsingModule+module Main where++test =+ { "bad"+ }
+ tests/purs/failing/3701.out view
@@ -0,0 +1,64 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/3701.purs:39:8 - 39:34 (line 39, column 8 - line 39, column 34)++ Could not match type+ [33m [0m+ [33m ( ... )[0m+ [33m [0m+ with type+ [33m [0m+ [33m ( thing1 :: String[0m+ [33m ... [0m+ [33m ) [0m+ [33m [0m++while solving type class constraint+[33m [0m+[33m Prim.Row.Nub ( thing1 :: String[0m+[33m , thing1 :: String[0m+[33m , thing2 :: Int [0m+[33m ) [0m+[33m ( thing1 :: String[0m+[33m , thing1 :: String[0m+[33m , thing2 :: Int [0m+[33m ) [0m+[33m [0m+while applying a function [33mfooMerge[0m+ of type [33mUnion @Type t0 [0m+ [33m ( thing1 :: String [0m+ [33m , thing2 :: Int [0m+ [33m ) [0m+ [33m ( thing1 :: String [0m+ [33m , thing2 :: Int [0m+ [33m | t0 [0m+ [33m ) [0m+ [33m => Nub @Type [0m+ [33m ( thing1 :: String [0m+ [33m , thing2 :: Int [0m+ [33m | t0 [0m+ [33m ) [0m+ [33m ( thing1 :: String [0m+ [33m , thing2 :: Int [0m+ [33m | t0 [0m+ [33m ) [0m+ [33m => Record t0 [0m+ [33m -> { thing1 :: String[0m+ [33m , thing2 :: Int [0m+ [33m | t0 [0m+ [33m } [0m+ to argument [33m{ thing1: "foo"[0m+ [33m} [0m+while checking that expression [33mfooMerge { thing1: "foo"[0m+ [33m } [0m+ has type [33m{ thing1 :: String[0m+ [33m, thing1 :: String[0m+ [33m, thing2 :: Int [0m+ [33m} [0m+in value declaration [33mfoo2[0m++where [33mt0[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/3701.purs view
@@ -0,0 +1,39 @@+-- @shouldFailWith TypesDoNotUnify+module Main where++import Prim.Row as Row++merge+ :: forall r1 r2 r3 r4+ . Row.Union r1 r2 r3+ => Row.Nub r3 r4+ => Record r1+ -> Record r2+ -> Record r4+merge r = merge r+++type FooRow r =+ ( thing1 :: String+ , thing2 :: Int+ | r+ )++type AddedRow =+ ( thing3 :: String )++type AddedRow2 =+ ( thing1 :: String )++fooMerge :: forall addedRow.+ Row.Union addedRow (FooRow ()) (FooRow addedRow) =>+ Row.Nub (FooRow addedRow) (FooRow addedRow) =>+ Record addedRow ->+ Record (FooRow addedRow)+fooMerge addedRow = merge addedRow {thing1: "foo", thing2: 1}++foo1 :: Record (FooRow (AddedRow))+foo1 = fooMerge { thing3: "foo" }++foo2 :: Record (FooRow (AddedRow2))+foo2 = fooMerge { thing1: "foo" }
+ tests/purs/failing/3765-kinds.out view
@@ -0,0 +1,29 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/3765-kinds.purs:7:28 - 7:29 (line 7, column 28 - line 7, column 29)++ Could not match kind+ [33m [0m+ [33m ( a :: Int[0m+ [33m | t11 [0m+ [33m ) [0m+ [33m [0m+ with kind+ [33m [0m+ [33m ( b :: Int[0m+ [33m | t11 [0m+ [33m ) [0m+ [33m [0m++while checking that type [33mx[0m+ has kind [33m{ b :: Int[0m+ [33m| t0 [0m+ [33m} [0m+while inferring the kind of [33mTricky x x[0m+in type synonym [33mMkTricky[0m++where [33mt0[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/KindsDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/3765-kinds.purs view
@@ -0,0 +1,7 @@+-- @shouldFailWith KindsDoNotUnify+module Main where++data Tricky :: forall r. {a :: Int | r} -> {b :: Int | r} -> Type+data Tricky x y = Tricky++type MkTricky x = Tricky x x
+ tests/purs/failing/3765.out view
@@ -0,0 +1,35 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/3765.purs:6:23 - 6:24 (line 6, column 23 - line 6, column 24)++ Could not match type+ [33m [0m+ [33m ( b :: Int[0m+ [33m ... [0m+ [33m | t0 [0m+ [33m ) [0m+ [33m [0m+ with type+ [33m [0m+ [33m ( a :: Int[0m+ [33m ... [0m+ [33m | t0 [0m+ [33m ) [0m+ [33m [0m++while trying to match type [33m{ b :: Int[0m+ [33m| t0 [0m+ [33m} [0m+ with type [33mt1[0m+while checking that expression [33mx[0m+ has type [33m{ b :: Int[0m+ [33m| t0 [0m+ [33m} [0m+in value declaration [33mmkTricky[0m++where [33mt1[0m is an unknown type+ [33mt0[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/3765.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith TypesDoNotUnify+module Main where++data Tricky r = Tricky {a :: Int | r} {b :: Int | r}++mkTricky x = Tricky x x
+ tests/purs/failing/3891.out view
@@ -0,0 +1,24 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/3891.purs:4:8 - 4:15 (line 4, column 8 - line 4, column 15)++ Could not match type+ [33m [0m+ [33m String[0m+ [33m [0m+ with type+ [33m [0m+ [33m String -> t0[0m+ [33m [0m++while applying a function [33m"("[0m+ of type [33mString[0m+ to argument [33m")"[0m+while inferring the type of [33m"(" ")"[0m+in value declaration [33moops[0m++where [33mt0[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/3891.purs view
@@ -0,0 +1,4 @@+-- @shouldFailWith TypesDoNotUnify+module Main where++oops = "(" ")"
+ tests/purs/failing/4019-1.out view
@@ -0,0 +1,27 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/4019-1.purs:26:21 - 26:24 (line 26, column 21 - line 26, column 24)++ Could not match kind+ [33m [0m+ [33m K1[0m+ [33m [0m+ with kind+ [33m [0m+ [33m K2[0m+ [33m [0m++while trying to match type [33mIndexed @Type @K1 @K2 Array[0m+ with type [33mt0[0m+while checking that expression [33mfoo[0m+ has type [33mt0 t1 t2 t3[0m+in value declaration [33mbar[0m++where [33mt0[0m is an unknown type+ [33mt3[0m is an unknown type+ [33mt1[0m is an unknown type+ [33mt2[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/KindsDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/4019-1.purs view
@@ -0,0 +1,26 @@+-- @shouldFailWith KindsDoNotUnify+module Main where++import Prelude++newtype Indexed ∷ forall k1 k2 k3. (k1 → Type) → k2 → k3 → k1 → Type+newtype Indexed m x y a = Indexed (m a)++class IxFunctor ∷ ∀ ix. (ix → ix → Type → Type) → Constraint+class IxFunctor f where+ imap ∷ ∀ a b x y. (a → b) → f x y a → f x y b++instance ixFunctorIndexed ∷ Functor m ⇒ IxFunctor (Indexed m) where+ imap f (Indexed ma) = Indexed (map f ma)++foreign import data K1 :: Type+foreign import data K2 :: Type++foreign import data D1 :: K1+foreign import data D2 :: K2++foo :: Indexed Array D1 D2 Int+foo = Indexed [1]++bar :: Indexed Array D1 D2 Int+bar = imap identity foo
+ tests/purs/failing/4019-2.out view
@@ -0,0 +1,28 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/4019-2.purs:26:22 - 26:60 (line 26, column 22 - line 26, column 60)++ Could not match kind+ [33m [0m+ [33m K1[0m+ [33m [0m+ with kind+ [33m [0m+ [33m K2[0m+ [33m [0m++while trying to match type [33mIndexed @Type @K1 @K2 Array[0m+ with type [33mt0[0m+while checking that expression [33mIndexed [ 1[0m+ [33m ] [0m+ has type [33mt0 t1 t2 t3[0m+in value declaration [33mbar[0m++where [33mt0[0m is an unknown type+ [33mt3[0m is an unknown type+ [33mt1[0m is an unknown type+ [33mt2[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/KindsDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/4019-2.purs view
@@ -0,0 +1,26 @@+-- @shouldFailWith KindsDoNotUnify+module Main where++import Prelude++newtype Indexed ∷ forall k1 k2 k3. (k1 → Type) → k2 → k3 → k1 → Type+newtype Indexed m x y a = Indexed (m a)++class IxFunctor ∷ ∀ ix. (ix → ix → Type → Type) → Constraint+class IxFunctor f where+ imap ∷ ∀ a b x y. (a → b) → f x y a → f x y b++instance ixFunctorIndexed ∷ Functor m ⇒ IxFunctor (Indexed m) where+ imap f (Indexed ma) = Indexed (map f ma)++foreign import data K1 :: Type+foreign import data K2 :: Type++foreign import data D1 :: K1+foreign import data D2 :: K2++foo :: Indexed Array D1 D2 Int+foo = Indexed [1]++bar :: Indexed Array D1 D2 Int+bar = imap identity (Indexed [1] :: Indexed Array D1 D2 Int)
+ tests/purs/failing/4024-2.out view
@@ -0,0 +1,27 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/4024-2.purs:10:8 - 10:13 (line 10, column 8 - line 10, column 13)++ No type class instance was found for+ [33m [0m+ [33m Main.Foo t2 [0m+ [33m t3 [0m+ [33m String[0m+ [33m [0m+ The instance head contains unknown type variables. Consider adding a type annotation.++while applying a function [33mbar[0m+ of type [33mFoo @t0 @t1 @Type t2 t3 String => Int -> String[0m+ to argument [33m0[0m+while checking that expression [33mbar 0[0m+ has type [33mString[0m+in value declaration [33mtest[0m++where [33mt0[0m is an unknown type+ [33mt1[0m is an unknown type+ [33mt2[0m is an unknown type+ [33mt3[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/4024-2.purs view
@@ -0,0 +1,11 @@+-- @shouldFailWith NoInstanceFound+module Main where++class Foo a b c | a -> b c, b -> a c++bar :: forall a b. Foo a b String => Int -> String+bar _ = ""++test :: String+test = bar 0+
+ tests/purs/failing/4024.out view
@@ -0,0 +1,26 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/4024.purs:10:8 - 10:13 (line 10, column 8 - line 10, column 13)++ No type class instance was found for+ [33m [0m+ [33m Main.Foo String[0m+ [33m t2 [0m+ [33m t3 [0m+ [33m [0m++while applying a function [33mbar[0m+ of type [33mFoo @Type @t0 @t1 String t2 t3 => Int -> String[0m+ to argument [33m0[0m+while checking that expression [33mbar 0[0m+ has type [33mString[0m+in value declaration [33mtest[0m++where [33mt0[0m is an unknown type+ [33mt1[0m is an unknown type+ [33mt2[0m is an unknown type+ [33mt3[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/4024.purs view
@@ -0,0 +1,10 @@+-- @shouldFailWith NoInstanceFound+module Main where++class Foo a b c | a -> b c, b -> a c++bar :: forall a b. Foo String a b => Int -> String+bar _ = ""++test :: String+test = bar 0
+ tests/purs/failing/4028.out view
@@ -0,0 +1,27 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/4028.purs:29:12 - 29:37 (line 29, column 12 - line 29, column 37)++ No type class instance was found for+ [33m [0m+ [33m Main.TLShow (S i2)[0m+ [33m [0m+ The following instance partially overlaps the above constraint, which means the rest of its instance chain will not be considered:++ [33mMain.tlShow2[0m+++while applying a function [33mgo[0m+ of type [33mTLShow @t0 t1 => Proxy @t0 t1 -> Int -> String[0m+ to argument [33mProxy[0m+while inferring the type of [33mgo Proxy[0m+in value declaration [33mpeano[0m++where [33mi2[0m is a rigid type variable+ bound at (line 0, column 0 - line 0, column 0)+ [33mt0[0m is an unknown type+ [33mt1[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/4028.purs view
@@ -0,0 +1,29 @@+-- @shouldFailWith NoInstanceFound+module Main where++import Prelude++import Type.Proxy (Proxy(..))++foreign import data Peano :: Type++foreign import data Z :: Peano+foreign import data S :: Peano -> Peano++class TLShow :: forall k. k -> Constraint+class TLShow i where+ tlShow :: Proxy i -> String++instance tlShow2 :: TLShow (S (S Z)) where+ tlShow _ = "2"+else instance tlShow0 :: TLShow Z where+ tlShow _ = "0"+else instance tlShowS :: TLShow x => TLShow (S x) where+ tlShow _ = "S" <> tlShow (Proxy :: Proxy x)++peano :: Int -> String+peano = go (Proxy :: Proxy Z)+ where+ go :: forall i. TLShow i => Proxy i -> Int -> String+ go p 0 = tlShow p+ go _ n = go (Proxy :: Proxy (S i)) (n - 1)
+ tests/purs/failing/4158.out view
@@ -0,0 +1,34 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/4158.purs:9:10 - 9:11 (line 9, column 10 - line 9, column 11)++ Could not match type+ [33m [0m+ [33m a1[0m+ [33m [0m+ with type+ [33m [0m+ [33m b0[0m+ [33m [0m++while trying to match type [33m{ foo :: Int[0m+ [33m| a1 [0m+ [33m} [0m+ with type [33m{ foo :: Int[0m+ [33m| b0 [0m+ [33m} [0m+while checking that expression [33mr[0m+ has type [33mMaybe [0m+ [33m { foo :: Int[0m+ [33m | b0 [0m+ [33m } [0m+in value declaration [33mevil[0m++where [33ma1[0m is a rigid type variable+ bound at (line 0, column 0 - line 0, column 0)+ [33mb0[0m is a rigid type variable+ bound at (line 0, column 0 - line 0, column 0)++See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/4158.purs view
@@ -0,0 +1,9 @@+-- @shouldFailWith TypesDoNotUnify+module Main where++import Prelude++data Maybe a = Just a | Nothing++evil :: forall a b. Maybe (Record (foo :: Int | a)) -> Maybe (Record (foo :: Int | b))+evil r = r
+ tests/purs/failing/438.out view
@@ -0,0 +1,25 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/438.purs:15:11 - 15:25 (line 15, column 11 - line 15, column 25)++ Type class instance for+ [33m [0m+ [33m Data.Eq.Eq (Array (Fix Array))[0m+ [33m [0m+ is possibly infinite.++while solving type class constraint+[33m [0m+[33m Data.Eq.Eq (Fix Array)[0m+[33m [0m+while applying a function [33meq[0m+ of type [33mEq t0 => t0 -> t0 -> Boolean[0m+ to argument [33mIn [][0m+while inferring the type of [33meq (In [])[0m+in value declaration [33mexample[0m++where [33mt0[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/PossiblyInfiniteInstance.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/438.purs view
@@ -0,0 +1,15 @@+-- @shouldFailWith PossiblyInfiniteInstance++-- See issue 438 for details: this test is mainly here to test that code like+-- this doesn't cause the compiler to loop.++module Main where++import Prelude++data Fix f = In (f (Fix f))++instance eqFix :: (Eq (f (Fix f))) => Eq (Fix f) where+ eq (In f) (In g) = f == g++example = In [] == In []
+ tests/purs/failing/4382.out view
@@ -0,0 +1,55 @@+Error 1 of 5:++ in module [33mMain[0m+ at tests/purs/failing/4382.purs:10:7 - 10:14 (line 10, column 7 - line 10, column 14)++ Unknown type class [33mRinku[0m+++ See https://github.com/purescript/documentation/blob/master/errors/UnknownName.md for more information,+ or to contribute content related to this error.++Error 2 of 5:++ in module [33mMain[0m+ at tests/purs/failing/4382.purs:13:10 - 13:17 (line 13, column 10 - line 13, column 17)++ Unknown type class [33mRinku[0m+++ See https://github.com/purescript/documentation/blob/master/errors/UnknownName.md for more information,+ or to contribute content related to this error.++Error 3 of 5:++ in module [33mMain[0m+ at tests/purs/failing/4382.purs:16:10 - 16:17 (line 16, column 10 - line 16, column 17)++ Unknown type class [33mRinku[0m+++ See https://github.com/purescript/documentation/blob/master/errors/UnknownName.md for more information,+ or to contribute content related to this error.++Error 4 of 5:++ in module [33mMain[0m+ at tests/purs/failing/4382.purs:18:17 - 18:28 (line 18, column 17 - line 18, column 28)++ Unknown type class [33mRinku[0m+++ See https://github.com/purescript/documentation/blob/master/errors/UnknownName.md for more information,+ or to contribute content related to this error.++Error 5 of 5:++ in module [33mMain[0m+ at tests/purs/failing/4382.purs:20:25 - 20:36 (line 20, column 25 - line 20, column 36)++ Unknown type class [33mRinku[0m+++ See https://github.com/purescript/documentation/blob/master/errors/UnknownName.md for more information,+ or to contribute content related to this error.+
+ tests/purs/failing/4382.purs view
@@ -0,0 +1,20 @@+-- @shouldFailWith UnknownName+-- @shouldFailWith UnknownName+-- @shouldFailWith UnknownName+-- @shouldFailWith UnknownName+-- @shouldFailWith UnknownName+module Main where++newtype T a = T a++class Rinku a <= Maho a where+ tPose :: a -> a++instance Rinku a => Maho a where+ tPose = \a -> a++instance Rinku a++derive instance Rinku (T a)++derive newtype instance Rinku (T a)
+ tests/purs/failing/4408Acyclic.out view
@@ -0,0 +1,22 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/4408Acyclic.purs:16:9 - 16:14 (line 16, column 9 - line 16, column 14)++ Hole '[33mhelp[0m' has the inferred type+ [33m [0m+ [33m Int -> K[0m+ [33m [0m+ You could substitute the hole with one of these values:+ [33m [0m+ [33m Main.aRinku :: Int -> K [0m+ [33m Main.cMuni :: Int -> K [0m+ [33m Safe.Coerce.coerce :: forall a b. Coercible a b => a -> b[0m+ [33m Unsafe.Coerce.unsafeCoerce :: forall a b. a -> b [0m+ [33m Main.K :: Int -> K [0m+ [33m [0m++in value declaration [33mbMaho[0m++See https://github.com/purescript/documentation/blob/master/errors/HoleInferredType.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/4408Acyclic.purs view
@@ -0,0 +1,22 @@+-- @shouldFailWith HoleInferredType+module Main where++-- Expected:+--+-- aRinku+cMuni -> bMaho -> dRei+--+-- Both aRinku and cMuni is suggested++newtype K = K Int++aRinku :: Int -> K+aRinku = K++bMaho :: K+bMaho = ?help 0++cMuni :: Int -> K+cMuni = K++dRei :: Int -> K+dRei _ = bMaho
+ tests/purs/failing/4408AcyclicRecursive.out view
@@ -0,0 +1,23 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/4408AcyclicRecursive.purs:17:11 - 17:16 (line 17, column 11 - line 17, column 16)++ Hole '[33mhelp[0m' has the inferred type+ [33m [0m+ [33m Int -> K[0m+ [33m [0m+ You could substitute the hole with one of these values:+ [33m [0m+ [33m Main.aRinku :: Int -> K [0m+ [33m Main.bMaho :: Int -> K [0m+ [33m Main.cMuni :: Int -> K [0m+ [33m Safe.Coerce.coerce :: forall a b. Coercible a b => a -> b[0m+ [33m Unsafe.Coerce.unsafeCoerce :: forall a b. a -> b [0m+ [33m Main.K :: Int -> K [0m+ [33m [0m++in value declaration [33mbMaho[0m++See https://github.com/purescript/documentation/blob/master/errors/HoleInferredType.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/4408AcyclicRecursive.purs view
@@ -0,0 +1,23 @@+-- @shouldFailWith HoleInferredType+module Main where++-- Expected:+--+-- aRinku+cMuni -> bMaho -> dRei+--+-- aRinku, cMuni, and bMaho are all suggested.+-- bMaho can be aware of itself during checking.++newtype K = K Int++aRinku :: Int -> K+aRinku = K++bMaho :: Int -> K+bMaho _ = ?help 0++cMuni :: Int -> K+cMuni = K++dRei :: Int -> K+dRei _ = bMaho
+ tests/purs/failing/4408Cyclic.out view
@@ -0,0 +1,31 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/4408Cyclic.purs:23:29 - 23:34 (line 23, column 29 - line 23, column 34)++ Hole '[33mhelp[0m' has the inferred type+ [33m [0m+ [33m Int -> K[0m+ [33m [0m+ You could substitute the hole with one of these values:+ [33m [0m+ [33m Main.aSaki :: Int -> K [0m+ [33m Main.bNoa :: forall a. a -> K [0m+ [33m Main.cTowa :: forall a. a -> K [0m+ [33m Main.eSaki :: Int -> K [0m+ [33m Safe.Coerce.coerce :: forall a b. Coercible a b => a -> b[0m+ [33m Unsafe.Coerce.unsafeCoerce :: forall a b. a -> b [0m+ [33m Main.K :: Int -> K [0m+ [33m [0m+ in the following context:++ a :: [33ma0[0m+++in binding group cTowa, bNoa++where [33ma0[0m is a rigid type variable+ bound at (line 0, column 0 - line 0, column 0)++See https://github.com/purescript/documentation/blob/master/errors/HoleInferredType.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/4408Cyclic.purs view
@@ -0,0 +1,29 @@+-- @shouldFailWith HoleInferredType+module Main where++-- Expected:+--+-- aSaki/eSaki -> bNoa~cTowa -> dIbuki+--+-- Only aSaki/eSaki, bNoa, and cTowa is suggested.+--+-- The mutual recursion between bNoa and cTowa+-- ensures they exist "at the same time". dIbuki+-- depends on cTowa, so it's checked much later.++newtype K = K Int++aSaki :: Int -> K+aSaki = K++bNoa :: forall a. a -> K+bNoa a = let _ = cTowa a in K 0++cTowa :: forall a. a -> K+cTowa a = let _ = bNoa a in ?help 0++dIbuki :: Int -> K+dIbuki = bNoa++eSaki :: Int -> K+eSaki = K
+ tests/purs/failing/4408CyclicTail.out view
@@ -0,0 +1,26 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/4408CyclicTail.purs:22:11 - 22:16 (line 22, column 11 - line 22, column 16)++ Hole '[33mhelp[0m' has the inferred type+ [33m [0m+ [33m Int -> K[0m+ [33m [0m+ You could substitute the hole with one of these values:+ [33m [0m+ [33m Main.aKyoko :: Int -> K [0m+ [33m Main.bShinobu :: forall a. a -> K [0m+ [33m Main.cEsora :: forall a. a -> K [0m+ [33m Main.dYuka :: Int -> K [0m+ [33m Main.eShinobu :: forall a. a -> K [0m+ [33m Main.fEsora :: forall a. a -> K [0m+ [33m Safe.Coerce.coerce :: forall a b. Coercible a b => a -> b[0m+ [33m Unsafe.Coerce.unsafeCoerce :: forall a b. a -> b [0m+ [33m Main.K :: Int -> K [0m+ [33m [0m++in value declaration [33mdYuka[0m++See https://github.com/purescript/documentation/blob/master/errors/HoleInferredType.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/4408CyclicTail.purs view
@@ -0,0 +1,28 @@+-- @shouldFailWith HoleInferredType+module Main where++-- Expected:+--+-- aKyoko -> bShinobu~cEsora/eShinobu~fEsora -> dYuka+--+-- All are suggested, as dYuka is also recursive.++newtype K = K Int++aKyoko :: Int -> K+aKyoko = K++bShinobu :: forall a. a -> K+bShinobu a = let _ = cEsora a in K 0++cEsora :: forall a. a -> K+cEsora a = let _ = bShinobu a in K 0++dYuka :: Int -> K+dYuka _ = ?help 0++eShinobu :: forall a. a -> K+eShinobu a = let _ = fEsora a in K 0++fEsora :: forall a. a -> K+fEsora a = let _ = eShinobu a in K 0
+ tests/purs/failing/4408CyclicTriple.out view
@@ -0,0 +1,32 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/4408CyclicTriple.purs:22:33 - 22:38 (line 22, column 33 - line 22, column 38)++ Hole '[33mhelp[0m' has the inferred type+ [33m [0m+ [33m Int -> K[0m+ [33m [0m+ You could substitute the hole with one of these values:+ [33m [0m+ [33m Main.aHaruna :: Int -> K [0m+ [33m Main.bMiyu :: forall a. a -> K [0m+ [33m Main.cKurumi :: forall a. a -> K [0m+ [33m Main.dMiiko :: forall a. a -> K [0m+ [33m Main.eHaruna :: Int -> K [0m+ [33m Safe.Coerce.coerce :: forall a b. Coercible a b => a -> b[0m+ [33m Unsafe.Coerce.unsafeCoerce :: forall a b. a -> b [0m+ [33m Main.K :: Int -> K [0m+ [33m [0m+ in the following context:++ a :: [33ma0[0m+++in binding group dMiiko, cKurumi, bMiyu++where [33ma0[0m is a rigid type variable+ bound at (line 0, column 0 - line 0, column 0)++See https://github.com/purescript/documentation/blob/master/errors/HoleInferredType.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/4408CyclicTriple.purs view
@@ -0,0 +1,25 @@+-- @shouldFailWith HoleInferredType+module Main where++-- Expected:+--+-- aHaruna/eHaruna -> bMiyu~cKurumi~dMiiko+--+-- All are suggested.++newtype K = K Int++aHaruna :: Int -> K+aHaruna = K++bMiyu :: forall a. a -> K+bMiyu a = let _ = dMiiko a in K 0++cKurumi :: forall a. a -> K+cKurumi a = let _ = bMiyu a in K 0++dMiiko :: forall a. a -> K+dMiiko a = let _ = cKurumi a in ?help 0++eHaruna :: Int -> K+eHaruna = K
+ tests/purs/failing/4466.out view
@@ -0,0 +1,24 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/4466.purs:15:44 - 15:67 (line 15, column 44 - line 15, column 67)++ A case expression could not be determined to cover all inputs.+ The following additional cases are required to cover all inputs:++ [33m{ sound: Quack }[0m+ [33m{ sound: Bark }[0m++ Alternatively, add a Partial constraint to the type of the enclosing value.++while checking that type [33mPartial => t0[0m+ is at least as general as type [33mBoolean[0m+while checking that expression [33mcase $0 of [0m+ [33m { sound: Moo } -> true[0m+ has type [33mBoolean[0m+in value declaration [33manimalFunc[0m++where [33mt0[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/4466.purs view
@@ -0,0 +1,16 @@+-- @shouldFailWith NoInstanceFound+module Main where++import Prelude++import Data.Array as Array+import Data.Maybe (Maybe(..))++data Sound = Moo | Quack | Bark++type Animal = { sound :: Sound }++animalFunc :: Array Animal -> Unit+animalFunc animals+ | Just { sound } <- animals # Array.find \{ sound: Moo } -> true = unit+ | otherwise = unit
+ tests/purs/failing/4483.out view
@@ -0,0 +1,14 @@+Error found:+at tests/purs/failing/4483.purs:10:1 - 11:24 (line 10, column 1 - line 11, column 24)++ The following type class members have not been implemented:+ [33mbar :: Int -> Int[0m++in type class instance+[33m [0m+[33m Main.Foo Int[0m+[33m [0m++See https://github.com/purescript/documentation/blob/master/errors/MissingClassMember.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/4483.purs view
@@ -0,0 +1,13 @@+-- @shouldFailWith MissingClassMember+module Main where++import Prim.TypeError++class Foo t where+ foo :: t -> String+ bar :: Int -> t++instance fooInt :: Fail (Text "can't use this") => Foo Int where+ foo _ = "unreachable"+ -- bar is missing; you can get away with an empty instance here but not a+ -- half-implemented one
+ tests/purs/failing/4522.out view
@@ -0,0 +1,10 @@+Error found:+at tests/purs/failing/4522.purs:4:11 - 4:12 (line 4, column 11 - line 4, column 12)++ Unable to parse module:+ Unexpected token '@'+++See https://github.com/purescript/documentation/blob/master/errors/ErrorParsingModule.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/4522.purs view
@@ -0,0 +1,4 @@+-- @shouldFailWith ErrorParsingModule+module Main where++class Foo @a
+ tests/purs/failing/881.out view
@@ -0,0 +1,14 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/881.purs:10:1 - 13:12 (line 10, column 1 - line 13, column 12)++ Multiple value declarations exist for [33mfoo[0m.++in type class instance+[33m [0m+[33m Main.Foo X[0m+[33m [0m++See https://github.com/purescript/documentation/blob/master/errors/DuplicateValueDeclaration.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/881.purs view
@@ -0,0 +1,13 @@+-- @shouldFailWith DuplicateValueDeclaration+module Main where++data X = X | Y++class Foo a where+ foo :: a -> a+ bar :: a++instance fooX :: Foo X where+ foo X = X+ bar = X+ foo Y = Y
+ tests/purs/failing/AnonArgument1.out view
@@ -0,0 +1,9 @@+Error found:+at tests/purs/failing/AnonArgument1.purs:5:8 - 5:9 (line 5, column 8 - line 5, column 9)++ An anonymous function argument appears in an invalid context.+++See https://github.com/purescript/documentation/blob/master/errors/IncorrectAnonymousArgument.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/AnonArgument1.purs view
@@ -0,0 +1,5 @@+-- @shouldFailWith IncorrectAnonymousArgument+module Main where++test :: Int -> Int+test = _
+ tests/purs/failing/AnonArgument2.out view
@@ -0,0 +1,9 @@+Error found:+at tests/purs/failing/AnonArgument2.purs:7:16 - 7:17 (line 7, column 16 - line 7, column 17)++ An anonymous function argument appears in an invalid context.+++See https://github.com/purescript/documentation/blob/master/errors/IncorrectAnonymousArgument.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/AnonArgument2.purs view
@@ -0,0 +1,7 @@+-- @shouldFailWith IncorrectAnonymousArgument+module Main where++import Prelude++test :: Int -> Int+test = 1 + 2 * _
+ tests/purs/failing/AnonArgument3.out view
@@ -0,0 +1,9 @@+Error found:+at tests/purs/failing/AnonArgument3.purs:7:12 - 7:13 (line 7, column 12 - line 7, column 13)++ An anonymous function argument appears in an invalid context.+++See https://github.com/purescript/documentation/blob/master/errors/IncorrectAnonymousArgument.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/AnonArgument3.purs view
@@ -0,0 +1,7 @@+-- @shouldFailWith IncorrectAnonymousArgument+module Main where++import Prelude++test :: Int -> Int+test = 1 + _
+ tests/purs/failing/ApostropheModuleName.out view
@@ -0,0 +1,10 @@+Error found:+at tests/purs/failing/ApostropheModuleName.purs:3:8 - 3:18 (line 3, column 8 - line 3, column 18)++ Unable to parse module:+ Invalid module name; underscores and primes are not allowed in module names+++See https://github.com/purescript/documentation/blob/master/errors/ErrorParsingModule.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ApostropheModuleName.purs view
@@ -0,0 +1,7 @@+-- @shouldFailWith ErrorParsingModule+-- see #3601+module Bad'Module where++import Effect.Console (log)++main = log "Done"
+ tests/purs/failing/ArgLengthMismatch.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mArgLengthMismatch[0m+at tests/purs/failing/ArgLengthMismatch.purs:6:1 - 6:13 (line 6, column 1 - line 6, column 13)++ Argument list lengths differ in declaration [33mf[0m+++See https://github.com/purescript/documentation/blob/master/errors/ArgListLengthsDiffer.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ArgLengthMismatch.purs view
@@ -0,0 +1,7 @@+-- @shouldFailWith ArgListLengthsDiffer+module ArgLengthMismatch where++import Prelude++f x y = true+f = false
+ tests/purs/failing/ArrayType.out view
@@ -0,0 +1,22 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/ArrayType.purs:10:7 - 10:8 (line 10, column 7 - line 10, column 8)++ Could not match type+ [33m [0m+ [33m Int[0m+ [33m [0m+ with type+ [33m [0m+ [33m Number[0m+ [33m [0m++while checking that type [33mInt[0m+ is at least as general as type [33mNumber[0m+while checking that expression [33mx[0m+ has type [33mNumber[0m+in value declaration [33mfoo[0m++See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ArrayType.purs view
@@ -0,0 +1,13 @@+-- @shouldFailWith TypesDoNotUnify++module Main where++import Prelude++bar :: Number -> Number -> Number+bar n m = n + m++foo = x `bar` y+ where+ x = 1+ y = []
+ tests/purs/failing/Arrays.out view
@@ -0,0 +1,24 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/Arrays.purs:6:26 - 6:27 (line 6, column 26 - line 6, column 27)++ Could not match type+ [33m [0m+ [33m Int[0m+ [33m [0m+ with type+ [33m [0m+ [33m Array t0[0m+ [33m [0m++while checking that type [33mInt[0m+ is at least as general as type [33mArray t0[0m+while checking that expression [33m0[0m+ has type [33mArray t0[0m+in value declaration [33mtest[0m++where [33mt0[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/Arrays.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith TypesDoNotUnify+module Main where++foreign import ix :: forall a. Array a -> Int -> a++test = \arr -> arr `ix` (0 `ix` 0)
+ tests/purs/failing/AtPatternPrecedence.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/AtPatternPrecedence.purs:11:1 - 11:15 (line 11, column 1 - line 11, column 15)++ Argument list lengths differ in declaration [33moops[0m+++See https://github.com/purescript/documentation/blob/master/errors/ArgListLengthsDiffer.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/AtPatternPrecedence.purs view
@@ -0,0 +1,14 @@+-- See #3532+-- @shouldFailWith ArgListLengthsDiffer+module Main where++import Effect.Console (log)++data X = X String | Y++oops :: X -> String+-- previously this was parsed as x@(X s)+oops x@X s = s+oops Y = "Y"++main = log (oops (X "Done"))
+ tests/purs/failing/BifunctorInstance1.out view
@@ -0,0 +1,16 @@+Error found:+in module [33mBifunctorInstance1[0m+at tests/purs/failing/BifunctorInstance1.purs:10:1 - 10:31 (line 10, column 1 - line 10, column 31)++ One or more type variables are in positions that prevent [33mBifunctor[0m from being derived.+ To derive this class, make sure that these variables are only used as the final arguments to type constructors, that their variance matches the variance of [33mBifunctor[0m, and that those type constructors themselves have instances of [33mData.Functor.Functor[0m, [33mData.Bifunctor.Bifunctor[0m, [33mData.Functor.Contravariant.Contravariant[0m, or [33mData.Profunctor.Profunctor[0m.++ tests/purs/failing/BifunctorInstance1.purs:+ [90m 8[0m [33m[0m+ [90m 9[0m [33mdata Test a b = Test (Tuple (Predicate [7ma[27m) (Predicate [7mb[27m)) (Tuple a b)[0m+ [90m 10[0m [33mderive instance Bifunctor Test[0m+++See https://github.com/purescript/documentation/blob/master/errors/CannotDeriveInvalidConstructorArg.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/BifunctorInstance1.purs view
@@ -0,0 +1,10 @@+-- @shouldFailWith CannotDeriveInvalidConstructorArg+module BifunctorInstance1 where++import Prelude+import Data.Bifunctor (class Bifunctor)+import Data.Predicate (Predicate)+import Data.Tuple (Tuple)++data Test a b = Test (Tuple (Predicate a) (Predicate b)) (Tuple a b)+derive instance Bifunctor Test
+ tests/purs/failing/BindInDo-2.out view
@@ -0,0 +1,9 @@+Error found:+at tests/purs/failing/BindInDo-2.purs:7:7 - 7:16 (line 7, column 7 - line 7, column 16)++ The name [33mbind[0m cannot be brought into scope in a do notation block, since do notation uses the same name.+++See https://github.com/purescript/documentation/blob/master/errors/CannotUseBindWithDo.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/BindInDo-2.purs view
@@ -0,0 +1,9 @@+-- @shouldFailWith CannotUseBindWithDo+module Main where++import Prelude++foo = do+ let bind = 42+ x <- [4, 5, 6]+ pure x
+ tests/purs/failing/BindInDo.out view
@@ -0,0 +1,9 @@+Error found:+at tests/purs/failing/BindInDo.purs:7:3 - 7:18 (line 7, column 3 - line 7, column 18)++ The name [33mbind[0m cannot be brought into scope in a do notation block, since do notation uses the same name.+++See https://github.com/purescript/documentation/blob/master/errors/CannotUseBindWithDo.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/BindInDo.purs view
@@ -0,0 +1,9 @@+-- @shouldFailWith CannotUseBindWithDo+module Main where++import Prelude++foo = do+ bind <- [1,2,3]+ x <- [4, 5, 6]+ pure x
+ tests/purs/failing/CannotDeriveNewtypeForData.out view
@@ -0,0 +1,9 @@+Error found:+at tests/purs/failing/CannotDeriveNewtypeForData.purs:6:1 - 6:24 (line 6, column 1 - line 6, column 24)++ Cannot derive an instance of the [33mNewtype[0m class for non-newtype [33mTest[0m.+++See https://github.com/purescript/documentation/blob/master/errors/CannotDeriveNewtypeForData.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CannotDeriveNewtypeForData.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith CannotDeriveNewtypeForData+module CannotDeriveNewtypeForData where++import Data.Newtype++data Test = Test String++derive instance newtypeTest :: Newtype Test _
+ tests/purs/failing/CaseBinderLengthsDiffer.out view
@@ -0,0 +1,14 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/CaseBinderLengthsDiffer.purs:5:3 - 5:10 (line 5, column 3 - line 5, column 10)++ Binder list length differs in case alternative:++ 1, 2, 3++ Expecting 2 binders.+++See https://github.com/purescript/documentation/blob/master/errors/CaseBinderLengthDiffers.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CaseBinderLengthsDiffer.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith CaseBinderLengthDiffers+module Main where++test = case 1, 2 of+ 1, 2, 3 -> 42+ _, _ -> 43
+ tests/purs/failing/CaseDoesNotMatchAllConstructorArgs.out view
@@ -0,0 +1,16 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/CaseDoesNotMatchAllConstructorArgs.purs:11:9 - 11:17 (line 11, column 9 - line 11, column 17)++ Data constructor [33mMain.Person[0m was given 1 arguments in a case expression, but expected 2 arguments.+ This problem can be fixed by giving [33mMain.Person[0m 2 arguments.++while inferring the type of [33m\p -> [0m+ [33m case p of [0m+ [33m (Two (Person n) (Person n2 a2)) -> n[0m+ [33m _ -> "Unknown" [0m+in value declaration [33mgetName[0m++See https://github.com/purescript/documentation/blob/master/errors/IncorrectConstructorArity.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CaseDoesNotMatchAllConstructorArgs.purs view
@@ -0,0 +1,15 @@+-- @shouldFailWith IncorrectConstructorArity+module Main where++import Prelude++data Person = Person String Int++data TwoPeople = Two Person Person++getName p = case p of+ (Two (Person n) (Person n2 a2)) -> n+ _ -> "Unknown"+++name = getName (Two (Person "Jimmy" 20) (Person "" 1))
+ tests/purs/failing/ClassHeadNoVTA1.out view
@@ -0,0 +1,25 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/ClassHeadNoVTA1.purs:8:10 - 8:19 (line 8, column 10 - line 8, column 19)++ No type class instance was found for+ [33m [0m+ [33m Main.Single t0[0m+ [33m [0m+ The instance head contains unknown type variables.++ Note: The following type class members found in the expression require visible type applications to be unambiguous (e.g. [33mtyClassMember @Int[0m).+ [33mMain.useSingle[0m+ tyNotAppearInBody++while checking that type [33mforall (t12 :: Type) (@tyNotAppearInBody :: t12). Single @t12 tyNotAppearInBody => Int[0m+ is at least as general as type [33mInt[0m+while checking that expression [33museSingle[0m+ has type [33mInt[0m+in value declaration [33msingle[0m++where [33mt0[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ClassHeadNoVTA1.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith NoInstanceFound+module Main where++class Single tyNotAppearInBody where+ useSingle :: Int++single :: Int+single = useSingle
+ tests/purs/failing/ClassHeadNoVTA2.out view
@@ -0,0 +1,27 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/ClassHeadNoVTA2.purs:10:9 - 10:17 (line 10, column 9 - line 10, column 17)++ No type class instance was found for+ [33m [0m+ [33m Main.Multi t0[0m+ [33m t1[0m+ [33m [0m+ The instance head contains unknown type variables.++ Note: The following type class members found in the expression require visible type applications to be unambiguous (e.g. [33mtyClassMember @Int[0m).+ [33mMain.useMulti[0m+ tyNotAppearInBody, norThisOne++while checking that type [33mforall (t20 :: Type) (t21 :: Type) (@tyNotAppearInBody :: t20) (@norThisOne :: t21). Multi @t20 @t21 tyNotAppearInBody norThisOne => Int[0m+ is at least as general as type [33mInt[0m+while checking that expression [33museMulti[0m+ has type [33mInt[0m+in value declaration [33mmulti[0m++where [33mt0[0m is an unknown type+ [33mt1[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ClassHeadNoVTA2.purs view
@@ -0,0 +1,11 @@+-- @shouldFailWith NoInstanceFound+module Main where++import Prelude++class Multi tyNotAppearInBody norThisOne where+ useMulti :: Int++multi :: Int+multi = useMulti+
+ tests/purs/failing/ClassHeadNoVTA3.out view
@@ -0,0 +1,28 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/ClassHeadNoVTA3.purs:8:16 - 8:36 (line 8, column 16 - line 8, column 36)++ No type class instance was found for+ [33m [0m+ [33m Main.MultiMissing Int[0m+ [33m t2 [0m+ [33m [0m+ The instance head contains unknown type variables.++ Note: The following type class members found in the expression require visible type applications to be unambiguous (e.g. [33mtyClassMember @Int[0m).+ [33mMain.useMultiMissing[0m+ tyNotAppearInBody, norThisOne++while checking that type [33mforall (@norThisOne :: t0). MultiMissing @t1 @t0 Int norThisOne => Int[0m+ is at least as general as type [33mInt[0m+while checking that expression [33museMultiMissing[0m+ has type [33mInt[0m+in value declaration [33mmultiMissing[0m++where [33mt1[0m is an unknown type+ [33mt0[0m is an unknown type+ [33mt2[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ClassHeadNoVTA3.purs view
@@ -0,0 +1,9 @@+-- @shouldFailWith NoInstanceFound+module Main where++class MultiMissing tyNotAppearInBody norThisOne where+ useMultiMissing :: Int++multiMissing :: Int+multiMissing = useMultiMissing @Int+
+ tests/purs/failing/ClassHeadNoVTA4.out view
@@ -0,0 +1,27 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/ClassHeadNoVTA4.purs:8:11 - 8:21 (line 8, column 11 - line 8, column 21)++ No type class instance was found for+ [33m [0m+ [33m Main.MultiFd t0[0m+ [33m t1[0m+ [33m [0m+ The instance head contains unknown type variables.++ Note: The following type class members found in the expression require visible type applications to be unambiguous (e.g. [33mtyClassMember @Int[0m).+ [33mMain.useMultiFd[0m+ tyNotAppearInBody++while checking that type [33mforall (t20 :: Type) (t21 :: Type) (@tyNotAppearInBody :: t20) (@norThisOne :: t21). MultiFd @t20 @t21 tyNotAppearInBody norThisOne => Int[0m+ is at least as general as type [33mInt[0m+while checking that expression [33museMultiFd[0m+ has type [33mInt[0m+in value declaration [33mmultiFd[0m++where [33mt0[0m is an unknown type+ [33mt1[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ClassHeadNoVTA4.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith NoInstanceFound+module Main where++class MultiFd tyNotAppearInBody norThisOne | tyNotAppearInBody -> norThisOne where+ useMultiFd :: Int++multiFd :: Int+multiFd = useMultiFd
+ tests/purs/failing/ClassHeadNoVTA5.out view
@@ -0,0 +1,29 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/ClassHeadNoVTA5.purs:10:15 - 10:29 (line 10, column 15 - line 10, column 29)++ No type class instance was found for+ [33m [0m+ [33m Main.MultiFdBidi t0[0m+ [33m t1[0m+ [33m [0m+ The instance head contains unknown type variables.++ Note: The following type class members found in the expression require visible type applications to be unambiguous (e.g. [33mtyClassMember @Int[0m).+ [33mMain.useMultiFdBidi[0m+ One of the following sets of type variables:+ tyNotAppearInBody+ norThisOne++while checking that type [33mforall (t20 :: Type) (t21 :: Type) (@tyNotAppearInBody :: t20) (@norThisOne :: t21). MultiFdBidi @t20 @t21 tyNotAppearInBody norThisOne => Int[0m+ is at least as general as type [33mInt[0m+while checking that expression [33museMultiFdBidi[0m+ has type [33mInt[0m+in value declaration [33mmultiFdBidi[0m++where [33mt0[0m is an unknown type+ [33mt1[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ClassHeadNoVTA5.purs view
@@ -0,0 +1,10 @@+-- @shouldFailWith NoInstanceFound+module Main where++-- Verify that args in output match order defined here:+-- `tyNotAppearInBody` appears before `norThisOne`+class MultiFdBidi tyNotAppearInBody norThisOne | tyNotAppearInBody -> norThisOne, norThisOne -> tyNotAppearInBody where+ useMultiFdBidi :: Int++multiFdBidi :: Int+multiFdBidi = useMultiFdBidi
+ tests/purs/failing/ClassHeadNoVTA6a.out view
@@ -0,0 +1,37 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/ClassHeadNoVTA6a.purs:12:15 - 12:25 (line 12, column 15 - line 12, column 25)++ No type class instance was found for+ [33m [0m+ [33m Main.MultiCoveringSets t0[0m+ [33m t1[0m+ [33m t2[0m+ [33m t3[0m+ [33m t4[0m+ [33m t5[0m+ [33m [0m+ The instance head contains unknown type variables.++ Note: The following type class members found in the expression require visible type applications to be unambiguous (e.g. [33mtyClassMember @Int[0m).+ [33mMain.noneOfSets[0m+ One of the following sets of type variables:+ a, b+ e, f++while checking that type [33mforall (t82 :: Type) (t83 :: Type) (@a :: Type) (@b :: t82) (@c :: Type) (@d :: Type) (@e :: t83) (@f :: Type). MultiCoveringSets @t82 @t83 a b c d e f => Int[0m+ is at least as general as type [33mInt[0m+while checking that expression [33mnoneOfSets[0m+ has type [33mInt[0m+in value declaration [33mnoneOfSets'[0m++where [33mt0[0m is an unknown type+ [33mt1[0m is an unknown type+ [33mt2[0m is an unknown type+ [33mt3[0m is an unknown type+ [33mt4[0m is an unknown type+ [33mt5[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ClassHeadNoVTA6a.purs view
@@ -0,0 +1,12 @@+-- @shouldFailWith NoInstanceFound+module Main where++class MultiCoveringSets a b c d e f | a b -> c d e f, f e -> a b c d where+ noneOfSets :: Int++ partialOfABSet :: a -> { c :: c, d :: d }++ partialOfFESet :: f -> { c :: c, d :: d }++noneOfSets' :: Int+noneOfSets' = noneOfSets
+ tests/purs/failing/ClassHeadNoVTA6b.out view
@@ -0,0 +1,50 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/ClassHeadNoVTA6b.purs:16:19 - 16:33 (line 16, column 19 - line 16, column 33)++ No type class instance was found for+ [33m [0m+ [33m Main.MultiCoveringSets a0[0m+ [33m t3[0m+ [33m c1[0m+ [33m d2[0m+ [33m t4[0m+ [33m t5[0m+ [33m [0m+ The instance head contains unknown type variables.++ Note: The following type class members found in the expression require visible type applications to be unambiguous (e.g. [33mtyClassMember @Int[0m).+ [33mMain.partialOfABSet[0m+ One of the following sets of type variables:+ b+ e, f++while checking that type [33mforall (t70 :: Type) (t71 :: Type) (@a :: Type) (@b :: t70) (@c :: Type) (@d :: Type) (@e :: t71) (@f :: Type).[0m+ [33m MultiCoveringSets @t70 @t71 a b c d e f => a [0m+ [33m -> { c :: c [0m+ [33m , d :: d [0m+ [33m } [0m+ is at least as general as type [33ma0 [0m+ [33m-> { c :: c1[0m+ [33m , d :: d2[0m+ [33m } [0m+while checking that expression [33mpartialOfABSet[0m+ has type [33ma0 [0m+ [33m-> { c :: c1[0m+ [33m , d :: d2[0m+ [33m } [0m+in value declaration [33mpartialOfABSet'[0m++where [33ma0[0m is a rigid type variable+ bound at (line 16, column 19 - line 16, column 33)+ [33mc1[0m is a rigid type variable+ bound at (line 16, column 19 - line 16, column 33)+ [33md2[0m is a rigid type variable+ bound at (line 16, column 19 - line 16, column 33)+ [33mt3[0m is an unknown type+ [33mt4[0m is an unknown type+ [33mt5[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ClassHeadNoVTA6b.purs view
@@ -0,0 +1,16 @@+-- @shouldFailWith NoInstanceFound+module Main where++class MultiCoveringSets a b c d e f | a b -> c d e f, f e -> a b c d where+ noneOfSets :: Int++ partialOfABSet :: a -> { c :: c, d :: d }++ partialOfFESet :: f -> { c :: c, d :: d }++partialOfABSet' + :: forall a b c d e f+ . MultiCoveringSets a b c d e f+ => a+ -> { c :: c, d :: d }+partialOfABSet' = partialOfABSet
+ tests/purs/failing/ClassHeadNoVTA6c.out view
@@ -0,0 +1,50 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/ClassHeadNoVTA6c.purs:16:19 - 16:33 (line 16, column 19 - line 16, column 33)++ No type class instance was found for+ [33m [0m+ [33m Main.MultiCoveringSets t3[0m+ [33m t4[0m+ [33m c1[0m+ [33m d2[0m+ [33m t5[0m+ [33m f0[0m+ [33m [0m+ The instance head contains unknown type variables.++ Note: The following type class members found in the expression require visible type applications to be unambiguous (e.g. [33mtyClassMember @Int[0m).+ [33mMain.partialOfFESet[0m+ One of the following sets of type variables:+ a, b+ e++while checking that type [33mforall (t58 :: Type) (t59 :: Type) (@a :: Type) (@b :: t58) (@c :: Type) (@d :: Type) (@e :: t59) (@f :: Type).[0m+ [33m MultiCoveringSets @t58 @t59 a b c d e f => f [0m+ [33m -> { c :: c [0m+ [33m , d :: d [0m+ [33m } [0m+ is at least as general as type [33mf0 [0m+ [33m-> { c :: c1[0m+ [33m , d :: d2[0m+ [33m } [0m+while checking that expression [33mpartialOfFESet[0m+ has type [33mf0 [0m+ [33m-> { c :: c1[0m+ [33m , d :: d2[0m+ [33m } [0m+in value declaration [33mpartialOfFESet'[0m++where [33mc1[0m is a rigid type variable+ bound at (line 16, column 19 - line 16, column 33)+ [33md2[0m is a rigid type variable+ bound at (line 16, column 19 - line 16, column 33)+ [33mf0[0m is a rigid type variable+ bound at (line 16, column 19 - line 16, column 33)+ [33mt3[0m is an unknown type+ [33mt4[0m is an unknown type+ [33mt5[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ClassHeadNoVTA6c.purs view
@@ -0,0 +1,16 @@+-- @shouldFailWith NoInstanceFound+module Main where++class MultiCoveringSets a b c d e f | a b -> c d e f, f e -> a b c d where+ noneOfSets :: Int++ partialOfABSet :: a -> { c :: c, d :: d }++ partialOfFESet :: f -> { c :: c, d :: d }++partialOfFESet'+ :: forall a b c d e f+ . MultiCoveringSets a b c d e f+ => f+ -> { c :: c, d :: d }+partialOfFESet' = partialOfFESet
+ tests/purs/failing/ClassHeadNoVTA7.out view
@@ -0,0 +1,25 @@+Error found:+in module [33mClassHeadNoVTA7[0m+at tests/purs/failing/ClassHeadNoVTA7.purs:12:8 - 12:26 (line 12, column 8 - line 12, column 26)++ No type class instance was found for+ [33m [0m+ [33m ClassHeadNoVTA7.TestClass t1[0m+ [33m t2[0m+ [33m [0m+ The instance head contains unknown type variables. Consider adding a type annotation.++while applying a function [33mtestMethod[0m+ of type [33mTestClass @t0 t1 t2 => Maybe t1 -> Int[0m+ to argument [33mNothing[0m+while checking that expression [33mtestMethod Nothing[0m+ has type [33mInt[0m+in value declaration [33mtest[0m++where [33mt0[0m is an unknown type+ [33mt1[0m is an unknown type+ [33mt2[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ClassHeadNoVTA7.purs view
@@ -0,0 +1,12 @@+-- @shouldFailWith NoInstanceFound+module ClassHeadNoVTA7 where++import Prelude++import Data.Maybe (Maybe(..))++class TestClass a b | a -> b, b -> a where+ testMethod :: Maybe a -> Int++test :: Int+test = testMethod Nothing
+ tests/purs/failing/CoercibleClosedRowsDoNotUnify.out view
@@ -0,0 +1,39 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/CoercibleClosedRowsDoNotUnify.purs:7:12 - 7:18 (line 7, column 12 - line 7, column 18)++ Could not match type+ [33m [0m+ [33m ( x :: Int[0m+ [33m ... [0m+ [33m ) [0m+ [33m [0m+ with type+ [33m [0m+ [33m ( y :: String[0m+ [33m ... [0m+ [33m ) [0m+ [33m [0m++while solving type class constraint+[33m [0m+[33m Prim.Coerce.Coercible { x :: Int [0m+[33m } [0m+[33m { y :: String[0m+[33m } [0m+[33m [0m+while checking that type [33mforall (a :: Type) (b :: Type). Coercible @Type a b => a -> b[0m+ is at least as general as type [33m{ x :: Int [0m+ [33m} [0m+ [33m-> { y :: String[0m+ [33m } [0m+while checking that expression [33mcoerce[0m+ has type [33m{ x :: Int [0m+ [33m} [0m+ [33m-> { y :: String[0m+ [33m } [0m+in value declaration [33mrecToRec[0m++See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CoercibleClosedRowsDoNotUnify.purs view
@@ -0,0 +1,7 @@+-- @shouldFailWith TypesDoNotUnify+module Main where++import Safe.Coerce (coerce)++recToRec :: { x :: Int } -> { y :: String }+recToRec = coerce
+ tests/purs/failing/CoercibleConstrained1.out view
@@ -0,0 +1,29 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/CoercibleConstrained1.purs:11:28 - 11:34 (line 11, column 28 - line 11, column 34)++ No type class instance was found for+ [33m [0m+ [33m Prim.Coerce.Coercible a0[0m+ [33m b1[0m+ [33m [0m++while solving type class constraint+[33m [0m+[33m Prim.Coerce.Coercible (Constrained a0)[0m+[33m (Constrained b1)[0m+[33m [0m+while checking that type [33mforall (a :: Type) (b :: Type). Coercible @Type a b => a -> b[0m+ is at least as general as type [33mConstrained a0 -> Constrained b1[0m+while checking that expression [33mcoerce[0m+ has type [33mConstrained a0 -> Constrained b1[0m+in value declaration [33mconstrainedToConstrained[0m++where [33ma0[0m is a rigid type variable+ bound at (line 11, column 28 - line 11, column 34)+ [33mb1[0m is a rigid type variable+ bound at (line 11, column 28 - line 11, column 34)++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CoercibleConstrained1.purs view
@@ -0,0 +1,11 @@+-- @shouldFailWith NoInstanceFound+module Main where++import Safe.Coerce (coerce)++class Nullary++data Constrained a = Constrained (Nullary => a)++constrainedToConstrained :: forall a b. Constrained a -> Constrained b+constrainedToConstrained = coerce
+ tests/purs/failing/CoercibleConstrained2.out view
@@ -0,0 +1,32 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/CoercibleConstrained2.purs:11:28 - 11:34 (line 11, column 28 - line 11, column 34)++ Could not match type+ [33m [0m+ [33m a0[0m+ [33m [0m+ with type+ [33m [0m+ [33m b1[0m+ [33m [0m++while solving type class constraint+[33m [0m+[33m Prim.Coerce.Coercible (Constrained a0)[0m+[33m (Constrained b1)[0m+[33m [0m+while checking that type [33mforall (a :: Type) (b :: Type). Coercible @Type a b => a -> b[0m+ is at least as general as type [33mConstrained a0 -> Constrained b1[0m+while checking that expression [33mcoerce[0m+ has type [33mConstrained a0 -> Constrained b1[0m+in value declaration [33mconstrainedToConstrained[0m++where [33ma0[0m is a rigid type variable+ bound at (line 11, column 28 - line 11, column 34)+ [33mb1[0m is a rigid type variable+ bound at (line 11, column 28 - line 11, column 34)++See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CoercibleConstrained2.purs view
@@ -0,0 +1,11 @@+-- @shouldFailWith TypesDoNotUnify+module Main where++import Safe.Coerce (coerce)++class Unary a++data Constrained a = Constrained (Unary a => a)++constrainedToConstrained :: forall a b. Constrained a -> Constrained b+constrainedToConstrained = coerce
+ tests/purs/failing/CoercibleConstrained3.out view
@@ -0,0 +1,30 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/CoercibleConstrained3.purs:13:28 - 13:34 (line 13, column 28 - line 13, column 34)++ Could not match type+ [33m [0m+ [33m a0[0m+ [33m [0m+ with type+ [33m [0m+ [33m N a0[0m+ [33m [0m++while solving type class constraint+[33m [0m+[33m Prim.Coerce.Coercible (Constrained a0) [0m+[33m (Constrained (N a0))[0m+[33m [0m+while checking that type [33mforall (a :: Type) (b :: Type). Coercible @Type a b => a -> b[0m+ is at least as general as type [33mConstrained a0 -> Constrained (N a0)[0m+while checking that expression [33mcoerce[0m+ has type [33mConstrained a0 -> Constrained (N a0)[0m+in value declaration [33mconstrainedToConstrained[0m++where [33ma0[0m is a rigid type variable+ bound at (line 13, column 28 - line 13, column 34)++See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CoercibleConstrained3.purs view
@@ -0,0 +1,13 @@+-- @shouldFailWith TypesDoNotUnify+module Main where++import Safe.Coerce (coerce)++class Unary a++data Constrained a = Constrained (Unary a => a)++newtype N a = N a++constrainedToConstrained :: forall a. Constrained a -> Constrained (N a)+constrainedToConstrained = coerce
+ tests/purs/failing/CoercibleForeign.out view
@@ -0,0 +1,32 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/CoercibleForeign.purs:11:20 - 11:26 (line 11, column 20 - line 11, column 26)++ Could not match type+ [33m [0m+ [33m a0[0m+ [33m [0m+ with type+ [33m [0m+ [33m Id a0[0m+ [33m [0m++while solving type class constraint+[33m [0m+[33m Prim.Coerce.Coercible (Foreign a0 b1) [0m+[33m (Foreign (Id a0) (Id b1))[0m+[33m [0m+while checking that type [33mforall (a :: Type) (b :: Type). Coercible @Type a b => a -> b[0m+ is at least as general as type [33mForeign a0 b1 -> Foreign (Id a0) (Id b1)[0m+while checking that expression [33mcoerce[0m+ has type [33mForeign a0 b1 -> Foreign (Id a0) (Id b1)[0m+in value declaration [33mforeignToForeign[0m++where [33ma0[0m is a rigid type variable+ bound at (line 11, column 20 - line 11, column 26)+ [33mb1[0m is a rigid type variable+ bound at (line 11, column 20 - line 11, column 26)++See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CoercibleForeign.purs view
@@ -0,0 +1,11 @@+-- @shouldFailWith TypesDoNotUnify+module Main where++import Safe.Coerce (coerce)++foreign import data Foreign :: Type -> Type -> Type++newtype Id a = Id a++foreignToForeign :: forall a b. Foreign a b -> Foreign (Id a) (Id b)+foreignToForeign = coerce
+ tests/purs/failing/CoercibleForeign2.out view
@@ -0,0 +1,36 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/CoercibleForeign2.purs:9:20 - 9:26 (line 9, column 20 - line 9, column 26)++ Could not match type+ [33m [0m+ [33m c2[0m+ [33m [0m+ with type+ [33m [0m+ [33m d3[0m+ [33m [0m++while solving type class constraint+[33m [0m+[33m Prim.Coerce.Coercible (Foreign a0 b1 c2)[0m+[33m (Foreign a0 b1 d3)[0m+[33m [0m+while checking that type [33mforall (a :: Type) (b :: Type). Coercible @Type a b => a -> b[0m+ is at least as general as type [33mForeign a0 b1 c2 -> Foreign a0 b1 d3[0m+while checking that expression [33mcoerce[0m+ has type [33mForeign a0 b1 c2 -> Foreign a0 b1 d3[0m+in value declaration [33mforeignToForeign[0m++where [33ma0[0m is a rigid type variable+ bound at (line 9, column 20 - line 9, column 26)+ [33mb1[0m is a rigid type variable+ bound at (line 9, column 20 - line 9, column 26)+ [33mc2[0m is a rigid type variable+ bound at (line 9, column 20 - line 9, column 26)+ [33md3[0m is a rigid type variable+ bound at (line 9, column 20 - line 9, column 26)++See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CoercibleForeign2.purs view
@@ -0,0 +1,9 @@+-- @shouldFailWith TypesDoNotUnify+module Main where++import Safe.Coerce (coerce)++foreign import data Foreign :: Type -> Type -> Type -> Type++foreignToForeign :: forall a b c d. Foreign a b c -> Foreign a b d+foreignToForeign = coerce
+ tests/purs/failing/CoercibleForeign3.out view
@@ -0,0 +1,36 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/CoercibleForeign3.purs:9:20 - 9:26 (line 9, column 20 - line 9, column 26)++ Could not match type+ [33m [0m+ [33m b2[0m+ [33m [0m+ with type+ [33m [0m+ [33m c3[0m+ [33m [0m++while solving type class constraint+[33m [0m+[33m Prim.Coerce.Coercible (Foreign @k0 a1 b2)[0m+[33m (Foreign @k0 a1 c3)[0m+[33m [0m+while checking that type [33mforall (a :: Type) (b :: Type). Coercible @Type a b => a -> b[0m+ is at least as general as type [33mForeign @k0 a1 b2 -> Foreign @k0 a1 c3[0m+while checking that expression [33mcoerce[0m+ has type [33mForeign @k0 a1 b2 -> Foreign @k0 a1 c3[0m+in value declaration [33mforeignToForeign[0m++where [33mk0[0m is a rigid type variable+ bound at (line 9, column 20 - line 9, column 26)+ [33ma1[0m is a rigid type variable+ bound at (line 9, column 20 - line 9, column 26)+ [33mb2[0m is a rigid type variable+ bound at (line 9, column 20 - line 9, column 26)+ [33mc3[0m is a rigid type variable+ bound at (line 9, column 20 - line 9, column 26)++See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CoercibleForeign3.purs view
@@ -0,0 +1,9 @@+-- @shouldFailWith TypesDoNotUnify+module Main where++import Safe.Coerce (coerce)++foreign import data Foreign :: ∀ k. k -> k -> Type++foreignToForeign :: ∀ k (a :: k) (b :: k) (c :: k). Foreign a b -> Foreign a c+foreignToForeign = coerce
+ tests/purs/failing/CoercibleHigherKindedData.out view
@@ -0,0 +1,33 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/CoercibleHigherKindedData.purs:13:17 - 13:23 (line 13, column 17 - line 13, column 23)++ No type class instance was found for+ [33m [0m+ [33m Prim.Coerce.Coercible (Unary t5) [0m+ [33m (Binary a3 t5)[0m+ [33m [0m+ The instance head contains unknown type variables. Consider adding a type annotation.++while solving type class constraint+[33m [0m+[33m Prim.Coerce.Coercible (Proxy @(t0 -> Type) (Unary @t0)) [0m+[33m (Proxy @(t1 -> Type) (Binary @t2 @t1 a3))[0m+[33m [0m+while checking that type [33mforall (a :: Type) (b :: Type). Coercible @Type a b => a -> b[0m+ is at least as general as type [33mProxy @(t0 -> Type) (Unary @t0) -> Proxy @(t1 -> Type) (... @t1 a3)[0m+while checking that expression [33mcoerce[0m+ has type [33mProxy @(t0 -> Type) (Unary @t0) -> Proxy @(t1 -> Type) (... @t1 a3)[0m+in value declaration [33munaryToBinary[0m++where [33ma3[0m is a rigid type variable+ bound at (line 13, column 17 - line 13, column 23)+ [33mt0[0m is an unknown type+ [33mt2[0m is an unknown type+ [33mt1[0m is an unknown type+ [33mt4[0m is an unknown type+ [33mt5[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CoercibleHigherKindedData.purs view
@@ -0,0 +1,13 @@+-- @shouldFailWith NoInstanceFound+module Main where++import Safe.Coerce (coerce)++data Unary a+data Binary a b++data Proxy a = Proxy+type role Proxy representational++unaryToBinary :: forall a. Proxy Unary -> Proxy (Binary a)+unaryToBinary = coerce
+ tests/purs/failing/CoercibleHigherKindedNewtypes.out view
@@ -0,0 +1,24 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/CoercibleHigherKindedNewtypes.purs:13:8 - 13:14 (line 13, column 8 - line 13, column 14)++ No type class instance was found for+ [33m [0m+ [33m Prim.Coerce.Coercible Int [0m+ [33m String[0m+ [33m [0m++while solving type class constraint+[33m [0m+[33m Prim.Coerce.Coercible (Ap @Type @Type N1 Int String)[0m+[33m (Ap @Type @Type N2 Int String)[0m+[33m [0m+while checking that type [33mforall (a :: Type) (b :: Type). Coercible @Type a b => a -> b[0m+ is at least as general as type [33mAp @Type @Type N1 Int String -> Ap @Type @Type N2 Int String[0m+while checking that expression [33mcoerce[0m+ has type [33mAp @Type @Type N1 Int String -> Ap @Type @Type N2 Int String[0m+in value declaration [33mswap[0m++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CoercibleHigherKindedNewtypes.purs view
@@ -0,0 +1,13 @@+-- @shouldFailWith NoInstanceFound+module Main where++import Safe.Coerce (coerce)++newtype Ap f a b = Ap (f a b)++data Tuple a b = Tuple a b+newtype N1 a b = N1 (Tuple a b)+newtype N2 b a = N2 (Tuple a b)++swap :: Ap N1 Int String -> Ap N2 Int String+swap = coerce
+ tests/purs/failing/CoercibleKindMismatch.out view
@@ -0,0 +1,31 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/CoercibleKindMismatch.purs:15:17 - 15:23 (line 15, column 17 - line 15, column 23)++ Could not match kind+ [33m [0m+ [33m Type[0m+ [33m [0m+ with kind+ [33m [0m+ [33m t29 -> Type[0m+ [33m [0m++while solving type class constraint+[33m [0m+[33m Prim.Coerce.Coercible (Proxy @(t0 -> Type) (Unary @t0)) [0m+[33m (Proxy @(t1 -> t2 -> Type) (Binary @t1 @t2))[0m+[33m [0m+while checking that type [33mforall (a :: Type) (b :: Type). Coercible @Type a b => a -> b[0m+ is at least as general as type [33mProxy @(t0 -> Type) (Unary @t0) -> Proxy @(t1 -> ...) (Binary @t1 @t2)[0m+while checking that expression [33mcoerce[0m+ has type [33mProxy @(t0 -> Type) (Unary @t0) -> Proxy @(t1 -> ...) (Binary @t1 @t2)[0m+in value declaration [33munaryToBinary[0m++where [33mt0[0m is an unknown type+ [33mt1[0m is an unknown type+ [33mt2[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/KindsDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CoercibleKindMismatch.purs view
@@ -0,0 +1,15 @@+-- @shouldFailWith KindsDoNotUnify+module Main where++import Safe.Coerce (coerce)++data Unary a+data Binary a b++data Proxy :: forall k. k -> Type+data Proxy a = Proxy++type role Proxy representational++unaryToBinary :: Proxy Unary -> Proxy Binary+unaryToBinary = coerce
+ tests/purs/failing/CoercibleNominal.out view
@@ -0,0 +1,34 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/CoercibleNominal.purs:11:20 - 11:26 (line 11, column 20 - line 11, column 26)++ Could not match type+ [33m [0m+ [33m a0[0m+ [33m [0m+ with type+ [33m [0m+ [33m b2[0m+ [33m [0m++while solving type class constraint+[33m [0m+[33m Prim.Coerce.Coercible (Nominal a0 c1)[0m+[33m (Nominal b2 c1)[0m+[33m [0m+while checking that type [33mforall (a :: Type) (b :: Type). Coercible @Type a b => a -> b[0m+ is at least as general as type [33mNominal a0 c1 -> Nominal b2 c1[0m+while checking that expression [33mcoerce[0m+ has type [33mNominal a0 c1 -> Nominal b2 c1[0m+in value declaration [33mnominalToNominal[0m++where [33ma0[0m is a rigid type variable+ bound at (line 11, column 20 - line 11, column 26)+ [33mb2[0m is a rigid type variable+ bound at (line 11, column 20 - line 11, column 26)+ [33mc1[0m is a rigid type variable+ bound at (line 11, column 20 - line 11, column 26)++See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CoercibleNominal.purs view
@@ -0,0 +1,11 @@+-- @shouldFailWith TypesDoNotUnify+module Main where++import Safe.Coerce (coerce)++data Nominal a (b :: Type) = Nominal a++type role Nominal nominal phantom++nominalToNominal :: forall a b c. Nominal a c -> Nominal b c+nominalToNominal = coerce
+ tests/purs/failing/CoercibleNominalTypeApp.out view
@@ -0,0 +1,27 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/CoercibleNominalTypeApp.purs:13:8 - 13:14 (line 13, column 8 - line 13, column 14)++ Could not match type+ [33m [0m+ [33m Int[0m+ [33m [0m+ with type+ [33m [0m+ [33m String[0m+ [33m [0m++while solving type class constraint+[33m [0m+[33m Prim.Coerce.Coercible (G @Type Maybe Int) [0m+[33m (G @Type Maybe String)[0m+[33m [0m+while checking that type [33mforall (a :: Type) (b :: Type). Coercible @Type a b => a -> b[0m+ is at least as general as type [33mG @Type Maybe Int -> G @Type Maybe String[0m+while checking that expression [33mcoerce[0m+ has type [33mG @Type Maybe Int -> G @Type Maybe String[0m+in value declaration [33mgToG[0m++See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CoercibleNominalTypeApp.purs view
@@ -0,0 +1,13 @@+-- @shouldFailWith TypesDoNotUnify+module Main where++import Safe.Coerce (coerce)++data Phantom a = Phantom++data Maybe a = Nothing | Just a++data G a b = G (a (Phantom b))++gToG :: G Maybe Int -> G Maybe String+gToG = coerce
+ tests/purs/failing/CoercibleNominalWrapped.out view
@@ -0,0 +1,32 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/CoercibleNominalWrapped.purs:15:14 - 15:20 (line 15, column 14 - line 15, column 20)++ Could not match type+ [33m [0m+ [33m a0[0m+ [33m [0m+ with type+ [33m [0m+ [33m Id a0[0m+ [33m [0m++while solving type class constraint+[33m [0m+[33m Prim.Coerce.Coercible (Wrap a0 b1) [0m+[33m (Wrap (Id a0) b1)[0m+[33m [0m+while checking that type [33mforall (a :: Type) (b :: Type). Coercible @Type a b => a -> b[0m+ is at least as general as type [33mWrap a0 b1 -> Wrap (Id a0) b1[0m+while checking that expression [33mcoerce[0m+ has type [33mWrap a0 b1 -> Wrap (Id a0) b1[0m+in value declaration [33mwrapToWrap[0m++where [33ma0[0m is a rigid type variable+ bound at (line 15, column 14 - line 15, column 20)+ [33mb1[0m is a rigid type variable+ bound at (line 15, column 14 - line 15, column 20)++See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CoercibleNominalWrapped.purs view
@@ -0,0 +1,15 @@+-- @shouldFailWith TypesDoNotUnify+module Main where++import Safe.Coerce (coerce)++data Nominal a (b :: Type) = Nominal a++type role Nominal nominal phantom++newtype Id a = Id a++data Wrap a b = Wrap (Nominal a b)++wrapToWrap :: forall a b. Wrap a b -> Wrap (Id a) b+wrapToWrap = coerce
+ tests/purs/failing/CoercibleNonCanonical1.out view
@@ -0,0 +1,27 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/CoercibleNonCanonical1.purs:11:27 - 11:33 (line 11, column 27 - line 11, column 33)++ No type class instance was found for+ [33m [0m+ [33m Prim.Coerce.Coercible a0 [0m+ [33m (D (N a0))[0m+ [33m [0m++while solving type class constraint+[33m [0m+[33m Prim.Coerce.Coercible a0 [0m+[33m (N @Type a0)[0m+[33m [0m+while checking that type [33mforall (a :: Type) (b :: Type). Coercible @Type a b => a -> b[0m+ is at least as general as type [33ma0 -> N @Type a0[0m+while checking that expression [33mcoerce[0m+ has type [33ma0 -> N @Type a0[0m+in value declaration [33mnonCanonicalSameTyVarEq[0m++where [33ma0[0m is a rigid type variable+ bound at (line 11, column 27 - line 11, column 33)++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CoercibleNonCanonical1.purs view
@@ -0,0 +1,11 @@+-- @shouldFailWith NoInstanceFound+module Main where++import Prim.Coerce (class Coercible)+import Safe.Coerce (coerce)++data D a = D a+newtype N a = N (D (N a))++nonCanonicalSameTyVarEq :: forall a. Coercible a (D a) => a -> N a+nonCanonicalSameTyVarEq = coerce
+ tests/purs/failing/CoercibleNonCanonical2.out view
@@ -0,0 +1,24 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/CoercibleNonCanonical2.purs:10:27 - 10:33 (line 10, column 27 - line 10, column 33)++ No type class instance was found for+ [33m [0m+ [33m Prim.Coerce.Coercible a0[0m+ [33m b1[0m+ [33m [0m++while checking that type [33mforall (a :: Type) (b :: Type). Coercible @Type a b => a -> b[0m+ is at least as general as type [33ma0 -> b1[0m+while checking that expression [33mcoerce[0m+ has type [33ma0 -> b1[0m+in value declaration [33mnonCanonicalDiffTyVarEq[0m++where [33ma0[0m is a rigid type variable+ bound at (line 10, column 27 - line 10, column 33)+ [33mb1[0m is a rigid type variable+ bound at (line 10, column 27 - line 10, column 33)++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CoercibleNonCanonical2.purs view
@@ -0,0 +1,10 @@+-- @shouldFailWith NoInstanceFound+module Main where++import Prim.Coerce (class Coercible)+import Safe.Coerce (coerce)++data D a = D a++nonCanonicalDiffTyVarEq :: forall a b. Coercible b (D b) => a -> b+nonCanonicalDiffTyVarEq = coerce
+ tests/purs/failing/CoercibleOpenRowsDoNotUnify.out view
@@ -0,0 +1,43 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/CoercibleOpenRowsDoNotUnify.purs:7:12 - 7:18 (line 7, column 12 - line 7, column 18)++ No type class instance was found for+ [33m [0m+ [33m Prim.Coerce.Coercible r0[0m+ [33m s1[0m+ [33m [0m++while solving type class constraint+[33m [0m+[33m Prim.Coerce.Coercible { x :: Int[0m+[33m | r0 [0m+[33m } [0m+[33m { x :: Int[0m+[33m | s1 [0m+[33m } [0m+[33m [0m+while checking that type [33mforall (a :: Type) (b :: Type). Coercible @Type a b => a -> b[0m+ is at least as general as type [33m{ x :: Int [0m+ [33m| r0 [0m+ [33m} [0m+ [33m-> { x :: Int[0m+ [33m | s1 [0m+ [33m } [0m+while checking that expression [33mcoerce[0m+ has type [33m{ x :: Int [0m+ [33m| r0 [0m+ [33m} [0m+ [33m-> { x :: Int[0m+ [33m | s1 [0m+ [33m } [0m+in value declaration [33mrecToRec[0m++where [33mr0[0m is a rigid type variable+ bound at (line 7, column 12 - line 7, column 18)+ [33ms1[0m is a rigid type variable+ bound at (line 7, column 12 - line 7, column 18)++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CoercibleOpenRowsDoNotUnify.purs view
@@ -0,0 +1,7 @@+-- @shouldFailWith NoInstanceFound+module Main where++import Safe.Coerce (coerce)++recToRec :: forall r s. { x :: Int | r } -> { x :: Int | s }+recToRec = coerce
+ tests/purs/failing/CoercibleRepresentational.out view
@@ -0,0 +1,31 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/CoercibleRepresentational.purs:11:20 - 11:26 (line 11, column 20 - line 11, column 26)++ No type class instance was found for+ [33m [0m+ [33m Prim.Coerce.Coercible a1[0m+ [33m b3[0m+ [33m [0m++while solving type class constraint+[33m [0m+[33m Prim.Coerce.Coercible (Phantom @t0 a1)[0m+[33m (Phantom @t2 b3)[0m+[33m [0m+while checking that type [33mforall (a :: Type) (b :: Type). Coercible @Type a b => a -> b[0m+ is at least as general as type [33mPhantom @t0 a1 -> Phantom @t2 b3[0m+while checking that expression [33mcoerce[0m+ has type [33mPhantom @t0 a1 -> Phantom @t2 b3[0m+in value declaration [33mphantomToPhantom[0m++where [33ma1[0m is a rigid type variable+ bound at (line 11, column 20 - line 11, column 26)+ [33mb3[0m is a rigid type variable+ bound at (line 11, column 20 - line 11, column 26)+ [33mt0[0m is an unknown type+ [33mt2[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CoercibleRepresentational.purs view
@@ -0,0 +1,11 @@+-- @shouldFailWith NoInstanceFound+module Main where++import Safe.Coerce (coerce)++data Phantom a = Phantom++type role Phantom representational++phantomToPhantom :: forall a b. Phantom a -> Phantom b+phantomToPhantom = coerce
+ tests/purs/failing/CoercibleRepresentational2.out view
@@ -0,0 +1,24 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/CoercibleRepresentational2.purs:9:14 - 9:20 (line 9, column 14 - line 9, column 20)++ No type class instance was found for+ [33m [0m+ [33m Prim.Coerce.Coercible Int [0m+ [33m String[0m+ [33m [0m++while solving type class constraint+[33m [0m+[33m Prim.Coerce.Coercible (Arr1 Int) [0m+[33m (Arr1 String)[0m+[33m [0m+while checking that type [33mforall (a :: Type) (b :: Type). Coercible @Type a b => a -> b[0m+ is at least as general as type [33mArr1 Int -> Arr1 String[0m+while checking that expression [33mcoerce[0m+ has type [33mArr1 Int -> Arr1 String[0m+in value declaration [33marr1ToArr1[0m++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CoercibleRepresentational2.purs view
@@ -0,0 +1,9 @@+-- @shouldFailWith NoInstanceFound+module Main where++import Safe.Coerce (coerce)++data Arr1 a = Arr1 (Array a)++arr1ToArr1 :: Arr1 Int -> Arr1 String+arr1ToArr1 = coerce
+ tests/purs/failing/CoercibleRepresentational3.out view
@@ -0,0 +1,24 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/CoercibleRepresentational3.purs:9:14 - 9:20 (line 9, column 14 - line 9, column 20)++ No type class instance was found for+ [33m [0m+ [33m Prim.Coerce.Coercible Int [0m+ [33m String[0m+ [33m [0m++while solving type class constraint+[33m [0m+[33m Prim.Coerce.Coercible (Rec1 Int) [0m+[33m (Rec1 String)[0m+[33m [0m+while checking that type [33mforall (a :: Type) (b :: Type). Coercible @Type a b => a -> b[0m+ is at least as general as type [33mRec1 Int -> Rec1 String[0m+while checking that expression [33mcoerce[0m+ has type [33mRec1 Int -> Rec1 String[0m+in value declaration [33marr1ToArr1[0m++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CoercibleRepresentational3.purs view
@@ -0,0 +1,9 @@+-- @shouldFailWith NoInstanceFound+module Main where++import Safe.Coerce (coerce)++data Rec1 a = Rec1 { f :: a }++arr1ToArr1 :: Rec1 Int -> Rec1 String+arr1ToArr1 = coerce
+ tests/purs/failing/CoercibleRepresentational4.out view
@@ -0,0 +1,24 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/CoercibleRepresentational4.purs:11:38 - 11:44 (line 11, column 38 - line 11, column 44)++ No type class instance was found for+ [33m [0m+ [33m Prim.Coerce.Coercible Int [0m+ [33m String[0m+ [33m [0m++while solving type class constraint+[33m [0m+[33m Prim.Coerce.Coercible (Representational Int) [0m+[33m (Representational String)[0m+[33m [0m+while checking that type [33mforall (a :: Type) (b :: Type). Coercible @Type a b => a -> b[0m+ is at least as general as type [33mRepresentational Int -> Representational String[0m+while checking that expression [33mcoerce[0m+ has type [33mRepresentational Int -> Representational String[0m+in value declaration [33mrepresentationalToRepresentational[0m++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CoercibleRepresentational4.purs view
@@ -0,0 +1,11 @@+-- @shouldFailWith NoInstanceFound+module Main where++import Safe.Coerce (coerce)++data F a = F a+type Synonym a = F a+data Representational a = Representational (Synonym a)++representationalToRepresentational :: Representational Int -> Representational String+representationalToRepresentational = coerce
+ tests/purs/failing/CoercibleRepresentational5.out view
@@ -0,0 +1,24 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/CoercibleRepresentational5.purs:15:38 - 15:44 (line 15, column 38 - line 15, column 44)++ No type class instance was found for+ [33m [0m+ [33m Prim.Coerce.Coercible Int [0m+ [33m String[0m+ [33m [0m++while solving type class constraint+[33m [0m+[33m Prim.Coerce.Coercible (MutuallyRecursiveRepresentational2 Int) [0m+[33m (MutuallyRecursiveRepresentational2 String)[0m+[33m [0m+while checking that type [33mforall (a :: Type) (b :: Type). Coercible @Type a b => a -> b[0m+ is at least as general as type [33mMutuallyRecursiveRepresentational2 Int -> MutuallyRecursiveRepresentational2 String[0m+while checking that expression [33mcoerce[0m+ has type [33mMutuallyRecursiveRepresentational2 Int -> MutuallyRecursiveRepresentational2 String[0m+in value declaration [33mrepresentationalToRepresentational[0m++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CoercibleRepresentational5.purs view
@@ -0,0 +1,15 @@+-- @shouldFailWith NoInstanceFound+module Main where++import Safe.Coerce (coerce)++data MutuallyRecursiveRepresentational1 a+ = MutuallyRecursiveRepresentational1 a (MutuallyRecursiveRepresentational2 a)++type MutuallyRecursiveRepresentational1Synonym a = MutuallyRecursiveRepresentational1 a++data MutuallyRecursiveRepresentational2 a+ = MutuallyRecursiveRepresentational2 (MutuallyRecursiveRepresentational1Synonym a)++representationalToRepresentational :: MutuallyRecursiveRepresentational2 Int -> MutuallyRecursiveRepresentational2 String+representationalToRepresentational = coerce
+ tests/purs/failing/CoercibleRepresentational6.out view
@@ -0,0 +1,24 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/CoercibleRepresentational6.purs:8:10 - 8:16 (line 8, column 10 - line 8, column 16)++ No type class instance was found for+ [33m [0m+ [33m Prim.Coerce.Coercible (N a0)[0m+ [33m a0 [0m+ [33m [0m++ Solving this instance requires the newtype constructor [33mN[0m to be in scope.++while checking that type [33mforall (a :: Type) (b :: Type). Coercible @Type a b => a -> b[0m+ is at least as general as type [33mN a0 -> a0[0m+while checking that expression [33mcoerce[0m+ has type [33mN a0 -> a0[0m+in value declaration [33munwrap[0m++where [33ma0[0m is a rigid type variable+ bound at (line 8, column 10 - line 8, column 16)++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CoercibleRepresentational6.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith NoInstanceFound+module Main where++import Safe.Coerce (coerce)+import N (N(..))++unwrap :: forall a. N a -> a+unwrap = coerce
+ tests/purs/failing/CoercibleRepresentational6/N.purs view
@@ -0,0 +1,3 @@+module N (N) where++newtype N a = N a
+ tests/purs/failing/CoercibleRepresentational7.out view
@@ -0,0 +1,24 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/CoercibleRepresentational7.purs:8:10 - 8:16 (line 8, column 10 - line 8, column 16)++ No type class instance was found for+ [33m [0m+ [33m Prim.Coerce.Coercible (N a0)[0m+ [33m a0 [0m+ [33m [0m++ Solving this instance requires the newtype constructor [33mN[0m to be in scope.++while checking that type [33mforall (a :: Type) (b :: Type). Coercible @Type a b => a -> b[0m+ is at least as general as type [33mN a0 -> a0[0m+while checking that expression [33mcoerce[0m+ has type [33mN a0 -> a0[0m+in value declaration [33munwrap[0m++where [33ma0[0m is a rigid type variable+ bound at (line 8, column 10 - line 8, column 16)++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CoercibleRepresentational7.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith NoInstanceFound+module Main where++import Safe.Coerce (coerce)+import N (N)++unwrap :: forall a. N a -> a+unwrap = coerce
+ tests/purs/failing/CoercibleRepresentational7/N.purs view
@@ -0,0 +1,3 @@+module N (N(..)) where++newtype N a = N a
+ tests/purs/failing/CoercibleRepresentational8.out view
@@ -0,0 +1,24 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/CoercibleRepresentational8.purs:9:16 - 9:22 (line 9, column 16 - line 9, column 22)++ No type class instance was found for+ [33m [0m+ [33m Prim.Coerce.Coercible a0[0m+ [33m b1[0m+ [33m [0m++while checking that type [33mforall (a :: Type) (b :: Type). Coercible @Type a b => a -> b[0m+ is at least as general as type [33ma0 -> b1[0m+while checking that expression [33mcoerce[0m+ has type [33ma0 -> b1[0m+in value declaration [33munsafeCoerce[0m++where [33ma0[0m is a rigid type variable+ bound at (line 9, column 16 - line 9, column 22)+ [33mb1[0m is a rigid type variable+ bound at (line 9, column 16 - line 9, column 22)++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CoercibleRepresentational8.purs view
@@ -0,0 +1,9 @@+-- @shouldFailWith NoInstanceFound+module Main where++import UnsafeCoerce (UnsafeCoerce)+import Prim.Coerce (class Coercible)+import Safe.Coerce (coerce)++unsafeCoerce :: forall a b. Coercible (UnsafeCoerce a) (UnsafeCoerce b) => a -> b+unsafeCoerce = coerce
+ tests/purs/failing/CoercibleRepresentational8/UnsafeCoerce.purs view
@@ -0,0 +1,7 @@+module UnsafeCoerce where++import Data.Unit (Unit)++newtype UnsafeCoerce a = UnsafeCoerce Unit++type role UnsafeCoerce representational
+ tests/purs/failing/CoercibleRoleMismatch1.out view
@@ -0,0 +1,14 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/CoercibleRoleMismatch1.purs:6:1 - 6:27 (line 6, column 1 - line 6, column 27)++ Role mismatch for the type parameter [33ma[0m:++ The annotation says [33mphantom[0m but the role [33mrepresentational[0m is required.+++in role declaration for [33mIdentity[0m++See https://github.com/purescript/documentation/blob/master/errors/RoleMismatch.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CoercibleRoleMismatch1.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith RoleMismatch+module Main where++data Identity a = Identity a++type role Identity phantom
+ tests/purs/failing/CoercibleRoleMismatch2.out view
@@ -0,0 +1,14 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/CoercibleRoleMismatch2.purs:10:1 - 10:20 (line 10, column 1 - line 10, column 20)++ Role mismatch for the type parameter [33ma[0m:++ The annotation says [33mphantom[0m but the role [33mnominal[0m is required.+++in role declaration for [33mV[0m++See https://github.com/purescript/documentation/blob/master/errors/RoleMismatch.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CoercibleRoleMismatch2.purs view
@@ -0,0 +1,10 @@+-- @shouldFailWith RoleMismatch+module Main where++data T r (p :: Type) n = T r n++type role T representational phantom nominal++data V a = V (T a a a)++type role V phantom
+ tests/purs/failing/CoercibleRoleMismatch3.out view
@@ -0,0 +1,14 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/CoercibleRoleMismatch3.purs:10:1 - 10:29 (line 10, column 1 - line 10, column 29)++ Role mismatch for the type parameter [33ma[0m:++ The annotation says [33mrepresentational[0m but the role [33mnominal[0m is required.+++in role declaration for [33mU[0m++See https://github.com/purescript/documentation/blob/master/errors/RoleMismatch.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CoercibleRoleMismatch3.purs view
@@ -0,0 +1,10 @@+-- @shouldFailWith RoleMismatch+module Main where++data T r (p :: Type) n = T r n++type role T representational phantom nominal++data U a = U (T a a a)++type role U representational
+ tests/purs/failing/CoercibleRoleMismatch4.out view
@@ -0,0 +1,14 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/CoercibleRoleMismatch4.purs:5:1 - 5:29 (line 5, column 1 - line 5, column 29)++ Role mismatch for the type parameter [33ma[0m:++ The annotation says [33mrepresentational[0m but the role [33mnominal[0m is required.+++in role declaration for [33mF[0m++See https://github.com/purescript/documentation/blob/master/errors/RoleMismatch.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CoercibleRoleMismatch4.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith RoleMismatch+module Main where++data F a = F (G a)+type role F representational++data G a = G (F a)+type role G nominal
+ tests/purs/failing/CoercibleRoleMismatch5.out view
@@ -0,0 +1,14 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/CoercibleRoleMismatch5.purs:5:1 - 5:20 (line 5, column 1 - line 5, column 20)++ Role mismatch for the type parameter [33ma[0m:++ The annotation says [33mphantom[0m but the role [33mrepresentational[0m is required.+++in role declaration for [33mF[0m++See https://github.com/purescript/documentation/blob/master/errors/RoleMismatch.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CoercibleRoleMismatch5.purs view
@@ -0,0 +1,7 @@+-- @shouldFailWith RoleMismatch+module Main where++data F a = F a (G a)+type role F phantom++data G a = G (F a)
+ tests/purs/failing/CoercibleUnknownRowTail1.out view
@@ -0,0 +1,41 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/CoercibleUnknownRowTail1.purs:7:9 - 7:24 (line 7, column 9 - line 7, column 24)++ No type class instance was found for+ [33m [0m+ [33m Prim.Coerce.Coercible ()[0m+ [33m t0[0m+ [33m [0m+ The instance head contains unknown type variables. Consider adding a type annotation.++while solving type class constraint+[33m [0m+[33m Prim.Coerce.Coercible { a :: Int[0m+[33m } [0m+[33m { a :: Int[0m+[33m | t0 [0m+[33m } [0m+[33m [0m+while applying a function [33mcoerce[0m+ of type [33mCoercible @Type t1 t2 => t1 -> t2[0m+ to argument [33m{ a: 0[0m+ [33m} [0m+while checking that expression [33mcoerce { a: 0[0m+ [33m } [0m+ has type [33m{ a :: Int[0m+ [33m| t0 [0m+ [33m} [0m+while checking type of property accessor [33m(coerce { a: ...[0m+ [33m } [0m+ [33m) [0m+ [33m.a [0m+in value declaration [33mzero[0m++where [33mt0[0m is an unknown type+ [33mt1[0m is an unknown type+ [33mt2[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CoercibleUnknownRowTail1.purs view
@@ -0,0 +1,7 @@+-- @shouldFailWith NoInstanceFound+module Main where++import Safe.Coerce (coerce)++zero :: Int+zero = (coerce { a: 0 }).a
+ tests/purs/failing/CoercibleUnknownRowTail2.out view
@@ -0,0 +1,46 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/CoercibleUnknownRowTail2.purs:7:9 - 7:30 (line 7, column 9 - line 7, column 30)++ No type class instance was found for+ [33m [0m+ [33m Prim.Coerce.Coercible ( b :: Int[0m+ [33m ) [0m+ [33m t0 [0m+ [33m [0m+ The instance head contains unknown type variables. Consider adding a type annotation.++while solving type class constraint+[33m [0m+[33m Prim.Coerce.Coercible { a :: Int[0m+[33m , b :: Int[0m+[33m } [0m+[33m { a :: Int[0m+[33m | t0 [0m+[33m } [0m+[33m [0m+while applying a function [33mcoerce[0m+ of type [33mCoercible @Type t1 t2 => t1 -> t2[0m+ to argument [33m{ a: 0[0m+ [33m, b: 1[0m+ [33m} [0m+while checking that expression [33mcoerce { a: 0[0m+ [33m , b: 1[0m+ [33m } [0m+ has type [33m{ a :: Int[0m+ [33m| t0 [0m+ [33m} [0m+while checking type of property accessor [33m(coerce { a: ...[0m+ [33m , b: ...[0m+ [33m } [0m+ [33m) [0m+ [33m.a [0m+in value declaration [33mzero[0m++where [33mt0[0m is an unknown type+ [33mt1[0m is an unknown type+ [33mt2[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CoercibleUnknownRowTail2.purs view
@@ -0,0 +1,7 @@+-- @shouldFailWith NoInstanceFound+module Main where++import Safe.Coerce (coerce)++zero :: Int+zero = (coerce { a: 0, b: 1 }).a
+ tests/purs/failing/CompareInt1.out view
@@ -0,0 +1,43 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/CompareInt1.purs:14:16 - 14:29 (line 14, column 16 - line 14, column 29)++ Could not match type+ [33m [0m+ [33m EQ[0m+ [33m [0m+ with type+ [33m [0m+ [33m GT[0m+ [33m [0m++while solving type class constraint+[33m [0m+[33m Prim.Int.Compare a0[0m+[33m b1[0m+[33m GT[0m+[33m [0m+while checking that type [33mforall (l :: Int) (r :: Int). [0m+ [33m Compare l r GT => Proxy @(Row Int)[0m+ [33m ( left :: l [0m+ [33m , right :: r [0m+ [33m ) [0m+ is at least as general as type [33mProxy @(Row Int)[0m+ [33m ( left :: a0 [0m+ [33m , right :: b1 [0m+ [33m ) [0m+while checking that expression [33massertGreater[0m+ has type [33mProxy @(Row Int)[0m+ [33m ( left :: a0 [0m+ [33m , right :: b1 [0m+ [33m ) [0m+in value declaration [33mimpossible[0m++where [33ma0[0m is a rigid type variable+ bound at (line 0, column 0 - line 0, column 0)+ [33mb1[0m is a rigid type variable+ bound at (line 0, column 0 - line 0, column 0)++See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CompareInt1.purs view
@@ -0,0 +1,14 @@+-- @shouldFailWith TypesDoNotUnify+module Main where++import Prim.Int (class Compare)+import Prim.Ordering (EQ, GT, LT)++data Proxy :: forall k. k -> Type+data Proxy n = Proxy++assertGreater :: forall l r. Compare l r GT => Proxy ( left :: l, right :: r )+assertGreater = Proxy++impossible :: forall a b c. Compare a b EQ => Compare b c GT => Proxy c -> Proxy ( left :: a, right :: b )+impossible _ = assertGreater
+ tests/purs/failing/CompareInt10.out view
@@ -0,0 +1,43 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/CompareInt10.purs:14:16 - 14:27 (line 14, column 16 - line 14, column 27)++ Could not match type+ [33m [0m+ [33m LT[0m+ [33m [0m+ with type+ [33m [0m+ [33m EQ[0m+ [33m [0m++while solving type class constraint+[33m [0m+[33m Prim.Int.Compare c0[0m+[33m a1[0m+[33m EQ[0m+[33m [0m+while checking that type [33mforall (l :: Int) (r :: Int). [0m+ [33m Compare l r EQ => Proxy @(Row Int)[0m+ [33m ( left :: l [0m+ [33m , right :: r [0m+ [33m ) [0m+ is at least as general as type [33mProxy @(Row Int)[0m+ [33m ( left :: c0 [0m+ [33m , right :: a1 [0m+ [33m ) [0m+while checking that expression [33massertEqual[0m+ has type [33mProxy @(Row Int)[0m+ [33m ( left :: c0 [0m+ [33m , right :: a1 [0m+ [33m ) [0m+in value declaration [33mimpossible[0m++where [33ma1[0m is a rigid type variable+ bound at (line 0, column 0 - line 0, column 0)+ [33mc0[0m is a rigid type variable+ bound at (line 0, column 0 - line 0, column 0)++See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CompareInt10.purs view
@@ -0,0 +1,14 @@+-- @shouldFailWith TypesDoNotUnify+module Main where++import Prim.Int (class Compare)+import Prim.Ordering (EQ, GT, LT)++data Proxy :: forall k. k -> Type+data Proxy n = Proxy++assertEqual :: forall l r. Compare l r EQ => Proxy ( left :: l, right :: r )+assertEqual = Proxy++impossible :: forall a b c. Compare a b GT => Compare b c GT => Proxy c -> Proxy ( left :: c, right :: a )+impossible _ = assertEqual
+ tests/purs/failing/CompareInt11.out view
@@ -0,0 +1,33 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/CompareInt11.purs:14:14 - 14:26 (line 14, column 14 - line 14, column 26)++ No type class instance was found for+ [33m [0m+ [33m Prim.Int.Compare a0[0m+ [33m 5 [0m+ [33m LT[0m+ [33m [0m++while checking that type [33mforall (l :: Int) (r :: Int). [0m+ [33m Compare l r LT => Proxy @(Row Int)[0m+ [33m ( left :: l [0m+ [33m , right :: r [0m+ [33m ) [0m+ is at least as general as type [33mProxy @(Row Int)[0m+ [33m ( left :: a0 [0m+ [33m , right :: 5 [0m+ [33m ) [0m+while checking that expression [33massertLesser[0m+ has type [33mProxy @(Row Int)[0m+ [33m ( left :: a0 [0m+ [33m , right :: 5 [0m+ [33m ) [0m+in value declaration [33mimpossible[0m++where [33ma0[0m is a rigid type variable+ bound at (line 14, column 14 - line 14, column 26)++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CompareInt11.purs view
@@ -0,0 +1,14 @@+-- @shouldFailWith NoInstanceFound+module Main where++import Prim.Int (class Compare)+import Prim.Ordering (EQ, GT, LT)++data Proxy :: forall k. k -> Type+data Proxy n = Proxy++assertLesser :: forall l r. Compare l r LT => Proxy ( left :: l, right :: r )+assertLesser = Proxy++impossible :: forall a. Compare a 10 LT => Proxy ( left :: a, right :: 5 )+impossible = assertLesser
+ tests/purs/failing/CompareInt12.out view
@@ -0,0 +1,33 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/CompareInt12.purs:14:14 - 14:27 (line 14, column 14 - line 14, column 27)++ No type class instance was found for+ [33m [0m+ [33m Prim.Int.Compare a0[0m+ [33m 20[0m+ [33m GT[0m+ [33m [0m++while checking that type [33mforall (l :: Int) (r :: Int). [0m+ [33m Compare l r GT => Proxy @(Row Int)[0m+ [33m ( left :: l [0m+ [33m , right :: r [0m+ [33m ) [0m+ is at least as general as type [33mProxy @(Row Int)[0m+ [33m ( left :: a0 [0m+ [33m , right :: 20 [0m+ [33m ) [0m+while checking that expression [33massertGreater[0m+ has type [33mProxy @(Row Int)[0m+ [33m ( left :: a0 [0m+ [33m , right :: 20 [0m+ [33m ) [0m+in value declaration [33mimpossible[0m++where [33ma0[0m is a rigid type variable+ bound at (line 14, column 14 - line 14, column 27)++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CompareInt12.purs view
@@ -0,0 +1,14 @@+-- @shouldFailWith NoInstanceFound+module Main where++import Prim.Int (class Compare)+import Prim.Ordering (EQ, GT, LT)++data Proxy :: forall k. k -> Type+data Proxy n = Proxy++assertGreater :: forall l r. Compare l r GT => Proxy ( left :: l, right :: r )+assertGreater = Proxy++impossible :: forall a. Compare a 10 GT => Proxy ( left :: a, right :: 20 )+impossible = assertGreater
+ tests/purs/failing/CompareInt2.out view
@@ -0,0 +1,43 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/CompareInt2.purs:14:14 - 14:27 (line 14, column 14 - line 14, column 27)++ Could not match type+ [33m [0m+ [33m LT[0m+ [33m [0m+ with type+ [33m [0m+ [33m GT[0m+ [33m [0m++while solving type class constraint+[33m [0m+[33m Prim.Int.Compare b0[0m+[33m a1[0m+[33m GT[0m+[33m [0m+while checking that type [33mforall (l :: Int) (r :: Int). [0m+ [33m Compare l r GT => Proxy @(Row Int)[0m+ [33m ( left :: l [0m+ [33m , right :: r [0m+ [33m ) [0m+ is at least as general as type [33mProxy @(Row Int)[0m+ [33m ( left :: b0 [0m+ [33m , right :: a1 [0m+ [33m ) [0m+while checking that expression [33massertGreater[0m+ has type [33mProxy @(Row Int)[0m+ [33m ( left :: b0 [0m+ [33m , right :: a1 [0m+ [33m ) [0m+in value declaration [33mimpossible[0m++where [33ma1[0m is a rigid type variable+ bound at (line 14, column 14 - line 14, column 27)+ [33mb0[0m is a rigid type variable+ bound at (line 14, column 14 - line 14, column 27)++See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CompareInt2.purs view
@@ -0,0 +1,14 @@+-- @shouldFailWith TypesDoNotUnify+module Main where++import Prim.Int (class Compare)+import Prim.Ordering (EQ, GT, LT)++data Proxy :: forall k. k -> Type+data Proxy n = Proxy++assertGreater :: forall l r. Compare l r GT => Proxy ( left :: l, right :: r )+assertGreater = Proxy++impossible :: forall a b. Compare a b GT => Proxy ( left :: b, right :: a )+impossible = assertGreater
+ tests/purs/failing/CompareInt3.out view
@@ -0,0 +1,43 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/CompareInt3.purs:14:16 - 14:28 (line 14, column 16 - line 14, column 28)++ Could not match type+ [33m [0m+ [33m EQ[0m+ [33m [0m+ with type+ [33m [0m+ [33m LT[0m+ [33m [0m++while solving type class constraint+[33m [0m+[33m Prim.Int.Compare a0[0m+[33m b1[0m+[33m LT[0m+[33m [0m+while checking that type [33mforall (l :: Int) (r :: Int). [0m+ [33m Compare l r LT => Proxy @(Row Int)[0m+ [33m ( left :: l [0m+ [33m , right :: r [0m+ [33m ) [0m+ is at least as general as type [33mProxy @(Row Int)[0m+ [33m ( left :: a0 [0m+ [33m , right :: b1 [0m+ [33m ) [0m+while checking that expression [33massertLesser[0m+ has type [33mProxy @(Row Int)[0m+ [33m ( left :: a0 [0m+ [33m , right :: b1 [0m+ [33m ) [0m+in value declaration [33mimpossible[0m++where [33ma0[0m is a rigid type variable+ bound at (line 0, column 0 - line 0, column 0)+ [33mb1[0m is a rigid type variable+ bound at (line 0, column 0 - line 0, column 0)++See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CompareInt3.purs view
@@ -0,0 +1,14 @@+-- @shouldFailWith TypesDoNotUnify+module Main where++import Prim.Int (class Compare)+import Prim.Ordering (EQ, GT, LT)++data Proxy :: forall k. k -> Type+data Proxy n = Proxy++assertLesser :: forall l r. Compare l r LT => Proxy ( left :: l, right :: r )+assertLesser = Proxy++impossible :: forall a b c. Compare a b EQ => Compare b c LT => Proxy c -> Proxy ( left :: a, right :: b )+impossible _ = assertLesser
+ tests/purs/failing/CompareInt4.out view
@@ -0,0 +1,43 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/CompareInt4.purs:14:14 - 14:26 (line 14, column 14 - line 14, column 26)++ Could not match type+ [33m [0m+ [33m GT[0m+ [33m [0m+ with type+ [33m [0m+ [33m LT[0m+ [33m [0m++while solving type class constraint+[33m [0m+[33m Prim.Int.Compare b0[0m+[33m a1[0m+[33m LT[0m+[33m [0m+while checking that type [33mforall (l :: Int) (r :: Int). [0m+ [33m Compare l r LT => Proxy @(Row Int)[0m+ [33m ( left :: l [0m+ [33m , right :: r [0m+ [33m ) [0m+ is at least as general as type [33mProxy @(Row Int)[0m+ [33m ( left :: b0 [0m+ [33m , right :: a1 [0m+ [33m ) [0m+while checking that expression [33massertLesser[0m+ has type [33mProxy @(Row Int)[0m+ [33m ( left :: b0 [0m+ [33m , right :: a1 [0m+ [33m ) [0m+in value declaration [33mimpossible[0m++where [33ma1[0m is a rigid type variable+ bound at (line 14, column 14 - line 14, column 26)+ [33mb0[0m is a rigid type variable+ bound at (line 14, column 14 - line 14, column 26)++See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CompareInt4.purs view
@@ -0,0 +1,14 @@+-- @shouldFailWith TypesDoNotUnify+module Main where++import Prim.Int (class Compare)+import Prim.Ordering (EQ, GT, LT)++data Proxy :: forall k. k -> Type+data Proxy n = Proxy++assertLesser :: forall l r. Compare l r LT => Proxy ( left :: l, right :: r )+assertLesser = Proxy++impossible :: forall a b. Compare a b LT => Proxy ( left :: b, right :: a )+impossible = assertLesser
+ tests/purs/failing/CompareInt5.out view
@@ -0,0 +1,43 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/CompareInt5.purs:14:16 - 14:29 (line 14, column 16 - line 14, column 29)++ Could not match type+ [33m [0m+ [33m LT[0m+ [33m [0m+ with type+ [33m [0m+ [33m GT[0m+ [33m [0m++while solving type class constraint+[33m [0m+[33m Prim.Int.Compare c0[0m+[33m a1[0m+[33m GT[0m+[33m [0m+while checking that type [33mforall (l :: Int) (r :: Int). [0m+ [33m Compare l r GT => Proxy @(Row Int)[0m+ [33m ( left :: l [0m+ [33m , right :: r [0m+ [33m ) [0m+ is at least as general as type [33mProxy @(Row Int)[0m+ [33m ( left :: c0 [0m+ [33m , right :: a1 [0m+ [33m ) [0m+while checking that expression [33massertGreater[0m+ has type [33mProxy @(Row Int)[0m+ [33m ( left :: c0 [0m+ [33m , right :: a1 [0m+ [33m ) [0m+in value declaration [33mimpossible[0m++where [33ma1[0m is a rigid type variable+ bound at (line 0, column 0 - line 0, column 0)+ [33mc0[0m is a rigid type variable+ bound at (line 0, column 0 - line 0, column 0)++See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CompareInt5.purs view
@@ -0,0 +1,14 @@+-- @shouldFailWith TypesDoNotUnify+module Main where++import Prim.Int (class Compare)+import Prim.Ordering (EQ, GT, LT)++data Proxy :: forall k. k -> Type+data Proxy n = Proxy++assertGreater :: forall l r. Compare l r GT => Proxy ( left :: l, right :: r )+assertGreater = Proxy++impossible :: forall a b c. Compare a b GT => Compare b c GT => Proxy c -> Proxy ( left :: c, right :: a )+impossible _ = assertGreater
+ tests/purs/failing/CompareInt6.out view
@@ -0,0 +1,43 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/CompareInt6.purs:14:16 - 14:28 (line 14, column 16 - line 14, column 28)++ Could not match type+ [33m [0m+ [33m GT[0m+ [33m [0m+ with type+ [33m [0m+ [33m LT[0m+ [33m [0m++while solving type class constraint+[33m [0m+[33m Prim.Int.Compare c0[0m+[33m a1[0m+[33m LT[0m+[33m [0m+while checking that type [33mforall (l :: Int) (r :: Int). [0m+ [33m Compare l r LT => Proxy @(Row Int)[0m+ [33m ( left :: l [0m+ [33m , right :: r [0m+ [33m ) [0m+ is at least as general as type [33mProxy @(Row Int)[0m+ [33m ( left :: c0 [0m+ [33m , right :: a1 [0m+ [33m ) [0m+while checking that expression [33massertLesser[0m+ has type [33mProxy @(Row Int)[0m+ [33m ( left :: c0 [0m+ [33m , right :: a1 [0m+ [33m ) [0m+in value declaration [33mimpossible[0m++where [33ma1[0m is a rigid type variable+ bound at (line 0, column 0 - line 0, column 0)+ [33mc0[0m is a rigid type variable+ bound at (line 0, column 0 - line 0, column 0)++See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CompareInt6.purs view
@@ -0,0 +1,14 @@+-- @shouldFailWith TypesDoNotUnify+module Main where++import Prim.Int (class Compare)+import Prim.Ordering (EQ, GT, LT)++data Proxy :: forall k. k -> Type+data Proxy n = Proxy++assertLesser :: forall l r. Compare l r LT => Proxy ( left :: l, right :: r )+assertLesser = Proxy++impossible :: forall a b c. Compare a b LT => Compare b c LT => Proxy c -> Proxy ( left :: c, right :: a )+impossible _ = assertLesser
+ tests/purs/failing/CompareInt7.out view
@@ -0,0 +1,43 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/CompareInt7.purs:14:16 - 14:27 (line 14, column 16 - line 14, column 27)++ Could not match type+ [33m [0m+ [33m LT[0m+ [33m [0m+ with type+ [33m [0m+ [33m EQ[0m+ [33m [0m++while solving type class constraint+[33m [0m+[33m Prim.Int.Compare a0[0m+[33m c1[0m+[33m EQ[0m+[33m [0m+while checking that type [33mforall (l :: Int) (r :: Int). [0m+ [33m Compare l r EQ => Proxy @(Row Int)[0m+ [33m ( left :: l [0m+ [33m , right :: r [0m+ [33m ) [0m+ is at least as general as type [33mProxy @(Row Int)[0m+ [33m ( left :: a0 [0m+ [33m , right :: c1 [0m+ [33m ) [0m+while checking that expression [33massertEqual[0m+ has type [33mProxy @(Row Int)[0m+ [33m ( left :: a0 [0m+ [33m , right :: c1 [0m+ [33m ) [0m+in value declaration [33mimpossible[0m++where [33ma0[0m is a rigid type variable+ bound at (line 0, column 0 - line 0, column 0)+ [33mc1[0m is a rigid type variable+ bound at (line 0, column 0 - line 0, column 0)++See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CompareInt7.purs view
@@ -0,0 +1,14 @@+-- @shouldFailWith TypesDoNotUnify+module Main where++import Prim.Int (class Compare)+import Prim.Ordering (EQ, GT, LT)++data Proxy :: forall k. k -> Type+data Proxy n = Proxy++assertEqual :: forall l r. Compare l r EQ => Proxy ( left :: l, right :: r )+assertEqual = Proxy++impossible :: forall a b c. Compare a b LT => Compare b c LT => Proxy c -> Proxy ( left :: a, right :: c )+impossible _ = assertEqual
+ tests/purs/failing/CompareInt8.out view
@@ -0,0 +1,43 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/CompareInt8.purs:14:16 - 14:27 (line 14, column 16 - line 14, column 27)++ Could not match type+ [33m [0m+ [33m GT[0m+ [33m [0m+ with type+ [33m [0m+ [33m EQ[0m+ [33m [0m++while solving type class constraint+[33m [0m+[33m Prim.Int.Compare a0[0m+[33m c1[0m+[33m EQ[0m+[33m [0m+while checking that type [33mforall (l :: Int) (r :: Int). [0m+ [33m Compare l r EQ => Proxy @(Row Int)[0m+ [33m ( left :: l [0m+ [33m , right :: r [0m+ [33m ) [0m+ is at least as general as type [33mProxy @(Row Int)[0m+ [33m ( left :: a0 [0m+ [33m , right :: c1 [0m+ [33m ) [0m+while checking that expression [33massertEqual[0m+ has type [33mProxy @(Row Int)[0m+ [33m ( left :: a0 [0m+ [33m , right :: c1 [0m+ [33m ) [0m+in value declaration [33mimpossible[0m++where [33ma0[0m is a rigid type variable+ bound at (line 0, column 0 - line 0, column 0)+ [33mc1[0m is a rigid type variable+ bound at (line 0, column 0 - line 0, column 0)++See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CompareInt8.purs view
@@ -0,0 +1,14 @@+-- @shouldFailWith TypesDoNotUnify+module Main where++import Prim.Int (class Compare)+import Prim.Ordering (EQ, GT, LT)++data Proxy :: forall k. k -> Type+data Proxy n = Proxy++assertEqual :: forall l r. Compare l r EQ => Proxy ( left :: l, right :: r )+assertEqual = Proxy++impossible :: forall a b c. Compare a b GT => Compare b c GT => Proxy c -> Proxy ( left :: a, right :: c )+impossible _ = assertEqual
+ tests/purs/failing/CompareInt9.out view
@@ -0,0 +1,43 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/CompareInt9.purs:14:16 - 14:27 (line 14, column 16 - line 14, column 27)++ Could not match type+ [33m [0m+ [33m GT[0m+ [33m [0m+ with type+ [33m [0m+ [33m EQ[0m+ [33m [0m++while solving type class constraint+[33m [0m+[33m Prim.Int.Compare c0[0m+[33m a1[0m+[33m EQ[0m+[33m [0m+while checking that type [33mforall (l :: Int) (r :: Int). [0m+ [33m Compare l r EQ => Proxy @(Row Int)[0m+ [33m ( left :: l [0m+ [33m , right :: r [0m+ [33m ) [0m+ is at least as general as type [33mProxy @(Row Int)[0m+ [33m ( left :: c0 [0m+ [33m , right :: a1 [0m+ [33m ) [0m+while checking that expression [33massertEqual[0m+ has type [33mProxy @(Row Int)[0m+ [33m ( left :: c0 [0m+ [33m , right :: a1 [0m+ [33m ) [0m+in value declaration [33mimpossible[0m++where [33ma1[0m is a rigid type variable+ bound at (line 0, column 0 - line 0, column 0)+ [33mc0[0m is a rigid type variable+ bound at (line 0, column 0 - line 0, column 0)++See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CompareInt9.purs view
@@ -0,0 +1,14 @@+-- @shouldFailWith TypesDoNotUnify+module Main where++import Prim.Int (class Compare)+import Prim.Ordering (EQ, GT, LT)++data Proxy :: forall k. k -> Type+data Proxy n = Proxy++assertEqual :: forall l r. Compare l r EQ => Proxy ( left :: l, right :: r )+assertEqual = Proxy++impossible :: forall a b c. Compare a b LT => Compare b c LT => Proxy c -> Proxy ( left :: c, right :: a )+impossible _ = assertEqual
+ tests/purs/failing/ConflictingExports.out view
@@ -0,0 +1,14 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/ConflictingExports.purs:3:14 - 3:22 (line 3, column 14 - line 3, column 22)++ Conflicting definitions are in scope for value [33mthing[0m from the following modules:++ [33mA[0m+ [33mB[0m++++See https://github.com/purescript/documentation/blob/master/errors/ScopeConflict.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ConflictingExports.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith ScopeConflict+-- Fails here because re-exporting forces any scope conflicts to be resolved+module Main (module A, module B) where++ import A+ import B
+ tests/purs/failing/ConflictingExports/A.purs view
@@ -0,0 +1,4 @@+module A where++thing :: Int+thing = 1
+ tests/purs/failing/ConflictingExports/B.purs view
@@ -0,0 +1,4 @@+module B where++thing :: Int+thing = 2
+ tests/purs/failing/ConflictingImports.out view
@@ -0,0 +1,14 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/ConflictingImports.purs:9:8 - 9:13 (line 9, column 8 - line 9, column 13)++ Conflicting definitions are in scope for value [33mthing[0m from the following modules:++ [33mA[0m+ [33mB[0m++++See https://github.com/purescript/documentation/blob/master/errors/ScopeConflict.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ConflictingImports.purs view
@@ -0,0 +1,9 @@+-- @shouldFailWith ScopeConflict+module Main where++import A+import B++-- Error due to referencing `thing` which is in scope as A.thing and B.thing+what :: Int+what = thing
+ tests/purs/failing/ConflictingImports/A.purs view
@@ -0,0 +1,4 @@+module A where++thing :: Int+thing = 1
+ tests/purs/failing/ConflictingImports/B.out view
@@ -0,0 +1,14 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/ConflictingImports.purs:9:8 - 9:13 (line 9, column 8 - line 9, column 13)++ Conflicting definitions are in scope for value [33mthing[0m from the following modules:++ [33mA[0m+ [33mB[0m++++See https://github.com/purescript/documentation/blob/master/errors/ScopeConflict.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ConflictingImports/B.purs view
@@ -0,0 +1,4 @@+module B where++thing :: Int+thing = 2
+ tests/purs/failing/ConflictingImports2.out view
@@ -0,0 +1,14 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/ConflictingImports2.purs:10:8 - 10:13 (line 10, column 8 - line 10, column 13)++ Conflicting definitions are in scope for value [33mthing[0m from the following modules:++ [33mA[0m+ [33mB[0m++++See https://github.com/purescript/documentation/blob/master/errors/ScopeConflict.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ConflictingImports2.purs view
@@ -0,0 +1,10 @@+-- @shouldFailWith ScopeConflict+module Main where++import A (thing)+import B (thing)++-- Error due to referencing `thing` which is explicitly in scope as A.thing+-- and B.thing+what :: Int+what = thing
+ tests/purs/failing/ConflictingImports2/A.purs view
@@ -0,0 +1,4 @@+module A where++thing :: Int+thing = 1
+ tests/purs/failing/ConflictingImports2/B.out view
@@ -0,0 +1,14 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/ConflictingImports2.purs:10:8 - 10:13 (line 10, column 8 - line 10, column 13)++ Conflicting definitions are in scope for value [33mthing[0m from the following modules:++ [33mA[0m+ [33mB[0m++++See https://github.com/purescript/documentation/blob/master/errors/ScopeConflict.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ConflictingImports2/B.purs view
@@ -0,0 +1,4 @@+module B where++thing :: Int+thing = 2
+ tests/purs/failing/ConflictingQualifiedImports.out view
@@ -0,0 +1,14 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/ConflictingQualifiedImports.purs:7:7 - 7:14 (line 7, column 7 - line 7, column 14)++ Conflicting definitions are in scope for value [33mthing[0m from the following modules:++ [33mA[0m+ [33mB[0m++++See https://github.com/purescript/documentation/blob/master/errors/ScopeConflict.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ConflictingQualifiedImports.purs view
@@ -0,0 +1,7 @@+-- @shouldFailWith ScopeConflict+module Main where++import A as X+import B as X++foo = X.thing
+ tests/purs/failing/ConflictingQualifiedImports/A.purs view
@@ -0,0 +1,4 @@+module A where++thing :: Int+thing = 1
+ tests/purs/failing/ConflictingQualifiedImports/B.purs view
@@ -0,0 +1,4 @@+module B where++thing :: Int+thing = 2
+ tests/purs/failing/ConflictingQualifiedImports2.out view
@@ -0,0 +1,14 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/ConflictingQualifiedImports2.purs:2:14 - 2:22 (line 2, column 14 - line 2, column 22)++ Conflicting definitions are in scope for value [33mthing[0m from the following modules:++ [33mA[0m+ [33mB[0m++++See https://github.com/purescript/documentation/blob/master/errors/ScopeConflict.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ConflictingQualifiedImports2.purs view
@@ -0,0 +1,5 @@+-- @shouldFailWith ScopeConflict+module Main (module X) where++import A as X+import B as X
+ tests/purs/failing/ConflictingQualifiedImports2/A.purs view
@@ -0,0 +1,4 @@+module A where++thing :: Int+thing = 1
+ tests/purs/failing/ConflictingQualifiedImports2/B.out view
@@ -0,0 +1,14 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/ConflictingQualifiedImports2.purs:2:14 - 2:22 (line 2, column 14 - line 2, column 22)++ Conflicting definitions are in scope for value [33mthing[0m from the following modules:++ [33mA[0m+ [33mB[0m++++See https://github.com/purescript/documentation/blob/master/errors/ScopeConflict.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ConflictingQualifiedImports2/B.purs view
@@ -0,0 +1,4 @@+module B where++thing :: Int+thing = 2
+ tests/purs/failing/ConstraintFailure.out view
@@ -0,0 +1,22 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/ConstraintFailure.purs:12:8 - 12:12 (line 12, column 8 - line 12, column 12)++ No type class instance was found for+ [33m [0m+ [33m Data.Show.Show Foo[0m+ [33m [0m++while checking that type [33mforall (@a :: Type). Show a => a -> String[0m+ is at least as general as type [33mt0 t1 t2[0m+while checking that expression [33mshow[0m+ has type [33mt0 t1 t2[0m+in value declaration [33mmain[0m++where [33mt0[0m is an unknown type+ [33mt1[0m is an unknown type+ [33mt2[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ConstraintFailure.purs view
@@ -0,0 +1,13 @@+-- @shouldFailWith NoInstanceFound++module Main where++import Prelude++data Foo = Bar+ +spin :: forall a. a -> Foo+spin x = Bar++main = show <<< spin+
+ tests/purs/failing/ConstraintInForeignImport.js view
@@ -0,0 +1,5 @@+export var show = function (showDict) {+ return function (a) {+ return showDict.show(a);+ };+};
+ tests/purs/failing/ConstraintInForeignImport.out view
@@ -0,0 +1,10 @@+Error found:+at tests/purs/failing/ConstraintInForeignImport.purs:6:1 - 6:50 (line 6, column 1 - line 6, column 50)++ Unable to parse module:+ Constraints are not allowed in foreign imports. Omit the constraint instead and update the foreign module accordingly.+++See https://github.com/purescript/documentation/blob/master/errors/ErrorParsingModule.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ConstraintInForeignImport.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith ErrorParsingModule+module Main where++import Data.Show (class Show)++foreign import show :: ∀ a. Show a => a -> String
+ tests/purs/failing/ConstraintInference.out view
@@ -0,0 +1,19 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/ConstraintInference.purs:10:1 - 10:21 (line 10, column 1 - line 10, column 21)++ The inferred type+ [33m [0m+ [33m forall c8 t11. Show c8 => t11 -> String[0m+ [33m [0m+ has type variables which are not determined by those mentioned in the body of the type:++ [33mc8[0m could not be determined++ Consider adding a type annotation.++in value declaration [33mtest[0m++See https://github.com/purescript/documentation/blob/master/errors/AmbiguousTypeVariables.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ConstraintInference.purs view
@@ -0,0 +1,10 @@+-- @shouldFailWith AmbiguousTypeVariables++module Main where++import Prelude++spin :: forall a b. a -> b+spin x = spin x++test = show <<< spin
+ tests/purs/failing/ContravariantInstance1.out view
@@ -0,0 +1,16 @@+Error found:+in module [33mContravariantInstance1[0m+at tests/purs/failing/ContravariantInstance1.purs:9:1 - 9:35 (line 9, column 1 - line 9, column 35)++ One or more type variables are in positions that prevent [33mContravariant[0m from being derived.+ To derive this class, make sure that these variables are only used as the final arguments to type constructors, that their variance matches the variance of [33mContravariant[0m, and that those type constructors themselves have instances of [33mData.Functor.Functor[0m, [33mData.Bifunctor.Bifunctor[0m, [33mData.Functor.Contravariant.Contravariant[0m, or [33mData.Profunctor.Profunctor[0m.++ tests/purs/failing/ContravariantInstance1.purs:+ [90m 6[0m [33m[0m+ [90m 7[0m [33mnewtype Test a = Test (Predicate (Predicate [7ma[27m))[0m+ [90m 8[0m [33m[0m+++See https://github.com/purescript/documentation/blob/master/errors/CannotDeriveInvalidConstructorArg.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ContravariantInstance1.purs view
@@ -0,0 +1,9 @@+-- @shouldFailWith CannotDeriveInvalidConstructorArg+module ContravariantInstance1 where++import Data.Functor.Contravariant (class Contravariant)+import Data.Predicate (Predicate)++newtype Test a = Test (Predicate (Predicate a))++derive instance Contravariant Test
+ tests/purs/failing/CycleInForeignDataKinds.out view
@@ -0,0 +1,13 @@+Error found:+at tests/purs/failing/CycleInForeignDataKinds.purs:5:1 - 5:31 (line 5, column 1 - line 5, column 31)++ A cycle appears in a set of kind declarations:++ {[33mBar[0m, [33mFoo[0m}++ Kind declarations may not refer to themselves in their own signatures.+++See https://github.com/purescript/documentation/blob/master/errors/CycleInKindDeclaration.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CycleInForeignDataKinds.purs view
@@ -0,0 +1,5 @@+-- @shouldFailWith CycleInKindDeclaration+module Main where++foreign import data Foo :: Bar+foreign import data Bar :: Foo
+ tests/purs/failing/CycleInKindDeclaration.out view
@@ -0,0 +1,13 @@+Error found:+at tests/purs/failing/CycleInKindDeclaration.purs:7:1 - 7:24 (line 7, column 1 - line 7, column 24)++ A cycle appears in a set of kind declarations:++ {[33mBar[0m, [33mFoo[0m}++ Kind declarations may not refer to themselves in their own signatures.+++See https://github.com/purescript/documentation/blob/master/errors/CycleInKindDeclaration.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/CycleInKindDeclaration.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith CycleInKindDeclaration+module Main where++data Foo :: Bar -> Type+data Foo a = Foo++data Bar :: Foo -> Type+data Bar a = Bar
+ tests/purs/failing/DctorOperatorAliasExport.out view
@@ -0,0 +1,13 @@+Error found:+in module [33mData.List[0m+at tests/purs/failing/DctorOperatorAliasExport.purs:2:1 - 6:21 (line 2, column 1 - line 6, column 21)++ An export for [33m(:)[0m requires the following data constructor to also be exported:++ [33mCons[0m++++See https://github.com/purescript/documentation/blob/master/errors/TransitiveDctorExportError.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/DctorOperatorAliasExport.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith TransitiveDctorExportError+module Data.List (List, (:)) where++ data List a = Cons a (List a) | Nil++ infixr 6 Cons as :
+ tests/purs/failing/DeclConflictClassCtor.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/DeclConflictClassCtor.purs:6:1 - 6:11 (line 6, column 1 - line 6, column 11)++ Declaration for type class [33mFail[0m conflicts with an existing data constructor of the same name.+++See https://github.com/purescript/documentation/blob/master/errors/DeclConflict.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/DeclConflictClassCtor.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith DeclConflict+module Main where++data T = Fail++class Fail
+ tests/purs/failing/DeclConflictClassSynonym.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/DeclConflictClassSynonym.purs:8:1 - 8:11 (line 8, column 1 - line 8, column 11)++ Declaration for type class [33mFail[0m conflicts with an existing type of the same name.+++See https://github.com/purescript/documentation/blob/master/errors/DeclConflict.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/DeclConflictClassSynonym.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith DeclConflict+module Main where++import Prelude++type Fail = Unit++class Fail
+ tests/purs/failing/DeclConflictClassType.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/DeclConflictClassType.purs:6:1 - 6:10 (line 6, column 1 - line 6, column 10)++ Declaration for type [33mFail[0m conflicts with an existing type class of the same name.+++See https://github.com/purescript/documentation/blob/master/errors/DeclConflict.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/DeclConflictClassType.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith DeclConflict+module Main where++class Fail++data Fail
+ tests/purs/failing/DeclConflictCtorClass.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/DeclConflictCtorClass.purs:6:1 - 6:14 (line 6, column 1 - line 6, column 14)++ Declaration for data constructor [33mFail[0m conflicts with an existing type class of the same name.+++See https://github.com/purescript/documentation/blob/master/errors/DeclConflict.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/DeclConflictCtorClass.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith DeclConflict+module Main where++class Fail++data T = Fail
+ tests/purs/failing/DeclConflictCtorCtor.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/DeclConflictCtorCtor.purs:6:1 - 6:15 (line 6, column 1 - line 6, column 15)++ Declaration for data constructor [33mFail[0m conflicts with an existing data constructor of the same name.+++See https://github.com/purescript/documentation/blob/master/errors/DeclConflict.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/DeclConflictCtorCtor.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith DeclConflict+module Main where++data T1 = Fail++data T2 = Fail
+ tests/purs/failing/DeclConflictDuplicateCtor.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/DeclConflictDuplicateCtor.purs:4:1 - 4:21 (line 4, column 1 - line 4, column 21)++ Declaration for data constructor [33mFail[0m conflicts with an existing data constructor of the same name.+++See https://github.com/purescript/documentation/blob/master/errors/DeclConflict.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/DeclConflictDuplicateCtor.purs view
@@ -0,0 +1,5 @@+-- @shouldFailWith DeclConflict+module Main where++data T = Fail | Fail+
+ tests/purs/failing/DeclConflictSynonymClass.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/DeclConflictSynonymClass.purs:8:1 - 8:17 (line 8, column 1 - line 8, column 17)++ Declaration for type [33mFail[0m conflicts with an existing type class of the same name.+++See https://github.com/purescript/documentation/blob/master/errors/DeclConflict.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/DeclConflictSynonymClass.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith DeclConflict+module Main where++import Prelude++class Fail++type Fail = Unit
+ tests/purs/failing/DeclConflictSynonymType.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/DeclConflictSynonymType.purs:8:1 - 8:17 (line 8, column 1 - line 8, column 17)++ Declaration for type [33mFail[0m conflicts with an existing type of the same name.+++See https://github.com/purescript/documentation/blob/master/errors/DeclConflict.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/DeclConflictSynonymType.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith DeclConflict+module Main where++import Prelude++data Fail++type Fail = Unit
+ tests/purs/failing/DeclConflictTypeClass.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/DeclConflictTypeClass.purs:6:1 - 6:10 (line 6, column 1 - line 6, column 10)++ Declaration for type [33mFail[0m conflicts with an existing type class of the same name.+++See https://github.com/purescript/documentation/blob/master/errors/DeclConflict.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/DeclConflictTypeClass.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith DeclConflict+module Main where++class Fail++data Fail
+ tests/purs/failing/DeclConflictTypeSynonym.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/DeclConflictTypeSynonym.purs:8:1 - 8:10 (line 8, column 1 - line 8, column 10)++ Declaration for type [33mFail[0m conflicts with an existing type of the same name.+++See https://github.com/purescript/documentation/blob/master/errors/DeclConflict.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/DeclConflictTypeSynonym.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith DeclConflict+module Main where++import Prelude++type Fail = Unit++data Fail
+ tests/purs/failing/DeclConflictTypeType.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/DeclConflictTypeType.purs:6:1 - 6:10 (line 6, column 1 - line 6, column 10)++ Declaration for type [33mFail[0m conflicts with an existing type of the same name.+++See https://github.com/purescript/documentation/blob/master/errors/DeclConflict.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/DeclConflictTypeType.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith DeclConflict+module Main where++data Fail++data Fail
+ tests/purs/failing/DeprecatedFFICommonJSModule.js view
@@ -0,0 +1,4 @@+"use strict";++exports.yes = true;+exports.no = true;
+ tests/purs/failing/DeprecatedFFICommonJSModule.out view
@@ -0,0 +1,13 @@+Error found:+at tests/purs/failing/DeprecatedFFICommonJSModule.purs:2:1 - 5:29 (line 2, column 1 - line 5, column 29)++ A CommonJS foreign module implementation was provided for module [33mMain[0m:++ tests/purs/failing/DeprecatedFFICommonJSModule.js++ CommonJS foreign modules are no longer supported. Use native JavaScript/ECMAScript module syntax instead.+++See https://github.com/purescript/documentation/blob/master/errors/DeprecatedFFICommonJSModule.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/DeprecatedFFICommonJSModule.purs view
@@ -0,0 +1,5 @@+-- @shouldFailWith DeprecatedFFICommonJSModule+module Main where++foreign import yes :: Boolean+foreign import no :: Boolean
+ tests/purs/failing/DeprecatedFFIPrime.js view
@@ -0,0 +1,5 @@+exports['a\''] = 0;+exports["\x62\x27"] = 1;+// NOTE: I wanted to use "\c'" here, but langauge-javascript doesn't support it...+exports["c'"] = 2;+exports["\u0064\u0027"] = 3;
+ tests/purs/failing/DeprecatedFFIPrime.out view
@@ -0,0 +1,56 @@+Error 1 of 4:++ at tests/purs/failing/DeprecatedFFIPrime.purs:5:1 - 10:28 (line 5, column 1 - line 10, column 28)++ In the FFI module for [33mMain[0m:++ The identifier [33ma'[0m contains a prime ([33m'[0m).+ Primes are not allowed in identifiers exported from FFI modules.++++ See https://github.com/purescript/documentation/blob/master/errors/DeprecatedFFIPrime.md for more information,+ or to contribute content related to this error.++Error 2 of 4:++ at tests/purs/failing/DeprecatedFFIPrime.purs:5:1 - 10:28 (line 5, column 1 - line 10, column 28)++ In the FFI module for [33mMain[0m:++ The identifier [33mb'[0m contains a prime ([33m'[0m).+ Primes are not allowed in identifiers exported from FFI modules.++++ See https://github.com/purescript/documentation/blob/master/errors/DeprecatedFFIPrime.md for more information,+ or to contribute content related to this error.++Error 3 of 4:++ at tests/purs/failing/DeprecatedFFIPrime.purs:5:1 - 10:28 (line 5, column 1 - line 10, column 28)++ In the FFI module for [33mMain[0m:++ The identifier [33mc'[0m contains a prime ([33m'[0m).+ Primes are not allowed in identifiers exported from FFI modules.++++ See https://github.com/purescript/documentation/blob/master/errors/DeprecatedFFIPrime.md for more information,+ or to contribute content related to this error.++Error 4 of 4:++ at tests/purs/failing/DeprecatedFFIPrime.purs:5:1 - 10:28 (line 5, column 1 - line 10, column 28)++ In the FFI module for [33mMain[0m:++ The identifier [33md'[0m contains a prime ([33m'[0m).+ Primes are not allowed in identifiers exported from FFI modules.++++ See https://github.com/purescript/documentation/blob/master/errors/DeprecatedFFIPrime.md for more information,+ or to contribute content related to this error.+
+ tests/purs/failing/DeprecatedFFIPrime.purs view
@@ -0,0 +1,10 @@+-- @shouldFailWith DeprecatedFFIPrime+-- @shouldFailWith DeprecatedFFIPrime+-- @shouldFailWith DeprecatedFFIPrime+-- @shouldFailWith DeprecatedFFIPrime+module Main where++foreign import a' :: Number+foreign import b' :: Number+foreign import c' :: Number+foreign import d' :: Number
+ tests/purs/failing/DiffKindsSameName.out view
@@ -0,0 +1,21 @@+Error found:+in module [33mDiffKindsSameName[0m+at tests/purs/failing/DiffKindsSameName.purs:13:18 - 13:31 (line 13, column 18 - line 13, column 31)++ Could not match kind+ [33m [0m+ [33m DemoKind[0m+ [33m [0m+ with kind+ [33m [0m+ [33m DemoKind[0m+ [33m [0m++while checking that type [33mDemoData[0m+ has kind [33mDemoKind[0m+while inferring the kind of [33mAProxy DemoData[0m+in value declaration [33mbProxy[0m++See https://github.com/purescript/documentation/blob/master/errors/KindsDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/DiffKindsSameName.purs view
@@ -0,0 +1,15 @@+-- @shouldFailWith KindsDoNotUnify+module DiffKindsSameName where++import DiffKindsSameName.LibA as LibA+import DiffKindsSameName.LibB as LibB++-- both `LibA` and `LibB` define a kind locally called `DemoKind`+-- `LibB` defines `DemoData :: LibB.DemoKind`+-- if we try to use `DemoData` in a place where `LibA.DemoKind` is expected, it should fail with `KindsDoNotUnify`++data AProxy (m :: LibA.DemoKind) = AProxy++bProxy :: AProxy LibB.DemoData+bProxy = AProxy+
+ tests/purs/failing/DiffKindsSameName/LibA.out view
@@ -0,0 +1,19 @@+Error found:+in module [33mDiffKindsSameName[0m+at tests/purs/failing/DiffKindsSameName.purs:13:18 - 13:31 (line 13, column 18 - line 13, column 31)++ Could not match kind++ [33mDiffKindsSameName.LibA.DemoKind[0m++ with kind++ [33mDiffKindsSameName.LibB.DemoKind[0m+++while checking the kind of [33mAProxy DemoData[0m+in value declaration [33mbProxy[0m++See https://github.com/purescript/documentation/blob/master/errors/KindsDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/DiffKindsSameName/LibA.purs view
@@ -0,0 +1,4 @@+module DiffKindsSameName.LibA where++data DemoKind+
+ tests/purs/failing/DiffKindsSameName/LibB.purs view
@@ -0,0 +1,6 @@+module DiffKindsSameName.LibB where++data DemoKind++foreign import data DemoData :: DemoKind+
+ tests/purs/failing/Do.out view
@@ -0,0 +1,20 @@+Error 1 of 2:++ at tests/purs/failing/Do.purs:7:12 - 7:21 (line 7, column 12 - line 7, column 21)++ The last statement in a 'do' block must be an expression, but this block ends with a let binding.+++ See https://github.com/purescript/documentation/blob/master/errors/InvalidDoLet.md for more information,+ or to contribute content related to this error.++Error 2 of 2:++ at tests/purs/failing/Do.purs:9:14 - 9:20 (line 9, column 14 - line 9, column 20)++ The last statement in a 'do' block must be an expression, but this block ends with a binder.+++ See https://github.com/purescript/documentation/blob/master/errors/InvalidDoBind.md for more information,+ or to contribute content related to this error.+
+ tests/purs/failing/Do.purs view
@@ -0,0 +1,12 @@+-- @shouldFailWith InvalidDoBind+-- @shouldFailWith InvalidDoLet+module Main where++import Prelude++test1 = do let x = 1++test2 y = do x <- y++test3 = do pure 1+ pure 2
+ tests/purs/failing/DoNotSuggestComposition.out view
@@ -0,0 +1,24 @@+Error found:+in module [33mDoNotSuggestComposition[0m+at tests/purs/failing/DoNotSuggestComposition.purs:13:11 - 13:12 (line 13, column 11 - line 13, column 12)++ Could not match type+ [33m [0m+ [33m { y :: Int[0m+ [33m } [0m+ [33m [0m+ with type+ [33m [0m+ [33m String[0m+ [33m [0m++while checking that type [33m{ y :: Int[0m+ [33m} [0m+ is at least as general as type [33mString[0m+while checking that expression [33mx[0m+ has type [33mString[0m+in value declaration [33mbar[0m++See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/DoNotSuggestComposition.purs view
@@ -0,0 +1,13 @@+-- @shouldFailWith TypesDoNotUnify+-- TODO: Check that this does not produce a "function composition is (<<<)"+-- suggestion.+module DoNotSuggestComposition where++import Prelude++x = { y: 3 }++foo :: String -> String+foo y = y++bar = foo x
+ tests/purs/failing/DoNotSuggestComposition2.out view
@@ -0,0 +1,24 @@+Error found:+in module [33mDoNotSuggestComposition2[0m+at tests/purs/failing/DoNotSuggestComposition2.purs:7:27 - 7:30 (line 7, column 27 - line 7, column 30)++ Could not match type+ [33m [0m+ [33m Record[0m+ [33m [0m+ with type+ [33m [0m+ [33m Function Int[0m+ [33m [0m++while trying to match type [33m{ y :: Int[0m+ [33m} [0m+ with type [33mInt -> t0[0m+while inferring the type of [33mx 2[0m+in value declaration [33mfoo[0m++where [33mt0[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/DoNotSuggestComposition2.purs view
@@ -0,0 +1,7 @@+-- @shouldFailWith TypesDoNotUnify+-- TODO: Check that this does not produce a "function composition is (<<<)"+-- suggestion.++module DoNotSuggestComposition2 where++foo = let x = { y: 3 } in x 2
+ tests/purs/failing/DuplicateDeclarationsInLet.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/DuplicateDeclarationsInLet.purs:9:3 - 9:14 (line 9, column 3 - line 9, column 14)++ The name [33ma[0m was defined multiple times in a binding group+++See https://github.com/purescript/documentation/blob/master/errors/OverlappingNamesInLet.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/DuplicateDeclarationsInLet.purs view
@@ -0,0 +1,10 @@+-- @shouldFailWith OverlappingNamesInLet+module Main where++foo = a+ where+ a :: Number+ a = 1++ a :: Number+ a = 2
+ tests/purs/failing/DuplicateDeclarationsInLet2.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/DuplicateDeclarationsInLet2.purs:10:3 - 10:24 (line 10, column 3 - line 10, column 24)++ The name [33minterrupted[0m was defined multiple times in a binding group+++See https://github.com/purescript/documentation/blob/master/errors/OverlappingNamesInLet.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/DuplicateDeclarationsInLet2.purs view
@@ -0,0 +1,10 @@+-- @shouldFailWith OverlappingNamesInLet+module Main where++foo = interrupted+ where+ interrupted true = 1++ interrupter = 2++ interrupted false = 3
+ tests/purs/failing/DuplicateDeclarationsInLet3.out view
@@ -0,0 +1,22 @@+Error 1 of 2:++ in module [33mMain[0m+ at tests/purs/failing/DuplicateDeclarationsInLet3.purs:9:3 - 9:11 (line 9, column 3 - line 9, column 11)++ The name [33ma[0m was defined multiple times in a binding group+++ See https://github.com/purescript/documentation/blob/master/errors/OverlappingNamesInLet.md for more information,+ or to contribute content related to this error.++Error 2 of 2:++ in module [33mMain[0m+ at tests/purs/failing/DuplicateDeclarationsInLet3.purs:16:3 - 16:24 (line 16, column 3 - line 16, column 24)++ The name [33minterrupted[0m was defined multiple times in a binding group+++ See https://github.com/purescript/documentation/blob/master/errors/OverlappingNamesInLet.md for more information,+ or to contribute content related to this error.+
+ tests/purs/failing/DuplicateDeclarationsInLet3.purs view
@@ -0,0 +1,16 @@+-- @shouldFailWith OverlappingNamesInLet+-- @shouldFailWith OverlappingNamesInLet+module Main where++-- Should see separate errors for `a` and `interrupted`+foo = interrupter + a+ where+ a = 0+ a :: Int+ a = 0++ interrupted true = 1++ interrupter = 2++ interrupted false = 3
+ tests/purs/failing/DuplicateInstance.out view
@@ -0,0 +1,17 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/DuplicateInstance.purs:6:1 - 6:16 (line 6, column 1 - line 6, column 16)++ Instance [33mi[0m has been defined multiple times:++ tests/purs/failing/DuplicateInstance.purs:6:1 - 6:16 (line 6, column 1 - line 6, column 16)+++in type class instance+[33m [0m+[33m Main.Y [0m+[33m [0m++See https://github.com/purescript/documentation/blob/master/errors/DuplicateInstance.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/DuplicateInstance.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith DuplicateInstance+module Main where+class X+class Y+instance i :: X+instance i :: Y
+ tests/purs/failing/DuplicateModule.out view
@@ -0,0 +1,9 @@+Error found:+at tests/purs/failing/DuplicateModule.purs:2:1 - 2:16 (line 2, column 1 - line 2, column 16)++ Module [33mM1[0m has been defined multiple times+++See https://github.com/purescript/documentation/blob/master/errors/DuplicateModule.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/DuplicateModule.purs view
@@ -0,0 +1,2 @@+-- @shouldFailWith DuplicateModule+module M1 where
+ tests/purs/failing/DuplicateModule/M1.purs view
@@ -0,0 +1,1 @@+module M1 where
+ tests/purs/failing/DuplicateProperties.out view
@@ -0,0 +1,36 @@+Error found:+in module [33mDuplicateProperties[0m+at tests/purs/failing/DuplicateProperties.purs:12:18 - 12:32 (line 12, column 18 - line 12, column 32)++ Could not match type+ [33m [0m+ [33m ( y :: Unit[0m+ [33m ... [0m+ [33m ) [0m+ [33m [0m+ with type+ [33m [0m+ [33m ( x :: Unit[0m+ [33m ... [0m+ [33m | t0 [0m+ [33m ) [0m+ [33m [0m++while trying to match type [33mTest t1[0m+ with type [33mTest [0m+ [33m ( x :: Unit[0m+ [33m | t0 [0m+ [33m ) [0m+while checking that expression [33msubtractX hasX[0m+ has type [33mTest [0m+ [33m ( x :: Unit[0m+ [33m | t0 [0m+ [33m ) [0m+in value declaration [33mbaz[0m++where [33mt0[0m is an unknown type+ [33mt1[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/DuplicateProperties.purs view
@@ -0,0 +1,12 @@+-- @shouldFailWith TypesDoNotUnify+module DuplicateProperties where++import Prelude++foreign import data Test :: Row Type -> Type++foreign import subtractX :: forall r. Test (x :: Unit | r) -> Test r++foreign import hasX :: Test (x :: Unit, y :: Unit)++baz = subtractX (subtractX hasX)
+ tests/purs/failing/DuplicateRoleDeclaration.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/DuplicateRoleDeclaration.purs:6:1 - 6:20 (line 6, column 1 - line 6, column 20)++ Duplicate role declaration for [33mA[0m.+++See https://github.com/purescript/documentation/blob/master/errors/DuplicateRoleDeclaration.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/DuplicateRoleDeclaration.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith DuplicateRoleDeclaration+module Main where++data A a = A+type role A nominal+type role A phantom
+ tests/purs/failing/DuplicateTypeClass.out view
@@ -0,0 +1,14 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/DuplicateTypeClass.purs:4:1 - 4:8 (line 4, column 1 - line 4, column 8)++ Type class [33mC[0m has been defined multiple times:++ tests/purs/failing/DuplicateTypeClass.purs:4:1 - 4:8 (line 4, column 1 - line 4, column 8)+++in type class declaration for [33mC[0m++See https://github.com/purescript/documentation/blob/master/errors/DuplicateTypeClass.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/DuplicateTypeClass.purs view
@@ -0,0 +1,4 @@+-- @shouldFailWith DuplicateTypeClass+module Main where+class C+class C
+ tests/purs/failing/DuplicateTypeVars.out view
@@ -0,0 +1,11 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/DuplicateTypeVars.purs:6:1 - 6:17 (line 6, column 1 - line 6, column 17)++ Type argument [33ma[0m appears more than once.++in type synonym [33mFoo[0m++See https://github.com/purescript/documentation/blob/master/errors/DuplicateTypeArgument.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/DuplicateTypeVars.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith DuplicateTypeArgument+module Main where++import Prelude++type Foo a a = a
+ tests/purs/failing/EmptyCase.out view
@@ -0,0 +1,10 @@+Error found:+at tests/purs/failing/EmptyCase.purs:4:25 - 4:26 (line 4, column 25 - line 4, column 26)++ Unable to parse module:+ Unexpected token '\'+++See https://github.com/purescript/documentation/blob/master/errors/ErrorParsingModule.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/EmptyCase.purs view
@@ -0,0 +1,4 @@+-- @shouldFailWith ErrorParsingModule+module Main where++error err = case err of \_ -> 1
+ tests/purs/failing/EmptyClass.out view
@@ -0,0 +1,10 @@+Error found:+at tests/purs/failing/EmptyClass.purs:6:1 - 6:1 (line 6, column 1 - line 6, column 1)++ Unable to parse module:+ Unexpected or mismatched indentation+++See https://github.com/purescript/documentation/blob/master/errors/ErrorParsingModule.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/EmptyClass.purs view
@@ -0,0 +1,7 @@+-- @shouldFailWith ErrorParsingModule+module Main where++class Foo x where++bar :: String+bar = "hello"
+ tests/purs/failing/EmptyDo.out view
@@ -0,0 +1,10 @@+Error found:+at tests/purs/failing/EmptyDo.purs:7:1 - 7:1 (line 7, column 1 - line 7, column 1)++ Unable to parse module:+ Unexpected or mismatched indentation+++See https://github.com/purescript/documentation/blob/master/errors/ErrorParsingModule.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/EmptyDo.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith ErrorParsingModule++module Main where++main = do+
+ tests/purs/failing/ExpectedWildcard.out view
@@ -0,0 +1,9 @@+Error found:+at tests/purs/failing/ExpectedWildcard.purs:8:1 - 8:51 (line 8, column 1 - line 8, column 51)++ Expected a type wildcard (_) when deriving an instance for [33mTest[0m.+++See https://github.com/purescript/documentation/blob/master/errors/ExpectedWildcard.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ExpectedWildcard.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith ExpectedWildcard+module ExpectedWildcard where++import Data.Newtype++data Test = Test String++derive instance newtypeTest :: Newtype Test String
+ tests/purs/failing/ExportConflictClass.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mC[0m+at tests/purs/failing/ExportConflictClass.purs:2:21 - 2:29 (line 2, column 21 - line 2, column 29)++ Export for type class [33mB.X[0m conflicts with type class [33mA.X[0m+++See https://github.com/purescript/documentation/blob/master/errors/ExportConflict.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ExportConflictClass.purs view
@@ -0,0 +1,5 @@+-- @shouldFailWith ExportConflict+module C (module A, module B) where++import A as A+import B as B
+ tests/purs/failing/ExportConflictClass/A.purs view
@@ -0,0 +1,3 @@+module A where++class X
+ tests/purs/failing/ExportConflictClass/B.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mC[0m+at tests/purs/failing/ExportConflictClass.purs:2:21 - 2:29 (line 2, column 21 - line 2, column 29)++ Export for type class [33mB.X[0m conflicts with type class [33mA.X[0m+++See https://github.com/purescript/documentation/blob/master/errors/ExportConflict.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ExportConflictClass/B.purs view
@@ -0,0 +1,3 @@+module B where++class X
+ tests/purs/failing/ExportConflictClassAndType.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mC[0m+at tests/purs/failing/ExportConflictClassAndType.purs:2:21 - 2:29 (line 2, column 21 - line 2, column 29)++ Export for type [33mB.X[0m conflicts with type class [33mA.X[0m+++See https://github.com/purescript/documentation/blob/master/errors/ExportConflict.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ExportConflictClassAndType.purs view
@@ -0,0 +1,5 @@+-- @shouldFailWith ExportConflict+module C (module A, module B) where++import A as A+import B as B
+ tests/purs/failing/ExportConflictClassAndType/A.purs view
@@ -0,0 +1,3 @@+module A where++class X
+ tests/purs/failing/ExportConflictClassAndType/B.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mC[0m+at tests/purs/failing/ExportConflictClassAndType.purs:2:21 - 2:29 (line 2, column 21 - line 2, column 29)++ Export for type [33mB.X[0m conflicts with type class [33mA.X[0m+++See https://github.com/purescript/documentation/blob/master/errors/ExportConflict.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ExportConflictClassAndType/B.purs view
@@ -0,0 +1,3 @@+module B where++data X
+ tests/purs/failing/ExportConflictCtor.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mC[0m+at tests/purs/failing/ExportConflictCtor.purs:2:21 - 2:29 (line 2, column 21 - line 2, column 29)++ Export for data constructor [33mB.X[0m conflicts with data constructor [33mA.X[0m+++See https://github.com/purescript/documentation/blob/master/errors/ExportConflict.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ExportConflictCtor.purs view
@@ -0,0 +1,5 @@+-- @shouldFailWith ExportConflict+module C (module A, module B) where++import A as A+import B as B
+ tests/purs/failing/ExportConflictCtor/A.purs view
@@ -0,0 +1,3 @@+module A where++data T1 = X
+ tests/purs/failing/ExportConflictCtor/B.purs view
@@ -0,0 +1,3 @@+module B where++data T2 = X
+ tests/purs/failing/ExportConflictType.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mC[0m+at tests/purs/failing/ExportConflictType.purs:2:21 - 2:29 (line 2, column 21 - line 2, column 29)++ Export for type [33mB.T[0m conflicts with type [33mA.T[0m+++See https://github.com/purescript/documentation/blob/master/errors/ExportConflict.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ExportConflictType.purs view
@@ -0,0 +1,5 @@+-- @shouldFailWith ExportConflict+module C (module A, module B) where++import A as A+import B as B
+ tests/purs/failing/ExportConflictType/A.purs view
@@ -0,0 +1,3 @@+module A where++data T
+ tests/purs/failing/ExportConflictType/B.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mC[0m+at tests/purs/failing/ExportConflictType.purs:2:21 - 2:29 (line 2, column 21 - line 2, column 29)++ Export for type [33mB.T[0m conflicts with type [33mA.T[0m+++See https://github.com/purescript/documentation/blob/master/errors/ExportConflict.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ExportConflictType/B.purs view
@@ -0,0 +1,3 @@+module B where++data T
+ tests/purs/failing/ExportConflictTypeOp.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mC[0m+at tests/purs/failing/ExportConflictTypeOp.purs:2:21 - 2:29 (line 2, column 21 - line 2, column 29)++ Export for type operator [33mB.(??)[0m conflicts with type operator [33mA.(??)[0m+++See https://github.com/purescript/documentation/blob/master/errors/ExportConflict.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ExportConflictTypeOp.purs view
@@ -0,0 +1,5 @@+-- @shouldFailWith ExportConflict+module C (module A, module B) where++import A as A+import B as B
+ tests/purs/failing/ExportConflictTypeOp/A.purs view
@@ -0,0 +1,5 @@+module A where++type T1 a b = a -> b++infixr 4 type T1 as ??
+ tests/purs/failing/ExportConflictTypeOp/B.purs view
@@ -0,0 +1,5 @@+module B where++type T2 a b = a -> b++infixr 4 type T2 as ??
+ tests/purs/failing/ExportConflictValue.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mC[0m+at tests/purs/failing/ExportConflictValue.purs:2:21 - 2:29 (line 2, column 21 - line 2, column 29)++ Export for value [33mB.x[0m conflicts with value [33mA.x[0m+++See https://github.com/purescript/documentation/blob/master/errors/ExportConflict.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ExportConflictValue.purs view
@@ -0,0 +1,5 @@+-- @shouldFailWith ExportConflict+module C (module A, module B) where++import A as A+import B as B
+ tests/purs/failing/ExportConflictValue/A.purs view
@@ -0,0 +1,4 @@+module A where++x :: Boolean+x = true
+ tests/purs/failing/ExportConflictValue/B.purs view
@@ -0,0 +1,4 @@+module B where++x :: Boolean+x = false
+ tests/purs/failing/ExportConflictValueOp.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mC[0m+at tests/purs/failing/ExportConflictValueOp.purs:2:21 - 2:29 (line 2, column 21 - line 2, column 29)++ Export for operator [33mB.(!!)[0m conflicts with operator [33mA.(!!)[0m+++See https://github.com/purescript/documentation/blob/master/errors/ExportConflict.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ExportConflictValueOp.purs view
@@ -0,0 +1,5 @@+-- @shouldFailWith ExportConflict+module C (module A, module B) where++import A as A+import B as B
+ tests/purs/failing/ExportConflictValueOp/A.purs view
@@ -0,0 +1,6 @@+module A where++f1 :: forall a b. a -> b -> a+f1 x _ = x++infix 0 f1 as !!
+ tests/purs/failing/ExportConflictValueOp/B.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mC[0m+at tests/purs/failing/ExportConflictValueOp.purs:2:21 - 2:29 (line 2, column 21 - line 2, column 29)++ Export for operator [33mB.(!!)[0m conflicts with operator [33mA.(!!)[0m+++See https://github.com/purescript/documentation/blob/master/errors/ExportConflict.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ExportConflictValueOp/B.purs view
@@ -0,0 +1,6 @@+module B where++f2 :: forall a b. a -> b -> a+f2 x _ = x++infix 0 f2 as !!
+ tests/purs/failing/ExportExplicit.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mM1[0m+at tests/purs/failing/ExportExplicit.purs:3:18 - 3:19 (line 3, column 18 - line 3, column 19)++ Cannot export unknown value [33mz[0m+++See https://github.com/purescript/documentation/blob/master/errors/UnknownExport.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ExportExplicit.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith UnknownExport+-- should fail as z does not exist in the module+module M1 (x, y, z) where++import Prelude++x = 1+y = 2
+ tests/purs/failing/ExportExplicit1.out view
@@ -0,0 +1,22 @@+Error 1 of 2:++ in module [33mMain[0m+ at tests/purs/failing/ExportExplicit1.purs:9:9 - 9:10 (line 9, column 9 - line 9, column 10)++ Unknown data constructor [33mX[0m+++ See https://github.com/purescript/documentation/blob/master/errors/UnknownName.md for more information,+ or to contribute content related to this error.++Error 2 of 2:++ in module [33mMain[0m+ at tests/purs/failing/ExportExplicit1.purs:10:9 - 10:10 (line 10, column 9 - line 10, column 10)++ Unknown data constructor [33mY[0m+++ See https://github.com/purescript/documentation/blob/master/errors/UnknownName.md for more information,+ or to contribute content related to this error.+
+ tests/purs/failing/ExportExplicit1.purs view
@@ -0,0 +1,12 @@+-- @shouldFailWith UnknownName+-- @shouldFailWith UnknownName+-- should fail as X and Y constructors are not exported from M1+module Main where++import M1+import Effect.Console (log)++testX = X+testY = Y++main = log "Done"
+ tests/purs/failing/ExportExplicit1/M1.purs view
@@ -0,0 +1,3 @@+module M1 (X) where++data X = X | Y
+ tests/purs/failing/ExportExplicit2.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mM1[0m+at tests/purs/failing/ExportExplicit2.purs:3:12 - 3:16 (line 3, column 12 - line 3, column 16)++ Cannot export data constructor [33mY[0m for type [33mX[0m, as it has not been declared.+++See https://github.com/purescript/documentation/blob/master/errors/UnknownExportDataConstructor.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ExportExplicit2.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith UnknownExportDataConstructor+-- should fail as Y is not a data constructor for X+module M1 (X(Y)) where++import Prelude++data X = X+data Y = Y
+ tests/purs/failing/ExportExplicit3.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/ExportExplicit3.purs:8:9 - 8:12 (line 8, column 9 - line 8, column 12)++ Unknown data constructor [33mM.Z[0m+++See https://github.com/purescript/documentation/blob/master/errors/UnknownName.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ExportExplicit3.purs view
@@ -0,0 +1,10 @@+-- @shouldFailWith UnknownName+module Main where++import M1 as M+import Effect.Console (log)++-- should fail as Z is not exported from M1+testZ = M.Z++main = log "Done"
+ tests/purs/failing/ExportExplicit3/M1.purs view
@@ -0,0 +1,4 @@+module M1 (X(..)) where++data X = X | Y+data Z = Z
+ tests/purs/failing/ExtraRecordField.out view
@@ -0,0 +1,27 @@+Error found:+in module [33mExtraRecordField[0m+at tests/purs/failing/ExtraRecordField.purs:9:13 - 9:54 (line 9, column 13 - line 9, column 54)++ Type of expression contains additional label [33mage[0m.++while checking that expression [33m{ first: "Jane"[0m+ [33m, last: "Smith"[0m+ [33m, age: 29 [0m+ [33m} [0m+ has type [33m{ first :: String[0m+ [33m, last :: String [0m+ [33m} [0m+while applying a function [33mfull[0m+ of type [33m{ first :: String[0m+ [33m, last :: String [0m+ [33m} [0m+ [33m-> String [0m+ to argument [33m{ first: "Jane"[0m+ [33m, last: "Smith"[0m+ [33m, age: 29 [0m+ [33m} [0m+in value declaration [33moops[0m++See https://github.com/purescript/documentation/blob/master/errors/AdditionalProperty.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ExtraRecordField.purs view
@@ -0,0 +1,9 @@+-- @shouldFailWith AdditionalProperty+module ExtraRecordField where++import Prelude ((<>))++full :: { first :: String, last :: String } -> String+full p = p.first <> " " <> p.last++oops = full { first: "Jane", last: "Smith", age: 29 }
+ tests/purs/failing/ExtraneousClassMember.out view
@@ -0,0 +1,13 @@+Error found:+at tests/purs/failing/ExtraneousClassMember.purs:11:3 - 11:10 (line 11, column 3 - line 11, column 10)++ [33mb[0m is not a member of type class [33mMain.A[0m++in type class instance+[33m [0m+[33m Main.A String[0m+[33m [0m++See https://github.com/purescript/documentation/blob/master/errors/ExtraneousClassMember.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ExtraneousClassMember.purs view
@@ -0,0 +1,11 @@+-- @shouldFailWith ExtraneousClassMember+module Main where++import Prelude++class A a where+ a :: a -> String++instance aString :: A String where+ a s = s+ b x = x
+ tests/purs/failing/FFIDefaultCJSExport.js view
@@ -0,0 +1,1 @@+exports.default = "Done";
+ tests/purs/failing/FFIDefaultCJSExport.out view
@@ -0,0 +1,13 @@+Error found:+at tests/purs/failing/FFIDefaultCJSExport.purs:2:1 - 8:19 (line 2, column 1 - line 8, column 19)++ A CommonJS foreign module implementation was provided for module [33mMain[0m:++ tests/purs/failing/FFIDefaultCJSExport.js++ CommonJS foreign modules are no longer supported. Use native JavaScript/ECMAScript module syntax instead.+++See https://github.com/purescript/documentation/blob/master/errors/DeprecatedFFICommonJSModule.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/FFIDefaultCJSExport.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith DeprecatedFFICommonJSModule+module Main where++import Effect.Console (log)++foreign import default :: String++main = log default
+ tests/purs/failing/Foldable.out view
@@ -0,0 +1,9 @@+Error found:+at tests/purs/failing/Foldable.purs:12:1 - 15:36 (line 12, column 1 - line 15, column 36)++ The value of [33mfoldableL[0m is undefined here, so this reference is not allowed.+++See https://github.com/purescript/documentation/blob/master/errors/CycleInDeclaration.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/Foldable.purs view
@@ -0,0 +1,17 @@+-- @shouldFailWith CycleInDeclaration+module Main where++import Prelude++class Foldable f where+ fold :: forall a b. (a -> b -> b) -> b -> f a -> b+ size :: forall a. f a -> Number++data L a = C a (L a) | N++instance foldableL :: Foldable L where+ fold _ z N = z+ fold f z (C x xs) = x `f` (fold f z xs)+ size = fold (const ((+) 1.0)) 0.0++x = size (C 1 (C 2 (C 3 N)))
+ tests/purs/failing/FoldableInstance1.out view
@@ -0,0 +1,24 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/FoldableInstance1.purs:9:26 - 9:29 (line 9, column 26 - line 9, column 29)++ Could not match kind+ [33m [0m+ [33m Type[0m+ [33m [0m+ with kind+ [33m [0m+ [33m Type -> Type[0m+ [33m [0m++while checking that type [33mFoo[0m+ has kind [33mType -> Type[0m+while inferring the kind of [33mFoldable Foo[0m+in type class instance+[33m [0m+[33m Data.Foldable.Foldable Foo[0m+[33m [0m++See https://github.com/purescript/documentation/blob/master/errors/KindsDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/FoldableInstance1.purs view
@@ -0,0 +1,9 @@+-- @shouldFailWith KindsDoNotUnify+module Main where++import Prelude+import Data.Foldable (class Foldable)++data Foo = Bar++derive instance Foldable Foo
+ tests/purs/failing/FoldableInstance10.out view
@@ -0,0 +1,16 @@+Error found:+in module [33mFoldableInstance10[0m+at tests/purs/failing/FoldableInstance10.purs:11:1 - 11:30 (line 11, column 1 - line 11, column 30)++ One or more type variables are in positions that prevent [33mFoldable[0m from being derived.+ To derive this class, make sure that these variables are only used as the final arguments to type constructors, and that those type constructors themselves have instances of [33mData.Foldable.Foldable[0m or [33mData.Bifoldable.Bifoldable[0m.++ tests/purs/failing/FoldableInstance10.purs:+ [90m 9[0m [33m[0m+ [90m 10[0m [33mdata Test a = Test (Variant (left :: [7ma[27m, right :: Array [7ma[27m))[0m+ [90m 11[0m [33mderive instance Foldable Test[0m+++See https://github.com/purescript/documentation/blob/master/errors/CannotDeriveInvalidConstructorArg.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/FoldableInstance10.purs view
@@ -0,0 +1,11 @@+-- @shouldFailWith CannotDeriveInvalidConstructorArg+module FoldableInstance10 where++import Prelude+import Data.Tuple (Tuple)+import Data.Foldable (class Foldable)++foreign import data Variant :: Row Type -> Type++data Test a = Test (Variant (left :: a, right :: Array a))+derive instance Foldable Test
+ tests/purs/failing/FoldableInstance2.out view
@@ -0,0 +1,24 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/FoldableInstance2.purs:10:26 - 10:29 (line 10, column 26 - line 10, column 29)++ Could not match kind+ [33m [0m+ [33m Type[0m+ [33m [0m+ with kind+ [33m [0m+ [33m Type -> Type[0m+ [33m [0m++while checking that type [33mFoo[0m+ has kind [33mType -> Type[0m+while inferring the kind of [33mFoldable Foo[0m+in type class instance+[33m [0m+[33m Data.Foldable.Foldable Foo[0m+[33m [0m++See https://github.com/purescript/documentation/blob/master/errors/KindsDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/FoldableInstance2.purs view
@@ -0,0 +1,10 @@+-- @shouldFailWith KindsDoNotUnify+module Main where++import Prelude+import Data.Foldable (class Foldable)++data Foo :: (Type -> Type) -> Type+data Foo a = Bar++derive instance Foldable Foo
+ tests/purs/failing/FoldableInstance3.out view
@@ -0,0 +1,24 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/FoldableInstance3.purs:9:26 - 9:29 (line 9, column 26 - line 9, column 29)++ Could not match kind+ [33m [0m+ [33m Type[0m+ [33m [0m+ with kind+ [33m [0m+ [33m Type -> Type[0m+ [33m [0m++while checking that type [33mFoo[0m+ has kind [33mType -> Type[0m+while inferring the kind of [33mFoldable Foo[0m+in type class instance+[33m [0m+[33m Data.Foldable.Foldable Foo[0m+[33m [0m++See https://github.com/purescript/documentation/blob/master/errors/KindsDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/FoldableInstance3.purs view
@@ -0,0 +1,9 @@+-- @shouldFailWith KindsDoNotUnify+module Main where++import Prelude+import Data.Foldable (class Foldable)++data Foo f = Bar (f Int)++derive instance Foldable Foo
+ tests/purs/failing/FoldableInstance4.out view
@@ -0,0 +1,16 @@+Error found:+in module [33mFoldableInstance4[0m+at tests/purs/failing/FoldableInstance4.purs:8:1 - 8:27 (line 8, column 1 - line 8, column 27)++ One or more type variables are in positions that prevent [33mFoldable[0m from being derived.+ To derive this class, make sure that these variables are only used as the final arguments to type constructors, and that those type constructors themselves have instances of [33mData.Foldable.Foldable[0m or [33mData.Bifoldable.Bifoldable[0m.++ tests/purs/failing/FoldableInstance4.purs:+ [90m 6[0m [33m[0m+ [90m 7[0m [33mdata T a = T (forall t. Show t => t -> [7ma[27m)[0m+ [90m 8[0m [33mderive instance Foldable T[0m+++See https://github.com/purescript/documentation/blob/master/errors/CannotDeriveInvalidConstructorArg.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/FoldableInstance4.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith CannotDeriveInvalidConstructorArg+module FoldableInstance4 where++import Prelude+import Data.Foldable (class Foldable)++data T a = T (forall t. Show t => t -> a)+derive instance Foldable T
+ tests/purs/failing/FoldableInstance6.out view
@@ -0,0 +1,16 @@+Error found:+in module [33mFoldableInstance6[0m+at tests/purs/failing/FoldableInstance6.purs:8:1 - 8:30 (line 8, column 1 - line 8, column 30)++ One or more type variables are in positions that prevent [33mFoldable[0m from being derived.+ To derive this class, make sure that these variables are only used as the final arguments to type constructors, and that those type constructors themselves have instances of [33mData.Foldable.Foldable[0m or [33mData.Bifoldable.Bifoldable[0m.++ tests/purs/failing/FoldableInstance6.purs:+ [90m 6[0m [33m[0m+ [90m 7[0m [33mdata Test a = Test ([7ma[27m -> Int)[0m+ [90m 8[0m [33mderive instance Foldable Test[0m+++See https://github.com/purescript/documentation/blob/master/errors/CannotDeriveInvalidConstructorArg.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/FoldableInstance6.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith CannotDeriveInvalidConstructorArg+module FoldableInstance6 where++import Prelude+import Data.Foldable (class Foldable)++data Test a = Test (a -> Int)+derive instance Foldable Test
+ tests/purs/failing/FoldableInstance8.out view
@@ -0,0 +1,16 @@+Error found:+in module [33mFoldableInstance6[0m+at tests/purs/failing/FoldableInstance8.purs:8:1 - 8:34 (line 8, column 1 - line 8, column 34)++ One or more type variables are in positions that prevent [33mFoldable[0m from being derived.+ To derive this class, make sure that these variables are only used as the final arguments to type constructors, and that those type constructors themselves have instances of [33mData.Foldable.Foldable[0m or [33mData.Bifoldable.Bifoldable[0m.++ tests/purs/failing/FoldableInstance8.purs:+ [90m 6[0m [33m[0m+ [90m 7[0m [33mdata Test f a = Test (f [7ma[27m [7ma[27m)[0m+ [90m 8[0m [33mderive instance Foldable (Test f)[0m+++See https://github.com/purescript/documentation/blob/master/errors/CannotDeriveInvalidConstructorArg.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/FoldableInstance8.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith CannotDeriveInvalidConstructorArg+module FoldableInstance6 where++import Prelude+import Data.Foldable (class Foldable)++data Test f a = Test (f a a)+derive instance Foldable (Test f)
+ tests/purs/failing/FoldableInstance9.out view
@@ -0,0 +1,51 @@+Error found:+in module [33mFoldableInstance9[0m+at tests/purs/failing/FoldableInstance9.purs:53:1 - 53:38 (line 53, column 1 - line 53, column 38)++ One or more type variables are in positions that prevent [33mFoldable[0m from being derived.+ To derive this class, make sure that these variables are only used as the final arguments to type constructors, and that those type constructors themselves have instances of [33mData.Foldable.Foldable[0m or [33mData.Bifoldable.Bifoldable[0m.++ tests/purs/failing/FoldableInstance9.purs:+ [90m 15[0m [33mdata Test f g h a[0m+ [90m 16[0m [33m = Test1 (f [7ma[27m [7ma[27m [7ma[27m) (f Int [7ma[27m [7ma[27m) (f [7ma[27m [7ma[27m Int) (f Int [7ma[27m Int) (f Int Int Int)[0m+ [90m 17[0m [33m | Test2 { all :: f [7ma[27m [7ma[27m [7ma[27m[0m+ [90m 18[0m [33m , rights :: f Int [7ma[27m [7ma[27m[0m+ [90m 19[0m [33m , lefts :: f [7ma[27m [7ma[27m Int[0m+ [90m 20[0m [33m , middle :: f Int [7ma[27m Int[0m+ [90m 21[0m [33m , none :: f Int Int Int[0m+ [90m 22[0m [33m }[0m+ [90m 23[0m [33m | Test3 (g[0m+ [90m 24[0m [33m { all :: f [7ma[27m [7ma[27m [7ma[27m[0m+ [90m 25[0m [33m , rights :: f Int [7ma[27m [7ma[27m[0m+ [90m 26[0m [33m , lefts :: f [7ma[27m [7ma[27m Int[0m+ [90m 27[0m [33m , middle :: f Int [7ma[27m Int[0m+ [90m 28[0m [33m , none :: f Int Int Int[0m+ [90m 29[0m [33m }[0m+ [90m 30[0m [33m [7ma[27m)[0m+ [90m 31[0m [33m | Test4 (h[0m+ [90m 32[0m [33m { nested1 ::[0m+ [90m 33[0m [33m { all :: f [7ma[27m [7ma[27m [7ma[27m[0m+ [90m 34[0m [33m , rights :: f Int [7ma[27m [7ma[27m[0m+ [90m 35[0m [33m , lefts :: f [7ma[27m [7ma[27m Int[0m+ [90m 36[0m [33m , middle :: f Int [7ma[27m Int[0m+ [90m 37[0m [33m , none :: f Int Int Int[0m+ [90m ...[0m+ [90m 40[0m [33m g[0m+ [90m 41[0m [33m { all :: f [7ma[27m [7ma[27m [7ma[27m[0m+ [90m 42[0m [33m , rights :: f Int [7ma[27m [7ma[27m[0m+ [90m 43[0m [33m , lefts :: f [7ma[27m [7ma[27m Int[0m+ [90m 44[0m [33m , middle :: f Int [7ma[27m Int[0m+ [90m 45[0m [33m , none :: f Int Int Int[0m+ [90m 46[0m [33m }[0m+ [90m 47[0m [33m [7ma[27m[0m+ [90m 48[0m [33m }[0m+ [90m 49[0m [33m [7ma[27m)[0m+ [90m 50[0m [33m | Test5 (Rec f [7ma[27m)[0m+ [90m 51[0m [33m | Test6 (g (Rec f [7ma[27m) [7ma[27m)[0m+ [90m 52[0m [33m | Test7 (h { nested1 :: Rec f [7ma[27m, nested2 :: g (Rec f [7ma[27m) [7ma[27m } [7ma[27m)[0m+ [90m 53[0m [33mderive instance Foldable (Test f g h)[0m+++See https://github.com/purescript/documentation/blob/master/errors/CannotDeriveInvalidConstructorArg.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/FoldableInstance9.purs view
@@ -0,0 +1,53 @@+-- @shouldFailWith CannotDeriveInvalidConstructorArg+module FoldableInstance9 where++import Prelude+import Data.Tuple (Tuple)+import Data.Foldable (class Foldable)++type Rec f a =+ { all :: f a a a+ , rights :: f Int a a+ , lefts :: f a a Int+ , middle :: f Int a Int+ , none :: f Int Int Int+ }+data Test f g h a+ = Test1 (f a a a) (f Int a a) (f a a Int) (f Int a Int) (f Int Int Int)+ | Test2 { all :: f a a a+ , rights :: f Int a a+ , lefts :: f a a Int+ , middle :: f Int a Int+ , none :: f Int Int Int+ }+ | Test3 (g+ { all :: f a a a+ , rights :: f Int a a+ , lefts :: f a a Int+ , middle :: f Int a Int+ , none :: f Int Int Int+ }+ a)+ | Test4 (h+ { nested1 ::+ { all :: f a a a+ , rights :: f Int a a+ , lefts :: f a a Int+ , middle :: f Int a Int+ , none :: f Int Int Int+ }+ , nested2 ::+ g+ { all :: f a a a+ , rights :: f Int a a+ , lefts :: f a a Int+ , middle :: f Int a Int+ , none :: f Int Int Int+ }+ a+ }+ a)+ | Test5 (Rec f a)+ | Test6 (g (Rec f a) a)+ | Test7 (h { nested1 :: Rec f a, nested2 :: g (Rec f a) a } a)+derive instance Foldable (Test f g h)
+ tests/purs/failing/FunctorInstance1.out view
@@ -0,0 +1,16 @@+Error found:+in module [33mFunctorInstance1[0m+at tests/purs/failing/FunctorInstance1.purs:8:1 - 8:29 (line 8, column 1 - line 8, column 29)++ One or more type variables are in positions that prevent [33mFunctor[0m from being derived.+ To derive this class, make sure that these variables are only used as the final arguments to type constructors, that their variance matches the variance of [33mFunctor[0m, and that those type constructors themselves have instances of [33mData.Functor.Functor[0m, [33mData.Bifunctor.Bifunctor[0m, [33mData.Functor.Contravariant.Contravariant[0m, or [33mData.Profunctor.Profunctor[0m.++ tests/purs/failing/FunctorInstance1.purs:+ [90m 6[0m [33m[0m+ [90m 7[0m [33mdata Test a = Test (Predicate [7ma[27m)[0m+ [90m 8[0m [33mderive instance Functor Test[0m+++See https://github.com/purescript/documentation/blob/master/errors/CannotDeriveInvalidConstructorArg.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/FunctorInstance1.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith CannotDeriveInvalidConstructorArg+module FunctorInstance1 where++import Prelude+import Data.Predicate (Predicate)++data Test a = Test (Predicate a)+derive instance Functor Test
+ tests/purs/failing/Generalization1.out view
@@ -0,0 +1,16 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/Generalization1.purs:6:1 - 6:14 (line 6, column 1 - line 6, column 14)++ Unable to generalize the type of the recursive function [33mfoo[0m.+ The inferred type of [33mfoo[0m was:+ [33m [0m+ [33m forall t4. Semigroup t4 => Int -> t4 -> t4 -> t4[0m+ [33m [0m+ Try adding a type signature.++in binding group foo, bar++See https://github.com/purescript/documentation/blob/master/errors/CannotGeneralizeRecursiveFunction.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/Generalization1.purs view
@@ -0,0 +1,11 @@+-- @shouldFailWith CannotGeneralizeRecursiveFunction+module Main where++import Prelude++foo 0 x _ = x+foo n x y = x <> bar (n - 1) x y++bar 0 x _ = x+bar n x y = y <> foo (n - 1) x y+
+ tests/purs/failing/Generalization2.out view
@@ -0,0 +1,16 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/Generalization2.purs:6:1 - 7:45 (line 6, column 1 - line 7, column 45)++ Unable to generalize the type of the recursive function [33mtest[0m.+ The inferred type of [33mtest[0m was:+ [33m [0m+ [33m forall a7. Semigroup a7 => Int -> a7 -> a7[0m+ [33m [0m+ Try adding a type signature.++in binding group test++See https://github.com/purescript/documentation/blob/master/errors/CannotGeneralizeRecursiveFunction.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/Generalization2.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith CannotGeneralizeRecursiveFunction+module Main where++import Prelude++test n m | n <= 1 = m+ | otherwise = test (n - 1) (m <> m)+
+ tests/purs/failing/ImportExplicit.out view
@@ -0,0 +1,11 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/ImportExplicit.purs:4:12 - 4:17 (line 4, column 12 - line 4, column 17)++ Cannot import type [33mX[0m from module [33mM1[0m+ It either does not exist or the module does not export it.+++See https://github.com/purescript/documentation/blob/master/errors/UnknownImport.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ImportExplicit.purs view
@@ -0,0 +1,4 @@+-- @shouldFailWith UnknownImport+module Main where++import M1 (X(..))
+ tests/purs/failing/ImportExplicit/M1.out view
@@ -0,0 +1,11 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/ImportExplicit.purs:4:12 - 4:17 (line 4, column 12 - line 4, column 17)++ Cannot import type [33mX[0m from module [33mM1[0m+ It either does not exist or the module does not export it.+++See https://github.com/purescript/documentation/blob/master/errors/UnknownImport.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ImportExplicit/M1.purs view
@@ -0,0 +1,3 @@+module M1 where++foo = "foo"
+ tests/purs/failing/ImportExplicit2.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/ImportExplicit2.purs:4:12 - 4:19 (line 4, column 12 - line 4, column 19)++ Module M1 does not export data constructor [33mZ[0m for type [33mX[0m+++See https://github.com/purescript/documentation/blob/master/errors/UnknownImportDataConstructor.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ImportExplicit2.purs view
@@ -0,0 +1,4 @@+-- @shouldFailWith UnknownImportDataConstructor+module Main where++import M1 (X(Z, Q))
+ tests/purs/failing/ImportExplicit2/M1.purs view
@@ -0,0 +1,3 @@+module M1 where++data X = Y
+ tests/purs/failing/ImportHidingModule.out view
@@ -0,0 +1,10 @@+Error found:+at tests/purs/failing/ImportHidingModule.purs:4:18 - 4:24 (line 4, column 18 - line 4, column 24)++ Unable to parse module:+ Unexpected token 'module'+++See https://github.com/purescript/documentation/blob/master/errors/ErrorParsingModule.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ImportHidingModule.purs view
@@ -0,0 +1,4 @@+-- @shouldFailWith ErrorParsingModule+module Main where++import B hiding (module A)
+ tests/purs/failing/ImportHidingModule/A.purs view
@@ -0,0 +1,2 @@+module A where+x = 1
+ tests/purs/failing/ImportHidingModule/B.purs view
@@ -0,0 +1,3 @@+module B (module B, module A) where+import A+y = 1
+ tests/purs/failing/ImportModule.out view
@@ -0,0 +1,11 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/ImportModule.purs:4:1 - 4:10 (line 4, column 1 - line 4, column 10)++ Module [33mM1[0m was not found.+ Make sure the source file exists, and that it has been provided as an input to the compiler.+++See https://github.com/purescript/documentation/blob/master/errors/ModuleNotFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ImportModule.purs view
@@ -0,0 +1,4 @@+-- @shouldFailWith ModuleNotFound+module Main where++import M1
+ tests/purs/failing/ImportModule/M2.purs view
@@ -0,0 +1,3 @@+module M2 where++data X = X
+ tests/purs/failing/InfiniteKind.out view
@@ -0,0 +1,19 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/InfiniteKind.purs:5:17 - 5:18 (line 5, column 17 - line 5, column 18)++ An infinite kind was inferred for a type:+ [33m [0m+ [33m t5 -> t6[0m+ [33m [0m++while checking that type [33ma[0m+ has kind [33mt0[0m+while inferring the kind of [33ma a[0m+in type constructor [33mF[0m++where [33mt0[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/InfiniteKind.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/InfiniteKind.purs view
@@ -0,0 +1,5 @@+-- @shouldFailWith InfiniteKind ++module Main where++data F a = F (a a)
+ tests/purs/failing/InfiniteKind2.out view
@@ -0,0 +1,19 @@+Error found:+in module [33mInfiniteKind2[0m+at tests/purs/failing/InfiniteKind2.purs:5:23 - 5:27 (line 5, column 23 - line 5, column 27)++ An infinite kind was inferred for a type:+ [33m [0m+ [33m (t5 -> t6) -> Type[0m+ [33m [0m++while checking that type [33mTree[0m+ has kind [33mt0[0m+while inferring the kind of [33mm Tree[0m+in data binding group Tree++where [33mt0[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/InfiniteKind.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/InfiniteKind2.purs view
@@ -0,0 +1,5 @@+-- @shouldFailWith InfiniteKind++module InfiniteKind2 where++data Tree m = Tree (m Tree)
+ tests/purs/failing/InfiniteType.out view
@@ -0,0 +1,21 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/InfiniteType.purs:5:7 - 5:10 (line 5, column 7 - line 5, column 10)++ An infinite type was inferred for an expression:+ [33m [0m+ [33m t0 -> t1[0m+ [33m [0m++while trying to match type [33mt0[0m+ with type [33mt0 -> t1[0m+while inferring the type of [33m\a -> [0m+ [33m a a [0m+in value declaration [33mf[0m++where [33mt0[0m is an unknown type+ [33mt1[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/InfiniteType.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/InfiniteType.purs view
@@ -0,0 +1,5 @@+-- @shouldFailWith InfiniteType ++module Main where++f a = a a
+ tests/purs/failing/InstanceChainBothUnknownAndMatch.out view
@@ -0,0 +1,39 @@+Error found:+in module [33mInstanceChains.BothUnknownAndMatch[0m+at tests/purs/failing/InstanceChainBothUnknownAndMatch.purs:15:13 - 15:53 (line 15, column 13 - line 15, column 53)++ No type class instance was found for+ [33m [0m+ [33m InstanceChains.BothUnknownAndMatch.Same (Proxy [0m+ [33m ( m :: Int[0m+ [33m , u :: t3 [0m+ [33m ) [0m+ [33m ) [0m+ [33m (Proxy [0m+ [33m ( m :: Int[0m+ [33m , u :: Int[0m+ [33m ) [0m+ [33m ) [0m+ [33m t4 [0m+ [33m [0m+ The following instance partially overlaps the above constraint, which means the rest of its instance chain will not be considered:++ [33mInstanceChains.BothUnknownAndMatch.sameY[0m+++while applying a function [33msame[0m+ of type [33mSame @Type @Type t0 t1 t2 => t0 -> t1 -> Proxy @Symbol t2[0m+ to argument [33mProxy[0m+while inferring the type of [33msame Proxy[0m+in value declaration [33mexample[0m++where [33mt3[0m is a rigid type variable+ bound at (line 0, column 0 - line 0, column 0)+ [33mt4[0m is an unknown type+ [33mt0[0m is an unknown type+ [33mt1[0m is an unknown type+ [33mt2[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/InstanceChainBothUnknownAndMatch.purs view
@@ -0,0 +1,16 @@+-- @shouldFailWith NoInstanceFound+module InstanceChains.BothUnknownAndMatch where++import Type.Proxy (Proxy(..))++class Same l r (o :: Symbol) | l r -> o+instance sameY :: Same t t "Y" else instance sameN :: Same l r "N"+same :: forall l r o. Same l r o => l -> r -> Proxy o+same _ _ = Proxy++-- for label `u`, `t ~ Int` should be Unknown+-- for label `m`, `Int ~ Int` should be a match+-- together they should be Unknown+example :: forall t. Proxy t -> Proxy _+example _ = same (Proxy :: Proxy (u :: t, m :: Int))+ (Proxy :: Proxy (u :: Int, m :: Int))
+ tests/purs/failing/InstanceChainSkolemUnknownMatch.out view
@@ -0,0 +1,31 @@+Error found:+in module [33mInstanceChainSkolemUnknownMatch[0m+at tests/purs/failing/InstanceChainSkolemUnknownMatch.purs:13:13 - 13:36 (line 13, column 13 - line 13, column 36)++ No type class instance was found for+ [33m [0m+ [33m InstanceChainSkolemUnknownMatch.Same (Proxy t3) [0m+ [33m (Proxy Int)[0m+ [33m t4 [0m+ [33m [0m+ The following instance partially overlaps the above constraint, which means the rest of its instance chain will not be considered:++ [33mInstanceChainSkolemUnknownMatch.sameY[0m+++while applying a function [33msame[0m+ of type [33mSame @Type @Type t0 t1 t2 => t0 -> t1 -> Proxy @Symbol t2[0m+ to argument [33mProxy[0m+while inferring the type of [33msame Proxy[0m+in value declaration [33mexample[0m++where [33mt3[0m is a rigid type variable+ bound at (line 0, column 0 - line 0, column 0)+ [33mt4[0m is an unknown type+ [33mt0[0m is an unknown type+ [33mt1[0m is an unknown type+ [33mt2[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/InstanceChainSkolemUnknownMatch.purs view
@@ -0,0 +1,14 @@+-- @shouldFailWith NoInstanceFound+module InstanceChainSkolemUnknownMatch where++import Type.Proxy (Proxy(..))++class Same l r (o :: Symbol) | l r -> o+instance sameY :: Same t t "Y" else instance sameN :: Same l r "N"+same :: forall l r o. Same l r o => l -> r -> Proxy o+same _ _ = Proxy++-- shouldn't discard sameY as Apart+example :: forall (t :: Type). Proxy t -> Proxy _+example _ = same (Proxy :: Proxy t) (Proxy :: Proxy Int)+
+ tests/purs/failing/InstanceExport.out view
@@ -0,0 +1,13 @@+Error found:+in module [33mInstanceExport[0m+at tests/purs/failing/InstanceExport/InstanceExport.purs:1:1 - 11:14 (line 1, column 1 - line 11, column 14)++ An export for [33mf[0m requires the following to also be exported:++ [33mclass F[0m++++See https://github.com/purescript/documentation/blob/master/errors/TransitiveExportError.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/InstanceExport.purs view
@@ -0,0 +1,7 @@+-- @shouldFailWith TransitiveExportError+module Test where++import InstanceExport+import Prelude++test = f $ S "Test"
+ tests/purs/failing/InstanceExport/InstanceExport.purs view
@@ -0,0 +1,11 @@+module InstanceExport (S(..), f) where++import Prelude++newtype S = S String++class F a where+ f :: a -> String++instance fs :: F S where+ f (S s) = s
+ tests/purs/failing/InstanceNamedWithoutSeparator.out view
@@ -0,0 +1,10 @@+Error found:+at tests/purs/failing/InstanceNamedWithoutSeparator.purs:9:23 - 9:26 (line 9, column 23 - line 9, column 26)++ Unable to parse module:+ Unexpected token 'Foo'+++See https://github.com/purescript/documentation/blob/master/errors/ErrorParsingModule.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/InstanceNamedWithoutSeparator.purs view
@@ -0,0 +1,12 @@+-- @shouldFailWith ErrorParsingModule+module Main where++import Effect.Console (log)++class Foo a+-- the "::" separator between the name and class name+-- needs to be added.+instance instanceName Foo x+-- else instance Foo x++main = log "Done"
+ tests/purs/failing/InstanceSigsBodyIncorrect.out view
@@ -0,0 +1,22 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/InstanceSigsBodyIncorrect.purs:10:9 - 10:13 (line 10, column 9 - line 10, column 13)++ Could not match type+ [33m [0m+ [33m Boolean[0m+ [33m [0m+ with type+ [33m [0m+ [33m Number[0m+ [33m [0m++while checking that type [33mBoolean[0m+ is at least as general as type [33mNumber[0m+while checking that expression [33mtrue[0m+ has type [33mNumber[0m+in value declaration [33mfooNumber[0m++See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/InstanceSigsBodyIncorrect.purs view
@@ -0,0 +1,10 @@+-- @shouldFailWith TypesDoNotUnify++module Main where++class Foo a where+ foo :: a++instance fooNumber :: Foo Number where+ foo :: Number+ foo = true
+ tests/purs/failing/InstanceSigsDifferentTypes.out view
@@ -0,0 +1,22 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/InstanceSigsDifferentTypes.purs:10:9 - 10:12 (line 10, column 9 - line 10, column 12)++ Could not match type+ [33m [0m+ [33m Number[0m+ [33m [0m+ with type+ [33m [0m+ [33m Int[0m+ [33m [0m++while checking that type [33mNumber[0m+ is at least as general as type [33mInt[0m+while checking that expression [33m0.0[0m+ has type [33mInt[0m+in value declaration [33mfooNumber[0m++See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/InstanceSigsDifferentTypes.purs view
@@ -0,0 +1,10 @@+-- @shouldFailWith TypesDoNotUnify++module Main where++class Foo a where+ foo :: a++instance fooNumber :: Foo Number where+ foo :: Int+ foo = 0.0
+ tests/purs/failing/InstanceSigsIncorrectType.out view
@@ -0,0 +1,25 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/InstanceSigsIncorrectType.purs:8:1 - 10:13 (line 8, column 1 - line 10, column 13)++ Could not match type+ [33m [0m+ [33m Boolean[0m+ [33m [0m+ with type+ [33m [0m+ [33m Number[0m+ [33m [0m++while trying to match type [33mFoo$Dict t0[0m+ with type [33mFoo$Dict Number[0m+while checking that expression [33mFoo$Dict { foo: true[0m+ [33m } [0m+ has type [33mFoo$Dict Number[0m+in value declaration [33mfooNumber[0m++where [33mt0[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/InstanceSigsIncorrectType.purs view
@@ -0,0 +1,10 @@+-- @shouldFailWith TypesDoNotUnify++module Main where++class Foo a where+ foo :: a++instance fooNumber :: Foo Number where+ foo :: Boolean+ foo = true
+ tests/purs/failing/InstanceSigsOrphanTypeDeclaration.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/InstanceSigsOrphanTypeDeclaration.purs:10:3 - 10:12 (line 10, column 3 - line 10, column 12)++ The type declaration for [33mbar[0m should be followed by its definition.+++See https://github.com/purescript/documentation/blob/master/errors/OrphanTypeDeclaration.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/InstanceSigsOrphanTypeDeclaration.purs view
@@ -0,0 +1,10 @@+-- @shouldFailWith OrphanTypeDeclaration++module Main where++class Foo a where+ foo :: a++instance fooNumber :: Foo Number where+ bar :: Int+ foo = 0.0
+ tests/purs/failing/IntAsRecordLabel.out view
@@ -0,0 +1,10 @@+Error found:+at tests/purs/failing/IntAsRecordLabel.purs:4:27 - 4:29 (line 4, column 27 - line 4, column 29)++ Unable to parse module:+ Unexpected token '42'+++See https://github.com/purescript/documentation/blob/master/errors/ErrorParsingModule.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/IntAsRecordLabel.purs view
@@ -0,0 +1,4 @@+-- @shouldFailWith ErrorParsingModule+module Main where++type IntAsRecordLabel = { 42 :: Int }
+ tests/purs/failing/IntOutOfRange.out view
@@ -0,0 +1,11 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/IntOutOfRange.purs:6:5 - 6:15 (line 6, column 5 - line 6, column 15)++ Integer value [33m2147483648[0m is out of range for the JavaScript backend.+ Acceptable values fall within the range [33m-2147483648[0m to [33m2147483647[0m (inclusive).+++See https://github.com/purescript/documentation/blob/master/errors/IntOutOfRange.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/IntOutOfRange.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith IntOutOfRange++module Main where++n :: Int+n = 2147483648
+ tests/purs/failing/IntToString1.out view
@@ -0,0 +1,31 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/IntToString1.purs:14:15 - 14:46 (line 14, column 15 - line 14, column 46)++ Could not match type+ [33m [0m+ [33m "1"[0m+ [33m [0m+ with type+ [33m [0m+ [33m "a"[0m+ [33m [0m++while solving type class constraint+[33m [0m+[33m Prim.Int.ToString 1 [0m+[33m "a"[0m+[33m [0m+while applying a function [33mtestToString[0m+ of type [33mToString t0 t1 => Proxy @Int t0 -> Proxy @Symbol t1[0m+ to argument [33mProxy[0m+while checking that expression [33mtestToString Proxy[0m+ has type [33mProxy @Symbol "a"[0m+in value declaration [33mposToString[0m++where [33mt0[0m is an unknown type+ [33mt1[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/IntToString1.purs view
@@ -0,0 +1,14 @@+-- @shouldFailWith TypesDoNotUnify+module Main where++import Prelude+import Prim.Int (class ToString)++data Proxy :: forall k. k -> Type+data Proxy a = Proxy++testToString :: forall i s. ToString i s => Proxy i -> Proxy s+testToString _ = Proxy++posToString :: Proxy "a"+posToString = testToString (Proxy :: Proxy 1)
+ tests/purs/failing/IntToString2.out view
@@ -0,0 +1,31 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/IntToString2.purs:14:15 - 14:49 (line 14, column 15 - line 14, column 49)++ Could not match type+ [33m [0m+ [33m "-1"[0m+ [33m [0m+ with type+ [33m [0m+ [33m "a"[0m+ [33m [0m++while solving type class constraint+[33m [0m+[33m Prim.Int.ToString -1 [0m+[33m "a"[0m+[33m [0m+while applying a function [33mtestToString[0m+ of type [33mToString t0 t1 => Proxy @Int t0 -> Proxy @Symbol t1[0m+ to argument [33mProxy[0m+while checking that expression [33mtestToString Proxy[0m+ has type [33mProxy @Symbol "a"[0m+in value declaration [33mnegToString[0m++where [33mt0[0m is an unknown type+ [33mt1[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/IntToString2.purs view
@@ -0,0 +1,14 @@+-- @shouldFailWith TypesDoNotUnify+module Main where++import Prelude+import Prim.Int (class ToString)++data Proxy :: forall k. k -> Type+data Proxy a = Proxy++testToString :: forall i s. ToString i s => Proxy i -> Proxy s+testToString _ = Proxy++negToString :: Proxy "a"+negToString = testToString (Proxy :: Proxy (-1))
+ tests/purs/failing/IntToString3.out view
@@ -0,0 +1,31 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/IntToString3.purs:14:16 - 14:47 (line 14, column 16 - line 14, column 47)++ Could not match type+ [33m [0m+ [33m "0"[0m+ [33m [0m+ with type+ [33m [0m+ [33m "a"[0m+ [33m [0m++while solving type class constraint+[33m [0m+[33m Prim.Int.ToString 0 [0m+[33m "a"[0m+[33m [0m+while applying a function [33mtestToString[0m+ of type [33mToString t0 t1 => Proxy @Int t0 -> Proxy @Symbol t1[0m+ to argument [33mProxy[0m+while checking that expression [33mtestToString Proxy[0m+ has type [33mProxy @Symbol "a"[0m+in value declaration [33mzeroToString[0m++where [33mt0[0m is an unknown type+ [33mt1[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/IntToString3.purs view
@@ -0,0 +1,14 @@+-- @shouldFailWith TypesDoNotUnify+module Main where++import Prelude+import Prim.Int (class ToString)++data Proxy :: forall k. k -> Type+data Proxy a = Proxy++testToString :: forall i s. ToString i s => Proxy i -> Proxy s+testToString _ = Proxy++zeroToString :: Proxy "a"+zeroToString = testToString (Proxy :: Proxy 0)
+ tests/purs/failing/InvalidCoercibleInstanceDeclaration.out view
@@ -0,0 +1,14 @@+Error found:+at tests/purs/failing/InvalidCoercibleInstanceDeclaration.purs:8:1 - 8:36 (line 8, column 1 - line 8, column 36)++ Invalid type class instance declaration for+ [33m [0m+ [33m Prim.Coerce.Coercible D[0m+ [33m D[0m+ [33m [0m+ Instance declarations of this type class are disallowed.+++See https://github.com/purescript/documentation/blob/master/errors/InvalidCoercibleInstanceDeclaration.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/InvalidCoercibleInstanceDeclaration.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith InvalidCoercibleInstanceDeclaration+module Main where++import Prim.Coerce (class Coercible)++data D++instance coercible :: Coercible D D
+ tests/purs/failing/InvalidDerivedInstance.out view
@@ -0,0 +1,16 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/InvalidDerivedInstance.purs:8:1 - 8:30 (line 8, column 1 - line 8, column 30)++ The type class [33mData.Eq.Eq[0m expects 1 argument.+ But the instance [33meqX[0m provided 2.++in type class instance+[33m [0m+[33m Data.Eq.Eq X[0m+[33m X[0m+[33m [0m++See https://github.com/purescript/documentation/blob/master/errors/ClassInstanceArityMismatch.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/InvalidDerivedInstance.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith ClassInstanceArityMismatch+module Main where++import Prelude++data X = X++derive instance eqX :: Eq X X
+ tests/purs/failing/InvalidDerivedInstance2.out view
@@ -0,0 +1,18 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/InvalidDerivedInstance2.purs:6:1 - 6:34 (line 6, column 1 - line 6, column 34)++ Type class instance head is invalid due to use of type+ [33m [0m+ [33m ()[0m+ [33m [0m+ All types appearing in instance declarations must be of the form T a_1 .. a_n, where each type a_i is of the same form, unless the type is fully determined by other type class arguments via functional dependencies.++in type class instance+[33m [0m+[33m Data.Eq.Eq (Record ())[0m+[33m [0m++See https://github.com/purescript/documentation/blob/master/errors/InvalidInstanceHead.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/InvalidDerivedInstance2.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith InvalidInstanceHead+module Main where++import Prelude++derive instance eqRecord :: Eq {}
+ tests/purs/failing/InvalidDerivedInstance3.out view
@@ -0,0 +1,14 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/InvalidDerivedInstance3.purs:8:15 - 8:16 (line 8, column 15 - line 8, column 16)++ Type synonym [33mMain.S[0m is partially applied.+ Type synonyms must be applied to all of their type arguments.++while checking that type [33mS[0m+ has kind [33mType[0m+in type constructor [33mN[0m++See https://github.com/purescript/documentation/blob/master/errors/PartiallyAppliedSynonym.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/InvalidDerivedInstance3.purs view
@@ -0,0 +1,10 @@+-- @shouldFailWith PartiallyAppliedSynonym+module Main where++import Data.Newtype (class Newtype)++data D a+type S a = D a+newtype N = N S++derive instance newtypeN :: Newtype N _
+ tests/purs/failing/InvalidOperatorInBinder.out view
@@ -0,0 +1,10 @@+Error found:+at tests/purs/failing/InvalidOperatorInBinder.purs:12:12 - 12:13 (line 12, column 12 - line 12, column 13)++ Operator [33mMain.(:)[0m cannot be used in a pattern as it is an alias for function Main.cons.+ Only aliases for data constructors may be used in patterns.+++See https://github.com/purescript/documentation/blob/master/errors/InvalidOperatorInBinder.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/InvalidOperatorInBinder.purs view
@@ -0,0 +1,12 @@+-- @shouldFailWith InvalidOperatorInBinder+module Main where++data List a = Cons a (List a) | Nil++cons ∷ ∀ a. a → List a → List a+cons = Cons++infixl 6 cons as :++get ∷ ∀ a. List a → a+get (_ : x : _) = x
+ tests/purs/failing/KindError.out view
@@ -0,0 +1,24 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/KindError.purs:6:35 - 6:36 (line 6, column 35 - line 6, column 36)++ Could not match kind+ [33m [0m+ [33m Type[0m+ [33m [0m+ with kind+ [33m [0m+ [33m t8 -> t9[0m+ [33m [0m++while checking that type [33mf[0m+ has kind [33mt0 -> t1[0m+while inferring the kind of [33mf a[0m+in type constructor [33mKindError[0m++where [33mt0[0m is an unknown type+ [33mt1[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/KindsDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/KindError.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith KindsDoNotUnify+module Main where++import Prelude++data KindError f a = One f | Two (f a)
+ tests/purs/failing/KindStar.out view
@@ -0,0 +1,20 @@+Error found:+in module [33mX[0m+at tests/purs/failing/KindStar.purs:7:1 - 7:13 (line 7, column 1 - line 7, column 13)++ In a type-annotated expression [33mx :: t[0m, the type [33mt[0m must have kind [33mType[0m.+ The error arises from the type+ [33m [0m+ [33m List[0m+ [33m [0m+ having the kind+ [33m [0m+ [33m Type -> Type[0m+ [33m [0m+ instead.++in value declaration [33mtest[0m++See https://github.com/purescript/documentation/blob/master/errors/ExpectedType.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/KindStar.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith ExpectedType++module X where++data List a = Nil | Cons a (List a)++test :: List+test = Nil
+ tests/purs/failing/LacksWithSubGoal.out view
@@ -0,0 +1,35 @@+Error found:+in module [33mLacksWithSubGoal[0m+at tests/purs/failing/LacksWithSubGoal.purs:14:11 - 14:33 (line 14, column 11 - line 14, column 33)++ No type class instance was found for+ [33m [0m+ [33m Prim.Row.Lacks "hello"[0m+ [33m r0 [0m+ [33m [0m++while solving type class constraint+[33m [0m+[33m Prim.Row.Lacks "hello" [0m+[33m ( k :: Int[0m+[33m | r0 [0m+[33m ) [0m+[33m [0m+while applying a function [33munion[0m+ of type [33mLacks @Type t1 t2 => S t1 -> R t2[0m+ to argument [33mS[0m+while checking that expression [33munion S[0m+ has type [33mR [0m+ [33m ( k :: Int[0m+ [33m | r0 [0m+ [33m ) [0m+in value declaration [33mexample[0m++where [33mr0[0m is a rigid type variable+ bound at (line 14, column 11 - line 14, column 33)+ [33mt1[0m is an unknown type+ [33mt2[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/LacksWithSubGoal.purs view
@@ -0,0 +1,16 @@+-- @shouldFailWith NoInstanceFound+module LacksWithSubGoal where++import Prim.Row (class Lacks)++data S (r :: Symbol) = S++data R (r :: Row Type) = R++union :: forall s r. Lacks s r => S s -> R r+union S = R++example :: forall r. R (k :: Int | r)+example = union (S :: S "hello")++
+ tests/purs/failing/LeadingZeros1.out view
@@ -0,0 +1,10 @@+Error found:+at tests/purs/failing/LeadingZeros1.purs:6:6 - 6:7 (line 6, column 6 - line 6, column 7)++ Unable to parse module:+ Unexpected leading zeros+++See https://github.com/purescript/documentation/blob/master/errors/ErrorParsingModule.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/LeadingZeros1.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith ErrorParsingModule+module Main where++import Prelude++x = 01
+ tests/purs/failing/LeadingZeros2.out view
@@ -0,0 +1,10 @@+Error found:+at tests/purs/failing/LeadingZeros2.purs:6:6 - 6:7 (line 6, column 6 - line 6, column 7)++ Unable to parse module:+ Unexpected leading zeros+++See https://github.com/purescript/documentation/blob/master/errors/ErrorParsingModule.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/LeadingZeros2.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith ErrorParsingModule+module Main where++import Prelude++x = 00.1
+ tests/purs/failing/Let.out view
@@ -0,0 +1,9 @@+Error found:+at tests/purs/failing/Let.purs:6:12 - 6:17 (line 6, column 12 - line 6, column 17)++ The value of [33mx[0m is undefined here, so this reference is not allowed.+++See https://github.com/purescript/documentation/blob/master/errors/CycleInDeclaration.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/Let.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith CycleInDeclaration+module Main where++import Prelude++test = let x = x in x
+ tests/purs/failing/LetPatterns1.out view
@@ -0,0 +1,10 @@+Error found:+at tests/purs/failing/LetPatterns1.purs:8:7 - 8:14 (line 8, column 7 - line 8, column 14)++ Unable to parse module:+ Expected pattern, saw expression+++See https://github.com/purescript/documentation/blob/master/errors/ErrorParsingModule.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/LetPatterns1.purs view
@@ -0,0 +1,10 @@+-- @shouldFailWith ErrorParsingModule+module Main where++import Prelude++-- wrong binders for function, the first one should be VarBinder+x =+ let (X a b) x y = hoge+ in+ a
+ tests/purs/failing/LetPatterns2.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/LetPatterns2.purs:11:9 - 11:10 (line 11, column 9 - line 11, column 10)++ Unknown value [33ma[0m+++See https://github.com/purescript/documentation/blob/master/errors/UnknownName.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/LetPatterns2.purs view
@@ -0,0 +1,14 @@+-- @shouldFailWith UnknownName+module Main where++import Prelude++data X a = X a++-- wrong dependency order+x =+ let+ b = a+ X a = X 10+ in+ b
+ tests/purs/failing/LetPatterns3.out view
@@ -0,0 +1,16 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/LetPatterns3.purs:11:7 - 11:8 (line 11, column 7 - line 11, column 8)++ Data constructor [33mMain.X[0m was given 0 arguments in a case expression, but expected 1 arguments.+ This problem can be fixed by giving [33mMain.X[0m 1 arguments.++while inferring the type of [33m\$0 -> [0m+ [33m \b -> [0m+ [33m case $0 b of[0m+ [33m X b -> ...[0m+in value declaration [33mx[0m++See https://github.com/purescript/documentation/blob/master/errors/IncorrectConstructorArity.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/LetPatterns3.purs view
@@ -0,0 +1,13 @@+-- @shouldFailWith IncorrectConstructorArity+module Main where++import Prelude++data X a = X a++-- a parameter binder should be with nullary constructor, or with parens+x =+ let+ a X b = b+ in+ a $ X 10
+ tests/purs/failing/LetPatterns4.out view
@@ -0,0 +1,10 @@+Error found:+at tests/purs/failing/LetPatterns4.purs:6:1 - 6:2 (line 6, column 1 - line 6, column 2)++ Unable to parse module:+ Unexpected token 'X'+++See https://github.com/purescript/documentation/blob/master/errors/ErrorParsingModule.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/LetPatterns4.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith ErrorParsingModule+module Main where++data X a = X a++X a = a
+ tests/purs/failing/MPTCs.out view
@@ -0,0 +1,16 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/MPTCs.purs:9:1 - 10:10 (line 9, column 1 - line 10, column 10)++ The type class [33mMain.Foo[0m expects 1 argument.+ But the instance [33mfooStringString[0m provided 2.++in type class instance+[33m [0m+[33m Main.Foo String[0m+[33m String[0m+[33m [0m++See https://github.com/purescript/documentation/blob/master/errors/ClassInstanceArityMismatch.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/MPTCs.purs view
@@ -0,0 +1,10 @@+-- @shouldFailWith ClassInstanceArityMismatch+module Main where++import Prelude++class Foo a where+ f :: a -> a++instance fooStringString :: Foo String String where+ f a = a
+ tests/purs/failing/MissingClassExport.out view
@@ -0,0 +1,13 @@+Error found:+in module [33mTest[0m+at tests/purs/failing/MissingClassExport.purs:2:1 - 7:16 (line 2, column 1 - line 7, column 16)++ An export for [33mbar[0m requires the following to also be exported:++ [33mclass Foo[0m++++See https://github.com/purescript/documentation/blob/master/errors/TransitiveExportError.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/MissingClassExport.purs view
@@ -0,0 +1,7 @@+-- @shouldFailWith TransitiveExportError+module Test (bar) where++import Prelude++class Foo a where+ bar :: a -> a
+ tests/purs/failing/MissingClassMember.out view
@@ -0,0 +1,15 @@+Error found:+at tests/purs/failing/MissingClassMember.purs:9:1 - 10:10 (line 9, column 1 - line 10, column 10)++ The following type class members have not been implemented:+ [33mb :: String -> Number[0m+ [33mc :: forall f. String -> f String[0m++in type class instance+[33m [0m+[33m Main.A String[0m+[33m [0m++See https://github.com/purescript/documentation/blob/master/errors/MissingClassMember.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/MissingClassMember.purs view
@@ -0,0 +1,10 @@+-- @shouldFailWith MissingClassMember+module Main where++class A a where+ a :: a -> String+ b :: a -> Number+ c :: forall f. a -> f a++instance aString :: A String where+ a s = s
+ tests/purs/failing/MissingClassMemberExport.out view
@@ -0,0 +1,13 @@+Error found:+in module [33mTest[0m+at tests/purs/failing/MissingClassMemberExport.purs:2:1 - 7:16 (line 2, column 1 - line 7, column 16)++ An export for [33mclass Foo[0m requires the following to also be exported:++ [33mbar[0m++++See https://github.com/purescript/documentation/blob/master/errors/TransitiveExportError.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/MissingClassMemberExport.purs view
@@ -0,0 +1,7 @@+-- @shouldFailWith TransitiveExportError+module Test (class Foo) where++import Prelude++class Foo a where+ bar :: a -> a
+ tests/purs/failing/MissingFFIImplementations.js view
@@ -0,0 +1,1 @@+export var yes = true;
+ tests/purs/failing/MissingFFIImplementations.out view
@@ -0,0 +1,12 @@+Error found:+at tests/purs/failing/MissingFFIImplementations.purs:2:1 - 5:29 (line 2, column 1 - line 5, column 29)++ The following values are not defined in the foreign module for module [33mMain[0m:++ no++++See https://github.com/purescript/documentation/blob/master/errors/MissingFFIImplementations.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/MissingFFIImplementations.purs view
@@ -0,0 +1,5 @@+-- @shouldFailWith MissingFFIImplementations+module Main where++foreign import yes :: Boolean+foreign import no :: Boolean
+ tests/purs/failing/MissingRecordField.out view
@@ -0,0 +1,23 @@+Error found:+in module [33mMissingRecordField[0m+at tests/purs/failing/MissingRecordField.purs:10:19 - 10:23 (line 10, column 19 - line 10, column 23)++ Type of expression lacks required label [33mage[0m.++while checking that type [33m{ first :: String[0m+ [33m, last :: String [0m+ [33m} [0m+ is at least as general as type [33m{ age :: Number[0m+ [33m| t0 [0m+ [33m} [0m+while checking that expression [33mjohn[0m+ has type [33m{ age :: Number[0m+ [33m| t0 [0m+ [33m} [0m+in value declaration [33mresult[0m++where [33mt0[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/PropertyIsMissing.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/MissingRecordField.purs view
@@ -0,0 +1,10 @@+-- @shouldFailWith PropertyIsMissing+module MissingRecordField where++import Prelude ((>))++john = { first: "John", last: "Smith" }++isOver50 p = p.age > 50.0++result = isOver50 john
+ tests/purs/failing/MixedAssociativityError.out view
@@ -0,0 +1,14 @@+Error found:+at tests/purs/failing/MixedAssociativityError.purs:6:15 - 6:18 (line 6, column 15 - line 6, column 18)++ Cannot parse an expression that uses operators of the same precedence but mixed associativity:++ [33mData.Functor.(<$>)[0m is [33minfixl[0m+ [33mData.Eq.(==)[0m is [33minfix[0m++ Use parentheses to resolve this ambiguity.+++See https://github.com/purescript/documentation/blob/master/errors/MixedAssociativityError.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/MixedAssociativityError.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith MixedAssociativityError+module Main where++import Prelude++feq f x y = f <$> x == f <$> y
+ tests/purs/failing/MonoKindDataBindingGroup.out view
@@ -0,0 +1,21 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/MonoKindDataBindingGroup.purs:8:12 - 8:17 (line 8, column 12 - line 8, column 17)++ Could not match kind+ [33m [0m+ [33m Symbol[0m+ [33m [0m+ with kind+ [33m [0m+ [33m Type[0m+ [33m [0m++while checking that type [33m"bad"[0m+ has kind [33mType[0m+while inferring the kind of [33mA "bad"[0m+in type synonym [33mX[0m++See https://github.com/purescript/documentation/blob/master/errors/KindsDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/MonoKindDataBindingGroup.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith KindsDoNotUnify+module Main where++data F (a :: Type -> Type) = F+data A a = A (B a)+type B a = F A++type X = A "bad"
+ tests/purs/failing/MultipleErrors.out view
@@ -0,0 +1,46 @@+Error 1 of 2:++ in module [33mMultipleErrors[0m+ at tests/purs/failing/MultipleErrors.purs:8:9 - 8:15 (line 8, column 9 - line 8, column 15)++ Could not match type+ [33m [0m+ [33m String[0m+ [33m [0m+ with type+ [33m [0m+ [33m Int[0m+ [33m [0m++ while checking that type [33mString[0m+ is at least as general as type [33mInt[0m+ while checking that expression [33m"Test"[0m+ has type [33mInt[0m+ in binding group foo, bar++ See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+ or to contribute content related to this error.++Error 2 of 2:++ in module [33mMultipleErrors[0m+ at tests/purs/failing/MultipleErrors.purs:12:9 - 12:15 (line 12, column 9 - line 12, column 15)++ Could not match type+ [33m [0m+ [33m String[0m+ [33m [0m+ with type+ [33m [0m+ [33m Int[0m+ [33m [0m++ while checking that type [33mString[0m+ is at least as general as type [33mInt[0m+ while checking that expression [33m"Test"[0m+ has type [33mInt[0m+ in binding group foo, bar++ See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+ or to contribute content related to this error.+
+ tests/purs/failing/MultipleErrors.purs view
@@ -0,0 +1,13 @@+-- @shouldFailWith TypesDoNotUnify+-- @shouldFailWith TypesDoNotUnify+module MultipleErrors where++import Prelude++foo :: Int -> Int+foo 0 = "Test"+foo n = bar (n - 1)++bar :: Int -> Int+bar 0 = "Test"+bar n = foo (n - 1)
+ tests/purs/failing/MultipleErrors2.out view
@@ -0,0 +1,22 @@+Error 1 of 2:++ in module [33mMultipleErrors2[0m+ at tests/purs/failing/MultipleErrors2.purs:7:7 - 7:20 (line 7, column 7 - line 7, column 20)++ Unknown value [33mitDoesntExist[0m+++ See https://github.com/purescript/documentation/blob/master/errors/UnknownName.md for more information,+ or to contribute content related to this error.++Error 2 of 2:++ in module [33mMultipleErrors2[0m+ at tests/purs/failing/MultipleErrors2.purs:9:7 - 9:22 (line 9, column 7 - line 9, column 22)++ Unknown value [33mneitherDoesThis[0m+++ See https://github.com/purescript/documentation/blob/master/errors/UnknownName.md for more information,+ or to contribute content related to this error.+
+ tests/purs/failing/MultipleErrors2.purs view
@@ -0,0 +1,9 @@+-- @shouldFailWith UnknownName+-- @shouldFailWith UnknownName+module MultipleErrors2 where++import Prelude++foo = itDoesntExist++bar = neitherDoesThis
+ tests/purs/failing/MultipleTypeOpFixities.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mMultipleTypeOpFixities[0m+at tests/purs/failing/MultipleTypeOpFixities.purs:9:1 - 9:22 (line 9, column 1 - line 9, column 22)++ There are multiple fixity/precedence declarations for type operator [33m(!?)[0m+++See https://github.com/purescript/documentation/blob/master/errors/MultipleTypeOpFixities.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/MultipleTypeOpFixities.purs view
@@ -0,0 +1,9 @@+-- @shouldFailWith MultipleTypeOpFixities+module MultipleTypeOpFixities where++import Prelude++type Op x y = Op x y++infix 2 type Op as !?+infix 2 type Op as !?
+ tests/purs/failing/MultipleValueOpFixities.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mMultipleValueOpFixities[0m+at tests/purs/failing/MultipleValueOpFixities.purs:9:1 - 9:18 (line 9, column 1 - line 9, column 18)++ There are multiple fixity/precedence declarations for operator [33m(!?)[0m+++See https://github.com/purescript/documentation/blob/master/errors/MultipleValueOpFixities.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/MultipleValueOpFixities.purs view
@@ -0,0 +1,9 @@+-- @shouldFailWith MultipleValueOpFixities+module MultipleValueOpFixities where++import Prelude++add x y = x + y++infix 2 add as !?+infix 2 add as !?
+ tests/purs/failing/MutRec.out view
@@ -0,0 +1,20 @@+Error 1 of 2:++ at tests/purs/failing/MutRec.purs:7:1 - 7:6 (line 7, column 1 - line 7, column 6)++ The value of [33mx[0m is undefined here, so this reference is not allowed.+++ See https://github.com/purescript/documentation/blob/master/errors/CycleInDeclaration.md for more information,+ or to contribute content related to this error.++Error 2 of 2:++ at tests/purs/failing/MutRec.purs:9:1 - 9:6 (line 9, column 1 - line 9, column 6)++ The value of [33my[0m is undefined here, so this reference is not allowed.+++ See https://github.com/purescript/documentation/blob/master/errors/CycleInDeclaration.md for more information,+ or to contribute content related to this error.+
+ tests/purs/failing/MutRec.purs view
@@ -0,0 +1,9 @@+-- @shouldFailWith CycleInDeclaration+-- @shouldFailWith CycleInDeclaration+module MutRec where++import Prelude++x = y++y = x
+ tests/purs/failing/MutRec2.out view
@@ -0,0 +1,9 @@+Error found:+at tests/purs/failing/MutRec2.purs:6:1 - 6:6 (line 6, column 1 - line 6, column 6)++ The value of [33mx[0m is undefined here, so this reference is not allowed.+++See https://github.com/purescript/documentation/blob/master/errors/CycleInDeclaration.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/MutRec2.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith CycleInDeclaration+module Main where++import Prelude++x = x
+ tests/purs/failing/NestedRecordLabelOnTypeError.out view
@@ -0,0 +1,34 @@+Error found:+in module [33mNestedRecordLabelOnTypeError[0m+at tests/purs/failing/NestedRecordLabelOnTypeError.purs:8:9 - 8:15 (line 8, column 9 - line 8, column 15)++ Could not match type+ [33m [0m+ [33m Int[0m+ [33m [0m+ with type+ [33m [0m+ [33m String[0m+ [33m [0m++while matching label [33mc[0m+while matching label [33mb[0m+while matching label [33ma[0m+while checking that type [33m{ a :: { b :: { c :: Int[0m+ [33m } [0m+ [33m } [0m+ [33m} [0m+ is at least as general as type [33m{ a :: { b :: { c :: String[0m+ [33m } [0m+ [33m } [0m+ [33m} [0m+while checking that expression [33mrecord[0m+ has type [33m{ a :: { b :: { c :: String[0m+ [33m } [0m+ [33m } [0m+ [33m} [0m+in value declaration [33merror[0m++See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/NestedRecordLabelOnTypeError.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith TypesDoNotUnify+module NestedRecordLabelOnTypeError where++record :: { a :: { b :: { c :: Int } } }+record = { a: { b: { c: 1 } } }++error :: { a :: { b :: { c :: String } } }+error = record -- this should trigger an error, telling us there's a mismatch in the field `a > b > c`
+ tests/purs/failing/NewtypeInstance.out view
@@ -0,0 +1,15 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/NewtypeInstance.purs:8:1 - 8:40 (line 8, column 1 - line 8, column 40)++ Cannot derive newtype instance for+ [33m [0m+ [33m Data.Show.Show X[0m+ [33m [0m+ Make sure this is a newtype.++in value declaration [33mshowX[0m++See https://github.com/purescript/documentation/blob/master/errors/InvalidNewtypeInstance.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/NewtypeInstance.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith InvalidNewtypeInstance+module Main where++import Prelude++data X = X++derive newtype instance showX :: Show X
+ tests/purs/failing/NewtypeInstance2.out view
@@ -0,0 +1,18 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/NewtypeInstance2.purs:8:1 - 8:54 (line 8, column 1 - line 8, column 54)++ Cannot derive newtype instance for+ [33m [0m+ [33m Data.Show.Show (X a0)[0m+ [33m [0m+ Make sure this is a newtype.++in value declaration [33mshowX[0m++where [33ma0[0m is a rigid type variable+ bound at (line 0, column 0 - line 0, column 0)++See https://github.com/purescript/documentation/blob/master/errors/InvalidNewtypeInstance.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/NewtypeInstance2.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith InvalidNewtypeInstance+module Main where++import Prelude++data X a = X a a++derive newtype instance showX :: Show a => Show (X a)
+ tests/purs/failing/NewtypeInstance3.out view
@@ -0,0 +1,15 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/NewtypeInstance3.purs:8:1 - 8:43 (line 8, column 1 - line 8, column 43)++ Cannot derive newtype instance for+ [33m [0m+ [33m Main.Nullary [0m+ [33m [0m+ Make sure this is a newtype.++in value declaration [33mnullary[0m++See https://github.com/purescript/documentation/blob/master/errors/InvalidNewtypeInstance.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/NewtypeInstance3.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith InvalidNewtypeInstance+module Main where++import Prelude++class Nullary++derive newtype instance nullary :: Nullary
+ tests/purs/failing/NewtypeInstance4.out view
@@ -0,0 +1,15 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/NewtypeInstance4.purs:8:1 - 8:40 (line 8, column 1 - line 8, column 40)++ Cannot derive newtype instance for+ [33m [0m+ [33m Data.Show.Show X[0m+ [33m [0m+ Make sure this is a newtype.++in value declaration [33mshowX[0m++See https://github.com/purescript/documentation/blob/master/errors/InvalidNewtypeInstance.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/NewtypeInstance4.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith InvalidNewtypeInstance+module Main where++import Prelude++data X = X | Y++derive newtype instance showX :: Show X
+ tests/purs/failing/NewtypeInstance5.out view
@@ -0,0 +1,15 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/NewtypeInstance5.purs:8:1 - 8:46 (line 8, column 1 - line 8, column 46)++ Cannot derive newtype instance for+ [33m [0m+ [33m Data.Functor.Functor X[0m+ [33m [0m+ Make sure this is a newtype.++in value declaration [33mfunctorX[0m++See https://github.com/purescript/documentation/blob/master/errors/InvalidNewtypeInstance.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/NewtypeInstance5.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith InvalidNewtypeInstance+module Main where++import Prelude++newtype X a = X a++derive newtype instance functorX :: Functor X
+ tests/purs/failing/NewtypeInstance6.out view
@@ -0,0 +1,24 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/NewtypeInstance6.purs:8:45 - 8:46 (line 8, column 45 - line 8, column 46)++ Could not match kind+ [33m [0m+ [33m Type -> Type[0m+ [33m [0m+ with kind+ [33m [0m+ [33m Type[0m+ [33m [0m++while checking that type [33mX[0m+ has kind [33mType -> Type[0m+while inferring the kind of [33mFunctor X[0m+in type class instance+[33m [0m+[33m Data.Functor.Functor X[0m+[33m [0m++See https://github.com/purescript/documentation/blob/master/errors/KindsDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/NewtypeInstance6.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith KindsDoNotUnify+module Main where++import Prelude++newtype X a b = X (Array b)++derive newtype instance functorX :: Functor X
+ tests/purs/failing/NewtypeMultiArgs.out view
@@ -0,0 +1,10 @@+Error found:+at tests/purs/failing/NewtypeMultiArgs.purs:6:30 - 6:37 (line 6, column 30 - line 6, column 37)++ Unable to parse module:+ Unexpected token 'Boolean'+++See https://github.com/purescript/documentation/blob/master/errors/ErrorParsingModule.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/NewtypeMultiArgs.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith ErrorParsingModule+module Main where++import Prelude++newtype Thing = Thing String Boolean
+ tests/purs/failing/NewtypeMultiCtor.out view
@@ -0,0 +1,10 @@+Error found:+at tests/purs/failing/NewtypeMultiCtor.purs:6:30 - 6:31 (line 6, column 30 - line 6, column 31)++ Unable to parse module:+ Unexpected token '|'+++See https://github.com/purescript/documentation/blob/master/errors/ErrorParsingModule.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/NewtypeMultiCtor.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith ErrorParsingModule+module Main where++import Prelude++newtype Thing = Thing String | Other
+ tests/purs/failing/NewtypeUnnamedInstance.out view
@@ -0,0 +1,14 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/NewtypeUnnamedInstance.purs:8:1 - 8:31 (line 8, column 1 - line 8, column 31)++ Cannot derive newtype instance for+ [33m [0m+ [33m Data.Show.Show X[0m+ [33m [0m+ Make sure this is a newtype.+++See https://github.com/purescript/documentation/blob/master/errors/InvalidNewtypeInstance.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/NewtypeUnnamedInstance.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith InvalidNewtypeInstance+module Main where++import Prelude++data X = X++derive newtype instance Show X
+ tests/purs/failing/NonAssociativeError.out view
@@ -0,0 +1,26 @@+Error 1 of 2:++ at tests/purs/failing/NonAssociativeError.purs:7:10 - 7:12 (line 7, column 10 - line 7, column 12)++ Cannot parse an expression that uses multiple instances of the non-associative operator [33mData.Eq.(==)[0m.+ Use parentheses to resolve this ambiguity.+++ See https://github.com/purescript/documentation/blob/master/errors/NonAssociativeError.md for more information,+ or to contribute content related to this error.++Error 2 of 2:++ at tests/purs/failing/NonAssociativeError.purs:8:19 - 8:21 (line 8, column 19 - line 8, column 21)++ Cannot parse an expression that uses multiple non-associative operators of the same precedence:++ [33mData.Eq.(/=)[0m+ [33mData.Eq.(==)[0m++ Use parentheses to resolve this ambiguity.+++ See https://github.com/purescript/documentation/blob/master/errors/NonAssociativeError.md for more information,+ or to contribute content related to this error.+
+ tests/purs/failing/NonAssociativeError.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith NonAssociativeError+-- @shouldFailWith NonAssociativeError+module Main where++import Prelude++a = true == true == true+b = true == false /= true
+ tests/purs/failing/NonExhaustivePatGuard.out view
@@ -0,0 +1,23 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/NonExhaustivePatGuard.purs:4:1 - 4:16 (line 4, column 1 - line 4, column 16)++ A case expression could not be determined to cover all inputs.+ The following additional cases are required to cover all inputs:++ [33m_[0m++ Alternatively, add a Partial constraint to the type of the enclosing value.++while checking that type [33mPartial => t0[0m+ is at least as general as type [33mInt[0m+while checking that expression [33mcase x of [0m+ [33m x | 1 <- x -> x[0m+ has type [33mInt[0m+in value declaration [33mf[0m++where [33mt0[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/NonExhaustivePatGuard.purs view
@@ -0,0 +1,5 @@+-- @shouldFailWith NoInstanceFound+module Main where++f :: Int -> Int+f x | 1 <- x = x
+ tests/purs/failing/NullaryAbs.out view
@@ -0,0 +1,10 @@+Error found:+at tests/purs/failing/NullaryAbs.purs:6:10 - 6:12 (line 6, column 10 - line 6, column 12)++ Unable to parse module:+ Unexpected token '->'+++See https://github.com/purescript/documentation/blob/master/errors/ErrorParsingModule.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/NullaryAbs.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith ErrorParsingModule+module Main where++import Prelude++func = \ -> "no"
+ tests/purs/failing/Object.out view
@@ -0,0 +1,24 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/Object.purs:8:14 - 8:16 (line 8, column 14 - line 8, column 16)++ Type of expression lacks required label [33mfoo[0m.++while checking that expression [33m{}[0m+ has type [33m{ foo :: t0[0m+ [33m| t1 [0m+ [33m} [0m+while applying a function [33mtest[0m+ of type [33m{ foo :: t0[0m+ [33m| t1 [0m+ [33m} [0m+ [33m-> t0 [0m+ to argument [33m{}[0m+in value declaration [33mtest1[0m++where [33mt0[0m is an unknown type+ [33mt1[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/PropertyIsMissing.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/Object.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith PropertyIsMissing+module Main where++import Prelude++test o = o.foo++test1 = test {}
+ tests/purs/failing/OperatorAliasNoExport.out view
@@ -0,0 +1,13 @@+Error found:+in module [33mTest[0m+at tests/purs/failing/OperatorAliasNoExport.purs:2:1 - 7:13 (line 2, column 1 - line 7, column 13)++ An export for [33m(?!)[0m requires the following to also be exported:++ [33mwhat[0m++++See https://github.com/purescript/documentation/blob/master/errors/TransitiveExportError.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/OperatorAliasNoExport.purs view
@@ -0,0 +1,7 @@+-- @shouldFailWith TransitiveExportError+module Test ((?!)) where++infixl 4 what as ?!++what :: forall a b. a -> b -> a+what a _ = a
+ tests/purs/failing/OperatorAt.out view
@@ -0,0 +1,10 @@+Error found:+at tests/purs/failing/OperatorAt.purs:6:18 - 6:19 (line 6, column 18 - line 6, column 19)++ Unable to parse module:+ Unexpected token '@'+++See https://github.com/purescript/documentation/blob/master/errors/ErrorParsingModule.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/OperatorAt.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith ErrorParsingModule+module Main where++import Prelude++infix 1 const as @++test = 1 @ 2
+ tests/purs/failing/OperatorBackslash.out view
@@ -0,0 +1,10 @@+Error found:+at tests/purs/failing/OperatorBackslash.purs:6:18 - 6:19 (line 6, column 18 - line 6, column 19)++ Unable to parse module:+ Unexpected token '\'+++See https://github.com/purescript/documentation/blob/master/errors/ErrorParsingModule.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/OperatorBackslash.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith ErrorParsingModule+module Main where++import Prelude++infix 1 const as \++test = 1 \ 2
+ tests/purs/failing/OperatorSections.out view
@@ -0,0 +1,27 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/OperatorSections.purs:7:3 - 7:17 (line 7, column 3 - line 7, column 17)++ Could not match type+ [33m [0m+ [33m Boolean[0m+ [33m [0m+ with type+ [33m [0m+ [33m t1 -> t2[0m+ [33m [0m++while applying a function [33m(not (#dict HeytingAlgebra t2)) true[0m+ of type [33mt0[0m+ to argument [33m$0[0m+while inferring the type of [33m\$0 -> [0m+ [33m (not true) $0[0m+in value declaration [33mmain[0m++where [33mt1[0m is an unknown type+ [33mt0[0m is an unknown type+ [33mt2[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/OperatorSections.purs view
@@ -0,0 +1,7 @@+-- @shouldFailWith TypesDoNotUnify+module Main where++import Prelude++main = do+ (true `not` _)
+ tests/purs/failing/OperatorSections2.out view
@@ -0,0 +1,9 @@+Error found:+at tests/purs/failing/OperatorSections2.purs:6:10 - 6:11 (line 6, column 10 - line 6, column 11)++ An anonymous function argument appears in an invalid context.+++See https://github.com/purescript/documentation/blob/master/errors/IncorrectAnonymousArgument.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/OperatorSections2.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith IncorrectAnonymousArgument+module Main where++import Prelude++test = ( _ * 4 + 1 ) 50
+ tests/purs/failing/OrphanInstance.out view
@@ -0,0 +1,18 @@+Error found:+in module [33mTest[0m+at tests/purs/failing/OrphanInstance.purs:6:1 - 7:11 (line 6, column 1 - line 7, column 11)++ Orphan instance [33mcBoolean[0m found for+ [33m [0m+ [33m Class.C Boolean[0m+ [33m [0m+ This problem can be resolved by declaring the instance in [33mClass[0m, or by defining the instance on a newtype wrapper.++in type class instance+[33m [0m+[33m Class.C Boolean[0m+[33m [0m++See https://github.com/purescript/documentation/blob/master/errors/OrphanInstance.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/OrphanInstance.purs view
@@ -0,0 +1,7 @@+-- @shouldFailWith OrphanInstance+module Test where++import Class++instance cBoolean :: C Boolean where+ op a = a
+ tests/purs/failing/OrphanInstance/Class.purs view
@@ -0,0 +1,4 @@+module Class where++class C a where+ op :: a -> a
+ tests/purs/failing/OrphanInstanceFunDepCycle.out view
@@ -0,0 +1,20 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/OrphanInstanceFunDepCycle.purs:5:1 - 5:22 (line 5, column 1 - line 5, column 22)++ Orphan instance [33mclr[0m found for+ [33m [0m+ [33m Lib.C L[0m+ [33m R[0m+ [33m [0m+ This problem can be resolved by declaring the instance in [33mLib[0m, or by defining the instance on a newtype wrapper.++in type class instance+[33m [0m+[33m Lib.C L[0m+[33m R[0m+[33m [0m++See https://github.com/purescript/documentation/blob/master/errors/OrphanInstance.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/OrphanInstanceFunDepCycle.purs view
@@ -0,0 +1,5 @@+-- @shouldFailWith OrphanInstance+module Main where+import Lib+data L+instance clr :: C L R
+ tests/purs/failing/OrphanInstanceFunDepCycle/Lib.out view
@@ -0,0 +1,20 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/OrphanInstanceFunDepCycle.purs:5:1 - 5:22 (line 5, column 1 - line 5, column 22)++ Orphan instance [33mclr[0m found for+ [33m [0m+ [33m Lib.C L[0m+ [33m R[0m+ [33m [0m+ This problem can be resolved by declaring the instance in [33mLib[0m, or by defining the instance on a newtype wrapper.++in type class instance+[33m [0m+[33m Lib.C L[0m+[33m R[0m+[33m [0m++See https://github.com/purescript/documentation/blob/master/errors/OrphanInstance.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/OrphanInstanceFunDepCycle/Lib.purs view
@@ -0,0 +1,4 @@+module Lib where+-- covering sets: {{l}, {r}}+class C l r | l -> r, r -> l+data R
+ tests/purs/failing/OrphanInstanceNullary.out view
@@ -0,0 +1,18 @@+Error found:+in module [33mTest[0m+at tests/purs/failing/OrphanInstanceNullary.purs:4:1 - 4:16 (line 4, column 1 - line 4, column 16)++ Orphan instance [33mc[0m found for+ [33m [0m+ [33m Lib.C [0m+ [33m [0m+ This problem can be resolved by declaring the instance in [33mLib[0m, or by defining the instance on a newtype wrapper.++in type class instance+[33m [0m+[33m Lib.C [0m+[33m [0m++See https://github.com/purescript/documentation/blob/master/errors/OrphanInstance.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/OrphanInstanceNullary.purs view
@@ -0,0 +1,4 @@+-- @shouldFailWith OrphanInstance+module Test where+import Lib+instance c :: C
+ tests/purs/failing/OrphanInstanceNullary/Lib.out view
@@ -0,0 +1,18 @@+Error found:+in module [33mTest[0m+at tests/purs/failing/OrphanInstanceNullary.purs:4:1 - 4:16 (line 4, column 1 - line 4, column 16)++ Orphan instance [33mc[0m found for+ [33m [0m+ [33m Lib.C [0m+ [33m [0m+ This problem can be resolved by declaring the instance in [33mLib[0m, or by defining the instance on a newtype wrapper.++in type class instance+[33m [0m+[33m Lib.C [0m+[33m [0m++See https://github.com/purescript/documentation/blob/master/errors/OrphanInstance.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/OrphanInstanceNullary/Lib.purs view
@@ -0,0 +1,2 @@+module Lib where+class C
+ tests/purs/failing/OrphanInstanceWithDetermined.out view
@@ -0,0 +1,22 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/OrphanInstanceWithDetermined.purs:5:1 - 5:25 (line 5, column 1 - line 5, column 25)++ Orphan instance [33mcflr[0m found for+ [33m [0m+ [33m Lib.C F[0m+ [33m L[0m+ [33m R[0m+ [33m [0m+ This problem can be resolved by declaring the instance in [33mLib[0m, or by defining the instance on a newtype wrapper.++in type class instance+[33m [0m+[33m Lib.C F[0m+[33m L[0m+[33m R[0m+[33m [0m++See https://github.com/purescript/documentation/blob/master/errors/OrphanInstance.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/OrphanInstanceWithDetermined.purs view
@@ -0,0 +1,5 @@+-- @shouldFailWith OrphanInstance+module Main where+import Lib+data R+instance cflr :: C F L R
+ tests/purs/failing/OrphanInstanceWithDetermined/Lib.out view
@@ -0,0 +1,22 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/OrphanInstanceWithDetermined.purs:5:1 - 5:25 (line 5, column 1 - line 5, column 25)++ Orphan instance [33mcflr[0m found for+ [33m [0m+ [33m Lib.C F[0m+ [33m L[0m+ [33m R[0m+ [33m [0m+ This problem can be resolved by declaring the instance in [33mLib[0m, or by defining the instance on a newtype wrapper.++in type class instance+[33m [0m+[33m Lib.C F[0m+[33m L[0m+[33m R[0m+[33m [0m++See https://github.com/purescript/documentation/blob/master/errors/OrphanInstance.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/OrphanInstanceWithDetermined/Lib.purs view
@@ -0,0 +1,5 @@+module Lib where+-- covering sets: {{f, l}}+class C f l r | l -> r+data F+data L
+ tests/purs/failing/OrphanKindDeclaration1.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/OrphanKindDeclaration1.purs:4:1 - 4:17 (line 4, column 1 - line 4, column 17)++ The kind declaration for [33mFoo[0m should be followed by its definition.+++See https://github.com/purescript/documentation/blob/master/errors/OrphanKindDeclaration.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/OrphanKindDeclaration1.purs view
@@ -0,0 +1,4 @@+-- @shouldFailWith OrphanKindDeclaration+module Main where++type Foo :: Type
+ tests/purs/failing/OrphanKindDeclaration2.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/OrphanKindDeclaration2.purs:4:1 - 4:17 (line 4, column 1 - line 4, column 17)++ The kind declaration for [33mFoo[0m should be followed by its definition.+++See https://github.com/purescript/documentation/blob/master/errors/OrphanKindDeclaration.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/OrphanKindDeclaration2.purs view
@@ -0,0 +1,5 @@+-- @shouldFailWith OrphanKindDeclaration+module Main where++type Foo :: Type+data Foo = Foo Int
+ tests/purs/failing/OrphanRoleDeclaration1.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/OrphanRoleDeclaration1.purs:4:1 - 4:20 (line 4, column 1 - line 4, column 20)++ The role declaration for [33mD[0m should follow its definition.+++See https://github.com/purescript/documentation/blob/master/errors/OrphanRoleDeclaration.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/OrphanRoleDeclaration1.purs view
@@ -0,0 +1,4 @@+-- @shouldFailWith OrphanRoleDeclaration+module Main where++type role D nominal
+ tests/purs/failing/OrphanRoleDeclaration2.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/OrphanRoleDeclaration2.purs:4:1 - 4:20 (line 4, column 1 - line 4, column 20)++ The role declaration for [33mD[0m should follow its definition.+++See https://github.com/purescript/documentation/blob/master/errors/OrphanRoleDeclaration.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/OrphanRoleDeclaration2.purs view
@@ -0,0 +1,5 @@+-- @shouldFailWith OrphanRoleDeclaration+module Main where++type role D nominal+data D a = D a
+ tests/purs/failing/OrphanRoleDeclaration3.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/OrphanRoleDeclaration3.purs:8:1 - 8:21 (line 8, column 1 - line 8, column 21)++ The role declaration for [33mD1[0m should follow its definition.+++See https://github.com/purescript/documentation/blob/master/errors/OrphanRoleDeclaration.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/OrphanRoleDeclaration3.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith OrphanRoleDeclaration+module Main where++data D1 a = D1 a++data D2 a = D2 a++type role D1 nominal
+ tests/purs/failing/OrphanTypeDecl.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mOrphanTypeDecl[0m+at tests/purs/failing/OrphanTypeDecl.purs:4:1 - 4:24 (line 4, column 1 - line 4, column 24)++ The type declaration for [33mfn[0m should be followed by its definition.+++See https://github.com/purescript/documentation/blob/master/errors/OrphanTypeDeclaration.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/OrphanTypeDecl.purs view
@@ -0,0 +1,4 @@+-- @shouldFailWith OrphanTypeDeclaration+module OrphanTypeDecl where++fn :: Number -> Boolean
+ tests/purs/failing/OrphanUnnamedInstance.out view
@@ -0,0 +1,18 @@+Error found:+in module [33mTest[0m+at tests/purs/failing/OrphanUnnamedInstance.purs:6:1 - 7:11 (line 6, column 1 - line 7, column 11)++ Orphan instance found for+ [33m [0m+ [33m Class.C Boolean[0m+ [33m [0m+ This problem can be resolved by declaring the instance in [33mClass[0m, or by defining the instance on a newtype wrapper.++in type class instance+[33m [0m+[33m Class.C Boolean[0m+[33m [0m++See https://github.com/purescript/documentation/blob/master/errors/OrphanInstance.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/OrphanUnnamedInstance.purs view
@@ -0,0 +1,7 @@+-- @shouldFailWith OrphanInstance+module Test where++import Class++instance C Boolean where+ op a = a
+ tests/purs/failing/OrphanUnnamedInstance/Class.purs view
@@ -0,0 +1,4 @@+module Class where++class C a where+ op :: a -> a
+ tests/purs/failing/OverlapAcrossModules.out view
@@ -0,0 +1,24 @@+Error found:+in module [33mOverlapAcrossModules[0m+at tests/purs/failing/OverlapAcrossModules.purs:6:1 - 6:22 (line 6, column 1 - line 6, column 22)++ Overlapping type class instances found for+ [33m [0m+ [33m OverlapAcrossModules.Class.C X[0m+ [33m Y[0m+ [33m [0m+ The following instances were found:++ [33mOverlapAcrossModules.X.cxy[0m+ [33mOverlapAcrossModules.cxy[0m+++in type class instance+[33m [0m+[33m OverlapAcrossModules.Class.C X[0m+[33m Y[0m+[33m [0m++See https://github.com/purescript/documentation/blob/master/errors/OverlappingInstances.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/OverlapAcrossModules.purs view
@@ -0,0 +1,7 @@+-- @shouldFailWith OverlappingInstances+module OverlapAcrossModules where+import OverlapAcrossModules.Class+import OverlapAcrossModules.X+data Y+instance cxy :: C X Y+
+ tests/purs/failing/OverlapAcrossModules/Class.out view
@@ -0,0 +1,24 @@+Error found:+in module [33mOverlapAcrossModules[0m+at tests/purs/failing/OverlapAcrossModules.purs:6:1 - 6:22 (line 6, column 1 - line 6, column 22)++ Overlapping type class instances found for+ [33m [0m+ [33m OverlapAcrossModules.Class.C X[0m+ [33m Y[0m+ [33m [0m+ The following instances were found:++ OverlapAcrossModules.X.cxy+ OverlapAcrossModules.cxy+++in type class instance+[33m [0m+[33m OverlapAcrossModules.Class.C X[0m+[33m Y[0m+[33m [0m++See https://github.com/purescript/documentation/blob/master/errors/OverlappingInstances.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/OverlapAcrossModules/Class.purs view
@@ -0,0 +1,2 @@+module OverlapAcrossModules.Class where+class C x y
+ tests/purs/failing/OverlapAcrossModules/X.purs view
@@ -0,0 +1,4 @@+module OverlapAcrossModules.X where+import OverlapAcrossModules.Class+data X+instance cxy :: C X y
+ tests/purs/failing/OverlapAcrossModulesUnnamedInstance.out view
@@ -0,0 +1,24 @@+Error found:+in module [33mOverlapAcrossModules[0m+at tests/purs/failing/OverlapAcrossModulesUnnamedInstance.purs:6:1 - 6:15 (line 6, column 1 - line 6, column 15)++ Overlapping type class instances found for+ [33m [0m+ [33m OverlapAcrossModules.Class.C X[0m+ [33m Y[0m+ [33m [0m+ The following instances were found:++ [33mOverlapAcrossModules.X.cX[0m+ instance in module [33mOverlapAcrossModules[0m with type [33mC X Y[0m (line 6, column 1 - line 6, column 15)+++in type class instance+[33m [0m+[33m OverlapAcrossModules.Class.C X[0m+[33m Y[0m+[33m [0m++See https://github.com/purescript/documentation/blob/master/errors/OverlappingInstances.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/OverlapAcrossModulesUnnamedInstance.purs view
@@ -0,0 +1,7 @@+-- @shouldFailWith OverlappingInstances+module OverlapAcrossModules where+import OverlapAcrossModules.Class+import OverlapAcrossModules.X+data Y+instance C X Y+
+ tests/purs/failing/OverlapAcrossModulesUnnamedInstance/Class.out view
@@ -0,0 +1,24 @@+Error found:+in module [33mOverlapAcrossModules[0m+at tests/purs/failing/OverlapAcrossModules.purs:6:1 - 6:22 (line 6, column 1 - line 6, column 22)++ Overlapping type class instances found for+ [33m [0m+ [33m OverlapAcrossModules.Class.C X[0m+ [33m Y[0m+ [33m [0m+ The following instances were found:++ OverlapAcrossModules.X.cxy+ OverlapAcrossModules.cxy+++in type class instance+[33m [0m+[33m OverlapAcrossModules.Class.C X[0m+[33m Y[0m+[33m [0m++See https://github.com/purescript/documentation/blob/master/errors/OverlappingInstances.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/OverlapAcrossModulesUnnamedInstance/Class.purs view
@@ -0,0 +1,2 @@+module OverlapAcrossModules.Class where+class C x y
+ tests/purs/failing/OverlapAcrossModulesUnnamedInstance/X.purs view
@@ -0,0 +1,4 @@+module OverlapAcrossModules.X where+import OverlapAcrossModules.Class+data X+instance C X y
+ tests/purs/failing/OverlappingArguments.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mOverlappingArguments[0m+at tests/purs/failing/OverlappingArguments.purs:6:1 - 6:10 (line 6, column 1 - line 6, column 10)++ Overlapping names in function/binder in declaration f+++See https://github.com/purescript/documentation/blob/master/errors/OverlappingArgNames.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/OverlappingArguments.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith OverlappingArgNames+module OverlappingArguments where++import Prelude++f x x = x
+ tests/purs/failing/OverlappingBinders.out view
@@ -0,0 +1,14 @@+Error found:+in module [33mOverlappingBinders[0m+at tests/purs/failing/OverlappingBinders.purs:8:7 - 9:28 (line 8, column 7 - line 9, column 28)++ Overlapping names in function/binder++while inferring the type of [33m\x -> [0m+ [33m case x of [0m+ [33m (S y (S y@S z zs)) -> y[0m+in value declaration [33mf[0m++See https://github.com/purescript/documentation/blob/master/errors/OverlappingArgNames.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/OverlappingBinders.purs view
@@ -0,0 +1,9 @@+-- @shouldFailWith OverlappingArgNames+module OverlappingBinders where++import Prelude++data S a = S a (S a)++f x = case x of+ (S y (S y@(S z zs))) -> y
+ tests/purs/failing/OverlappingInstances.out view
@@ -0,0 +1,22 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/OverlappingInstances.purs:10:1 - 11:13 (line 10, column 1 - line 11, column 13)++ Overlapping type class instances found for+ [33m [0m+ [33m Main.Test Int[0m+ [33m [0m+ The following instances were found:++ [33mMain.testRefl[0m+ [33mMain.testInt[0m+++in type class instance+[33m [0m+[33m Main.Test Int[0m+[33m [0m++See https://github.com/purescript/documentation/blob/master/errors/OverlappingInstances.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/OverlappingInstances.purs view
@@ -0,0 +1,17 @@+-- @shouldFailWith OverlappingInstances+module Main where++class Test a where+ test :: a -> a++instance testRefl :: Test a where+ test x = x++instance testInt :: Test Int where+ test _ = 0++-- The OverlappingInstances instances error only arises when there are two+-- choices for a dictionary, not when the instances are defined. So without+-- `value` this module would not raise an error.+value :: Int+value = test 1
+ tests/purs/failing/OverlappingUnnamedInstances.out view
@@ -0,0 +1,22 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/OverlappingUnnamedInstances.purs:10:1 - 11:13 (line 10, column 1 - line 11, column 13)++ Overlapping type class instances found for+ [33m [0m+ [33m Main.Test Int[0m+ [33m [0m+ The following instances were found:++ instance in module [33mMain[0m with type [33mforall a. Test a[0m (line 7, column 1 - line 8, column 13)+ instance in module [33mMain[0m with type [33mTest Int[0m (line 10, column 1 - line 11, column 13)+++in type class instance+[33m [0m+[33m Main.Test Int[0m+[33m [0m++See https://github.com/purescript/documentation/blob/master/errors/OverlappingInstances.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/OverlappingUnnamedInstances.purs view
@@ -0,0 +1,17 @@+-- @shouldFailWith OverlappingInstances+module Main where++class Test a where+ test :: a -> a++instance Test a where+ test x = x++instance Test Int where+ test _ = 0++-- The OverlappingInstances instances error only arises when there are two+-- choices for a dictionary, not when the instances are defined. So without+-- `value` this module would not raise an error.+value :: Int+value = test 1
+ tests/purs/failing/OverlappingVars.out view
@@ -0,0 +1,20 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/OverlappingVars.purs:14:8 - 14:20 (line 14, column 8 - line 14, column 20)++ No type class instance was found for+ [33m [0m+ [33m Main.OverlappingVars (Foo String Int)[0m+ [33m [0m++while applying a function [33mf[0m+ of type [33mOverlappingVars t0 => t0 -> t0[0m+ to argument [33m(Foo "") 0[0m+while inferring the type of [33mf ((Foo "") 0)[0m+in value declaration [33mtest[0m++where [33mt0[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/OverlappingVars.purs view
@@ -0,0 +1,14 @@+-- @shouldFailWith NoInstanceFound+module Main where++import Prelude++class OverlappingVars a where+ f :: a -> a++data Foo a b = Foo a b++instance overlappingVarsFoo :: OverlappingVars (Foo a a) where+ f a = a++test = f (Foo "" 0)
+ tests/purs/failing/PASTrumpsKDNU1.out view
@@ -0,0 +1,17 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/PASTrumpsKDNU1.purs:14:33 - 14:43 (line 14, column 33 - line 14, column 43)++ Type synonym [33mData.NaturalTransformation.NaturalTransformation[0m is partially applied.+ Type synonyms must be applied to all of their type arguments.++while checking that type [33mNaturalTransformation Array[0m+ has kind [33mType[0m+while inferring the kind of [33mShow a => NaturalTransformation Array[0m+while inferring the kind of [33mProxy (Show a => NaturalTransformation Array)[0m+while inferring the kind of [33mforall a. Proxy (Show a => NaturalTransformation Array)[0m+in value declaration [33mf[0m++See https://github.com/purescript/documentation/blob/master/errors/PartiallyAppliedSynonym.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/PASTrumpsKDNU1.purs view
@@ -0,0 +1,15 @@+-- @shouldFailWith PartiallyAppliedSynonym+module Main where++import Prelude++-- The PASTrumpsKDNU series of tests check a number of situations in which+-- both PartiallyAppliedSynonym and KindsDoNotUnify would be reasonable+-- errors to show; in these situtations, PartiallyAppliedSynonym is likely to+-- be the more useful error.++data Proxy :: forall k. k -> Type+data Proxy a = Proxy++f :: forall a. Proxy (Show a => (~>) Array)+f = Proxy
+ tests/purs/failing/PASTrumpsKDNU2.out view
@@ -0,0 +1,15 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/PASTrumpsKDNU2.purs:9:19 - 9:29 (line 9, column 19 - line 9, column 29)++ Type synonym [33mData.NaturalTransformation.NaturalTransformation[0m is partially applied.+ Type synonyms must be applied to all of their type arguments.++while checking that type [33mNaturalTransformation Array[0m+ has kind [33mType[0m+while inferring the kind of [33mforall (a :: NaturalTransformation Array). Proxy a -> Proxy a[0m+in value declaration [33mf[0m++See https://github.com/purescript/documentation/blob/master/errors/PartiallyAppliedSynonym.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/PASTrumpsKDNU2.purs view
@@ -0,0 +1,10 @@+-- @shouldFailWith PartiallyAppliedSynonym+module Main where++import Prelude++data Proxy :: forall k. k -> Type+data Proxy a = Proxy++f :: forall (a :: (~>) Array). Proxy a -> Proxy a+f x = x
+ tests/purs/failing/PASTrumpsKDNU3.out view
@@ -0,0 +1,16 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/PASTrumpsKDNU3.purs:9:23 - 9:33 (line 9, column 23 - line 9, column 33)++ Type synonym [33mData.NaturalTransformation.NaturalTransformation[0m is partially applied.+ Type synonyms must be applied to all of their type arguments.++while checking that type [33mNaturalTransformation Array[0m+ has kind [33mType[0m+while inferring the kind of [33mforall a. NaturalTransformation Array[0m+while inferring the kind of [33mProxy (forall a. NaturalTransformation Array)[0m+in value declaration [33mp[0m++See https://github.com/purescript/documentation/blob/master/errors/PartiallyAppliedSynonym.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/PASTrumpsKDNU3.purs view
@@ -0,0 +1,10 @@+-- @shouldFailWith PartiallyAppliedSynonym+module Main where++import Prelude++data Proxy :: forall k. k -> Type+data Proxy a = Proxy++p :: Proxy (forall a. (~>) Array)+p = Proxy
+ tests/purs/failing/PASTrumpsKDNU4.out view
@@ -0,0 +1,14 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/PASTrumpsKDNU4.purs:6:14 - 6:24 (line 6, column 14 - line 6, column 24)++ Type synonym [33mData.NaturalTransformation.NaturalTransformation[0m is partially applied.+ Type synonyms must be applied to all of their type arguments.++while checking that type [33mNaturalTransformation Array[0m+ has kind [33mType[0m+in type constructor [33mD[0m++See https://github.com/purescript/documentation/blob/master/errors/PartiallyAppliedSynonym.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/PASTrumpsKDNU4.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith PartiallyAppliedSynonym+module Main where++import Prelude++data D (a :: (~>) Array) = D
+ tests/purs/failing/PASTrumpsKDNU5.out view
@@ -0,0 +1,14 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/PASTrumpsKDNU5.purs:6:16 - 6:26 (line 6, column 16 - line 6, column 26)++ Type synonym [33mData.NaturalTransformation.NaturalTransformation[0m is partially applied.+ Type synonyms must be applied to all of their type arguments.++while checking that type [33mNaturalTransformation Array[0m+ has kind [33mType[0m+in type constructor [33mN[0m++See https://github.com/purescript/documentation/blob/master/errors/PartiallyAppliedSynonym.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/PASTrumpsKDNU5.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith PartiallyAppliedSynonym+module Main where++import Prelude++newtype N = N ((~>) Array)
+ tests/purs/failing/PASTrumpsKDNU6.out view
@@ -0,0 +1,14 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/PASTrumpsKDNU6.purs:6:14 - 6:24 (line 6, column 14 - line 6, column 24)++ Type synonym [33mData.NaturalTransformation.NaturalTransformation[0m is partially applied.+ Type synonyms must be applied to all of their type arguments.++while checking that type [33mNaturalTransformation Array[0m+ has kind [33mType[0m+in type synonym [33mT[0m++See https://github.com/purescript/documentation/blob/master/errors/PartiallyAppliedSynonym.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/PASTrumpsKDNU6.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith PartiallyAppliedSynonym+module Main where++import Prelude++type T (a :: (~>) Array) = Int
+ tests/purs/failing/PASTrumpsKDNU7.out view
@@ -0,0 +1,14 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/PASTrumpsKDNU7.purs:6:15 - 6:25 (line 6, column 15 - line 6, column 25)++ Type synonym [33mData.NaturalTransformation.NaturalTransformation[0m is partially applied.+ Type synonyms must be applied to all of their type arguments.++while checking that type [33mNaturalTransformation Array[0m+ has kind [33mType[0m+in type constructor [33mC$Dict[0m++See https://github.com/purescript/documentation/blob/master/errors/PartiallyAppliedSynonym.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/PASTrumpsKDNU7.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith PartiallyAppliedSynonym+module Main where++import Prelude++class C (a :: (~>) Array)
+ tests/purs/failing/PolykindGeneralizationLet.out view
@@ -0,0 +1,24 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/PolykindGeneralizationLet.purs:14:10 - 14:26 (line 14, column 10 - line 14, column 26)++ Could not match type+ [33m [0m+ [33m "foo"[0m+ [33m [0m+ with type+ [33m [0m+ [33m Int[0m+ [33m [0m++while trying to match type [33mt0 "foo"[0m+ with type [33mProxy @Type Int[0m+while checking that expression [33mProxy[0m+ has type [33mProxy @Type Int[0m+in value declaration [33mtest[0m++where [33mt0[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/PolykindGeneralizationLet.purs view
@@ -0,0 +1,14 @@+-- @shouldFailWith TypesDoNotUnify+module Main where++data Proxy a = Proxy+data F f a = F (f a)++fproxy :: forall f a. Proxy f -> Proxy a -> Proxy (F f a)+fproxy _ _ = Proxy++test = c+ where+ a = fproxy (Proxy :: _ Proxy)+ b = a (Proxy :: _ Int)+ c = a (Proxy :: _ "foo")
+ tests/purs/failing/PolykindInstanceOverlapping.out view
@@ -0,0 +1,22 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/PolykindInstanceOverlapping.purs:12:1 - 13:19 (line 12, column 1 - line 13, column 19)++ Overlapping type class instances found for+ [33m [0m+ [33m Main.ShowP (Proxy a)[0m+ [33m [0m+ The following instances were found:++ [33mMain.test1[0m+ [33mMain.test2[0m+++in type class instance+[33m [0m+[33m Main.ShowP (Proxy (a :: k))[0m+[33m [0m++See https://github.com/purescript/documentation/blob/master/errors/OverlappingInstances.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/PolykindInstanceOverlapping.purs view
@@ -0,0 +1,13 @@+-- @shouldFailWith OverlappingInstances+module Main where++data Proxy a = Proxy++class ShowP a where+ showP :: a -> String++instance test1 :: ShowP (Proxy ((a) :: k)) where+ showP _ = "Type"++instance test2 :: ShowP (Proxy ((a) :: k)) where+ showP _ = "Type"
+ tests/purs/failing/PolykindInstantiatedInstance.out view
@@ -0,0 +1,25 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/PolykindInstantiatedInstance.purs:12:26 - 12:42 (line 12, column 26 - line 12, column 42)++ Could not match kind+ [33m [0m+ [33m Symbol[0m+ [33m [0m+ with kind+ [33m [0m+ [33m Type[0m+ [33m [0m++while trying to match type [33m"foo"[0m+ with type [33mt1[0m+while checking that expression [33mProxy[0m+ has type [33mt0 t1[0m+in value declaration [33mtest1[0m++where [33mt0[0m is an unknown type+ [33mt1[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/KindsDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/PolykindInstantiatedInstance.purs view
@@ -0,0 +1,12 @@+-- @shouldFailWith KindsDoNotUnify+module Main where++data Proxy a = Proxy++class F f where+ f :: forall a b. (a -> b) -> f a -> f b++instance fProxy :: F Proxy where+ f _ _ = Proxy++test1 = f (\a -> "foo") (Proxy :: _ "foo")
+ tests/purs/failing/PolykindInstantiation.out view
@@ -0,0 +1,22 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/PolykindInstantiation.purs:8:33 - 8:38 (line 8, column 33 - line 8, column 38)++ Could not match kind+ [33m [0m+ [33m Symbol[0m+ [33m [0m+ with kind+ [33m [0m+ [33m Type[0m+ [33m [0m++while checking that type [33m"foo"[0m+ has kind [33mType[0m+while inferring the kind of [33mF Proxy "foo"[0m+while inferring the kind of [33mProxy (F Proxy "foo")[0m+in value declaration [33mtest2[0m++See https://github.com/purescript/documentation/blob/master/errors/KindsDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/PolykindInstantiation.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith KindsDoNotUnify+module Main where++data Proxy a = Proxy+data F f (a :: Type) = F (f a)++test1 = Proxy :: Proxy (F Proxy Int)+test2 = Proxy :: Proxy (F Proxy "foo")
+ tests/purs/failing/PolykindUnnamedInstanceOverlapping.out view
@@ -0,0 +1,22 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/PolykindUnnamedInstanceOverlapping.purs:12:1 - 13:19 (line 12, column 1 - line 13, column 19)++ Overlapping type class instances found for+ [33m [0m+ [33m Main.ShowP (Proxy a)[0m+ [33m [0m+ The following instances were found:++ instance in module [33mMain[0m with type [33mforall a. ShowP (Proxy a)[0m (line 9, column 1 - line 10, column 19)+ instance in module [33mMain[0m with type [33mforall a. ShowP (Proxy a)[0m (line 12, column 1 - line 13, column 19)+++in type class instance+[33m [0m+[33m Main.ShowP (Proxy (a :: k))[0m+[33m [0m++See https://github.com/purescript/documentation/blob/master/errors/OverlappingInstances.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/PolykindUnnamedInstanceOverlapping.purs view
@@ -0,0 +1,13 @@+-- @shouldFailWith OverlappingInstances+module Main where++data Proxy a = Proxy++class ShowP a where+ showP :: a -> String++instance ShowP (Proxy ((a) :: k)) where+ showP _ = "Type"++instance ShowP (Proxy ((a) :: k)) where+ showP _ = "Type"
+ tests/purs/failing/PossiblyInfiniteCoercibleInstance.out view
@@ -0,0 +1,25 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/PossiblyInfiniteCoercibleInstance.purs:9:12 - 9:18 (line 9, column 12 - line 9, column 18)++ A [33mCoercible[0m instance is possibly infinite.++while solving type class constraint+[33m [0m+[33m Prim.Coerce.Coercible (N a0)[0m+[33m (N b1)[0m+[33m [0m+while checking that type [33mforall (a :: Type) (b :: Type). Coercible @Type a b => a -> b[0m+ is at least as general as type [33mN a0 -> N b1[0m+while checking that expression [33mcoerce[0m+ has type [33mN a0 -> N b1[0m+in value declaration [33minfinite[0m++where [33ma0[0m is a rigid type variable+ bound at (line 9, column 12 - line 9, column 18)+ [33mb1[0m is a rigid type variable+ bound at (line 9, column 12 - line 9, column 18)++See https://github.com/purescript/documentation/blob/master/errors/PossiblyInfiniteCoercibleInstance.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/PossiblyInfiniteCoercibleInstance.purs view
@@ -0,0 +1,9 @@+-- @shouldFailWith PossiblyInfiniteCoercibleInstance+module Main where++import Safe.Coerce (coerce)++newtype N a = N (a -> N a)++infinite :: forall a b. N a -> N b+infinite = coerce
+ tests/purs/failing/PrimModuleReserved.out view
@@ -0,0 +1,10 @@+Error found:+at tests/purs/failing/PrimModuleReserved/Prim.purs:1:1 - 1:18 (line 1, column 1 - line 1, column 18)++ The module name [33mPrim[0m is in the Prim namespace.+ The Prim namespace is reserved for compiler-defined terms.+++See https://github.com/purescript/documentation/blob/master/errors/CannotDefinePrimModules.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/PrimModuleReserved.purs view
@@ -0,0 +1,4 @@+-- @shouldFailWith CannotDefinePrimModules+module Main where++import Prim
+ tests/purs/failing/PrimModuleReserved/Prim.purs view
@@ -0,0 +1,1 @@+module Prim where
+ tests/purs/failing/PrimRow.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/PrimRow.purs:8:6 - 8:42 (line 8, column 6 - line 8, column 42)++ Unknown type class [33mCons[0m+++See https://github.com/purescript/documentation/blob/master/errors/UnknownName.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/PrimRow.purs view
@@ -0,0 +1,11 @@+-- @shouldFailWith UnknownName+module Main where++import Prelude++-- The 'Cons' class is not imported here, so we should not be able to refer to+-- it in the module.+x :: Cons "hello" Int () ("hello" :: Int)+ => Unit+x = unit+
+ tests/purs/failing/PrimSubModuleReserved.out view
@@ -0,0 +1,10 @@+Error found:+at tests/purs/failing/PrimSubModuleReserved/Prim_Foobar.purs:1:1 - 1:25 (line 1, column 1 - line 1, column 25)++ The module name [33mPrim.Foobar[0m is in the Prim namespace.+ The Prim namespace is reserved for compiler-defined terms.+++See https://github.com/purescript/documentation/blob/master/errors/CannotDefinePrimModules.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/PrimSubModuleReserved.purs view
@@ -0,0 +1,4 @@+-- @shouldFailWith CannotDefinePrimModules+module Main where++import Prim.Foobar
+ tests/purs/failing/PrimSubModuleReserved/Prim_Foobar.out view
@@ -0,0 +1,10 @@+Error found:+at tests/purs/failing/PrimSubModuleReserved/Prim_Foobar.purs:1:1 - 1:25 (line 1, column 1 - line 1, column 25)++ The module name [33mPrim.Foobar[0m is in the Prim namespace.+ The Prim namespace is reserved for compiler-defined terms.+++See https://github.com/purescript/documentation/blob/master/errors/CannotDefinePrimModules.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/PrimSubModuleReserved/Prim_Foobar.purs view
@@ -0,0 +1,1 @@+module Prim.Foobar where
+ tests/purs/failing/ProgrammablePolykindedTypeErrorsTypeString.out view
@@ -0,0 +1,18 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/ProgrammablePolykindedTypeErrorsTypeString.purs:23:7 - 23:17 (line 23, column 7 - line 23, column 17)++ Custom error:++ Don't want to show Just @Type String because.+++while checking that type [33mFail (Beside (Beside (Text "Don\'t want to show ") (... ...)) (Text " because.")) => String[0m+ is at least as general as type [33mString[0m+while checking that expression [33msomeString[0m+ has type [33mString[0m+in value declaration [33mmain[0m++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ProgrammablePolykindedTypeErrorsTypeString.purs view
@@ -0,0 +1,23 @@+-- @shouldFailWith NoInstanceFound++module Main where++import Prelude+import Prim.TypeError+import Effect (Effect)+import Effect.Console (log)++data Maybe :: forall k. k -> Type+data Maybe a++foreign import data Nothing :: forall k. Maybe k+foreign import data Just :: forall k. k -> Maybe k++someString :: Fail (Text "Don't want to show " <> Quote (Just String) <> Text " because.") => String+someString = "someString"++infixl 6 type Beside as <>++main :: Effect Unit+main = do+ log someString
+ tests/purs/failing/ProgrammableTypeErrors.out view
@@ -0,0 +1,28 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/ProgrammableTypeErrors.purs:17:13 - 17:27 (line 17, column 13 - line 17, column 27)++ Custom error:++ Cannot show functions+++while solving type class constraint+[33m [0m+[33m Main.MyShow (Int -> Int)[0m+[33m [0m+while applying a function [33mmyShow[0m+ of type [33mMyShow t0 => t0 -> String[0m+ to argument [33m\$1 -> [0m+ [33m (add $1) 1[0m+while checking that expression [33mmyShow (\$1 -> [0m+ [33m (add $1) 1[0m+ [33m ) [0m+ has type [33mString[0m+in value declaration [33mmain[0m++where [33mt0[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ProgrammableTypeErrors.purs view
@@ -0,0 +1,17 @@+-- @shouldFailWith NoInstanceFound++module Main where++import Prelude+import Prim.TypeError+import Effect (Effect)+import Effect.Console (log)++class MyShow a where+ myShow :: a -> String++instance cannotShowFunctions :: Fail (Text "Cannot show functions") => MyShow (a -> b) where+ myShow _ = "unreachable"++main :: Effect Unit+main = log (myShow (_ + 1))
+ tests/purs/failing/ProgrammableTypeErrorsTypeString.out view
@@ -0,0 +1,25 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/ProgrammableTypeErrorsTypeString.purs:24:9 - 24:24 (line 24, column 9 - line 24, column 24)++ Custom error:++ Don't want to show MyType Int because.+++while solving type class constraint+[33m [0m+[33m Data.Show.Show (MyType Int)[0m+[33m [0m+while applying a function [33mshow[0m+ of type [33mShow t0 => t0 -> String[0m+ to argument [33mMyType 2[0m+while checking that expression [33mshow (MyType 2)[0m+ has type [33mString[0m+in value declaration [33mmain[0m++where [33mt0[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ProgrammableTypeErrorsTypeString.purs view
@@ -0,0 +1,24 @@+-- @shouldFailWith NoInstanceFound++module Main where++import Prelude+import Prim.TypeError+import Effect (Effect)+import Effect.Console (log)++newtype MyType a = MyType a++instance cannotShowFunctions ::+ Fail ( Text "Don't want to show " <>+ Quote (MyType a) <>+ Text " because."+ ) => Show (MyType a)+ where+ show _ = "unreachable"++infixl 6 type Beside as <>++main :: Effect Unit+main = do+ log $ show (MyType 2)
+ tests/purs/failing/QualifiedOperators.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/QualifiedOperators.purs:4:10 - 4:21 (line 4, column 10 - line 4, column 21)++ Unknown module [33mFoo.Bar[0m+++See https://github.com/purescript/documentation/blob/master/errors/UnknownName.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/QualifiedOperators.purs view
@@ -0,0 +1,4 @@+-- @shouldFailWith UnknownName+module Main where++test = 4 Foo.Bar.-#- 10
+ tests/purs/failing/QualifiedOperators2.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/QualifiedOperators2.purs:4:8 - 4:21 (line 4, column 8 - line 4, column 21)++ Unknown module [33mFoo.Bar[0m+++See https://github.com/purescript/documentation/blob/master/errors/UnknownName.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/QualifiedOperators2.purs view
@@ -0,0 +1,4 @@+-- @shouldFailWith UnknownName+module Main where++test = Foo.Bar.(-#-) 4 10
+ tests/purs/failing/QuantificationCheckFailure.out view
@@ -0,0 +1,12 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/QuantificationCheckFailure.purs:13:48 - 13:69 (line 13, column 48 - line 13, column 69)++ Cannot generalize the kind of type variable [33md[0m since it would not be well-scoped.+ Try adding a kind annotation.++in kind declaration for [33mT[0m++See https://github.com/purescript/documentation/blob/master/errors/QuantificationCheckFailureInKind.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/QuantificationCheckFailure.purs view
@@ -0,0 +1,14 @@+-- @shouldFailWith QuantificationCheckFailureInKind+module Main where++data Proxy :: forall k. k -> Type+data Proxy a = Proxy++data Relate :: forall a (b :: a). a -> Proxy b -> Type+data Relate x y = Relate++-- Inferring and generalizing the kind of `d` such that implicitly generalized+-- variables appear first would result in a reference to `a` before `a` is+-- declared. See "Kind Inference for Datatypes" Section 7.2+data T :: forall (a :: Type) (b :: a) (c :: a) d. Relate b d -> Type+data T a = T
+ tests/purs/failing/QuantificationCheckFailure2.out view
@@ -0,0 +1,16 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/QuantificationCheckFailure2.purs:6:13 - 6:30 (line 6, column 13 - line 6, column 30)++ Cannot unambiguously generalize kinds appearing in the elaborated type:++ [33mforall (a :: t8). Proxy @t8 a[0m++ where [33mt8[0m is an unknown kind.+ Try adding additional kind signatures or polymorphic kind variables.++in type constructor [33mP[0m++See https://github.com/purescript/documentation/blob/master/errors/QuantificationCheckFailureInType.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/QuantificationCheckFailure2.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith QuantificationCheckFailureInType+module Main where++data Proxy a = Proxy++data P = P (forall a. Proxy a)
+ tests/purs/failing/QuantificationCheckFailure3.out view
@@ -0,0 +1,12 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/QuantificationCheckFailure3.purs:7:1 - 7:34 (line 7, column 1 - line 7, column 34)++ Visible dependent quantification of type variable [33mk[0m is not supported.+ If you would like this feature supported, please bother Liam Goodacre (@LiamGoodacre).++in type synonym [33mHmm[0m++See https://github.com/purescript/documentation/blob/master/errors/VisibleQuantificationCheckFailureInType.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/QuantificationCheckFailure3.purs view
@@ -0,0 +1,7 @@+-- @shouldFailWith VisibleQuantificationCheckFailureInType+module Main where++foreign import data KProxy :: forall (k :: Type) . k -> Type+foreign import data TProxy :: forall (k :: Type) (t :: k) . KProxy t++type Hmm k = (TProxy :: KProxy k)
+ tests/purs/failing/QuantifiedKind.out view
@@ -0,0 +1,15 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/QuantifiedKind.purs:6:22 - 6:23 (line 6, column 22 - line 6, column 23)++ Type variable [33mk[0m is undefined.++while inferring the kind of [33mk[0m+while checking that type [33mk[0m+ has kind [33mType[0m+while inferring the kind of [33mforall (a :: k) k. Proxy a[0m+in value declaration [33mtest[0m++See https://github.com/purescript/documentation/blob/master/errors/UndefinedTypeVariable.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/QuantifiedKind.purs view
@@ -0,0 +1,7 @@+-- @shouldFailWith UndefinedTypeVariable+module Main where++data Proxy a = Proxy++test :: forall (a :: k) k. Proxy a+test = Proxy
+ tests/purs/failing/Rank2Types.out view
@@ -0,0 +1,25 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/Rank2Types.purs:8:25 - 8:26 (line 8, column 25 - line 8, column 26)++ Could not match type+ [33m [0m+ [33m Int[0m+ [33m [0m+ with type+ [33m [0m+ [33m a0[0m+ [33m [0m++while checking that type [33mInt[0m+ is at least as general as type [33ma0[0m+while checking that expression [33m1[0m+ has type [33ma0[0m+in value declaration [33mtest1[0m++where [33ma0[0m is a rigid type variable+ bound at (line 8, column 14 - line 8, column 27)++See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/Rank2Types.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith TypesDoNotUnify+module Main where++import Prelude++foreign import test :: (forall a. a -> a) -> Number++test1 = test (\n -> n + 1)
+ tests/purs/failing/RecordLabelOnTypeError.out view
@@ -0,0 +1,26 @@+Error found:+in module [33mRecordLabelOnTypeError[0m+at tests/purs/failing/RecordLabelOnTypeError.purs:8:5 - 8:6 (line 8, column 5 - line 8, column 6)++ Could not match type+ [33m [0m+ [33m Int[0m+ [33m [0m+ with type+ [33m [0m+ [33m String[0m+ [33m [0m++while matching label [33mfield[0m+while checking that type [33m{ field :: Int[0m+ [33m} [0m+ is at least as general as type [33m{ field :: String[0m+ [33m} [0m+while checking that expression [33ma[0m+ has type [33m{ field :: String[0m+ [33m} [0m+in value declaration [33mb[0m++See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/RecordLabelOnTypeError.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith TypesDoNotUnify+module RecordLabelOnTypeError where++a :: { field :: Int }+a = { field: 1 }++b :: { field :: String }+b = a -- this should trigger an error, telling us the `field` tag where the type discrepancy happened
+ tests/purs/failing/RecordLabelOnTypeErrorImmediate.out view
@@ -0,0 +1,22 @@+Error found:+in module [33mNestedRecordLabelOnTypeError[0m+at tests/purs/failing/RecordLabelOnTypeErrorImmediate.purs:5:15 - 5:18 (line 5, column 15 - line 5, column 18)++ Could not match type+ [33m [0m+ [33m String[0m+ [33m [0m+ with type+ [33m [0m+ [33m Int[0m+ [33m [0m++while checking that type [33mString[0m+ is at least as general as type [33mInt[0m+while checking that expression [33m"a"[0m+ has type [33mInt[0m+in value declaration [33mrecord[0m++See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/RecordLabelOnTypeErrorImmediate.purs view
@@ -0,0 +1,5 @@+-- @shouldFailWith TypesDoNotUnify+module NestedRecordLabelOnTypeError where++record :: { a :: Int }+record = { a: "a" } -- Triggers an error, but the label is explicitly not added since it caused other errors to be worse. See https://github.com/purescript/purescript/pull/4411 for more information.
+ tests/purs/failing/RequiredHiddenType.out view
@@ -0,0 +1,13 @@+Error found:+in module [33mFoo[0m+at tests/purs/failing/RequiredHiddenType.purs:3:1 - 9:6 (line 3, column 1 - line 9, column 6)++ An export for [33ma[0m requires the following to also be exported:++ [33mA[0m++++See https://github.com/purescript/documentation/blob/master/errors/TransitiveExportError.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/RequiredHiddenType.purs view
@@ -0,0 +1,9 @@+-- @shouldFailWith TransitiveExportError+-- exporting `a` should fail as `A` is hidden+module Foo (B(..), a, b) where++data A = A+data B = B++a = A+b = B
+ tests/purs/failing/Reserved.out view
@@ -0,0 +1,10 @@+Error found:+at tests/purs/failing/Reserved.purs:6:1 - 6:4 (line 6, column 1 - line 6, column 4)++ Unable to parse module:+ Unexpected token '(<)'+++See https://github.com/purescript/documentation/blob/master/errors/ErrorParsingModule.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/Reserved.purs view
@@ -0,0 +1,7 @@+-- @shouldFailWith ErrorParsingModule+module Main where++import Prelude++(<) :: Number -> Number -> Number+(<) a b = !(a >= b)
+ tests/purs/failing/RoleDeclarationArityMismatch.out view
@@ -0,0 +1,11 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/RoleDeclarationArityMismatch.purs:5:1 - 5:20 (line 5, column 1 - line 5, column 20)++ The type [33mA[0m expects 0 arguments but its role declaration lists 1 role.++in role declaration for [33mA[0m++See https://github.com/purescript/documentation/blob/master/errors/RoleDeclarationArityMismatch.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/RoleDeclarationArityMismatch.purs view
@@ -0,0 +1,5 @@+-- @shouldFailWith RoleDeclarationArityMismatch+module Main where++data A = A+type role A nominal
+ tests/purs/failing/RoleDeclarationArityMismatchForeign.out view
@@ -0,0 +1,11 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/RoleDeclarationArityMismatchForeign.purs:5:1 - 5:20 (line 5, column 1 - line 5, column 20)++ The type [33mA[0m expects 0 arguments but its role declaration lists 1 role.++in role declaration for [33mA[0m++See https://github.com/purescript/documentation/blob/master/errors/RoleDeclarationArityMismatch.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/RoleDeclarationArityMismatchForeign.purs view
@@ -0,0 +1,5 @@+-- @shouldFailWith RoleDeclarationArityMismatch+module Main where++foreign import data A :: Type+type role A nominal
+ tests/purs/failing/RoleDeclarationArityMismatchForeign2.out view
@@ -0,0 +1,11 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/RoleDeclarationArityMismatchForeign2.purs:5:1 - 5:20 (line 5, column 1 - line 5, column 20)++ The type [33mA[0m expects 2 arguments but its role declaration lists only 1 role.++in role declaration for [33mA[0m++See https://github.com/purescript/documentation/blob/master/errors/RoleDeclarationArityMismatch.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/RoleDeclarationArityMismatchForeign2.purs view
@@ -0,0 +1,5 @@+-- @shouldFailWith RoleDeclarationArityMismatch+module Main where++foreign import data A :: Type -> (Type -> Type)+type role A nominal
+ tests/purs/failing/RoleDeclarationArityMismatchForeign3.out view
@@ -0,0 +1,11 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/RoleDeclarationArityMismatchForeign3.purs:5:1 - 5:20 (line 5, column 1 - line 5, column 20)++ The type [33mA[0m expects 2 arguments but its role declaration lists only 1 role.++in role declaration for [33mA[0m++See https://github.com/purescript/documentation/blob/master/errors/RoleDeclarationArityMismatch.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/RoleDeclarationArityMismatchForeign3.purs view
@@ -0,0 +1,5 @@+-- @shouldFailWith RoleDeclarationArityMismatch+module Main where++foreign import data A :: (Type -> Type -> Type)+type role A nominal
+ tests/purs/failing/RoleDeclarationArityMismatchForeign4.out view
@@ -0,0 +1,11 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/RoleDeclarationArityMismatchForeign4.purs:7:1 - 7:20 (line 7, column 1 - line 7, column 20)++ The type [33mA[0m expects 2 arguments but its role declaration lists only 1 role.++in role declaration for [33mA[0m++See https://github.com/purescript/documentation/blob/master/errors/RoleDeclarationArityMismatch.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/RoleDeclarationArityMismatchForeign4.purs view
@@ -0,0 +1,7 @@+-- @shouldFailWith RoleDeclarationArityMismatch+module Main where++type To = Function++foreign import data A :: To Type (To Type Type)+type role A nominal
+ tests/purs/failing/RowConstructors1.out view
@@ -0,0 +1,21 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/RowConstructors1.purs:7:16 - 7:19 (line 7, column 16 - line 7, column 19)++ Could not match kind+ [33m [0m+ [33m Type[0m+ [33m [0m+ with kind+ [33m [0m+ [33m Row Type[0m+ [33m [0m++while checking that type [33mFoo[0m+ has kind [33mRow Type[0m+while inferring the kind of [33mRecord Foo[0m+in type synonym [33mBaz[0m++See https://github.com/purescript/documentation/blob/master/errors/KindsDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/RowConstructors1.purs view
@@ -0,0 +1,9 @@+-- @shouldFailWith KindsDoNotUnify+module Main where++import Effect.Console (log)++data Foo = Bar+type Baz = { | Foo }++main = log "Done"
+ tests/purs/failing/RowConstructors2.out view
@@ -0,0 +1,15 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/RowConstructors2.purs:7:16 - 7:19 (line 7, column 16 - line 7, column 19)++ Type synonym [33mMain.Foo[0m is partially applied.+ Type synonyms must be applied to all of their type arguments.++while checking that type [33mFoo[0m+ has kind [33mRow Type[0m+while inferring the kind of [33mRecord Foo[0m+in type synonym [33mBar[0m++See https://github.com/purescript/documentation/blob/master/errors/PartiallyAppliedSynonym.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/RowConstructors2.purs view
@@ -0,0 +1,9 @@+-- @shouldFailWith PartiallyAppliedSynonym+module Main where++import Effect.Console (log)++type Foo r = (x :: Number | r)+type Bar = { | Foo }++main = log "Done"
+ tests/purs/failing/RowConstructors3.out view
@@ -0,0 +1,21 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/RowConstructors3.purs:7:16 - 7:19 (line 7, column 16 - line 7, column 19)++ Could not match kind+ [33m [0m+ [33m Type[0m+ [33m [0m+ with kind+ [33m [0m+ [33m Row Type[0m+ [33m [0m++while checking that type [33mFoo[0m+ has kind [33mRow Type[0m+while inferring the kind of [33mRecord Foo[0m+in type synonym [33mBar[0m++See https://github.com/purescript/documentation/blob/master/errors/KindsDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/RowConstructors3.purs view
@@ -0,0 +1,9 @@+-- @shouldFailWith KindsDoNotUnify+module Main where++import Effect.Console (log)++type Foo = { x :: Number }+type Bar = { | Foo }++main = log "Done"
+ tests/purs/failing/RowInInstanceNotDetermined0.out view
@@ -0,0 +1,19 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/RowInInstanceNotDetermined0.purs:8:1 - 8:24 (line 8, column 1 - line 8, column 24)++ Type class instance head is invalid due to use of type+ [33m [0m+ [33m ()[0m+ [33m [0m+ All types appearing in instance declarations must be of the form T a_1 .. a_n, where each type a_i is of the same form, unless the type is fully determined by other type class arguments via functional dependencies.++in type class instance+[33m [0m+[33m Main.C Unit [0m+[33m (Record ())[0m+[33m [0m++See https://github.com/purescript/documentation/blob/master/errors/InvalidInstanceHead.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/RowInInstanceNotDetermined0.purs view
@@ -0,0 +1,9 @@+-- @shouldFailWith InvalidInstanceHead+module Main where++import Prelude++-- no fundeps+class C a b+instance c :: C Unit {}+
+ tests/purs/failing/RowInInstanceNotDetermined1.out view
@@ -0,0 +1,20 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/RowInInstanceNotDetermined1.purs:8:1 - 8:29 (line 8, column 1 - line 8, column 29)++ Type class instance head is invalid due to use of type+ [33m [0m+ [33m ()[0m+ [33m [0m+ All types appearing in instance declarations must be of the form T a_1 .. a_n, where each type a_i is of the same form, unless the type is fully determined by other type class arguments via functional dependencies.++in type class instance+[33m [0m+[33m Main.C Unit [0m+[33m Unit [0m+[33m (Record ())[0m+[33m [0m++See https://github.com/purescript/documentation/blob/master/errors/InvalidInstanceHead.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/RowInInstanceNotDetermined1.purs view
@@ -0,0 +1,9 @@+-- @shouldFailWith InvalidInstanceHead+module Main where++import Prelude++-- `c` not mentioned in any fundeps+class C a b c | a -> b+instance c :: C Unit Unit {}+
+ tests/purs/failing/RowInInstanceNotDetermined2.out view
@@ -0,0 +1,19 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/RowInInstanceNotDetermined2.purs:8:1 - 8:24 (line 8, column 1 - line 8, column 24)++ Type class instance head is invalid due to use of type+ [33m [0m+ [33m ()[0m+ [33m [0m+ All types appearing in instance declarations must be of the form T a_1 .. a_n, where each type a_i is of the same form, unless the type is fully determined by other type class arguments via functional dependencies.++in type class instance+[33m [0m+[33m Main.C Unit [0m+[33m (Record ())[0m+[33m [0m++See https://github.com/purescript/documentation/blob/master/errors/InvalidInstanceHead.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/RowInInstanceNotDetermined2.purs view
@@ -0,0 +1,9 @@+-- @shouldFailWith InvalidInstanceHead+module Main where++import Prelude++-- `b` isn't determined by anything that `b` doesn't determine+class C a b | a -> b, b -> a+instance c :: C Unit {}+
+ tests/purs/failing/RowLacks.out view
@@ -0,0 +1,28 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/RowLacks.purs:16:9 - 16:66 (line 16, column 9 - line 16, column 66)++ No type class instance was found for+ [33m [0m+ [33m Prim.Row.Lacks "x" [0m+ [33m ( x :: Int [0m+ [33m , y :: Int [0m+ [33m , z :: String[0m+ [33m ) [0m+ [33m [0m++while applying a function [33mlacksX[0m+ of type [33mLacks @t1 "x" t2 => Proxy @(Row t1) t2 -> Proxy @(Row t3) (() @t3)[0m+ to argument [33mProxy[0m+while checking that expression [33mlacksX Proxy[0m+ has type [33mProxy @(Row t0) (() @t0)[0m+in value declaration [33mtest1[0m++where [33mt0[0m is an unknown type+ [33mt1[0m is an unknown type+ [33mt3[0m is an unknown type+ [33mt2[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/RowLacks.purs view
@@ -0,0 +1,18 @@+-- @shouldFailWith NoInstanceFound+module Main where++import Effect.Console (log)+import Prim.Row (class Lacks)+import Type.Proxy (Proxy(..))++lacksX+ :: forall r+ . Lacks "x" r+ => Proxy r+ -> Proxy ()+lacksX _ = Proxy++test1 :: Proxy ()+test1 = lacksX (Proxy :: Proxy (x :: Int, y :: Int, z :: String))++main = log "Done"
+ tests/purs/failing/RowsInKinds.out view
@@ -0,0 +1,28 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/RowsInKinds.purs:14:16 - 14:17 (line 14, column 16 - line 14, column 17)++ Could not match kind+ [33m [0m+ [33m ( z :: Type[0m+ [33m | t25 [0m+ [33m ) [0m+ [33m [0m+ with kind+ [33m [0m+ [33m ( x :: Type[0m+ [33m , y :: Type[0m+ [33m ) [0m+ [33m [0m++while checking that type [33mZ[0m+ has kind [33mR @Type [0m+ [33m ( x :: Type[0m+ [33m , y :: Type[0m+ [33m ) [0m+while inferring the kind of [33mP Z[0m+in type synonym [33mTest3[0m++See https://github.com/purescript/documentation/blob/master/errors/KindsDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/RowsInKinds.purs view
@@ -0,0 +1,15 @@+-- @shouldFailWith KindsDoNotUnify+module Main where++foreign import data R :: forall k. Row k -> Type+foreign import data X :: forall r. R (x :: Type | r)+foreign import data Y :: forall r. R (y :: Type | r)+foreign import data Z :: forall r. R (z :: Type | r)++data P :: R (x :: Type, y :: Type) -> Type+data P a = P++type Test1 = P X+type Test2 = P Y+type Test3 = P Z+
+ tests/purs/failing/ScopedKindVariableSynonym.out view
@@ -0,0 +1,12 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/ScopedKindVariableSynonym.purs:7:14 - 7:15 (line 7, column 14 - line 7, column 15)++ Type variable [33ma[0m is undefined.++while inferring the kind of [33ma[0m+in type synonym [33mB[0m++See https://github.com/purescript/documentation/blob/master/errors/UndefinedTypeVariable.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/ScopedKindVariableSynonym.purs view
@@ -0,0 +1,7 @@+-- @shouldFailWith UndefinedTypeVariable+module Main where++type A x = forall a. a -> x -> Type++type B :: forall x. A x+type B y z = a
+ tests/purs/failing/SelfCycleInForeignDataKinds.out view
@@ -0,0 +1,9 @@+Error found:+at tests/purs/failing/SelfCycleInForeignDataKinds.purs:4:1 - 4:31 (line 4, column 1 - line 4, column 31)++ A kind declaration '[33mFoo[0m' may not refer to itself in its own signature.+++See https://github.com/purescript/documentation/blob/master/errors/CycleInKindDeclaration.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/SelfCycleInForeignDataKinds.purs view
@@ -0,0 +1,4 @@+-- @shouldFailWith CycleInKindDeclaration+module Main where++foreign import data Foo :: Foo
+ tests/purs/failing/SelfCycleInKindDeclaration.out view
@@ -0,0 +1,9 @@+Error found:+at tests/purs/failing/SelfCycleInKindDeclaration.purs:4:1 - 4:24 (line 4, column 1 - line 4, column 24)++ A kind declaration '[33mFoo[0m' may not refer to itself in its own signature.+++See https://github.com/purescript/documentation/blob/master/errors/CycleInKindDeclaration.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/SelfCycleInKindDeclaration.purs view
@@ -0,0 +1,5 @@+-- @shouldFailWith CycleInKindDeclaration+module Main where++data Foo :: Foo -> Type+data Foo a = Foo
+ tests/purs/failing/SelfCycleInTypeClassDeclaration.out view
@@ -0,0 +1,9 @@+Error found:+at tests/purs/failing/SelfCycleInTypeClassDeclaration.purs:4:1 - 4:23 (line 4, column 1 - line 4, column 23)++ A type class '[33mFoo[0m' may not have itself as a superclass.+++See https://github.com/purescript/documentation/blob/master/errors/CycleInTypeClassDeclaration.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/SelfCycleInTypeClassDeclaration.purs view
@@ -0,0 +1,4 @@+-- @shouldFailWith CycleInTypeClassDeclaration+module Main where++class (Foo a) <= Foo a
+ tests/purs/failing/SelfImport.out view
@@ -0,0 +1,9 @@+Error found:+at tests/purs/failing/SelfImport.purs:3:1 - 9:12 (line 3, column 1 - line 9, column 12)++ Module [33mMain[0m imports itself.+++See https://github.com/purescript/documentation/blob/master/errors/CycleInModules.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/SelfImport.purs view
@@ -0,0 +1,9 @@+-- @shouldFailWith CycleInModules++module Main where++import Main as M++foo = 0++bar = M.foo
+ tests/purs/failing/SelfImport/Dummy.out view
@@ -0,0 +1,9 @@+Error found:+at tests/purs/failing/SelfImport.purs:3:1 - 9:12 (line 3, column 1 - line 9, column 12)++ Module [33mMain[0m imports itself.+++See https://github.com/purescript/documentation/blob/master/errors/CycleInModules.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/SelfImport/Dummy.purs view
@@ -0,0 +1,5 @@+-- This module only exists so that we perform a full build for the+-- SelfImport.purs module. If this module didn't exist, we would perform a+-- single-module fast rebuild, which doesn't perform the `sortModules` step,+-- and so the error we want to see wouldn't be emitted.+module Dummy where
+ tests/purs/failing/SkolemEscape.out view
@@ -0,0 +1,20 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/SkolemEscape.purs:8:1 - 8:19 (line 8, column 1 - line 8, column 19)++ The type variable [33ma[0m, bound at++ tests/purs/failing/SkolemEscape.purs:8:18 - 8:19 (line 8, column 18 - line 8, column 19)++ has escaped its scope, appearing in the type+ [33m [0m+ [33m (a0 -> a0) -> Number[0m+ [33m [0m++in the expression [33m[33m\x -> [0m[0m+ [33m[33m foo x[0m[0m+in value declaration [33mtest[0m++See https://github.com/purescript/documentation/blob/master/errors/EscapedSkolem.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/SkolemEscape.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith EscapedSkolem+module Main where++import Prelude++foreign import foo :: (forall a. a -> a) -> Number++test = \x -> foo x
+ tests/purs/failing/SkolemEscape2.out view
@@ -0,0 +1,22 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/SkolemEscape2.purs:9:1 - 11:9 (line 9, column 1 - line 11, column 9)++ The type variable [33mr[0m, bound at++ tests/purs/failing/SkolemEscape2.purs:10:21 - 10:34 (line 10, column 21 - line 10, column 34)++ has escaped its scope, appearing in the type+ [33m [0m+ [33m t1 -> t2 (STRef r0 Int)[0m+ [33m [0m++in the expression [33m[33m\$0 -> [0m[0m+ [33m[33m ((bind $dictBind1) ((...) (...))) (\r -> [0m[0m+ [33m[33m (...) r[0m[0m+ [33m[33m ) [0m[0m+in value declaration [33mtest[0m++See https://github.com/purescript/documentation/blob/master/errors/EscapedSkolem.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/SkolemEscape2.purs view
@@ -0,0 +1,11 @@+-- @shouldFailWith EscapedSkolem+module Main where++import Prelude+import Effect+import Control.Monad.ST as ST+import Control.Monad.ST.Ref as STRef++test _ = do+ r <- pure (ST.run (STRef.new 0))+ pure r
+ tests/purs/failing/SkolemEscapeKinds.out view
@@ -0,0 +1,18 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/SkolemEscapeKinds.purs:8:10 - 8:17 (line 8, column 10 - line 8, column 17)++ The type variable [33mk[0m, bound at++ tests/purs/failing/SkolemEscapeKinds.purs:8:16 - 8:17 (line 8, column 16 - line 8, column 17)++ has escaped its scope, appearing in the type+ [33m [0m+ [33m Proxy[0m+ [33m [0m++in type synonym [33mB[0m++See https://github.com/purescript/documentation/blob/master/errors/EscapedSkolem.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/SkolemEscapeKinds.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith EscapedSkolem+module Main where++data Proxy a = Proxy++data A (a :: forall k. k -> Type) = A++type B = Proxy A
+ tests/purs/failing/StandaloneKindSignatures1.out view
@@ -0,0 +1,21 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/StandaloneKindSignatures1.purs:7:25 - 7:30 (line 7, column 25 - line 7, column 30)++ Could not match kind+ [33m [0m+ [33m Symbol[0m+ [33m [0m+ with kind+ [33m [0m+ [33m Type[0m+ [33m [0m++while checking that type [33m"foo"[0m+ has kind [33mType[0m+while inferring the kind of [33mPair Int "foo"[0m+in value declaration [33mtest[0m++See https://github.com/purescript/documentation/blob/master/errors/KindsDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/StandaloneKindSignatures1.purs view
@@ -0,0 +1,7 @@+-- @shouldFailWith KindsDoNotUnify+module Main where++data Pair :: forall k. k -> k -> Type+data Pair a b = Pair++test = Pair :: Pair Int "foo"
+ tests/purs/failing/StandaloneKindSignatures2.out view
@@ -0,0 +1,21 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/StandaloneKindSignatures2.purs:8:35 - 8:36 (line 8, column 35 - line 8, column 36)++ Could not match kind+ [33m [0m+ [33m k2[0m+ [33m [0m+ with kind+ [33m [0m+ [33m k1[0m+ [33m [0m++while checking that type [33mb[0m+ has kind [33mk1[0m+while inferring the kind of [33mPair a b[0m+in type constructor [33mPair'[0m++See https://github.com/purescript/documentation/blob/master/errors/KindsDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/StandaloneKindSignatures2.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith KindsDoNotUnify+module Main where++data Pair :: forall k. k -> k -> Type+data Pair a b = Pair++newtype Pair' :: forall k1 k2. k1 -> k2 -> Type+newtype Pair' a b = Pair' (Pair a b)
+ tests/purs/failing/StandaloneKindSignatures3.out view
@@ -0,0 +1,21 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/StandaloneKindSignatures3.purs:7:18 - 7:23 (line 7, column 18 - line 7, column 23)++ Could not match kind+ [33m [0m+ [33m Symbol[0m+ [33m [0m+ with kind+ [33m [0m+ [33m Type[0m+ [33m [0m++while checking that type [33m"foo"[0m+ has kind [33mType[0m+while inferring the kind of [33mFst Int "foo"[0m+in type synonym [33mF[0m++See https://github.com/purescript/documentation/blob/master/errors/KindsDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/StandaloneKindSignatures3.purs view
@@ -0,0 +1,7 @@+-- @shouldFailWith KindsDoNotUnify+module Main where++type Fst :: forall k. k -> k -> k+type Fst a b = a++type F = Fst Int "foo"
+ tests/purs/failing/StandaloneKindSignatures4.out view
@@ -0,0 +1,25 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/StandaloneKindSignatures4.purs:7:24 - 7:29 (line 7, column 24 - line 7, column 29)++ Could not match kind+ [33m [0m+ [33m Symbol[0m+ [33m [0m+ with kind+ [33m [0m+ [33m Type[0m+ [33m [0m++while checking that type [33m"foo"[0m+ has kind [33mType[0m+while inferring the kind of [33mTo Int "foo"[0m+in type class instance+[33m [0m+[33m Main.To Int [0m+[33m "foo"[0m+[33m [0m++See https://github.com/purescript/documentation/blob/master/errors/KindsDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/StandaloneKindSignatures4.purs view
@@ -0,0 +1,7 @@+-- @shouldFailWith KindsDoNotUnify+module Main where++class To :: forall k. k -> k -> Constraint+class To a b | a -> b++instance to1 :: To Int "foo"
+ tests/purs/failing/SuggestComposition.out view
@@ -0,0 +1,32 @@+Error found:+in module [33mSuggestComposition[0m+at tests/purs/failing/SuggestComposition.purs:7:5 - 7:6 (line 7, column 5 - line 7, column 6)++ Could not match type+ [33m [0m+ [33m Record[0m+ [33m [0m+ with type+ [33m [0m+ [33m Function Int[0m+ [33m [0m++while trying to match type [33m{ g :: t0[0m+ [33m| t1 [0m+ [33m} [0m+ with type [33mt2 -> t3[0m+while checking that expression [33mg[0m+ has type [33m{ g :: t0[0m+ [33m| t1 [0m+ [33m} [0m+while checking type of property accessor [33mg.g[0m+in value declaration [33mf[0m++where [33mt2[0m is an unknown type+ [33mt3[0m is an unknown type+ [33mt0[0m is an unknown type+ [33mt1[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/SuggestComposition.purs view
@@ -0,0 +1,7 @@+-- @shouldFailWith TypesDoNotUnify+-- TODO: Ensure the correct suggestion is produced.+module SuggestComposition where++import Prelude++f = g . g where g = (_ + 1)
+ tests/purs/failing/Superclasses1.out view
@@ -0,0 +1,18 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/Superclasses1.purs:12:1 - 13:17 (line 12, column 1 - line 13, column 17)++ No type class instance was found for+ [33m [0m+ [33m Main.Su Number[0m+ [33m [0m++while checking that expression [33m#dict Su[0m+ has type [33mSu$Dict t0[0m+in value declaration [33mclNumber[0m++where [33mt0[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/Superclasses1.purs view
@@ -0,0 +1,14 @@+-- @shouldFailWith NoInstanceFound+module Main where++import Prelude++class Su a where+ su :: a -> a++class (Su a) <= Cl a where+ cl :: a -> a -> a++instance clNumber :: Cl Number where+ cl n m = n + m+
+ tests/purs/failing/Superclasses2.out view
@@ -0,0 +1,13 @@+Error found:+at tests/purs/failing/Superclasses2.purs:6:1 - 6:23 (line 6, column 1 - line 6, column 23)++ A cycle appears in a set of type class definitions:++ {[33mBar[0m, [33mFoo[0m}++ Cycles are disallowed because they can lead to loops in the type checker.+++See https://github.com/purescript/documentation/blob/master/errors/CycleInTypeClassDeclaration.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/Superclasses2.purs view
@@ -0,0 +1,12 @@+-- @shouldFailWith CycleInTypeClassDeclaration+module CycleInSuperclasses where++import Prelude++class (Foo a) <= Bar a++class (Bar a) <= Foo a++instance barString :: Bar String++instance fooString :: Foo String
+ tests/purs/failing/Superclasses3.out view
@@ -0,0 +1,22 @@+Error found:+in module [33mUnknownSuperclassTypeVar[0m+at tests/purs/failing/Superclasses3.purs:8:12 - 8:13 (line 8, column 12 - line 8, column 13)++ Type variable [33mb[0m is undefined.++while inferring the kind of [33mb[0m+while checking that type [33mb[0m+ has kind [33mt0[0m+while inferring the kind of [33mFoo$Dict b[0m+while inferring the kind of [33mRecord () -> Foo$Dict b[0m+while inferring the kind of [33m( "Foo0" :: Record () -> Foo$Dict b[0m+ [33m) [0m+while inferring the kind of [33m{ "Foo0" :: Record () -> Foo$Dict b[0m+ [33m} [0m+in type constructor [33mBar$Dict[0m++where [33mt0[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/UndefinedTypeVariable.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/Superclasses3.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith UndefinedTypeVariable+module UnknownSuperclassTypeVar where++import Prelude++class Foo a++class (Foo b) <= Bar a
+ tests/purs/failing/Superclasses5.out view
@@ -0,0 +1,22 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/Superclasses5.purs:17:1 - 18:18 (line 17, column 1 - line 18, column 18)++ A case expression could not be determined to cover all inputs.+ The following additional cases are required to cover all inputs:++ [33m_[0m++ Alternatively, add a Partial constraint to the type of the enclosing value.++while checking that expression [33mcase $0 of [0m+ [33m [ x ] -> [ su x[0m+ [33m ] [0m+ has type [33mt0[0m+in value declaration [33msuArray[0m++where [33mt0[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/Superclasses5.purs view
@@ -0,0 +1,26 @@+-- @shouldFailWith NoInstanceFound++module Main where++import Prelude+import Effect.Console (logShow)++class Su a where+ su :: a -> a++class Su (Array a) <= Cl a where+ cl :: a -> a -> a++instance suNumber :: Su Number where+ su n = n + 1.0++instance suArray :: Su a => Su (Array a) where+ su [x] = [su x]++instance clNumber :: Cl Number where+ cl n m = n + m++test :: forall a. Cl a => a -> Array a+test x = su [cl x x]++main = logShow $ test 10.0
+ tests/purs/failing/TooFewClassInstanceArgs.out view
@@ -0,0 +1,15 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/TooFewClassInstanceArgs.purs:8:1 - 8:33 (line 8, column 1 - line 8, column 33)++ The type class [33mMain.Foo[0m expects 2 arguments.+ But the instance [33mfooString[0m only provided 1.++in type class instance+[33m [0m+[33m Main.Foo String[0m+[33m [0m++See https://github.com/purescript/documentation/blob/master/errors/ClassInstanceArityMismatch.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/TooFewClassInstanceArgs.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith ClassInstanceArityMismatch+module Main where++import Prelude++class Foo a b++instance fooString :: Foo String
+ tests/purs/failing/TooFewUnnamedClassInstanceArgs.out view
@@ -0,0 +1,15 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/TooFewUnnamedClassInstanceArgs.purs:8:1 - 8:20 (line 8, column 1 - line 8, column 20)++ The type class [33mMain.Foo[0m expects 2 arguments.+ But the instance only provided 1.++in type class instance+[33m [0m+[33m Main.Foo String[0m+[33m [0m++See https://github.com/purescript/documentation/blob/master/errors/ClassInstanceArityMismatch.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/TooFewUnnamedClassInstanceArgs.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith ClassInstanceArityMismatch+module Main where++import Prelude++class Foo a b++instance Foo String
+ tests/purs/failing/TopLevelCaseNoArgs.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/TopLevelCaseNoArgs.purs:7:1 - 7:8 (line 7, column 1 - line 7, column 8)++ Multiple value declarations exist for [33mfoo[0m.+++See https://github.com/purescript/documentation/blob/master/errors/DuplicateValueDeclaration.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/TopLevelCaseNoArgs.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith DuplicateValueDeclaration+module Main where++import Prelude++foo :: Number+foo = 1+foo = 2
+ tests/purs/failing/TransitiveDctorExport.out view
@@ -0,0 +1,13 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/TransitiveDctorExport.purs:2:1 - 5:13 (line 2, column 1 - line 5, column 13)++ An export for [33mY[0m requires the following to also be exported:++ [33mX[0m++++See https://github.com/purescript/documentation/blob/master/errors/TransitiveExportError.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/TransitiveDctorExport.purs view
@@ -0,0 +1,5 @@+-- @shouldFailWith TransitiveExportError+module Main (Y(..)) where++type X = Int+data Y = Y X
+ tests/purs/failing/TransitiveDctorExportError.out view
@@ -0,0 +1,13 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/TransitiveDctorExportError.purs:2:1 - 4:15 (line 2, column 1 - line 4, column 15)++ An export for [33mT[0m requires the following data constructor to also be exported:++ [33mB[0m++++See https://github.com/purescript/documentation/blob/master/errors/TransitiveDctorExportError.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/TransitiveDctorExportError.purs view
@@ -0,0 +1,4 @@+-- @shouldFailWith TransitiveDctorExportError+module Main (T(A)) where++data T = A | B
+ tests/purs/failing/TransitiveKindExport.out view
@@ -0,0 +1,13 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/TransitiveKindExport.purs:2:1 - 6:39 (line 2, column 1 - line 6, column 39)++ An export for [33mTestProxy[0m requires the following to also be exported:++ [33mTest[0m++++See https://github.com/purescript/documentation/blob/master/errors/TransitiveExportError.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/TransitiveKindExport.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith TransitiveExportError+module Main (TestProxy(..)) where++data Test++data TestProxy (p :: Test) = TestProxy
+ tests/purs/failing/TransitiveSynonymExport.out view
@@ -0,0 +1,13 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/TransitiveSynonymExport.purs:2:1 - 5:11 (line 2, column 1 - line 5, column 11)++ An export for [33mY[0m requires the following to also be exported:++ [33mX[0m++++See https://github.com/purescript/documentation/blob/master/errors/TransitiveExportError.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/TransitiveSynonymExport.purs view
@@ -0,0 +1,5 @@+-- @shouldFailWith TransitiveExportError+module Main (Y()) where++type X = Int+type Y = X
+ tests/purs/failing/TypeClasses2.out view
@@ -0,0 +1,20 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/TypeClasses2.purs:7:8 - 7:22 (line 7, column 8 - line 7, column 22)++ No type class instance was found for+ [33m [0m+ [33m Main.Show String[0m+ [33m [0m++while applying a function [33mshow[0m+ of type [33mShow t0 => t0 -> String[0m+ to argument [33m"testing"[0m+while inferring the type of [33mshow "testing"[0m+in value declaration [33mtest[0m++where [33mt0[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/TypeClasses2.purs view
@@ -0,0 +1,7 @@+-- @shouldFailWith NoInstanceFound+module Main where++class Show a where+ show :: a -> String++test = show "testing"
+ tests/purs/failing/TypeError.out view
@@ -0,0 +1,22 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/TypeError.purs:6:13 - 6:16 (line 6, column 13 - line 6, column 16)++ Could not match type+ [33m [0m+ [33m String[0m+ [33m [0m+ with type+ [33m [0m+ [33m Int[0m+ [33m [0m++while checking that type [33mString[0m+ is at least as general as type [33mInt[0m+while checking that expression [33m"A"[0m+ has type [33mInt[0m+in value declaration [33mtest[0m++See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/TypeError.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith TypesDoNotUnify+module Main where++import Prelude++test = 1 <> "A"
+ tests/purs/failing/TypeOperatorAliasNoExport.out view
@@ -0,0 +1,13 @@+Error found:+in module [33mTest[0m+at tests/purs/failing/TypeOperatorAliasNoExport.purs:2:1 - 6:25 (line 2, column 1 - line 6, column 25)++ An export for [33mtype (×)[0m requires the following to also be exported:++ [33mTuple[0m++++See https://github.com/purescript/documentation/blob/master/errors/TransitiveExportError.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/TypeOperatorAliasNoExport.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith TransitiveExportError+module Test (type (×)) where++data Tuple a b = Tuple a b++infixl 6 type Tuple as ×
+ tests/purs/failing/TypeSynonymCycle.out view
@@ -0,0 +1,14 @@+Error found:+at tests/purs/failing/TypeSynonymCycle.purs:4:1 - 4:11 (line 4, column 1 - line 4, column 11)++ A cycle appears in a set of type synonym definitions:++ {[33mA[0m, [33mB[0m}++ Cycles are disallowed because they can lead to loops in the type checker.+ Consider using a 'newtype' instead.+++See https://github.com/purescript/documentation/blob/master/errors/CycleInTypeSynonym.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/TypeSynonymCycle.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith CycleInTypeSynonym+module Main where++type A = B+type B = { a :: A, b :: Loop }+data Loop = Loop B
+ tests/purs/failing/TypeSynonyms.out view
@@ -0,0 +1,14 @@+Error found:+at tests/purs/failing/TypeSynonyms.purs:6:1 - 6:19 (line 6, column 1 - line 6, column 19)++ A cycle appears in a set of type synonym definitions:++ {[33mT1[0m, [33mT2[0m}++ Cycles are disallowed because they can lead to loops in the type checker.+ Consider using a 'newtype' instead.+++See https://github.com/purescript/documentation/blob/master/errors/CycleInTypeSynonym.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/TypeSynonyms.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith CycleInTypeSynonym+module Main where++import Prelude++type T1 = Array T2++type T2 = T1
+ tests/purs/failing/TypeSynonyms10.out view
@@ -0,0 +1,21 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/TypeSynonyms10.purs:8:19 - 8:23 (line 8, column 19 - line 8, column 23)++ Could not match kind+ [33m [0m+ [33m (Type -> Type) -> Type[0m+ [33m [0m+ with kind+ [33m [0m+ [33m Type[0m+ [33m [0m++while checking that type [33mNaturalTransformation Array[0m+ has kind [33mType[0m+while inferring the kind of [33mF (NaturalTransformation Array)[0m+in type constructor [33mN[0m++See https://github.com/purescript/documentation/blob/master/errors/KindsDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/TypeSynonyms10.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith KindsDoNotUnify+module Main where++import Prelude++type F (a :: Type) = a++newtype N = N (F ((~>) Array))
+ tests/purs/failing/TypeSynonyms4.out view
@@ -0,0 +1,12 @@+Error found:+in module [33mTypeSynonyms4[0m+at tests/purs/failing/TypeSynonyms4.purs:8:12 - 8:15 (line 8, column 12 - line 8, column 15)++ Type synonym [33mTypeSynonyms4.F[0m is partially applied.+ Type synonyms must be applied to all of their type arguments.++in type synonym [33mG[0m++See https://github.com/purescript/documentation/blob/master/errors/PartiallyAppliedSynonym.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/TypeSynonyms4.purs view
@@ -0,0 +1,11 @@+-- @shouldFailWith PartiallyAppliedSynonym+module TypeSynonyms4 where++import Prelude++type F x y = x -> y++type G x = F x++f :: G String String -> String+f k = k "Done"
+ tests/purs/failing/TypeSynonyms5.out view
@@ -0,0 +1,11 @@+Error found:+at tests/purs/failing/TypeSynonyms5.purs:6:1 - 6:11 (line 6, column 1 - line 6, column 11)++ A cycle appears in the definition of type synonym [33mT[0m+ Cycles are disallowed because they can lead to loops in the type checker.+ Consider using a 'newtype' instead.+++See https://github.com/purescript/documentation/blob/master/errors/CycleInTypeSynonym.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/TypeSynonyms5.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith CycleInTypeSynonym+module Main where++import Prelude++type T = T
+ tests/purs/failing/TypeSynonyms7.out view
@@ -0,0 +1,20 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/TypeSynonyms7.purs:8:1 - 9:14 (line 8, column 1 - line 9, column 14)++ Type class instance head is invalid due to use of type+ [33m [0m+ [33m ( x :: Int[0m+ [33m | r [0m+ [33m ) [0m+ [33m [0m+ All types appearing in instance declarations must be of the form T a_1 .. a_n, where each type a_i is of the same form, unless the type is fully determined by other type class arguments via functional dependencies.++in type class instance+[33m [0m+[33m Data.Show.Show (X r)[0m+[33m [0m++See https://github.com/purescript/documentation/blob/master/errors/InvalidInstanceHead.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/TypeSynonyms7.purs view
@@ -0,0 +1,9 @@+-- @shouldFailWith InvalidInstanceHead+module Main where++import Prelude++type X r = {x :: Int | r}++instance showX :: Show (X r) where+ show _ = ""
+ tests/purs/failing/TypeSynonyms8.out view
@@ -0,0 +1,14 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/TypeSynonyms8.purs:6:15 - 6:16 (line 6, column 15 - line 6, column 16)++ Type synonym [33mMain.S[0m is partially applied.+ Type synonyms must be applied to all of their type arguments.++while checking that type [33mS[0m+ has kind [33mType[0m+in type constructor [33mN[0m++See https://github.com/purescript/documentation/blob/master/errors/PartiallyAppliedSynonym.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/TypeSynonyms8.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith PartiallyAppliedSynonym+module Main where++data D a+type S a = D a+newtype N = N S
+ tests/purs/failing/TypeSynonyms9.out view
@@ -0,0 +1,15 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/TypeSynonyms9.purs:7:19 - 7:29 (line 7, column 19 - line 7, column 29)++ Type synonym [33mData.NaturalTransformation.NaturalTransformation[0m is partially applied.+ Type synonyms must be applied to all of their type arguments.++while checking that type [33mNaturalTransformation Array[0m+ has kind [33m(Type -> Type) -> Type -> Type[0m+while inferring the kind of [33mA (NaturalTransformation Array)[0m+in type constructor [33mB[0m++See https://github.com/purescript/documentation/blob/master/errors/PartiallyAppliedSynonym.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/TypeSynonyms9.purs view
@@ -0,0 +1,7 @@+-- @shouldFailWith PartiallyAppliedSynonym+module Main where++import Prelude++newtype A (a :: (Type -> Type) -> Type -> Type) = A String+newtype B = B (A ((~>) Array))
+ tests/purs/failing/TypeSynonymsOverlappingInstance.out view
@@ -0,0 +1,24 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/TypeSynonymsOverlappingInstance.purs:14:1 - 15:16 (line 14, column 1 - line 15, column 16)++ Overlapping type class instances found for+ [33m [0m+ [33m Main.Convert String[0m+ [33m String[0m+ [33m [0m+ The following instances were found:++ [33mMain.convertSB[0m+ [33mMain.convertSS[0m+++in type class instance+[33m [0m+[33m Main.Convert String[0m+[33m String[0m+[33m [0m++See https://github.com/purescript/documentation/blob/master/errors/OverlappingInstances.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/TypeSynonymsOverlappingInstance.purs view
@@ -0,0 +1,15 @@+-- @shouldFailWith OverlappingInstances+module Main where++import Prelude++class Convert a b | a -> b where+ convert :: a -> b++type Bar = String++instance convertSB :: Convert String Bar where+ convert s = s++instance convertSS :: Convert String String where+ convert s = s
+ tests/purs/failing/TypeSynonymsOverlappingUnnamedInstance.out view
@@ -0,0 +1,24 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/TypeSynonymsOverlappingUnnamedInstance.purs:14:1 - 15:16 (line 14, column 1 - line 15, column 16)++ Overlapping type class instances found for+ [33m [0m+ [33m Main.Convert String[0m+ [33m String[0m+ [33m [0m+ The following instances were found:++ instance in module [33mMain[0m with type [33mConvert String String[0m (line 11, column 1 - line 12, column 16)+ instance in module [33mMain[0m with type [33mConvert String String[0m (line 14, column 1 - line 15, column 16)+++in type class instance+[33m [0m+[33m Main.Convert String[0m+[33m String[0m+[33m [0m++See https://github.com/purescript/documentation/blob/master/errors/OverlappingInstances.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/TypeSynonymsOverlappingUnnamedInstance.purs view
@@ -0,0 +1,15 @@+-- @shouldFailWith OverlappingInstances+module Main where++import Prelude++class Convert a b | a -> b where+ convert :: a -> b++type Bar = String++instance Convert String Bar where+ convert s = s++instance Convert String String where+ convert s = s
+ tests/purs/failing/TypeWildcards1.out view
@@ -0,0 +1,10 @@+Error found:+at tests/purs/failing/TypeWildcards1.purs:6:13 - 6:14 (line 6, column 13 - line 6, column 14)++ Unable to parse module:+ Unexpected wildcard in type; type wildcards are only allowed in value annotations+++See https://github.com/purescript/documentation/blob/master/errors/ErrorParsingModule.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/TypeWildcards1.purs view
@@ -0,0 +1,7 @@+-- @shouldFailWith ErrorParsingModule+module TypeWildcards where++import Prelude++type Test = _+
+ tests/purs/failing/TypeWildcards2.out view
@@ -0,0 +1,10 @@+Error found:+at tests/purs/failing/TypeWildcards2.purs:6:18 - 6:19 (line 6, column 18 - line 6, column 19)++ Unable to parse module:+ Unexpected wildcard in type; type wildcards are only allowed in value annotations+++See https://github.com/purescript/documentation/blob/master/errors/ErrorParsingModule.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/TypeWildcards2.purs view
@@ -0,0 +1,7 @@+-- @shouldFailWith ErrorParsingModule+module TypeWildcards where++import Prelude++data Test = Test _+
+ tests/purs/failing/TypeWildcards3.out view
@@ -0,0 +1,18 @@+Error found:+in module [33mTypeWildcards[0m+at tests/purs/failing/TypeWildcards3.purs:8:1 - 9:19 (line 8, column 1 - line 9, column 19)++ Type class instance head is invalid due to use of type+ [33m [0m+ [33m _[0m+ [33m [0m+ All types appearing in instance declarations must be of the form T a_1 .. a_n, where each type a_i is of the same form, unless the type is fully determined by other type class arguments via functional dependencies.++in type class instance+[33m [0m+[33m Data.Show.Show (Foo _)[0m+[33m [0m++See https://github.com/purescript/documentation/blob/master/errors/InvalidInstanceHead.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/TypeWildcards3.purs view
@@ -0,0 +1,9 @@+-- @shouldFailWith InvalidInstanceHead+module TypeWildcards where++import Prelude++data Foo a = Foo++instance showFoo :: Show (Foo _) where+ show Foo = "Foo"
+ tests/purs/failing/TypeWildcards4.out view
@@ -0,0 +1,10 @@+Error found:+at tests/purs/failing/TypeWildcards4.purs:4:23 - 4:24 (line 4, column 23 - line 4, column 24)++ Unable to parse module:+ Unexpected wildcard in type; type wildcards are only allowed in value annotations+++See https://github.com/purescript/documentation/blob/master/errors/ErrorParsingModule.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/TypeWildcards4.purs view
@@ -0,0 +1,4 @@+-- @shouldFailWith ErrorParsingModule+module Main where++type OhNo = ((Int) :: _)
+ tests/purs/failing/TypedBinders.out view
@@ -0,0 +1,10 @@+Error found:+at tests/purs/failing/TypedBinders.purs:6:12 - 6:14 (line 6, column 12 - line 6, column 14)++ Unable to parse module:+ Unexpected token '::'+++See https://github.com/purescript/documentation/blob/master/errors/ErrorParsingModule.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/TypedBinders.purs view
@@ -0,0 +1,10 @@+-- @shouldFailWith ErrorParsingModule+module Main where++import Effect.Console (log)++test = (\f :: Int -> Int -> f 10) identity++main = do+ let t1 = test+ log "Done"
+ tests/purs/failing/TypedBinders2.out view
@@ -0,0 +1,30 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/TypedBinders2.purs:8:3 - 8:14 (line 8, column 3 - line 8, column 14)++ Could not match type+ [33m [0m+ [33m Unit[0m+ [33m [0m+ with type+ [33m [0m+ [33m String[0m+ [33m [0m++while checking that expression [33mcase $0 of [0m+ [33m s -> log "Done"[0m+ has type [33mEffect t2[0m+while applying a function [33m(bind (#dict Bind t1)) (log "Foo")[0m+ of type [33m(t0 -> t1 t2) -> t1 t2[0m+ to argument [33m\$0 -> [0m+ [33m case $0 of [0m+ [33m s -> log "Done"[0m+in value declaration [33mmain[0m++where [33mt1[0m is an unknown type+ [33mt0[0m is an unknown type+ [33mt2[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/TypedBinders2.purs view
@@ -0,0 +1,9 @@+-- @shouldFailWith TypesDoNotUnify+module Main where++import Prelude+import Effect.Console (log)++main = do+ s :: String <- log "Foo"+ log "Done"
+ tests/purs/failing/TypedBinders3.out view
@@ -0,0 +1,21 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/TypedBinders3.purs:8:4 - 8:15 (line 8, column 4 - line 8, column 15)++ Could not match type+ [33m [0m+ [33m Int[0m+ [33m [0m+ with type+ [33m [0m+ [33m String[0m+ [33m [0m++while inferring the type of [33mcase 1 of [0m+ [33m 0 -> true [0m+ [33m _ -> false[0m+in value declaration [33mtest[0m++See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/TypedBinders3.purs view
@@ -0,0 +1,13 @@+-- @shouldFailWith TypesDoNotUnify+module Main where++import Prelude+import Effect.Console (log)++test = case 1 of+ (0 :: String) -> true+ _ -> false++main = do+ let t = test+ log "Done"
+ tests/purs/failing/TypedHole.out view
@@ -0,0 +1,23 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/TypedHole.purs:8:8 - 8:13 (line 8, column 8 - line 8, column 13)++ Hole '[33mummm[0m' has the inferred type+ [33m [0m+ [33m Effect Unit[0m+ [33m [0m+ You could substitute the hole with one of these values:+ [33m [0m+ [33m Data.Monoid.mempty :: forall @m. Monoid m => m [0m+ [33m Effect.Class.Console.clear :: forall m. MonadEffect m => m Unit[0m+ [33m Effect.Class.Console.groupEnd :: forall m. MonadEffect m => m Unit[0m+ [33m Effect.Console.clear :: Effect Unit [0m+ [33m Effect.Console.groupEnd :: Effect Unit [0m+ [33m Main.main :: Effect Unit [0m+ [33m [0m++in value declaration [33mmain[0m++See https://github.com/purescript/documentation/blob/master/errors/HoleInferredType.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/TypedHole.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith HoleInferredType+module Main where++import Prelude+import Effect (Effect)++main :: Effect Unit+main = ?ummm
+ tests/purs/failing/TypedHole2.out view
@@ -0,0 +1,14 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/TypedHole2.purs:7:16 - 7:21 (line 7, column 16 - line 7, column 21)++ Hole '[33mummm[0m' has the inferred type+ [33m [0m+ [33m Unit[0m+ [33m [0m++in value declaration [33mmain[0m++See https://github.com/purescript/documentation/blob/master/errors/HoleInferredType.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/TypedHole2.purs view
@@ -0,0 +1,8 @@+-- @shouldFailWith HoleInferredType+module Main where++import Prelude+import Effect (Effect)++main :: Effect ?ummm+main = pure unit
+ tests/purs/failing/TypedHole3.out view
@@ -0,0 +1,34 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/TypedHole3.purs:4:10 - 4:15 (line 4, column 10 - line 4, column 15)++ Hole '[33mhelp[0m' has the inferred type+ [33m [0m+ [33m t0[0m+ [33m [0m+ You could substitute the hole with one of these values:+ [33m [0m+ [33m Control.Alt.alt :: forall @f a. Alt f => f a -> f a -> f a [0m+ [33m Control.Alternative.guard :: forall m. Alternative m => Boolean -> m Unit [0m+ [33m Control.Applicative.liftA1 :: forall f a b. Applicative f => (a -> b) -> f a -> f b [0m+ [33m Control.Applicative.pure :: forall @f a. Applicative f => a -> f a [0m+ [33m Control.Applicative.unless :: forall m. Applicative m => Boolean -> m Unit -> m Unit [0m+ [33m Control.Applicative.when :: forall m. Applicative m => Boolean -> m Unit -> m Unit [0m+ [33m Control.Apply.apply :: forall @f a b. Apply f => f (a -> b) -> f a -> f b [0m+ [33m Control.Apply.applyFirst :: forall a b f. Apply f => f a -> f b -> f a [0m+ [33m Control.Apply.applySecond :: forall a b f. Apply f => f a -> f b -> f b [0m+ [33m Control.Apply.lift2 :: forall a b c f. Apply f => (a -> b -> c) -> f a -> ... -> ... [0m+ [33m Control.Apply.lift3 :: forall a b c d f. Apply f => (a -> b -> ...) -> f a -> ... -> ... [0m+ [33m Control.Apply.lift4 :: forall a b c d e f. Apply f => (a -> b -> ...) -> f a -> ... -> ... [0m+ [33m Control.Apply.lift5 :: forall a b c d e f g. Apply f => (a -> b -> ...) -> f a -> ... -> ...[0m+ [33m Control.Biapplicative.bipure :: forall @w a b. Biapplicative w => a -> b -> w a b [0m+ [33m Control.Biapply.biapply :: forall @w a b c d. Biapply w => w (a -> b) (c -> d) -> w a c -> w b d[0m+ [33m [0m++in value declaration [33mfn[0m++where [33mt0[0m is an unknown type++See https://github.com/purescript/documentation/blob/master/errors/HoleInferredType.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/TypedHole3.purs view
@@ -0,0 +1,4 @@+-- @shouldFailWith HoleInferredType+module Main where++fn _ _ = ?help
+ tests/purs/failing/TypedHole4.out view
@@ -0,0 +1,52 @@+Error 1 of 2:++ in module [33mMain[0m+ at tests/purs/failing/TypedHole4.purs:8:9 - 8:14 (line 8, column 9 - line 8, column 14)++ Hole '[33mhelp[0m' has the inferred type+ [33m [0m+ [33m a0[0m+ [33m [0m+ You could substitute the hole with one of these values:+ [33m [0m+ [33m b :: a0[0m+ [33m [0m+ in the following context:++ b :: [33ma0[0m+++ in value declaration [33mf[0m++ where [33ma0[0m is a rigid type variable+ bound at (line 0, column 0 - line 0, column 0)++ See https://github.com/purescript/documentation/blob/master/errors/HoleInferredType.md for more information,+ or to contribute content related to this error.++Error 2 of 2:++ in module [33mMain[0m+ at tests/purs/failing/TypedHole4.purs:9:9 - 9:14 (line 9, column 9 - line 9, column 14)++ Hole '[33mhelp[0m' has the inferred type+ [33m [0m+ [33m a0[0m+ [33m [0m+ You could substitute the hole with one of these values:+ [33m [0m+ [33m b :: a0[0m+ [33m [0m+ in the following context:++ b :: [33ma0[0m+++ in value declaration [33mf[0m++ where [33ma0[0m is a rigid type variable+ bound at (line 0, column 0 - line 0, column 0)++ See https://github.com/purescript/documentation/blob/master/errors/HoleInferredType.md for more information,+ or to contribute content related to this error.+
+ tests/purs/failing/TypedHole4.purs view
@@ -0,0 +1,9 @@+-- @shouldFailWith HoleInferredType+-- @shouldFailWith HoleInferredType+module Main where++data F = X | Y++f :: forall a. F -> a -> a+f X b = ?help+f Y b = ?help
+ tests/purs/failing/UnderscoreModuleName.out view
@@ -0,0 +1,10 @@+Error found:+at tests/purs/failing/UnderscoreModuleName.purs:2:8 - 2:18 (line 2, column 8 - line 2, column 18)++ Unable to parse module:+ Invalid module name; underscores and primes are not allowed in module names+++See https://github.com/purescript/documentation/blob/master/errors/ErrorParsingModule.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/UnderscoreModuleName.purs view
@@ -0,0 +1,6 @@+-- @shouldFailWith ErrorParsingModule+module Bad_Module where++import Effect.Console (log)++main = log "Done"
+ tests/purs/failing/UnknownType.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/UnknownType.purs:6:19 - 6:28 (line 6, column 19 - line 6, column 28)++ Unknown type [33mSomething[0m+++See https://github.com/purescript/documentation/blob/master/errors/UnknownName.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/UnknownType.purs view
@@ -0,0 +1,7 @@+-- @shouldFailWith UnknownName+module Main where++import Prelude++test :: Number -> Something+test = {}
+ tests/purs/failing/UnsupportedFFICommonJSExports1.js view
@@ -0,0 +1,2 @@+export var yes = true;+exports.no = false;
+ tests/purs/failing/UnsupportedFFICommonJSExports1.out view
@@ -0,0 +1,12 @@+Error found:+at tests/purs/failing/UnsupportedFFICommonJSExports1.purs:2:1 - 5:29 (line 2, column 1 - line 5, column 29)++ The following CommonJS exports are not supported in the ES foreign module for module [33mMain[0m:++ no++++See https://github.com/purescript/documentation/blob/master/errors/UnsupportedFFICommonJSExports.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/UnsupportedFFICommonJSExports1.purs view
@@ -0,0 +1,5 @@+-- @shouldFailWith UnsupportedFFICommonJSExports+module Main where++foreign import yes :: Boolean+foreign import no :: Boolean
+ tests/purs/failing/UnsupportedFFICommonJSExports2.js view
@@ -0,0 +1,4 @@+import { yes, no } from "some ES module";++exports.yes = yes;+exports.no = no;
+ tests/purs/failing/UnsupportedFFICommonJSExports2.out view
@@ -0,0 +1,13 @@+Error found:+at tests/purs/failing/UnsupportedFFICommonJSExports2.purs:2:1 - 5:29 (line 2, column 1 - line 5, column 29)++ The following CommonJS exports are not supported in the ES foreign module for module [33mMain[0m:++ yes+ no++++See https://github.com/purescript/documentation/blob/master/errors/UnsupportedFFICommonJSExports.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/UnsupportedFFICommonJSExports2.purs view
@@ -0,0 +1,5 @@+-- @shouldFailWith UnsupportedFFICommonJSExports+module Main where++foreign import yes :: Boolean+foreign import no :: Boolean
+ tests/purs/failing/UnsupportedFFICommonJSImports1.js view
@@ -0,0 +1,4 @@+var cjsImports = require("some CJS module");++export var yes = cjsImports.yes;+export var no = cjsImports.no;
+ tests/purs/failing/UnsupportedFFICommonJSImports1.out view
@@ -0,0 +1,12 @@+Error found:+at tests/purs/failing/UnsupportedFFICommonJSImports1.purs:2:1 - 5:29 (line 2, column 1 - line 5, column 29)++ The following CommonJS imports are not supported in the ES foreign module for module [33mMain[0m:++ some CJS module++++See https://github.com/purescript/documentation/blob/master/errors/UnsupportedFFICommonJSImports.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/UnsupportedFFICommonJSImports1.purs view
@@ -0,0 +1,5 @@+-- @shouldFailWith UnsupportedFFICommonJSImports+module Main where++foreign import yes :: Boolean+foreign import no :: Boolean
+ tests/purs/failing/UnsupportedFFICommonJSImports2.js view
@@ -0,0 +1,5 @@+import { yes } from "some ES module";+var cjsImports = require("some CJS module");++exports.yes = yes;+exports.no = cjsImports.no;
+ tests/purs/failing/UnsupportedFFICommonJSImports2.out view
@@ -0,0 +1,12 @@+Error found:+at tests/purs/failing/UnsupportedFFICommonJSImports2.purs:2:1 - 5:29 (line 2, column 1 - line 5, column 29)++ The following CommonJS imports are not supported in the ES foreign module for module [33mMain[0m:++ some CJS module++++See https://github.com/purescript/documentation/blob/master/errors/UnsupportedFFICommonJSImports.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/UnsupportedFFICommonJSImports2.purs view
@@ -0,0 +1,5 @@+-- @shouldFailWith UnsupportedFFICommonJSImports+module Main where++foreign import yes :: Boolean+foreign import no :: Boolean
+ tests/purs/failing/UnsupportedRoleDeclarationTypeClass.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/UnsupportedRoleDeclarationTypeClass.purs:5:1 - 5:29 (line 5, column 1 - line 5, column 29)++ Role declarations are only supported for data types, not for type synonyms nor type classes.+++See https://github.com/purescript/documentation/blob/master/errors/UnsupportedRoleDeclaration.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/UnsupportedRoleDeclarationTypeClass.purs view
@@ -0,0 +1,5 @@+-- @shouldFailWith UnsupportedRoleDeclaration+module Main where++class C a+type role C representational
+ tests/purs/failing/UnsupportedRoleDeclarationTypeSynonym.out view
@@ -0,0 +1,10 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/UnsupportedRoleDeclarationTypeSynonym.purs:7:1 - 7:20 (line 7, column 1 - line 7, column 20)++ Role declarations are only supported for data types, not for type synonyms nor type classes.+++See https://github.com/purescript/documentation/blob/master/errors/UnsupportedRoleDeclaration.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/UnsupportedRoleDeclarationTypeSynonym.purs view
@@ -0,0 +1,7 @@+-- @shouldFailWith UnsupportedRoleDeclaration+module Main where++data A a = A++type B a = A a+type role B nominal
+ tests/purs/failing/UnsupportedTypeInKind.out view
@@ -0,0 +1,15 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/UnsupportedTypeInKind.purs:7:28 - 7:38 (line 7, column 28 - line 7, column 38)++ The type:++ [33mOk => Type[0m++ is not supported in kinds.++in foreign data type declaration for [33mBad[0m++See https://github.com/purescript/documentation/blob/master/errors/UnsupportedTypeInKind.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/UnsupportedTypeInKind.purs view
@@ -0,0 +1,7 @@+-- @shouldFailWith UnsupportedTypeInKind+module Main where++class Ok+instance ok :: Ok++foreign import data Bad :: Ok => Type
+ tests/purs/failing/VisibleTypeApplications1.out view
@@ -0,0 +1,20 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/VisibleTypeApplications1.purs:7:11 - 7:18 (line 7, column 11 - line 7, column 18)++ An expression of polymorphic type+ with the invisible type variable [33ma[0m:+ [33m [0m+ [33m forall a. a -> a[0m+ [33m [0m+ cannot be applied to:+ [33m [0m+ [33m Int[0m+ [33m [0m++while inferring the type of [33mid[0m+in value declaration [33mfailOne[0m++See https://github.com/purescript/documentation/blob/master/errors/CannotApplyExpressionOfTypeOnType.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/VisibleTypeApplications1.purs view
@@ -0,0 +1,7 @@+-- @shouldFailWith CannotApplyExpressionOfTypeOnType+module Main where++id :: forall a. a -> a+id a = a++failOne = id @Int
+ tests/purs/failing/VisibleTypeApplications2.out view
@@ -0,0 +1,19 @@+Error found:+in module [33mMain[0m+at tests/purs/failing/VisibleTypeApplications2.purs:7:11 - 7:18 (line 7, column 11 - line 7, column 18)++ An expression of monomorphic type:+ [33m [0m+ [33m Int -> Int[0m+ [33m [0m+ cannot be applied to:+ [33m [0m+ [33m Int[0m+ [33m [0m++while inferring the type of [33mid[0m+in value declaration [33mfailTwo[0m++See https://github.com/purescript/documentation/blob/master/errors/CannotApplyExpressionOfTypeOnType.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/VisibleTypeApplications2.purs view
@@ -0,0 +1,7 @@+-- @shouldFailWith CannotApplyExpressionOfTypeOnType+module Main where++id :: Int -> Int+id a = a++failTwo = id @Int
+ tests/purs/failing/Whitespace1.out view
@@ -0,0 +1,10 @@+Error found:+at tests/purs/failing/Whitespace1.purs:5:1 - 5:2 (line 5, column 1 - line 5, column 2)++ Unable to parse module:+ Illegal whitespace character U+0009+++See https://github.com/purescript/documentation/blob/master/errors/ErrorParsingModule.md for more information,+or to contribute content related to this error.+
+ tests/purs/failing/Whitespace1.purs view
@@ -0,0 +1,5 @@+-- @shouldFailWith ErrorParsingModule+module Main where++test = do+ test
+ tests/purs/graph/graph.json view
@@ -0,0 +1,1 @@+{"Module2":{"path":"tests/purs/graph/src/Module2.purs","depends":["Module3"]},"Module3":{"path":"tests/purs/graph/src/Module3.purs","depends":[]},"Module":{"path":"tests/purs/graph/src/Module.purs","depends":["Module2"]}}
+ tests/purs/graph/src/Module.purs view
@@ -0,0 +1,9 @@+module Module (foo) where++import Module2 (bar)++foo :: Int+foo = 0++baz :: Int+baz = foo + bar
+ tests/purs/graph/src/Module2.purs view
@@ -0,0 +1,6 @@+module Module2 (bar) where++import Module3 (baz)++bar :: Int+bar = 1
+ tests/purs/graph/src/Module3.purs view
@@ -0,0 +1,4 @@+module Module3 (baz) where++baz :: Int+baz = 3
+ tests/purs/graph/src/ModuleFailing.purs view
@@ -0,0 +1,5 @@+module ModuleFailing where++import NonExistent as M++bat = M.nonExistent
+ tests/purs/layout/AdoIn.out view
@@ -0,0 +1,20 @@+module Test where{++test = ado{+ baz;+ let {foo = bar}}+ in bar;++test = ado {}in foo;++test = ado{+ foo <- bar $ let {a = 42 }in a;+ baz <- b}+ in bar;++test = ado{+ foo;+ let {bar = let {a = 42 }in a};+ let {baz = 42}}+ in bar}+<eof>
+ tests/purs/layout/AdoIn.purs view
@@ -0,0 +1,19 @@+module Test where++test = ado+ baz+ let foo = bar+ in bar++test = ado in foo++test = ado+ foo <- bar $ let a = 42 in a+ baz <- b+ in bar++test = ado+ foo+ let bar = let a = 42 in a+ let baz = 42+ in bar
+ tests/purs/layout/BacktickOperator.out view
@@ -0,0 +1,22 @@+module Test where{++example1 = do{+ foo bar}+ <|> baz;++example2 = do{+ foo bar}+ `wat` baz;++example3 =+ case _ of{+ Foo a -> 1;+ Bar b -> 2}+ `append` 3;++example4 =+ case _ of{+ Foo a -> 1;+ Bar b -> 2}+ + 3}+<eof>
+ tests/purs/layout/BacktickOperator.purs view
@@ -0,0 +1,21 @@+module Test where++example1 = do+ foo bar+ <|> baz++example2 = do+ foo bar+ `wat` baz++example3 =+ case _ of+ Foo a -> 1+ Bar b -> 2+ `append` 3++example4 =+ case _ of+ Foo a -> 1+ Bar b -> 2+ + 3
+ tests/purs/layout/CaseGuards.out view
@@ -0,0 +1,54 @@+module Test where{++-- Including data because of `|` masking+data Foo+ = Foo+ | Bar+ | Baz;++test =+ case foo of{+ a | b, c ->+ d;+ a | b, c -> d};++test = case a, b of{+ c, d+ | e ->+ case e of{+ f | true -> bar+ | false -> baz}+ | f -> g};++test a+ | false =+ case false of{+ true | a > 12 -> true}+ | otherwise = true;++test = case a of {foo | foo \a -> a -> true};++test = a `case _ of {x | unit # \_ -> true, true -> const}` b;++test = case a of{+ 12 | do {that;+ that }-> this+ | otherwise -> this};++test a b = [ case _ of{+ 12 | case a, b of{+ _, 42 -> b;+ _, 12 -> false}, b -> true+ | case a, b of{+ _, 42 -> b;+ _, 12 -> false}, b -> true}, false ];++test a+ | case a, b of{+ _, 42 -> b;+ _, 12 -> false}, b = true+ | case a, b of{+ _, 42 -> b;+ _, 12 -> false}, b = true}++<eof>
+ tests/purs/layout/CaseGuards.purs view
@@ -0,0 +1,53 @@+module Test where++-- Including data because of `|` masking+data Foo+ = Foo+ | Bar+ | Baz++test =+ case foo of+ a | b, c ->+ d+ a | b, c -> d++test = case a, b of+ c, d+ | e ->+ case e of+ f | true -> bar+ | false -> baz+ | f -> g++test a+ | false =+ case false of+ true | a > 12 -> true+ | otherwise = true++test = case a of foo | foo \a -> a -> true++test = a `case _ of x | unit # \_ -> true, true -> const` b++test = case a of+ 12 | do that+ that -> this+ | otherwise -> this++test a b = [ case _ of+ 12 | case a, b of+ _, 42 -> b+ _, 12 -> false, b -> true+ | case a, b of+ _, 42 -> b+ _, 12 -> false, b -> true, false ]++test a+ | case a, b of+ _, 42 -> b+ _, 12 -> false, b = true+ | case a, b of+ _, 42 -> b+ _, 12 -> false, b = true+
+ tests/purs/layout/CaseWhere.out view
@@ -0,0 +1,13 @@+module Test where{++test = case foo of{+ Nothing -> a+ where {a = 12};+ Just a -> do{+ what}}+ where{+ foo = bar};++test = case f of {Foo -> do {that}+ where {foo = 12}}}+<eof>
+ tests/purs/layout/CaseWhere.purs view
@@ -0,0 +1,12 @@+module Test where++test = case foo of+ Nothing -> a+ where a = 12+ Just a -> do+ what+ where+ foo = bar++test = case f of Foo -> do that+ where foo = 12
+ tests/purs/layout/ClassHead.out view
@@ -0,0 +1,11 @@+module Test where{++import Foo (class Foo);++class Foo a b c d | a -> b, c -> d where{+ foo :: Foo};++class Foo a b c d | a -> b, c -> d;++instance foo :: Foo}+<eof>
+ tests/purs/layout/ClassHead.purs view
@@ -0,0 +1,10 @@+module Test where++import Foo (class Foo)++class Foo a b c d | a -> b, c -> d where+ foo :: Foo++class Foo a b c d | a -> b, c -> d++instance foo :: Foo
+ tests/purs/layout/Commas.out view
@@ -0,0 +1,23 @@+module Test where{++test =+ [ case do {foo}, bar of{+ a | b, c -> d}, bar+ ];++test =+ [ case do {foo}, bar of {a | b, c -> d}, bar ];++test =+ [ do {do {do {foo}}}, bar ];++test =+ [ \foo -> foo, bar ];++test = foo where{+ bar =+ case a, b of{+ c, d | d == [case true, w of {1, a -> true}, false ] -> d;+ e, d | do {what}, do {that }-> d}}}++<eof>
+ tests/purs/layout/Commas.purs view
@@ -0,0 +1,22 @@+module Test where++test =+ [ case do foo, bar of+ a | b, c -> d, bar+ ]++test =+ [ case do foo, bar of a | b, c -> d, bar ]++test =+ [ do do do foo, bar ]++test =+ [ \foo -> foo, bar ]++test = foo where+ bar =+ case a, b of+ c, d | d == [case true, w of 1, a -> true, false ] -> d+ e, d | do what, do that -> d+
+ tests/purs/layout/Delimiter.out view
@@ -0,0 +1,14 @@+module Test where{++test1 = a;+test2 = {+ b+};+test3 = do{+ foo;+ bar (+ baz+ ) == 12;+ baz};+test4 = c}+<eof>
+ tests/purs/layout/Delimiter.purs view
@@ -0,0 +1,13 @@+module Test where++test1 = a+test2 = {+ b+}+test3 = do+ foo+ bar (+ baz+ ) == 12+ baz+test4 = c
+ tests/purs/layout/DoLet.out view
@@ -0,0 +1,16 @@+module Test where{++test = do{+ let {foo = bar};+ foo};++test = do{+ let {foo = bar};+ in baz;+ foo};++test = do{+ let {foo = bar}+ in baz;+ foo}}+<eof>
+ tests/purs/layout/DoLet.purs view
@@ -0,0 +1,15 @@+module Test where++test = do+ let foo = bar+ foo++test = do+ let foo = bar+ in baz+ foo++test = do+ let foo = bar+ in baz+ foo
+ tests/purs/layout/DoOperator.out view
@@ -0,0 +1,9 @@+module Test where{++test = do{+ foo;+ foo do{+ bar}}+ <|> bar}++<eof>
+ tests/purs/layout/DoOperator.purs view
@@ -0,0 +1,8 @@+module Test where++test = do+ foo+ foo do+ bar+ <|> bar+
+ tests/purs/layout/DoWhere.out view
@@ -0,0 +1,7 @@+module Test where{++test =+ do{+ do {do{+ foo }}}where {bar = baz}}+<eof>
+ tests/purs/layout/DoWhere.purs view
@@ -0,0 +1,6 @@+module Test where++test =+ do+ do do+ foo where bar = baz
+ tests/purs/layout/IfThenElseDo.out view
@@ -0,0 +1,11 @@+module Test where{++foo = do{+ if true then+ false+ else if false then do{+ that}+ else do{+ what};+ that}}+<eof>
+ tests/purs/layout/IfThenElseDo.purs view
@@ -0,0 +1,10 @@+module Test where++foo = do+ if true then+ false+ else if false then do+ that+ else do+ what+ that
+ tests/purs/layout/InstanceChainElse.out view
@@ -0,0 +1,5 @@+module Test where{++instance foo :: Foo Int else bar :: Foo String+else baz :: Foo Boolean}+<eof>
+ tests/purs/layout/InstanceChainElse.purs view
@@ -0,0 +1,4 @@+module Test where++instance foo :: Foo Int else bar :: Foo String+else baz :: Foo Boolean
+ tests/purs/layout/IntType.out view
@@ -0,0 +1,8 @@+module Test where{++type IntType = (-1);++type IntType' = (-+ -- here's a comment+ 1)}+<eof>
+ tests/purs/layout/IntType.purs view
@@ -0,0 +1,7 @@+module Test where++type IntType = (-1)++type IntType' = (-+ -- here's a comment+ 1)
+ tests/purs/layout/LetGuards.out view
@@ -0,0 +1,30 @@+module Test where{++test =+ let{+ foo+ | bar+ , baz =+ 42+ | otherwise = 100}+ in+ foo;++test = do{+ let{+ foo+ | bar+ , baz =+ 42+ | otherwise = 100};+ foo};++test = ado{+ let{+ foo+ | bar+ , baz =+ 42+ | otherwise = 100};+ foo}}+<eof>
+ tests/purs/layout/LetGuards.purs view
@@ -0,0 +1,29 @@+module Test where++test =+ let+ foo+ | bar+ , baz =+ 42+ | otherwise = 100+ in+ foo++test = do+ let+ foo+ | bar+ , baz =+ 42+ | otherwise = 100+ foo++test = ado+ let+ foo+ | bar+ , baz =+ 42+ | otherwise = 100+ foo
+ tests/purs/layout/Shebang.out view
@@ -0,0 +1,7 @@+#! shebang line 1+#! shebang line 2++module Test where{++foo = 42}+<eof>
+ tests/purs/layout/Shebang.purs view
@@ -0,0 +1,6 @@+#! shebang line 1+#! shebang line 2++module Test where++foo = 42
+ tests/purs/make/Module.purs view
@@ -0,0 +1,5 @@+module Module where+x :: Int+x = 1+y :: Int+y = 1
+ tests/purs/optimize/2866.out.js view
@@ -0,0 +1,13 @@+// Canonical test for #2866. This doesn't need to test whether `apply`s+// defined from modules other than `Data.Function` are incorrectly+// optimized since the rest of the test suite seemingly catches it.+var Area = function (x) {+ return x;+};+var areaFlipped = 42;+var area = 42;+export {+ Area,+ area,+ areaFlipped+};
+ tests/purs/optimize/2866.purs view
@@ -0,0 +1,12 @@+-- Canonical test for #2866. This doesn't need to test whether `apply`s+-- defined from modules other than `Data.Function` are incorrectly+-- optimized since the rest of the test suite seemingly catches it.+module Main where++import Prelude++newtype Area = Area Int++area = Area $ 42++areaFlipped = 42 # Area
+ tests/purs/optimize/4179.out.js view
@@ -0,0 +1,101 @@+var $runtime_lazy = function (name, moduleName, init) {+ var state = 0;+ var val;+ return function (lineNumber) {+ if (state === 2) return val;+ if (state === 1) throw new ReferenceError(name + " was needed before it finished initializing (module " + moduleName + ", line " + lineNumber + ")", moduleName, lineNumber);+ state = 1;+ val = init();+ state = 2;+ return val;+ };+};++// This is a test that TCO isn't broken by unsafePartial.+var tcoable = function ($copy_v) {+ var $tco_done = false;+ var $tco_result;+ function $tco_loop(v) {+ if (v === 0) {+ $tco_done = true;+ return "done";+ };+ if (v > 0) {+ $copy_v = v - 1 | 0;+ return;+ };+ throw new Error("Failed pattern match at Main (line 43, column 25 - line 45, column 31): " + [ v.constructor.name ]);+ };+ while (!$tco_done) {+ $tco_result = $tco_loop($copy_v);+ };+ return $tco_result;+};+var isOdd = function (n) {+ return n > 0 && !isEven(n - 1 | 0);+};+var isEven = function (n) {+ return n === 0 || isOdd(n - 1 | 0);+};++// This is an example of four mutually recursive bindings with a complex+// run-time dependency structure. The expected result is:+// alpha is defined without any laziness+// bravo and charlie are lazily initialized in a group+// and then delta is lazily initialized+var alpha = function (v) {+ if (v === 0) {+ return $lazy_bravo(18);+ };+ if (v === 1) {+ return $lazy_charlie(19);+ };+ if (v === 2) {+ return function (y) {+ var $13 = y > 0;+ if ($13) {+ return bravo(y);+ };+ return charlie(y);+ };+ };+ return function (y) {+ return $lazy_delta(21)(y)(v);+ };+};+var $lazy_charlie = /* #__PURE__ */ $runtime_lazy("charlie", "Main", function () {+ return (function (v) {+ return alpha;+ })({})(4);+});+var $lazy_bravo = /* #__PURE__ */ $runtime_lazy("bravo", "Main", function () {+ return (function (v) {+ return alpha;+ })({})(3);+});+var charlie = /* #__PURE__ */ $lazy_charlie(31);+var bravo = /* #__PURE__ */ $lazy_bravo(28);+var $lazy_delta = /* #__PURE__ */ $runtime_lazy("delta", "Main", function () {+ var b = (function (v) {+ return bravo;+ })({});+ return function (x) {+ return function (y) {+ var $14 = x === y;+ if ($14) {+ return b(0);+ };+ return 1.0;+ };+ };+});+var delta = /* #__PURE__ */ $lazy_delta(34);+export {+ isEven,+ isOdd,+ alpha,+ bravo,+ charlie,+ delta,+ tcoable+};
+ tests/purs/optimize/4179.purs view
@@ -0,0 +1,45 @@+module Main where++import Prelude++import Partial.Unsafe (unsafePartial)++isEven n = n == 0 || isOdd (n - 1)+isOdd n = n > 0 && not (isEven (n - 1))++-- This is an example of four mutually recursive bindings with a complex+-- run-time dependency structure. The expected result is:+-- alpha is defined without any laziness+-- bravo and charlie are lazily initialized in a group+-- and then delta is lazily initialized++alpha :: Int -> Int -> Number+alpha = case _ of+ 0 -> bravo+ 1 -> charlie+ 2 -> \y -> if y > 0 then bravo y else charlie y+ x -> \y -> delta y x++-- Me: `alpha`+-- purs: The value of alpha is undefined here, so this reference is not allowed.+-- Me: `(\_ -> alpha) {}`+-- purs: LGTM!++bravo :: Int -> Number+bravo = (\_ -> alpha) {} 3++charlie :: Int -> Number+charlie = (\_ -> alpha) {} 4++delta :: Int -> Int -> Number+delta =+ let b = (\_ -> bravo) {}+ in \x y -> if x == y then b 0 else 1.0+++-- This is a test that TCO isn't broken by unsafePartial.++tcoable :: Int -> String+tcoable = unsafePartial case _ of+ 0 -> "done"+ n | n > 0 -> tcoable (n - 1)
+ tests/purs/optimize/4229.out.js view
@@ -0,0 +1,17 @@+import * as Data_Unit from "../Data.Unit/index.js";+import * as Effect_Console from "../Effect.Console/index.js";+var Control_Bind = /* #__PURE__ */ (function () {+ function Control_Bind() {++ };+ Control_Bind.value = new Control_Bind();+ return Control_Bind;+})();+var main = function __do() {+ Data_Unit.unit;+ return Effect_Console.log("Done")();+};+export {+ Control_Bind,+ main+};
+ tests/purs/optimize/4229.purs view
@@ -0,0 +1,13 @@+module Main where++import Prelude++import Effect (Effect)+import Effect.Console (log)++data X = Control_Bind++main :: Effect Unit+main = do+ pure unit+ log "Done"
+ tests/purs/optimize/4386.out.js view
@@ -0,0 +1,26 @@+var mySTFn2 = function (a, b) {+ return a + b | 0;+};+var mySTFn1 = function (a) {+ return a + 1 | 0;+};+var myInt2 = function () {+ return mySTFn2(0, 1);+};+var myInt1 = function () {+ return mySTFn1(0);+};+var otherTest = function __do() {+ var a = mySTFn2(0, 1);+ var b = mySTFn1(2);+ var c = myInt1();+ var d = myInt2();+ return ((a + b | 0) + c | 0) + d | 0;+};+export {+ mySTFn1,+ mySTFn2,+ myInt1,+ myInt2,+ otherTest+};
+ tests/purs/optimize/4386.purs view
@@ -0,0 +1,25 @@+module Main where++import Prelude+import Control.Monad.ST (ST)+import Control.Monad.ST.Uncurried (STFn1, STFn2, mkSTFn1, mkSTFn2, runSTFn1, runSTFn2)++mySTFn1 :: forall r. STFn1 Int r Int+mySTFn1 = mkSTFn1 \a -> pure (a + 1)++mySTFn2 :: forall r. STFn2 Int Int r Int+mySTFn2 = mkSTFn2 \a b -> pure (a + b)++myInt1 :: forall r. ST r Int+myInt1 = runSTFn1 mySTFn1 0++myInt2 :: forall r. ST r Int+myInt2 = runSTFn2 mySTFn2 0 1++otherTest :: forall r. ST r Int+otherTest = do+ a <- runSTFn2 mySTFn2 0 1+ b <- runSTFn1 mySTFn1 2+ c <- myInt1+ d <- myInt2+ pure $ a + b + c + d
+ tests/purs/optimize/Foreign.js view
@@ -0,0 +1,1 @@+export const foo = 42;
+ tests/purs/optimize/Foreign.out.js view
@@ -0,0 +1,5 @@+import * as $foreign from "./foreign.js";+var bar = $foreign.foo;+export {+ bar+};
+ tests/purs/optimize/Foreign.purs view
@@ -0,0 +1,5 @@+module Main (bar) where++foreign import foo :: Int++bar = foo
+ tests/purs/optimize/Monad.out.js view
@@ -0,0 +1,30 @@+import * as Control_Applicative from "../Control.Applicative/index.js";+import * as Control_Bind from "../Control.Bind/index.js";+var liftM1 = function (dictMonad) {+ var bind = Control_Bind.bind(dictMonad.Bind1());+ var pure = Control_Applicative.pure(dictMonad.Applicative0());+ return function (f) {+ return function (a) {+ return bind(a)(function (a$prime) {+ return pure(f(a$prime));+ });+ };+ };+};+var ap = function (dictMonad) {+ var bind = Control_Bind.bind(dictMonad.Bind1());+ var pure = Control_Applicative.pure(dictMonad.Applicative0());+ return function (f) {+ return function (a) {+ return bind(f)(function (f$prime) {+ return bind(a)(function (a$prime) {+ return pure(f$prime(a$prime));+ });+ });+ };+ };+};+export {+ liftM1,+ ap+};
+ tests/purs/optimize/Monad.purs view
@@ -0,0 +1,17 @@+module Main where++import Control.Applicative (class Applicative, pure)+import Control.Bind (class Bind, bind)++class (Applicative m, Bind m) <= Monad m++liftM1 :: forall m a b. Monad m => (a -> b) -> m a -> m b+liftM1 f a = do+ a' <- a+ pure (f a')++ap :: forall m a b. Monad m => m (a -> b) -> m a -> m b+ap f a = do+ f' <- f+ a' <- a+ pure (f' a')
+ tests/purs/optimize/ObjectUpdate.out.js view
@@ -0,0 +1,27 @@+var staticUpdate2 = function (x) {+ return {+ alpha: x.alpha,+ bravo: true+ };+};+var staticUpdate1 = function (x) {+ return {+ alpha: x.alpha,+ bravo: "replaced"+ };+};+var dynamicUpdate1 = function (x) {+ var $3 = {};+ for (var $4 in x) {+ if ({}.hasOwnProperty.call(x, $4)) {+ $3[$4] = x[$4];+ };+ };+ $3.bravo = true;+ return $3;+};+export {+ staticUpdate1,+ staticUpdate2,+ dynamicUpdate1+};
+ tests/purs/optimize/ObjectUpdate.purs view
@@ -0,0 +1,10 @@+module Main where++staticUpdate1 :: { alpha :: Int, bravo :: String } -> { alpha :: Int, bravo :: String }+staticUpdate1 x = x { bravo = "replaced" }++staticUpdate2 :: { alpha :: Int, bravo :: String } -> { alpha :: Int, bravo :: Boolean }+staticUpdate2 x = x { bravo = true }++dynamicUpdate1 :: forall r. { alpha :: Int, bravo :: String | r } -> { alpha :: Int, bravo :: Boolean | r }+dynamicUpdate1 x = x { bravo = true }
+ tests/purs/optimize/Primitives.out.js view
@@ -0,0 +1,10 @@+// This test checks that no unused Semiring abstractions are introduced when+// the operators are compiled to JS primitives.+var f = function (x) {+ return function (y) {+ return x * (y + 1 | 0) | 0;+ };+};+export {+ f+};
+ tests/purs/optimize/Primitives.purs view
@@ -0,0 +1,9 @@+-- This test checks that no unused Semiring abstractions are introduced when+-- the operators are compiled to JS primitives.++module Main where++import Prelude++f :: Int -> Int -> Int+f x y = x * (y + 1)
+ tests/purs/optimize/RecursiveInstances.out.js view
@@ -0,0 +1,107 @@+import * as Data_Semigroup from "../Data.Semigroup/index.js";+import * as Data_Symbol from "../Data.Symbol/index.js";+import * as Type_Proxy from "../Type.Proxy/index.js";+var append = /* #__PURE__ */ Data_Semigroup.append(Data_Semigroup.semigroupArray);+var findKeysAuxNil = {+ findKeysAux: function (v) {+ return [ ];+ }+};+var findKeysAux = function (dict) {+ return dict.findKeysAux;+};+var findKeysAuxCons = function (dictIsSymbol) {+ var reflectSymbol = Data_Symbol.reflectSymbol(dictIsSymbol);+ return function (dictFindKeysAux) {+ var findKeysAux1 = findKeysAux(dictFindKeysAux);+ return {+ findKeysAux: function (v) {+ return append([ reflectSymbol(Type_Proxy["Proxy"].value) ])(findKeysAux1(Type_Proxy["Proxy"].value));+ }+ };+ };+};+var findKeysAuxCons1 = /* #__PURE__ */ findKeysAuxCons({+ reflectSymbol: function () {+ return "a";+ }+});+var findKeysAuxCons2 = /* #__PURE__ */ findKeysAuxCons({+ reflectSymbol: function () {+ return "b";+ }+});+var findKeysAuxCons3 = /* #__PURE__ */ findKeysAuxCons({+ reflectSymbol: function () {+ return "c";+ }+});+var findKeysAuxCons4 = /* #__PURE__ */ findKeysAuxCons({+ reflectSymbol: function () {+ return "d";+ }+});+var findKeys = function () {+ return function (dictFindKeysAux) {+ var findKeysAux1 = findKeysAux(dictFindKeysAux);+ return function (v) {+ return findKeysAux1(Type_Proxy["Proxy"].value);+ };+ };+};+var findKeys11 = /* #__PURE__ */ findKeys();+var findKeys12 = /* #__PURE__ */ findKeys11(/* #__PURE__ */ findKeysAuxCons1(findKeysAuxNil));+var findKeys13 = /* #__PURE__ */ findKeys11(/* #__PURE__ */ findKeysAuxCons1(/* #__PURE__ */ findKeysAuxCons2(/* #__PURE__ */ findKeysAuxCons3(/* #__PURE__ */ findKeysAuxCons4(/* #__PURE__ */ findKeysAuxCons({+ reflectSymbol: function () {+ return "e";+ }+})(findKeysAuxNil))))));+var findKeys14 = /* #__PURE__ */ findKeys11(/* #__PURE__ */ findKeysAuxCons1(/* #__PURE__ */ findKeysAuxCons2(findKeysAuxNil)));+var findKeys15 = /* #__PURE__ */ findKeys11(/* #__PURE__ */ findKeysAuxCons1(/* #__PURE__ */ findKeysAuxCons2(/* #__PURE__ */ findKeysAuxCons3(findKeysAuxNil))));+var findKeys16 = /* #__PURE__ */ findKeys11(/* #__PURE__ */ findKeysAuxCons1(/* #__PURE__ */ findKeysAuxCons2(/* #__PURE__ */ findKeysAuxCons3(/* #__PURE__ */ findKeysAuxCons4(findKeysAuxNil)))));+var findKeys1 = /* #__PURE__ */ (function () {+ return findKeys12(Type_Proxy["Proxy"].value);+})();+var findKeys10 = /* #__PURE__ */ (function () {+ return findKeys13(Type_Proxy["Proxy"].value);+})();+var findKeys2 = /* #__PURE__ */ (function () {+ return findKeys14(Type_Proxy["Proxy"].value);+})();+var findKeys3 = /* #__PURE__ */ (function () {+ return findKeys15(Type_Proxy["Proxy"].value);+})();+var findKeys4 = /* #__PURE__ */ (function () {+ return findKeys16(Type_Proxy["Proxy"].value);+})();+var findKeys5 = /* #__PURE__ */ (function () {+ return findKeys13(Type_Proxy["Proxy"].value);+})();+var findKeys6 = /* #__PURE__ */ (function () {+ return findKeys12(Type_Proxy["Proxy"].value);+})();+var findKeys7 = /* #__PURE__ */ (function () {+ return findKeys14(Type_Proxy["Proxy"].value);+})();+var findKeys8 = /* #__PURE__ */ (function () {+ return findKeys15(Type_Proxy["Proxy"].value);+})();+var findKeys9 = /* #__PURE__ */ (function () {+ return findKeys16(Type_Proxy["Proxy"].value);+})();+export {+ findKeysAux,+ findKeys,+ findKeys1,+ findKeys2,+ findKeys3,+ findKeys4,+ findKeys5,+ findKeys6,+ findKeys7,+ findKeys8,+ findKeys9,+ findKeys10,+ findKeysAuxNil,+ findKeysAuxCons+};
+ tests/purs/optimize/RecursiveInstances.purs view
@@ -0,0 +1,31 @@+module Main where++import Prelude++import Prim.Row as R+import Prim.RowList as RL+import Type.Prelude (class IsSymbol, Proxy(..), reflectSymbol)++class FindKeysAux :: forall k. RL.RowList k -> Constraint+class FindKeysAux a where+ findKeysAux :: Proxy a -> Array String++instance FindKeysAux RL.Nil where+ findKeysAux _ = []++else instance (IsSymbol l, FindKeysAux r) => FindKeysAux (RL.Cons l t r) where+ findKeysAux _ = [ reflectSymbol (Proxy :: Proxy l) ] <> findKeysAux (Proxy :: Proxy r)++findKeys :: forall r rl. RL.RowToList r rl => FindKeysAux rl => Proxy r -> Array String+findKeys _ = findKeysAux (Proxy :: Proxy rl)++findKeys1 = findKeys (Proxy :: Proxy (a :: Unit))+findKeys2 = findKeys (Proxy :: Proxy (a :: Unit, b :: Unit))+findKeys3 = findKeys (Proxy :: Proxy (a :: Unit, b :: Unit, c :: Unit))+findKeys4 = findKeys (Proxy :: Proxy (a :: Unit, b :: Unit, c :: Unit, d :: Unit))+findKeys5 = findKeys (Proxy :: Proxy (a :: Unit, b :: Unit, c :: Unit, d :: Unit, e :: Unit))+findKeys6 = findKeys (Proxy :: Proxy (a :: Unit))+findKeys7 = findKeys (Proxy :: Proxy (a :: Unit, b :: Unit))+findKeys8 = findKeys (Proxy :: Proxy (a :: Unit, b :: Unit, c :: Unit))+findKeys9 = findKeys (Proxy :: Proxy (a :: Unit, b :: Unit, c :: Unit, d :: Unit))+findKeys10 = findKeys (Proxy :: Proxy (a :: Unit, b :: Unit, c :: Unit, d :: Unit, e :: Unit))
+ tests/purs/optimize/Symbols.out.js view
@@ -0,0 +1,68 @@+import * as Data_Symbol from "../Data.Symbol/index.js";+import * as Record_Unsafe from "../Record.Unsafe/index.js";+import * as Type_Proxy from "../Type.Proxy/index.js";+var fooIsSymbol = {+ reflectSymbol: function () {+ return "foo";+ }+};+var set = function (dictIsSymbol) {+ var reflectSymbol = Data_Symbol.reflectSymbol(dictIsSymbol);+ return function () {+ return function (l) {+ return function (a) {+ return function (r) {+ return Record_Unsafe.unsafeSet(reflectSymbol(l))(a)(r);+ };+ };+ };+ };+};+var set1 = /* #__PURE__ */ set(fooIsSymbol)();+var get = function (dictIsSymbol) {+ var reflectSymbol = Data_Symbol.reflectSymbol(dictIsSymbol);+ return function () {+ return function (l) {+ return function (r) {+ return Record_Unsafe.unsafeGet(reflectSymbol(l))(r);+ };+ };+ };+};+var get1 = /* #__PURE__ */ get(fooIsSymbol)();+var get2 = /* #__PURE__ */ get({+ reflectSymbol: function () {+ return "bar";+ }+})();+var foo = /* #__PURE__ */ (function () {+ return Type_Proxy["Proxy"].value;+})();+var h = function (n) {+ return set1(foo)(n)({+ foo: 0+ });+};+var f = function (n) {+ return get1(foo)({+ foo: n+ });+};+var bar = /* #__PURE__ */ (function () {+ return Type_Proxy["Proxy"].value;+})();+var g = function (n) {+ return get2(bar)({+ foo: 0,+ bar: n+ });+};+export {+ get,+ set,+ foo,+ bar,+ f,+ g,+ h+};
+ tests/purs/optimize/Symbols.purs view
@@ -0,0 +1,40 @@+module Main where++import Data.Symbol (class IsSymbol, reflectSymbol)+import Prim.Row (class Cons)+import Record.Unsafe (unsafeGet, unsafeSet)+import Type.Proxy (Proxy(..))++get+ :: forall r r' l a+ . IsSymbol l+ => Cons l a r' r+ => Proxy l+ -> Record r+ -> a+get l r = unsafeGet (reflectSymbol l) r++set+ :: forall r r' l a+ . IsSymbol l+ => Cons l a r' r+ => Proxy l+ -> a+ -> Record r+ -> Record r+set l a r = unsafeSet (reflectSymbol l) a r++foo :: Proxy "foo"+foo = Proxy++bar :: Proxy "bar"+bar = Proxy++f :: Int -> Int+f n = get foo { foo: n }++g :: Int -> Int+g n = get bar { foo: 0, bar: n }++h :: Int -> { foo :: Int }+h n = set foo n { foo: 0 }
+ tests/purs/passing/1110.purs view
@@ -0,0 +1,26 @@+module Main where++import Prelude+import Effect.Console (log)++data X a = X++x :: forall a. X a+x = X++type Y = { x :: X Int }++test :: forall m. Monad m => m Y+test = pure { x: x }++type Z t = forall x. t x -> (forall a. t a) -> t x++class C t where c :: Z t++instance cA :: C Array where+ c x _ = x++test2 :: forall m. Monad m => m { ccc :: Z Array }+test2 = pure { ccc: (c :: Z Array) }++main = log "Done"
+ tests/purs/passing/1185.purs view
@@ -0,0 +1,15 @@+module Main where++import Effect.Console (log)++data Person = Person String Boolean++getName :: Person -> String+getName p = case p of+ Person name true -> name+ _ -> "Unknown"++name :: String+name = getName (Person "John Smith" true)++main = log "Done"
+ tests/purs/passing/1335.purs view
@@ -0,0 +1,14 @@+module Main where++import Prelude+import Effect.Console (log)++x :: forall a. a -> String+x a = y "Test"+ where+ y :: forall a. Show a => a -> String+ y a = show (a :: a)++main = do+ log (x 0)+ log "Done"
+ tests/purs/passing/1570.purs view
@@ -0,0 +1,8 @@+module Main where++import Effect.Console (log)++test :: forall a. a -> a+test = \(x :: a) -> x++main = log "Done"
+ tests/purs/passing/1664.purs view
@@ -0,0 +1,16 @@+module Main where++import Prelude+import Effect+import Effect.Console++data Identity a = Identity a++newtype IdentityEff a = IdentityEff (Effect (Identity a))++test :: forall a. IdentityEff a -> IdentityEff Unit+test (IdentityEff action) = IdentityEff $ do+ (Identity x :: Identity _) <- action+ pure $ Identity unit++main = log "Done"
+ tests/purs/passing/1697.purs view
@@ -0,0 +1,25 @@+module Main where++import Prelude+import Effect.Console (log)++_2 :: forall a. a -> a+_2 a = a++x :: forall m. Monad m => m Unit+x = do+ _ <- pure unit+ pure unit++y :: forall m. Monad m => m Unit+y = do+ _ <- pure unit+ pure unit++wtf :: forall m. Monad m => m Unit+wtf = do+ _ <- pure unit+ let tmp = _2 1+ pure unit++main = log "Done"
+ tests/purs/passing/1807.purs view
@@ -0,0 +1,14 @@+module Main where++import Prelude+import Effect.Console (log)++fn = _.b.c.d+a = {b:{c:{d:2}}}++d :: Int+d = fn a + a.b.c.d++main = if fn a + a.b.c.d == 4+ then log "Done"+ else log "Fail"
+ tests/purs/passing/1881.purs view
@@ -0,0 +1,19 @@+module Main where++import Effect.Console (log)++foo =+ 1++bar+ = 2++baz+ =+ 3++qux+ =+ 3++main = log "Done"
+ tests/purs/passing/1991.purs view
@@ -0,0 +1,22 @@+module Main where++import Prelude+import Effect.Console (log)++singleton :: forall a. a -> Array a+singleton x = [x]++empty :: forall a. Array a+empty = []++foldMap :: forall a m. Semigroup m => (a -> m) -> Array a -> m+foldMap f [a, b, c, d, e] = f a <> f b <> f c <> f d <> f e+foldMap f xs = foldMap f xs -- spin, not used++regression :: Array Int+regression =+ let as = [1,2,3,4,5]+ as' = foldMap (\x -> if 1 < x && x < 4 then singleton x else empty) as+ in as'++main = log "Done"
+ tests/purs/passing/2018.purs view
@@ -0,0 +1,12 @@+module Main where++import Prelude+import A (foo)+import B (Foo(..))+import Effect (Effect)+import Effect.Console (log)++main :: Effect Unit+main = do+ let tmp = foo X+ log "Done"
+ tests/purs/passing/2018/A.purs view
@@ -0,0 +1,7 @@+module A where++import B as Main++-- Prior to the 2018 fix this would be detected as a cycle between A and Main.+foo ∷ Main.Foo → Main.Foo+foo x = x
+ tests/purs/passing/2018/B.purs view
@@ -0,0 +1,3 @@+module B where++data Foo = X | Y
+ tests/purs/passing/2049.purs view
@@ -0,0 +1,14 @@+module Main where++import Prelude+import Effect.Console (log)++data List a = Cons a (List a) | Nil++infixr 6 Cons as :++f :: List { x :: Int, y :: Int } -> Int+f ( r@{ x } : _) = x + r.y+f _ = 0++main = log "Done"
+ tests/purs/passing/2136.purs view
@@ -0,0 +1,9 @@+module Main where++import Prelude+import Effect.Console (log)++main = + if (negate (bottom :: Int) > top)+ then log "Fail"+ else log "Done"
+ tests/purs/passing/2138.purs view
@@ -0,0 +1,7 @@+module Main where++import Effect.Console (log)++import Lib (A(B,C))++main = log "Done"
+ tests/purs/passing/2138/Lib.purs view
@@ -0,0 +1,3 @@+module Lib (A(..), A) where++data A = B | C
+ tests/purs/passing/2197-1.purs view
@@ -0,0 +1,12 @@+module Main where++import Effect.Console+import Prim as P++type Number = P.Number+type Test = {}++z :: Number+z = 0.0++main = log "Done"
+ tests/purs/passing/2197-2.purs view
@@ -0,0 +1,11 @@+module Main where++import Effect.Console+import Prim (Int)++type Number = Int++z :: Number+z = 0++main = log "Done"
+ tests/purs/passing/2252.purs view
@@ -0,0 +1,15 @@+module Main where++import Effect.Console (log)++data T a = T++ti :: T Int+ti = T++t :: forall a. T a+t = T++xs = [ti, t, t]++main = log "Done"
+ tests/purs/passing/2288.purs view
@@ -0,0 +1,19 @@+module Main where++import Prelude+import Effect+import Effect.Console+import Data.Array+import Data.Array.Partial as P+import Partial.Unsafe++length :: forall a. Array a -> Int+length = go 0 where+ go acc arr =+ if null arr+ then acc+ else go (acc + 1) (unsafePartial P.tail arr)++main = do+ logShow (length (1 .. 10000))+ log "Done"
+ tests/purs/passing/2378.purs view
@@ -0,0 +1,9 @@+module Main where++import Effect.Console (log)++class Foo (a :: Symbol)++instance fooX :: Foo "x"++main = log "Done"
+ tests/purs/passing/2438.purs view
@@ -0,0 +1,8 @@+module Main where++import Effect.Console (log)++done :: String+done = {"𝌆": "Done"}."𝌆"++main = log done
+ tests/purs/passing/2609.purs view
@@ -0,0 +1,12 @@+module Main where++import Prelude+import Eg (Foo'(Bar'), (:->))+import Effect (Effect)+import Effect.Console (log)++bar' :: Foo'+bar' = 4 :-> 5++main :: Effect Unit+main = case bar' of Bar' l r -> log "Done"
+ tests/purs/passing/2609/Eg.purs view
@@ -0,0 +1,6 @@+module Eg (Foo'(Bar'), (:->)) where++data Foo' = Bar' Int Int++infix 4 Bar' as :->+
+ tests/purs/passing/2616.purs view
@@ -0,0 +1,13 @@+module Main where++import Prelude+import Effect.Console (log)++newtype F r a = F { x :: a | r }++unF :: forall r a. F r a -> { x :: a | r }+unF (F x) = x++derive instance functorF :: Functor (F r)++main = log (unF (map identity (F { x: "Done", y: 42 }))).x
+ tests/purs/passing/2626.purs view
@@ -0,0 +1,13 @@+module Main where++import Effect.Console (log)++f = \(x :: forall a. a -> a) -> x x++test1 = (f \x -> x) 1++g = \(x :: (forall a. a -> a) -> Int) -> x (\y -> y)++test2 = g \f -> if f true then f 0 else f 1++main = log "Done"
+ tests/purs/passing/2663.purs view
@@ -0,0 +1,10 @@+module Main where++import Prelude+import Prim.TypeError (class Warn, Text)+import Effect.Console (log)++foo :: forall t. Warn (Text "Example") => t -> t+foo x = x++main = when (foo 42 == 42) $ log "Done"
+ tests/purs/passing/2689.purs view
@@ -0,0 +1,36 @@+module Main where++import Prelude+import Effect.Console+import Data.Array.Partial+import Partial.Unsafe++sumTCObug = go identity where + go f 0 = f + go f n =+ let+ f' a = n + a+ in+ go f' 0++sumTCObug' = go identity where + go f 0 = f+ go f n = go (\a -> n + a) 0++count :: forall a. (a -> Boolean) -> Array a -> Int+count p = count' 0 where+ count' acc [] = acc+ count' acc xs =+ let h = unsafePartial head xs+ in count' (acc + if p h then 1 else 0) (unsafePartial tail xs)++main = do+ let x = sumTCObug 7 3+ y = sumTCObug' 7 3+ z = count (_ > 0) [-1, 0, 1]+ logShow x+ logShow y + logShow z+ if x == 10 && y == 10 && z == 1+ then log "Done"+ else log "Fail"
+ tests/purs/passing/2756.purs view
@@ -0,0 +1,20 @@+module Main where++import Effect (Effect)+import Effect.Console (log)+import Prelude++pu :: forall i. i -> Effect Unit+pu _ = pure unit++type C i = { pu :: i -> Effect Unit }++sampleC :: C Unit+sampleC = { pu: pu }++newtype Identity a = Id a++sampleIdC :: Identity (C Unit)+sampleIdC = Id { pu : pu }++main = log "Done"
+ tests/purs/passing/2787.purs view
@@ -0,0 +1,8 @@+module Main where++import Prelude+import Effect.Console++main+ | between 0 1 2 = log "Fail"+ | otherwise = log "Done"
+ tests/purs/passing/2795.purs view
@@ -0,0 +1,14 @@+module Main where++import Prelude+import Effect.Console (log)++data X = X Int | Y++x :: X -> Int+x = case _ of+ Y -> 0+ X n | 1 <- n -> 1+ | otherwise -> 2++main = log "Done"
+ tests/purs/passing/2803.purs view
@@ -0,0 +1,17 @@+module Main where++import Prelude ((+), (-), (==))+import Effect.Console (log)++f :: Int -> Int -> Int+f = (+)++infixl 6 f as %++g :: Int -> Int -> Int+g a b = let f = (-) in a % b++main =+ if g 10 5 == 15+ then log "Done"+ else log "Failed"
+ tests/purs/passing/2806.purs view
@@ -0,0 +1,14 @@+module Main where++import Prelude+import Effect.Console (log)++data Stream a = Cons a (Stream a)++step :: forall a. Stream a -> Stream a+step (Cons _ xs) = xs++head :: forall a. Stream a -> a+head xs | Cons x _ <- step xs = x++main = log "Done"
+ tests/purs/passing/2941.purs view
@@ -0,0 +1,18 @@+module Main where++import Effect.Console (log)++test0 = ((((\_ -> 0) :: b -> Int) :: forall b. b -> Int) :: forall a. a -> Int)++test1 :: {attr :: forall a. a -> Int}+test1 = {attr: ((\_ -> 0) :: b -> Int) :: forall b. b -> Int}++class Test2 where+ f :: forall a. a -> a++instance test2 :: Test2 where+ f :: forall a. a -> a+ f x = (x :: a)+++main = log "Done"
+ tests/purs/passing/2947.purs view
@@ -0,0 +1,11 @@+module Main where++import Prelude+import Effect.Console (log)++data Foo = Foo++instance eqFoo :: Eq Foo where+ eq _ _ = true++main = log "Done"
+ tests/purs/passing/2958.purs view
@@ -0,0 +1,14 @@+module Main where++import Effect.Console++data Nil+data Snoc xs x++infixl 1 type Snoc as :>++type One = Nil :> Int+type Two = Nil :> Int :> Int+type Three = Nil :> Int :> Int :> Int++main = log "Done"
+ tests/purs/passing/2972.purs view
@@ -0,0 +1,13 @@+module Main where++import Effect.Console (log)+import Prelude (class Show, show)++type I t = t++newtype Id t = Id t++instance foo :: Show (I t) => Show (Id t) where+ show (Id t) = "Done"++main = log (show (Id "other"))
+ tests/purs/passing/3114.purs view
@@ -0,0 +1,54 @@+module Main where++import Prelude++import Data.Either+import Data.Maybe+import Data.Tuple+import Effect+import Effect.Console (log)+import VendoredVariant+import Data.Symbol+import Type.Proxy (Proxy(..))++type TestVariants =+ ( foo :: Proxy Maybe+ , bar :: Proxy (Tuple String)+ )++_foo :: Proxy "foo"+_foo = Proxy++_bar :: Proxy "bar"+_bar = Proxy++main :: Effect Unit+main = do+ let+ -- with the type signatures on `a`, this compiles fine.+ case1 :: VariantF TestVariants Int → String+ case1 = case_+ # on _foo (\a → "foo: " <> show (a :: Maybe Int))+ # on _bar (\a → "bar: " <> show (a :: Tuple String Int))++ -- without the type signature, this would complain about+ -- Could not match type + -- Array+ -- with type+ -- Tuple String+ -- while trying to match the type FProxy Array+ -- with type FProxy (Tuple String)+ -- while solving type class constraint+ -- Prim.RowCons "baz"+ -- (FProxy t0)+ -- t1+ -- ( foo :: FProxy Maybe+ -- , bar :: FProxy (Tuple String)+ -- )+ -- while inferring the type of `on _baz`+ case2 :: VariantF TestVariants Int → String+ case2 = case_+ # on _foo (\a → "foo: " <> show a)+ # on _bar (\a → "bar: " <> show a)++ log "Done"
+ tests/purs/passing/3114/VendoredVariant.purs view
@@ -0,0 +1,42 @@+module VendoredVariant where++import Prelude++import Prim.Row as Row++import Unsafe.Coerce (unsafeCoerce)+import Partial.Unsafe (unsafeCrashWith)+import Data.Symbol+import Type.Proxy (Proxy(..))++data VariantF (f :: Row Type) a++newtype VariantFRep f a = VariantFRep+ { type :: String+ , value :: f a+ , map :: forall x y. (x -> y) -> f x -> f y+ }++case_ :: forall a b. VariantF () a -> b+case_ r = unsafeCrashWith case unsafeCoerce r of+ VariantFRep v -> "failure on " <> v.type++on+ :: forall sym f a b r1 r2+ . Row.Cons sym (Proxy f) r1 r2+ => IsSymbol sym+ => Proxy sym+ -> (f a -> b)+ -> (VariantF r1 a -> b)+ -> VariantF r2 a+ -> b+on p f g r =+ case coerceY r of+ VariantFRep v | v.type == reflectSymbol p -> f v.value+ _ -> g (coerceR r)+ where+ coerceY :: VariantF r2 a -> VariantFRep f a+ coerceY = unsafeCoerce++ coerceR :: VariantF r2 a -> VariantF r1 a+ coerceR = unsafeCoerce
+ tests/purs/passing/3125.purs view
@@ -0,0 +1,16 @@+module Main where++import Prelude+import Data.Monoid (class Monoid, mempty)+import Effect.Console (log, logShow)++data B a = B a a++memptyB :: forall a b. Monoid b => B (a -> b)+memptyB = B l r where+ l _ = mempty+ r _ = mempty++main = do+ logShow $ case (memptyB :: B (Int -> Array Unit)) of B l r -> l 0 == r 0+ log "Done"
+ tests/purs/passing/3187-UnusedNameClash.purs view
@@ -0,0 +1,12 @@+module Main (main) where++import Prelude ((+))+import Effect.Console (log)++-- the __unused parameter used to get optimized away+abuseUnused :: forall a. a -> a+abuseUnused __unused = __unused++main = do+ let explode = abuseUnused 0 + abuseUnused 0+ log "Done"
+ tests/purs/passing/3238.purs view
@@ -0,0 +1,14 @@+module Main where++import Effect.Console (log)++class C a++class FD a b | a -> b++fn1 :: forall a b. FD a b => C b => a -> String+fn1 _ = ""++fn2 x = fn1 x++main = log "Done"
+ tests/purs/passing/3329.purs view
@@ -0,0 +1,34 @@+module Main where++import Prelude++import Data.Either (Either(..))+import Data.Maybe (Maybe(..))+import Effect (Effect)+import Effect.Console (log)++class Inject f g where+ inj :: f -> g+ prj :: g -> Maybe f++instance injectRefl :: Inject x x where+ inj x = x+ prj x = Just x+else instance injectLeft :: Inject l (Either l r) where+ inj x = Left x+ prj (Left x) = Just x+ prj _ = Nothing+else instance injectRight :: Inject x r => Inject x (Either l r) where+ inj x = Right (inj x)+ prj (Right x) = prj x+ prj _ = Nothing++injL :: forall f g. f -> Either f g+injL = inj++main :: Effect Unit+main = log "Done"+ where+ testInjLWithUnknowns a = case inj a of+ Left a' -> a'+ Right _ -> a
+ tests/purs/passing/3388.purs view
@@ -0,0 +1,10 @@+module Main where++import Prelude+import Effect.Console (log)++main = do+ let+ x = { a: 42, b: "foo" }+ { a, b } = x { a = 43 }+ log "Done"
+ tests/purs/passing/3410.purs view
@@ -0,0 +1,11 @@+module Main+ ( module Prelude+ , module DEN+ , main+ ) where++import Prelude+import Data.Either.Nested (type (\/)) as DEN+import Effect.Console (log)++main = log "Done"
+ tests/purs/passing/3481.purs view
@@ -0,0 +1,7 @@+module Main where++import Effect.Console (log)++message = { "0": { "1": "Done" }}++main = log message."0"."1"
+ tests/purs/passing/3510.purs view
@@ -0,0 +1,11 @@+module Main where++import Prelude (class Eq)+import Effect.Console (log)++data Maybe a = Just a | Nothing++type T = Maybe Int+derive instance eqT :: Eq T++main = log "Done"
+ tests/purs/passing/3549.purs view
@@ -0,0 +1,13 @@+module Main where++import Prelude++import Effect.Console (log)++identity :: forall (a :: Type) . a -> a+identity x = x++map' :: forall (f :: Type -> Type) (a :: Type) (b :: Type) . Functor f => (a -> b) -> f a -> f b+map' = map++main = log "Done"
+ tests/purs/passing/3558-UpToDateDictsForHigherOrderFns.purs view
@@ -0,0 +1,34 @@+module Main where++import Prelude (Unit)+import Effect (Effect)+import Effect.Console (log)+import Record.Unsafe (unsafeGet)+import Type.Data.Symbol (class IsSymbol, reflectSymbol)+import Type.Row (class Cons) as Row+import Type.Proxy (Proxy)++newtype LBox row a = LBox (∀ r. (∀ lbl _1. Row.Cons lbl a _1 row ⇒ IsSymbol lbl ⇒ Proxy lbl → r) → r)++unLBox ∷ ∀ row a r. (∀ lbl _1. Row.Cons lbl a _1 row ⇒ IsSymbol lbl ⇒ Proxy lbl → r) → LBox row a → r+unLBox g (LBox f) = f g++-- Example 1+lboxIdentity ∷ ∀ row a. LBox row a → LBox row a+lboxIdentity = unLBox \lbl → LBox \f → f lbl++-- Example 2+read ∷ ∀ row a. Record row → LBox row a → a+read rec = unLBox \lbl → get lbl rec++get+ :: forall r r' l a+ . IsSymbol l+ => Row.Cons l a r' r+ => Proxy l+ -> Record r+ -> a+get l r = unsafeGet (reflectSymbol l) r++main :: Effect Unit+main = log "Done"
+ tests/purs/passing/3595.purs view
@@ -0,0 +1,14 @@+module Main where++import Prelude as P+import Effect (Effect)+import Effect.Console (log)++class P.Show a <= Show a where+ id :: a -> a++instance showString :: Show String where+ id x = x++main :: Effect P.Unit+main = log (id "Done")
+ tests/purs/passing/3830.purs view
@@ -0,0 +1,16 @@+module Main where++import Effect.Console (log)++data Proxy :: forall k. k -> Type+data Proxy a = Proxy++data PProxy :: forall k1 (k2 :: k1). (Proxy k2 -> Type) -> Type+data PProxy p = PProxy++type PProxy' = PProxy++test :: PProxy' Proxy+test = PProxy++main = log "Done"
+ tests/purs/passing/3941.purs view
@@ -0,0 +1,25 @@+module Main where++import Effect.Console (log)+import Unsafe.Coerce (unsafeCoerce)++class TwoParams a b where+ func :: a -> b++instance equals :: TwoParams a a where+ func a = a+else+instance any :: TwoParams a b where+ func = unsafeCoerce++testEquals :: forall a. a -> a+testEquals = func -- with instance `equals`+testAny :: Int -> Boolean+testAny = func -- with instance `any`++-- `a` and `m a` are never unifiable unless we have infinite types (and of course not)+-- so expected that the instance `any` is chosen.+thisShouldBeCompiled :: forall m a. a -> m a+thisShouldBeCompiled = func++main = log "Done"
+ tests/purs/passing/3957.purs view
@@ -0,0 +1,39 @@+module Main where++import Prelude+import Effect.Console (log)+import Test.Assert (assertEqual)++data Maybe a = Nothing | Just a++f :: Int -> Int+f x = case x of+ 0 -> 0+ n | _ <- n -> f (x - 1)+ _ -> f (x - 2)++g :: Int -> Int+g x = case x of+ 0 -> 0+ n | n == n, true -> g (x - 1)+ _ -> g (x - 2)++weirdsum :: Int -> (Int -> Maybe Int) -> Int -> Int+weirdsum accum f n = case n of+ 0 -> accum+ x | Just y <- f x -> weirdsum (accum + y) f (n - 1)+ _ -> weirdsum accum f (n - 1)++tricksyinners :: Int -> Int -> Int+tricksyinners accum x = case x of+ 0 -> accum + f' x * f' x+ n -> tricksyinners (accum + 2) (n - 1)+ where+ f' y = y + 3++main = do+ assertEqual { expected: 0, actual: f 100000 }+ assertEqual { expected: 0, actual: g 100000 }+ assertEqual { expected: 20, actual: weirdsum 0 (\x -> if x < 5 then Just (2 * x) else Nothing) 100000 }+ assertEqual { expected: 200009, actual: tricksyinners 0 100000 }+ log "Done"
+ tests/purs/passing/4035.purs view
@@ -0,0 +1,14 @@+module Main where++import Effect.Console (log)+import Other (Id)++type Alias = Int++type Wrapped :: forall k. (Type -> k) -> Row k -> Row k+type Wrapped f r = (key :: f Alias | r)++type Unwrapped :: Row Type -> Row Type+type Unwrapped r = Wrapped Id r++main = log "Done"
+ tests/purs/passing/4035/Other.purs view
@@ -0,0 +1,4 @@+module Other where++type Id :: forall k. k -> k+type Id a = a
+ tests/purs/passing/4038.purs view
@@ -0,0 +1,11 @@+module Main where++import Effect.Console (log)++class A :: Constraint+class A++class B :: Constraint+class A <= B++main = log "Done"
+ tests/purs/passing/4101.purs view
@@ -0,0 +1,20 @@+module Main where++import Effect.Console (log)++import Lib++class ClassA :: Type -> Type -> Constraint+class ClassA t a++class ClassB :: Type -> Type -> Constraint+class ClassA t a <= ClassB t a++data VariantF :: (Type -> Type) -> Type+data VariantF fs+data Expr++instance a :: ClassA Expr (VariantF UNIT)+instance b :: ClassB Expr (VariantF UNIT)++main = log "Done"
+ tests/purs/passing/4101/Lib.purs view
@@ -0,0 +1,9 @@+module Lib where++newtype Const :: forall k. Type -> k -> Type+newtype Const a b = Const a++data Unit = Unit++type CONST = Const+type UNIT = CONST Unit
+ tests/purs/passing/4105.purs view
@@ -0,0 +1,12 @@+module Main where++import Prelude++import Effect.Console (log)++import Lib (Patch)++newtype UpdateDto = UpdateDto Patch+derive instance eqUpdateDto :: Eq UpdateDto++main = log "Done"
+ tests/purs/passing/4105/Lib.purs view
@@ -0,0 +1,5 @@+module Lib where++type Template col = { bio :: col String }+type Identity a = a+type Patch = Template Identity
+ tests/purs/passing/4174.purs view
@@ -0,0 +1,16 @@+module Main where++import Data.Unit (Unit, unit)+import Effect.Console (log)++data Effect_Console = Effect_Console++d :: Effect_Console+d = Effect_Console++newtype Data_Unit = Data_Unit Unit++n :: Data_Unit+n = Data_Unit unit++main = log "Done"
+ tests/purs/passing/4179.js view
@@ -0,0 +1,2 @@+export const runtimeImportImpl = nothing => just => moduleName => body => () =>+ import(`../${moduleName}/index.js`).then(() => body(nothing)(), err => body(just(err.toString()))());
+ tests/purs/passing/4179.purs view
@@ -0,0 +1,73 @@+module Main where++import Prelude++import Data.Maybe (Maybe(..))+import Effect (Effect)+import Effect.Console (log)+import Test.Assert (assertEqual)+import CustomAssert (assertThrows)++force :: forall a b. (Unit -> b) -> b+force f = f unit++alpha = { backref: \_ -> bravo, x: 1 }+bravo = force \_ -> alpha.x+++complicatedIdentity :: forall a. a -> a+complicatedIdentity = h+ where+ -- This highly contrived function tests that escalating force is caught and+ -- doesn't cause an infinite loop during compilation. ("Escalating force"+ -- means that invoking `f` with two argument leads to `f` being invoked with+ -- three arguments, and so on.)++ -- If the escalating loop in `f` isn't taken into account, `h` might be+ -- initialized before `g`, which will lead to a run-time error. The intended+ -- behavior is to lazily initialize `g` and `h` together, and let the fact+ -- that at run time `g` never actually dereferences `h` resolve the+ -- initialization ordering.++ f :: forall a. Int -> { tick :: a -> a, tock :: a -> a }+ f n = { tick: if n <= 0 then identity else (f (n - 1)).tock identity, tock: \a -> g n a }++ g :: forall a. Int -> a -> a+ g = (\bit -> if bit then \n -> (f n).tick else const h) true++ h :: forall a. a -> a+ h = (\n -> (f n).tick) 10+++foreign import runtimeImportImpl :: forall a. Maybe String -> (String -> Maybe String) -> String -> (Maybe String -> Effect a) -> Effect a++runtimeImport :: forall a. String -> (Maybe String -> Effect a) -> Effect a+runtimeImport = runtimeImportImpl Nothing Just++type ID = forall a. a -> a++main = do+ err <- assertThrows \_ ->+ let+ selfOwn = { a: 1, b: force \_ -> selfOwn.a }+ in selfOwn+ assertEqual { actual: err, expected: "ReferenceError: selfOwn was needed before it finished initializing (module Main, line 52)" }++ err2 <- assertThrows \_ ->+ let+ f = (\_ -> { left: g identity, right: h identity }) unit++ g :: ID -> ID+ g x = (j x x x).right++ h :: ID -> ID -> { left :: ID, right :: ID }+ h x = j x x++ j x y z = { left: x y z, right: f.left }+ in f+ assertEqual { actual: err2, expected: "ReferenceError: f was needed before it finished initializing (module Main, line 66)" }++ assertEqual { actual: bravo, expected: 1 }+ runtimeImport "InitializationError" \err3 -> do+ assertEqual { actual: err3, expected: Just "ReferenceError: alphaArray was needed before it finished initializing (module InitializationError, line 0)" } -- TODO: fix the 0+ log "Done"
+ tests/purs/passing/4179/CustomAssert.js view
@@ -0,0 +1,12 @@+export var assertThrowsImpl = function (arg) {+ return function (f) {+ return function () {+ try {+ f(arg);+ } catch (e) {+ return e.toString();+ }+ throw new Error("Assertion failed: An error should have been thrown");+ };+ };+};
+ tests/purs/passing/4179/CustomAssert.purs view
@@ -0,0 +1,10 @@+module CustomAssert (assertThrows) where++import Prelude++import Effect (Effect)++assertThrows :: forall a. (Unit -> a) -> Effect String+assertThrows = assertThrowsImpl unit++foreign import assertThrowsImpl :: forall a b. a -> (a -> b) -> Effect String
+ tests/purs/passing/4179/InitializationError.purs view
@@ -0,0 +1,14 @@+module InitializationError where++class Alpha a where+ alpha :: a Int -> a Int+class Alpha a <= Bravo a+class Bravo a <= Charlie a++charlieAlpha :: forall a. Charlie a => a Int -> a Int+charlieAlpha = alpha++instance alphaArray :: Alpha Array where+ alpha = charlieAlpha+instance Bravo Array+instance Charlie Array
+ tests/purs/passing/4180.purs view
@@ -0,0 +1,14 @@+module Main where++import Effect.Console (log)++class C (t :: Type)+instance C (f a)++f :: C (Array String) => Int+f = 0++v :: Int+v = f++main = log "Done"
+ tests/purs/passing/4194.purs view
@@ -0,0 +1,14 @@+module Main where++import Effect.Console (log)++data Identity a+data Maybe a++class ErrorSemigroup o m w | w -> o m, o m -> w++instance ErrorSemigroup (Identity o) (Identity m) (Identity w)++instance ErrorSemigroup o (Maybe m) (Maybe w)++main = log "Done"
+ tests/purs/passing/4200.purs view
@@ -0,0 +1,11 @@+module Main where++import Data.Newtype (class Newtype)+import Effect.Console (log)+import Lib (TAlias)++newtype NewA a = NewA (TAlias Int)++derive instance Newtype (NewA a) _++main = log "Done"
+ tests/purs/passing/4200/Lib.purs view
@@ -0,0 +1,7 @@+module Lib where++data T :: forall m. m -> Type+data T msg = E++type TAlias :: forall k. k -> Type+type TAlias msg = T msg
+ tests/purs/passing/4229.purs view
@@ -0,0 +1,13 @@+module Main where++import Effect.Console (log)+import Partial.Unsafe (unsafePartial)++data X = Prim++f :: Partial => Int -> Int+f 0 = 0++f' = unsafePartial f++main = log "Done"
+ tests/purs/passing/4310.purs view
@@ -0,0 +1,8 @@+module Main where++import Effect.Console (log)+import Lib++main = do+ let q = runTest (4 /\ 4)+ log "Done"
+ tests/purs/passing/4310/Lib.purs view
@@ -0,0 +1,17 @@+module Lib where++import Prelude++data Tuple a b = Tuple a b++infixr 6 Tuple as /\+infixr 6 type Tuple as /\++class Test a where+ runTest :: a -> String++instance Test Int where+ runTest _ = "4"++instance (Test a, Test b) => Test (a /\ b) where+ runTest (a /\ b) = runTest a <> runTest b
+ tests/purs/passing/4357.purs view
@@ -0,0 +1,29 @@+module Main where++import Prelude++import Data.Foldable (fold)+import Data.Maybe (Maybe(..))+import Data.Monoid.Additive (Additive(..))+import Effect.Console (log)++data Foo = Foo Int | Bar Int++g :: Foo -> Int+g =+ case _ of+ a+ | Bar z <- a+ -> z+ | Foo z <- a+ -> z+ | otherwise+ -> 42++-- solved as a consequence of #4358+test :: Maybe Int -> Int+test = case _ of+ m | Just fold <- m -> fold+ | otherwise -> case fold [] of Additive x -> x++main = log "Done"
+ tests/purs/passing/4376.purs view
@@ -0,0 +1,29 @@+module Main where++import Prelude+import Prim.Row (class Union)++import Data.Maybe (Maybe(..))+import Data.Monoid (mempty)+import Effect.Console (log)+import Type.Proxy (Proxy(..))++-- Make sure that record updates get monomorphized.+asNothing :: forall a. { a :: Maybe a } -> { a :: Maybe a }+asNothing = _ { a = Nothing }++union :: forall a b c. Union a b c => Record a -> Record b -> Proxy c+union _ _ = Proxy++-- This fails to solve if neither is monomorphized.+shouldSolve :: forall a b. Proxy ( a :: Maybe a, b :: Maybe b )+shouldSolve = { a: Nothing } `union` { b: Nothing }++-- Removes ConstrainedTypeUnified+v1 :: { a :: Maybe Unit }+v1 = { a : Just unit }++v2 :: { a :: Maybe Unit }+v2 = let v3 = v1 { a = mempty } in v3++main = log "Done"
+ tests/purs/passing/4431-2.purs view
@@ -0,0 +1,12 @@+module Main where++import Prelude+import Data.Const (Const)+import Effect.Console (log)++data TypedCache :: (Type -> Type) -> Type -> Type+data TypedCache key a = Get (key a)++derive instance Functor (TypedCache (Const k))++main = log "Done"
+ tests/purs/passing/4431.purs view
@@ -0,0 +1,11 @@+module Main where++import Prelude+import Effect.Console (log)++data TypedCache :: (Type -> Type) -> Type -> Type+data TypedCache key a = Get (key a)++derive instance Functor k => Functor (TypedCache k)++main = log "Done"
+ tests/purs/passing/4483.purs view
@@ -0,0 +1,12 @@+module Main where++import Effect.Console (log)+import Prim.TypeError++class Foo t where+ foo :: t -> String+ bar :: Int -> t++instance fooInt :: Fail (Text "can't use this") => Foo Int++main = log "Done"
+ tests/purs/passing/4500.purs view
@@ -0,0 +1,15 @@+module Main where++import Prelude++import Data.Reflectable (class Reflectable, reflectType)+import Type.Proxy (Proxy(..))+import Effect.Console (log)++reflect :: forall @t v . Reflectable t v => v+reflect = reflectType (Proxy @t)++use :: String+use = show { asdf: reflect @"asdf" }++main = log "Done"
+ tests/purs/passing/652.purs view
@@ -0,0 +1,18 @@+module Main where++import Prelude+import Effect.Console (log)++class Foo a b++class Bar a c++class (Foo a b, Bar a c) <= Baz a b c++instance foo :: Foo (a -> b) a++instance bar :: Bar (a -> b) b++instance baz :: (Eq a) => Baz (a -> b) a b++main = log "Done"
+ tests/purs/passing/810.purs view
@@ -0,0 +1,14 @@+module Main where++import Prelude+import Effect.Console (log)++data Maybe a = Nothing | Just a++test :: forall a. Maybe a -> Maybe a+test m = o.x+ where+ o = case m of Nothing -> { x : Nothing }+ Just a -> { x : Just a }++main = log "Done"
+ tests/purs/passing/862.purs view
@@ -0,0 +1,8 @@+module Main where++import Prelude+import Effect.Console++id' = (\x -> x) <$> \y -> y++main = log (id' "Done")
+ tests/purs/passing/922.purs view
@@ -0,0 +1,20 @@+module Main where++import Prelude++import Effect.Console++class Default a where+ def :: a++instance defaultString :: Default String where+ def = "Done"++data I a = I a++instance defaultI :: (Default a) => Default (I a) where+ def = I def++main = do+ case def of+ I s -> log s
+ tests/purs/passing/Ado.purs view
@@ -0,0 +1,77 @@+module Main where++import Prelude+import Effect.Console (log)+import Effect.Ref as Ref++data Maybe a = Nothing | Just a++instance functorMaybe :: Functor Maybe where+ map f Nothing = Nothing+ map f (Just x) = Just (f x)++instance applyMaybe :: Apply Maybe where+ apply (Just f) (Just x) = Just (f x)+ apply _ _ = Nothing++instance applicativeMaybe :: Applicative Maybe where+ pure = Just++test1 = \_ -> ado+ in "abc"++test2 = \_ -> ado+ x <- Just 1.0+ y <- Just 2.0+ in x + y++test3 = \_ -> ado+ _ <- Just 1.0+ _ <- Nothing :: Maybe Number+ in 2.0++test4 mx my = ado+ x <- mx+ y <- my+ in x + y + 1.0++test5 mx my mz = ado+ x <- mx+ y <- my+ let sum = x + y+ z <- mz+ in z + sum + 1.0++test6 mx = \_ -> ado+ let+ f :: forall a. Maybe a -> a+ f (Just x) = x+ in f mx++test8 = \_ -> ado+ in (ado+ in 1.0)++test9 = \_ -> (+) <$> Just 1.0 <*> Just 2.0++test10 _ = ado+ let+ f x = g x * 3.0+ g x = f x / 2.0+ in f 10.0++test11 = \_ -> ado+ x <- pure 1+ y <- pure "A"+ z <- pure []+ in show (x :: Int) <> y <> show (z :: Array Int)++main = do+ r <- Ref.new "X"+ log =<< ado+ _ <- Ref.write "D" r+ a <- Ref.read r+ b <- pure "o"+ let c = "n"+ d <- pure "e"+ in a <> b <> c <> d
+ tests/purs/passing/AppendInReverse.purs view
@@ -0,0 +1,38 @@+module Main where++import Prelude+import Prim.Symbol (class Append)+import Effect.Console (log)+import Type.Proxy (Proxy(..))++class Balanced (sym :: Symbol)++instance balanced1 :: Balanced ""+else+instance balanced2+ :: ( Append "(" sym1 sym+ , Append sym2 ")" sym1+ , Balanced sym2+ ) => Balanced sym++balanced :: forall sym. Balanced sym => Proxy sym -> String+balanced _ = "ok"++b0 :: String+b0 = balanced (Proxy :: Proxy "")++b1 :: String+b1 = balanced (Proxy :: Proxy "()")++b2 :: String+b2 = balanced (Proxy :: Proxy "(())")++b3 :: String+b3 = balanced (Proxy :: Proxy "((()))")++main = do+ log b0+ log b1+ log b2+ log b3+ log "Done"
+ tests/purs/passing/Applicative.purs view
@@ -0,0 +1,16 @@+module Main where++import Effect.Console (log)++class Applicative f where+ pure :: forall a. a -> f a+ apply :: forall a b. f (a -> b) -> f a -> f b++data Maybe a = Nothing | Just a++instance applicativeMaybe :: Applicative Maybe where+ pure = Just+ apply (Just f) (Just a) = Just (f a)+ apply _ _ = Nothing++main = log "Done"
+ tests/purs/passing/ArrayType.purs view
@@ -0,0 +1,12 @@+module Main where++import Prelude+import Effect.Console (log)++class Pointed p where+ point :: forall a. a -> p a++instance pointedArray :: Pointed Array where+ point a = [a]++main = log "Done"
+ tests/purs/passing/Auto.purs view
@@ -0,0 +1,16 @@+module Main where++import Prelude+import Effect.Console (log)++data Auto s i o = Auto { state :: s, step :: s -> i -> o }++type SomeAuto i o = forall r. (forall s. Auto s i o -> r) -> r++exists :: forall s i o. s -> (s -> i -> o) -> SomeAuto i o+exists = \state step f -> f (Auto { state: state, step: step })++run :: forall i o. SomeAuto i o -> i -> o+run = \s i -> s (\a -> case a of Auto a -> a.step a.state i)++main = log "Done"
+ tests/purs/passing/AutoPrelude.purs view
@@ -0,0 +1,11 @@+module Main where++import Prelude+import Effect.Console (log)++f x = x * 10.0+g y = y - 10.0++main = do+ log $ show $ (f <<< g) 100.0+ log "Done"
+ tests/purs/passing/AutoPrelude2.purs view
@@ -0,0 +1,10 @@+module Main where++import Prelude+import Prelude as P+import Effect.Console++f :: forall a. a -> a+f = P.identity++main = P.($) log ((f P.<<< f) "Done")
+ tests/purs/passing/BigFunction.purs view
@@ -0,0 +1,140 @@+module Main where++import Prelude+import Data.Maybe+import Data.Array(index)+import Effect.Console(log)++main = let x = f [] in log "Done"++lookup :: forall a. Int -> Array a -> Maybe a+lookup = flip index++f :: Array (Array Int) -> Int+f [] = 0+f [m] | Just x <- lookup 1 m = x+f [m, mm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm = x + xx+f [m, mm, mmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm = x + xx + xxx+f [m, mm, mmm, mmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm = x + xx + xxx + xxxx+f [m, mm, mmm, mmmm, mmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm = x + xx + xxx + xxxx + xxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [] = 0+f [m] | Just x <- lookup 1 m = x+f [m, mm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm = x + xx+f [m, mm, mmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm = x + xx + xxx+f [m, mm, mmm, mmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm = x + xx + xxx + xxxx+f [m, mm, mmm, mmmm, mmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm = x + xx + xxx + xxxx + xxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f [m, mm, mmm, mmmm, mmmmm, mmmmmm, mmmmmmm, mmmmmmmm, mmmmmmmmm, mmmmmmmmmm, mmmmmmmmmmm, mmmmmmmmmmmm, mmmmmmmmmmmmm, mmmmmmmmmmmmmm, mmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm] | Just x <- lookup 1 m, Just xx <- lookup 11 mm, Just xxx <- lookup 111 mmm, Just xxxx <- lookup 1111 mmmm, Just xxxxx <- lookup 11111 mmmmm, Just xxxxxx <- lookup 6 mmmmmm, Just xxxxxxx <- lookup 5 mmmmmmm, Just xxxxxxxx <- lookup 4 mmmmmmmm, Just xxxxxxxxx <- lookup 3 mmmmmmmmm, Just xxxxxxxxxx <- lookup 2 mmmmmmmmmm, Just xxxxxxxxxxx <- lookup 2 mmmmmmmmmmm, Just xxxxxxxxxxxx <- lookup 21 mmmmmmmmmmmm, Just xxxxxxxxxxxxx <- lookup 211 mmmmmmmmmmmmm, Just xxxxxxxxxxxxxx <- lookup 2111 mmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxx <- lookup 21111 mmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxx <- lookup 211111 mmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxx <- lookup 26 mmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxx <- lookup 25 mmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxx <- lookup 24 mmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxx <- lookup 23 mmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxx <- lookup 22 mmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxx <- lookup 221 mmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211 mmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22111 mmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 221111 mmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2211111 mmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 226 mmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2224 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2223 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 2222111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22221111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 222211111 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22226 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm, Just xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <- lookup 22225 mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm = x + xx + xxx + xxxx + xxxxx + xxxxxx + xxxxxxx + xxxxxxxx + xxxxxxxxx + xxxxxxxxxx + xxxxxxxxxxx + xxxxxxxxxxxx + xxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+f _ = 2137
+ tests/purs/passing/BindersInFunctions.purs view
@@ -0,0 +1,16 @@+module Main where++import Prelude+import Partial.Unsafe (unsafePartial)+import Test.Assert (assert')+import Effect (Effect)+import Effect.Console (log)++snd :: forall a. Partial => Array a -> a+snd = \[_, y] -> y++main :: Effect _+main = do+ let ts = unsafePartial (snd [1.0, 2.0])+ assert' "Incorrect result from 'snd'." (ts == 2.0)+ log "Done"
+ tests/purs/passing/BindingGroups.purs view
@@ -0,0 +1,11 @@+module Main where++import Prelude+import Effect.Console (log)++foo = bar+ where bar r = r + 1.0++r = foo 2.0++main = log "Done"
+ tests/purs/passing/BlockString.purs view
@@ -0,0 +1,9 @@+module Main where++import Prelude+import Effect.Console (log)++foo :: String+foo = """foo"""++main = log "Done"
+ tests/purs/passing/BlockStringEdgeCases.purs view
@@ -0,0 +1,30 @@+module Main where++import Prelude+import Effect.Console (log)+import Test.Assert (assert')++data Tuple a b = Tuple a b+derive instance tupleEq :: (Eq a, Eq b) => Eq (Tuple a b)++main = do+ assert' "empty string" ("""""" == "")+ assert' "quote" (""""""" == "\"")+ assert' "starts with quote" (""""x""" == "\"x")+ assert' "ends with quote" ("""x"""" == "x\"")+ assert' "two quotes" ("""""""" == "\"\"")+ assert' "starts with two quotes" ("""""x""" == "\"\"x")+ assert' "ends with two quotes" ("""x""""" == "x\"\"")+ assert' "starts and ends with two quotes" ("""""x""""" == "\"\"x\"\"")+ assert' "mixture 1" ("""""x"y""z"""" == "\"\"x\"y\"\"z\"")+ assert' "mixture 2" ("""x"y""z""" == "x\"y\"\"z")++ -- These last tests are more about forbidding certain raw string literal+ -- edge cases than about wanting to support mashing string literals against.+ -- each other, which is techically legal but generally, if not universally,+ -- a bad idea.+ assert' "too many quotes 1" (Tuple """"""""" " == Tuple "\"\"" " ")+ assert' "too many quotes 2" (Tuple """""""""" == Tuple "\"\"" "")+ assert' "too many quotes 3" (Tuple """x"""""" " == Tuple "x\"\"" " ")+ assert' "too many quotes 4" (Tuple """x""""""" == Tuple "x\"\"" "")+ log "Done"
+ tests/purs/passing/CSEInitialDigitSymbols.purs view
@@ -0,0 +1,16 @@+module Main where++import Data.Symbol (class IsSymbol, reflectSymbol)+import Effect.Console (log)+import Type.Proxy (Proxy(..))++reflectSymbol' :: forall s. IsSymbol s => Proxy s -> String+reflectSymbol' = reflectSymbol++two = reflectSymbol (Proxy :: _ "2")+two2 = reflectSymbol' (Proxy :: _ "2")++twoThirty = reflectSymbol (Proxy :: _ "2:30")+twoThirty2 = reflectSymbol' (Proxy :: _ "2:30")++main = log "Done"
+ tests/purs/passing/CaseInDo.purs view
@@ -0,0 +1,21 @@+module Main where++import Prelude+import Partial.Unsafe (unsafeCrashWith)+import Effect.Console+import Effect++doIt :: Effect Boolean+doIt = pure true++set = do+ log "Testing..."+ case 0 of+ 0 -> doIt+ _ -> pure false++main = do+ b <- set+ case b of+ true -> log "Done"+ false -> unsafeCrashWith "Failed"
+ tests/purs/passing/CaseInputWildcard.purs view
@@ -0,0 +1,18 @@+module Main where++import Prelude+import Effect (Effect)+import Effect.Console (log)++data Foo = X | Y++what ∷ Foo → Int → Boolean → Foo+what x = case _, x, _ of+ 0, X, true → X+ 0, Y, true → X+ _, _, _ → Y++main :: Effect Unit+main = do+ let tmp = what Y 0 true+ log "Done"
+ tests/purs/passing/CaseMultipleExpressions.purs view
@@ -0,0 +1,21 @@+module Main where++import Prelude+import Partial.Unsafe (unsafeCrashWith)+import Effect.Console+import Effect++doIt :: Effect Boolean+doIt = pure true++set = do+ log "Testing..."+ case 42, 10 of+ 42, 10 -> doIt+ _ , _ -> pure false++main = do+ b <- set+ case b of+ true -> log "Done"+ false -> unsafeCrashWith "Failed"
+ tests/purs/passing/CaseStatement.purs view
@@ -0,0 +1,22 @@+module Main where++import Prelude+import Effect.Console (log)++data A = A | B | C++f a _ A = a+f _ a B = a+f _ _ C = "Done"++g a _ A = a+g _ b B = b+g _ _ C = C++data M a = N | J a++h f N a = a+h f a N = a+h f (J a) (J b) = J (f a b)++main = log $ f "Done" "Failed" A
+ tests/purs/passing/CheckFunction.purs view
@@ -0,0 +1,8 @@+module Main where++import Prelude+import Effect.Console (log)++test = ((\x -> x+1.0) >>> (\x -> x*2.0)) 4.0++main = log "Done"
+ tests/purs/passing/CheckSynonymBug.purs view
@@ -0,0 +1,13 @@+module Main where++import Prelude+import Effect.Console (log)++length :: forall a. Array a -> Int+length _ = 0++type Foo a = Array a++foo _ = length ([] :: Foo Number)++main = log "Done"
+ tests/purs/passing/CheckTypeClass.purs view
@@ -0,0 +1,18 @@+module Main where++import Prelude+import Effect.Console (log)++data Bar a = Bar+data Baz++class Foo a where+ foo :: Bar a -> Baz++foo_ :: forall a. Foo a => a -> Baz+foo_ x = foo ((mkBar :: forall a. Foo a => a -> Bar a) x)++mkBar :: forall a. a -> Bar a+mkBar _ = Bar++main = log "Done"
+ tests/purs/passing/Church.purs view
@@ -0,0 +1,18 @@+module Main where++import Effect.Console (log)++type List a = forall r. r -> (a -> r -> r) -> r++empty :: forall a. List a+empty = \r f -> r++cons :: forall a. a -> List a -> List a+cons = \a l r f -> f a (l r f)++append :: forall a. List a -> List a -> List a+append = \l1 l2 r f -> l2 (l1 r f) f++test = append (cons 1 empty) (cons 2 empty)++main = log "Done"
+ tests/purs/passing/ClassRefSyntax.purs view
@@ -0,0 +1,9 @@+module Main where++import Lib (class X, go)+import Effect.Console (log)++go' :: forall a. X a => a -> a+go' = go++main = log "Done"
+ tests/purs/passing/ClassRefSyntax/Lib.purs view
@@ -0,0 +1,4 @@+module Lib (class X, go) where++class X a where+ go :: a -> a
+ tests/purs/passing/Coercible.purs view
@@ -0,0 +1,290 @@+module Main where++import Coercible.Lib (NTLib1(..), NTLib2(..), NTLib3)++import Effect.Console (log)+import Prim.Coerce (class Coercible)+import Safe.Coerce (coerce)+import Type.Proxy (Proxy)++refl :: forall a. a -> a+refl = coerce++symm :: forall a b. Coercible a b => b -> a+symm = coerce++trans :: forall a b c. Coercible a b => Coercible b c => Proxy b -> a -> c+trans _ = coerce++trans' :: forall a b c. Coercible a b => Coercible c b => Proxy b -> a -> c+trans' _ = coerce++trans'' :: forall a b c d. Coercible a c => Coercible a d => Coercible d b => Proxy c -> Proxy d -> a -> b+trans'' _ _ = coerce++transSymm :: forall a b c. Coercible a b => Coercible b c => Proxy b -> c -> a+transSymm _ = coerce++type SynString = String++newtype NTString1 = NTString1 SynString++nt1ToString :: NTString1 -> String+nt1ToString = coerce++stringToNt1 :: String -> NTString1+stringToNt1 = coerce++toNT1 :: forall a. Coercible a String => a -> NTString1+toNT1 = coerce++toNT1Array :: forall a. Coercible a (Array String) => a -> Array NTString1+toNT1Array = coerce++newtype NTString2 = NTString2 String++nt2ToNT1 :: NTString2 -> NTString1+nt2ToNT1 = coerce++newtype Id1 a = Id1 a+newtype Id2 b = Id2 b++id1ToId2 :: forall a. Id1 a -> Id2 a+id1ToId2 = coerce++id12ToId21 :: forall b. Id1 (Id2 b) -> Id2 (Id1 b)+id12ToId21 = coerce++newtype Ap f a = Ap (f a)++apId1ToApId1 :: forall a b. Coercible a b => Ap Id1 a -> Ap Id1 b+apId1ToApId1 = coerce++apId1ToApId2 :: forall a. Ap Id1 a -> Ap Id2 a+apId1ToApId2 = coerce++newtype ApPolykind f = ApPolykind (f ())++apPolykind :: forall f. ApPolykind f -> f ()+apPolykind = coerce++newtype Phantom1 a b = Phantom1 a++phantom1TypeToPhantom1Symbol :: forall x (y :: Type) (z :: Symbol). Phantom1 x y -> Phantom1 x z+phantom1TypeToPhantom1Symbol = coerce++phantom1ToId12 :: forall x y. Phantom1 x y -> Id1 (Id2 x)+phantom1ToId12 = coerce++nested :: forall x y z. Phantom1 (Id1 (Phantom1 x y)) y -> Id2 (Phantom1 x (Phantom1 z z))+nested = coerce++id1IntToInt :: Id1 Int -> Int+id1IntToInt = coerce++id2IntToId1Int :: Id2 Int -> Id1 Int+id2IntToId1Int = coerce++newtype NTInt1 = NTInt1 Int++id2NTToId1Nt :: Id2 NTInt1 -> Id1 NTInt1+id2NTToId1Nt = coerce++id2NTToId1Int :: Id2 NTInt1 -> Id1 Int+id2NTToId1Int = coerce++newtype NTFn1 a b = NTFn1 (a -> Int -> b)+newtype NTFn2 x a b = NTFn2 (a -> x -> b)++ntFn1ToNTFn2 :: forall a b. NTFn1 a b -> NTFn2 Int a b+ntFn1ToNTFn2 = coerce++libExposedCtorToId2 :: forall z. NTLib1 z -> Id2 z+libExposedCtorToId2 = coerce++libReExportedCtorToId2 :: forall z. NTLib2 z -> Id2 z+libReExportedCtorToId2 = coerce++libHiddenCtorRepresentational :: forall a b. Coercible (NTLib3 a a) (NTLib3 a b) => NTLib3 a a -> NTLib3 a b+libHiddenCtorRepresentational = coerce++newtype Roles1 a b c = Roles1 (Phantom1 b c)++roles1ToSecond :: forall r s t. Roles1 r s t -> s+roles1ToSecond = coerce++data D a b = D a++underD :: D NTString1 Boolean -> D NTString2 Int+underD = coerce++givenCanonicalSameTyVarEq :: forall a b c d e. Coercible a (D b c) => Coercible a (D d e) => Proxy a -> b -> d+givenCanonicalSameTyVarEq _ = coerce++givenCanonicalDiffTyVarEq1 :: forall a b c d e. Coercible a (D b c) => Coercible b d => a -> D d e+givenCanonicalDiffTyVarEq1 = coerce++givenCanonicalDiffTyVarEq2 :: forall f g a b. Coercible a (f b) => Coercible f g => Proxy f -> a -> g b+givenCanonicalDiffTyVarEq2 _ = coerce++newtype NTD a b c d = NTD (D b d)++dToNTD :: forall i j k l. D j l -> NTD i (Id1 j) k (Phantom1 l k)+dToNTD = coerce++ntdToNTD :: forall i j k l. NTD i j k l -> NTD (Id1 k) (Phantom1 j k) Int Boolean+ntdToNTD = coerce++newtype RankN1 a b = RankN1 (forall r. r -> a)++rankN1ToRankN1 :: RankN1 NTString1 Int -> RankN1 String Boolean+rankN1ToRankN1 = coerce++data RankN2 a = RankN2 (forall a. a -> a)++rankN2ToRankN2 :: forall x y. RankN2 x -> RankN2 y+rankN2ToRankN2 = coerce++data RankN3 c = RankN3 (forall c. (forall c. c -> c) -> c)++rankN3ToRankN3 :: forall x y. RankN3 x -> RankN3 y+rankN3ToRankN3 = coerce++data RankN4 z = RankN4 (forall c. (forall z. c -> z) -> c)++rankN4ToRankN4 :: forall x y. RankN4 x -> RankN4 y+rankN4ToRankN4 = coerce++data Phantom2 a = Phantom++data Rec1 a = Rec1 { f :: a }++rec1ToRec1 :: Rec1 Int -> Rec1 (Id1 Int)+rec1ToRec1 = coerce++data Rec2 a b = Rec2 { f :: a, g :: Int, h :: b }++rec2ToRec2 :: Rec2 Int (Phantom2 String) -> Rec2 (Id1 Int) (Phantom2 Int)+rec2ToRec2 = coerce++data Rec3 a = Rec3 {}++rec3ToRec3 :: forall m n. Rec3 m -> Rec3 n+rec3ToRec3 = coerce++newtype Rec4 f = Rec4 (f {})++unwrapRec4 :: forall f. Rec4 f -> f {}+unwrapRec4 = coerce++newtype Rec5 a f = Rec5 (f {})++apRec4ToApRec5 :: forall a. Ap Rec4 Id1 -> Ap (Rec5 a) Id1+apRec4ToApRec5 = coerce++type Rec6 a = { f :: a }++rec6ToRec6 :: Rec6 Int -> Rec6 (Id1 Int)+rec6ToRec6 = coerce++type Rec7 a b = { f :: a, g :: Int, h :: b }++rec7ToRec7 :: Rec7 Int (Phantom2 String) -> Rec7 (Id1 Int) (Phantom2 Int)+rec7ToRec7 = coerce++type Rec8 r a = { f :: a | r }++rec8ToRec8 :: forall r. Rec8 r Int -> Rec8 r (Id1 Int)+rec8ToRec8 = coerce++rec8ToRec8' :: forall r s. Coercible r s => Rec8 r Int -> Rec8 s (Id1 Int)+rec8ToRec8' = coerce++data Arr1 a b = Arr1 (Array a) (Array b)++arr1ToArr1 :: Arr1 Int String -> Arr1 (Id1 Int) (Id2 String)+arr1ToArr1 = coerce++arr1ToArr1Phantom :: forall a. Arr1 (Phantom2 Int) String -> Arr1 (Phantom2 a) (Id2 String)+arr1ToArr1Phantom = coerce++foreign import data Foreign1 :: Type -> Type -> Type++type role Foreign1 representational representational++foreign1ToForeign1 :: Foreign1 NTString1 (Phantom2 Int) -> Foreign1 String (Phantom2 Boolean)+foreign1ToForeign1 = coerce++foreign import data Foreign2 :: Type -> Type -> Type++type role Foreign2 phantom representational++foreign2ToForeign2 :: Foreign2 NTString2 (Phantom2 Int) -> Foreign2 Int (Phantom2 Boolean)+foreign2ToForeign2 = coerce++data MyMap k v = MyMap k v++type role MyMap nominal representational++mapToMap :: forall k1 k2 a b. Coercible (MyMap k1 a) (MyMap k2 b) => MyMap k1 a -> MyMap k2 b+mapToMap = coerce++mapStringToMapString :: MyMap String String -> MyMap String NTString1+mapStringToMapString = mapToMap++class Unary a++data Constrained1 a b = Constrained1 (Unary a => b)++constrained1ToConstrained1 :: forall a b. Constrained1 a b -> Constrained1 a (Id1 b)+constrained1ToConstrained1 = coerce++data Constrained2 a = Constrained2 a (forall a. Unary a => a)++type role Constrained2 representational++-- "role" should only be a reserved word after "type"+testRoleNotReserved :: String -> String+testRoleNotReserved role = role++-- "nominal", "representational" and "phantom" should only be reserved when in+-- role signatures+testRolesNotReserved :: String -> String -> String -> String+testRolesNotReserved nominal representational phantom = ""++data RoleNotReserved role = RoleNotReserved role++-- Contextual keywords should be allowed unquoted in rows.+type ContextualKeywords =+ ( nominal :: String+ , phantom :: String+ , representational :: String+ , role :: String+ )++newtype RecursiveRepresentational a+ = RecursiveRepresentational (RecursiveRepresentational a)+type role RecursiveRepresentational representational++recursiveRepresentational :: forall a b. Coercible a b => RecursiveRepresentational a -> RecursiveRepresentational b+recursiveRepresentational = coerce++data MutuallyRecursivePhantom1 a+ = MutuallyRecursivePhantom1 (MutuallyRecursivePhantom2 a)++data MutuallyRecursivePhantom2 a+ = MutuallyRecursivePhantom2 (MutuallyRecursivePhantom1 a)++mutuallyRecursivePhantom :: forall a b. MutuallyRecursivePhantom1 a -> MutuallyRecursivePhantom1 b+mutuallyRecursivePhantom = coerce++data MutuallyRecursiveRepresentational1 a+ = MutuallyRecursiveRepresentational1 a (MutuallyRecursiveRepresentational2 a)++data MutuallyRecursiveRepresentational2 a+ = MutuallyRecursiveRepresentational2 (MutuallyRecursiveRepresentational1 a)++mutuallyRecursiveRepresentational :: forall a. MutuallyRecursiveRepresentational1 a -> MutuallyRecursiveRepresentational1 (Id1 a)+mutuallyRecursiveRepresentational = coerce++main = log (coerce (NTString1 "Done") :: String)
+ tests/purs/passing/Coercible/Lib.purs view
@@ -0,0 +1,12 @@+module Coercible.Lib+ ( module Coercible.Lib2+ , NTLib1 (..)+ , NTLib3 (..)+ ) where++import Coercible.Lib2++newtype NTLib1 a = NTLib1 a++newtype NTLib3 a b = NTLib3 a+type role NTLib3 representational representational
+ tests/purs/passing/Coercible/Lib2.purs view
@@ -0,0 +1,3 @@+module Coercible.Lib2 where++newtype NTLib2 a = NTLib2 a
+ tests/purs/passing/Collatz.purs view
@@ -0,0 +1,21 @@+module Main where++import Prelude+import Effect+import Control.Monad.ST as ST+import Control.Monad.ST.Ref as STRef+import Effect.Console (log, logShow)++collatz :: Int -> Int+collatz n = ST.run (do+ r <- STRef.new n+ count <- STRef.new 0+ ST.while (map (_ /= 1) (STRef.read r)) do+ _ <- STRef.modify (_ + 1) count+ m <- STRef.read r+ void $ STRef.write (if m `mod` 2 == 0 then m / 2 else 3 * m + 1) r+ STRef.read count)++main = do+ logShow $ collatz 1000+ log "Done"
+ tests/purs/passing/Comparisons.purs view
@@ -0,0 +1,15 @@+module Main where++import Prelude+import Effect+import Effect.Console+import Test.Assert++main = do+ assert (1.0 < 2.0)+ assert (2.0 == 2.0)+ assert (3.0 > 1.0)+ assert ("a" < "b")+ assert ("a" == "a")+ assert ("z" > "a")+ log "Done"
+ tests/purs/passing/Conditional.purs view
@@ -0,0 +1,9 @@+module Main where++import Effect.Console (log)++fns = \f -> if f true then f else \x -> x++not = \x -> if x then false else true++main = log "Done"
+ tests/purs/passing/Console.purs view
@@ -0,0 +1,15 @@+module Main where++import Prelude+import Effect+import Effect.Console++replicateM_ :: forall m a. Monad m => Number -> m a -> m Unit+replicateM_ 0.0 _ = pure unit+replicateM_ n act = do+ _ <- act+ replicateM_ (n - 1.0) act++main = do+ replicateM_ 10.0 (log "Hello World!")+ log "Done"
+ tests/purs/passing/ConstraintInference.purs view
@@ -0,0 +1,10 @@+module Main where++import Prelude+import Effect.Console (log)++shout = log <<< (_ <> "!") <<< show++main = do+ shout "Test"+ log "Done"
+ tests/purs/passing/ConstraintOutsideForall.purs view
@@ -0,0 +1,12 @@+module Main where++import Effect.Console++class Test a++instance testUnit :: Test Int++test :: Test Int => forall a. a -> a+test a = a++main = log (test "Done")
+ tests/purs/passing/ConstraintParens.purs view
@@ -0,0 +1,12 @@+module Main where++import Prelude+import Effect.Console (log)++class Foo a where+ foo ∷ a → a++test ∷ ∀ a. (Foo a) ⇒ a → a+test = foo++main = log "Done"
+ tests/purs/passing/ConstraintParsingIssue.purs view
@@ -0,0 +1,9 @@+module Main where++import Effect.Console++class X a++instance x :: X (Array (Array a)) => X (Array a)++main = log "Done"
+ tests/purs/passing/ContextSimplification.purs view
@@ -0,0 +1,15 @@+module Main where++import Prelude+import Effect.Console++shout = log <<< (_ <> "!") <<< show++-- Here, we should simplify the context so that only one Show+-- constraint is added.+usesShowTwice true = shout+usesShowTwice false = logShow++main = do+ usesShowTwice true "Test"+ log "Done"
+ tests/purs/passing/CyclicInstances.purs view
@@ -0,0 +1,29 @@+module Main where++import Prelude++import Data.Generic.Rep (class Generic)+import Data.Show.Generic (genericShow)+import Effect.Console (log)++newtype A = A B+derive newtype instance Show A+data B = B C+ | Z+derive instance Generic B _+instance Show B where show x = genericShow x+newtype C = C A+derive instance Generic C _+instance Show C where show = genericShow++newtype A2 = A2 { x :: B2 }+derive newtype instance Show A2+data B2 = B2 C2+ | Z2+derive instance Generic B2 _+instance Show B2 where show x = genericShow x+newtype C2 = C2 A2+derive instance Generic C2 _+instance Show C2 where show = genericShow++main = log "Done"
+ tests/purs/passing/DataAndType.purs view
@@ -0,0 +1,10 @@+module Main where++import Prelude+import Effect.Console (log)++data A = A B++type B = A++main = log "Done"
+ tests/purs/passing/DataConsClassConsOverlapOk.purs view
@@ -0,0 +1,8 @@+module Main where++import Effect.Console (log)+import Prim.Row (class Cons)++data Cons = Cons++main = log "Done"
+ tests/purs/passing/DctorName.purs view
@@ -0,0 +1,33 @@+module Main where++import Prelude+import Effect.Console (log)++newtype Bar' = Bar' Int++data Foo' = Foo' Bar'++data Baz'' = Baz'' | Baz'++f ∷ Foo' → Boolean+f a = case a of Foo' b → true++f' ∷ Boolean+f' = f $ Foo' $ Bar' 0++g ∷ Baz'' → Int+g Baz'' = 0+g Baz' = 1++g' ∷ Int+g' = g Baz''++h ∷ Bar' → Int+h (Bar' x)+ | x <= 10 = x * 2 + | otherwise = 10++h' ∷ Int+h' = h $ Bar' 4++main = log "Done"
+ tests/purs/passing/DctorOperatorAlias.purs view
@@ -0,0 +1,34 @@+module Main where++ import Prelude (Unit, bind, discard, (==))+ import Effect (Effect)+ import Effect.Console (log)+ import Test.Assert (assert')+ import List (List(..), (:))+ import List as L++ -- unqualified+ infixl 6 Cons as !++ -- qualified+ infixl 6 L.Cons as !!++ get1 ∷ ∀ a. a → List a → a+ get1 y xs = case xs of+ _ : x : _ → x+ _ → y++ get2 ∷ ∀ a. a → List a → a+ get2 _ (_ : x : _) = x+ get2 y _ = y++ get3 ∷ ∀ a. a → List a → a+ get3 _ (_ ! (x ! _)) = x+ get3 y _ = y++ main ∷ Effect Unit+ main = do+ assert' "Incorrect result!" (get1 0 (1 : 2 : 3 : Nil) == 2)+ assert' "Incorrect result!" (get2 0 (1 ! (2 ! (3 ! Nil))) == 2)+ assert' "Incorrect result!" (get3 0.0 (1.0 : 2.0 : (3.0 ! Nil)) == 2.0)+ log "Done"
+ tests/purs/passing/DctorOperatorAlias/List.purs view
@@ -0,0 +1,5 @@+module List where++data List a = Cons a (List a) | Nil++infixr 6 Cons as :
+ tests/purs/passing/DeepArrayBinder.purs view
@@ -0,0 +1,17 @@+module Main where++import Prelude+import Effect+import Effect.Console (log)+import Test.Assert++data List a = Cons a (List a) | Nil++match2 :: List Number -> Number+match2 (Cons x (Cons y xs)) = x * y + match2 xs+match2 _ = 0.0++main = do+ let result = match2 (Cons 1.0 (Cons 2.0 (Cons 3.0 (Cons 4.0 (Cons 5.0 (Cons 6.0 (Cons 7.0 (Cons 8.0 (Cons 9.0 Nil)))))))))+ assert' "Incorrect result!" (result == 100.0)+ log "Done"
+ tests/purs/passing/DeepCase.purs view
@@ -0,0 +1,15 @@+module Main where++import Prelude+import Effect.Console (log, logShow)++f x y =+ let+ g = case y of+ 0.0 -> x+ x -> 1.0 + x * x+ in g + x + y++main = do+ logShow $ f 1.0 10.0+ log "Done"
+ tests/purs/passing/DeriveNewtype.purs view
@@ -0,0 +1,29 @@+module Main where++import Effect.Console (log)++import Data.Newtype++type MyString = String++newtype Test = Test MyString++derive instance newtypeTest :: Newtype Test _++t :: Test+t = wrap "hello"++a :: String+a = unwrap t++newtype First a = First a++derive instance newtypeFirst :: Newtype (First b) _++f :: First Int+f = wrap 1++i :: Int+i = unwrap f++main = log "Done"
+ tests/purs/passing/DeriveWithNestedSynonyms.purs view
@@ -0,0 +1,29 @@+module Main where++import Prelude+import Effect.Console (log)++type L = {}+data X = X L+derive instance eqX :: Eq X++type M = {}+data Y = Y {foo :: M}+derive instance eqY :: Eq Y++type N = {}+data Z = Z N+derive instance eqZ :: Eq Z++type Foo = String++type Bar = { foo :: Foo }++type Baz = { baz :: Bar }++newtype T = T Baz++derive instance eqT :: Eq T+derive instance ordT :: Ord T++main = log "Done"
+ tests/purs/passing/Deriving.purs view
@@ -0,0 +1,36 @@+module Main where++import Prelude+import Effect.Console (log)+import Test.Assert++data V++derive instance eqV :: Eq V++derive instance ordV :: Ord V++type MyString = String++data X = X Int | Y MyString++derive instance eqX :: Eq X++derive instance ordX :: Ord X++newtype Z = Z { left :: X, right :: X }++derive instance eqZ :: Eq Z++main = do+ assert $ X 0 == X 0+ assert $ X 0 /= X 1+ assert $ Y "Foo" == Y "Foo"+ assert $ Y "Foo" /= Y "Bar"+ assert $ X 0 < X 1+ assert $ X 0 < Y "Foo"+ assert $ Y "Bar" < Y "Baz"+ assert $ z == z+ log "Done"+ where+ z = Z { left: X 0, right: Y "Foo" }
+ tests/purs/passing/DerivingBifunctor.purs view
@@ -0,0 +1,26 @@+module Main where++import Prelude++import Data.Bifoldable (class Bifoldable)+import Data.Bifunctor (class Bifunctor)+import Data.Bitraversable (class Bitraversable)+import Data.Predicate (Predicate)+import Data.Tuple (Tuple)+import Effect.Console (log)++data Test f a b+ = Test0+ | Test1 (Array a) b+ | Test2 Int (forall a. Array a -> Array a)+ | Test3 Int (f a b) (f a Int) (f Int b)+ | Test4 (Array (Tuple a Int)) (Tuple b Int)+ | Test5 { nested :: Array { x :: f { a :: a } { b :: b } } }+derive instance Bifunctor f => Bifunctor (Test f)+derive instance Bifoldable f => Bifoldable (Test f)+derive instance Bitraversable f => Bitraversable (Test f)++data FromProAndContra a b = FromProAndContra (Predicate (a -> Int)) (Predicate b -> Int)+derive instance Bifunctor FromProAndContra++main = log "Done"
+ tests/purs/passing/DerivingContravariant.purs view
@@ -0,0 +1,20 @@+module Main where++import Prelude++import Data.Functor.Contravariant (class Contravariant)+import Data.Predicate (Predicate)+import Data.Tuple (Tuple)+import Effect.Console (log)++data Test f a+ = Test0+ | Test1 (Predicate a)+ | Test2 (Predicate (Predicate (Predicate a)))+ | Test3 Int (forall a. Array a -> Array a)+ | Test4 Int (f a)+ | Test5 (Array (a -> Int)) (Tuple (Predicate a) Int)+ | Test6 { nested :: Array { x :: f { a :: a } } }+derive instance Contravariant f => Contravariant (Test f)++main = log "Done"
+ tests/purs/passing/DerivingFoldable.purs view
@@ -0,0 +1,89 @@+module Main where++import Prelude+import Effect.Console (log)+import Data.Foldable (class Foldable, foldl, foldr, foldMap)+import Test.Assert++-- Fold is done in alphabetical ordering of labels,+-- not their order in definition+type RecordFields f a =+ { a :: a+ , zArrayA :: Array a+ , fa :: f a+ , ignore :: Int+ , arrayIgnore :: Array Int+ , fIgnore :: f Int+ }++data M f a+ = M0+ | M1 a (Array a)+ | M2 Int (forall a. Array a -> Array a)+ | M3 (f a)+ | M4 (RecordFields f a)+ | M5 { nested :: RecordFields f a }+ | M6 Int a (Array Int) (Array a) (f a) (f Int) (RecordFields f a) { nested :: RecordFields f a }+ | M7 (f (f { nested :: RecordFields f a }))++derive instance foldableM :: Foldable f => Foldable (M f)++type MArrStr = M Array String++foldlStr :: forall f. Foldable f => f String -> String+foldlStr = foldl (\acc next -> acc <> "<" <> next) "Start"++foldrStr :: forall f. Foldable f => f String -> String+foldrStr = foldr (\next acc -> next <> ">" <> acc) "Start"++foldMapStr :: forall f. Foldable f => f String -> String+foldMapStr = foldMap identity++m0 = M0 :: MArrStr+m1 = M1 "a" ["b", "c"] :: MArrStr+m2 = M2 0 identity :: MArrStr+m3 = M3 ["a", "b", "c"] :: MArrStr+m4 = M4 recordValue :: MArrStr+m5 = M5 { nested: recordValue } :: MArrStr+m6 = M6 1 "a" [] ["b"] ["c"] [] recordValue { nested: recordValue } :: MArrStr+m7 = M7 [[{ nested: recordValue }]] :: MArrStr++recordValue :: RecordFields Array String+recordValue =+ { a: "a"+ , zArrayA: ["c"]+ , fa: ["b"]+ , ignore: 1+ , arrayIgnore: [2, 3]+ , fIgnore: [4]+ }++main = do+ assertEqual' "foldl - M0" { expected: "Start", actual: foldlStr m0 }+ assertEqual' "foldl - M1" { expected: "Start<a<b<c", actual: foldlStr m1 }+ assertEqual' "foldl - M2" { expected: "Start", actual: foldlStr m2 }+ assertEqual' "foldl - M3" { expected: "Start<a<b<c", actual: foldlStr m3 }+ assertEqual' "foldl - M4" { expected: "Start<a<b<c", actual: foldlStr m4 }+ assertEqual' "foldl - M5" { expected: "Start<a<b<c", actual: foldlStr m5 }+ assertEqual' "foldl - M6" { expected: "Start<a<b<c<a<b<c<a<b<c", actual: foldlStr m6 }+ assertEqual' "foldl - M7" { expected: "Start<a<b<c", actual: foldlStr m7 }++ assertEqual' "foldr - M0" { expected: "Start", actual: foldrStr m0 }+ assertEqual' "foldr - M1" { expected: "a>b>c>Start", actual: foldrStr m1 }+ assertEqual' "foldr - M2" { expected: "Start", actual: foldrStr m2 }+ assertEqual' "foldr - M3" { expected: "a>b>c>Start", actual: foldrStr m3 }+ assertEqual' "foldr - M4" { expected: "a>b>c>Start", actual: foldrStr m4 }+ assertEqual' "foldr - M5" { expected: "a>b>c>Start", actual: foldrStr m5 }+ assertEqual' "foldr - M6" { expected: "a>b>c>a>b>c>a>b>c>Start", actual: foldrStr m6 }+ assertEqual' "foldr - M7" { expected: "a>b>c>Start", actual: foldrStr m7 }++ assertEqual' "foldMap - M0" { expected: "", actual: foldMapStr m0 }+ assertEqual' "foldMap - M1" { expected: "abc", actual: foldMapStr m1 }+ assertEqual' "foldMap - M2" { expected: "", actual: foldMapStr m2 }+ assertEqual' "foldMap - M3" { expected: "abc", actual: foldMapStr m3 }+ assertEqual' "foldMap - M4" { expected: "abc", actual: foldMapStr m4 }+ assertEqual' "foldMap - M5" { expected: "abc", actual: foldMapStr m5 }+ assertEqual' "foldMap - M6" { expected: "abcabcabc", actual: foldMapStr m6 }+ assertEqual' "foldMap - M7" { expected: "abc", actual: foldMapStr m7 }++ log "Done"
+ tests/purs/passing/DerivingFunctor.purs view
@@ -0,0 +1,124 @@+module Main where++import Prelude+import Data.Eq (class Eq1)+import Effect.Console (log)+import Data.List (List(..), (:))+import Data.Tuple (Tuple(..))+import Test.Assert++type RecordFields f a =+ { a :: a+ , zArrayA :: Array a+ , fa :: f a+ , ignore :: Int+ , recursiveA :: Array (Tuple Int (Array a))+ , arrayIgnore :: Array Int+ , fIgnore :: f Int+ , empty :: {}+ }++data M f a+ = M0 a (Array a)+ | M1 Int+ | M2 (f a)+ | M3 (RecordFields f a)+ | M4 { nested :: RecordFields f a }+ | M5 Int a (Array Int) (Array a) (f a) (f Int) (RecordFields f a) { nested :: RecordFields f a }+ | M6 (Array (Array (Array a)))++derive instance eqM :: (Eq1 f, Eq a) => Eq (M f a)+derive instance functorM :: Functor f => Functor (M f)++type MA = M Array++m0L = M0 0 [1, 2] :: MA Int+m0R = M0 "0" ["1", "2"] :: MA String++m1L = M1 0 :: MA Int+m1R = M1 0 :: MA String++m2L = M2 [0, 1] :: MA Int+m2R = M2 ["0", "1"] :: MA String++m3L = M3 recordValueL :: MA Int+m3R = M3 recordValueR :: MA String++m4L = M4 { nested: recordValueL } :: MA Int+m4R = M4 { nested: recordValueR } :: MA String++m5L = M5 0 1 [2, 3] [3, 4] [5, 6] [7, 8] recordValueL { nested: recordValueL } :: MA Int+m5R = M5 0 "1" [2, 3] ["3", "4"] ["5", "6"] [7, 8] recordValueR { nested: recordValueR } :: MA String++recordValueL :: RecordFields Array Int+recordValueL = { a: 71, zArrayA: [72], fa: [73], ignore: 91, recursiveA: [ Tuple 1 [1], Tuple 2 [2] ], arrayIgnore: [92, 93], fIgnore: [94], empty: {} }++recordValueR :: RecordFields Array String+recordValueR = { a: "71", zArrayA: ["72"], fa: ["73"], ignore: 91, recursiveA: [ Tuple 1 ["1"], Tuple 2 ["2"] ], arrayIgnore: [92, 93], fIgnore: [94], empty: {} }++m6L = M6 [[[1, 2]]] :: MA Int+m6R = M6 [[["1", "2"]]] :: MA String++maTests = do+ assert' "map - M0" $ map show m0L == m0R+ assert' "map - M1" $ map show m1L == m1R+ assert' "map - M2" $ map show m2L == m2R+ assert' "map - M3" $ map show m3L == m3R+ assert' "map - M4" $ map show m4L == m4R+ assert' "map - M5" $ map show m5L == m5R+ assert' "map - M6" $ map show m6L == m6R++data Fun1 a = Fun1 (Int -> Int -> a)+derive instance Functor Fun1++f1Test = do+ assert' "map - Fun1" do+ let+ fn = show+ left a b = a + b+ right a b = fn $ left a b+ Fun1 left' = map fn $ Fun1 left+ left' 1 2 == right 1 2++data Fun2 a = Fun2 (Int -> Int -> Array (Array a))+derive instance Functor Fun2++f2Test = do+ assert' "map - Fun2" do+ let+ fn = show+ left a b = [[a + b]]+ right a b = map (map fn) $ left a b+ Fun2 left' = map fn $ Fun2 left+ left' 1 2 == right 1 2++data Fun3 f a = Fun3 (Unit -> Array (f (Array { nested :: RecordFields f a })))+derive instance Functor f => Functor (Fun3 f)++f3Test = do+ assert' "map - Fun3" do+ let+ left _ = [[[{ nested: recordValueL }]]]+ right _ = [[[{ nested: recordValueR }]]]+ Fun3 left' = map show $ Fun3 left+ left' unit == right unit++data T a = T (forall t. Show t => t -> a)+derive instance functorT :: Functor T++taTests = do+ case map show (T \_ -> 42) of+ T f -> assert' "map show T" $ f "hello" == "42"+ _ -> assert' "map show T" false++funTests = do+ f1Test+ f2Test+ f3Test+ taTests++main = do+ maTests+ funTests++ log "Done"
+ tests/purs/passing/DerivingFunctorFromBi.purs view
@@ -0,0 +1,18 @@+module Main where++import Prelude++import Data.Foldable (class Foldable)+import Data.Traversable (class Traversable)+import Data.Tuple (Tuple)+import Effect.Console (log)++data Test a+ = Test1 (Tuple a Int)+ | Test2 (Tuple (Array a) a)+ | Test3 { x :: Tuple { a :: a } Int, y :: Tuple { a :: Array a } { a :: a } }+derive instance Functor Test+derive instance Foldable Test+derive instance Traversable Test++main = log "Done"
+ tests/purs/passing/DerivingFunctorFromContra.purs view
@@ -0,0 +1,13 @@+module Main where++import Prelude++import Data.Predicate (Predicate)+import Effect.Console (log)++data Test a+ = Test1 (Predicate (Predicate a))+ | Test2 { x :: Predicate { y :: Predicate a } }+derive instance Functor Test++main = log "Done"
+ tests/purs/passing/DerivingFunctorFromPro.purs view
@@ -0,0 +1,16 @@+module Main where++-- Note that Data.Profunctor is not in the dependencies of any types imported+-- here. The package that contains that module must be a dependency of the test+-- project.++import Prelude++import Effect.Console (log)++data Test a+ = Test1 ((Array a -> Int) -> Int)+ | Test2 { f :: ({ a :: a } -> Int) -> Int }+derive instance Functor Test++main = log "Done"
+ tests/purs/passing/DerivingFunctorPrefersSimplerClasses.purs view
@@ -0,0 +1,46 @@+module Main where++import Prelude++import Data.Bifunctor (class Bifunctor)+import Data.Profunctor (class Profunctor)+import Effect (Effect)+import Effect.Console (log)+import Test.Assert (assert')++newtype MonoAndBi a b = MonoAndBi (Effect Unit)+derive instance Functor (MonoAndBi a)+instance Bifunctor MonoAndBi where+ bimap _ _ _ = MonoAndBi (assert' "Bifunctor instance was used but the Functor instance was expected" false)++newtype Test1 a = Test1 (MonoAndBi Int a)+derive instance Functor Test1++data ExclusivelyBi a b+derive instance Bifunctor ExclusivelyBi++newtype Test2 a = Test2 (ExclusivelyBi Int a)+derive instance Functor Test2++newtype MonoAndPro a b = MonoAndPro (Effect Unit)+derive instance Functor (MonoAndPro a)+instance Profunctor MonoAndPro where+ dimap _ _ _ = MonoAndPro (assert' "Profunctor instance was used but the Functor instance was expected" false)++newtype Test3 a = Test3 (MonoAndPro Int a)+derive instance Functor Test3++data ExclusivelyPro a b+derive instance Profunctor ExclusivelyPro++newtype Test4 a = Test4 (ExclusivelyPro Int a)+derive instance Functor Test4++main = do+ let t = Test1 (MonoAndBi (pure unit))+ let Test1 (MonoAndBi result1) = map identity t+ result1+ let t = Test3 (MonoAndPro (pure unit))+ let Test3 (MonoAndPro result3) = map identity t+ result3+ log "Done"
+ tests/purs/passing/DerivingProfunctor.purs view
@@ -0,0 +1,19 @@+module Main where++import Prelude++import Data.Predicate (Predicate)+import Data.Profunctor (class Profunctor)+import Data.Tuple (Tuple)+import Effect.Console (log)++data Test f a b+ = Test0+ | Test1 (Predicate a) b+ | Test2 Int (forall a. Array a -> Array a)+ | Test3 Int (f a b) (f a Int) (f Int b)+ | Test4 (Array (a -> Int)) (Tuple b Int)+ | Test5 { nested :: Array { x :: f { a :: a } { b :: b } } }+derive instance Profunctor f => Profunctor (Test f)++main = log "Done"
+ tests/purs/passing/DerivingTraversable.purs view
@@ -0,0 +1,110 @@+module Main where++import Prelude++import Effect.Console (log)+import Data.Eq (class Eq1)+import Data.Foldable (class Foldable)+import Data.Traversable (class Traversable, traverse, sequence)+import Test.Assert++-- Traverse order is done in alphabetical ordering of labels,+-- not their order in definition+type RecordFields f a =+ { a :: a+ , zArrayA :: Array a+ , fa :: f a+ , ignore :: Int+ , arrayIgnore :: Array Int+ , fIgnore :: f Int+ }++data M f a+ = M0+ | M1 a (Array a)+ | M2 Int+ | M3 (f a)+ | M4 (RecordFields f a)+ | M5 { nested :: RecordFields f a }+ | M6 Int a (Array Int) (Array a) (f a) (f Int) (RecordFields f a) { nested :: RecordFields f a }+ | M7 (f (f { nested :: RecordFields f a }))++-- Note: all 4 of these constraints are needed to compile this code+derive instance+ ( Eq1 f+ , Eq (f (f { nested :: RecordFields f a }))+ , Eq (f { nested :: RecordFields f a })+ , Eq a+ ) => Eq (M f a)+derive instance Functor f => Functor (M f)+derive instance Foldable f => Foldable (M f)+derive instance Traversable f => Traversable (M f)++type MArrStr = M Array String++traverseStr :: forall f. Traversable f => f String -> Array (f String)+traverseStr = traverse pure++sequenceStr :: forall f. Traversable f => f (Array String) -> Array (f String)+sequenceStr = sequence++m0 = M0 :: MArrStr+m1 = M1 "a" ["b", "c"] :: MArrStr+m2 = M2 0 :: MArrStr+m3 = M3 ["a", "b", "c"] :: MArrStr+m4 = M4 recordValue :: MArrStr+m5 = M5 { nested: recordValue } :: MArrStr+m6 = M6 1 "a" [] ["b"] ["c"] [] recordValue { nested: recordValue } :: MArrStr+m7 = M7 [ [ { nested: recordValue } ] ] :: MArrStr++recordValue :: RecordFields Array String+recordValue =+ { a: "a"+ , zArrayA: ["c"]+ , fa: ["b"]+ , ignore: 1+ , arrayIgnore: [2, 3]+ , fIgnore: [4]+ }++type MArrArrStr = M Array (Array String)++m0' = M0 :: MArrArrStr+m1' = M1 ["a"] [["b"], ["c"]] :: MArrArrStr+m2' = M2 0 :: MArrArrStr+m3' = M3 [["a"], ["b"], ["c"]] :: MArrArrStr+m4' = M4 recordValue' :: MArrArrStr+m5' = M5 { nested: recordValue' } :: MArrArrStr+m6' = M6 1 ["a"] [] [["b"]] [["c"]] [] recordValue' { nested: recordValue' } :: MArrArrStr+m7' = M7 [ [ { nested: recordValue' } ] ] :: MArrArrStr++recordValue' :: RecordFields Array (Array String)+recordValue' =+ { a: ["a"]+ , zArrayA: [["c"]]+ , fa: [["b"]]+ , ignore: 1+ , arrayIgnore: [2, 3]+ , fIgnore: [4]+ }++main = do+ assert' "traverse - m0" $ traverseStr m0 == [m0]+ assert' "traverse - m1" $ traverseStr m1 == [m1]+ assert' "traverse - m2" $ traverseStr m2 == [m2]+ assert' "traverse - m3" $ traverseStr m3 == [m3]+ assert' "traverse - m4" $ traverseStr m4 == [m4]+ assert' "traverse - m5" $ traverseStr m5 == [m5]+ assert' "traverse - m6" $ traverseStr m6 == [m6]+ assert' "traverse - m7" $ traverseStr m7 == [m7]++ assert' "sequence - m0" $ sequenceStr m0' == [m0]+ assert' "sequence - m1" $ sequenceStr m1' == [m1]+ assert' "sequence - m2" $ sequenceStr m2' == [m2]+ assert' "sequence - m3" $ sequenceStr m3' == [m3]+ assert' "sequence - m4" $ sequenceStr m4' == [m4]+ assert' "sequence - m5" $ sequenceStr m5' == [m5]+ assert' "sequence - m6" $ sequenceStr m6' == [m6]+ assert' "sequence - m7" $ sequenceStr m7' == [m7]++ log "Done"
+ tests/purs/passing/Do.purs view
@@ -0,0 +1,68 @@+module Main where++import Prelude+import Effect.Console (log)++data Maybe a = Nothing | Just a++instance functorMaybe :: Functor Maybe where+ map f Nothing = Nothing+ map f (Just x) = Just (f x)++instance applyMaybe :: Apply Maybe where+ apply (Just f) (Just x) = Just (f x)+ apply _ _ = Nothing++instance applicativeMaybe :: Applicative Maybe where+ pure = Just++instance bindMaybe :: Bind Maybe where+ bind Nothing _ = Nothing+ bind (Just a) f = f a++instance monadMaybe :: Monad Maybe++test1 = \_ -> do+ Just "abc"++test2 = \_ -> do+ x <- Just 1.0+ y <- Just 2.0+ Just (x + y)++test3 = \_ -> do+ _ <- Just 1.0+ _ <- Nothing :: Maybe Number+ Just 2.0++test4 mx my = do+ x <- mx+ y <- my+ Just (x + y + 1.0)++test5 mx my mz = do+ x <- mx+ y <- my+ let sum = x + y+ z <- mz+ Just (z + sum + 1.0)++test6 mx = \_ -> do+ let+ f :: forall a. Maybe a -> a+ f (Just x) = x+ Just (f mx)++test8 = \_ -> do+ Just (do+ Just 1.0)++test9 = \_ -> (+) <$> Just 1.0 <*> Just 2.0++test10 _ = do+ let+ f x = g x * 3.0+ g x = f x / 2.0+ Just (f 10.0)++main = log "Done"
+ tests/purs/passing/Dollar.purs view
@@ -0,0 +1,16 @@+module Main where++import Effect.Console (log)++applyFn :: forall a b. (a -> b) -> a -> b+applyFn f x = f x++infixr 1000 applyFn as $++id x = x++test1 x = id $ id $ id $ id $ x++test2 x = id id $ id x++main = log "Done"
+ tests/purs/passing/DuplicateProperties.purs view
@@ -0,0 +1,24 @@+module Main where++import Prelude+import Effect.Console (log)+import Type.Proxy (Proxy(..))++subtractX :: forall r a. Proxy (x :: a | r) -> Proxy r+subtractX Proxy = Proxy++extractX :: forall r a. Proxy (x :: a | r) -> Proxy a+extractX Proxy = Proxy++hasX :: forall r a b. Proxy (x :: a, y :: b | r)+hasX = Proxy++test1 = subtractX (subtractX hasX)++test2+ :: forall r a b+ . Proxy (x :: a, x :: b, x :: Int | r)+ -> Proxy Int+test2 x = extractX (subtractX (subtractX x))++main = log "Done"
+ tests/purs/passing/ESFFIFunctionConst.js view
@@ -0,0 +1,3 @@+export const functionName = function (a) {+ return a;+}
+ tests/purs/passing/ESFFIFunctionConst.purs view
@@ -0,0 +1,8 @@+module Main where++import Prelude+import Effect.Console (log)++foreign import functionName :: forall a. a -> a++main = log "Done"
+ tests/purs/passing/ESFFIFunctionFunction.js view
@@ -0,0 +1,3 @@+export function functionName(a) {+ return a;+}
+ tests/purs/passing/ESFFIFunctionFunction.purs view
@@ -0,0 +1,8 @@+module Main where++import Prelude+import Effect.Console (log)++foreign import functionName :: forall a. a -> a++main = log "Done"
+ tests/purs/passing/ESFFIFunctionVar.js view
@@ -0,0 +1,3 @@+export var functionName = function (a) {+ return a;+}
+ tests/purs/passing/ESFFIFunctionVar.purs view
@@ -0,0 +1,8 @@+module Main where++import Prelude+import Effect.Console (log)++foreign import functionName :: forall a. a -> a++main = log "Done"
+ tests/purs/passing/ESFFIValueConst1.js view
@@ -0,0 +1,1 @@+export const value = 1;
+ tests/purs/passing/ESFFIValueConst1.purs view
@@ -0,0 +1,8 @@+module Main where++import Prelude+import Effect.Console (log)++foreign import value :: Int++main = log "Done"
+ tests/purs/passing/ESFFIValueVar.js view
@@ -0,0 +1,1 @@+export var value = 1;
+ tests/purs/passing/ESFFIValueVar.purs view
@@ -0,0 +1,8 @@+module Main where++import Prelude+import Effect.Console (log)++foreign import value :: Int++main = log "Done"
+ tests/purs/passing/EffFn.js view
@@ -0,0 +1,1 @@+export var add3 = function (a,b,c) { return a + b + c; };
+ tests/purs/passing/EffFn.purs view
@@ -0,0 +1,22 @@+module Main where++import Prelude++import Effect.Console (log)+import Effect.Uncurried (EffectFn3, mkEffectFn7, runEffectFn3, runEffectFn7)+import Test.Assert (assert)++testBothWays = do+ res <- (runEffectFn7 $ mkEffectFn7 \x1 x2 x3 x4 x5 x6 x7 -> pure 42) 1 2 3 4 5 6 7+ assert $ res == 42++foreign import add3 :: EffectFn3 String String String String++testRunFn = do+ str <- runEffectFn3 add3 "a" "b" "c"+ assert $ str == "abc"++main = do+ testBothWays+ testRunFn+ log "Done"
+ tests/purs/passing/EmptyDataDecls.purs view
@@ -0,0 +1,20 @@+module Main where++import Prelude+import Test.Assert+import Effect.Console (log)++data Z+data S n++data ArrayBox n a = ArrayBox (Array a)++nil :: forall a. ArrayBox Z a+nil = ArrayBox []++cons' :: forall a n. a -> ArrayBox n a -> ArrayBox (S n) a+cons' x (ArrayBox xs) = ArrayBox $ append [x] xs++main = case cons' 1 $ cons' 2 $ cons' 3 nil of+ ArrayBox [1, 2, 3] -> log "Done"+ _ -> assert' "Failed" false
+ tests/purs/passing/EmptyDicts.purs view
@@ -0,0 +1,77 @@+-- |+-- The purpose of this test is to make sure that the empty type class+-- dictionary elimination code doesn't change semantics.+module Main where++import Prelude+import Effect.Console (log)++-- |+-- Data type to check that the result of expressions with eliminated+-- dictionaries are as expected.+data Check = Check+derive instance eqCheck :: Eq Check++-- |+-- This type class has no constraints and no members.+-- Is is therefore considered empty.+class EmptyClass+instance emptyDictInst :: EmptyClass++-- |+-- This type class is not empty as it has members, but it has an empty super+-- class.+class EmptyClass <= HasEmptySuper where+ hasEmptySuper :: Check+instance hasEmptySuperInst :: HasEmptySuper where+ hasEmptySuper = Check++-- |+-- This type class has no members, but has a non-empty super class.+-- It is therefore not empty.+class HasEmptySuper <= HasNonEmptySuper+instance hasNonEmptySuperInst :: HasEmptySuper => HasNonEmptySuper++-- |+-- This type class is empty because all it's super classes are empty and it+-- has no members.+class EmptyClass <= AliasEmptyClass+instance aliasEmptyClassInst :: AliasEmptyClass++whenEmpty :: Check+whenEmpty = Check :: EmptyClass => Check++whenHasEmptySuper :: Check+whenHasEmptySuper = Check :: HasEmptySuper => Check++whenHasNonEmptySuper :: Check+whenHasNonEmptySuper = Check :: HasNonEmptySuper => Check++whenAliasEmptyClass :: Check+whenAliasEmptyClass = Check :: AliasEmptyClass => Check++class WithArgEmpty t+instance withArgEmptyCheck :: WithArgEmpty Check+class WithArgEmpty t <= WithArgHasEmptySuper t where+ withArgHasEmptySuper :: t+instance withArgHasEmptySuperCheck :: WithArgHasEmptySuper Check where+ withArgHasEmptySuper = Check++whenAccessingSuperDict :: Check+whenAccessingSuperDict = foo Check where++ bar :: forall t . WithArgEmpty t => t -> t+ bar x = x++ foo :: forall t . WithArgHasEmptySuper t => t -> t+ foo x = bar x++main =+ if Check == whenEmpty &&+ Check == whenHasEmptySuper &&+ Check == whenHasNonEmptySuper &&+ Check == whenAliasEmptyClass &&+ Check == whenAccessingSuperDict+ then log "Done"+ else pure unit+
+ tests/purs/passing/EmptyRow.purs view
@@ -0,0 +1,11 @@+module Main where++import Prelude+import Effect.Console (log)++data Foo r = Foo { | r }++test :: Foo ()+test = Foo {}++main = log "Done"
+ tests/purs/passing/EmptyTypeClass.purs view
@@ -0,0 +1,11 @@+module Main where++import Prelude+import Effect+import Effect.Console++head :: forall a. Partial => Array a -> a+head [x] = x++main :: Effect _+main = log "Done"
+ tests/purs/passing/EntailsKindedType.purs view
@@ -0,0 +1,11 @@+module Main where++import Prelude+import Effect+import Effect.Console++test x = show (x :: _ :: Type)++main = do+ when (show (unit :: Unit :: Type) == "unit") (log "Done")+ when (test unit == "unit") (log "Done")
+ tests/purs/passing/Eq1Deriving.purs view
@@ -0,0 +1,12 @@+module Main where++import Prelude+import Data.Eq (class Eq1)+import Effect.Console (log)++data Product a b = Product a b++derive instance eqMu :: (Eq a, Eq b) => Eq (Product a b)+derive instance eq1Mu :: Eq a => Eq1 (Product a)++main = log "Done"
+ tests/purs/passing/Eq1InEqDeriving.purs view
@@ -0,0 +1,11 @@+module Main where++import Prelude+import Data.Eq (class Eq1)+import Effect.Console (log)++newtype Mu f = In (f (Mu f))++derive instance eqMu :: Eq1 f => Eq (Mu f)++main = log "Done"
+ tests/purs/passing/EqOrd.purs view
@@ -0,0 +1,18 @@+module Main where++import Prelude+import Effect.Console (log, logShow)++data Pair a b = Pair a b++instance ordPair :: (Ord a, Ord b) => Ord (Pair a b) where+ compare (Pair a1 b1) (Pair a2 b2) = case compare a1 a2 of+ EQ -> compare b1 b2+ r -> r++instance eqPair :: (Eq a, Eq b) => Eq (Pair a b) where+ eq (Pair a1 b1) (Pair a2 b2) = a1 == a2 && b1 == b2++main = do+ logShow $ Pair 1.0 2.0 == Pair 1.0 2.0+ log "Done"
+ tests/purs/passing/ExplicitImportReExport.purs view
@@ -0,0 +1,11 @@+-- from #1244+module Main where++import Prelude+import Effect.Console (log)+import Bar (foo)++baz :: Int+baz = foo++main = log "Done"
+ tests/purs/passing/ExplicitImportReExport/Bar.purs view
@@ -0,0 +1,3 @@+module Bar (module Foo) where++import Foo
+ tests/purs/passing/ExplicitImportReExport/Foo.purs view
@@ -0,0 +1,4 @@+module Foo where++foo :: Int+foo = 3
+ tests/purs/passing/ExplicitOperatorSections.purs view
@@ -0,0 +1,15 @@+module Main where++import Prelude+import Effect.Console (log)++subtractOne :: Int -> Int+subtractOne = (_ - 1)++addOne :: Int -> Int+addOne = (1 + _)++named :: Int -> Int+named = (_ `sub` 1)++main = log "Done"
+ tests/purs/passing/ExportExplicit.purs view
@@ -0,0 +1,10 @@+module Main where++import M1+import Effect.Console (log)++testX = X+testZ = Z+testFoo = foo++main = log "Done"
+ tests/purs/passing/ExportExplicit/M1.purs view
@@ -0,0 +1,10 @@+module M1 (X(X, Y), Z(..), foo) where++data X = X | Y+data Z = Z++foo :: Int+foo = 0++bar :: Int+bar = 1
+ tests/purs/passing/ExportExplicit2.purs view
@@ -0,0 +1,8 @@+module Main where++import M1+import Effect.Console (log)++testBar = bar++main = log "Done"
+ tests/purs/passing/ExportExplicit2/M1.purs view
@@ -0,0 +1,7 @@+module M1 (bar) where++foo :: Int+foo = 0++bar :: Int+bar = foo
+ tests/purs/passing/ExportedInstanceDeclarations.purs view
@@ -0,0 +1,45 @@+-- Tests that instances for non-exported classes / types do not appear in the+-- result of `exportedDeclarations`.+module Main+ ( Const(..)+ , class Foo+ , foo+ , main+ ) where++import Prelude+import Effect.Console (log)++data Const a b = Const a++class Foo a where+ foo :: a++data NonexportedType = NonexportedType++class NonexportedClass a where+ notExported :: a++-- There are three places that a nonexported type or type class can occur,+-- leading an instance to count as non-exported:+-- * The instance types+-- * Constraints+-- * The type class itself++-- Case 1: instance types+instance constFoo :: Foo (Const NonexportedType b) where+ foo = Const NonexportedType+else+-- Case 2: constraints+instance nonExportedFoo :: (Foo NonexportedType) => Foo (a -> a) where+ foo = identity+else+-- Another instance of case 2:+instance nonExportedFoo2 :: (NonexportedClass a) => Foo a where+ foo = notExported++-- Case 3: type class+instance nonExportedNonexportedType :: NonexportedClass (Const Int a) where+ notExported = Const 0++main = log "Done"
+ tests/purs/passing/ExtendedInfixOperators.purs view
@@ -0,0 +1,17 @@+module Main where++import Prelude+import Effect.Console (log, logShow)+import Data.Function (on)++comparing :: forall a b. Ord b => (a -> b) -> a -> a -> Ordering+comparing f = compare `on` f++null [] = true+null _ = false++test = [1.0, 2.0, 3.0] `comparing null` [4.0, 5.0, 6.0]++main = do+ logShow test+ log "Done"
+ tests/purs/passing/FFIConstraintWorkaround.js view
@@ -0,0 +1,5 @@+export function showImpl(showFn) {+ return function (val) {+ return showFn(val);+ };+};
+ tests/purs/passing/FFIConstraintWorkaround.purs view
@@ -0,0 +1,22 @@+module Main where++import Prelude+import Effect+import Effect.Console+import Test.Assert++main :: Effect Unit+main = do+ assert' "Showing Int is correct" $ showFFI 4 == "4"+ assert' "Showing String is correct" $ showFFI "string" == "\"string\""+ assert' "Showing Record is correct" $+ showFFI { a: 1, b: true, c: 'd', e: 4.0 } == "{ a: 1, b: true, c: 'd', e: 4.0 }"+ log "Done"++showFFI :: forall a. Show a => a -> String+showFFI = showImpl show++-- Since type class constraints are not allowed+-- in FFI declarations, we have to pass members+-- we want to use into the function itself.+foreign import showImpl :: forall a. (a -> String) -> a -> String
+ tests/purs/passing/FFIDefaultESExport.js view
@@ -0,0 +1,3 @@+var message = "Done";++export { message as default };
+ tests/purs/passing/FFIDefaultESExport.purs view
@@ -0,0 +1,7 @@+module Main where++import Effect.Console (log)++foreign import default :: String++main = log default
+ tests/purs/passing/Fib.purs view
@@ -0,0 +1,20 @@+module Main where++import Prelude+import Effect.Console (log)+import Control.Monad.ST as ST+import Control.Monad.ST.Ref as STRef++fib :: Number+fib = ST.run do+ n1 <- STRef.new 1.0+ n2 <- STRef.new 1.0+ ST.while ((>) 1000.0 <$> STRef.read n1) do+ n1' <- STRef.read n1+ n2' <- STRef.read n2+ _ <- STRef.write (n1' + n2') n2+ STRef.write n2' n1+ STRef.read n2++main = do+ log "Done"
+ tests/purs/passing/FieldConsPuns.purs view
@@ -0,0 +1,13 @@+module Main where++import Prelude+import Effect.Console (log, logShow)++greet { greeting, name } = log $ greeting <> ", " <> name <> "."++main = do+ greet { greeting, name }+ log "Done"+ where+ greeting = "Hello"+ name = "World"
+ tests/purs/passing/FieldPuns.purs view
@@ -0,0 +1,10 @@+module Main where++import Prelude+import Effect.Console++greet { greeting, name } = log $ greeting <> ", " <> name <> "."++main = do+ greet { greeting: "Hello", name: "World" }+ log "Done"
+ tests/purs/passing/FinalTagless.purs view
@@ -0,0 +1,25 @@+module Main where++import Prelude hiding (add)+import Effect.Console (log, logShow)++class E e where+ num :: Number -> e Number+ add :: e Number -> e Number -> e Number++type Expr a = forall e. E e => e a++data Id a = Id a++instance exprId :: E Id where+ num = Id+ add (Id n) (Id m) = Id (n + m)++runId (Id a) = a++three :: Expr Number+three = add (num 1.0) (num 2.0)++main = do+ logShow $ runId three+ log "Done"
+ tests/purs/passing/ForeignDataInKind.purs view
@@ -0,0 +1,9 @@+module Main where++import Prelude+import Effect.Console (log)++foreign import data A :: Type+data B (x :: A)++main = log "Done"
+ tests/purs/passing/ForeignKind.purs view
@@ -0,0 +1,10 @@+module Main where++import Prelude+import ForeignKinds.Lib (Nat, Zero, Succ, N3, NatProxy, class AddNat, addNat, proxy1, proxy2)+import Effect.Console (log)++proxy1Add2Is3 :: NatProxy N3+proxy1Add2Is3 = addNat proxy1 proxy2++main = log "Done"
+ tests/purs/passing/ForeignKind/Lib.purs view
@@ -0,0 +1,60 @@+module ForeignKinds.Lib (Nat, Kinded, Zero, Succ, N0, N1, N2, N3, NatProxy(..), class AddNat, addNat, proxy1, proxy2) where++-- declaration++data Nat++-- use in foreign data++foreign import data Zero :: Nat+foreign import data Succ :: Nat -> Nat++-- use in data++data NatProxy (t :: Nat) = NatProxy++-- use in type sig++succProxy :: forall n. NatProxy n -> NatProxy (Succ n)+succProxy _ = NatProxy++-- use in alias++type Kinded f = f :: Nat++type KindedZero = Kinded Zero++type N0 = Zero+type N1 = Succ N0+type N2 = Succ N1+type N3 = Succ N2++-- use of alias++proxy0 :: NatProxy N0+proxy0 = NatProxy++proxy1 :: NatProxy N1+proxy1 = NatProxy++proxy2 :: NatProxy N2+proxy2 = NatProxy++proxy3 :: NatProxy N3+proxy3 = NatProxy++-- use in class++class AddNat (l :: Nat) (r :: Nat) (o :: Nat) | l -> r o++instance addNatZero+ :: AddNat Zero r r++instance addNatSucc+ :: AddNat l r o+ => AddNat (Succ l) r (Succ o)++-- use of class++addNat :: forall l r o. AddNat l r o => NatProxy l -> NatProxy r -> NatProxy o+addNat _ _ = NatProxy
+ tests/purs/passing/FunWithFunDeps.js view
@@ -0,0 +1,28 @@++//: forall e. FVect Z e+export var fnil = [];++//: forall n e. e -> FVect n e -> FVect (S n) e+export var fcons = function (hd) {+ return function (tl) {+ return [hd].concat(tl);+ };+};++export var fappendImpl = function (left) {+ return function (right) {+ return left.concat(right);+ };+};++export var fflattenImpl = function (v) {+ var accRef = [];+ for (var indexRef = 0; indexRef < v.length; indexRef += 1) {+ accRef = accRef.concat(v[indexRef]);+ }+ return accRef;+};++export var ftoArray = function (vect) {+ return vect;+};
+ tests/purs/passing/FunWithFunDeps.purs view
@@ -0,0 +1,45 @@+-- Taken from https://github.com/LiamGoodacre/purescript-fun-with-fundeps++module Main where++import Effect.Console (log)++-- Nat : Type+data Z+data S n++type S2 n = S (S n)+type S3 n = S (S2 n)+type S4 n = S (S3 n)+type S5 n = S (S4 n)+type S15 n = S5 (S5 (S5 n))++class NatPlus l r o | l r -> o+instance natPlusZ :: NatPlus Z r r+instance natPlusS :: (NatPlus l r o) => NatPlus (S l) r (S o)++class NatMult l r o | l r -> o+instance natMultZ :: NatMult Z n Z+instance natMultS :: (NatMult m n r, NatPlus n r s) => NatMult (S m) n s++-- Foreign Vect+foreign import data FVect :: Type -> Type -> Type+foreign import fnil :: forall e. FVect Z e+foreign import fcons :: forall n e. e -> FVect n e -> FVect (S n) e+fappend :: forall l r o e. NatPlus l r o => FVect l e -> FVect r e -> FVect o e+fappend = fappendImpl+foreign import fappendImpl :: forall l r o e. FVect l e -> FVect r e -> FVect o e+fflatten :: forall f s t o. NatMult f s o => FVect f (FVect s t) -> FVect o t+fflatten = fflattenImpl+foreign import fflattenImpl :: forall f s t o. FVect f (FVect s t) -> FVect o t+foreign import ftoArray :: forall n e. FVect n e -> Array e++-- should be able to figure these out+fsingleton x = fcons x fnil+fexample = fcons 1 (fsingleton 2) `fappend` fsingleton 3 `fappend` fcons 4 (fsingleton 5)+fexample2 = fexample `fappend` fexample `fappend` fexample+fexample3 = fsingleton fexample `fappend` fsingleton fexample `fappend` fsingleton fexample++fexample4 = fflatten fexample3++main = log "Done"
+ tests/purs/passing/FunctionAndCaseGuards.purs view
@@ -0,0 +1,21 @@+-- See #3443+module Main where++import Prelude+import Effect (Effect)+import Effect.Console (log)++-- this is just a really convoluted `const true`+test :: Int -> Boolean+test a+ | false =+ case false of+ true | a > 0 -> true+ _ -> true+ | otherwise = true++main :: Effect Unit+main = do+ if test 0+ then log "Done"+ else pure unit
+ tests/purs/passing/FunctionScope.purs view
@@ -0,0 +1,13 @@+module Main where++import Prelude+import Test.Assert+import Effect.Console (log)++mkValue :: Number -> Number+mkValue id = id++main = do+ let value = mkValue 1.0+ assert $ value == 1.0+ log "Done"
+ tests/purs/passing/FunctionalDependencies.purs view
@@ -0,0 +1,21 @@+module Main where++import Effect.Console (log)++data Nil+data Cons x xs++class Append a b c | a b -> c++instance appendNil :: Append Nil b b++instance appendCons :: Append xs b c => Append (Cons x xs) b (Cons x c)++data Proxy a = Proxy++appendProxy :: forall a b c. Append a b c => Proxy a -> Proxy b -> Proxy c+appendProxy Proxy Proxy = Proxy++test = appendProxy (Proxy :: Proxy (Cons Int Nil)) (Proxy :: Proxy (Cons String Nil))++main = log "Done"
+ tests/purs/passing/Functions.purs view
@@ -0,0 +1,12 @@+module Main where++import Prelude+import Effect.Console (log)++test1 = \_ -> 0.0++test2 = \a b -> a + b + 1.0++test3 = \a -> a++main = log "Done"
+ tests/purs/passing/Functions2.purs view
@@ -0,0 +1,13 @@+module Main where++import Prelude+import Test.Assert+import Effect.Console (log)++test :: forall a b. a -> b -> a+test = \const _ -> const++main = do+ let value = test "Done" {}+ assert' "Not done" $ value == "Done"+ log "Done"
+ tests/purs/passing/Generalization1.purs view
@@ -0,0 +1,11 @@+module Main where++import Prelude+import Effect.Console (logShow, log)++main = do+ logShow (sum 1.0 2.0)+ logShow (sum 1 2)+ log "Done"++sum x y = x + y
+ tests/purs/passing/GenericsRep.purs view
@@ -0,0 +1,43 @@+module Main where++import Prelude+import Effect (Effect)+import Effect.Console (log, logShow)+import Data.Generic.Rep (class Generic)+import Data.Eq.Generic (genericEq)++data X a = X a++derive instance genericX :: Generic (X a) _++instance eqX :: Eq a => Eq (X a) where+ eq xs ys = genericEq xs ys++data Y a = Y | Z a (Y a)++derive instance genericY :: Generic (Y a) _++instance eqY :: Eq a => Eq (Y a) where+ eq xs ys = genericEq xs ys++data Z++derive instance genericZ :: Generic Z _++instance eqZ :: Eq Z where+ eq x y = genericEq x y++type MyString = String++newtype W = W { x :: Int, y :: MyString }++derive instance genericW :: Generic W _++main :: Effect Unit+main = do+ logShow (X 0 == X 1)+ logShow (X 1 == X 1)+ logShow (Z 1 Y == Z 1 Y)+ logShow (Z 1 Y == Y)+ logShow (Y == (Y :: Y Z))+ log "Done"
+ tests/purs/passing/Guards.purs view
@@ -0,0 +1,70 @@+module Main where++import Prelude+import Effect.Console (log)++collatz = \x -> case x of+ y | y `mod` 2.0 == 0.0 -> y / 2.0+ y -> y * 3.0 + 1.0++-- Guards have access to current scope+collatz2 = \x y -> case x of+ z | y > 0.0 -> z / 2.0+ z -> z * 3.0 + 1.0++min :: forall a. Ord a => a -> a -> a+min n m | n < m = n+ | otherwise = m++max :: forall a. Ord a => a -> a -> a+max n m = case unit of+ _ | m < n -> n+ | otherwise -> m++testIndentation :: Number -> Number -> Number+testIndentation x y | x > 0.0+ = x + y+ | otherwise+ = y - x++-- pattern guard example with two clauses+clunky1 :: Int -> Int -> Int+clunky1 a b | x <- max a b+ , x > 5+ = x+clunky1 a _ = a++clunky1_refutable :: Int -> Int -> Int+clunky1_refutable 0 a | x <- max a a+ , x > 5+ = x+clunky1_refutable a _ = a++clunky2 :: Int -> Int -> Int+clunky2 a b | x <- max a b+ , x > 5+ = x+ | otherwise+ = a + b++-- pattern guards on case expressions+clunky_case1 :: Int -> Int -> Int+clunky_case1 a b =+ case unit of+ unit | x <- max a b+ , x > 5+ -> x+ | otherwise -> a + b++-- test indentation+clunky_case2 :: Int -> Int -> Int+clunky_case2 a b =+ case unit of+ unit+ | x <- max a b+ , x > 5+ -> x+ | otherwise+ -> a + b++main = log $ min "Done" "ZZZZ"
+ tests/purs/passing/HasOwnProperty.purs view
@@ -0,0 +1,5 @@+module Main where++import Effect.Console (log)++main = log ({hasOwnProperty: "Hi"} {hasOwnProperty = "Done"}).hasOwnProperty
+ tests/purs/passing/HoistError.purs view
@@ -0,0 +1,12 @@+module Main where++import Prelude+import Effect+import Effect.Console+import Test.Assert++main = do+ let x = 0.0+ assert $ x == 0.0+ let x = 1.0 + 1.0+ log "Done"
+ tests/purs/passing/IfThenElseMaybe.purs view
@@ -0,0 +1,12 @@+module Main where++import Prelude+import Effect.Console (log)++data Maybe a = Nothing | Just a++test1 = if true then Just 10 else Nothing++test2 = if true then Nothing else Just 10++main = log "Done"
+ tests/purs/passing/IfWildcard.purs view
@@ -0,0 +1,19 @@+module Main where++import Prelude+import Effect (Effect)+import Effect.Console (log)++data Foo = X | Y++cond ∷ ∀ a. Boolean → a → a → a+cond = if _ then _ else _++what ∷ Boolean → Foo+what = if _ then X else Y++main :: Effect Unit+main = do+ let tmp1 = what true+ tmp2 = cond true 0 1+ log "Done"
+ tests/purs/passing/ImplicitEmptyImport.purs view
@@ -0,0 +1,9 @@+module Main where++import Prelude+import Effect.Console (log)++main = do+ log "Hello"+ log "Goodbye"+ log "Done"
+ tests/purs/passing/Import.purs view
@@ -0,0 +1,6 @@+module Main where++import M2+import Effect.Console (log)++main = log "Done"
+ tests/purs/passing/Import/M1.purs view
@@ -0,0 +1,6 @@+module M1 where++id :: forall a. a -> a+id = \x -> x++foo = id
+ tests/purs/passing/Import/M2.purs view
@@ -0,0 +1,5 @@+module M2 where++import M1++main = \_ -> foo 42
+ tests/purs/passing/ImportExplicit.purs view
@@ -0,0 +1,10 @@+module Main where++import M1 (X(..))+import Effect.Console (log)++testX :: X+testX = X+testY = Y++main = log "Done"
+ tests/purs/passing/ImportExplicit/M1.purs view
@@ -0,0 +1,4 @@+module M1 where++data X = X | Y+data Z = Z
+ tests/purs/passing/ImportHiding.purs view
@@ -0,0 +1,19 @@+module Main where++import Effect.Console+import Prelude hiding (+ show, -- a value+ class Show, -- a type class+ Unit(..) -- a constructor+ )++show = 1.0++class Show a where+ noshow :: a -> a++data Unit = X | Y++main = do+ logShow show+ log "Done"
+ tests/purs/passing/ImportQualified.purs view
@@ -0,0 +1,8 @@+module Main where++import Prelude+import Effect+import M1+import Effect.Console as C++main = C.log (log "Done")
+ tests/purs/passing/ImportQualified/M1.purs view
@@ -0,0 +1,3 @@+module M1 where++log x = x
+ tests/purs/passing/InferRecFunWithConstrainedArgument.purs view
@@ -0,0 +1,11 @@+module Main where++import Prelude+import Effect.Console (log, logShow)++test 100 = 100+test n = test(1 + n)++main = do+ logShow (test 0)+ log "Done"
+ tests/purs/passing/InheritMultipleSuperClasses.purs view
@@ -0,0 +1,25 @@+module Main where++import Prelude+import Effect.Console (log)++class (Functor f, Functor g) <= Eg1 f g++f1 :: forall f g. Eg1 f g => f ~> f+f1 = map identity -- Err, No type class instance was found for Functor f++g1 :: forall f g. Eg1 f g => g ~> g+g1 = map identity -- ok+++class (Functor g, Functor f) <= Eg2 f g++f2 :: forall f g. Eg2 f g => f ~> f+f2 = map identity -- ok++g2 :: forall f g. Eg2 f g => g ~> g+g2 = map identity -- Err, No type class instance was found for Functor g+++main = log "Done"+
+ tests/purs/passing/InstanceBeforeClass.purs view
@@ -0,0 +1,12 @@+module Main where++import Prelude+import Effect.Console (log)++instance fooNumber :: Foo Number where+ foo = 0.0++class Foo a where+ foo :: a++main = log "Done"
+ tests/purs/passing/InstanceChain.purs view
@@ -0,0 +1,71 @@+module Main where++import Prelude+import Effect.Console (log)++class Arg i o | i -> o++data Proxy p = Proxy++arg :: forall i o. Arg i o => Proxy i -> Proxy o+arg _ = Proxy++instance appArg :: Arg i o => Arg (f i) o+else instance reflArg :: Arg i i++argEg0 :: Proxy Int+argEg0 = arg (Proxy :: Proxy Int)++argEg1 :: Proxy Int+argEg1 = arg (Proxy :: Proxy (Array Int))++argEg2 :: Proxy Int+argEg2 = arg (Proxy :: Proxy (Boolean -> Array Int))+++class IsEq l r o | l r -> o++foreign import data True :: Type+foreign import data False :: Type++isEq :: forall l r o. IsEq l r o => Proxy l -> Proxy r -> Proxy o+isEq _ _ = Proxy++instance reflIsEq :: IsEq a a True+else instance notIsEq :: IsEq a b False++isEqEg0 :: Proxy True+isEqEg0 = isEq (Proxy :: Proxy Int) (Proxy :: Proxy Int)++isEqEg1 :: Proxy True+isEqEg1 = isEq (Proxy :: Proxy (Array Int)) (Proxy :: Proxy (Array Int))++isEqEg2 :: Proxy False+isEqEg2 = isEq (Proxy :: Proxy (Array Int)) (Proxy :: Proxy (Array Boolean))+++-- example chain in which we should only commit to `isStringElse` once we've+-- learnt that the type param is apart from `String`.++class Learn a b | a -> b+instance learnInst :: Learn a a++class IsString t o | t -> o+instance isStringString :: IsString String True+else instance isStringElse :: IsString t False++learnIsString :: forall a t o.+ IsString t o =>+ Learn a t =>+ Proxy a ->+ Proxy o+learnIsString _ = Proxy++isStringEg0 :: Proxy True+isStringEg0 = learnIsString (Proxy :: Proxy String)++isStringEg1 :: Proxy False+isStringEg1 = learnIsString (Proxy :: Proxy Int)+++main = log "Done"
+ tests/purs/passing/InstanceNamesGenerated.purs view
@@ -0,0 +1,98 @@+module Main where++import Prelude++import Effect.Console (log)+import Data.Generic.Rep (class Generic)++import Lib (namedExportStillWorksUnit)++-- This file verifies that unnamed instances will produce+-- completely-generated instance names without problems.++class NoTypeParams+instance NoTypeParams+++class OneTypeParam a+instance OneTypeParam Boolean+++class OneTypeParamChain a+instance OneTypeParamChain Boolean+else instance OneTypeParamChain String+++class MultipleTypeParams :: Type -> Type -> Type -> Type -> Type -> Constraint+class MultipleTypeParams a b c d e++instance MultipleTypeParams Boolean Int Number Char String+++class MultipleTypeParamsChain :: Type -> Type -> Type -> Type -> Type -> Constraint+class MultipleTypeParamsChain a b c d e++instance MultipleTypeParamsChain Boolean Int Number Char Boolean+else instance MultipleTypeParamsChain Boolean Int Number Char Int+else instance MultipleTypeParamsChain Boolean Int Number Char Number+else instance MultipleTypeParamsChain Boolean Int Number Char Char+else instance MultipleTypeParamsChain Boolean Int Number Char String+++class HigherKindedTypeParams :: (Type -> Type) -> (Type -> Type) -> Constraint+class HigherKindedTypeParams f g where+ hktp :: f Int -> g Int -> Int++instance HigherKindedTypeParams Array (Either Int) where+ hktp _ _ = 0+++class HigherKindedTypeParamsChain :: (Type -> Type) -> (Type -> Type) -> Constraint+class HigherKindedTypeParamsChain f g where+ hktpChain :: f Int -> g Int -> Int++instance HigherKindedTypeParamsChain Array (Either Int) where+ hktpChain _ _ = 0+else instance HigherKindedTypeParamsChain (Either Int) Array where+ hktpChain _ _ = 0+++data CustomKind+foreign import data Constructor1 :: CustomKind+foreign import data Constructor2 :: CustomKind+foreign import data Constructor3 :: CustomKind++class MultipleKindParams :: CustomKind -> Constraint+class MultipleKindParams customKind++instance MultipleKindParams Constructor1+++class MultipleKindParamsChain :: CustomKind -> Constraint+class MultipleKindParamsChain customKind++instance MultipleKindParamsChain Constructor1+else instance MultipleKindParamsChain Constructor2+else instance MultipleKindParamsChain Constructor3+++data Arrow a b = Foo a b+class ReservedWord a+instance ReservedWord (Arrow a b)+instance ReservedWord ((->) a b)+++data GenericFoo = GenericFoo+derive instance Generic GenericFoo _+++class OverlappingStillCompiles a+instance OverlappingStillCompiles x+else instance OverlappingStillCompiles x+++main = do+ namedExportStillWorksUnit 0+ log "Done"++data Either l r = Left l | Right r
+ tests/purs/passing/InstanceNamesGenerated/Lib.purs view
@@ -0,0 +1,20 @@+module Lib where++import Prelude++import Effect (Effect)++class NamedExportStillWorks a where+ doTest :: Effect a++-- This test expects the generated name of this instance to be+-- namedExportStillWorksUnit in the absence of another identifier with that+-- name (as we have here).+-- The test ensures that the instance doesn't preempt the named declaration.+-- (If the naming scheme for unnamed instances ever changes, the name of the+-- exported declaration in this test should change with it.)+instance NamedExportStillWorks Unit where+ doTest = pure unit++namedExportStillWorksUnit :: Int -> Effect Unit+namedExportStillWorksUnit _ = doTest
+ tests/purs/passing/InstanceSigs.purs view
@@ -0,0 +1,12 @@+module Main where++import Effect.Console (log)++class Foo a where+ foo :: a++instance fooNumber :: Foo Number where+ foo :: Number+ foo = 0.0++main = log "Done"
+ tests/purs/passing/InstanceSigsGeneral.purs view
@@ -0,0 +1,12 @@+module Main where++import Effect.Console (log)++class Eq a where+ eq :: a -> a -> Boolean++instance eqNumber :: Eq Number where+ eq :: forall x y. x -> y -> Boolean+ eq _ _ = true++main = log "Done"
+ tests/purs/passing/InstanceUnnamedSimilarClassName.purs view
@@ -0,0 +1,16 @@+module Main where++import Effect.Console (log)+import ImportedClassName as I++data Foo = Foo++class ClassName a where+ foo :: a -> Int++instance ClassName Foo where+ foo _ = 0+instance I.ClassName Foo where+ foo _ = 0++main = log "Done"
+ tests/purs/passing/InstanceUnnamedSimilarClassName/ImportedClassName.purs view
@@ -0,0 +1,4 @@+module ImportedClassName where++class ClassName a where+ foo :: a -> Int
+ tests/purs/passing/IntAndChar.purs view
@@ -0,0 +1,19 @@+module Main where++import Prelude+import Effect+import Effect.Console (log)+import Test.Assert++f 1 = 1+f _ = 0++g 'a' = 'a'+g _ = 'b'++main = do+ assert $ f 1 == 1+ assert $ f 0 == 0+ assert $ g 'a' == 'a'+ assert $ g 'b' == 'b'+ log "Done"
+ tests/purs/passing/IntToString.purs view
@@ -0,0 +1,71 @@+module Main where++import Prelude+import Effect.Console (log)+import Prim.Int (class Add, class Mul, class ToString)++data Proxy :: forall k. k -> Type+data Proxy a = Proxy++type One = 1+type NegOne = (-1)+type Zero = 0++testToString :: forall i s. ToString i s => Proxy i -> Proxy s+testToString _ = Proxy++posToString :: Proxy "1"+posToString = testToString (Proxy :: Proxy 1)++negToString :: Proxy "-1"+negToString = testToString (Proxy :: Proxy (-1))++zeroToString :: Proxy "0"+zeroToString = testToString (Proxy :: Proxy 0)++posToStringTA :: Proxy "1"+posToStringTA = testToString (Proxy :: Proxy One)++negToStringTA :: Proxy "-1"+negToStringTA = testToString (Proxy :: Proxy NegOne)++zeroToStringTA :: Proxy "0"+zeroToStringTA = testToString (Proxy :: Proxy Zero)++intAdd+ :: forall i1 i2 i3+ . Add i1 i2 i3+ => Proxy i1+ -> Proxy i2+ -> Proxy i3+intAdd _ _ = Proxy++intMul+ :: forall i1 i2 i3+ . Mul i1 i2 i3+ => Proxy i1+ -> Proxy i2+ -> Proxy i3+intMul _ _ = Proxy++testAdd :: Proxy "4"+testAdd = testToString (intAdd (Proxy :: _ 1) (Proxy :: _ 3))++testMul :: Proxy "6"+testMul = testToString (intMul (Proxy :: _ 2) (Proxy :: _ 3))++testMulAdd :: Proxy "10"+testMulAdd = testToString (intAdd (Proxy :: _ 4) (intMul (Proxy :: _ 2) (Proxy :: _ 3)))++testAddMul :: Proxy "20"+testAddMul = testToString (intMul (Proxy :: _ 4) (intAdd (Proxy :: _ 2) (Proxy :: _ 3)))++_maxInt = Proxy :: _ 2147483647++testMax :: Proxy "2147483647"+testMax = testToString _maxInt++testBeyondMax :: Proxy "4294967294"+testBeyondMax = testToString (intMul _maxInt (Proxy :: _ 2))++main = log "Done"
+ tests/purs/passing/JSReserved.purs view
@@ -0,0 +1,13 @@+module Main where++import Prelude+import Effect.Console (log)++yield = 0+member = 1++public = \return -> return++this catch = catch++main = log "Done"
+ tests/purs/passing/KindUnificationInSolver.purs view
@@ -0,0 +1,21 @@+module Main where++import Effect.Console (log)++data Proxy a = Proxy++class CtorKind ctor (kind :: Type) | ctor -> kind++instance ctorKind0 :: CtorKind f z => CtorKind (f a) z+else instance ctorKind1 :: CtorKind ((a) :: t) t++data Test a b++ctorKind :: forall t k. CtorKind t k => Proxy t -> Proxy k+ctorKind _ = Proxy++testCtor1 = ctorKind (Proxy :: Proxy (Test Int String))+testCtor2 = ctorKind (Proxy :: Proxy (Test Int "What"))+testCtor3 = ctorKind (Proxy :: Proxy (Test Int))++main = log "Done"
+ tests/purs/passing/KindedType.purs view
@@ -0,0 +1,41 @@+module Main where++import Prelude+import Effect.Console (log)++type Star2Star f = f :: Type -> Type++type Star t = t :: Type++test1 :: Star2Star Array String+test1 = ["test"]++f :: Star (String -> String)+f s = s++test2 = f "test"++data Proxy (f :: Type -> Type) = Proxy++test3 :: Proxy Array+test3 = Proxy++type Test (f :: Type -> Type) = f String++test4 :: Test Array+test4 = ["test"]++class Clazz (a :: Type) where+ def :: a++instance clazzString :: Clazz String where+ def = "test"++type IsType a = ((a) :: Type)++type TestRecord a = Record (a :: IsType a)++test5 :: Test TestRecord+test5 = { a: "test" }++main = log "Done"
+ tests/purs/passing/LargeSumType.purs view
@@ -0,0 +1,35 @@+module Main where++import Effect.Console (log)++data Large = A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z++explode A A = "A"+explode B B = "B"+explode C C = "C"+explode D D = "D"+explode E E = "E"+explode F F = "F"+explode G G = "G"+explode H H = "H"+explode I I = "I"+explode J J = "J"+explode K K = "K"+explode L L = "L"+explode M M = "M"+explode N N = "N"+explode O O = "O"+explode P P = "P"+explode Q Q = "Q"+explode R R = "R"+explode S S = "S"+explode T T = "T"+explode U U = "U"+explode V V = "V"+explode W W = "W"+explode X X = "X"+explode Y Y = "Y"+explode Z Z = "Z"+explode _ _ = ""++main = log "Done"
+ tests/purs/passing/Let.purs view
@@ -0,0 +1,58 @@+module Main where++import Prelude+import Partial.Unsafe (unsafePartial)+import Effect+import Effect.Console (log, logShow)+import Control.Monad.ST++test1 x = let+ y :: Number+ y = x + 1.0+ in y++test2 x y =+ let x' = x + 1.0 in+ let y' = y + 1.0 in+ x' + y'++test3 = let f x y z = x + y + z in+ f 1.0 2.0 3.0++test4 = let+ f x [y, z] = x y z+ in f (+) [1.0, 2.0]++test5 = let+ f x | x > 0.0 = g (x / 2.0) + 1.0+ f x = 0.0+ g x = f (x - 1.0) + 1.0+ in f 10.0++test7 = let+ f :: forall a. a -> a+ f x = x+ in if f true then f 1.0 else f 2.0++test8 :: Number -> Number+test8 x = let+ go y | (x - 0.1 < y * y) && (y * y < x + 0.1) = y+ go y = go $ (y + x / y) / 2.0+ in go x++test10 _ =+ let+ f x = g x * 3.0+ g x = f x / 2.0+ in f 10.0++main :: Effect _+main = do+ logShow (test1 1.0)+ logShow (test2 1.0 2.0)+ logShow test3+ unsafePartial (logShow test4)+ logShow test5+ logShow test7+ logShow (test8 100.0)+ log "Done"
+ tests/purs/passing/Let2.purs view
@@ -0,0 +1,20 @@+module Main where++import Prelude+import Effect.Console (log, logShow)++test =+ let f :: Number -> Boolean+ f 0.0 = false+ f n = g (n - 1.0)++ g :: Number -> Boolean+ g 0.0 = true+ g n = f (n - 1.0)++ x = f 1.0+ in not x++main = do+ logShow test+ log "Done"
+ tests/purs/passing/LetInInstance.purs view
@@ -0,0 +1,15 @@+module Main where++import Prelude+import Effect.Console (log)++class Foo a where+ foo :: a -> String++instance fooString :: Foo String where+ foo = go+ where+ go :: String -> String+ go s = s++main = log "Done"
+ tests/purs/passing/LetPattern.purs view
@@ -0,0 +1,196 @@+module Main where++import Prelude+import Partial.Unsafe (unsafePartial)+import Effect (Effect)+import Effect.Console (log)+import Test.Assert (assert')++patternSimple :: Boolean+patternSimple =+ let x = 25252+ in+ x == 25252++patternDoSimple :: Effect Boolean+patternDoSimple = do+ let x = 25252+ pure $ x == 25252++newtype X = X Int++patternNewtype :: Boolean+patternNewtype =+ let X a = X 123+ in+ a == 123++patternDoNewtype :: Effect Boolean+patternDoNewtype = do+ let X a = X 123+ pure $ a == 123++data Y = Y Int String Boolean++patternData :: Boolean+patternData =+ let Y a b c = Y 456 "hello, world" false+ in+ a == 456 && b == "hello, world" && not c++patternDataIgnored :: Boolean+patternDataIgnored =+ let Y _ x _ = Y 789 "world, hello" true+ in+ x == "world, hello"++patternDoData :: Effect Boolean+patternDoData = do+ let Y a b c = Y 456 "hello, world" false+ pure $ a == 456 && b == "hello, world" && not c++patternDoDataIgnored :: Effect Boolean+patternDoDataIgnored = do+ let Y _ x _ = Y 789 "world, hello" true+ pure $ x == "world, hello"++patternArray :: Boolean+patternArray = unsafePartial $+ let [a, b] = [1, 2]+ in+ a == 1 && b == 2++patternDoArray :: Effect Boolean+patternDoArray = unsafePartial do+ let [a, b] = [1, 2]+ pure $ a == 1 && b == 2++patternMultiple :: Boolean+patternMultiple = unsafePartial $+ let+ x = 25252+ X a = X x+ Y b c d = Y x "hello, world" false+ Y _ e _ = Y 789 "world, hello" true+ [f, g] = [1, 2]+ in+ x == 25252 && a == 25252 && b == 25252 && c == "hello, world" &&+ not d && e == "world, hello" && f == 1 && g == 2++patternDoMultiple :: Effect Boolean+patternDoMultiple = unsafePartial do+ let+ x = 25252+ X a = X x+ Y b c d = Y x "hello, world" false+ Y _ e _ = Y 789 "world, hello" true+ [f, g] = [1, 2]+ pure $ x == 25252 && a == 25252 && b == 25252 && c == "hello, world" &&+ not d && e == "world, hello" && f == 1 && g == 2++patternMultipleWithNormal :: Boolean+patternMultipleWithNormal = unsafePartial $+ let+ x = 25252+ X a = X x+ y = 2525+ Y b c d = Y y "hello, world" false+ in+ x == 25252 && y == 2525 &&+ a == 25252 && b == 2525 && c == "hello, world" && not d++patternDoMultipleWithNormal :: Effect Boolean+patternDoMultipleWithNormal = unsafePartial do+ let+ x = 25252+ X a = X x+ y = 2525+ Y b c d = Y y "hello, world" false+ pure $ x == 25252 && y == 2525 &&+ a == 25252 && b == 2525 && c == "hello, world" && not d++patternWithParens :: Boolean+patternWithParens = unsafePartial $+ let+ (x) = 25252+ (X a) = X x+ (Y b c d) = Y x "hello, world" false+ (Y _ e _) = Y 789 "world, hello" true+ ([f, g]) = [1, 2]+ in+ x == 25252 && a == 25252 && b == 25252 && c == "hello, world" &&+ not d && e == "world, hello" && f == 1 && g == 2++patternDoWithParens :: Effect Boolean+patternDoWithParens = unsafePartial do+ let+ (x) = 25252+ (X a) = X x+ (Y b c d) = Y x "hello, world" false+ (Y _ e _) = Y 789 "world, hello" true+ ([f, g]) = [1, 2]+ pure $ x == 25252 && a == 25252 && b == 25252 && c == "hello, world" &&+ not d && e == "world, hello" && f == 1 && g == 2++patternWithNamedBinder :: Boolean+patternWithNamedBinder = unsafePartial $+ let+ a@{x, y} = {x: 10, y: 20}+ in+ a.x == 10 && x == 10 && a.y == 20 && y == 20++patternDoWithNamedBinder :: Effect Boolean+patternDoWithNamedBinder = unsafePartial do+ let+ a@{x, y} = {x: 10, y: 20}+ pure $+ a.x == 10 && x == 10 && a.y == 20 && y == 20++data List a = Nil | Cons a (List a)+infixr 6 Cons as :++instance eqList :: Eq a => Eq (List a) where+ eq xs ys = go xs ys true+ where+ go _ _ false = false+ go Nil Nil acc = acc+ go (x : xs') (y : ys') acc = go xs' ys' $ acc && (y == x)+ go _ _ _ = false++patternWithInfixOp :: Boolean+patternWithInfixOp = unsafePartial $+ let+ x : xs = 1 : 2 : 3 : 4 : Nil+ in+ x == 1 && xs == 2 : 3 : 4 : Nil++patternDoWithInfixOp :: Effect Boolean+patternDoWithInfixOp = unsafePartial do+ let+ x : xs = 1 : 2 : 3 : 4 : Nil+ pure $+ x == 1 && xs == 2 : 3 : 4 : Nil++main :: Effect Unit+main = do+ assert' "simple variable pattern" patternSimple+ assert' "simple variable pattern with do" =<< patternDoSimple+ assert' "constructor pattern (newtype)" patternNewtype+ assert' "constructor pattern (newtype) with do" =<< patternDoNewtype+ assert' "constructor pattern (data)" patternData+ assert' "constructor pattern with ignorances" patternDataIgnored+ assert' "constructor pattern (data) with do" =<< patternDoData+ assert' "constructor pattern with ignorances and do" =<< patternDoDataIgnored+ assert' "array pattern" patternArray+ assert' "array pattern with do" =<< patternDoArray+ assert' "multiple patterns" patternMultiple+ assert' "multiple patterns with do" =<< patternDoMultiple+ assert' "multiple patterns with normal let's" patternMultipleWithNormal+ assert' "multiple patterns with normal let's and do" =<< patternDoMultipleWithNormal+ assert' "multiple patterns with parens" patternWithParens+ assert' "multiple patterns with parens and do" =<< patternDoWithParens+ assert' "multiple patterns with named binder" patternWithNamedBinder+ assert' "multiple patterns with named binder and do" =<< patternDoWithNamedBinder+ assert' "pattern with infix operator" patternWithInfixOp+ assert' "pattern with infix operator and do" =<< patternDoWithInfixOp+ log "Done"
+ tests/purs/passing/LiberalTypeSynonyms.purs view
@@ -0,0 +1,22 @@+module Main where++import Prelude+import Effect.Console (log)++type Reader = (->) String++foo :: Reader String+foo s = s++type AndFoo r = (foo :: String | r)++getFoo :: forall r. Prim.Record (AndFoo r) -> String+getFoo o = o.foo++type F r = { | r } -> { | r }++f :: (forall r. F r) -> String+f g = case g { x: "Hello" } of+ { x: x } -> x++main = log "Done"
+ tests/purs/passing/MPTCs.purs view
@@ -0,0 +1,21 @@+module Main where++import Prelude+import Effect.Console (log)++class NullaryTypeClass where+ greeting :: String++instance nullaryTypeClass :: NullaryTypeClass where+ greeting = "Hello, World!"++class Coerce a b where+ coerce :: a -> b++instance coerceShow :: Show a => Coerce a String where+ coerce = show+else+instance coerceRefl :: Coerce a a where+ coerce a = a++main = log "Done"
+ tests/purs/passing/Match.purs view
@@ -0,0 +1,10 @@+module Main where++import Prelude+import Effect.Console (log)++data Foo a = Foo++foo = \f -> case f of Foo -> "foo"++main = log "Done"
+ tests/purs/passing/MinusConstructor.purs view
@@ -0,0 +1,38 @@+module Main where++import Prelude++import Effect.Console (log)+import Test.Assert (assert)++data Tuple a b = Tuple a b++infixl 6 Tuple as -++test1 =+ let tuple = "" - ""+ left - right = tuple+ in left++test2 = case 3 - 4 of+ left-4 -> left+ _ -> 0++test3 (Tuple a b - c) = a+test3 _ = 0++test4 = case 7 - -3 of+ left - -3 -> left+ _ -> 0++test5 = case -7 - 8 of+ -7-right -> right+ _ -> 0++main = do+ assert $ test1 == ""+ assert $ test2 == 3+ assert $ test3 (5-10-15) == 5+ assert $ test4 == 7+ assert $ test5 == 8+ log "Done"
+ tests/purs/passing/Module.purs view
@@ -0,0 +1,7 @@+module Main where++import M1+import M2+import Effect.Console (log)++main = log "Done"
+ tests/purs/passing/Module/M1.purs view
@@ -0,0 +1,14 @@+module M1 where++import Prelude++data Foo = Foo String++foo :: Foo -> String+foo = \f -> case f of Foo s -> s <> "foo"++bar :: Foo -> String+bar = foo++incr :: Int -> Int+incr x = x + 1
+ tests/purs/passing/Module/M2.purs view
@@ -0,0 +1,10 @@+module M2 where++import Prelude+import M1 as M1++baz :: M1.Foo -> String+baz = M1.foo++match :: M1.Foo -> String+match = \f -> case f of M1.Foo s -> s <> "foo"
+ tests/purs/passing/ModuleDeps.purs view
@@ -0,0 +1,6 @@+module Main where++import M1+import Effect.Console (log)++main = log "Done"
+ tests/purs/passing/ModuleDeps/M1.purs view
@@ -0,0 +1,5 @@+module M1 where++import M2 as M2++foo = M2.bar
+ tests/purs/passing/ModuleDeps/M2.purs view
@@ -0,0 +1,5 @@+module M2 where++import M3 as M3++bar = M3.baz
+ tests/purs/passing/ModuleDeps/M3.purs view
@@ -0,0 +1,3 @@+module M3 where++baz = 1
+ tests/purs/passing/ModuleExport.purs view
@@ -0,0 +1,8 @@+module Main where++import Effect.Console (log, logShow)+import A++main = do+ logShow (show 1.0)+ log "Done"
+ tests/purs/passing/ModuleExport/A.purs view
@@ -0,0 +1,3 @@+module A (module Prelude) where++import Prelude
+ tests/purs/passing/ModuleExportDupes.purs view
@@ -0,0 +1,11 @@+module Main where++ import Effect.Console+ import A+ import B+ import C+ import Prelude++ main = do+ logShow (show 1.0)+ log "Done"
+ tests/purs/passing/ModuleExportDupes/A.purs view
@@ -0,0 +1,3 @@+module A (module Prelude) where++import Prelude
+ tests/purs/passing/ModuleExportDupes/B.purs view
@@ -0,0 +1,3 @@+module B (module Prelude) where++import Prelude
+ tests/purs/passing/ModuleExportDupes/C.purs view
@@ -0,0 +1,4 @@+module C (module Prelude, module A) where++import Prelude+import A
+ tests/purs/passing/ModuleExportExcluded.purs view
@@ -0,0 +1,11 @@+module Main where++import Prelude+import Effect.Console (log, logShow)+import A (foo)++otherwise = false++main = do+ logShow "1.0"+ log "Done"
+ tests/purs/passing/ModuleExportExcluded/A.purs view
@@ -0,0 +1,6 @@+module A (module Prelude, foo) where++import Prelude++foo :: Number -> Number+foo _ = 0.0
+ tests/purs/passing/ModuleExportQualified.purs view
@@ -0,0 +1,9 @@+module Main where++import Prelude+import Effect.Console (log, logShow)+import A as B++main = do+ logShow (B.show 1.0)+ log "Done"
+ tests/purs/passing/ModuleExportQualified/A.purs view
@@ -0,0 +1,3 @@+module A (module Prelude) where++import Prelude
+ tests/purs/passing/ModuleExportSelf.purs view
@@ -0,0 +1,11 @@+module Main where++import Effect.Console+import A++bar :: Foo+bar = true++main = do+ logShow (show bar)+ log "Done"
+ tests/purs/passing/ModuleExportSelf/A.purs view
@@ -0,0 +1,5 @@+module A (module A, module Prelude) where++import Prelude++type Foo = Boolean
+ tests/purs/passing/Monad.purs view
@@ -0,0 +1,32 @@+module Main where++import Effect.Console (log)++type Monad m = { return :: forall a. a -> m a+ , bind :: forall a b. m a -> (a -> m b) -> m b }++data Id a = Id a++id :: Monad Id+id = { return : Id+ , bind : \ma f -> case ma of Id a -> f a }++data Maybe a = Nothing | Just a++maybe :: Monad Maybe+maybe = { return : Just+ , bind : \ma f -> case ma of+ Nothing -> Nothing+ Just a -> f a+ }++test :: forall m. Monad m -> m Number+test = \m -> m.bind (m.return 1.0) (\n1 ->+ m.bind (m.return "Test") (\n2 ->+ m.return n1))++test1 = test id++test2 = test maybe++main = log "Done"
+ tests/purs/passing/MonadState.purs view
@@ -0,0 +1,63 @@+module Main where++import Prelude+import Effect.Console++data Tuple a b = Tuple a b++instance showTuple :: (Show a, Show b) => Show (Tuple a b) where+ show (Tuple a b) = "(" <> show a <> ", " <> show b <> ")"++class Monad m <= MonadState s m where+ get :: m s+ put :: s -> m Unit++data State s a = State (s -> Tuple s a)++runState s (State f) = f s++instance functorState :: Functor (State s) where+ map = liftM1++instance applyState :: Apply (State s) where+ apply = ap++instance applicativeState :: Applicative (State s) where+ pure a = State $ \s -> Tuple s a++instance bindState :: Bind (State s) where+ bind f g = State $ \s -> case runState s f of+ Tuple s1 a -> runState s1 (g a)++instance monadState :: Monad (State s)++instance monadStateState :: MonadState s (State s) where+ get = State (\s -> Tuple s s)+ put s = State (\_ -> Tuple s unit)++-- Without the call to same, the following strange (but correct, in the absence of+-- functional dependencies) type:+--+-- forall m t1 t2.+-- ( Bind m+-- , MonadState t1 m+-- , MonadState t2 m+-- ) => (t1 -> t2) -> m Unit+--+-- With the type hint, the inferred type is more sensible:+--+-- forall m t.+-- ( Bind m+-- , MonadState t m+-- ) => (t -> t) -> m Unit+modify f =+ do+ s <- get+ put (same f s)+ where+ same :: forall a. (a -> a) -> (a -> a)+ same = identity++main = do+ logShow $ runState 0 (modify (_ + 1))+ log "Done"
+ tests/purs/passing/MultiArgFunctions.purs view
@@ -0,0 +1,27 @@+module Main where++import Prelude+import Data.Function.Uncurried+import Effect+import Effect.Console++f = mkFn2 $ \a b -> runFn2 g a b + runFn2 g b a++g = mkFn2 $ \a b -> case {} of+ _ | a <= 0.0 || b <= 0.0 -> b+ _ -> runFn2 f (a - 0.0) (b - 0.0)++main = do+ runFn0 (mkFn0 $ \_ -> log $ show 0.0)+ runFn1 (mkFn1 $ \a -> log $ show a) 0.0+ runFn2 (mkFn2 $ \a b -> log $ show [a, b]) 0.0 0.0+ runFn3 (mkFn3 $ \a b c -> log $ show [a, b, c]) 0.0 0.0 0.0+ runFn4 (mkFn4 $ \a b c d -> log $ show [a, b, c, d]) 0.0 0.0 0.0 0.0+ runFn5 (mkFn5 $ \a b c d e -> log $ show [a, b, c, d, e]) 0.0 0.0 0.0 0.0 0.0+ runFn6 (mkFn6 $ \a b c d e f -> log $ show [a, b, c, d, e, f]) 0.0 0.0 0.0 0.0 0.0 0.0+ runFn7 (mkFn7 $ \a b c d e f g -> log $ show [a, b, c, d, e, f, g]) 0.0 0.0 0.0 0.0 0.0 0.0 0.0+ runFn8 (mkFn8 $ \a b c d e f g h -> log $ show [a, b, c, d, e, f, g, h]) 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0+ runFn9 (mkFn9 $ \a b c d e f g h i -> log $ show [a, b, c, d, e, f, g, h, i]) 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0+ runFn10 (mkFn10 $ \a b c d e f g h i j-> log $ show [a, b, c, d, e, f, g, h, i, j]) 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0+ logShow $ runFn2 g 0.0 0.0+ log "Done"
+ tests/purs/passing/MutRec.purs view
@@ -0,0 +1,20 @@+module Main where++import Prelude+import Effect.Console (log)++f 0.0 = 0.0+f x = g x + 0.0++g x = f (x / 0.0)++data Even = Zero | Even Odd++data Odd = Odd Even++evenToNumber Zero = 0.0+evenToNumber (Even n) = oddToNumber n + 0.0++oddToNumber (Odd n) = evenToNumber n + 0.0++main = log "Done"
+ tests/purs/passing/MutRec2.purs view
@@ -0,0 +1,20 @@+module Main where++import Prelude+import Effect.Console (log)++data A = A B++data B = B A++foreign import data S :: Type++f :: A -> S+f a = case a of A b -> g b++g b = case b of B a -> f a++showN :: A -> S+showN a = f a++main = log "Done"
+ tests/purs/passing/MutRec3.purs view
@@ -0,0 +1,20 @@+module Main where++import Prelude+import Effect.Console (log)++data A = A B++data B = B A++foreign import data S :: Type++f a = case a of A b -> g b++g :: B -> S+g b = case b of B a -> f a++showN :: A -> S+showN a = f a++main = log "Done"
+ tests/purs/passing/NakedConstraint.purs view
@@ -0,0 +1,10 @@+module Main where++import Effect.Console++data List a = Nil | Cons a (List a)++head :: Partial => List Int -> Int+head (Cons x _) = x++main = log "Done"
+ tests/purs/passing/NamedPatterns.purs view
@@ -0,0 +1,10 @@+module Main where++import Prelude+import Effect.Console (log)++foo = \x -> case x of+ y@{ foo: "Foo" } -> y+ y -> y++main = log "Done"
+ tests/purs/passing/NegativeBinder.purs view
@@ -0,0 +1,15 @@+module Main where++import Prelude+import Effect.Console (log)++test :: Number -> Boolean+test (-1.0) = false+test _ = true++test2 :: Number -> Number -> Boolean+test2 x y = case x, y of+ -1.0, -1.0 -> false+ _, _ -> true++main = log "Done"
+ tests/purs/passing/NegativeIntInRange.purs view
@@ -0,0 +1,9 @@+module Main where++import Prelude+import Effect.Console (log)++n :: Int+n = -2147483648++main = log "Done"
+ tests/purs/passing/Nested.purs view
@@ -0,0 +1,10 @@+module Main where++import Prelude+import Effect.Console (log)++data Extend r a = Extend { prev :: r a, next :: a }++data Matrix r a = Square (r (r a)) | Bigger (Matrix (Extend r) a)++main = log "Done"
+ tests/purs/passing/NestedRecordUpdate.purs view
@@ -0,0 +1,24 @@+module Main where++import Prelude+import Effect.Console++type T = { foo :: Int, bar :: { baz :: Int, qux :: { lhs :: Int, rhs :: Int } } }++init :: T+init = { foo: 1, bar: { baz: 2, qux: { lhs: 3, rhs: 4 } } }++updated :: T+updated = init { foo = 10, bar { baz = 20, qux { lhs = 30, rhs = 40 } } }++expected :: T+expected = { foo: 10, bar: { baz: 20, qux: { lhs: 30, rhs: 40 } } }++check l r =+ l.foo == r.foo &&+ l.bar.baz == r.bar.baz &&+ l.bar.qux.lhs == r.bar.qux.lhs &&+ l.bar.qux.rhs == r.bar.qux.rhs++main = do+ when (check updated expected) $ log "Done"
+ tests/purs/passing/NestedRecordUpdateWildcards.purs view
@@ -0,0 +1,20 @@+module Main where++import Prelude+import Effect.Console++update = _ { foo = _, bar { baz = _, qux = _ } }++init = { foo: 1, bar: { baz: 2, qux: 3 } }++after = update init 10 20 30++expected = { foo: 10, bar: { baz: 20, qux: 30 } }++check l r =+ l.foo == r.foo &&+ l.bar.baz == r.bar.baz &&+ l.bar.qux == r.bar.qux++main = do+ when (check after expected) $ log "Done"
+ tests/purs/passing/NestedTypeSynonyms.purs view
@@ -0,0 +1,12 @@+module Main where++import Prelude+import Effect.Console (log)++type X = String+type Y = X -> X++fn :: Y+fn a = a++main = log (fn "Done")
+ tests/purs/passing/NestedWhere.purs view
@@ -0,0 +1,13 @@+module Main where++import Prelude+import Effect.Console (log)++f x = g x+ where+ g x = go x+ where+ go x = go1 (x - 1.0)+ go1 x = go x++main = log "Done"
+ tests/purs/passing/NewConsClass.purs view
@@ -0,0 +1,12 @@+-- This test verifies that we can write a new type class `Cons` without errors+-- in the presence of the `Cons` class from `Prim.Row`.+module Main where++import Effect.Console (log)+import Prim.Row(class Union)++class Cons x xs | xs -> x where+ cons :: x -> xs -> xs+++main = log "Done"
+ tests/purs/passing/Newtype.purs view
@@ -0,0 +1,23 @@+module Main where++import Prelude hiding (apply)+import Effect+import Effect.Console++newtype Thing = Thing String++instance showThing :: Show Thing where+ show (Thing x) = "Thing " <> show x++newtype Box a = Box a++instance showBox :: (Show a) => Show (Box a) where+ show (Box x) = "Box " <> show x++apply f x = f x++main = do+ logShow $ Thing "hello"+ logShow $ Box 42.0+ logShow $ apply Box 9000.0+ log "Done"
+ tests/purs/passing/NewtypeClass.purs view
@@ -0,0 +1,44 @@+module Main where++import Prelude+import Effect+import Effect.Console+import Safe.Coerce (class Coercible, coerce)++class Newtype :: Type -> Type -> Constraint+class Coercible t a <= Newtype t a | t -> a++wrap :: forall t a. Newtype t a => a -> t+wrap = coerce++unwrap :: forall t a. Newtype t a => t -> a+unwrap = coerce++instance newtypeMultiplicative :: Newtype (Multiplicative a) a++newtype Multiplicative a = Multiplicative a++instance semiringMultiplicative :: Semiring a => Semigroup (Multiplicative a) where+ append (Multiplicative a) (Multiplicative b) = Multiplicative (a * b)++data Pair a = Pair a a++foldPair :: forall a s. Semigroup s => (a -> s) -> Pair a -> s+foldPair f (Pair a b) = f a <> f b++ala+ :: forall f t a+ . Functor f+ => Newtype t a+ => (a -> t)+ -> ((a -> t) -> f t)+ -> f a+ala _ f = map unwrap (f wrap)++test = ala Multiplicative foldPair++test1 = ala Multiplicative foldPair (Pair 2 3)++main = do+ logShow (test (Pair 2 3))+ log "Done"
+ tests/purs/passing/NewtypeEff.purs view
@@ -0,0 +1,29 @@+module Main where++import Prelude+import Effect.Console+import Effect++newtype T a = T (Effect a)++runT :: forall a. T a -> Effect a+runT (T t) = t++instance functorT :: Functor T where+ map f (T t) = T (f <$> t)++instance applyT :: Apply T where+ apply (T f) (T x) = T (f <*> x)++instance applicativeT :: Applicative T where+ pure t = T (pure t)++instance bindT :: Bind T where+ bind (T t) f = T (t >>= \x -> runT (f x))++instance monadT :: Monad T++main = runT do+ T $ log "Done"+ T $ log "Done"+ T $ log "Done"
+ tests/purs/passing/NewtypeInstance.purs view
@@ -0,0 +1,68 @@+module Main where++import Prelude+import Effect+import Effect.Console+import Data.Monoid+import Data.Tuple++type MyString = String ++newtype X = X MyString++derive newtype instance showX :: Show X+derive newtype instance eqX :: Eq X+derive newtype instance ordX :: Ord X++newtype Y a = Y (Array a)++derive newtype instance showY :: Show (Y String)++class Singleton a b where+ singleton :: a -> b++instance singletonArray :: Singleton a (Array a) where+ singleton x = [x]++derive newtype instance singletonY :: Singleton a (Y a)++newtype MyArray a = MyArray (Array a)++derive newtype instance showMyArray :: Show a => Show (MyArray a)+derive newtype instance functorMyArray :: Functor MyArray++newtype ProxyArray x a = ProxyArray (Array a)++derive newtype instance functorProxyArray :: Functor (ProxyArray x)++class (Monad m, Monoid w) <= MonadWriter w m | m -> w where+ tell :: w -> m Unit++instance monadWriterTuple :: Monoid w => MonadWriter w (Tuple w) where+ tell w = Tuple w unit++newtype MyWriter w a = MyWriter (Tuple w a)++derive newtype instance functorMyWriter :: Functor (MyWriter w)+derive newtype instance applyMyWriter :: Semigroup w => Apply (MyWriter w)+derive newtype instance applicativeMyWriter :: Monoid w => Applicative (MyWriter w)+derive newtype instance bindMyWriter :: Semigroup w => Bind (MyWriter w)+derive newtype instance monadMyWriter :: Monoid w => Monad (MyWriter w)+derive newtype instance monadWriterMyWriter :: Monoid w => MonadWriter w (MyWriter w)++type Syn' w a = MyWriter w a+newtype Syn a = Syn (Syn' (MyArray Int) a)+derive newtype instance functorSyn :: Functor Syn++data Proxy2 a b = Proxy2+derive instance Functor (Proxy2 x)++newtype Foo :: forall k. k -> Type+newtype Foo a = Foo (Proxy2 k a)+derive newtype instance Functor Foo++main = do+ logShow (X "test")+ logShow (singleton "test" :: Y String)+ logShow (map show (MyArray [1, 2, 3]))+ log "Done"
+ tests/purs/passing/NewtypeWithRecordUpdate.purs view
@@ -0,0 +1,16 @@+-- https://github.com/purescript/purescript/issues/812.0++module Main where++import Prelude+import Effect.Console++newtype NewType a = NewType (Record a)++rec1 :: Record (a :: Number, b :: Number, c:: Number)+rec1 = { a: 0.0, b: 0.0, c: 0.0 }++rec2 :: NewType (a :: Number, b :: Number, c :: Number)+rec2 = NewType (rec1 { a = 1.0 })++main = log "Done"
+ tests/purs/passing/NonConflictingExports.purs view
@@ -0,0 +1,10 @@+-- No failure here as the export `thing` only refers to Main.thing+module Main (thing, main) where++import A+import Effect.Console (log)++thing :: Int+thing = 2++main = log "Done"
+ tests/purs/passing/NonConflictingExports/A.purs view
@@ -0,0 +1,4 @@+module A where++thing :: Int+thing = 1
+ tests/purs/passing/NonOrphanInstanceFunDepExtra.purs view
@@ -0,0 +1,8 @@+-- Both f and l must be known, thus can be in separate modules+module Main where+import Effect.Console (log)+import Lib+data F+data R+instance cflr :: C F L R+main = log "Done"
+ tests/purs/passing/NonOrphanInstanceFunDepExtra/Lib.purs view
@@ -0,0 +1,4 @@+module Lib where+-- covering sets: {{f, l}}+class C f l r | l -> r+data L
+ tests/purs/passing/NonOrphanInstanceMulti.purs view
@@ -0,0 +1,7 @@+-- Both l and r must be known, thus can be in separate modules+module Main where+import Effect.Console (log)+import Lib+data L+instance clr :: C L R+main = log "Done"
+ tests/purs/passing/NonOrphanInstanceMulti/Lib.purs view
@@ -0,0 +1,4 @@+module Lib where+-- covering sets: {{l, r}}+class C l r+data R
+ tests/purs/passing/NumberLiterals.purs view
@@ -0,0 +1,39 @@+module Main where++-- See issue #2115.++import Prelude+import Test.Assert (assert')+import Effect.Console (log)++main = do+ test "0.17" 0.17+ test "0.25996181067141905" 0.25996181067141905+ test "0.3572019862807257" 0.3572019862807257+ test "0.46817723004874223" 0.46817723004874223+ test "0.9640035681058178" 0.9640035681058178+ test "4.23808622486133" 4.23808622486133+ test "4.540362294799751" 4.540362294799751+ test "5.212384849884261" 5.212384849884261+ test "13.958257048123212" 13.958257048123212+ test "32.96176575630599" 32.96176575630599+ test "38.47735512322269" 38.47735512322269++ test "10000000000.0" 1e10+ test "10000000000.0" 1.0e10+ test "0.00001" 1e-5+ test "0.00001" 1.0e-5+ test "1.5339794352098402e-118" 1.5339794352098402e-118+ test "2.108934760892056e-59" 2.108934760892056e-59+ test "2.250634744599241e-19" 2.250634744599241e-19+ test "5.960464477539063e-8" 5.960464477539063e-8+ test "5e-324" 5e-324+ test "5e-324" 5.0e-324++ log "Done"++test str num =+ if (show num == str)+ then pure unit+ else flip assert' false $+ "Expected " <> show str <> ", got " <> show (show num) <> "."
+ tests/purs/passing/ObjectGetter.purs view
@@ -0,0 +1,14 @@+module Main where++import Prelude+import Effect.Console (log, logShow)++getX = _.x++point = { x: 1.0, y: 0.0 }++main = do+ logShow $ getX point+ log $ _." 123 string Prop Name " { " 123 string Prop Name ": "OK" }+ log $ (_.x >>> _.y) { x: { y: "Nested" } }+ log $ _.value { value: "Done" }
+ tests/purs/passing/ObjectSynonym.purs view
@@ -0,0 +1,16 @@+module Main where++import Prelude+import Effect.Console (log)++type Inner = Number++inner :: Inner+inner = 0.0++type Outer = { inner :: Inner }++outer :: Outer+outer = { inner: inner }++main = log "Done"
+ tests/purs/passing/ObjectUpdate.purs view
@@ -0,0 +1,23 @@+module Main where++import Prelude+import Effect.Console (log)++update1 = \o -> o { foo = "Foo" }++update2 :: forall r. { foo :: String | r } -> { foo :: String | r }+update2 = \o -> o { foo = "Foo" }++replace = \o -> case o of+ { foo: "Foo" } -> o { foo = "Bar" }+ { foo: "Bar" } -> o { bar = "Baz" }+ o -> o++polyUpdate :: forall a r. { foo :: a | r } -> { foo :: String | r }+polyUpdate = \o -> o { foo = "Foo" }++inferPolyUpdate = \o -> o { foo = "Foo" }++main = do+ log ((update1 {foo: ""}).foo)+ log "Done"
+ tests/purs/passing/ObjectUpdate2.purs view
@@ -0,0 +1,18 @@+module Main where++import Prelude+import Effect.Console (log)++type X r = { | r }++x :: X (baz :: String)+x = { baz: "baz" }++blah :: forall r. X r -> X r+blah x = x++test = blah x+ { baz = "blah"+ }++main = log "Done"
+ tests/purs/passing/ObjectUpdater.purs view
@@ -0,0 +1,26 @@+module Main where++import Prelude+import Effect+import Effect.Console+import Test.Assert++getValue :: Effect Boolean+getValue = pure true++main = do+ let record = { value: false }+ record' <- record { value = _ } <$> getValue+ assert $ record'.value == true++ let point = { x: 1.0, y: 1.0 }+ x = 10.0+ point' = (point { x = _, y = x }) 100.0++ assert $ point'.x == 100.0+ assert $ point'.y == 10.0++ let record2 = (_ { x = _ }) { x: 0.0 } 10.0+ assert $ record2.x == 10.0++ log "Done"
+ tests/purs/passing/ObjectWildcards.purs view
@@ -0,0 +1,20 @@+module Main where++import Prelude+import Effect+import Effect.Console+import Test.Assert++mkRecord = { foo: _, bar: _, baz: "baz" }++getValue :: Effect Boolean+getValue = pure true++main = do+ obj <- { value: _ } <$> getValue+ logShow obj.value+ let x = 1.0+ point <- { x: _, y: x } <$> pure 2.0+ assert $ point.x == 2.0+ assert $ point.y == 1.0+ log (mkRecord 1.0 "Done").bar
+ tests/purs/passing/Objects.purs view
@@ -0,0 +1,36 @@+module Main where++import Prelude hiding (append)+import Effect.Console (log)++test = \x -> x.foo + x.bar + 1.0++append = \o -> { foo: o.foo, bar: 1.0 }++apTest = append({foo : "Foo", baz: "Baz"})++f = (\a -> a.b.c) { b: { c: 1.0, d: "Hello" }, e: "World" }++g = (\a -> a.f { x: 1.0, y: "y" }) { f: \o -> o.x + 1.0 }++typed :: { foo :: Number }+typed = { foo: 0.0 }++test2 = \x -> x."!@#"++test3 = typed."foo"++test4 = test2 weirdObj+ where+ weirdObj :: { "!@#" :: Number }+ weirdObj = { "!@#": 1.0 }++test5 = case { "***": 1.0 } of+ { "***": n } -> n++test6 = case { "***": 1.0 } of+ { "***": n } -> n++test7 {a: snoog , b : blah } = blah++main = log "Done"
+ tests/purs/passing/OneConstructor.purs view
@@ -0,0 +1,10 @@+module Main where++import Prelude+import Effect.Console (log)++data One a = One a++one' (One a) = a++main = log "Done"
+ tests/purs/passing/OperatorAlias.purs view
@@ -0,0 +1,11 @@+module Main where++import Prelude+import Effect.Console++infixl 4 what as ?!++what :: forall a b. a -> b -> a+what a _ = a++main = log $ "Done" ?! true
+ tests/purs/passing/OperatorAliasElsewhere.purs view
@@ -0,0 +1,9 @@+module Main where++import Prelude+import Def (what)+import Effect.Console++infixl 4 what as ?!++main = log $ "Done" ?! true
+ tests/purs/passing/OperatorAliasElsewhere/Def.purs view
@@ -0,0 +1,4 @@+module Def where++what :: forall a b. a -> b -> a+what a _ = a
+ tests/purs/passing/OperatorAssociativity.purs view
@@ -0,0 +1,25 @@+module Main where++import Prelude+import Effect+import Effect.Console+import Test.Assert++bug :: Number -> Number -> Number+bug a b = 0.0 - (a - b)++main = do+ assert (bug 0.0 2.0 == 2.0)+ assert (0.0 - (0.0 - 2.0) == 2.0)+ assert (0.0 - (0.0 + 2.0) == -2.0)+ assert (6.0 / (3.0 * 2.0) == 1.0)+ assert ((6.0 / 3.0) * 2.0 == 4.0)+ assert (not (1.0 < 0.0) == true)+ assert (not ((negate 1.0) < 0.0) == false)+ assert (negate (1.0 + 10.0) == -11.0)+ assert (2.0 * 3.0 / 4.0 == 1.5)+ assert (1.0 * 2.0 * 3.0 * 4.0 * 5.0 / 6.0 == 20.0)+ assert (1.0 + 10.0 - 5.0 == 6.0)+ assert (1.0 + 10.0 * 5.0 == 51.0)+ assert (10.0 * 5.0 - 1.0 == 49.0)+ log "Done"
+ tests/purs/passing/OperatorInlining.purs view
@@ -0,0 +1,48 @@+module Main where++import Prelude+import Effect.Console (logShow, log)++main = do++ -- semiringNumber+ logShow (1.0 + 2.0)+ logShow (1.0 * 2.0)++ -- ringNumber+ logShow (1.0 - 2.0)+ logShow (negate 1.0)++ -- moduleSemiringNumber+ logShow (1.0 / 2.0)++ -- ordNumber+ logShow (1.0 > 2.0)+ logShow (1.0 < 2.0)+ logShow (1.0 <= 2.0)+ logShow (1.0 >= 2.0)+ logShow (1.0 == 2.0)++ -- eqNumber+ logShow (1.0 == 2.0)+ logShow (1.0 /= 2.0)++ -- eqString+ logShow ("foo" == "bar")+ logShow ("foo" /= "bar")++ -- eqBoolean+ logShow (true == false)+ logShow (true /= false)++ -- semigroupString+ logShow ("foo" <> "bar")++ -- latticeBoolean+ logShow (top && true)+ logShow (bottom || false)++ -- complementedLatticeBoolean+ logShow (not true)++ log "Done"
+ tests/purs/passing/OperatorSections.purs view
@@ -0,0 +1,20 @@+module Main where++import Prelude+import Effect.Console (log)+import Test.Assert++main = do+ assert $ (_ / 2.0) 4.0 == 2.0+ assert $ (2.0 / _) 4.0 == 0.5+ assert $ (_ `const` 1.0) 2.0 == 2.0+ assert $ (1.0 `const` _) 2.0 == 1.0+ let foo = { x: 2.0 }+ assert $ (_ / foo.x) 4.0 == 2.0+ assert $ (foo.x / _) 4.0 == 0.5+ let div x y = x.x / y.x+ assert $ (_ `div` foo { x = 4.0 }) { x: 4.0 } == 1.0+ assert $ (foo { x = 4.0 } `div` _) { x: 4.0 } == 1.0+ assert $ (_ + 2 * 3) 1 == 7+ assert $ (3 * 2 + _) 1 == 7+ log "Done"
+ tests/purs/passing/Operators.purs view
@@ -0,0 +1,91 @@+module Main where++import Prelude+import Other (foo)+import Other as Other+import Effect+import Effect.Console++op1 :: forall a. a -> a -> a+op1 x _ = x++infix 4 op1 as ?!++test1 :: forall n. Semiring n => n -> n -> (n -> n -> n) -> n+test1 x y z = x * y + z x y++test2 = (\x -> x.foo false) { foo : \_ -> 1.0 }++test3 = (\x y -> x)(1.0 + 2.0 * (1.0 + 2.0)) (true && (false || false))++k = \x -> \y -> x++test4 = 1 `k` 2++op2 :: Number -> Number -> Number+op2 x y = x * y + y++infixl 5 op2 as %%++test5 = 1.0 %% 2.0 %% 3.0++test6 = ((\x -> x) `k` 2.0) 3.0++op3 :: String -> String -> String+op3 = \s1 s2 -> s1 <> s2++infix 4 op3 as <+>++test7 = "Hello" <+> "World!"++op4 :: forall a b. (a -> b) -> a -> b+op4 = \f x -> f x++infix 4 op4 as @@++test8 = foo @@ "Hello World"++test9 = Other.foo @@ "Hello World"++test10 = "Hello" `Other.baz` "World"++op5 :: forall a. Array a -> Array a -> Array a+op5 = \as -> \bs -> as++infix 4 op5 as ...++test11 = [1.0, 2.0, 0.0] ... [4.0, 5.0, 6.0]++test14 :: Number -> Number -> Boolean+test14 a b = a < b++test15 :: Number -> Number -> Boolean+test15 a b = const false $ a `test14` b++test17 :: Number+test17 = negate (-1.0)++test18 :: Number+test18 = negate $ negate 1.0++test19 :: Number+test19 = negate $ negate (-1.0)++main = do+ let t1 = test1 1.0 2.0 (\x y -> x + y)+ let t2 = test2+ let t3 = test3+ let t4 = test4+ let t5 = test5+ let t6 = test6+ let t7 = test7+ let t8 = test8+ let t9 = test9+ let t10 = test10+ let t11 = test11+ let t14 = test14 1.0 2.0+ let t15 = test15 1.0 2.0+ let t17 = test17+ let t18 = test18+ let t19 = test19+ log "Done"
+ tests/purs/passing/Operators/Other.purs view
@@ -0,0 +1,7 @@+module Other where++foo :: String -> String+foo s = s++baz :: String -> String -> String+baz s _ = s
+ tests/purs/passing/OptimizerBug.purs view
@@ -0,0 +1,10 @@+module Main where++import Prelude+import Effect.Console (log)++x a = 1.0 + y a++y a = x a++main = log "Done"
+ tests/purs/passing/OptionalQualified.purs view
@@ -0,0 +1,12 @@+module Main where++import Prelude as P++-- qualified import without the "qualified" keyword+import Effect.Console as Console++bind = P.bind++main = do+ message <- P.pure "Done"+ Console.log message
+ tests/purs/passing/Ord1Deriving.purs view
@@ -0,0 +1,16 @@+module Main where++import Prelude+import Data.Eq (class Eq1)+import Data.Ord (class Ord1)+import Effect.Console (log)++data Product a b = Product a b++derive instance eqMu :: (Eq a, Eq b) => Eq (Product a b)+derive instance eq1Mu :: Eq a => Eq1 (Product a)++derive instance ordMu :: (Ord a, Ord b) => Ord (Product a b)+derive instance ord1Mu :: Ord a => Ord1 (Product a)++main = log "Done"
+ tests/purs/passing/Ord1InOrdDeriving.purs view
@@ -0,0 +1,13 @@+module Main where++import Prelude+import Data.Eq (class Eq1)+import Data.Ord (class Ord1)+import Effect.Console (log)++newtype Mu f = In (f (Mu f))++derive instance eqMu :: Eq1 f => Eq (Mu f)+derive instance ordMu :: Ord1 f => Ord (Mu f)++main = log "Done"
+ tests/purs/passing/ParensInType.purs view
@@ -0,0 +1,14 @@+module Main where++import Prelude+import Effect (Effect)+import Effect.Console (log)++class Foo a where+ foo :: (String -> a ((Unit)))++instance fooLogEff :: Foo Effect where+ foo = log++main :: Effect Unit+main = foo "Done"
+ tests/purs/passing/ParensInTypedBinder.purs view
@@ -0,0 +1,14 @@+module Main where++import Prelude+import Effect (Effect)+import Effect.Console (log)++foo :: Array Int+foo = do+ xss :: Array (Array Int) <- [[[1,2,3], [4, 5]], [[6]]]+ xs :: Array Int <- xss+ xs++main :: Effect Unit+main = log "Done"
+ tests/purs/passing/ParseTypeInt.purs view
@@ -0,0 +1,28 @@+module Main where++import Effect.Console (log)++data Proxy :: forall k. k -> Type+data Proxy n = Proxy++a :: Proxy 42+a = Proxy++b :: Proxy (-42)+b = Proxy++c :: Proxy (42 :: Int)+c = Proxy++d :: Proxy ((42) :: Int)+d = Proxy++e :: Proxy ((-42) :: Int)+e = Proxy++f :: Proxy (-+ -- here's a comment+ 1)+f = Proxy++main = log "Done"
+ tests/purs/passing/PartialFunction.purs view
@@ -0,0 +1,11 @@+module Main where++import Prelude+import Effect+import Effect.Console++fn :: Partial => Number -> Number+fn 0.0 = 0.0+fn 1.0 = 2.0++main = log "Done"
+ tests/purs/passing/PartialTCO.purs view
@@ -0,0 +1,13 @@+module Main where++import Prelude+import Effect.Console (log)+import Partial.Unsafe (unsafePartial)++main = do+ let _ = unsafePartial partialTCO true 1000000+ log "Done"++partialTCO :: Partial => Boolean -> Int -> Int+partialTCO true 0 = 0+partialTCO true n = partialTCO true (n - 1)
+ tests/purs/passing/Patterns.purs view
@@ -0,0 +1,23 @@+module Main where++import Prelude+import Effect.Console (log)++test = \x -> case x of+ { str: "Foo", bool: true } -> true+ { str: "Bar", bool: b } -> b+ _ -> false++f = \o -> case o of+ { foo: "Foo" } -> o.bar+ _ -> 0++h = \o -> case o of+ a@[_,_,_] -> a+ _ -> []++isDesc :: Array Number -> Boolean+isDesc [x, y] | x > y = true+isDesc _ = false++main = log "Done"
+ tests/purs/passing/PendingConflictingImports.purs view
@@ -0,0 +1,8 @@+module Main where++-- No error as we never force `thing` to be resolved in `Main`+import A+import B+import Effect.Console (log)++main = log "Done"
+ tests/purs/passing/PendingConflictingImports/A.purs view
@@ -0,0 +1,4 @@+module A where++thing :: Int+thing = 1
+ tests/purs/passing/PendingConflictingImports/B.purs view
@@ -0,0 +1,4 @@+module B where++thing :: Int+thing = 2
+ tests/purs/passing/PendingConflictingImports2.purs view
@@ -0,0 +1,10 @@+module Main where++import A+import Effect.Console (log)++-- No error as we never force `thing` to be resolved in `Main`+thing :: Int+thing = 2++main = log "Done"
+ tests/purs/passing/PendingConflictingImports2/A.purs view
@@ -0,0 +1,4 @@+module A where++thing :: Int+thing = 1
+ tests/purs/passing/Person.purs view
@@ -0,0 +1,12 @@+module Main where++import Prelude+import Effect.Console (log)++data Person = Person { name :: String, age :: Number }++showPerson :: Person -> String+showPerson = \p -> case p of+ Person o -> o.name <> ", aged " <> show o.age++main = log "Done"
+ tests/purs/passing/PolyLabels.js view
@@ -0,0 +1,15 @@+export var unsafeGet = function (s) {+ return function (o) {+ return o[s];+ };+};++export var unsafeSet = function (s) {+ return function(a) {+ return function (o) {+ var o1 = {};+ o1[s] = a;+ return Object.assign({}, o, o1);+ };+ };+};
+ tests/purs/passing/PolyLabels.purs view
@@ -0,0 +1,67 @@+module Main where++import Prelude+import Prim.Row+import Effect+import Effect.Console+import Data.Symbol (class IsSymbol, reflectSymbol)+import Type.Proxy (Proxy(..))++foreign import unsafeGet+ :: forall r a+ . String+ -> Record r+ -> a++foreign import unsafeSet+ :: forall r1 r2 a+ . String+ -> a+ -> Record r1+ -> Record r2++get+ :: forall r r' l a+ . IsSymbol l+ => Cons l a r' r+ => Proxy l+ -> Record r+ -> a+get l = unsafeGet (reflectSymbol l)++set+ :: forall r1 r2 r l a b+ . IsSymbol l+ => Cons l a r r1+ => Cons l b r r2+ => Proxy l+ -> b+ -> Record r1+ -> Record r2+set l = unsafeSet (reflectSymbol l)++lens + :: forall l f r1 r2 r a b+ . IsSymbol l+ => Cons l a r r1+ => Cons l b r r2+ => Functor f+ => Proxy l+ -> (a -> f b)+ -> Record r1+ -> f (Record r2)+lens l f r = flip (set l) r <$> f (get l r)++getFoo :: forall a r. { foo :: a | r } -> a+getFoo = get (Proxy :: Proxy "foo")++setFoo :: forall a b r. b -> { foo :: a | r } -> { foo :: b | r }+setFoo = set (Proxy :: Proxy "foo")++fooLens :: forall f a b r. Functor f => (a -> f b) -> { foo :: a | r } -> f { foo :: b | r } +fooLens = lens (Proxy :: Proxy "foo")++main :: Effect Unit+main = do+ _ <- fooLens logShow { foo: 1 }+ log (getFoo (setFoo "Done" { foo: 1 }))
+ tests/purs/passing/PolykindBindingGroup1.purs view
@@ -0,0 +1,13 @@+module Main where++import Effect.Console (log)++data X a = X (Y a) | Z+data Y a = Y (X a)++test1 = X (Y Z) :: X Int+test2 = X (Y Z) :: X "foo"+test3 = Y (X (Y Z)) :: Y Int+test4 = Y (X (Y Z)) :: Y "foo"++main = log "Done"
+ tests/purs/passing/PolykindBindingGroup2.purs view
@@ -0,0 +1,16 @@+module Main where++import Effect.Console (log)++data Proxy a = Proxy++data X a = X (Y a => Proxy a)++class Z (X a) <= Y a++class Z a++test1 = X (Proxy :: _ Int)+test2 = X (Proxy :: _ "foo")++main = log "Done"
+ tests/purs/passing/PolykindGeneralization.purs view
@@ -0,0 +1,15 @@+module Main where++import Effect.Console (log)++data Proxy a = Proxy+data F f a = F (f a)++fproxy :: forall f a. Proxy f -> Proxy a -> Proxy (F f a)+fproxy _ _ = Proxy++a = fproxy (Proxy :: _ Proxy)+b = a (Proxy :: _ Int)+c = a (Proxy :: _ "foo")++main = log "Done"
+ tests/purs/passing/PolykindGeneralizationHygiene.purs view
@@ -0,0 +1,11 @@+module Main where++import Effect.Console (log)++-- First argument needs to be `k`.+type F k t = forall proxy. proxy k -> t++test :: F Symbol Int+test _ = 42++main = log "Done"
+ tests/purs/passing/PolykindGeneralizedTypeSynonym.purs view
@@ -0,0 +1,12 @@+module Main where++import Effect.Console (log)++data Proxy a = Proxy++type Prozy = Proxy++test1 = Proxy :: Prozy Int+test2 = Proxy :: Prozy "foo"++main = log "Done"
+ tests/purs/passing/PolykindInstanceDispatch.purs view
@@ -0,0 +1,21 @@+module Main where++import Prelude+import Effect.Console (log)+import Test.Assert++data Proxy a = Proxy++class ShowP a where+ showP :: a -> String++instance test1 :: ShowP (Proxy ((a) :: Type)) where+ showP _ = "Type"++instance test2 :: ShowP (Proxy ((a) :: Symbol)) where+ showP _ = "Symbol"++main = do+ assert (showP (Proxy :: _ Int) == "Type")+ assert (showP (Proxy :: _ "foo") == "Symbol")+ log "Done"
+ tests/purs/passing/PolykindInstantiatedInstance.purs view
@@ -0,0 +1,22 @@+module Main where++import Effect.Console (log)++data Proxy a = Proxy++class F f where+ f :: forall a b. (a -> b) -> f a -> f b++instance fProxy :: F Proxy where+ f _ _ = Proxy++test1 :: forall a. Proxy a+test1 = f (\a -> a) Proxy++test2 :: Proxy Int+test2 = f (\a -> a) (Proxy :: Proxy Int)++test3 :: Proxy String+test3 = f (\a -> "foo") Proxy++main = log "Done"
+ tests/purs/passing/PolykindInstantiation.purs view
@@ -0,0 +1,17 @@+module Main where++import Effect.Console (log)++data Proxy a = Proxy+data F f a = F (f a)++test1 = Proxy :: Proxy Int+test2 = Proxy :: Proxy "foo"+test3 = Proxy :: Proxy Proxy+test4 = Proxy :: Proxy F+test5 = Proxy :: Proxy (F Proxy)+test6 = Proxy :: Proxy (F (F Proxy))+test7 = Proxy :: Proxy (F Proxy Int)+test8 = Proxy :: Proxy (F Proxy "foo")++main = log "Done"
+ tests/purs/passing/PolykindRowCons.purs view
@@ -0,0 +1,51 @@+module Main where++import Effect.Console (log)+import Prim.Row++data Proxy a = Proxy+data Identity a = Identity a+data App f a = App (f a)++type RowType =+ ( a :: Int+ , b :: String+ , c :: Boolean+ )++type RowTypeType =+ ( a :: Proxy+ , b :: Identity+ , c :: App Identity+ )++type RowSymbol =+ ( a :: "a"+ , b :: "b"+ , c :: "c"+ )++lookup :: forall sym v rx r. Cons sym v rx r => Proxy sym -> Proxy r -> Proxy v+lookup _ _ = Proxy++lookup1 = lookup (Proxy :: _ "a") (Proxy :: _ RowType)+lookup2 = lookup (Proxy :: _ "b") (Proxy :: _ RowType)+lookup3 = lookup (Proxy :: _ "c") (Proxy :: _ RowType)+lookup4 = lookup (Proxy :: _ "a") (Proxy :: _ RowTypeType)+lookup5 = lookup (Proxy :: _ "b") (Proxy :: _ RowTypeType)+lookup6 = lookup (Proxy :: _ "c") (Proxy :: _ RowTypeType)+lookup7 = lookup (Proxy :: _ "a") (Proxy :: _ RowSymbol)+lookup8 = lookup (Proxy :: _ "b") (Proxy :: _ RowSymbol)+lookup9 = lookup (Proxy :: _ "c") (Proxy :: _ RowSymbol)++test1 = lookup1 :: Proxy Int+test2 = lookup2 :: Proxy String+test3 = lookup3 :: Proxy Boolean+test4 = lookup4 :: Proxy Proxy+test5 = lookup5 :: Proxy Identity+test6 = lookup6 :: Proxy (App Identity)+test7 = lookup7 :: Proxy "a"+test8 = lookup8 :: Proxy "b"+test9 = lookup9 :: Proxy "c"++main = log "Done"
+ tests/purs/passing/PrimedTypeName.purs view
@@ -0,0 +1,20 @@+module Main (T, T', T'', T''', main) where++import Prelude+import Effect.Console (log)++data T a = T+type T' = T Unit++data T'' = TP++foreign import data T''' ∷ Type++instance eqT ∷ Eq T'' where+ eq _ _ = true++type A' a b = b → a++infixr 4 type A' as ↫++main = log "Done"
+ tests/purs/passing/QualifiedAdo.purs view
@@ -0,0 +1,19 @@+module Main where++import Prelude+import Effect.Console (log)+import IxApplicative as Ix++testIApplicative :: forall f a. Ix.IxApplicative f => f a a String+testIApplicative = Ix.ado+ a <- Ix.pure "test"+ b <- Ix.pure "test"+ in (a <> b)++testApplicative :: forall f. Applicative f => f String+testApplicative = ado+ a <- pure "test"+ b <- pure "test"+ in (a <> b)++main = log "Done"
+ tests/purs/passing/QualifiedAdo/IxApplicative.purs view
@@ -0,0 +1,8 @@+module IxApplicative where++class IxFunctor f where+ map ∷ forall a b x y. (a -> b) -> f x y a -> f x y b++class IxFunctor f <= IxApplicative f where+ pure ∷ forall a x y. a -> f x y a+ apply ∷ forall a b x y z. f x y (a -> b) -> f y z a -> f x z b
+ tests/purs/passing/QualifiedDo.purs view
@@ -0,0 +1,19 @@+module Main where++import Prelude+import Effect.Console (log)+import IxMonad as Ix++testIMonad :: forall m a. Ix.IxMonad m => m a a String+testIMonad = Ix.do+ a <- Ix.pure "test"+ b <- Ix.pure "test"+ Ix.pure (a <> b)++testMonad :: forall m. Monad m => m String+testMonad = do+ a <- pure "test"+ b <- pure "test"+ pure (a <> b)++main = log "Done"
+ tests/purs/passing/QualifiedDo/IxMonad.purs view
@@ -0,0 +1,5 @@+module IxMonad where++class IxMonad m where+ pure ∷ forall a x y. a -> m x y a+ bind ∷ forall a b x y z. m x y a -> (a -> m y z b) -> m x z b
+ tests/purs/passing/QualifiedNames.purs view
@@ -0,0 +1,11 @@+module Main where++import Prelude+import Either as Either+import Effect.Console (log)++either :: forall a b c. (a -> c) -> (b -> c) -> Either.Either a b -> c+either f _ (Either.Left x) = f x+either _ g (Either.Right y) = g y++main = log (either identity identity (Either.Left "Done"))
+ tests/purs/passing/QualifiedNames/Either.purs view
@@ -0,0 +1,5 @@+module Either where++import Prelude++data Either a b = Left a | Right b
+ tests/purs/passing/QualifiedOperators.purs view
@@ -0,0 +1,13 @@+module Main where++import Prelude++import Effect.Console (log)+import Test.Assert (assert)++import Foo as Foo.Bar++main = do+ assert $ 4 Foo.Bar.-#- 10 == 33+ assert $ Foo.Bar.(-#-) 4 10 == 33+ log "Done"
+ tests/purs/passing/QualifiedOperators/Foo.purs view
@@ -0,0 +1,8 @@+module Foo where++import Prelude++tie :: Int -> Int -> Int+tie a b = (a - 1) * (b + 1)++infix 5 tie as -#-
+ tests/purs/passing/QualifiedQualifiedImports.purs view
@@ -0,0 +1,6 @@+module Main where++-- qualified import with qualified imported names+import Effect.Console (log) as Console++main = Console.log "Done"
+ tests/purs/passing/QuantifiedKind.purs view
@@ -0,0 +1,10 @@+module Main where++import Effect.Console (log)++data Proxy a = Proxy++test :: forall k (a :: k). Proxy a+test = Proxy++main = log "Done"
+ tests/purs/passing/Rank2Data.purs view
@@ -0,0 +1,30 @@+module Main where++import Prelude hiding (add)+import Effect.Console (log)++data Id = Id (forall a. a -> a)++runId = \id a -> case id of+ Id f -> f a++data Nat = Nat (forall r. r -> (r -> r) -> r)++runNat = \nat -> case nat of+ Nat f -> f 0.0 (\n -> n + 1.0)++zero' = Nat (\zero' _ -> zero')++succ = \n -> case n of+ Nat f -> Nat (\zero' succ -> succ (f zero' succ))++add = \n m -> case n of+ Nat f -> case m of+ Nat g -> Nat (\zero' succ -> g (f zero' succ) succ)++one' = succ zero'+two = succ zero'+four = add two two+fourNumber = runNat four++main = log "Done"
+ tests/purs/passing/Rank2Kinds.purs view
@@ -0,0 +1,21 @@+module Main where++import Effect.Console (log)++data A (a :: forall k. k -> Type) = A++data B :: (forall k. k -> Type) -> Type+data B a = B++data Pair a b = Pair+data Proxy a = Proxy++type Id a = a+type MkP (f :: forall k. k -> k) = Pair (f Int) (f "foo")++k :: forall a b. Proxy (Pair Int "foo") -> Int+k _ = 42++test = k (Proxy :: Proxy (MkP Id))++main = log "Done"
+ tests/purs/passing/Rank2Object.purs view
@@ -0,0 +1,11 @@+module Main where++import Prelude+import Effect.Console++data Foo = Foo { id :: forall a. a -> a }++foo :: Foo -> Number+foo (Foo { id: f }) = f 0.0++main = log "Done"
+ tests/purs/passing/Rank2TypeSynonym.purs view
@@ -0,0 +1,17 @@+module Main where++import Prelude+import Effect.Console (log, logShow)++type Foo a = forall f. Monad f => f a++foo :: forall a. a -> Foo a+foo x = pure x++bar :: Foo Number+bar = foo 3.0++main = do+ x <- bar+ logShow x+ log "Done"
+ tests/purs/passing/Rank2Types.purs view
@@ -0,0 +1,12 @@+module Main where++import Prelude+import Effect.Console (log)++test1 :: (forall a. (a -> a)) -> Number+test1 = \f -> f 0.0++forever :: forall m a b. (forall a b. m a -> (a -> m b) -> m b) -> m a -> m b+forever = \bind action -> bind action $ \_ -> forever bind action++main = log "Done"
+ tests/purs/passing/ReExportQualified.purs view
@@ -0,0 +1,7 @@+module Main where++import Prelude+import C+import Effect.Console (log)++main = log (x <> y)
+ tests/purs/passing/ReExportQualified/A.purs view
@@ -0,0 +1,3 @@+module A where++x = "Do"
+ tests/purs/passing/ReExportQualified/B.purs view
@@ -0,0 +1,3 @@+module B where++y = "ne"
+ tests/purs/passing/ReExportQualified/C.purs view
@@ -0,0 +1,4 @@+module C (module A, module M2) where++import A+import B as M2
+ tests/purs/passing/ReExportsExported.js view
@@ -0,0 +1,2 @@+// Import `A.a` which was re-exported from `B` and then again from `C`+export { a } from '../C/index.js';
+ tests/purs/passing/ReExportsExported.purs view
@@ -0,0 +1,7 @@+module Main where++import Effect.Console (log)++foreign import a :: String++main = log a
+ tests/purs/passing/ReExportsExported/A.purs view
@@ -0,0 +1,4 @@+module A (a) where++a :: String+a = "Done"
+ tests/purs/passing/ReExportsExported/B.purs view
@@ -0,0 +1,7 @@+module B (module A, A(..)) where++import A++-- | Test that there's no name collision between the imported module `A` and the+-- | data constructor `A`.+data A = A
+ tests/purs/passing/ReExportsExported/C.purs view
@@ -0,0 +1,4 @@+module C (module B) where++-- | `A.a` was re-exported from `B` and then again from `C`+import B
+ tests/purs/passing/RebindableSyntax.purs view
@@ -0,0 +1,43 @@+module Main where++import Prelude+import Effect.Console (log)++example1 :: String+example1 = do+ "Do"+ " notation"+ " for"+ " Semigroup"+ where+ discard x f = x <> f unit++applySecond :: forall f a b. Apply f => f a -> f b -> f b+applySecond fa fb = const identity <$> fa <*> fb++infixl 4 applySecond as *>++newtype Const a b = Const a++runConst :: forall a b. Const a b -> a+runConst (Const a) = a++instance functorConst :: Functor (Const a) where+ map _ (Const a) = Const a++instance applyConst :: Semigroup a => Apply (Const a) where+ apply (Const a1) (Const a2) = Const (a1 <> a2)++example2 :: Const String Unit+example2 = do+ Const "Do"+ Const " notation"+ Const " for"+ Const " Apply"+ where+ discard x f = x *> f unit++main = do+ log example1+ log $ runConst example2+ log "Done"
+ tests/purs/passing/Recursion.purs view
@@ -0,0 +1,11 @@+module Main where++import Prelude+import Effect.Console (log)++fib = \n -> case n of+ 0.0 -> 1.0+ 1.0 -> 1.0+ n -> fib (n - 1.0) + fib (n - 2.0)++main = log "Done"
+ tests/purs/passing/RedefinedFixity.purs view
@@ -0,0 +1,6 @@+module Main where++import M3+import Effect.Console (log)++main = log "Done"
+ tests/purs/passing/RedefinedFixity/M1.purs view
@@ -0,0 +1,6 @@+module M1 where++applyFn :: forall a b. (forall c d. c -> d) -> a -> b+applyFn f a = f a++infixr 1000 applyFn as $
+ tests/purs/passing/RedefinedFixity/M2.purs view
@@ -0,0 +1,3 @@+module M2 where++import M1
+ tests/purs/passing/RedefinedFixity/M3.purs view
@@ -0,0 +1,4 @@+module M3 where++import M1+import M2
+ tests/purs/passing/ReservedWords.purs view
@@ -0,0 +1,19 @@+-- See https://github.com/purescript/purescript/issues/606+module Main where++import Prelude+import Effect+import Effect.Console (log)++o :: { type :: String }+o = { type: "o" }++p :: { type :: String }+p = o { type = "p" }++f :: forall r. { type :: String | r } -> String+f { type: "p" } = "Done"+f _ = "Fail"++main :: Effect _+main = log $ f { type: p.type, foo: "bar" }
+ tests/purs/passing/ResolvableScopeConflict.purs view
@@ -0,0 +1,13 @@+module Main where++import A (thing)+import B+import Effect.Console (log)++-- Not an error as although we have `thing` in scope from both A and B, it is+-- imported explicitly from A, giving it a resolvable solution.+what :: Boolean -> Int+what true = thing+what false = zing++main = log "Done"
+ tests/purs/passing/ResolvableScopeConflict/A.purs view
@@ -0,0 +1,4 @@+module A where++thing :: Int+thing = 1
+ tests/purs/passing/ResolvableScopeConflict/B.purs view
@@ -0,0 +1,7 @@+module B where++thing :: Int+thing = 2++zing :: Int+zing = 3
+ tests/purs/passing/ResolvableScopeConflict2.purs view
@@ -0,0 +1,15 @@+module Main where++import A+import Effect.Console (log)++thing :: Int+thing = 1++-- Not an error as although we have `thing` in scope from both Main and A,+-- as the local declaration takes precedence over the implicit import+what :: Boolean -> Int+what true = thing+what false = zing++main = log "Done"
+ tests/purs/passing/ResolvableScopeConflict2/A.purs view
@@ -0,0 +1,7 @@+module A where++thing :: Int+thing = 2++zing :: Int+zing = 3
+ tests/purs/passing/ResolvableScopeConflict3.purs view
@@ -0,0 +1,9 @@+module Main (thing, main, module A) where++import A+import Effect.Console (log)++thing :: Int+thing = 2++main = log "Done"
+ tests/purs/passing/ResolvableScopeConflict3/A.purs view
@@ -0,0 +1,4 @@+module A where++thing :: Int+thing = 1
+ tests/purs/passing/RowConstructors.purs view
@@ -0,0 +1,43 @@+module Main where++import Prelude+import Effect.Console (log)++type Foo = (x :: Number | (y :: Number | (z :: Number)))+type Bar = (x :: Number, y :: Number, z :: Number)+type Baz = { w :: Number | Bar }++foo :: { | Foo }+foo = { x: 0.0, y: 0.0, z: 0.0 }++bar :: { | Bar }+bar = { x: 0.0, y: 0.0, z: 0.0 }++id' :: Record Foo -> Record Bar+id' = identity++foo' :: { | Foo }+foo' = id' foo++bar' :: { | Bar }+bar' = id' bar++baz :: Baz+baz = { x: 0.0, y: 0.0, z: 0.0, w: 0.0 }++type Quux r = (q :: Number | r)+type Norf r = (q' :: Number | Quux r)++quux :: { f :: { | Foo } | Quux Bar }+quux = { f: foo', x: 0.0, y: 0.0, z: 0.0, q: 0.0 }++quux' :: { | Norf Bar }+quux' = { x: 0.0, y: 0.0, z: 0.0, q: 0.0, q': 0.0 }++wildcard :: { w :: Number | _ } -> Baz+wildcard { w: w } = { x: w, y: w, z: w, w: w }++wildcard' :: { | Quux _ } -> Number+wildcard' { q: q } = q++main = log "Done"
+ tests/purs/passing/RowInInstanceHeadDetermined.purs view
@@ -0,0 +1,40 @@+module Main where++import Prelude+import Effect.Console (log)++data Empty = Empty+data Cons = Cons+++-- simple case+class Simple a b | a -> b where c :: a -> b+instance simple0 :: Simple Empty {} where c _ = {}+instance simple1 :: Simple Cons {foo :: Cons} where c cons = {foo: cons}+++-- simple transitive example+class Transitive a b c | a -> b, b -> c where d :: a -> c+instance transitive :: Transitive Empty {} {} where d _ = {}+++-- transitive example with cycles+class Cyclic a b c d | a -> b, b -> a+ , a -> c+ , c -> d, d -> c+instance cyclic :: Cyclic Empty Empty {} {}+++-- Determined cycle+class DeterminedCycle a b c | a -> b+ , b -> c, c -> b+instance determinedCycle :: DeterminedCycle Empty {} {}+++-- multiple determiners+class MultipleDeterminers a b c d | a b -> c d+instance multipleDeterminers :: MultipleDeterminers Empty Empty {} {}+++main = log "Done"+
+ tests/purs/passing/RowLacks.purs view
@@ -0,0 +1,33 @@+module Main where++import Effect.Console (log)+import Prim.Row (class Lacks)+import Type.Proxy (Proxy(..))++lacksX+ :: forall r+ . Lacks "x" r+ => Proxy r+ -> Proxy ()+lacksX _ = Proxy++lacksSym+ :: forall sym (to :: Row Type)+ . Lacks sym to+ => Proxy sym+ -> Proxy to+lacksSym _ = Proxy++test1 :: Proxy ()+test1 = lacksX (Proxy :: Proxy (y :: Int, z :: String))++test2 :: forall r. Lacks "x" r => Proxy r -> Proxy ()+test2 _ = lacksX (Proxy :: Proxy (y :: Int, z :: String | r))++test3 :: Proxy ()+test3 = test2 (Proxy :: Proxy (a :: String))++test4 :: forall sym. Proxy sym -> Proxy ()+test4 = lacksSym++main = log "Done"
+ tests/purs/passing/RowNub.purs view
@@ -0,0 +1,23 @@+module Main where++import Effect.Console (log)+import Prim.Row (class Nub, class Union)+import Type.Proxy (Proxy(..))++nubUnion+ :: forall r1 r2 r3 r4+ . Union r1 r2 r3+ => Nub r3 r4+ => Proxy r1+ -> Proxy r2+ -> Proxy r4+nubUnion _ _ = Proxy++type InL = (x :: Int, y :: String)+type InR = (x :: String, y :: Int, z :: Boolean)+type Out = (x :: Int, y :: String, z :: Boolean)++test :: Proxy Out+test = nubUnion (Proxy :: Proxy InL) (Proxy :: Proxy InR)++main = log "Done"
+ tests/purs/passing/RowPolyInstanceContext.purs view
@@ -0,0 +1,23 @@+module Main where++import Prelude+import Effect.Console (log)++class T s m | m -> s where+ state :: (s -> s) -> m Unit++data S s a = S (s -> { new :: s, ret :: a })++instance st :: T s (S s) where+ state f = S $ \s -> { new: f s, ret: unit }++test1 :: forall r . S { foo :: String | r } Unit+test1 = state $ \o -> o { foo = o.foo <> "!" }++test2 :: forall m r . T { foo :: String | r } m => m Unit+test2 = state $ \o -> o { foo = o.foo <> "!" }++main = do+ let t1 = test1+ let t2 = test2+ log "Done"
+ tests/purs/passing/RowUnion.js view
@@ -0,0 +1,6 @@+export var mergeImpl = function (l) {+ return function (r) {+ var o = {};+ return Object.assign(o, r, l);+ };+};
+ tests/purs/passing/RowUnion.purs view
@@ -0,0 +1,90 @@+module Main where++import Prelude+import Prim.Row+import Effect+import Effect.Console++data Proxy a = Proxy++solve :: forall l r u. Union l r u => Proxy r -> Proxy u -> Proxy l+solve _ _ = Proxy++solveUnionBackwardsNil :: Proxy _+solveUnionBackwardsNil = solve (Proxy :: Proxy ()) (Proxy :: Proxy ())++solveUnionBackwardsCons :: Proxy _+solveUnionBackwardsCons = solve (Proxy :: Proxy ( a :: Int )) (Proxy :: Proxy ( a :: Int, b :: String ))++solveUnionBackwardsDblCons :: Proxy _+solveUnionBackwardsDblCons = solve (Proxy :: Proxy ( a :: Int, a :: String )) (Proxy :: Proxy ( a :: Boolean, a :: Int, a :: String ))++merge+ :: forall r1 r2 r3+ . Union r1 r2 r3+ => Record r1+ -> Record r2+ -> Record r3+merge = mergeImpl++foreign import mergeImpl+ :: forall r1 r2 r3+ . Record r1+ -> Record r2+ -> Record r3++test1 = merge { x: 1 } { y: true }++test2 = merge { x: 1 } { x: true }++mergeWithExtras+ :: forall r1 r2 r3+ . Union r1 (y :: Boolean | r2) (y :: Boolean | r3)+ => { x :: Int | r1 }+ -> { y :: Boolean | r2 }+ -> { x :: Int, y :: Boolean | r3}+mergeWithExtras = merge++test3 x = merge { x: 1 } x+test3' x = merge x { x: 1 }++type Mandatory r = (x :: Int | r)+type Optional r = (x :: Int, y :: Int, z :: Int | r)++withDefaults+ :: forall r s+ . Union r (y :: Int, z :: Int) (y :: Int, z :: Int | s)+ => Record (Mandatory r)+ -> Record (Optional s)+withDefaults p = merge p { y: 1, z: 1 }++withDefaultsClosed+ :: forall r s+ . Union r (y :: Int, z :: Int) (y :: Int, z :: Int | s)+ => Subrow s (y :: Int, z :: Int)+ => Record (Mandatory r)+ -> Record (Optional s)+withDefaultsClosed p = merge p { y: 1, z: 1 }++test4 = withDefaults { x: 1, y: 2 }++-- r is a subrow of s if Union r t s for some t.+class Subrow (r :: Row Type) (s :: Row Type)+instance subrow :: Union r t s => Subrow r s++main :: Effect Unit+main = do+ logShow test1.x+ logShow test1.y+ logShow (test1.x == 1)+ logShow (mergeWithExtras { x: 1 } { x: 0, y: true, z: 42.0 }).x+ logShow (withDefaults { x: 1 }).x+ logShow (withDefaults { x: 1 }).y+ logShow (withDefaults { x: 1 }).z+ logShow (withDefaults { x: 1, y: 2 }).x+ logShow (withDefaults { x: 1, y: 2 }).y+ logShow (withDefaults { x: 1, y: 2 }).z+ logShow (withDefaultsClosed { x: 1, y: 2 }).x+ logShow (withDefaultsClosed { x: 1, y: 2 }).y+ logShow (withDefaultsClosed { x: 1, y: 2 }).z+ log "Done"
+ tests/purs/passing/RowsInInstanceContext.purs view
@@ -0,0 +1,28 @@+module Main where++import Prelude+import Effect (Effect)+import Effect.Console (log)++class TypeEquals a b | a -> b, b -> a where+ coerce :: a -> b+ coerceBack :: b -> a++instance refl :: TypeEquals a a where+ coerce = identity+ coerceBack = identity++newtype RecordNewtype = RecordNewtype { x :: String }++class OldStyleNewtype t a where+ wrap :: a -> t+ unwrap :: t -> a++instance newtypeRecordNewtype ::+ TypeEquals inner { x :: String }+ => OldStyleNewtype RecordNewtype inner where+ wrap = RecordNewtype <<< coerce+ unwrap (RecordNewtype rec) = coerceBack rec++main :: Effect Unit+main = log (unwrap (RecordNewtype { x: "Done" })).x
+ tests/purs/passing/RowsInKinds.purs view
@@ -0,0 +1,15 @@+module Main where++import Effect.Console (log)++foreign import data R :: forall k. Row k -> Type+foreign import data X :: forall r. R (x :: Type | r)+foreign import data Y :: forall r. R (y :: Type | r)++data P :: R (x :: Type, y :: Type) -> Type+data P a = P++type Test1 = P X+type Test2 = P Y++main = log "Done"
+ tests/purs/passing/RowsInKinds2.purs view
@@ -0,0 +1,11 @@+module Main where++import Effect.Console (log)++foreign import data R :: forall k. Row k -> Type+foreign import data X :: R ()++data P :: R () -> Type+data P a = P++main = log "Done"
+ tests/purs/passing/RunFnInline.purs view
@@ -0,0 +1,11 @@+module Main where++import Prelude++import Effect.Console (log)++runFn3 :: forall a b c d. (a -> b -> c -> d) -> a -> b -> c -> d+runFn3 f a b c = f a b c++main = do+ log $ runFn3 (\a b c -> c) 1 2 "Done"
+ tests/purs/passing/RuntimeScopeIssue.purs view
@@ -0,0 +1,22 @@+module Main where++import Prelude+import Effect.Console (log, logShow)++class A a where+ a :: a -> Boolean++class B a where+ b :: a -> Boolean++instance aNumber :: A Number where+ a 0.0 = true+ a n = b (n - 1.0)++instance bNumber :: B Number where+ b 0.0 = false+ b n = a (n - 1.0)++main = do+ logShow $ a 10.0+ log "Done"
+ tests/purs/passing/ScopedTypeVariables.purs view
@@ -0,0 +1,37 @@+module Main where++import Prelude+import Effect.Console (log)++test1 :: forall a. (a -> a) -> a -> a+test1 f x = g (g x)+ where+ g :: a -> a+ g y = f (f y)++test2 :: forall a. (a -> a) -> a -> a+test2 = h+ where+ h :: forall b. (b -> b) -> b -> b+ h f x = g (g x)+ where+ g :: b -> b+ g y = f (f y)++test3 :: Number+test3 = ((\b -> b :: b) :: forall b. b -> b) 0.0++test4 :: forall a. (a -> a) -> a -> a+test4 = h+ where+ h :: forall b. (b -> b) -> b -> b+ h f x = g (g x)+ where+ g :: b -> b+ g y = j (f (f y))+ where+ j :: forall b. b -> b+ j x = x+++main = log "Done"
+ tests/purs/passing/Sequence.purs view
@@ -0,0 +1,16 @@+module Main where++import Prelude+import Effect+import Effect.Console (log)++data List a = Cons a (List a) | Nil++class Sequence t where+ sequence :: forall m a. Monad m => t (m a) -> m (t a)++instance sequenceList :: Sequence List where+ sequence Nil = pure Nil+ sequence (Cons x xs) = Cons <$> x <*> sequence xs++main = sequence $ Cons (log "Done") Nil
+ tests/purs/passing/SequenceDesugared.purs view
@@ -0,0 +1,38 @@+module Main where++import Prelude+import Effect+import Effect.Console (log)++data List a = Cons a (List a) | Nil++data Sequence t = Sequence (forall m a. Monad m => t (m a) -> m (t a))++sequence :: forall t. Sequence t -> (forall m a. Monad m => t (m a) -> m (t a))+sequence (Sequence s) = s++sequenceListSeq :: forall m a. Monad m => List (m a) -> m (List a)+sequenceListSeq Nil = pure Nil+sequenceListSeq (Cons x xs) = Cons <$> x <*> sequenceListSeq xs++sequenceList :: Sequence List+sequenceList = Sequence (sequenceListSeq)++sequenceList' :: Sequence List+sequenceList' = Sequence ((\val -> case val of+ Nil -> pure Nil+ Cons x xs -> Cons <$> x <*> sequence sequenceList' xs))++sequenceList'' :: Sequence List+sequenceList'' = Sequence (sequenceListSeq :: forall m a. Monad m => List (m a) -> m (List a))++sequenceList''' :: Sequence List+sequenceList''' = Sequence ((\val -> case val of+ Nil -> pure Nil+ Cons x xs -> Cons <$> x <*> sequence sequenceList''' xs) :: forall m a. Monad m => List (m a) -> m (List a))++main = do+ void $ sequence sequenceList $ Cons (log "Done") Nil+ void $ sequence sequenceList' $ Cons (log "Done") Nil+ void $ sequence sequenceList'' $ Cons (log "Done") Nil+ void $ sequence sequenceList''' $ Cons (log "Done") Nil
+ tests/purs/passing/ShadowedModuleName.purs view
@@ -0,0 +1,8 @@+module Main where++import Test+import Effect.Console++data Test = Test++main = log (runZ (Z "Done"))
+ tests/purs/passing/ShadowedModuleName/Test.purs view
@@ -0,0 +1,6 @@+module Test where++data Z = Z String++runZ :: Z -> String+runZ (Z s) = s
+ tests/purs/passing/ShadowedName.purs view
@@ -0,0 +1,11 @@+module Main where++import Prelude+import Effect.Console+import Effect.Console (log)++done :: String+done = let str = "Not yet done" in+ let str = "Done" in str++main = log done
+ tests/purs/passing/ShadowedRename.purs view
@@ -0,0 +1,14 @@+module Main where++import Prelude+import Effect+import Effect.Console+import Test.Assert++foo foo = let foo_1 = \_ -> foo+ foo_2 = foo_1 unit + 1.0+ in foo_2++main = do+ assert $ foo 1.0 == 2.0+ log "Done"
+ tests/purs/passing/ShadowedTCO.purs view
@@ -0,0 +1,21 @@+module Main where++import Prelude hiding (add)+import Effect.Console (log)++runNat f = f 0.0 (\n -> n + 1.0)++zero' z _ = z++succ f zero' succ = succ (f zero' succ)++add f g zero' succ = g (f zero' succ) succ++one' = succ zero'+two = succ one'+four = add two two+fourNumber = runNat four++main = do+ log $ show fourNumber+ log "Done"
+ tests/purs/passing/ShadowedTCOLet.purs view
@@ -0,0 +1,15 @@+module Main where++import Prelude+import Partial.Unsafe (unsafePartial)+import Effect+import Effect.Console (log)++f x y z =+ let f 1.0 2.0 3.0 = 1.0+ in f x z y++main :: Effect _+main = do+ log $ show $ unsafePartial f 1.0 3.0 2.0+ log "Done"
+ tests/purs/passing/SignedNumericLiterals.purs view
@@ -0,0 +1,18 @@+module Main where++import Prelude+import Effect.Console (log)++p = 0.5+q = 1.0+x = -1.0+y = -0.5+z = 0.5+w = 1.0++f :: Number -> Number+f x = -x++test1 = 2.0 - 1.0++main = log "Done"
+ tests/purs/passing/SingleInstanceFundep.purs view
@@ -0,0 +1,21 @@+module Main where++import Prelude+import Effect.Console (log)+import Type.Proxy (Proxy(..))++-- This class can only have a single instance due to the functional dependency+class SingleInstanceFundep (r :: Row Type) | -> r where+ unified :: Proxy r++-- The row literal is valid in this instance head since it is fully determined+instance SingleInstanceFundep ( x :: Unit ) where+ unified = Proxy++-- This should infer `test :: Proxy ( x :: Unit )` by committing to the instance+test :: Proxy _+test = unified++main = do+ let (Proxy :: Proxy ( x :: Unit )) = test+ log "Done"
+ tests/purs/passing/SolvingAddInt.purs view
@@ -0,0 +1,26 @@+module Main where++import Effect.Console (log)+import Prim.Int (class Add)++data Proxy k = Proxy++a :: forall n. Add 21 21 n => Proxy n+a = Proxy++a' :: Proxy 42+a' = a++b :: forall n. Add 21 n 42 => Proxy n+b = Proxy++b' :: Proxy 21+b' = b++c :: forall n. Add n 21 42 => Proxy n+c = Proxy++c' :: Proxy 21+c' = c++main = log "Done"
+ tests/purs/passing/SolvingAppendSymbol.purs view
@@ -0,0 +1,34 @@+module Main where++import Prelude+import Effect.Console (log)+import Prim.Symbol (class Append)+import Type.Proxy (Proxy(..))+import Type.Data.Symbol (append, reflectSymbol) as Symbol++sym :: Proxy ""+sym = Proxy++symA :: Proxy "A"+symA = Proxy++symB :: Proxy "B"+symB = Proxy++egAB :: Proxy "AB"+egAB = Symbol.append symA symB++egBA :: Proxy "BA"+egBA = Symbol.append symB symA++egA' :: Proxy "A"+egA' = Symbol.append sym (Symbol.append symA sym)++main = do+ let gotAB = Symbol.reflectSymbol egAB == "AB"+ gotBA = Symbol.reflectSymbol egBA == "BA"+ gotA' = Symbol.reflectSymbol egA' == "A"+ when (not gotAB) $ log "Did not get AB"+ when (not gotBA) $ log "Did not get BA"+ when (not gotA') $ log "Did not get A"+ when (gotAB && gotBA && gotA') $ log "Done"
+ tests/purs/passing/SolvingCompareInt.purs view
@@ -0,0 +1,106 @@+module Main where++import Effect.Console (log)+import Prim.Int (class Compare)+import Prim.Ordering (EQ, GT, LT)++data Proxy :: forall k. k -> Type+data Proxy n = Proxy++assertLesser :: forall l r. Compare l r LT => Proxy ( left :: l, right :: r )+assertLesser = Proxy++assertGreater :: forall l r. Compare l r GT => Proxy ( left :: l, right :: r )+assertGreater = Proxy++assertEqual :: forall l r. Compare l r EQ => Proxy ( left :: l, right :: r )+assertEqual = Proxy++symmLt :: forall m n. Compare m n GT => Proxy ( left :: n, right :: m )+symmLt = assertLesser++symmGt :: forall m n. Compare m n LT => Proxy ( left :: n, right :: m )+symmGt = assertGreater++symmEq :: forall m n. Compare m n EQ => Proxy ( left :: n, right :: m )+symmEq = assertEqual++reflEq :: forall (n :: Int). Proxy ( left :: n, right :: n )+reflEq = assertEqual++transLt :: forall m n p. Compare m n LT => Compare n p LT => Proxy n -> Proxy ( left :: m, right :: p )+transLt _ = assertLesser++transLtEq :: forall m n p. Compare m n LT => Compare n p EQ => Proxy n -> Proxy ( left :: m, right :: p )+transLtEq _ = assertLesser++transEqLt :: forall m n p. Compare m n EQ => Compare n p LT => Proxy n -> Proxy ( left :: m, right :: p )+transEqLt _ = assertLesser++transGt :: forall m n p. Compare m n GT => Compare n p GT => Proxy n -> Proxy ( left :: m, right :: p )+transGt _ = assertGreater++transGtEq :: forall m n p. Compare m n GT => Compare n p EQ => Proxy n -> Proxy ( left :: m, right :: p )+transGtEq _ = assertGreater++transEqGt :: forall m n p. Compare m n EQ => Compare n p GT => Proxy n -> Proxy ( left :: m, right :: p )+transEqGt _ = assertGreater++transEq :: forall m n p. Compare m n EQ => Compare n p EQ => Proxy n -> Proxy ( left :: m, right :: p )+transEq _ = assertEqual++transSymmLt :: forall m n p. Compare n m GT => Compare n p LT => Proxy n -> Proxy ( left :: m, right :: p )+transSymmLt _ = assertLesser++transSymmLtEq :: forall m n p. Compare n m GT => Compare n p EQ => Proxy n -> Proxy ( left :: m, right :: p )+transSymmLtEq _ = assertLesser++transSymmEqLt :: forall m n p. Compare n m EQ => Compare n p LT => Proxy n -> Proxy ( left :: m, right :: p )+transSymmEqLt _ = assertLesser++transSymmGt :: forall m n p. Compare n m LT => Compare n p GT => Proxy n -> Proxy ( left :: m, right :: p )+transSymmGt _ = assertGreater++transSymmGtEq :: forall m n p. Compare n m LT => Compare n p EQ => Proxy n -> Proxy ( left :: m, right :: p )+transSymmGtEq _ = assertGreater++transSymmEqGt :: forall m n p. Compare n m EQ => Compare n p GT => Proxy n -> Proxy ( left :: m, right :: p )+transSymmEqGt _ = assertGreater++transSymmEq :: forall m n p. Compare n m EQ => Compare n p EQ => Proxy n -> Proxy ( left :: m, right :: p )+transSymmEq _ = assertEqual++litLt :: Proxy ( left :: 0, right :: 1 )+litLt = assertLesser++litGt :: Proxy ( left :: 1, right :: 0 )+litGt = assertGreater++litEq :: Proxy ( left :: 0, right :: 0 )+litEq = assertEqual++class AssertIsGT o where+ assertIsGT :: Proxy o -> Boolean++instance AssertIsGT GT where+ assertIsGT _ = true++infer :: forall l r o. Compare l r o => AssertIsGT o => Proxy l -> Proxy r -> Boolean+infer _ _ = assertIsGT (Proxy :: _ o)++inferSolved :: forall m n p. Compare m n GT => Compare n p GT => Proxy m -> Proxy n -> Proxy p -> Boolean+inferSolved m _ p = infer m p++litTransLT :: forall a. Compare a 10 LT => Proxy ( left :: a, right :: 20 )+litTransLT = assertLesser++litTransGT :: forall a. Compare a 10 GT => Proxy ( left :: a, right :: 0 )+litTransGT = assertGreater++litTransRange :: forall a o. Compare a 10 LT => Compare 0 a LT => Proxy ( left :: a, right :: 20 )+litTransRange = assertLesser++withFacts :: forall l r o. Compare l 10 LT => Compare r 20 GT => Proxy ( left :: l, right :: r )+withFacts = assertLesser++main = log "Done"
+ tests/purs/passing/SolvingCompareSymbol.purs view
@@ -0,0 +1,33 @@+module Main where++import Prelude+import Effect.Console (log)+import Prim.Symbol (class Compare)+import Prim.Ordering (Ordering, LT, EQ, GT)+import Type.Proxy (Proxy(..))+import Type.Data.Symbol (compare) as Symbol+import Type.Data.Ordering (reflectOrdering)++symA :: Proxy "A"+symA = Proxy++symB :: Proxy "B"+symB = Proxy++egLT :: Proxy LT+egLT = Symbol.compare symA symB++egEQ :: Proxy EQ+egEQ = Symbol.compare symA symA++egGT :: Proxy GT+egGT = Symbol.compare symB symA++main = do+ let gotLT = reflectOrdering egLT == LT+ gotEQ = reflectOrdering egEQ == EQ+ gotGT = reflectOrdering egGT == GT+ when (not gotLT) $ log "Did not get LT"+ when (not gotEQ) $ log "Did not get EQ"+ when (not gotGT) $ log "Did not get GT"+ when (gotLT && gotEQ && gotGT) $ log "Done"
+ tests/purs/passing/SolvingIsSymbol.purs view
@@ -0,0 +1,13 @@+module Main where++import Prelude+import Effect+import Effect.Console++-- Here we import as alias of reflectSymbol without importing Data.Symbol. However,+-- Data.Symbol should be implicitly imported as we have an instance of IsSymbol solved.+import SolvingIsSymbol.Lib (literalSymbol, libReflectSymbol)++main = do+ let lit = libReflectSymbol literalSymbol+ when (lit == "literal") (log "Done")
+ tests/purs/passing/SolvingIsSymbol/Lib.purs view
@@ -0,0 +1,11 @@+module SolvingIsSymbol.Lib where++import Data.Symbol+import Type.Proxy (Proxy(..))++literalSymbol :: Proxy "literal"+literalSymbol = Proxy++libReflectSymbol :: forall s. IsSymbol s => Proxy s -> String+libReflectSymbol = reflectSymbol+
+ tests/purs/passing/SolvingMulInt.purs view
@@ -0,0 +1,14 @@+module Main where++import Effect.Console (log)+import Prim.Int (class Mul)++data Proxy k = Proxy++a :: forall n. Mul 4 4 n => Proxy n+a = Proxy++a' :: Proxy 16+a' = a++main = log "Done"
+ tests/purs/passing/SolvingReflectable.purs view
@@ -0,0 +1,50 @@+module Main where++import Prelude++import Data.Ordering (Ordering(..))+import Data.Reflectable (reflectType)+import Effect.Console (log)+import Prim.Boolean (True, False)+import Prim.Ordering (LT, EQ, GT)+import Type.Proxy (Proxy(..))++refInt :: Proxy 42+refInt = Proxy++refIntPass :: Boolean+refIntPass = reflectType refInt == 42++refString :: Proxy "PureScript"+refString = Proxy++refStringPass :: Boolean+refStringPass = reflectType refString == "PureScript"++refBooleanT :: Proxy True+refBooleanT = Proxy++refBooleanF :: Proxy False+refBooleanF = Proxy++refBooleanPass :: Boolean+refBooleanPass = reflectType refBooleanT == true && reflectType refBooleanF == false++refOrderingLT :: Proxy LT+refOrderingLT = Proxy++refOrderingEQ :: Proxy EQ+refOrderingEQ = Proxy++refOrderingGT :: Proxy GT+refOrderingGT = Proxy++refOrderingPass :: Boolean+refOrderingPass =+ reflectType refOrderingLT == LT+ && reflectType refOrderingEQ == EQ+ && reflectType refOrderingGT == GT++main = do+ when (refIntPass && refStringPass && refBooleanPass && refOrderingPass) $+ log "Done"
+ tests/purs/passing/StandaloneKindSignatures.purs view
@@ -0,0 +1,27 @@+module Main where++import Effect.Console (log)++data Pair :: forall k. k -> k -> Type+data Pair a b = Pair++newtype Pair' :: forall k. k -> k -> Type+newtype Pair' a b = Pair' (Pair a b)++type Fst :: forall k. k -> k -> k+type Fst a b = a++class To :: forall k. k -> k -> Constraint+class To a b | a -> b++test1 = Pair :: Pair Int String+test2 = Pair :: Pair "foo" "bar"+test3 = Pair' Pair :: Pair' Int String+test4 = Pair' Pair :: Pair' "foo" "bar"+test5 = 42 :: Fst Int String+test6 = Pair :: Pair (Fst "foo" "bar") "baz"++instance to1 :: To Int String+instance to2 :: To "foo" "bar"++main = log "Done"
+ tests/purs/passing/Stream.purs view
@@ -0,0 +1,26 @@+module Main where++import Prelude++import Effect (Effect)+import Effect.Console (log)++class IsStream el s | s -> el where+ cons :: el -> (Unit -> s) -> s+ uncons :: s -> { head :: el, tail :: s }++data Stream a = Stream a (Unit -> Stream a)++instance streamIsStream :: IsStream a (Stream a) where+ cons x xs = Stream x xs+ uncons (Stream x f) = { head: x, tail: f unit }++test :: forall el s. IsStream el s => s -> s+test s = case uncons s of+ { head, tail } -> cons head \_ -> tail++main :: Effect Unit+main = do+ let dones :: Stream String+ dones = cons "Done" \_ -> dones+ log (uncons (test dones)).head
+ tests/purs/passing/StringEdgeCases.purs view
@@ -0,0 +1,9 @@+module Main where++import Prelude+import Records as Records+import Symbols as Symbols++main = do+ Records.main+ Symbols.main
+ tests/purs/passing/StringEdgeCases/Records.purs view
@@ -0,0 +1,39 @@+module Records where++import Prelude+import Effect.Console (log)+import Test.Assert (assert')++newtype AstralKeys = AstralKeys { "💡" :: Int, "💢" :: Int }+newtype LoneSurrogateKeys = LoneSurrogateKeys { "\xdf06" :: Int, "\xd834" :: Int }++testLoneSurrogateKeys =+ let+ expected = 5+ actual = (_."\xd801" <<< helper) { "\xd800": 5 }+ in+ assert' ("lone surrogate keys: " <> show actual) (expected == actual)++ where+ helper :: { "\xd800" :: Int } -> { "\xd801" :: Int }+ helper o =+ case o."\xd800" of+ x -> { "\xd801": x }++testAstralKeys =+ let+ expected = 5+ actual = (_."💢" <<< helper) { "💡": 5 }+ in+ assert' ("astral keys: " <> show actual) (expected == actual)++ where+ helper :: { "💡" :: Int } -> { "💢" :: Int }+ helper o =+ case o."💡" of+ x -> { "💢": x }++main = do+ testLoneSurrogateKeys+ testAstralKeys+ log "Done"
+ tests/purs/passing/StringEdgeCases/Symbols.purs view
@@ -0,0 +1,33 @@+-- This is similar to StringEscapes except we are performing the same tests+-- with Symbols (at the type level).++module Symbols where++import Prelude+import Effect.Console (log)+import Prim.Symbol (class Append)+import Type.Data.Symbol (reflectSymbol)+import Type.Data.Symbol (append) as Symbol+import Test.Assert (assert')+import Type.Proxy (Proxy(..))++highS :: Proxy "\xd834"+highS = Proxy++lowS :: Proxy "\xdf06"+lowS = Proxy++loneSurrogates :: Boolean+loneSurrogates = reflectSymbol (Symbol.append highS lowS) == "\x1d306"++outOfOrderSurrogates :: Boolean+outOfOrderSurrogates = reflectSymbol (Symbol.append lowS highS) == "\xdf06\xd834"++notReplacing :: Boolean+notReplacing = reflectSymbol lowS /= "\xfffd"++main = do+ assert' "lone surrogates may be combined into a surrogate pair" loneSurrogates+ assert' "lone surrogates may be combined out of order to remain lone surrogates" outOfOrderSurrogates+ assert' "lone surrogates are not replaced with the Unicode replacement character U+FFFD" notReplacing+ log "Done"
+ tests/purs/passing/StringEscapes.purs view
@@ -0,0 +1,24 @@+module Main where++import Prelude ((==), (/=), (<>), discard)+import Test.Assert (assert, assert')+import Effect.Console (log)++singleCharacter = "\t\n\r\"\\" == "\x9\xA\xD\x22\x5C"+hex = "\x1D306\x2603\x3C6\xE0" == "𝌆☃φà"+surrogatePair = "\xD834\xDF06" == "\x1D306"+highSurrogate = "\xD834"+lowSurrogate = "\xDF06"+loneSurrogates = (highSurrogate <> lowSurrogate) == "\x1D306"+outOfOrderSurrogates = (lowSurrogate <> highSurrogate) == "\xDF06\xD834"+replacement = "\xFFFD"+notReplacing = replacement /= highSurrogate++main = do+ assert' "single-character escape sequences" singleCharacter+ assert' "hex escape sequences" hex+ assert' "astral code points are represented as a UTF-16 surrogate pair" surrogatePair+ assert' "lone surrogates may be combined into a surrogate pair" loneSurrogates+ assert' "lone surrogates may be combined out of order to remain lone surrogates" outOfOrderSurrogates+ assert' "lone surrogates are not replaced with the Unicode replacement character U+FFFD" notReplacing+ log "Done"
+ tests/purs/passing/Superclasses1.purs view
@@ -0,0 +1,23 @@+module Main where++import Prelude+import Effect.Console (log, logShow)++class Su a where+ su :: a -> a++class (Su a) <= Cl a where+ cl :: a -> a -> a++instance suNumber :: Su Number where+ su n = n + 1.0++instance clNumber :: Cl Number where+ cl n m = n + m++test :: forall a. Cl a => a -> a+test a = su (cl a a)++main = do+ logShow $ test 10.0+ log "Done"
+ tests/purs/passing/Superclasses3.purs view
@@ -0,0 +1,41 @@+module Main where++import Prelude+import Effect.Console+import Effect++class Monad m <= MonadWriter w m where+ tell :: w -> m Unit++testFunctor :: forall m. Monad m => m Number -> m Number+testFunctor n = (+) 1.0 <$> n++test :: forall w m. Monad m => MonadWriter w m => w -> m Unit+test w = do+ tell w+ tell w+ tell w++data MTrace a = MTrace (Effect a)++runMTrace :: forall a. MTrace a -> Effect a+runMTrace (MTrace a) = a++instance functorMTrace :: Functor MTrace where+ map = liftM1++instance applyMTrace :: Apply MTrace where+ apply = ap++instance applicativeMTrace :: Applicative MTrace where+ pure = MTrace <<< pure++instance bindMTrace :: Bind MTrace where+ bind m f = MTrace (runMTrace m >>= (runMTrace <<< f))++instance monadMTrace :: Monad MTrace++instance writerMTrace :: MonadWriter String MTrace where+ tell s = MTrace (log s)++main = runMTrace $ test "Done"
+ tests/purs/passing/TCO.purs view
@@ -0,0 +1,28 @@+module Main where++import Prelude+import Effect.Console (log, logShow)+import Control.Monad.Rec.Class+import Data.Array ((..), span, length)++main = do+ let f x = x + 1+ let v = 0+ logShow (applyN 0 f v)+ logShow (applyN 1 f v)+ logShow (applyN 2 f v)+ logShow (applyN 3 f v)+ logShow (applyN 4 f v)++ let largeArray = 1..10000+ logShow (length (span (\_ -> true) largeArray).init)++ logShow (tailRec (\n -> if n < 10000 then Loop (n + 1) else Done 42) 0)++ log "Done"++applyN :: forall a. Int -> (a -> a) -> a -> a+applyN = go identity+ where+ go f n _ | n <= 0 = f+ go f n g = go (f >>> g) (n - 1) g
+ tests/purs/passing/TCOCase.purs view
@@ -0,0 +1,13 @@+module Main where++import Prelude+import Effect.Console (log)++data Data = One | More Data++main = log (from (to 10000.0 One))+ where+ to 0.0 a = a+ to n a = to (n - 1.0) (More a)+ from One = "Done"+ from (More d) = from d
+ tests/purs/passing/TCOFloated.purs view
@@ -0,0 +1,11 @@+module Main where++import Prelude+import Effect.Console (log)++main = log (looper { foo: 100000 })++-- The Ord instance for { foo :: Int } will be floated to an outer scope. This+-- test verifies that TCO happens anyway.+looper :: { foo :: Int } -> String+looper x = if x <= { foo: 0 } then "Done" else looper { foo: x.foo - 1 }
+ tests/purs/passing/TCOMutRec.purs view
@@ -0,0 +1,95 @@+module Main where++import Prelude+import Effect (Effect)+import Effect.Console (log)+import Test.Assert (assertEqual, assertThrows)++tco1 :: Int -> Int+tco1 = f 0+ where+ f x y = g (x + 2) (y - 1)+ where+ g x' y' = if y' <= 0 then x' else f x' y'++tco2 :: Int -> Int+tco2 = f 0+ where+ f x y = g (x + 2) (y - 1)+ where+ g x' y' = h (y' <= 0) x' y'+ h test x' y' = if test then x' else f x' y'++tco3 :: Int -> Int+tco3 y0 = f 0 y0+ where+ f x y = g x (h y)+ where+ g x' y' =+ if y' <= 0 then x'+ else if y' > y0 / 2 then g (j x') (y' - 1)+ else f (x' + 2) y'+ h y = y - 1+ j x = x + 3++tco4 :: Int -> Int+tco4 = f 0+ where+ f x y = if y <= 0 then x else g (y - 1)+ where+ g y' = f (x + 2) y'++-- The following examples are functions which are prevented from being TCO'd+-- because the arity of the function being looped does not match the function+-- call. In theory, these could be made to optimize via eta-expansion in the+-- future, in which case the assertions can change.++ntco1 :: Int -> Int+ntco1 y0 = f 0 y0+ where+ f x = if x > 10 * y0 then (x + _) else g x+ where+ g x' y' = f (x' + 10) (y' - 1)++ntco2 :: Int -> Int+ntco2 = f 0+ where+ f x y = if y <= 0 then x else g x (y - 1)+ where+ g x' = f (x' + 2)++ntco3 :: Int -> Int+ntco3 = f 0+ where+ f x y = if y <= 0 then x else g (y - 1)+ where+ g = f (x + 2)++ntco4 :: Int -> Int+ntco4 = f 0+ where+ f x y = if y <= 0 then x else g (y - 1)+ where+ g = h x+ h x' y' = f (x' + 2) y'++main :: Effect Unit+main = do+ assertEqual { expected: 200000, actual: tco1 100000 }+ assertEqual { expected: 200000, actual: tco2 100000 }+ assertEqual { expected: 249997, actual: tco3 100000 }+ assertEqual { expected: 200000, actual: tco4 100000 }++ assertEqual { expected: 1009, actual: ntco1 100 }+ assertThrows \_ -> ntco1 100000++ assertEqual { expected: 200, actual: ntco2 100 }+ assertThrows \_ -> ntco2 100000++ assertEqual { expected: 200, actual: ntco3 100 }+ assertThrows \_ -> ntco3 100000++ assertEqual { expected: 200, actual: ntco4 100 }+ assertThrows \_ -> ntco4 100000++ log "Done"
+ tests/purs/passing/TailCall.purs view
@@ -0,0 +1,20 @@+module Main where++import Prelude+import Effect.Console (log, logShow)++data L a = C a (L a) | N++test :: Number -> L Number -> Number+test n N = n+test n (C x xs) = test (n + x) xs++loop :: forall a. Number -> a+loop x = loop (x + 1.0)++notATailCall = \x ->+ (\notATailCall -> notATailCall x) (\x -> x)++main = do+ logShow (test 0.0 (1.0 `C` (2.0 `C` (3.0 `C` N))))+ log "Done"
+ tests/purs/passing/Tick.purs view
@@ -0,0 +1,8 @@+module Main where++import Prelude+import Effect.Console (log)++test' x = x++main = log "Done"
+ tests/purs/passing/TopLevelCase.purs view
@@ -0,0 +1,19 @@+module Main where++import Prelude+import Effect.Console (log)++gcd :: Number -> Number -> Number+gcd 0.0 x = x+gcd x 0.0 = x+gcd x y | x > y = gcd (x `mod` y) y+gcd x y = gcd (y `mod` x) x++guardsTest [x] | x > 0.0 = []+guardsTest xs = xs++data A = A++parseTest A 0.0 = 0.0++main = log "Done"
+ tests/purs/passing/TransitiveImport.purs view
@@ -0,0 +1,9 @@+module Main where++ import Prelude+ import Middle+ import Effect.Console++ main = do+ logShow (middle unit)+ log "Done"
+ tests/purs/passing/TransitiveImport/Middle.purs view
@@ -0,0 +1,5 @@+module Middle where++import Test (test)++middle = test
+ tests/purs/passing/TransitiveImport/Test.purs view
@@ -0,0 +1,9 @@+module Test where++import Prelude++class TestCls a where+ test :: a -> a++instance unitTestCls :: TestCls Unit where+ test _ = unit
+ tests/purs/passing/TransitiveImportUnnamedInstance.purs view
@@ -0,0 +1,9 @@+module Main where++ import Prelude+ import Middle+ import Effect.Console++ main = do+ logShow (middle unit)+ log "Done"
+ tests/purs/passing/TransitiveImportUnnamedInstance/Middle.purs view
@@ -0,0 +1,5 @@+module Middle where++import Test (test)++middle = test
+ tests/purs/passing/TransitiveImportUnnamedInstance/Test.purs view
@@ -0,0 +1,9 @@+module Test where++import Prelude++class TestCls a where+ test :: a -> a++instance TestCls Unit where+ test _ = unit
+ tests/purs/passing/TypeAnnotationPrecedence.purs view
@@ -0,0 +1,11 @@+-- See #3554+module Main where++import Prelude+import Effect (Effect)+import Effect.Console (log)+import Data.Tuple (Tuple(..), uncurry)++appendAndLog = log <<< uncurry append :: Tuple String String -> Effect Unit++main = appendAndLog (Tuple "Do" "ne")
+ tests/purs/passing/TypeClassMemberOrderChange.purs view
@@ -0,0 +1,16 @@+module Main where++import Prelude+import Effect.Console (log)++class Test a where+ fn :: a -> a -> a+ val :: a++instance testBoolean :: Test Boolean where+ val = true+ fn x y = y++main = do+ log (show (fn true val))+ log "Done"
+ tests/purs/passing/TypeClasses.purs view
@@ -0,0 +1,71 @@+module Main where++import Prelude+import Effect.Console (log)++test1 = \_ -> show "testing"++f :: forall a. Show a => a -> String+f x = show x++test2 = \_ -> f "testing"++test7 :: forall a. Show a => a -> String+test7 = show++test8 = \_ -> show $ "testing"++data Data a = Data a++instance showData :: Show a => Show (Data a) where+ show (Data a) = "Data (" <> show a <> ")"++test3 = \_ -> show (Data "testing")++instance functorData :: Functor Data where+ map = liftM1++instance applyData :: Apply Data where+ apply = ap++instance applicativeData :: Applicative Data where+ pure = Data++instance bindData :: Bind Data where+ bind (Data a) f = f a++instance monadData :: Monad Data++data Maybe a = Nothing | Just a++instance functorMaybe :: Functor Maybe where+ map = liftM1++instance applyMaybe :: Apply Maybe where+ apply = ap++instance applicativeMaybe :: Applicative Maybe where+ pure = Just++instance bindMaybe :: Bind Maybe where+ bind Nothing _ = Nothing+ bind (Just a) f = f a++instance monadMaybe :: Monad Maybe++test4 :: forall a m. Monad m => a -> m Number+test4 = \_ -> pure 1.0++test5 = \_ -> Just 1.0 >>= \n -> pure (n + 1.0)++ask r = r++runReader r f = f r++test9 _ = runReader 0.0 $ do+ n <- ask+ pure $ n + 1.0++main = do+ log (test7 "Hello")+ log "Done"
+ tests/purs/passing/TypeClassesInOrder.purs view
@@ -0,0 +1,12 @@+module Main where++import Prelude+import Effect.Console (log)++class Foo a where+ foo :: a -> String++instance fooString :: Foo String where+ foo s = s++main = log $ foo "Done"
+ tests/purs/passing/TypeClassesWithOverlappingTypeVariables.purs view
@@ -0,0 +1,12 @@+module Main where++import Prelude+import Effect.Console (log)++data Either a b = Left a | Right b++instance functorEither :: Functor (Either a) where+ map _ (Left x) = Left x+ map f (Right y) = Right (f y)++main = log "Done"
+ tests/purs/passing/TypeDecl.purs view
@@ -0,0 +1,13 @@+module Main where++import Prelude+import Effect.Console (log)++k :: String -> Number -> String+k x y = x++iterate :: forall a. Number -> (a -> a) -> a -> a+iterate 0.0 f a = a+iterate n f a = iterate (n - 1.0) f (f a)++main = log "Done"
+ tests/purs/passing/TypeOperators.purs view
@@ -0,0 +1,34 @@+module Main where++import A (type (~>), type (/\), (/\))+import Effect.Console (log)++natty ∷ ∀ f. f ~> f+natty x = x++data Compose f g a = Compose (f (g a))++testPrecedence1 ∷ ∀ f g. Compose f g ~> Compose f g+testPrecedence1 x = x++testPrecedence2 ∷ ∀ f g. f ~> g → f ~> g+testPrecedence2 nat fx = nat fx++testParens ∷ ∀ f g. (~>) f g → (~>) f g+testParens nat = nat++swap ∷ ∀ a b. a /\ b → b /\ a+swap (a /\ b) = b /\ a++foreign import data NatData ∷ ∀ f g. (f ~> g) -> f Type -> g Type++type NatKind ∷ ∀ f g. (f ~> g) -> f Type -> g Type+type NatKind k a = k a++data UseOperatorInDataParamKind (a :: Type /\ Type) = UseOperatorInDataParamKind++type UseOperatorInTypeParamKind (a :: Type /\ Type) = Int++class UseOperatorInClassParamKind (a :: Type /\ Type)++main = log "Done"
+ tests/purs/passing/TypeOperators/A.purs view
@@ -0,0 +1,22 @@+module A+( Tuple(..)+, type (/\)+, (/\)+, Natural+, type (~>)+) where++data Tuple a b = Tuple a b++infixl 6 Tuple as /\+infixl 6 type Tuple as /\++type Natural f g = ∀ a. f a → g a++infixr 0 type Natural as ~>++tup ∷ ∀ a b. a → b → b /\ a+tup a b = b /\ a++tupX ∷ ∀ a b c. a /\ b /\ c → c+tupX (a /\ b /\ c) = c
+ tests/purs/passing/TypeSynonymInData.purs view
@@ -0,0 +1,12 @@+module Main where++import Prelude+import Effect.Console (log)++type A a = Array a++data Foo a = Foo (A a) | Bar++foo (Foo []) = Bar++main = log "Done"
+ tests/purs/passing/TypeSynonymInSuperClass.purs view
@@ -0,0 +1,18 @@+module Main where++import Prelude+import Effect.Console (log)++type Env = { foo :: String }++class Monad m <= MonadAsk r m | m -> r where+ ask :: m r++class (Monad m, MonadAsk Env m) <= MonadAskEnv m++test :: forall m. MonadAskEnv m => m Boolean+test = do+ { foo } <- ask+ pure (foo == "test")++main = log "Done"
+ tests/purs/passing/TypeSynonymInstance.purs view
@@ -0,0 +1,16 @@+module Main where++import Prelude++import Effect.Console (log)++class Convert a b | a -> b where+ convert :: a -> b++type Words = String++instance convertSB :: Convert Int Words where+ convert 0 = "Nope"+ convert _ = "Done"++main = log $ convert 1
+ tests/purs/passing/TypeSynonymInstance2.purs view
@@ -0,0 +1,14 @@+module Main where++import Effect.Console (log)++data D+type S = D++class C0 a+class C0 a <= C1 a++instance c0 :: C0 D+instance c1 :: C1 S++main = log "Done"
+ tests/purs/passing/TypeSynonymInstance3.purs view
@@ -0,0 +1,23 @@+module Main where++import Effect.Console (log)++data Cons a b+infix 6 type Cons as :*++data D2+data D5+data D6+data D8++type D256 = D2 :* (D5 :* D6)++class LtEq a b++instance ltEqD8D256 :: LtEq D8 D256++class (LtEq a D256) <= Lte256 a++instance lte256 :: Lte256 D8++main = log "Done"
+ tests/purs/passing/TypeSynonymInstance4.purs view
@@ -0,0 +1,13 @@+module Main where++import Effect.Console (log)++data D+type S = D+newtype N a = N a++class C a++derive newtype instance c :: C S => C (N S)++main = log "Done"
+ tests/purs/passing/TypeSynonymInstance5.purs view
@@ -0,0 +1,13 @@+module Main where++import Effect.Console (log)++data D+type S = D+newtype N a = N a++class C a b++derive newtype instance c :: C S a => C S (N a)++main = log "Done"
+ tests/purs/passing/TypeSynonyms.purs view
@@ -0,0 +1,30 @@+module Main where++import Prelude+import Effect.Console (log)++type Lens a b =+ { get :: a -> b+ , set :: a -> b -> a+ }++composeLenses :: forall a b c. Lens a b -> Lens b c -> Lens a c+composeLenses = \l1 -> \l2 ->+ { get: \a -> l2.get (l1.get a)+ , set: \a c -> l1.set a (l2.set (l1.get a) c)+ }++type Pair a b = { fst :: a, snd :: b }++fst :: forall a b. Lens (Pair a b) a+fst =+ { get: \p -> p.fst+ , set: \p a -> { fst: a, snd: p.snd }+ }++test1 :: forall a b c. Lens (Pair (Pair a b) c) a+test1 = composeLenses fst fst++newtype N = N (Array ~> Array)++main = log "Done"
+ tests/purs/passing/TypeSynonymsInKinds.purs view
@@ -0,0 +1,25 @@+module Main where++import Effect.Console (log)++type Id a = a++data Proxy :: forall (k :: Id Type). k -> (Id Type)+data Proxy a = Proxy++data P (a :: Id Type) = P++class Test (a :: Id Type)++instance testClass1 :: Test Int+instance testClass2 :: Test (Proxy "foo")++test1 = Proxy :: Proxy Int+test2 = Proxy :: Proxy "foo"++test3 :: forall k (a :: Id k). Proxy a+test3 = Proxy++test4 = P :: P Int++main = log "Done"
+ tests/purs/passing/TypeWildcards.purs view
@@ -0,0 +1,16 @@+module Main where++import Prelude+import Effect.Console (log)++testTopLevel :: _ -> _+testTopLevel n = n + 1.0++test :: forall a. Eq a => (a -> a) -> a -> a+test f a = go (f a) a+ where+ go :: _ -> _ -> _+ go a1 a2 | a1 == a2 = a1+ go a1 _ = go (f a1) a1++main = log "Done"
+ tests/purs/passing/TypeWildcardsRecordExtension.purs view
@@ -0,0 +1,9 @@+module Main where++import Prelude+import Effect.Console (log)++foo :: forall a. {b :: Number | a} -> {b :: Number | _}+foo f = f++main = log "Done"
+ tests/purs/passing/TypeWithoutParens.purs view
@@ -0,0 +1,12 @@+module Main where++import Lib (X, Y)+import Effect.Console (log)++idX :: X -> X+idX x = x++idY :: Y -> Y+idY y = y++main = log "Done"
+ tests/purs/passing/TypeWithoutParens/Lib.purs view
@@ -0,0 +1,4 @@+module Lib (X, Y) where++data X = X+type Y = X
+ tests/purs/passing/TypedBinders.purs view
@@ -0,0 +1,68 @@+module Main where++import Prelude+import Effect.Console (log)++data Tuple a b = Tuple a b++class MonadState s m where+ get :: m s+ put :: s -> m Unit++data State s a = State (s -> Tuple s a)++runState s (State f) = f s++instance functorState :: Functor (State s) where+ map = liftM1++instance applyState :: Apply (State s) where+ apply = ap++instance applicativeState :: Applicative (State s) where+ pure a = State $ \s -> Tuple s a++instance bindState :: Bind (State s) where+ bind f g = State $ \s -> case runState s f of+ Tuple s1 a -> runState s1 (g a)++instance monadState :: Monad (State s)++instance monadStateState :: MonadState s (State s) where+ get = State (\s -> Tuple s s)+ put s = State (\_ -> Tuple s unit)++modify :: forall m s. Monad m => MonadState s m => (s -> s) -> m Unit+modify f = do+ s <- get+ put (f s)++test :: Tuple String String+test = runState "" $ do+ modify $ (<>) "World!"+ modify $ (<>) "Hello, "+ str :: String <- get+ pure str++test2 :: (Int -> Int) -> Int+test2 = (\(f :: Int -> Int) -> f 10)++test3 :: Int -> Boolean+test3 n = case n of+ (0 :: Int) -> true+ _ -> false++test4 :: Tuple Int Int -> Tuple Int Int+test4 = (\(Tuple a b :: Tuple Int Int) -> Tuple b a)++type Int1 = Int++test5 :: Int1 -> Int1+test5 = \(x :: Int1) -> x++main = do+ let t1 = test+ t2 = test2 identity+ t3 = test3 1+ t4 = test4 (Tuple 1 0)+ log "Done"
+ tests/purs/passing/TypedWhere.purs view
@@ -0,0 +1,18 @@+module Main where++import Prelude+import Effect.Console (log)++data E a b = L a | R b++data L a = C a (L a) | N++lefts :: forall a b. L (E a b) -> L a+lefts = go N+ where+ go :: forall a b. L a -> L (E a b) -> L a+ go ls N = ls+ go ls (C (L a) rest) = go (C a ls) rest+ go ls (C _ rest) = go ls rest++main = log "Done"
+ tests/purs/passing/UTF8Sourcefile.purs view
@@ -0,0 +1,8 @@+module Main where++import Effect.Console++-- '→' is multibyte sequence \u2192.+utf8multibyte = "Hello λ→ world!!"++main = log "Done"
+ tests/purs/passing/UnderscoreIdent.purs view
@@ -0,0 +1,13 @@+module Main where++import Prelude+import Effect.Console (log)++data Data_type = Con_Structor | Con_2 String++type Type_name = Data_type++done (Con_2 s) = s+done _ = "Failed"++main = log (done (Con_2 "Done"))
+ tests/purs/passing/UnicodeIdentifier.purs view
@@ -0,0 +1,7 @@+module Main where++import Effect.Console (log)++f asgård = asgård++main = log (f "Done")
+ tests/purs/passing/UnicodeOperators.purs view
@@ -0,0 +1,22 @@+module Main where++import Effect.Console (log)++compose :: forall a b c. (b -> c) -> (a -> b) -> a -> c+compose f g a = f (g a)++infixr 9 compose as ∘++test1 = (\x -> x) ∘ \y -> y++elem :: forall a b. a -> (a -> Boolean) -> Boolean+elem x f = f x++infixl 1 elem as ∈++emptySet :: forall a. a -> Boolean+emptySet _ = true++test2 = 1 ∈ emptySet++main = log "Done"
+ tests/purs/passing/UnicodeType.purs view
@@ -0,0 +1,22 @@+module Main where++import Prelude+import Effect.Console (log)++class Monad m ⇐ Monad1 m where+ f1 :: m Int++class Monad m <= Monad2 m where+ f2 :: m Int++f ∷ ∀ m. Monad m ⇒ Int → m Int+f n = do+ n' ← pure n+ pure n'++f' :: forall m. Monad m => Int -> m Int+f' n = do+ n' <- pure n+ pure n'++main = log "Done"
+ tests/purs/passing/UnifyInTypeInstanceLookup.purs view
@@ -0,0 +1,25 @@+module Main where++import Effect.Console (log)++data Z = Z+data S n = S n++data T+data F++class EQ x y b+instance eqT :: EQ x x T+instance eqF :: EQ x y F++test :: forall a b. EQ a b T => a -> b -> a+test a _ = a++spin :: forall a b. a -> b+spin a = spin a++-- Expected type:+-- forall t. (EQ t (S Z) T) => t+test1 = test (spin 1) (S Z)++main = log "Done"
+ tests/purs/passing/Unit.purs view
@@ -0,0 +1,8 @@+module Main where++import Prelude+import Effect.Console (logShow, log)++main = do+ logShow (const unit $ "Hello world")+ log "Done"
+ tests/purs/passing/UnknownInTypeClassLookup.purs view
@@ -0,0 +1,15 @@+module Main where++import Prelude+import Effect.Console (log)++class EQ a b++instance eqAA :: EQ a a++test :: forall a b. EQ a b => a -> b -> String+test _ _ = "Done"++runTest a = test a a++main = log $ runTest 0.0
+ tests/purs/passing/UnsafeCoerce.purs view
@@ -0,0 +1,16 @@+module Main where++import Prelude (Unit)+import Unsafe.Coerce (unsafeCoerce)+import Effect (Effect)+import Effect.Console (log)++x :: Number+x = unsafeCoerce 1++y :: Number+y = case unsafeCoerce 1 of+ z -> unsafeCoerce z++main :: Effect Unit+main = log "Done"
+ tests/purs/passing/UntupledConstraints.purs view
@@ -0,0 +1,17 @@+module Main where++import Prelude+import Effect.Console (log)++class Show a <= Nonsense a where+ method :: a -> a++data Box a = Box a++instance showBox :: Show a => Show (Box a) where+ show (Box a) = "Box " <> show a++strangeThing :: forall m. Semigroup (m Unit) => m Unit -> m Unit -> m Unit+strangeThing x y = x <> y++main = log "Done"
+ tests/purs/passing/UsableTypeClassMethods.purs view
@@ -0,0 +1,35 @@+-- this is testing that we don't see an `UnusableDeclaration` error for type+-- class methods that should be valid based on various configurations of fundeps+module Main where++import Effect.Console (log)++-- no fundeps+class C0 a b where+ c0 :: a -> b++-- simple fundep+class C1 a b | a -> b where+ c1 :: a+ c1' :: a -> b++-- transitive+class C2 a b c | a -> b, b -> c where+ c2 :: a+ c2' :: a -> b+ c2'' :: a -> c+ c2''' :: a -> b -> c++-- with cycles+class C3 a b c | a -> b, b -> a, b -> c where+ c3 :: a+ c3' :: b+ c3'' :: a -> c+ c3''' :: b -> c+ c3'''' :: a -> b -> c++-- nullary class+class C4 where+ c4 :: forall a. a++main = log "Done"
+ tests/purs/passing/VTAsClassHeads.purs view
@@ -0,0 +1,196 @@+module Main where++import Prelude+import Data.Array as Array+import Data.Array.NonEmpty as NEA+import Data.Maybe (Maybe(..))+import Data.Either (Either(..), either)+import Data.Foldable (traverse_)+import Data.Traversable (sequence)+import Effect (Effect)+import Effect.Console (log)++class Singleton x where+ singleton :: String++instance Singleton Int where+ singleton = "int"++instance Singleton String where+ singleton = "string"++singletonWorks :: Effect (Maybe String)+singletonWorks = do+ let+ left = singleton @Int+ right = singleton @String+ pure if left /= right then Nothing else Just "Singleton failed"++class ConflictingIdent :: Type -> Constraint+class ConflictingIdent a where+ -- The `a` in the type below should refer to the `a`+ -- introduced by the `forall`, not the class head.+ conflictingIdent :: forall a. a -> Int++instance ConflictingIdent String where+ conflictingIdent _ = 1++instance ConflictingIdent Int where+ conflictingIdent _ = 2++conflictingIdentWorks :: Effect (Maybe String)+conflictingIdentWorks = do+ pure if (1 == conflictingIdent @String 4) then Nothing else Just "ConflictingIdent failed"++type M :: Type -> Type+type M x = forall a. a -> Int++class ConflictingIdentSynonym :: Type -> Constraint+class ConflictingIdentSynonym a where+ -- The `a` in the type below should refer to the `a`+ -- introduced by the `forall`, not the class head.+ conflictingIdentSynonym :: M a++instance ConflictingIdentSynonym String where+ conflictingIdentSynonym _ = 1++instance ConflictingIdentSynonym Int where+ conflictingIdentSynonym _ = 2++conflictingIdentSynonymWorks :: Effect (Maybe String)+conflictingIdentSynonymWorks = do+ pure if (1 == conflictingIdentSynonym @String 4) then Nothing else Just "ConflictingIdentSynonym failed"++class MultiNoFDs a b where+ multiNoFds :: Int++instance MultiNoFDs Int Int where+ multiNoFds = 0++instance MultiNoFDs String Int where+ multiNoFds = 1++multiNoFdsWorks :: Effect (Maybe String)+multiNoFdsWorks = do+ let+ left = multiNoFds @Int @Int+ right = multiNoFds @String @Int+ pure if left /= right then Nothing else Just "MultiNoFDs failed"++class MultiWithFDs a b | a -> b where+ multiWithFDs :: Int++instance MultiWithFDs Int Int where+ multiWithFDs = 0++instance MultiWithFDs String Int where+ multiWithFDs = 1++multiWithFdsWorks :: Effect (Maybe String)+multiWithFdsWorks = do+ let+ left = multiWithFDs @Int+ right = multiWithFDs @String+ pure if left /= right then Nothing else Just "MultiWithFds failed"++class MultiWithBidiFDs a b | a -> b, b -> a where+ multiWithBidiFDs :: Int++instance MultiWithBidiFDs Int Int where+ multiWithBidiFDs = 0++instance MultiWithBidiFDs String String where+ multiWithBidiFDs = 1++multiWithBidiFDsLeftWorks :: Effect (Maybe String)+multiWithBidiFDsLeftWorks = do+ let+ left = multiWithBidiFDs @Int+ right = multiWithBidiFDs @String+ pure if left /= right then Nothing else Just "MultiWithFds failed"++multiWithBidiFDsRightWorks :: Effect (Maybe String)+multiWithBidiFDsRightWorks = do+ let+ left = multiWithBidiFDs @_ @Int+ right = multiWithBidiFDs @_ @String+ pure if left /= right then Nothing else Just "MultiWithFds failed"++class Superclass a where+ superClassValue :: a++class Superclass a <= MainClass a where+ mainClassInt :: Int++data A2 = A2++derive instance Eq A2++instance Superclass A2 where+ superClassValue = A2++instance MainClass A2 where+ mainClassInt = 0++data B2 = B2++derive instance Eq B2++instance Superclass B2 where+ superClassValue = B2++instance MainClass B2 where+ mainClassInt = 3++mainClassWorks :: Effect (Maybe String)+mainClassWorks = do+ let+ test1 = 0 == mainClassInt @A2+ test2 = A2 == superClassValue @A2+ pure if test1 && test2 then Nothing else Just "MainClass failed"++class MultiCoveringSets a b c d e f | a b -> c d e f, f e -> a b c d where+ noneOfSets :: Int++ partialOfABSet :: a -> { c :: c, d :: d }++ partialOfFESet :: f -> { c :: c, d :: d }++instance MultiCoveringSets Boolean Boolean String String Int Int where+ noneOfSets = 1+ partialOfABSet a = { c: if a then "101" else "100", d: "1" }+ partialOfFESet f = { c: show f, d: "1" }++instance MultiCoveringSets Int Int String String Boolean Boolean where+ noneOfSets = 2+ partialOfABSet a = { c: show a, d: "2" }+ partialOfFESet f = { c: show f, d: "2" }++multiCoveringSetsWorks :: Effect (Maybe String)+multiCoveringSetsWorks = do+ let+ test1a = 1 == noneOfSets @Boolean @Boolean+ test1b = "101" == (partialOfABSet @Boolean @Boolean true).c+ test1c = show 3 == (partialOfFESet @_ @_ @_ @_ @Int @Int 3).c+ test2a = 2 == noneOfSets @_ @_ @_ @_ @Boolean @Boolean+ test2b = show 20 == (partialOfABSet @_ @_ @_ @_ @Boolean @Boolean 20).c+ test2c = show false == (partialOfFESet @_ @_ @_ @_ @Boolean @Boolean false).c+ passes = test1a && test1b && test1c && test2a && test2b && test2c+ pure if passes then Nothing else Just "MultiCoveringSets failed"++main = do+ arr' <- sequence+ [ singletonWorks+ , conflictingIdentWorks+ , conflictingIdentSynonymWorks+ , multiNoFdsWorks+ , multiWithFdsWorks+ , multiWithBidiFDsLeftWorks+ , multiWithBidiFDsRightWorks+ , mainClassWorks+ ]+ case NEA.fromArray $ Array.catMaybes arr' of+ Just errs ->+ log $ "Errors..." <> (Array.intercalate "\n" $ NEA.toArray errs)+ Nothing ->+ log "Done"
+ tests/purs/passing/VisibleTypeApplications.purs view
@@ -0,0 +1,40 @@+module Main where++import Prelude+import Effect.Console (log)++foreign import data Id :: forall (a :: Type). a -> a++identityCheck :: forall (@f :: forall (a :: Type). a -> a). Int+identityCheck = 0++identityPass :: Int+identityPass = identityCheck @Id++foreign import data Const :: forall a b. a -> b -> a++constCheck :: forall (a :: Type) (@f :: forall (b :: Type). b -> a). Int+constCheck = 0++constPass :: Int+constPass = constCheck @(Const Int)++-- Type variables in class heads and data declarations are always visible.++class ConstClass a where+ constClass :: forall @b. a -> b -> a+ +instance ConstClass a where+ constClass a _ = a++constClassInt = constClass @Int @Number++data Tree a = Leaf a | Branch (Tree a) (Tree a)++treeInt :: Int -> Tree Int+treeInt = Leaf @Int++treeInt' :: Tree Int -> Tree Int -> Tree Int+treeInt' = Branch @Int++main = log "Done"
+ tests/purs/passing/Where.purs view
@@ -0,0 +1,49 @@+module Main where++import Prelude+import Partial.Unsafe (unsafePartial)+import Effect+import Effect.Console (logShow, log)++test1 x = y+ where+ y :: Number+ y = x + 1.0++test2 x y = x' + y'+ where+ x' = x + 1.0+ y' = y + 1.0++test3 = f 1.0 2.0 3.0+ where f x y z = x + y + z++test4 = f (+) [1.0, 2.0]+ where f x [y, z] = x y z++test5 = g 10.0+ where+ f x | x > 0.0 = g (x / 2.0) + 1.0+ f x = 0.0+ g x = f (x - 1.0) + 1.0++test6 = if f true then f 1.0 else f 2.0+ where f :: forall a. a -> a+ f x = x++test7 :: Number -> Number+test7 x = go x+ where+ go y | (x - 0.1 < y * y) && (y * y < x + 0.1) = y+ go y = go $ (y + x / y) / 2.0++main :: Effect _+main = do+ logShow (test1 1.0)+ logShow (test2 1.0 2.0)+ logShow test3+ unsafePartial (logShow test4)+ logShow test5+ logShow test6+ logShow (test7 100.0)+ log "Done"
+ tests/purs/passing/WildcardInInstance.purs view
@@ -0,0 +1,21 @@+module Main where++import Prelude+import Effect+import Effect.Console++class Monad m <= MonadAsk r m | m -> r where+ ask :: m r++instance monadAskFun :: MonadAsk r ((->) r) where+ ask = identity++-- This should generate a warning with the correct inferred type.+test :: forall m. MonadAsk _ m => m Int+test = do+ x <- ask+ pure (x + 1)++main :: Effect Unit+main = do+ log "Done"
+ tests/purs/passing/WildcardType.purs view
@@ -0,0 +1,12 @@+module Main where++import Prelude+import Effect.Console (log)++f1 :: (_ -> _) -> _+f1 g = g 1++f2 :: _ -> _+f2 _ = "Done"++main = log $ f1 f2
+ tests/purs/passing/iota.purs view
@@ -0,0 +1,11 @@+module Main where++import Effect.Console (log)++s = \x -> \y -> \z -> x z (y z)++k = \x -> \y -> x++iota = \x -> x s k++main = log "Done"
+ tests/purs/passing/s.purs view
@@ -0,0 +1,8 @@+module Main where++import Prelude+import Effect.Console (log)++s = \x y z -> x z (y z)++main = log "Done"
+ tests/purs/psci/BasicEval.purs view
@@ -0,0 +1,19 @@+import Prelude+import Data.Array++-- @shouldEvaluateTo 3628800+let fac n = foldl mul 1 (1..n) in fac 10++fac n = foldl mul 1 (1..n)++-- @shouldEvaluateTo 3628800+fac 10++infix 4 mul as |*|++-- @shouldEvaluateTo 50+5 |*| 10++data X a = X++type role X representational
+ tests/purs/psci/Multiline.purs view
@@ -0,0 +1,17 @@+-- @paste+import Prelude+import Data.Array+-- @paste++-- @paste+fac :: Int -> Int+fac n = foldl mul 1 (1..n)+-- @paste++-- @shouldEvaluateTo 3628800+fac 10++-- @paste+data X :: Type -> Type+data X a = X+-- @paste
+ tests/purs/publish/basic-example/bower.json view
@@ -0,0 +1,13 @@+{+ "name": "basic-example",+ "repository": {+ "type": "git",+ "url": "https://github.com/purescript/test.git"+ },+ "license": "MIT",+ "dependencies": {+ "purescript-console": "^1.0.0",+ "purescript-prelude": "^1.0.0",+ "purescript-effect": "^1.0.0"+ }+}
+ tests/purs/publish/basic-example/output/Control.Applicative/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[36,29],"name":"../../../support/bower_components/purescript-prelude/src/Control/Applicative.purs","start":[36,3]},"title":"pure"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Applicative"],"Applicative"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[39,15],"name":"../../../support/bower_components/purescript-prelude/src/Control/Applicative.purs","start":[38,1]},"title":"applicativeFn"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Applicative"],"Applicative"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Array"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[42,17],"name":"../../../support/bower_components/purescript-prelude/src/Control/Applicative.purs","start":[41,1]},"title":"applicativeArray"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Applicative"],"Applicative"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[45,17],"name":"../../../support/bower_components/purescript-prelude/src/Control/Applicative.purs","start":[44,1]},"title":"applicativeProxy"}],"comments":"The `Applicative` type class extends the [`Apply`](#apply) type class\nwith a `pure` function, which can be used to create values of type `f a`\nfrom values of type `a`.\n\nWhere [`Apply`](#apply) provides the ability to lift functions of two or\nmore arguments to functions whose arguments are wrapped using `f`, and\n[`Functor`](#functor) provides the ability to lift functions of one\nargument, `pure` can be seen as the function which lifts functions of\n_zero_ arguments. That is, `Applicative` functors support a lifting\noperation for any number of function arguments.\n\nInstances must satisfy the following laws in addition to the `Apply`\nlaws:\n\n- Identity: `(pure identity) <*> v = v`\n- Composition: `pure (<<<) <*> f <*> g <*> h = f <*> (g <*> h)`\n- Homomorphism: `(pure f) <*> (pure x) = pure (f x)`\n- Interchange: `u <*> (pure y) = (pure (_ $ y)) <*> u`\n","info":{"arguments":[["f",null]],"declType":"typeClass","fundeps":[],"superclasses":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"f","tag":"TypeVar"}],"constraintClass":[["Control","Apply"],"Apply"],"constraintData":null,"constraintKindArgs":[]}]},"kind":{"keyword":"class","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Constraint"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[36,29],"name":"../../../support/bower_components/purescript-prelude/src/Control/Applicative.purs","start":[35,1]},"title":"Applicative"},{"children":[],"comments":"`liftA1` provides a default implementation of `(<$>)` for any\n[`Applicative`](#applicative) functor, without using `(<$>)` as provided\nby the [`Functor`](#functor)-[`Applicative`](#applicative) superclass\nrelationship.\n\n`liftA1` can therefore be used to write [`Functor`](#functor) instances\nas follows:\n\n```purescript\ninstance functorF :: Functor F where\n map = liftA1\n```\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"f","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"f","tag":"TypeVar"}],"constraintClass":[["Control","Applicative"],"Applicative"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[59,64],"name":"../../../support/bower_components/purescript-prelude/src/Control/Applicative.purs","start":[59,1]},"title":"liftA1"},{"children":[],"comments":"Perform an applicative action unless a condition is true.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"m","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"m","tag":"TypeVar"}],"constraintClass":[["Control","Applicative"],"Applicative"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[68,65],"name":"../../../support/bower_components/purescript-prelude/src/Control/Applicative.purs","start":[68,1]},"title":"unless"},{"children":[],"comments":"Perform an applicative action when a condition is true.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"m","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"m","tag":"TypeVar"}],"constraintClass":[["Control","Applicative"],"Applicative"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[63,63],"name":"../../../support/bower_components/purescript-prelude/src/Control/Applicative.purs","start":[63,1]},"title":"when"}],"name":"Control.Applicative","reExports":[]}
+ tests/purs/publish/basic-example/output/Control.Apply/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[53,48],"name":"../../../support/bower_components/purescript-prelude/src/Control/Apply.purs","start":[53,3]},"title":"apply"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Apply"],"Apply"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[58,26],"name":"../../../support/bower_components/purescript-prelude/src/Control/Apply.purs","start":[57,1]},"title":"applyFn"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Apply"],"Apply"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Array"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[61,21],"name":"../../../support/bower_components/purescript-prelude/src/Control/Apply.purs","start":[60,1]},"title":"applyArray"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Apply"],"Apply"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[66,20],"name":"../../../support/bower_components/purescript-prelude/src/Control/Apply.purs","start":[65,1]},"title":"applyProxy"}],"comments":"The `Apply` class provides the `(<*>)` which is used to apply a function\nto an argument under a type constructor.\n\n`Apply` can be used to lift functions of two or more arguments to work on\nvalues wrapped with the type constructor `f`. It might also be understood\nin terms of the `lift2` function:\n\n```purescript\nlift2 :: forall f a b c. Apply f => (a -> b -> c) -> f a -> f b -> f c\nlift2 f a b = f <$> a <*> b\n```\n\n`(<*>)` is recovered from `lift2` as `lift2 ($)`. That is, `(<*>)` lifts\nthe function application operator `($)` to arguments wrapped with the\ntype constructor `f`.\n\nPut differently...\n```\nfoo =\n functionTakingNArguments <$> computationProducingArg1\n <*> computationProducingArg2\n <*> ...\n <*> computationProducingArgN\n```\n\nInstances must satisfy the following law in addition to the `Functor`\nlaws:\n\n- Associative composition: `(<<<) <$> f <*> g <*> h = f <*> (g <*> h)`\n\nFormally, `Apply` represents a strong lax semi-monoidal endofunctor.\n","info":{"arguments":[["f",null]],"declType":"typeClass","fundeps":[],"superclasses":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"f","tag":"TypeVar"}],"constraintClass":[["Data","Functor"],"Functor"],"constraintData":null,"constraintKindArgs":[]}]},"kind":{"keyword":"class","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Constraint"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[53,48],"name":"../../../support/bower_components/purescript-prelude/src/Control/Apply.purs","start":[52,1]},"title":"Apply"},{"children":[],"comments":null,"info":{"alias":[["Control","Apply"],{"Right":{"Left":{"Ident":"apply"}}}],"declType":"alias","fixity":{"associativity":"infixl","precedence":4}},"kind":null,"sourceSpan":{"end":[55,22],"name":"../../../support/bower_components/purescript-prelude/src/Control/Apply.purs","start":[55,1]},"title":"(<*>)"},{"children":[],"comments":"Combine two effectful actions, keeping only the result of the first.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"f","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"f","tag":"TypeVar"}],"constraintClass":[["Control","Apply"],"Apply"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[69,57],"name":"../../../support/bower_components/purescript-prelude/src/Control/Apply.purs","start":[69,1]},"title":"applyFirst"},{"children":[],"comments":null,"info":{"alias":[["Control","Apply"],{"Right":{"Left":{"Ident":"applyFirst"}}}],"declType":"alias","fixity":{"associativity":"infixl","precedence":4}},"kind":null,"sourceSpan":{"end":[72,26],"name":"../../../support/bower_components/purescript-prelude/src/Control/Apply.purs","start":[72,1]},"title":"(<*)"},{"children":[],"comments":"Combine two effectful actions, keeping only the result of the second.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"f","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"f","tag":"TypeVar"}],"constraintClass":[["Control","Apply"],"Apply"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[75,58],"name":"../../../support/bower_components/purescript-prelude/src/Control/Apply.purs","start":[75,1]},"title":"applySecond"},{"children":[],"comments":null,"info":{"alias":[["Control","Apply"],{"Right":{"Left":{"Ident":"applySecond"}}}],"declType":"alias","fixity":{"associativity":"infixl","precedence":4}},"kind":null,"sourceSpan":{"end":[78,27],"name":"../../../support/bower_components/purescript-prelude/src/Control/Apply.purs","start":[78,1]},"title":"(*>)"},{"children":[],"comments":"Lift a function of two arguments to a function which accepts and returns\nvalues wrapped with the type constructor `f`.\n\n```purescript\nlift2 add (Just 1) (Just 2) == Just 3\nlift2 add Nothing (Just 2) == Nothing\n```\n\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"c","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"f","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"f","tag":"TypeVar"}],"constraintClass":[["Control","Apply"],"Apply"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[88,71],"name":"../../../support/bower_components/purescript-prelude/src/Control/Apply.purs","start":[88,1]},"title":"lift2"},{"children":[],"comments":"Lift a function of three arguments to a function which accepts and returns\nvalues wrapped with the type constructor `f`.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"c","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"d","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"f","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"f","tag":"TypeVar"}],"constraintClass":[["Control","Apply"],"Apply"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[93,85],"name":"../../../support/bower_components/purescript-prelude/src/Control/Apply.purs","start":[93,1]},"title":"lift3"},{"children":[],"comments":"Lift a function of four arguments to a function which accepts and returns\nvalues wrapped with the type constructor `f`.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"c","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"d","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"e","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"f","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"f","tag":"TypeVar"}],"constraintClass":[["Control","Apply"],"Apply"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"e","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"e","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[98,99],"name":"../../../support/bower_components/purescript-prelude/src/Control/Apply.purs","start":[98,1]},"title":"lift4"},{"children":[],"comments":"Lift a function of five arguments to a function which accepts and returns\nvalues wrapped with the type constructor `f`.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"c","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"d","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"e","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"f","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"g","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"f","tag":"TypeVar"}],"constraintClass":[["Control","Apply"],"Apply"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"e","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"g","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"e","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"g","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[103,113],"name":"../../../support/bower_components/purescript-prelude/src/Control/Apply.purs","start":[103,1]},"title":"lift5"}],"name":"Control.Apply","reExports":[]}
+ tests/purs/publish/basic-example/output/Control.Bind/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[57,47],"name":"../../../support/bower_components/purescript-prelude/src/Control/Bind.purs","start":[57,3]},"title":"bind"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Bind"],"Bind"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[72,25],"name":"../../../support/bower_components/purescript-prelude/src/Control/Bind.purs","start":[71,1]},"title":"bindFn"},{"comments":"The `bind`/`>>=` function for `Array` works by applying a function to\neach element in the array, and flattening the results into a single,\nnew array.\n\nArray's `bind`/`>>=` works like a nested for loop. Each `bind` adds\nanother level of nesting in the loop. For example:\n```\nfoo :: Array String\nfoo =\n [\"a\", \"b\"] >>= \\eachElementInArray1 ->\n [\"c\", \"d\"] >>= \\eachElementInArray2\n pure (eachElementInArray1 <> eachElementInArray2)\n\n-- In other words...\nfoo\n-- ... is the same as...\n[ (\"a\" <> \"c\"), (\"a\" <> \"d\"), (\"b\" <> \"c\"), (\"b\" <> \"d\") ]\n-- which simplifies to...\n[ \"ac\", \"ad\", \"bc\", \"bd\" ]\n```\n","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Bind"],"Bind"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Array"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[95,19],"name":"../../../support/bower_components/purescript-prelude/src/Control/Bind.purs","start":[94,1]},"title":"bindArray"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Bind"],"Bind"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[100,19],"name":"../../../support/bower_components/purescript-prelude/src/Control/Bind.purs","start":[99,1]},"title":"bindProxy"}],"comments":"The `Bind` type class extends the [`Apply`](#apply) type class with a\n\"bind\" operation `(>>=)` which composes computations in sequence, using\nthe return value of one computation to determine the next computation.\n\nThe `>>=` operator can also be expressed using `do` notation, as follows:\n\n```purescript\nx >>= f = do y <- x\n f y\n```\n\nwhere the function argument of `f` is given the name `y`.\n\nInstances must satisfy the following laws in addition to the `Apply`\nlaws:\n\n- Associativity: `(x >>= f) >>= g = x >>= (\\k -> f k >>= g)`\n- Apply Superclass: `apply f x = f >>= \\f’ -> map f’ x`\n\nAssociativity tells us that we can regroup operations which use `do`\nnotation so that we can unambiguously write, for example:\n\n```purescript\ndo x <- m1\n y <- m2 x\n m3 x y\n```\n","info":{"arguments":[["m",null]],"declType":"typeClass","fundeps":[],"superclasses":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"m","tag":"TypeVar"}],"constraintClass":[["Control","Apply"],"Apply"],"constraintData":null,"constraintKindArgs":[]}]},"kind":{"keyword":"class","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Constraint"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[57,47],"name":"../../../support/bower_components/purescript-prelude/src/Control/Bind.purs","start":[56,1]},"title":"Bind"},{"children":[],"comments":null,"info":{"alias":[["Control","Bind"],{"Right":{"Left":{"Ident":"bind"}}}],"declType":"alias","fixity":{"associativity":"infixl","precedence":1}},"kind":null,"sourceSpan":{"end":[59,21],"name":"../../../support/bower_components/purescript-prelude/src/Control/Bind.purs","start":[59,1]},"title":"(>>=)"},{"children":[],"comments":"`bindFlipped` is `bind` with its arguments reversed. For example:\n\n```purescript\nprint =<< random\n```\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"m","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"m","tag":"TypeVar"}],"constraintClass":[["Control","Bind"],"Bind"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[66,64],"name":"../../../support/bower_components/purescript-prelude/src/Control/Bind.purs","start":[66,1]},"title":"bindFlipped"},{"children":[],"comments":null,"info":{"alias":[["Control","Bind"],{"Right":{"Left":{"Ident":"bindFlipped"}}}],"declType":"alias","fixity":{"associativity":"infixr","precedence":1}},"kind":null,"sourceSpan":{"end":[69,28],"name":"../../../support/bower_components/purescript-prelude/src/Control/Bind.purs","start":[69,1]},"title":"(=<<)"},{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":{"identifier":"f","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"f","tag":"TypeVar"}],"constraintClass":[["Control","Bind"],"Bind"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[108,60],"name":"../../../support/bower_components/purescript-prelude/src/Control/Bind.purs","start":[108,3]},"title":"discard"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Bind"],"Discard"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[111,17],"name":"../../../support/bower_components/purescript-prelude/src/Control/Bind.purs","start":[110,1]},"title":"discardUnit"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Bind"],"Discard"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[114,17],"name":"../../../support/bower_components/purescript-prelude/src/Control/Bind.purs","start":[113,1]},"title":"discardProxy"}],"comments":"A class for types whose values can safely be discarded\nin a `do` notation block.\n\nAn example is the `Unit` type, since there is only one\npossible value which can be returned.\n","info":{"arguments":[["a",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[108,60],"name":"../../../support/bower_components/purescript-prelude/src/Control/Bind.purs","start":[107,1]},"title":"Discard"},{"children":[],"comments":"Collapse two applications of a monadic type constructor into one.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"m","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"m","tag":"TypeVar"}],"constraintClass":[["Control","Bind"],"Bind"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[117,45],"name":"../../../support/bower_components/purescript-prelude/src/Control/Bind.purs","start":[117,1]},"title":"join"},{"children":[],"comments":"Forwards Kleisli composition.\n\nFor example:\n\n```purescript\nimport Data.Array (head, tail)\n\nthird = tail >=> tail >=> head\n```\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"c","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"m","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"m","tag":"TypeVar"}],"constraintClass":[["Control","Bind"],"Bind"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[129,81],"name":"../../../support/bower_components/purescript-prelude/src/Control/Bind.purs","start":[129,1]},"title":"composeKleisli"},{"children":[],"comments":null,"info":{"alias":[["Control","Bind"],{"Right":{"Left":{"Ident":"composeKleisli"}}}],"declType":"alias","fixity":{"associativity":"infixr","precedence":1}},"kind":null,"sourceSpan":{"end":[132,31],"name":"../../../support/bower_components/purescript-prelude/src/Control/Bind.purs","start":[132,1]},"title":"(>=>)"},{"children":[],"comments":"Backwards Kleisli composition.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"c","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"m","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"m","tag":"TypeVar"}],"constraintClass":[["Control","Bind"],"Bind"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[135,88],"name":"../../../support/bower_components/purescript-prelude/src/Control/Bind.purs","start":[135,1]},"title":"composeKleisliFlipped"},{"children":[],"comments":null,"info":{"alias":[["Control","Bind"],{"Right":{"Left":{"Ident":"composeKleisliFlipped"}}}],"declType":"alias","fixity":{"associativity":"infixr","precedence":1}},"kind":null,"sourceSpan":{"end":[138,38],"name":"../../../support/bower_components/purescript-prelude/src/Control/Bind.purs","start":[138,1]},"title":"(<=<)"},{"children":[],"comments":"Execute a monadic action if a condition holds.\n\nFor example:\n\n```purescript\nmain = ifM ((< 0.5) <$> random)\n (trace \"Heads\")\n (trace \"Tails\")\n```\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"m","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"m","tag":"TypeVar"}],"constraintClass":[["Control","Bind"],"Bind"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[149,60],"name":"../../../support/bower_components/purescript-prelude/src/Control/Bind.purs","start":[149,1]},"title":"ifM"}],"name":"Control.Bind","reExports":[]}
+ tests/purs/publish/basic-example/output/Control.Category/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":{"identifier":"t","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[19,30],"name":"../../../support/bower_components/purescript-prelude/src/Control/Category.purs","start":[19,3]},"title":"identity"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Category"],"Category"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[22,17],"name":"../../../support/bower_components/purescript-prelude/src/Control/Category.purs","start":[21,1]},"title":"categoryFn"}],"comments":"`Category`s consist of objects and composable morphisms between them, and\nas such are [`Semigroupoids`](#semigroupoid), but unlike `semigroupoids`\nmust have an identity element.\n\nInstances must satisfy the following law in addition to the\n`Semigroupoid` law:\n\n- Identity: `identity <<< p = p <<< identity = p`\n","info":{"arguments":[["a",null]],"declType":"typeClass","fundeps":[],"superclasses":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Control","Semigroupoid"],"Semigroupoid"],"constraintData":null,"constraintKindArgs":[]}]},"kind":{"keyword":"class","kind":{"annotation":[],"contents":{"identifier":"k","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Constraint"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[19,30],"name":"../../../support/bower_components/purescript-prelude/src/Control/Category.purs","start":[18,1]},"title":"Category"}],"name":"Control.Category","reExports":[]}
+ tests/purs/publish/basic-example/output/Control.Monad/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Monad"],"Monad"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[33,35],"name":"../../../support/bower_components/purescript-prelude/src/Control/Monad.purs","start":[33,1]},"title":"monadFn"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Monad"],"Monad"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Array"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[35,35],"name":"../../../support/bower_components/purescript-prelude/src/Control/Monad.purs","start":[35,1]},"title":"monadArray"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Monad"],"Monad"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[37,35],"name":"../../../support/bower_components/purescript-prelude/src/Control/Monad.purs","start":[37,1]},"title":"monadProxy"}],"comments":"The `Monad` type class combines the operations of the `Bind` and\n`Applicative` type classes. Therefore, `Monad` instances represent type\nconstructors which support sequential composition, and also lifting of\nfunctions of arbitrary arity.\n\nInstances must satisfy the following laws in addition to the\n`Applicative` and `Bind` laws:\n\n- Left Identity: `pure x >>= f = f x`\n- Right Identity: `x >>= pure = x`\n","info":{"arguments":[["m",null]],"declType":"typeClass","fundeps":[],"superclasses":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"m","tag":"TypeVar"}],"constraintClass":[["Control","Applicative"],"Applicative"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"m","tag":"TypeVar"}],"constraintClass":[["Control","Bind"],"Bind"],"constraintData":null,"constraintKindArgs":[]}]},"kind":{"keyword":"class","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Constraint"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[31,41],"name":"../../../support/bower_components/purescript-prelude/src/Control/Monad.purs","start":[31,1]},"title":"Monad"},{"children":[],"comments":"`liftM1` provides a default implementation of `(<$>)` for any\n[`Monad`](#monad), without using `(<$>)` as provided by the\n[`Functor`](#functor)-[`Monad`](#monad) superclass relationship.\n\n`liftM1` can therefore be used to write [`Functor`](#functor) instances\nas follows:\n\n```purescript\ninstance functorF :: Functor F where\n map = liftM1\n```\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"m","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"m","tag":"TypeVar"}],"constraintClass":[["Control","Monad"],"Monad"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[50,58],"name":"../../../support/bower_components/purescript-prelude/src/Control/Monad.purs","start":[50,1]},"title":"liftM1"},{"children":[],"comments":"Perform a monadic action when a condition is true, where the conditional\nvalue is also in a monadic context.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"m","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"m","tag":"TypeVar"}],"constraintClass":[["Control","Monad"],"Monad"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[57,60],"name":"../../../support/bower_components/purescript-prelude/src/Control/Monad.purs","start":[57,1]},"title":"whenM"},{"children":[],"comments":"Perform a monadic action unless a condition is true, where the conditional\nvalue is also in a monadic context.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"m","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"m","tag":"TypeVar"}],"constraintClass":[["Control","Monad"],"Monad"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[64,62],"name":"../../../support/bower_components/purescript-prelude/src/Control/Monad.purs","start":[64,1]},"title":"unlessM"},{"children":[],"comments":"`ap` provides a default implementation of `(<*>)` for any `Monad`, without\nusing `(<*>)` as provided by the `Apply`-`Monad` superclass relationship.\n\n`ap` can therefore be used to write `Apply` instances as follows:\n\n```purescript\ninstance applyF :: Apply F where\n apply = ap\n```\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"m","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"m","tag":"TypeVar"}],"constraintClass":[["Control","Monad"],"Monad"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[82,56],"name":"../../../support/bower_components/purescript-prelude/src/Control/Monad.purs","start":[82,1]},"title":"ap"}],"name":"Control.Monad","reExports":[]}
+ tests/purs/publish/basic-example/output/Control.Semigroupoid/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"c","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"d","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[14,51],"name":"../../../support/bower_components/purescript-prelude/src/Control/Semigroupoid.purs","start":[14,3]},"title":"compose"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Semigroupoid"],"Semigroupoid"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[17,26],"name":"../../../support/bower_components/purescript-prelude/src/Control/Semigroupoid.purs","start":[16,1]},"title":"semigroupoidFn"}],"comments":"A `Semigroupoid` is similar to a [`Category`](#category) but does not\nrequire an identity element `identity`, just composable morphisms.\n\n`Semigroupoid`s must satisfy the following law:\n\n- Associativity: `p <<< (q <<< r) = (p <<< q) <<< r`\n\nOne example of a `Semigroupoid` is the function type constructor `(->)`,\nwith `(<<<)` defined as function composition.\n","info":{"arguments":[["a",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":{"keyword":"class","kind":{"annotation":[],"contents":{"identifier":"k","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Constraint"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[14,51],"name":"../../../support/bower_components/purescript-prelude/src/Control/Semigroupoid.purs","start":[13,1]},"title":"Semigroupoid"},{"children":[],"comments":null,"info":{"alias":[["Control","Semigroupoid"],{"Right":{"Left":{"Ident":"compose"}}}],"declType":"alias","fixity":{"associativity":"infixr","precedence":9}},"kind":null,"sourceSpan":{"end":[19,24],"name":"../../../support/bower_components/purescript-prelude/src/Control/Semigroupoid.purs","start":[19,1]},"title":"(<<<)"},{"children":[],"comments":"Forwards composition, or `compose` with its arguments reversed.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"c","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"d","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Control","Semigroupoid"],"Semigroupoid"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[22,76],"name":"../../../support/bower_components/purescript-prelude/src/Control/Semigroupoid.purs","start":[22,1]},"title":"composeFlipped"},{"children":[],"comments":null,"info":{"alias":[["Control","Semigroupoid"],{"Right":{"Left":{"Ident":"composeFlipped"}}}],"declType":"alias","fixity":{"associativity":"infixr","precedence":9}},"kind":null,"sourceSpan":{"end":[25,31],"name":"../../../support/bower_components/purescript-prelude/src/Control/Semigroupoid.purs","start":[25,1]},"title":"(>>>)"}],"name":"Control.Semigroupoid","reExports":[]}
+ tests/purs/publish/basic-example/output/Data.Boolean/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[],"comments":"An alias for `true`, which can be useful in guard clauses:\n\n```purescript\nmax x y | x >= y = x\n | otherwise = y\n```\n","info":{"declType":"value","type":{"annotation":[],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[9,21],"name":"../../../support/bower_components/purescript-prelude/src/Data/Boolean.purs","start":[9,1]},"title":"otherwise"}],"name":"Data.Boolean","reExports":[]}
+ tests/purs/publish/basic-example/output/Data.BooleanAlgebra/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","BooleanAlgebra"],"BooleanAlgebra"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[24,57],"name":"../../../support/bower_components/purescript-prelude/src/Data/BooleanAlgebra.purs","start":[24,1]},"title":"booleanAlgebraBoolean"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","BooleanAlgebra"],"BooleanAlgebra"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[25,51],"name":"../../../support/bower_components/purescript-prelude/src/Data/BooleanAlgebra.purs","start":[25,1]},"title":"booleanAlgebraUnit"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"b","tag":"TypeVar"}],"constraintClass":[["Data","BooleanAlgebra"],"BooleanAlgebra"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","BooleanAlgebra"],"BooleanAlgebra"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[26,73],"name":"../../../support/bower_components/purescript-prelude/src/Data/BooleanAlgebra.purs","start":[26,1]},"title":"booleanAlgebraFn"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"row","tag":"TypeVar"},{"annotation":[],"contents":"list","tag":"TypeVar"}],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"list","tag":"TypeVar"},{"annotation":[],"contents":"row","tag":"TypeVar"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"constraintClass":[["Data","BooleanAlgebra"],"BooleanAlgebraRecord"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","BooleanAlgebra"],"BooleanAlgebra"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[27,123],"name":"../../../support/bower_components/purescript-prelude/src/Data/BooleanAlgebra.purs","start":[27,1]},"title":"booleanAlgebraRecord"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","BooleanAlgebra"],"BooleanAlgebra"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[28,57],"name":"../../../support/bower_components/purescript-prelude/src/Data/BooleanAlgebra.purs","start":[28,1]},"title":"booleanAlgebraProxy"}],"comments":"The `BooleanAlgebra` type class represents types that behave like boolean\nvalues.\n\nInstances should satisfy the following laws in addition to the\n`HeytingAlgebra` law:\n\n- Excluded middle:\n - `a || not a = tt`\n","info":{"arguments":[["a",null]],"declType":"typeClass","fundeps":[],"superclasses":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","HeytingAlgebra"],"HeytingAlgebra"],"constraintData":null,"constraintKindArgs":[]}]},"kind":null,"sourceSpan":{"end":[22,43],"name":"../../../support/bower_components/purescript-prelude/src/Data/BooleanAlgebra.purs","start":[22,1]},"title":"BooleanAlgebra"},{"children":[{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","BooleanAlgebra"],"BooleanAlgebraRecord"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim","RowList"],"Nil"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"tag":"REmpty"}],"tag":"TypeApp"}},"sourceSpan":{"end":[35,71],"name":"../../../support/bower_components/purescript-prelude/src/Data/BooleanAlgebra.purs","start":[35,1]},"title":"booleanAlgebraRecordNil"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"key","tag":"TypeVar"}],"constraintClass":[["Data","Symbol"],"IsSymbol"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"key","tag":"TypeVar"},{"annotation":[],"contents":"focus","tag":"TypeVar"},{"annotation":[],"contents":"subrowTail","tag":"TypeVar"},{"annotation":[],"contents":"subrow","tag":"TypeVar"}],"constraintClass":[["Prim","Row"],"Cons"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"rowlistTail","tag":"TypeVar"},{"annotation":[],"contents":"row","tag":"TypeVar"},{"annotation":[],"contents":"subrowTail","tag":"TypeVar"}],"constraintClass":[["Data","BooleanAlgebra"],"BooleanAlgebraRecord"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"focus","tag":"TypeVar"}],"constraintClass":[["Data","BooleanAlgebra"],"BooleanAlgebra"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","BooleanAlgebra"],"BooleanAlgebraRecord"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim","RowList"],"Cons"],"tag":"TypeConstructor"},{"annotation":[],"contents":"key","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"focus","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"rowlistTail","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"subrow","tag":"TypeVar"}],"tag":"TypeApp"}},"sourceSpan":{"end":[43,66],"name":"../../../support/bower_components/purescript-prelude/src/Data/BooleanAlgebra.purs","start":[37,1]},"title":"booleanAlgebraRecordCons"}],"comments":"A class for records where all fields have `BooleanAlgebra` instances, used\nto implement the `BooleanAlgebra` instance for records.\n","info":{"arguments":[["rowlist",null],["row",null],["subrow",null]],"declType":"typeClass","fundeps":[[["rowlist"],["subrow"]]],"superclasses":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"rowlist","tag":"TypeVar"},{"annotation":[],"contents":"row","tag":"TypeVar"},{"annotation":[],"contents":"subrow","tag":"TypeVar"}],"constraintClass":[["Data","HeytingAlgebra"],"HeytingAlgebraRecord"],"constraintData":null,"constraintKindArgs":[]}]},"kind":{"keyword":"class","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim","RowList"],"RowList"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Constraint"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[33,109],"name":"../../../support/bower_components/purescript-prelude/src/Data/BooleanAlgebra.purs","start":[33,1]},"title":"BooleanAlgebraRecord"}],"name":"Data.BooleanAlgebra","reExports":[]}
+ tests/purs/publish/basic-example/output/Data.Bounded.Generic/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":"a","tag":"TypeVar"}},"sourceSpan":{"end":[15,22],"name":"../../../support/bower_components/purescript-prelude/src/Data/Bounded/Generic.purs","start":[15,3]},"title":"genericBottom'"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Bounded","Generic"],"GenericBottom"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Generic","Rep"],"NoArguments"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[18,31],"name":"../../../support/bower_components/purescript-prelude/src/Data/Bounded/Generic.purs","start":[17,1]},"title":"genericBottomNoArguments"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Bounded"],"Bounded"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Bounded","Generic"],"GenericBottom"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Generic","Rep"],"Argument"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[21,35],"name":"../../../support/bower_components/purescript-prelude/src/Data/Bounded/Generic.purs","start":[20,1]},"title":"genericBottomArgument"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Bounded","Generic"],"GenericBottom"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Bounded","Generic"],"GenericBottom"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Generic","Rep"],"Sum"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[24,38],"name":"../../../support/bower_components/purescript-prelude/src/Data/Bounded/Generic.purs","start":[23,1]},"title":"genericBottomSum"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Bounded","Generic"],"GenericBottom"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"b","tag":"TypeVar"}],"constraintClass":[["Data","Bounded","Generic"],"GenericBottom"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Bounded","Generic"],"GenericBottom"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Generic","Rep"],"Product"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[27,57],"name":"../../../support/bower_components/purescript-prelude/src/Data/Bounded/Generic.purs","start":[26,1]},"title":"genericBottomProduct"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Bounded","Generic"],"GenericBottom"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Bounded","Generic"],"GenericBottom"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Generic","Rep"],"Constructor"],"tag":"TypeConstructor"},{"annotation":[],"contents":"name","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[30,46],"name":"../../../support/bower_components/purescript-prelude/src/Data/Bounded/Generic.purs","start":[29,1]},"title":"genericBottomConstructor"}],"comments":null,"info":{"arguments":[["a",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[15,22],"name":"../../../support/bower_components/purescript-prelude/src/Data/Bounded/Generic.purs","start":[14,1]},"title":"GenericBottom"},{"children":[],"comments":"A `Generic` implementation of the `bottom` member from the `Bounded` type class.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"rep","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":"rep","tag":"TypeVar"}],"constraintClass":[["Data","Generic","Rep"],"Generic"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"rep","tag":"TypeVar"}],"constraintClass":[["Data","Bounded","Generic"],"GenericBottom"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[51,71],"name":"../../../support/bower_components/purescript-prelude/src/Data/Bounded/Generic.purs","start":[51,1]},"title":"genericBottom"},{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":"a","tag":"TypeVar"}},"sourceSpan":{"end":[33,19],"name":"../../../support/bower_components/purescript-prelude/src/Data/Bounded/Generic.purs","start":[33,3]},"title":"genericTop'"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Bounded","Generic"],"GenericTop"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Generic","Rep"],"NoArguments"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[36,28],"name":"../../../support/bower_components/purescript-prelude/src/Data/Bounded/Generic.purs","start":[35,1]},"title":"genericTopNoArguments"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Bounded"],"Bounded"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Bounded","Generic"],"GenericTop"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Generic","Rep"],"Argument"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[39,29],"name":"../../../support/bower_components/purescript-prelude/src/Data/Bounded/Generic.purs","start":[38,1]},"title":"genericTopArgument"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"b","tag":"TypeVar"}],"constraintClass":[["Data","Bounded","Generic"],"GenericTop"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Bounded","Generic"],"GenericTop"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Generic","Rep"],"Sum"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[42,32],"name":"../../../support/bower_components/purescript-prelude/src/Data/Bounded/Generic.purs","start":[41,1]},"title":"genericTopSum"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Bounded","Generic"],"GenericTop"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"b","tag":"TypeVar"}],"constraintClass":[["Data","Bounded","Generic"],"GenericTop"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Bounded","Generic"],"GenericTop"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Generic","Rep"],"Product"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[45,48],"name":"../../../support/bower_components/purescript-prelude/src/Data/Bounded/Generic.purs","start":[44,1]},"title":"genericTopProduct"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Bounded","Generic"],"GenericTop"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Bounded","Generic"],"GenericTop"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Generic","Rep"],"Constructor"],"tag":"TypeConstructor"},{"annotation":[],"contents":"name","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[48,40],"name":"../../../support/bower_components/purescript-prelude/src/Data/Bounded/Generic.purs","start":[47,1]},"title":"genericTopConstructor"}],"comments":null,"info":{"arguments":[["a",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[33,19],"name":"../../../support/bower_components/purescript-prelude/src/Data/Bounded/Generic.purs","start":[32,1]},"title":"GenericTop"},{"children":[],"comments":"A `Generic` implementation of the `top` member from the `Bounded` type class.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"rep","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":"rep","tag":"TypeVar"}],"constraintClass":[["Data","Generic","Rep"],"Generic"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"rep","tag":"TypeVar"}],"constraintClass":[["Data","Bounded","Generic"],"GenericTop"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[55,65],"name":"../../../support/bower_components/purescript-prelude/src/Data/Bounded/Generic.purs","start":[55,1]},"title":"genericTop"}],"name":"Data.Bounded.Generic","reExports":[]}
+ tests/purs/publish/basic-example/output/Data.Bounded/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":"a","tag":"TypeVar"}},"sourceSpan":{"end":[26,11],"name":"../../../support/bower_components/purescript-prelude/src/Data/Bounded.purs","start":[26,3]},"title":"top"},{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":"a","tag":"TypeVar"}},"sourceSpan":{"end":[27,14],"name":"../../../support/bower_components/purescript-prelude/src/Data/Bounded.purs","start":[27,3]},"title":"bottom"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Bounded"],"Bounded"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[31,17],"name":"../../../support/bower_components/purescript-prelude/src/Data/Bounded.purs","start":[29,1]},"title":"boundedBoolean"},{"comments":"The `Bounded` `Int` instance has `top :: Int` equal to 2^31 - 1,\nand `bottom :: Int` equal to -2^31, since these are the largest and smallest\nintegers representable by twos-complement 32-bit integers, respectively.\n","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Bounded"],"Bounded"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[38,21],"name":"../../../support/bower_components/purescript-prelude/src/Data/Bounded.purs","start":[36,1]},"title":"boundedInt"},{"comments":"Characters fall within the Unicode range.\n","info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Bounded"],"Bounded"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Char"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[46,22],"name":"../../../support/bower_components/purescript-prelude/src/Data/Bounded.purs","start":[44,1]},"title":"boundedChar"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Bounded"],"Bounded"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Ordering"],"Ordering"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[53,14],"name":"../../../support/bower_components/purescript-prelude/src/Data/Bounded.purs","start":[51,1]},"title":"boundedOrdering"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Bounded"],"Bounded"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[57,16],"name":"../../../support/bower_components/purescript-prelude/src/Data/Bounded.purs","start":[55,1]},"title":"boundedUnit"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Bounded"],"Bounded"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Number"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[64,24],"name":"../../../support/bower_components/purescript-prelude/src/Data/Bounded.purs","start":[62,1]},"title":"boundedNumber"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Bounded"],"Bounded"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[68,14],"name":"../../../support/bower_components/purescript-prelude/src/Data/Bounded.purs","start":[66,1]},"title":"boundedProxy"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"row","tag":"TypeVar"},{"annotation":[],"contents":"list","tag":"TypeVar"}],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"list","tag":"TypeVar"},{"annotation":[],"contents":"row","tag":"TypeVar"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"constraintClass":[["Data","Bounded"],"BoundedRecord"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Bounded"],"Bounded"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[105,67],"name":"../../../support/bower_components/purescript-prelude/src/Data/Bounded.purs","start":[99,1]},"title":"boundedRecord"}],"comments":"The `Bounded` type class represents totally ordered types that have an\nupper and lower boundary.\n\nInstances should satisfy the following law in addition to the `Ord` laws:\n\n- Bounded: `bottom <= a <= top`\n","info":{"arguments":[["a",null]],"declType":"typeClass","fundeps":[],"superclasses":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Ord"],"Ord"],"constraintData":null,"constraintKindArgs":[]}]},"kind":null,"sourceSpan":{"end":[27,14],"name":"../../../support/bower_components/purescript-prelude/src/Data/Bounded.purs","start":[25,1]},"title":"Bounded"},{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"},{"annotation":[],"contents":"rowlist","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"subrow","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[72,59],"name":"../../../support/bower_components/purescript-prelude/src/Data/Bounded.purs","start":[72,3]},"title":"topRecord"},{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"},{"annotation":[],"contents":"rowlist","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"subrow","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[73,62],"name":"../../../support/bower_components/purescript-prelude/src/Data/Bounded.purs","start":[73,3]},"title":"bottomRecord"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Bounded"],"BoundedRecord"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim","RowList"],"Nil"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"tag":"REmpty"}],"tag":"TypeApp"}},"sourceSpan":{"end":[77,24],"name":"../../../support/bower_components/purescript-prelude/src/Data/Bounded.purs","start":[75,1]},"title":"boundedRecordNil"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"key","tag":"TypeVar"}],"constraintClass":[["Data","Symbol"],"IsSymbol"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"focus","tag":"TypeVar"}],"constraintClass":[["Data","Bounded"],"Bounded"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"key","tag":"TypeVar"},{"annotation":[],"contents":"focus","tag":"TypeVar"},{"annotation":[],"contents":"rowTail","tag":"TypeVar"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"constraintClass":[["Prim","Row"],"Cons"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"key","tag":"TypeVar"},{"annotation":[],"contents":"focus","tag":"TypeVar"},{"annotation":[],"contents":"subrowTail","tag":"TypeVar"},{"annotation":[],"contents":"subrow","tag":"TypeVar"}],"constraintClass":[["Prim","Row"],"Cons"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"rowlistTail","tag":"TypeVar"},{"annotation":[],"contents":"row","tag":"TypeVar"},{"annotation":[],"contents":"subrowTail","tag":"TypeVar"}],"constraintClass":[["Data","Bounded"],"BoundedRecord"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Bounded"],"BoundedRecord"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim","RowList"],"Cons"],"tag":"TypeConstructor"},{"annotation":[],"contents":"key","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"focus","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"rowlistTail","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"subrow","tag":"TypeVar"}],"tag":"TypeApp"}},"sourceSpan":{"end":[97,62],"name":"../../../support/bower_components/purescript-prelude/src/Data/Bounded.purs","start":[79,1]},"title":"boundedRecordCons"}],"comments":null,"info":{"arguments":[["rowlist",null],["row",null],["subrow",null]],"declType":"typeClass","fundeps":[[["rowlist"],["subrow"]]],"superclasses":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"rowlist","tag":"TypeVar"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"constraintClass":[["Data","Ord"],"OrdRecord"],"constraintData":null,"constraintKindArgs":[]}]},"kind":{"keyword":"class","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim","RowList"],"RowList"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Constraint"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[73,62],"name":"../../../support/bower_components/purescript-prelude/src/Data/Bounded.purs","start":[71,1]},"title":"BoundedRecord"}],"name":"Data.Bounded","reExports":[]}
+ tests/purs/publish/basic-example/output/Data.CommutativeRing/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","CommutativeRing"],"CommutativeRing"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[25,51],"name":"../../../support/bower_components/purescript-prelude/src/Data/CommutativeRing.purs","start":[25,1]},"title":"commutativeRingInt"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","CommutativeRing"],"CommutativeRing"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Number"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[26,57],"name":"../../../support/bower_components/purescript-prelude/src/Data/CommutativeRing.purs","start":[26,1]},"title":"commutativeRingNumber"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","CommutativeRing"],"CommutativeRing"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[27,53],"name":"../../../support/bower_components/purescript-prelude/src/Data/CommutativeRing.purs","start":[27,1]},"title":"commutativeRingUnit"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"b","tag":"TypeVar"}],"constraintClass":[["Data","CommutativeRing"],"CommutativeRing"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","CommutativeRing"],"CommutativeRing"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[28,76],"name":"../../../support/bower_components/purescript-prelude/src/Data/CommutativeRing.purs","start":[28,1]},"title":"commutativeRingFn"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"row","tag":"TypeVar"},{"annotation":[],"contents":"list","tag":"TypeVar"}],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"list","tag":"TypeVar"},{"annotation":[],"contents":"row","tag":"TypeVar"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"constraintClass":[["Data","CommutativeRing"],"CommutativeRingRecord"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","CommutativeRing"],"CommutativeRing"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[29,126],"name":"../../../support/bower_components/purescript-prelude/src/Data/CommutativeRing.purs","start":[29,1]},"title":"commutativeRingRecord"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","CommutativeRing"],"CommutativeRing"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[30,59],"name":"../../../support/bower_components/purescript-prelude/src/Data/CommutativeRing.purs","start":[30,1]},"title":"commutativeRingProxy"}],"comments":"The `CommutativeRing` class is for rings where multiplication is\ncommutative.\n\nInstances must satisfy the following law in addition to the `Ring`\nlaws:\n\n- Commutative multiplication: `a * b = b * a`\n","info":{"arguments":[["a",null]],"declType":"typeClass","fundeps":[],"superclasses":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Ring"],"Ring"],"constraintData":null,"constraintKindArgs":[]}]},"kind":null,"sourceSpan":{"end":[23,34],"name":"../../../support/bower_components/purescript-prelude/src/Data/CommutativeRing.purs","start":[23,1]},"title":"CommutativeRing"},{"children":[{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","CommutativeRing"],"CommutativeRingRecord"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim","RowList"],"Nil"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"tag":"REmpty"}],"tag":"TypeApp"}},"sourceSpan":{"end":[36,73],"name":"../../../support/bower_components/purescript-prelude/src/Data/CommutativeRing.purs","start":[36,1]},"title":"commutativeRingRecordNil"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"key","tag":"TypeVar"}],"constraintClass":[["Data","Symbol"],"IsSymbol"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"key","tag":"TypeVar"},{"annotation":[],"contents":"focus","tag":"TypeVar"},{"annotation":[],"contents":"subrowTail","tag":"TypeVar"},{"annotation":[],"contents":"subrow","tag":"TypeVar"}],"constraintClass":[["Prim","Row"],"Cons"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"rowlistTail","tag":"TypeVar"},{"annotation":[],"contents":"row","tag":"TypeVar"},{"annotation":[],"contents":"subrowTail","tag":"TypeVar"}],"constraintClass":[["Data","CommutativeRing"],"CommutativeRingRecord"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"focus","tag":"TypeVar"}],"constraintClass":[["Data","CommutativeRing"],"CommutativeRing"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","CommutativeRing"],"CommutativeRingRecord"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim","RowList"],"Cons"],"tag":"TypeConstructor"},{"annotation":[],"contents":"key","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"focus","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"rowlistTail","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"subrow","tag":"TypeVar"}],"tag":"TypeApp"}},"sourceSpan":{"end":[44,67],"name":"../../../support/bower_components/purescript-prelude/src/Data/CommutativeRing.purs","start":[38,1]},"title":"commutativeRingRecordCons"}],"comments":"A class for records where all fields have `CommutativeRing` instances, used\nto implement the `CommutativeRing` instance for records.\n","info":{"arguments":[["rowlist",null],["row",null],["subrow",null]],"declType":"typeClass","fundeps":[[["rowlist"],["subrow"]]],"superclasses":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"rowlist","tag":"TypeVar"},{"annotation":[],"contents":"row","tag":"TypeVar"},{"annotation":[],"contents":"subrow","tag":"TypeVar"}],"constraintClass":[["Data","Ring"],"RingRecord"],"constraintData":null,"constraintKindArgs":[]}]},"kind":{"keyword":"class","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim","RowList"],"RowList"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Constraint"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[34,100],"name":"../../../support/bower_components/purescript-prelude/src/Data/CommutativeRing.purs","start":[34,1]},"title":"CommutativeRingRecord"}],"name":"Data.CommutativeRing","reExports":[]}
+ tests/purs/publish/basic-example/output/Data.DivisionRing/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}},"sourceSpan":{"end":[30,18],"name":"../../../support/bower_components/purescript-prelude/src/Data/DivisionRing.purs","start":[30,3]},"title":"recip"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","DivisionRing"],"DivisionRing"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Number"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[55,20],"name":"../../../support/bower_components/purescript-prelude/src/Data/DivisionRing.purs","start":[54,1]},"title":"divisionringNumber"}],"comments":"The `DivisionRing` class is for non-zero rings in which every non-zero\nelement has a multiplicative inverse. Division rings are sometimes also\ncalled *skew fields*.\n\nInstances must satisfy the following laws in addition to the `Ring` laws:\n\n- Non-zero ring: `one /= zero`\n- Non-zero multiplicative inverse: `recip a * a = a * recip a = one` for\n all non-zero `a`\n\nThe result of `recip zero` is left undefined; individual instances may\nchoose how to handle this case.\n\nIf a type has both `DivisionRing` and `CommutativeRing` instances, then\nit is a field and should have a `Field` instance.\n","info":{"arguments":[["a",null]],"declType":"typeClass","fundeps":[],"superclasses":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Ring"],"Ring"],"constraintData":null,"constraintKindArgs":[]}]},"kind":null,"sourceSpan":{"end":[30,18],"name":"../../../support/bower_components/purescript-prelude/src/Data/DivisionRing.purs","start":[29,1]},"title":"DivisionRing"},{"children":[],"comments":"Left division, defined as `leftDiv a b = recip b * a`. Left and right\ndivision are distinct in this module because a `DivisionRing` is not\nnecessarily commutative.\n\nIf the type `a` is also a `EuclideanRing`, then this function is\nequivalent to `div` from the `EuclideanRing` class. When working\nabstractly, `div` should generally be preferred, unless you know that you\nneed your code to work with noncommutative rings.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","DivisionRing"],"DivisionRing"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[40,51],"name":"../../../support/bower_components/purescript-prelude/src/Data/DivisionRing.purs","start":[40,1]},"title":"leftDiv"},{"children":[],"comments":"Right division, defined as `rightDiv a b = a * recip b`. Left and right\ndivision are distinct in this module because a `DivisionRing` is not\nnecessarily commutative.\n\nIf the type `a` is also a `EuclideanRing`, then this function is\nequivalent to `div` from the `EuclideanRing` class. When working\nabstractly, `div` should generally be preferred, unless you know that you\nneed your code to work with noncommutative rings.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","DivisionRing"],"DivisionRing"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[51,52],"name":"../../../support/bower_components/purescript-prelude/src/Data/DivisionRing.purs","start":[51,1]},"title":"rightDiv"}],"name":"Data.DivisionRing","reExports":[]}
+ tests/purs/publish/basic-example/output/Data.Eq.Generic/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[11,34],"name":"../../../support/bower_components/purescript-prelude/src/Data/Eq/Generic.purs","start":[11,3]},"title":"genericEq'"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Eq","Generic"],"GenericEq"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Generic","Rep"],"NoConstructors"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[14,24],"name":"../../../support/bower_components/purescript-prelude/src/Data/Eq/Generic.purs","start":[13,1]},"title":"genericEqNoConstructors"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Eq","Generic"],"GenericEq"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Generic","Rep"],"NoArguments"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[17,24],"name":"../../../support/bower_components/purescript-prelude/src/Data/Eq/Generic.purs","start":[16,1]},"title":"genericEqNoArguments"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Eq","Generic"],"GenericEq"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"b","tag":"TypeVar"}],"constraintClass":[["Data","Eq","Generic"],"GenericEq"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Eq","Generic"],"GenericEq"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Generic","Rep"],"Sum"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[22,25],"name":"../../../support/bower_components/purescript-prelude/src/Data/Eq/Generic.purs","start":[19,1]},"title":"genericEqSum"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Eq","Generic"],"GenericEq"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"b","tag":"TypeVar"}],"constraintClass":[["Data","Eq","Generic"],"GenericEq"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Eq","Generic"],"GenericEq"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Generic","Rep"],"Product"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[25,84],"name":"../../../support/bower_components/purescript-prelude/src/Data/Eq/Generic.purs","start":[24,1]},"title":"genericEqProduct"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Eq","Generic"],"GenericEq"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Eq","Generic"],"GenericEq"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Generic","Rep"],"Constructor"],"tag":"TypeConstructor"},{"annotation":[],"contents":"name","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[28,66],"name":"../../../support/bower_components/purescript-prelude/src/Data/Eq/Generic.purs","start":[27,1]},"title":"genericEqConstructor"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Eq"],"Eq"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Eq","Generic"],"GenericEq"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Generic","Rep"],"Argument"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[31,52],"name":"../../../support/bower_components/purescript-prelude/src/Data/Eq/Generic.purs","start":[30,1]},"title":"genericEqArgument"}],"comments":null,"info":{"arguments":[["a",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[11,34],"name":"../../../support/bower_components/purescript-prelude/src/Data/Eq/Generic.purs","start":[10,1]},"title":"GenericEq"},{"children":[],"comments":"A `Generic` implementation of the `eq` member from the `Eq` type class.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"rep","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":"rep","tag":"TypeVar"}],"constraintClass":[["Data","Generic","Rep"],"Generic"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"rep","tag":"TypeVar"}],"constraintClass":[["Data","Eq","Generic"],"GenericEq"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[34,79],"name":"../../../support/bower_components/purescript-prelude/src/Data/Eq/Generic.purs","start":[34,1]},"title":"genericEq"}],"name":"Data.Eq.Generic","reExports":[]}
+ tests/purs/publish/basic-example/output/Data.Eq/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[36,26],"name":"../../../support/bower_components/purescript-prelude/src/Data/Eq.purs","start":[36,3]},"title":"eq"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Eq"],"Eq"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[48,21],"name":"../../../support/bower_components/purescript-prelude/src/Data/Eq.purs","start":[47,1]},"title":"eqBoolean"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Eq"],"Eq"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[51,17],"name":"../../../support/bower_components/purescript-prelude/src/Data/Eq.purs","start":[50,1]},"title":"eqInt"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Eq"],"Eq"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Number"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[54,20],"name":"../../../support/bower_components/purescript-prelude/src/Data/Eq.purs","start":[53,1]},"title":"eqNumber"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Eq"],"Eq"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Char"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[57,18],"name":"../../../support/bower_components/purescript-prelude/src/Data/Eq.purs","start":[56,1]},"title":"eqChar"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Eq"],"Eq"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[60,20],"name":"../../../support/bower_components/purescript-prelude/src/Data/Eq.purs","start":[59,1]},"title":"eqString"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Eq"],"Eq"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[63,16],"name":"../../../support/bower_components/purescript-prelude/src/Data/Eq.purs","start":[62,1]},"title":"eqUnit"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Eq"],"Eq"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Void"],"Void"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[66,16],"name":"../../../support/bower_components/purescript-prelude/src/Data/Eq.purs","start":[65,1]},"title":"eqVoid"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Eq"],"Eq"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Eq"],"Eq"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Array"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[69,22],"name":"../../../support/bower_components/purescript-prelude/src/Data/Eq.purs","start":[68,1]},"title":"eqArray"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"row","tag":"TypeVar"},{"annotation":[],"contents":"list","tag":"TypeVar"}],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"list","tag":"TypeVar"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"constraintClass":[["Data","Eq"],"EqRecord"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Eq"],"Eq"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[72,38],"name":"../../../support/bower_components/purescript-prelude/src/Data/Eq.purs","start":[71,1]},"title":"eqRec"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Eq"],"Eq"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[75,16],"name":"../../../support/bower_components/purescript-prelude/src/Data/Eq.purs","start":[74,1]},"title":"eqProxy"}],"comments":"The `Eq` type class represents types which support decidable equality.\n\n`Eq` instances should satisfy the following laws:\n\n- Reflexivity: `x == x = true`\n- Symmetry: `x == y = y == x`\n- Transitivity: if `x == y` and `y == z` then `x == z`\n\n**Note:** The `Number` type is not an entirely law abiding member of this\nclass due to the presence of `NaN`, since `NaN /= NaN`. Additionally,\ncomputing with `Number` can result in a loss of precision, so sometimes\nvalues that should be equivalent are not.\n","info":{"arguments":[["a",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[36,26],"name":"../../../support/bower_components/purescript-prelude/src/Data/Eq.purs","start":[35,1]},"title":"Eq"},{"children":[],"comments":null,"info":{"alias":[["Data","Eq"],{"Right":{"Left":{"Ident":"eq"}}}],"declType":"alias","fixity":{"associativity":"infix","precedence":4}},"kind":null,"sourceSpan":{"end":[38,17],"name":"../../../support/bower_components/purescript-prelude/src/Data/Eq.purs","start":[38,1]},"title":"(==)"},{"children":[],"comments":"`notEq` tests whether one value is _not equal_ to another. Shorthand for\n`not (eq x y)`.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Eq"],"Eq"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[42,45],"name":"../../../support/bower_components/purescript-prelude/src/Data/Eq.purs","start":[42,1]},"title":"notEq"},{"children":[],"comments":null,"info":{"alias":[["Data","Eq"],{"Right":{"Left":{"Ident":"notEq"}}}],"declType":"alias","fixity":{"associativity":"infix","precedence":4}},"kind":null,"sourceSpan":{"end":[45,20],"name":"../../../support/bower_components/purescript-prelude/src/Data/Eq.purs","start":[45,1]},"title":"(/=)"},{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Eq"],"Eq"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[87,49],"name":"../../../support/bower_components/purescript-prelude/src/Data/Eq.purs","start":[87,3]},"title":"eq1"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Eq"],"Eq1"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Array"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[90,11],"name":"../../../support/bower_components/purescript-prelude/src/Data/Eq.purs","start":[89,1]},"title":"eq1Array"}],"comments":"The `Eq1` type class represents type constructors with decidable equality.\n","info":{"arguments":[["f",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":{"keyword":"class","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Constraint"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[87,49],"name":"../../../support/bower_components/purescript-prelude/src/Data/Eq.purs","start":[86,1]},"title":"Eq1"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"f","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"f","tag":"TypeVar"}],"constraintClass":[["Data","Eq"],"Eq1"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Eq"],"Eq"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[92,61],"name":"../../../support/bower_components/purescript-prelude/src/Data/Eq.purs","start":[92,1]},"title":"notEq1"},{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"},{"annotation":[],"contents":"rowlist","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[99,67],"name":"../../../support/bower_components/purescript-prelude/src/Data/Eq.purs","start":[99,3]},"title":"eqRecord"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Eq"],"EqRecord"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim","RowList"],"Nil"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"}},"sourceSpan":{"end":[102,24],"name":"../../../support/bower_components/purescript-prelude/src/Data/Eq.purs","start":[101,1]},"title":"eqRowNil"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"rowlistTail","tag":"TypeVar"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"constraintClass":[["Data","Eq"],"EqRecord"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"key","tag":"TypeVar"},{"annotation":[],"contents":"focus","tag":"TypeVar"},{"annotation":[],"contents":"rowTail","tag":"TypeVar"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"constraintClass":[["Prim","Row"],"Cons"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"key","tag":"TypeVar"}],"constraintClass":[["Data","Symbol"],"IsSymbol"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"focus","tag":"TypeVar"}],"constraintClass":[["Data","Eq"],"Eq"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Eq"],"EqRecord"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim","RowList"],"Cons"],"tag":"TypeConstructor"},{"annotation":[],"contents":"key","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"focus","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"rowlistTail","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"}},"sourceSpan":{"end":[115,55],"name":"../../../support/bower_components/purescript-prelude/src/Data/Eq.purs","start":[104,1]},"title":"eqRowCons"}],"comments":"A class for records where all fields have `Eq` instances, used to implement\nthe `Eq` instance for records.\n","info":{"arguments":[["rowlist",null],["row",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":{"keyword":"class","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim","RowList"],"RowList"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Constraint"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[99,67],"name":"../../../support/bower_components/purescript-prelude/src/Data/Eq.purs","start":[98,1]},"title":"EqRecord"}],"name":"Data.Eq","reExports":[]}
+ tests/purs/publish/basic-example/output/Data.EuclideanRing/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[68,21],"name":"../../../support/bower_components/purescript-prelude/src/Data/EuclideanRing.purs","start":[68,3]},"title":"degree"},{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[69,21],"name":"../../../support/bower_components/purescript-prelude/src/Data/EuclideanRing.purs","start":[69,3]},"title":"div"},{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[70,21],"name":"../../../support/bower_components/purescript-prelude/src/Data/EuclideanRing.purs","start":[70,3]},"title":"mod"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","EuclideanRing"],"EuclideanRing"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[77,15],"name":"../../../support/bower_components/purescript-prelude/src/Data/EuclideanRing.purs","start":[74,1]},"title":"euclideanRingInt"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","EuclideanRing"],"EuclideanRing"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Number"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[82,16],"name":"../../../support/bower_components/purescript-prelude/src/Data/EuclideanRing.purs","start":[79,1]},"title":"euclideanRingNumber"}],"comments":"The `EuclideanRing` class is for commutative rings that support division.\nThe mathematical structure this class is based on is sometimes also called\na *Euclidean domain*.\n\nInstances must satisfy the following laws in addition to the `Ring`\nlaws:\n\n- Integral domain: `one /= zero`, and if `a` and `b` are both nonzero then\n so is their product `a * b`\n- Euclidean function `degree`:\n - Nonnegativity: For all nonzero `a`, `degree a >= 0`\n - Quotient/remainder: For all `a` and `b`, where `b` is nonzero,\n let `q = a / b` and ``r = a `mod` b``; then `a = q*b + r`, and also\n either `r = zero` or `degree r < degree b`\n- Submultiplicative euclidean function:\n - For all nonzero `a` and `b`, `degree a <= degree (a * b)`\n\nThe behaviour of division by `zero` is unconstrained by these laws,\nmeaning that individual instances are free to choose how to behave in this\ncase. Similarly, there are no restrictions on what the result of\n`degree zero` is; it doesn't make sense to ask for `degree zero` in the\nsame way that it doesn't make sense to divide by `zero`, so again,\nindividual instances may choose how to handle this case.\n\nFor any `EuclideanRing` which is also a `Field`, one valid choice\nfor `degree` is simply `const 1`. In fact, unless there's a specific\nreason not to, `Field` types should normally use this definition of\n`degree`.\n\nThe `EuclideanRing Int` instance is one of the most commonly used\n`EuclideanRing` instances and deserves a little more discussion. In\nparticular, there are a few different sensible law-abiding implementations\nto choose from, with slightly different behaviour in the presence of\nnegative dividends or divisors. The most common definitions are \"truncating\"\ndivision, where the result of `a / b` is rounded towards 0, and \"Knuthian\"\nor \"flooring\" division, where the result of `a / b` is rounded towards\nnegative infinity. A slightly less common, but arguably more useful, option\nis \"Euclidean\" division, which is defined so as to ensure that ``a `mod` b``\nis always nonnegative. With Euclidean division, `a / b` rounds towards\nnegative infinity if the divisor is positive, and towards positive infinity\nif the divisor is negative. Note that all three definitions are identical if\nwe restrict our attention to nonnegative dividends and divisors.\n\nIn versions 1.x, 2.x, and 3.x of the Prelude, the `EuclideanRing Int`\ninstance used truncating division. As of 4.x, the `EuclideanRing Int`\ninstance uses Euclidean division. Additional functions `quot` and `rem` are\nsupplied if truncating division is desired.\n","info":{"arguments":[["a",null]],"declType":"typeClass","fundeps":[],"superclasses":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","CommutativeRing"],"CommutativeRing"],"constraintData":null,"constraintKindArgs":[]}]},"kind":null,"sourceSpan":{"end":[70,21],"name":"../../../support/bower_components/purescript-prelude/src/Data/EuclideanRing.purs","start":[67,1]},"title":"EuclideanRing"},{"children":[],"comments":null,"info":{"alias":[["Data","EuclideanRing"],{"Right":{"Left":{"Ident":"div"}}}],"declType":"alias","fixity":{"associativity":"infixl","precedence":7}},"kind":null,"sourceSpan":{"end":[72,18],"name":"../../../support/bower_components/purescript-prelude/src/Data/EuclideanRing.purs","start":[72,1]},"title":"(/)"},{"children":[],"comments":"The *greatest common divisor* of two values.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Eq"],"Eq"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","EuclideanRing"],"EuclideanRing"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[91,56],"name":"../../../support/bower_components/purescript-prelude/src/Data/EuclideanRing.purs","start":[91,1]},"title":"gcd"},{"children":[],"comments":"The *least common multiple* of two values.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Eq"],"Eq"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","EuclideanRing"],"EuclideanRing"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[97,56],"name":"../../../support/bower_components/purescript-prelude/src/Data/EuclideanRing.purs","start":[97,1]},"title":"lcm"}],"name":"Data.EuclideanRing","reExports":[]}
+ tests/purs/publish/basic-example/output/Data.Field/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","EuclideanRing"],"EuclideanRing"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","DivisionRing"],"DivisionRing"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Field"],"Field"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}},"sourceSpan":{"end":[41,63],"name":"../../../support/bower_components/purescript-prelude/src/Data/Field.purs","start":[41,1]},"title":"field"}],"comments":"The `Field` class is for types that are (commutative) fields.\n\nMathematically, a field is a ring which is commutative and in which every\nnonzero element has a multiplicative inverse; these conditions correspond\nto the `CommutativeRing` and `DivisionRing` classes in PureScript\nrespectively. However, the `Field` class has `EuclideanRing` and\n`DivisionRing` as superclasses, which seems like a stronger requirement\n(since `CommutativeRing` is a superclass of `EuclideanRing`). In fact, it\nis not stronger, since any type which has law-abiding `CommutativeRing`\nand `DivisionRing` instances permits exactly one law-abiding\n`EuclideanRing` instance. We use a `EuclideanRing` superclass here in\norder to ensure that a `Field` constraint on a function permits you to use\n`div` on that type, since `div` is a member of `EuclideanRing`.\n\nThis class has no laws or members of its own; it exists as a convenience,\nso a single constraint can be used when field-like behaviour is expected.\n\nThis module also defines a single `Field` instance for any type which has\nboth `EuclideanRing` and `DivisionRing` instances. Any other instance\nwould overlap with this instance, so no other `Field` instances should be\ndefined in libraries. Instead, simply define `EuclideanRing` and\n`DivisionRing` instances, and this will permit your type to be used with a\n`Field` constraint.\n","info":{"arguments":[["a",null]],"declType":"typeClass","fundeps":[],"superclasses":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","EuclideanRing"],"EuclideanRing"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","DivisionRing"],"DivisionRing"],"constraintData":null,"constraintKindArgs":[]}]},"kind":null,"sourceSpan":{"end":[39,51],"name":"../../../support/bower_components/purescript-prelude/src/Data/Field.purs","start":[39,1]},"title":"Field"}],"name":"Data.Field","reExports":[]}
+ tests/purs/publish/basic-example/output/Data.Function/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[],"comments":"Given a function that takes two arguments, applies the arguments\nto the function in a swapped order.\n\n```purescript\nflip append \"1\" \"2\" == append \"2\" \"1\" == \"21\"\n\nconst 1 \"two\" == 1\n\nflip const 1 \"two\" == const \"two\" 1 == \"two\"\n```\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"c","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[28,51],"name":"../../../support/bower_components/purescript-prelude/src/Data/Function.purs","start":[28,1]},"title":"flip"},{"children":[],"comments":"Returns its first argument and ignores its second.\n\n```purescript\nconst 1 \"hello\" = 1\n```\n\nIt can also be thought of as creating a function that ignores its argument:\n\n```purescript\nconst 1 = \\_ -> 1\n```\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[42,33],"name":"../../../support/bower_components/purescript-prelude/src/Data/Function.purs","start":[42,1]},"title":"const"},{"children":[],"comments":"Applies a function to an argument. This is primarily used as the operator\n`($)` which allows parentheses to be omitted in some cases, or as a\nnatural way to apply a chain of composed functions to a value.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[48,40],"name":"../../../support/bower_components/purescript-prelude/src/Data/Function.purs","start":[48,1]},"title":"apply"},{"children":[],"comments":"Applies a function to an argument: the reverse of `(#)`.\n\n```purescript\nlength $ groupBy productCategory $ filter isInStock $ products\n```\n\nis equivalent to:\n\n```purescript\nlength (groupBy productCategory (filter isInStock products))\n```\n\nOr another alternative equivalent, applying chain of composed functions to\na value:\n\n```purescript\nlength <<< groupBy productCategory <<< filter isInStock $ products\n```\n","info":{"alias":[["Data","Function"],{"Right":{"Left":{"Ident":"apply"}}}],"declType":"alias","fixity":{"associativity":"infixr","precedence":0}},"kind":null,"sourceSpan":{"end":[69,20],"name":"../../../support/bower_components/purescript-prelude/src/Data/Function.purs","start":[69,1]},"title":"($)"},{"children":[],"comments":"Applies an argument to a function. This is primarily used as the `(#)`\noperator, which allows parentheses to be omitted in some cases, or as a\nnatural way to apply a value to a chain of composed functions.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[74,47],"name":"../../../support/bower_components/purescript-prelude/src/Data/Function.purs","start":[74,1]},"title":"applyFlipped"},{"children":[],"comments":"Applies an argument to a function: the reverse of `($)`.\n\n```purescript\nproducts # filter isInStock # groupBy productCategory # length\n```\n\nis equivalent to:\n\n```purescript\nlength (groupBy productCategory (filter isInStock products))\n```\n\nOr another alternative equivalent, applying a value to a chain of composed\nfunctions:\n\n```purescript\nproducts # filter isInStock >>> groupBy productCategory >>> length\n```\n","info":{"alias":[["Data","Function"],{"Right":{"Left":{"Ident":"applyFlipped"}}}],"declType":"alias","fixity":{"associativity":"infixl","precedence":1}},"kind":null,"sourceSpan":{"end":[95,27],"name":"../../../support/bower_components/purescript-prelude/src/Data/Function.purs","start":[95,1]},"title":"(#)"},{"children":[],"comments":"`applyN f n` applies the function `f` to its argument `n` times.\n\nIf n is less than or equal to 0, the function is not applied.\n\n```purescript\napplyN (_ + 1) 10 0 == 10\n```\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[104,46],"name":"../../../support/bower_components/purescript-prelude/src/Data/Function.purs","start":[104,1]},"title":"applyN"},{"children":[],"comments":"The `on` function is used to change the domain of a binary operator.\n\nFor example, we can create a function which compares two records based on the values of their `x` properties:\n\n```purescript\ncompareX :: forall r. { x :: Number | r } -> { x :: Number | r } -> Ordering\ncompareX = compare `on` _.x\n```\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"c","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[119,61],"name":"../../../support/bower_components/purescript-prelude/src/Data/Function.purs","start":[119,1]},"title":"on"}],"name":"Data.Function","reExports":[]}
+ tests/purs/publish/basic-example/output/Data.Functor/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[32,44],"name":"../../../support/bower_components/purescript-prelude/src/Data/Functor.purs","start":[32,3]},"title":"map"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Functor"],"Functor"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[47,16],"name":"../../../support/bower_components/purescript-prelude/src/Data/Functor.purs","start":[46,1]},"title":"functorFn"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Functor"],"Functor"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Array"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[50,17],"name":"../../../support/bower_components/purescript-prelude/src/Data/Functor.purs","start":[49,1]},"title":"functorArray"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Functor"],"Functor"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[53,18],"name":"../../../support/bower_components/purescript-prelude/src/Data/Functor.purs","start":[52,1]},"title":"functorProxy"}],"comments":"A `Functor` is a type constructor which supports a mapping operation\n`map`.\n\n`map` can be used to turn functions `a -> b` into functions\n`f a -> f b` whose argument and return types use the type constructor `f`\nto represent some computational context.\n\nInstances must satisfy the following laws:\n\n- Identity: `map identity = identity`\n- Composition: `map (f <<< g) = map f <<< map g`\n","info":{"arguments":[["f",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":{"keyword":"class","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Constraint"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[32,44],"name":"../../../support/bower_components/purescript-prelude/src/Data/Functor.purs","start":[31,1]},"title":"Functor"},{"children":[],"comments":null,"info":{"alias":[["Data","Functor"],{"Right":{"Left":{"Ident":"map"}}}],"declType":"alias","fixity":{"associativity":"infixl","precedence":4}},"kind":null,"sourceSpan":{"end":[34,20],"name":"../../../support/bower_components/purescript-prelude/src/Data/Functor.purs","start":[34,1]},"title":"(<$>)"},{"children":[],"comments":"`mapFlipped` is `map` with its arguments reversed. For example:\n\n```purescript\n[1, 2, 3] <#> \\n -> n * n\n```\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"f","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"f","tag":"TypeVar"}],"constraintClass":[["Data","Functor"],"Functor"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[41,64],"name":"../../../support/bower_components/purescript-prelude/src/Data/Functor.purs","start":[41,1]},"title":"mapFlipped"},{"children":[],"comments":null,"info":{"alias":[["Data","Functor"],{"Right":{"Left":{"Ident":"mapFlipped"}}}],"declType":"alias","fixity":{"associativity":"infixl","precedence":1}},"kind":null,"sourceSpan":{"end":[44,27],"name":"../../../support/bower_components/purescript-prelude/src/Data/Functor.purs","start":[44,1]},"title":"(<#>)"},{"children":[],"comments":"The `void` function is used to ignore the type wrapped by a\n[`Functor`](#functor), replacing it with `Unit` and keeping only the type\ninformation provided by the type constructor itself.\n\n`void` is often useful when using `do` notation to change the return type\nof a monadic computation:\n\n```purescript\nmain = forE 1 10 \\n -> void do\n print n\n print (n * n)\n```\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"f","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"f","tag":"TypeVar"}],"constraintClass":[["Data","Functor"],"Functor"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[69,47],"name":"../../../support/bower_components/purescript-prelude/src/Data/Functor.purs","start":[69,1]},"title":"void"},{"children":[],"comments":"Ignore the return value of a computation, using the specified return value\ninstead.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"f","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"f","tag":"TypeVar"}],"constraintClass":[["Data","Functor"],"Functor"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[74,56],"name":"../../../support/bower_components/purescript-prelude/src/Data/Functor.purs","start":[74,1]},"title":"voidRight"},{"children":[],"comments":null,"info":{"alias":[["Data","Functor"],{"Right":{"Left":{"Ident":"voidRight"}}}],"declType":"alias","fixity":{"associativity":"infixl","precedence":4}},"kind":null,"sourceSpan":{"end":[77,25],"name":"../../../support/bower_components/purescript-prelude/src/Data/Functor.purs","start":[77,1]},"title":"(<$)"},{"children":[],"comments":"A version of `voidRight` with its arguments flipped.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"f","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"f","tag":"TypeVar"}],"constraintClass":[["Data","Functor"],"Functor"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[80,55],"name":"../../../support/bower_components/purescript-prelude/src/Data/Functor.purs","start":[80,1]},"title":"voidLeft"},{"children":[],"comments":null,"info":{"alias":[["Data","Functor"],{"Right":{"Left":{"Ident":"voidLeft"}}}],"declType":"alias","fixity":{"associativity":"infixl","precedence":4}},"kind":null,"sourceSpan":{"end":[83,24],"name":"../../../support/bower_components/purescript-prelude/src/Data/Functor.purs","start":[83,1]},"title":"($>)"},{"children":[],"comments":"Apply a value in a computational context to a value in no context.\n\nGeneralizes `flip`.\n\n```purescript\nlongEnough :: String -> Bool\nhasSymbol :: String -> Bool\nhasDigit :: String -> Bool\npassword :: String\n\nvalidate :: String -> Array Bool\nvalidate = flap [longEnough, hasSymbol, hasDigit]\n```\n\n```purescript\nflap (-) 3 4 == 1\nthreeve <$> Just 1 <@> 'a' <*> Just true == Just (threeve 1 'a' true)\n```\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"f","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"f","tag":"TypeVar"}],"constraintClass":[["Data","Functor"],"Functor"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[103,58],"name":"../../../support/bower_components/purescript-prelude/src/Data/Functor.purs","start":[103,1]},"title":"flap"},{"children":[],"comments":null,"info":{"alias":[["Data","Functor"],{"Right":{"Left":{"Ident":"flap"}}}],"declType":"alias","fixity":{"associativity":"infixl","precedence":4}},"kind":null,"sourceSpan":{"end":[106,21],"name":"../../../support/bower_components/purescript-prelude/src/Data/Functor.purs","start":[106,1]},"title":"(<@>)"}],"name":"Data.Functor","reExports":[]}
+ tests/purs/publish/basic-example/output/Data.Generic.Rep/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"rep","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}},"sourceSpan":{"end":[58,17],"name":"../../../support/bower_components/purescript-prelude/src/Data/Generic/Rep.purs","start":[58,3]},"title":"to"},{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"rep","tag":"TypeVar"}],"tag":"TypeApp"}},"sourceSpan":{"end":[59,19],"name":"../../../support/bower_components/purescript-prelude/src/Data/Generic/Rep.purs","start":[59,3]},"title":"from"}],"comments":"The `Generic` class asserts the existence of a type function from types\nto their representations using the type constructors defined in this module.\n","info":{"arguments":[["a",null],["rep",null]],"declType":"typeClass","fundeps":[[["a"],["rep"]]],"superclasses":[]},"kind":null,"sourceSpan":{"end":[59,19],"name":"../../../support/bower_components/purescript-prelude/src/Data/Generic/Rep.purs","start":[57,1]},"title":"Generic"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"rep","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":"rep","tag":"TypeVar"}],"constraintClass":[["Data","Generic","Rep"],"Generic"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"},{"annotation":[],"contents":"rep","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[61,61],"name":"../../../support/bower_components/purescript-prelude/src/Data/Generic/Rep.purs","start":[61,1]},"title":"repOf"},{"children":[],"comments":"A representation for types with no constructors.\n","info":{"dataDeclType":"newtype","declType":"data","roles":[],"typeArguments":[]},"kind":null,"sourceSpan":{"end":[21,45],"name":"../../../support/bower_components/purescript-prelude/src/Data/Generic/Rep.purs","start":[21,1]},"title":"NoConstructors"},{"children":[{"comments":null,"info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":{"end":[24,31],"name":"../../../support/bower_components/purescript-prelude/src/Data/Generic/Rep.purs","start":[24,18]},"title":"NoArguments"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Show"],"Show"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Generic","Rep"],"NoArguments"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[27,25],"name":"../../../support/bower_components/purescript-prelude/src/Data/Generic/Rep.purs","start":[26,1]},"title":"showNoArguments"}],"comments":"A representation for constructors with no arguments.\n","info":{"dataDeclType":"data","declType":"data","roles":[],"typeArguments":[]},"kind":null,"sourceSpan":{"end":[24,31],"name":"../../../support/bower_components/purescript-prelude/src/Data/Generic/Rep.purs","start":[24,1]},"title":"NoArguments"},{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"declType":"dataConstructor"},"sourceSpan":{"end":[30,19],"name":"../../../support/bower_components/purescript-prelude/src/Data/Generic/Rep.purs","start":[30,14]},"title":"Inl"},{"comments":null,"info":{"arguments":[{"annotation":[],"contents":"b","tag":"TypeVar"}],"declType":"dataConstructor"},"sourceSpan":{"end":[30,27],"name":"../../../support/bower_components/purescript-prelude/src/Data/Generic/Rep.purs","start":[30,22]},"title":"Inr"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Show"],"Show"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"b","tag":"TypeVar"}],"constraintClass":[["Data","Show"],"Show"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Show"],"Show"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Generic","Rep"],"Sum"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[34,42],"name":"../../../support/bower_components/purescript-prelude/src/Data/Generic/Rep.purs","start":[32,1]},"title":"showSum"}],"comments":"A representation for types with multiple constructors.\n","info":{"dataDeclType":"data","declType":"data","roles":["Representational","Representational"],"typeArguments":[["a",null],["b",null]]},"kind":null,"sourceSpan":{"end":[30,29],"name":"../../../support/bower_components/purescript-prelude/src/Data/Generic/Rep.purs","start":[30,1]},"title":"Sum"},{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"declType":"dataConstructor"},"sourceSpan":{"end":[37,27],"name":"../../../support/bower_components/purescript-prelude/src/Data/Generic/Rep.purs","start":[37,18]},"title":"Product"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Show"],"Show"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"b","tag":"TypeVar"}],"constraintClass":[["Data","Show"],"Show"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Show"],"Show"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Generic","Rep"],"Product"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[40,69],"name":"../../../support/bower_components/purescript-prelude/src/Data/Generic/Rep.purs","start":[39,1]},"title":"showProduct"}],"comments":"A representation for constructors with multiple fields.\n","info":{"dataDeclType":"data","declType":"data","roles":["Representational","Representational"],"typeArguments":[["a",null],["b",null]]},"kind":null,"sourceSpan":{"end":[37,31],"name":"../../../support/bower_components/purescript-prelude/src/Data/Generic/Rep.purs","start":[37,1]},"title":"Product"},{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"declType":"dataConstructor"},"sourceSpan":{"end":[44,55],"name":"../../../support/bower_components/purescript-prelude/src/Data/Generic/Rep.purs","start":[44,40]},"title":"Constructor"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"name","tag":"TypeVar"}],"constraintClass":[["Data","Symbol"],"IsSymbol"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Show"],"Show"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Show"],"Show"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Generic","Rep"],"Constructor"],"tag":"TypeConstructor"},{"annotation":[],"contents":"name","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[47,112],"name":"../../../support/bower_components/purescript-prelude/src/Data/Generic/Rep.purs","start":[46,1]},"title":"showConstructor"}],"comments":"A representation for constructors which includes the data constructor name\nas a type-level string.\n","info":{"dataDeclType":"newtype","declType":"data","roles":["Phantom","Representational"],"typeArguments":[["name",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],["a",null]]},"kind":{"keyword":"newtype","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[44,55],"name":"../../../support/bower_components/purescript-prelude/src/Data/Generic/Rep.purs","start":[44,1]},"title":"Constructor"},{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"declType":"dataConstructor"},"sourceSpan":{"end":[50,32],"name":"../../../support/bower_components/purescript-prelude/src/Data/Generic/Rep.purs","start":[50,20]},"title":"Argument"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Show"],"Show"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Show"],"Show"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Generic","Rep"],"Argument"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[53,52],"name":"../../../support/bower_components/purescript-prelude/src/Data/Generic/Rep.purs","start":[52,1]},"title":"showArgument"}],"comments":"A representation for an argument in a data constructor.\n","info":{"dataDeclType":"newtype","declType":"data","roles":["Representational"],"typeArguments":[["a",null]]},"kind":null,"sourceSpan":{"end":[50,32],"name":"../../../support/bower_components/purescript-prelude/src/Data/Generic/Rep.purs","start":[50,1]},"title":"Argument"}],"name":"Data.Generic.Rep","reExports":[]}
+ tests/purs/publish/basic-example/output/Data.HeytingAlgebra.Generic/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":"a","tag":"TypeVar"}},"sourceSpan":{"end":[9,18],"name":"../../../support/bower_components/purescript-prelude/src/Data/HeytingAlgebra/Generic.purs","start":[9,3]},"title":"genericFF'"},{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":"a","tag":"TypeVar"}},"sourceSpan":{"end":[10,18],"name":"../../../support/bower_components/purescript-prelude/src/Data/HeytingAlgebra/Generic.purs","start":[10,3]},"title":"genericTT'"},{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[11,33],"name":"../../../support/bower_components/purescript-prelude/src/Data/HeytingAlgebra/Generic.purs","start":[11,3]},"title":"genericImplies'"},{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[12,30],"name":"../../../support/bower_components/purescript-prelude/src/Data/HeytingAlgebra/Generic.purs","start":[12,3]},"title":"genericConj'"},{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[13,30],"name":"../../../support/bower_components/purescript-prelude/src/Data/HeytingAlgebra/Generic.purs","start":[13,3]},"title":"genericDisj'"},{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}},"sourceSpan":{"end":[14,24],"name":"../../../support/bower_components/purescript-prelude/src/Data/HeytingAlgebra/Generic.purs","start":[14,3]},"title":"genericNot'"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","HeytingAlgebra","Generic"],"GenericHeytingAlgebra"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Generic","Rep"],"NoArguments"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[22,30],"name":"../../../support/bower_components/purescript-prelude/src/Data/HeytingAlgebra/Generic.purs","start":[16,1]},"title":"genericHeytingAlgebraNoArguments"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","HeytingAlgebra"],"HeytingAlgebra"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","HeytingAlgebra","Generic"],"GenericHeytingAlgebra"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Generic","Rep"],"Argument"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[30,46],"name":"../../../support/bower_components/purescript-prelude/src/Data/HeytingAlgebra/Generic.purs","start":[24,1]},"title":"genericHeytingAlgebraArgument"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","HeytingAlgebra","Generic"],"GenericHeytingAlgebra"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"b","tag":"TypeVar"}],"constraintClass":[["Data","HeytingAlgebra","Generic"],"GenericHeytingAlgebra"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","HeytingAlgebra","Generic"],"GenericHeytingAlgebra"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Generic","Rep"],"Product"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[38,70],"name":"../../../support/bower_components/purescript-prelude/src/Data/HeytingAlgebra/Generic.purs","start":[32,1]},"title":"genericHeytingAlgebraProduct"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","HeytingAlgebra","Generic"],"GenericHeytingAlgebra"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","HeytingAlgebra","Generic"],"GenericHeytingAlgebra"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Generic","Rep"],"Constructor"],"tag":"TypeConstructor"},{"annotation":[],"contents":"name","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[46,60],"name":"../../../support/bower_components/purescript-prelude/src/Data/HeytingAlgebra/Generic.purs","start":[40,1]},"title":"genericHeytingAlgebraConstructor"}],"comments":null,"info":{"arguments":[["a",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[14,24],"name":"../../../support/bower_components/purescript-prelude/src/Data/HeytingAlgebra/Generic.purs","start":[8,1]},"title":"GenericHeytingAlgebra"},{"children":[],"comments":"A `Generic` implementation of the `ff` member from the `HeytingAlgebra` type class.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"rep","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":"rep","tag":"TypeVar"}],"constraintClass":[["Data","Generic","Rep"],"Generic"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"rep","tag":"TypeVar"}],"constraintClass":[["Data","HeytingAlgebra","Generic"],"GenericHeytingAlgebra"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[49,75],"name":"../../../support/bower_components/purescript-prelude/src/Data/HeytingAlgebra/Generic.purs","start":[49,1]},"title":"genericFF"},{"children":[],"comments":"A `Generic` implementation of the `tt` member from the `HeytingAlgebra` type class.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"rep","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":"rep","tag":"TypeVar"}],"constraintClass":[["Data","Generic","Rep"],"Generic"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"rep","tag":"TypeVar"}],"constraintClass":[["Data","HeytingAlgebra","Generic"],"GenericHeytingAlgebra"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[53,75],"name":"../../../support/bower_components/purescript-prelude/src/Data/HeytingAlgebra/Generic.purs","start":[53,1]},"title":"genericTT"},{"children":[],"comments":"A `Generic` implementation of the `implies` member from the `HeytingAlgebra` type class.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"rep","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":"rep","tag":"TypeVar"}],"constraintClass":[["Data","Generic","Rep"],"Generic"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"rep","tag":"TypeVar"}],"constraintClass":[["Data","HeytingAlgebra","Generic"],"GenericHeytingAlgebra"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[57,90],"name":"../../../support/bower_components/purescript-prelude/src/Data/HeytingAlgebra/Generic.purs","start":[57,1]},"title":"genericImplies"},{"children":[],"comments":"A `Generic` implementation of the `conj` member from the `HeytingAlgebra` type class.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"rep","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":"rep","tag":"TypeVar"}],"constraintClass":[["Data","Generic","Rep"],"Generic"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"rep","tag":"TypeVar"}],"constraintClass":[["Data","HeytingAlgebra","Generic"],"GenericHeytingAlgebra"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[61,87],"name":"../../../support/bower_components/purescript-prelude/src/Data/HeytingAlgebra/Generic.purs","start":[61,1]},"title":"genericConj"},{"children":[],"comments":"A `Generic` implementation of the `disj` member from the `HeytingAlgebra` type class.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"rep","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":"rep","tag":"TypeVar"}],"constraintClass":[["Data","Generic","Rep"],"Generic"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"rep","tag":"TypeVar"}],"constraintClass":[["Data","HeytingAlgebra","Generic"],"GenericHeytingAlgebra"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[65,87],"name":"../../../support/bower_components/purescript-prelude/src/Data/HeytingAlgebra/Generic.purs","start":[65,1]},"title":"genericDisj"},{"children":[],"comments":"A `Generic` implementation of the `not` member from the `HeytingAlgebra` type class.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"rep","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":"rep","tag":"TypeVar"}],"constraintClass":[["Data","Generic","Rep"],"Generic"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"rep","tag":"TypeVar"}],"constraintClass":[["Data","HeytingAlgebra","Generic"],"GenericHeytingAlgebra"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[69,81],"name":"../../../support/bower_components/purescript-prelude/src/Data/HeytingAlgebra/Generic.purs","start":[69,1]},"title":"genericNot"}],"name":"Data.HeytingAlgebra.Generic","reExports":[]}
+ tests/purs/publish/basic-example/output/Data.HeytingAlgebra/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":"a","tag":"TypeVar"}},"sourceSpan":{"end":[53,10],"name":"../../../support/bower_components/purescript-prelude/src/Data/HeytingAlgebra.purs","start":[53,3]},"title":"ff"},{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":"a","tag":"TypeVar"}},"sourceSpan":{"end":[54,10],"name":"../../../support/bower_components/purescript-prelude/src/Data/HeytingAlgebra.purs","start":[54,3]},"title":"tt"},{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[55,25],"name":"../../../support/bower_components/purescript-prelude/src/Data/HeytingAlgebra.purs","start":[55,3]},"title":"implies"},{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[56,22],"name":"../../../support/bower_components/purescript-prelude/src/Data/HeytingAlgebra.purs","start":[56,3]},"title":"conj"},{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[57,22],"name":"../../../support/bower_components/purescript-prelude/src/Data/HeytingAlgebra.purs","start":[57,3]},"title":"disj"},{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}},"sourceSpan":{"end":[58,16],"name":"../../../support/bower_components/purescript-prelude/src/Data/HeytingAlgebra.purs","start":[58,3]},"title":"not"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","HeytingAlgebra"],"HeytingAlgebra"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[69,16],"name":"../../../support/bower_components/purescript-prelude/src/Data/HeytingAlgebra.purs","start":[63,1]},"title":"heytingAlgebraBoolean"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","HeytingAlgebra"],"HeytingAlgebra"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[77,15],"name":"../../../support/bower_components/purescript-prelude/src/Data/HeytingAlgebra.purs","start":[71,1]},"title":"heytingAlgebraUnit"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"b","tag":"TypeVar"}],"constraintClass":[["Data","HeytingAlgebra"],"HeytingAlgebra"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","HeytingAlgebra"],"HeytingAlgebra"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[85,22],"name":"../../../support/bower_components/purescript-prelude/src/Data/HeytingAlgebra.purs","start":[79,1]},"title":"heytingAlgebraFunction"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","HeytingAlgebra"],"HeytingAlgebra"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[93,13],"name":"../../../support/bower_components/purescript-prelude/src/Data/HeytingAlgebra.purs","start":[87,1]},"title":"heytingAlgebraProxy"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"row","tag":"TypeVar"},{"annotation":[],"contents":"list","tag":"TypeVar"}],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"list","tag":"TypeVar"},{"annotation":[],"contents":"row","tag":"TypeVar"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"constraintClass":[["Data","HeytingAlgebra"],"HeytingAlgebraRecord"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","HeytingAlgebra"],"HeytingAlgebra"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[101,40],"name":"../../../support/bower_components/purescript-prelude/src/Data/HeytingAlgebra.purs","start":[95,1]},"title":"heytingAlgebraRecord"}],"comments":"The `HeytingAlgebra` type class represents types that are bounded lattices with\nan implication operator such that the following laws hold:\n\n- Associativity:\n - `a || (b || c) = (a || b) || c`\n - `a && (b && c) = (a && b) && c`\n- Commutativity:\n - `a || b = b || a`\n - `a && b = b && a`\n- Absorption:\n - `a || (a && b) = a`\n - `a && (a || b) = a`\n- Idempotent:\n - `a || a = a`\n - `a && a = a`\n- Identity:\n - `a || ff = a`\n - `a && tt = a`\n- Implication:\n - ``a `implies` a = tt``\n - ``a && (a `implies` b) = a && b``\n - ``b && (a `implies` b) = b``\n - ``a `implies` (b && c) = (a `implies` b) && (a `implies` c)``\n- Complemented:\n - ``not a = a `implies` ff``\n","info":{"arguments":[["a",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[58,16],"name":"../../../support/bower_components/purescript-prelude/src/Data/HeytingAlgebra.purs","start":[52,1]},"title":"HeytingAlgebra"},{"children":[],"comments":null,"info":{"alias":[["Data","HeytingAlgebra"],{"Right":{"Left":{"Ident":"conj"}}}],"declType":"alias","fixity":{"associativity":"infixr","precedence":3}},"kind":null,"sourceSpan":{"end":[60,20],"name":"../../../support/bower_components/purescript-prelude/src/Data/HeytingAlgebra.purs","start":[60,1]},"title":"(&&)"},{"children":[],"comments":null,"info":{"alias":[["Data","HeytingAlgebra"],{"Right":{"Left":{"Ident":"disj"}}}],"declType":"alias","fixity":{"associativity":"infixr","precedence":2}},"kind":null,"sourceSpan":{"end":[61,20],"name":"../../../support/bower_components/purescript-prelude/src/Data/HeytingAlgebra.purs","start":[61,1]},"title":"(||)"},{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"},{"annotation":[],"contents":"rowlist","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"subrow","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[111,58],"name":"../../../support/bower_components/purescript-prelude/src/Data/HeytingAlgebra.purs","start":[111,3]},"title":"ffRecord"},{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"},{"annotation":[],"contents":"rowlist","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"subrow","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[112,58],"name":"../../../support/bower_components/purescript-prelude/src/Data/HeytingAlgebra.purs","start":[112,3]},"title":"ttRecord"},{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"},{"annotation":[],"contents":"rowlist","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"subrow","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[113,78],"name":"../../../support/bower_components/purescript-prelude/src/Data/HeytingAlgebra.purs","start":[113,3]},"title":"impliesRecord"},{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"},{"annotation":[],"contents":"rowlist","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"subrow","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[114,75],"name":"../../../support/bower_components/purescript-prelude/src/Data/HeytingAlgebra.purs","start":[114,3]},"title":"disjRecord"},{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"},{"annotation":[],"contents":"rowlist","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"subrow","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[115,75],"name":"../../../support/bower_components/purescript-prelude/src/Data/HeytingAlgebra.purs","start":[115,3]},"title":"conjRecord"},{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"},{"annotation":[],"contents":"rowlist","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"subrow","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[116,60],"name":"../../../support/bower_components/purescript-prelude/src/Data/HeytingAlgebra.purs","start":[116,3]},"title":"notRecord"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","HeytingAlgebra"],"HeytingAlgebraRecord"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim","RowList"],"Nil"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"tag":"REmpty"}],"tag":"TypeApp"}},"sourceSpan":{"end":[124,20],"name":"../../../support/bower_components/purescript-prelude/src/Data/HeytingAlgebra.purs","start":[118,1]},"title":"heytingAlgebraRecordNil"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"key","tag":"TypeVar"}],"constraintClass":[["Data","Symbol"],"IsSymbol"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"key","tag":"TypeVar"},{"annotation":[],"contents":"focus","tag":"TypeVar"},{"annotation":[],"contents":"subrowTail","tag":"TypeVar"},{"annotation":[],"contents":"subrow","tag":"TypeVar"}],"constraintClass":[["Prim","Row"],"Cons"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"rowlistTail","tag":"TypeVar"},{"annotation":[],"contents":"row","tag":"TypeVar"},{"annotation":[],"contents":"subrowTail","tag":"TypeVar"}],"constraintClass":[["Data","HeytingAlgebra"],"HeytingAlgebraRecord"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"focus","tag":"TypeVar"}],"constraintClass":[["Data","HeytingAlgebra"],"HeytingAlgebra"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","HeytingAlgebra"],"HeytingAlgebraRecord"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim","RowList"],"Cons"],"tag":"TypeConstructor"},{"annotation":[],"contents":"key","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"focus","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"rowlistTail","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"subrow","tag":"TypeVar"}],"tag":"TypeApp"}},"sourceSpan":{"end":[171,53],"name":"../../../support/bower_components/purescript-prelude/src/Data/HeytingAlgebra.purs","start":[126,1]},"title":"heytingAlgebraRecordCons"}],"comments":"A class for records where all fields have `HeytingAlgebra` instances, used\nto implement the `HeytingAlgebra` instance for records.\n","info":{"arguments":[["rowlist",null],["row",null],["subrow",null]],"declType":"typeClass","fundeps":[[["rowlist"],["subrow"]]],"superclasses":[]},"kind":{"keyword":"class","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim","RowList"],"RowList"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Constraint"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[116,60],"name":"../../../support/bower_components/purescript-prelude/src/Data/HeytingAlgebra.purs","start":[110,1]},"title":"HeytingAlgebraRecord"}],"name":"Data.HeytingAlgebra","reExports":[]}
+ tests/purs/publish/basic-example/output/Data.Monoid.Additive/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"declType":"dataConstructor"},"sourceSpan":{"end":[14,32],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Additive.purs","start":[14,20]},"title":"Additive"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Eq"],"Eq"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Eq"],"Eq"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Additive"],"Additive"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[16,62],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Additive.purs","start":[16,1]},"title":"eqAdditive"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Eq"],"Eq1"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Monoid","Additive"],"Additive"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[17,44],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Additive.purs","start":[17,1]},"title":"eq1Additive"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Ord"],"Ord"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ord"],"Ord"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Additive"],"Additive"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[19,65],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Additive.purs","start":[19,1]},"title":"ordAdditive"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ord"],"Ord1"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Monoid","Additive"],"Additive"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[20,46],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Additive.purs","start":[20,1]},"title":"ord1Additive"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Bounded"],"Bounded"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Bounded"],"Bounded"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Additive"],"Additive"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[22,77],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Additive.purs","start":[22,1]},"title":"boundedAdditive"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Show"],"Show"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Show"],"Show"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Additive"],"Additive"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[25,52],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Additive.purs","start":[24,1]},"title":"showAdditive"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Functor"],"Functor"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Monoid","Additive"],"Additive"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[27,52],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Additive.purs","start":[27,1]},"title":"functorAdditive"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Apply"],"Apply"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Monoid","Additive"],"Additive"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[30,51],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Additive.purs","start":[29,1]},"title":"applyAdditive"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Applicative"],"Applicative"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Monoid","Additive"],"Additive"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[33,18],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Additive.purs","start":[32,1]},"title":"applicativeAdditive"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Bind"],"Bind"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Monoid","Additive"],"Additive"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[36,28],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Additive.purs","start":[35,1]},"title":"bindAdditive"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Monad"],"Monad"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Monoid","Additive"],"Additive"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[38,41],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Additive.purs","start":[38,1]},"title":"monadAdditive"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Semiring"],"Semiring"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semigroup"],"Semigroup"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Additive"],"Additive"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[41,54],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Additive.purs","start":[40,1]},"title":"semigroupAdditive"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Semiring"],"Semiring"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid"],"Monoid"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Additive"],"Additive"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[44,25],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Additive.purs","start":[43,1]},"title":"monoidAdditive"}],"comments":"Monoid and semigroup for semirings under addition.\n\n``` purescript\nAdditive x <> Additive y == Additive (x + y)\n(mempty :: Additive _) == Additive zero\n```\n","info":{"dataDeclType":"newtype","declType":"data","roles":["Representational"],"typeArguments":[["a",null]]},"kind":null,"sourceSpan":{"end":[14,32],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Additive.purs","start":[14,1]},"title":"Additive"}],"name":"Data.Monoid.Additive","reExports":[]}
+ tests/purs/publish/basic-example/output/Data.Monoid.Conj/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"declType":"dataConstructor"},"sourceSpan":{"end":[15,24],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Conj.purs","start":[15,16]},"title":"Conj"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Eq"],"Eq"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Eq"],"Eq"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Conj"],"Conj"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[17,54],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Conj.purs","start":[17,1]},"title":"eqConj"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Eq"],"Eq1"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Monoid","Conj"],"Conj"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[18,36],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Conj.purs","start":[18,1]},"title":"eq1Conj"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Ord"],"Ord"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ord"],"Ord"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Conj"],"Conj"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[20,57],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Conj.purs","start":[20,1]},"title":"ordConj"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ord"],"Ord1"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Monoid","Conj"],"Conj"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[21,38],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Conj.purs","start":[21,1]},"title":"ord1Conj"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Bounded"],"Bounded"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Bounded"],"Bounded"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Conj"],"Conj"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[23,69],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Conj.purs","start":[23,1]},"title":"boundedConj"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Show"],"Show"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Show"],"Show"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Conj"],"Conj"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[26,44],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Conj.purs","start":[25,1]},"title":"showConj"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Functor"],"Functor"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Monoid","Conj"],"Conj"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[28,44],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Conj.purs","start":[28,1]},"title":"functorConj"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Apply"],"Apply"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Monoid","Conj"],"Conj"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[31,39],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Conj.purs","start":[30,1]},"title":"applyConj"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Applicative"],"Applicative"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Monoid","Conj"],"Conj"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[34,14],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Conj.purs","start":[33,1]},"title":"applicativeConj"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Bind"],"Bind"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Monoid","Conj"],"Conj"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[37,24],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Conj.purs","start":[36,1]},"title":"bindConj"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Monad"],"Monad"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Monoid","Conj"],"Conj"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[39,33],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Conj.purs","start":[39,1]},"title":"monadConj"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","HeytingAlgebra"],"HeytingAlgebra"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semigroup"],"Semigroup"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Conj"],"Conj"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[42,45],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Conj.purs","start":[41,1]},"title":"semigroupConj"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","HeytingAlgebra"],"HeytingAlgebra"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid"],"Monoid"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Conj"],"Conj"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[45,19],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Conj.purs","start":[44,1]},"title":"monoidConj"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","HeytingAlgebra"],"HeytingAlgebra"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semiring"],"Semiring"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Conj"],"Conj"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[51,42],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Conj.purs","start":[47,1]},"title":"semiringConj"}],"comments":"Monoid and semigroup for conjunction.\n\n``` purescript\nConj x <> Conj y == Conj (x && y)\n(mempty :: Conj _) == Conj tt\n```\n","info":{"dataDeclType":"newtype","declType":"data","roles":["Representational"],"typeArguments":[["a",null]]},"kind":null,"sourceSpan":{"end":[15,24],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Conj.purs","start":[15,1]},"title":"Conj"}],"name":"Data.Monoid.Conj","reExports":[]}
+ tests/purs/publish/basic-example/output/Data.Monoid.Disj/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"declType":"dataConstructor"},"sourceSpan":{"end":[15,24],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Disj.purs","start":[15,16]},"title":"Disj"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Eq"],"Eq"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Eq"],"Eq"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Disj"],"Disj"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[17,54],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Disj.purs","start":[17,1]},"title":"eqDisj"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Eq"],"Eq1"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Monoid","Disj"],"Disj"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[18,36],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Disj.purs","start":[18,1]},"title":"eq1Disj"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Ord"],"Ord"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ord"],"Ord"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Disj"],"Disj"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[20,57],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Disj.purs","start":[20,1]},"title":"ordDisj"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ord"],"Ord1"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Monoid","Disj"],"Disj"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[21,38],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Disj.purs","start":[21,1]},"title":"ord1Disj"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Bounded"],"Bounded"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Bounded"],"Bounded"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Disj"],"Disj"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[23,69],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Disj.purs","start":[23,1]},"title":"boundedDisj"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Show"],"Show"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Show"],"Show"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Disj"],"Disj"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[26,44],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Disj.purs","start":[25,1]},"title":"showDisj"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Functor"],"Functor"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Monoid","Disj"],"Disj"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[28,44],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Disj.purs","start":[28,1]},"title":"functorDisj"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Apply"],"Apply"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Monoid","Disj"],"Disj"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[31,39],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Disj.purs","start":[30,1]},"title":"applyDisj"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Applicative"],"Applicative"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Monoid","Disj"],"Disj"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[34,14],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Disj.purs","start":[33,1]},"title":"applicativeDisj"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Bind"],"Bind"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Monoid","Disj"],"Disj"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[37,24],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Disj.purs","start":[36,1]},"title":"bindDisj"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Monad"],"Monad"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Monoid","Disj"],"Disj"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[39,33],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Disj.purs","start":[39,1]},"title":"monadDisj"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","HeytingAlgebra"],"HeytingAlgebra"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semigroup"],"Semigroup"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Disj"],"Disj"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[42,45],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Disj.purs","start":[41,1]},"title":"semigroupDisj"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","HeytingAlgebra"],"HeytingAlgebra"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid"],"Monoid"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Disj"],"Disj"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[45,19],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Disj.purs","start":[44,1]},"title":"monoidDisj"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","HeytingAlgebra"],"HeytingAlgebra"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semiring"],"Semiring"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Disj"],"Disj"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[51,42],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Disj.purs","start":[47,1]},"title":"semiringDisj"}],"comments":"Monoid and semigroup for disjunction.\n\n``` purescript\nDisj x <> Disj y == Disj (x || y)\n(mempty :: Disj _) == Disj bottom\n```\n","info":{"dataDeclType":"newtype","declType":"data","roles":["Representational"],"typeArguments":[["a",null]]},"kind":null,"sourceSpan":{"end":[15,24],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Disj.purs","start":[15,1]},"title":"Disj"}],"name":"Data.Monoid.Disj","reExports":[]}
+ tests/purs/publish/basic-example/output/Data.Monoid.Dual/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"declType":"dataConstructor"},"sourceSpan":{"end":[14,24],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Dual.purs","start":[14,16]},"title":"Dual"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Eq"],"Eq"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Eq"],"Eq"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Dual"],"Dual"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[16,54],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Dual.purs","start":[16,1]},"title":"eqDual"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Eq"],"Eq1"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Monoid","Dual"],"Dual"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[17,36],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Dual.purs","start":[17,1]},"title":"eq1Dual"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Ord"],"Ord"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ord"],"Ord"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Dual"],"Dual"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[19,57],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Dual.purs","start":[19,1]},"title":"ordDual"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ord"],"Ord1"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Monoid","Dual"],"Dual"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[20,38],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Dual.purs","start":[20,1]},"title":"ord1Dual"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Bounded"],"Bounded"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Bounded"],"Bounded"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Dual"],"Dual"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[22,69],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Dual.purs","start":[22,1]},"title":"boundedDual"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Show"],"Show"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Show"],"Show"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Dual"],"Dual"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[25,44],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Dual.purs","start":[24,1]},"title":"showDual"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Functor"],"Functor"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Monoid","Dual"],"Dual"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[27,44],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Dual.purs","start":[27,1]},"title":"functorDual"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Apply"],"Apply"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Monoid","Dual"],"Dual"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[30,39],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Dual.purs","start":[29,1]},"title":"applyDual"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Applicative"],"Applicative"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Monoid","Dual"],"Dual"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[33,14],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Dual.purs","start":[32,1]},"title":"applicativeDual"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Bind"],"Bind"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Monoid","Dual"],"Dual"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[36,24],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Dual.purs","start":[35,1]},"title":"bindDual"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Monad"],"Monad"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Monoid","Dual"],"Dual"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[38,33],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Dual.purs","start":[38,1]},"title":"monadDual"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Semigroup"],"Semigroup"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semigroup"],"Semigroup"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Dual"],"Dual"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[41,43],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Dual.purs","start":[40,1]},"title":"semigroupDual"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Monoid"],"Monoid"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid"],"Monoid"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Dual"],"Dual"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[44,23],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Dual.purs","start":[43,1]},"title":"monoidDual"}],"comments":"The dual of a monoid.\n\n``` purescript\nDual x <> Dual y == Dual (y <> x)\n(mempty :: Dual _) == Dual mempty\n```\n","info":{"dataDeclType":"newtype","declType":"data","roles":["Representational"],"typeArguments":[["a",null]]},"kind":null,"sourceSpan":{"end":[14,24],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Dual.purs","start":[14,1]},"title":"Dual"}],"name":"Data.Monoid.Dual","reExports":[]}
+ tests/purs/publish/basic-example/output/Data.Monoid.Endo/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":"c","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"declType":"dataConstructor"},"sourceSpan":{"end":[15,32],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Endo.purs","start":[15,18]},"title":"Endo"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":"c","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"constraintClass":[["Data","Eq"],"Eq"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Eq"],"Eq"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Endo"],"Endo"],"tag":"TypeConstructor"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[17,62],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Endo.purs","start":[17,1]},"title":"eqEndo"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":"c","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"constraintClass":[["Data","Ord"],"Ord"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ord"],"Ord"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Endo"],"Endo"],"tag":"TypeConstructor"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[19,65],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Endo.purs","start":[19,1]},"title":"ordEndo"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":"c","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"constraintClass":[["Data","Bounded"],"Bounded"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Bounded"],"Bounded"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Endo"],"Endo"],"tag":"TypeConstructor"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[21,77],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Endo.purs","start":[21,1]},"title":"boundedEndo"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":"c","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"constraintClass":[["Data","Show"],"Show"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Show"],"Show"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Endo"],"Endo"],"tag":"TypeConstructor"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[24,44],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Endo.purs","start":[23,1]},"title":"showEndo"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"c","tag":"TypeVar"}],"constraintClass":[["Control","Semigroupoid"],"Semigroupoid"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semigroup"],"Semigroup"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Endo"],"Endo"],"tag":"TypeConstructor"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[27,44],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Endo.purs","start":[26,1]},"title":"semigroupEndo"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"c","tag":"TypeVar"}],"constraintClass":[["Control","Category"],"Category"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid"],"Monoid"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Endo"],"Endo"],"tag":"TypeConstructor"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[30,25],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Endo.purs","start":[29,1]},"title":"monoidEndo"}],"comments":"Monoid and semigroup for category endomorphisms.\n\nWhen `c` is instantiated with `->` this composes functions of type\n`a -> a`:\n\n``` purescript\nEndo f <> Endo g == Endo (f <<< g)\n(mempty :: Endo _) == Endo identity\n```\n","info":{"dataDeclType":"newtype","declType":"data","roles":["Representational","Nominal"],"typeArguments":[["c",null],["a",null]]},"kind":{"keyword":"newtype","kind":{"annotation":[],"contents":{"identifier":"k","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[15,32],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Endo.purs","start":[15,1]},"title":"Endo"}],"name":"Data.Monoid.Endo","reExports":[]}
+ tests/purs/publish/basic-example/output/Data.Monoid.Generic/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":"a","tag":"TypeVar"}},"sourceSpan":{"end":[11,22],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Generic.purs","start":[11,3]},"title":"genericMempty'"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Generic"],"GenericMonoid"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Generic","Rep"],"NoArguments"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[14,31],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Generic.purs","start":[13,1]},"title":"genericMonoidNoArguments"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Monoid","Generic"],"GenericMonoid"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"b","tag":"TypeVar"}],"constraintClass":[["Data","Monoid","Generic"],"GenericMonoid"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Generic"],"GenericMonoid"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Generic","Rep"],"Product"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[17,57],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Generic.purs","start":[16,1]},"title":"genericMonoidProduct"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Monoid","Generic"],"GenericMonoid"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Generic"],"GenericMonoid"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Generic","Rep"],"Constructor"],"tag":"TypeConstructor"},{"annotation":[],"contents":"name","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[20,46],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Generic.purs","start":[19,1]},"title":"genericMonoidConstructor"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Monoid"],"Monoid"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Generic"],"GenericMonoid"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Generic","Rep"],"Argument"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[23,35],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Generic.purs","start":[22,1]},"title":"genericMonoidArgument"}],"comments":null,"info":{"arguments":[["a",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[11,22],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Generic.purs","start":[10,1]},"title":"GenericMonoid"},{"children":[],"comments":"A `Generic` implementation of the `mempty` member from the `Monoid` type class.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"rep","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":"rep","tag":"TypeVar"}],"constraintClass":[["Data","Generic","Rep"],"Generic"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"rep","tag":"TypeVar"}],"constraintClass":[["Data","Monoid","Generic"],"GenericMonoid"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[26,71],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Generic.purs","start":[26,1]},"title":"genericMempty"}],"name":"Data.Monoid.Generic","reExports":[]}
+ tests/purs/publish/basic-example/output/Data.Monoid.Multiplicative/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"declType":"dataConstructor"},"sourceSpan":{"end":[14,44],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Multiplicative.purs","start":[14,26]},"title":"Multiplicative"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Eq"],"Eq"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Eq"],"Eq"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Multiplicative"],"Multiplicative"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[16,74],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Multiplicative.purs","start":[16,1]},"title":"eqMultiplicative"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Eq"],"Eq1"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Monoid","Multiplicative"],"Multiplicative"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[17,56],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Multiplicative.purs","start":[17,1]},"title":"eq1Multiplicative"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Ord"],"Ord"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ord"],"Ord"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Multiplicative"],"Multiplicative"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[19,77],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Multiplicative.purs","start":[19,1]},"title":"ordMultiplicative"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ord"],"Ord1"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Monoid","Multiplicative"],"Multiplicative"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[20,58],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Multiplicative.purs","start":[20,1]},"title":"ord1Multiplicative"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Bounded"],"Bounded"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Bounded"],"Bounded"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Multiplicative"],"Multiplicative"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[22,89],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Multiplicative.purs","start":[22,1]},"title":"boundedMultiplicative"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Show"],"Show"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Show"],"Show"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Multiplicative"],"Multiplicative"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[25,64],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Multiplicative.purs","start":[24,1]},"title":"showMultiplicative"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Functor"],"Functor"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Monoid","Multiplicative"],"Multiplicative"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[27,64],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Multiplicative.purs","start":[27,1]},"title":"functorMultiplicative"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Apply"],"Apply"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Monoid","Multiplicative"],"Multiplicative"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[30,69],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Multiplicative.purs","start":[29,1]},"title":"applyMultiplicative"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Applicative"],"Applicative"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Monoid","Multiplicative"],"Multiplicative"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[33,24],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Multiplicative.purs","start":[32,1]},"title":"applicativeMultiplicative"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Bind"],"Bind"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Monoid","Multiplicative"],"Multiplicative"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[36,34],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Multiplicative.purs","start":[35,1]},"title":"bindMultiplicative"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Monad"],"Monad"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Monoid","Multiplicative"],"Multiplicative"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[38,53],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Multiplicative.purs","start":[38,1]},"title":"monadMultiplicative"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Semiring"],"Semiring"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semigroup"],"Semigroup"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Multiplicative"],"Multiplicative"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[41,72],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Multiplicative.purs","start":[40,1]},"title":"semigroupMultiplicative"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Semiring"],"Semiring"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid"],"Monoid"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Multiplicative"],"Multiplicative"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[44,30],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Multiplicative.purs","start":[43,1]},"title":"monoidMultiplicative"}],"comments":"Monoid and semigroup for semirings under multiplication.\n\n``` purescript\nMultiplicative x <> Multiplicative y == Multiplicative (x * y)\n(mempty :: Multiplicative _) == Multiplicative one\n```\n","info":{"dataDeclType":"newtype","declType":"data","roles":["Representational"],"typeArguments":[["a",null]]},"kind":null,"sourceSpan":{"end":[14,44],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Multiplicative.purs","start":[14,1]},"title":"Multiplicative"}],"name":"Data.Monoid.Multiplicative","reExports":[]}
+ tests/purs/publish/basic-example/output/Data.Monoid/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":"m","tag":"TypeVar"}},"sourceSpan":{"end":[47,14],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid.purs","start":[47,3]},"title":"mempty"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid"],"Monoid"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[50,16],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid.purs","start":[49,1]},"title":"monoidUnit"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid"],"Monoid"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Ordering"],"Ordering"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[53,14],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid.purs","start":[52,1]},"title":"monoidOrdering"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"b","tag":"TypeVar"}],"constraintClass":[["Data","Monoid"],"Monoid"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid"],"Monoid"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[56,20],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid.purs","start":[55,1]},"title":"monoidFn"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid"],"Monoid"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[59,14],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid.purs","start":[58,1]},"title":"monoidString"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid"],"Monoid"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Array"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[62,14],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid.purs","start":[61,1]},"title":"monoidArray"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"row","tag":"TypeVar"},{"annotation":[],"contents":"list","tag":"TypeVar"}],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"list","tag":"TypeVar"},{"annotation":[],"contents":"row","tag":"TypeVar"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"constraintClass":[["Data","Monoid"],"MonoidRecord"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid"],"Monoid"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[65,46],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid.purs","start":[64,1]},"title":"monoidRecord"}],"comments":"A `Monoid` is a `Semigroup` with a value `mempty`, which is both a\nleft and right unit for the associative operation `<>`:\n\n- Left unit: `(mempty <> x) = x`\n- Right unit: `(x <> mempty) = x`\n\n`Monoid`s are commonly used as the result of fold operations, where\n`<>` is used to combine individual results, and `mempty` gives the result\nof folding an empty collection of elements.\n\n### Newtypes for Monoid\n\nSome types (e.g. `Int`, `Boolean`) can implement multiple law-abiding\ninstances for `Monoid`. Let's use `Int` as an example\n1. `<>` could be `+` and `mempty` could be `0`\n2. `<>` could be `*` and `mempty` could be `1`.\n\nTo clarify these ambiguous situations, one should use the newtypes\ndefined in `Data.Monoid.<NewtypeName>` modules.\n\nIn the above ambiguous situation, we could use `Additive`\nfor the first situation or `Multiplicative` for the second one.\n","info":{"arguments":[["m",null]],"declType":"typeClass","fundeps":[],"superclasses":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"m","tag":"TypeVar"}],"constraintClass":[["Data","Semigroup"],"Semigroup"],"constraintData":null,"constraintKindArgs":[]}]},"kind":null,"sourceSpan":{"end":[47,14],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid.purs","start":[46,1]},"title":"Monoid"},{"children":[],"comments":"Append a value to itself a certain number of times. For the\n`Multiplicative` type, and for a non-negative power, this is the same as\nnormal number exponentiation.\n\nIf the second argument is negative this function will return `mempty`\n(*unlike* normal number exponentiation). The `Monoid` constraint alone\nis not enough to write a `power` function with the property that `power x\nn` cancels with `power x (-n)`, i.e. `power x n <> power x (-n) = mempty`.\nFor that, we would additionally need the ability to invert elements, i.e.\na Group.\n\n```purescript\npower [1,2] 3 == [1,2,1,2,1,2]\npower [1,2] 1 == [1,2]\npower [1,2] 0 == []\npower [1,2] (-3) == []\n```\n\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"m","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"m","tag":"TypeVar"}],"constraintClass":[["Data","Monoid"],"Monoid"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"m","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":"m","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[85,45],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid.purs","start":[85,1]},"title":"power"},{"children":[],"comments":"Allow or \"truncate\" a Monoid to its `mempty` value based on a condition.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"m","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"m","tag":"TypeVar"}],"constraintClass":[["Data","Monoid"],"Monoid"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"m","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"m","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[96,49],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid.purs","start":[96,1]},"title":"guard"},{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"},{"annotation":[],"contents":"rowlist","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"subrow","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[104,49],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid.purs","start":[104,3]},"title":"memptyRecord"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid"],"MonoidRecord"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim","RowList"],"Nil"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"tag":"REmpty"}],"tag":"TypeApp"}},"sourceSpan":{"end":[107,22],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid.purs","start":[106,1]},"title":"monoidRecordNil"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"key","tag":"TypeVar"}],"constraintClass":[["Data","Symbol"],"IsSymbol"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"focus","tag":"TypeVar"}],"constraintClass":[["Data","Monoid"],"Monoid"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"key","tag":"TypeVar"},{"annotation":[],"contents":"focus","tag":"TypeVar"},{"annotation":[],"contents":"subrowTail","tag":"TypeVar"},{"annotation":[],"contents":"subrow","tag":"TypeVar"}],"constraintClass":[["Prim","Row"],"Cons"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"rowlistTail","tag":"TypeVar"},{"annotation":[],"contents":"row","tag":"TypeVar"},{"annotation":[],"contents":"subrowTail","tag":"TypeVar"}],"constraintClass":[["Data","Monoid"],"MonoidRecord"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid"],"MonoidRecord"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim","RowList"],"Cons"],"tag":"TypeConstructor"},{"annotation":[],"contents":"key","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"focus","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"rowlistTail","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"subrow","tag":"TypeVar"}],"tag":"TypeApp"}},"sourceSpan":{"end":[120,53],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid.purs","start":[109,1]},"title":"monoidRecordCons"}],"comments":"A class for records where all fields have `Monoid` instances, used to\nimplement the `Monoid` instance for records.\n","info":{"arguments":[["rowlist",null],["row",null],["subrow",null]],"declType":"typeClass","fundeps":[[["rowlist"],["row","subrow"]]],"superclasses":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"rowlist","tag":"TypeVar"},{"annotation":[],"contents":"row","tag":"TypeVar"},{"annotation":[],"contents":"subrow","tag":"TypeVar"}],"constraintClass":[["Data","Semigroup"],"SemigroupRecord"],"constraintData":null,"constraintKindArgs":[]}]},"kind":{"keyword":"class","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim","RowList"],"RowList"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Constraint"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[104,49],"name":"../../../support/bower_components/purescript-prelude/src/Data/Monoid.purs","start":[103,1]},"title":"MonoidRecord"}],"name":"Data.Monoid","reExports":[]}
+ tests/purs/publish/basic-example/output/Data.NaturalTransformation/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[],"comments":"A type for natural transformations.\n\nA natural transformation is a mapping between type constructors of kind\n`k -> Type`, for any kind `k`, where the mapping operation has no ability\nto manipulate the inner values.\n\nAn example of this is the `fromFoldable` function provided in\n`purescript-lists`, where some foldable structure containing values of\ntype `a` is converted into a `List a`.\n\nThe definition of a natural transformation in category theory states that\n`f` and `g` should be functors, but the `Functor` constraint is not\nenforced here; that the types are of kind `k -> Type` is enough for our\npurposes.\n","info":{"arguments":[["f",null],["g",null]],"declType":"typeSynonym","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"g","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":{"keyword":"type","kind":{"annotation":[],"contents":{"identifier":"k","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[18,54],"name":"../../../support/bower_components/purescript-prelude/src/Data/NaturalTransformation.purs","start":[18,1]},"title":"NaturalTransformation"},{"children":[],"comments":null,"info":{"alias":[["Data","NaturalTransformation"],{"Left":"NaturalTransformation"}],"declType":"alias","fixity":{"associativity":"infixr","precedence":4}},"kind":null,"sourceSpan":{"end":[20,42],"name":"../../../support/bower_components/purescript-prelude/src/Data/NaturalTransformation.purs","start":[20,1]},"title":"type (~>)"}],"name":"Data.NaturalTransformation","reExports":[]}
+ tests/purs/publish/basic-example/output/Data.Newtype/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Newtype"],"Newtype"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Additive"],"Additive"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}},"sourceSpan":{"end":[37,51],"name":"../../../support/bower_components/purescript-newtype/src/Data/Newtype.purs","start":[37,1]},"title":"newtypeAdditive"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Newtype"],"Newtype"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Multiplicative"],"Multiplicative"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}},"sourceSpan":{"end":[39,63],"name":"../../../support/bower_components/purescript-newtype/src/Data/Newtype.purs","start":[39,1]},"title":"newtypeMultiplicative"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Newtype"],"Newtype"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Conj"],"Conj"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}},"sourceSpan":{"end":[41,43],"name":"../../../support/bower_components/purescript-newtype/src/Data/Newtype.purs","start":[41,1]},"title":"newtypeConj"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Newtype"],"Newtype"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Disj"],"Disj"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}},"sourceSpan":{"end":[43,43],"name":"../../../support/bower_components/purescript-newtype/src/Data/Newtype.purs","start":[43,1]},"title":"newtypeDisj"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Newtype"],"Newtype"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Dual"],"Dual"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}},"sourceSpan":{"end":[45,43],"name":"../../../support/bower_components/purescript-newtype/src/Data/Newtype.purs","start":[45,1]},"title":"newtypeDual"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Newtype"],"Newtype"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid","Endo"],"Endo"],"tag":"TypeConstructor"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":"c","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[47,51],"name":"../../../support/bower_components/purescript-newtype/src/Data/Newtype.purs","start":[47,1]},"title":"newtypeEndo"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Newtype"],"Newtype"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semigroup","First"],"First"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}},"sourceSpan":{"end":[49,45],"name":"../../../support/bower_components/purescript-newtype/src/Data/Newtype.purs","start":[49,1]},"title":"newtypeFirst"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Newtype"],"Newtype"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semigroup","Last"],"Last"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}},"sourceSpan":{"end":[51,43],"name":"../../../support/bower_components/purescript-newtype/src/Data/Newtype.purs","start":[51,1]},"title":"newtypeLast"}],"comments":"A type class for `newtype`s to enable convenient wrapping and unwrapping,\nand the use of the other functions in this module.\n\nThe compiler can derive instances of `Newtype` automatically:\n\n``` purescript\nnewtype EmailAddress = EmailAddress String\n\nderive instance newtypeEmailAddress :: Newtype EmailAddress _\n```\n\nNote that deriving for `Newtype` instances requires that the type be\ndefined as `newtype` rather than `data` declaration (even if the `data`\nstructurally fits the rules of a `newtype`), and the use of a wildcard for\nthe wrapped type.\n","info":{"arguments":[["t",null],["a",null]],"declType":"typeClass","fundeps":[[["t"],["a"]]],"superclasses":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"t","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Prim","Coerce"],"Coercible"],"constraintData":null,"constraintKindArgs":[]}]},"kind":null,"sourceSpan":{"end":[29,44],"name":"../../../support/bower_components/purescript-newtype/src/Data/Newtype.purs","start":[29,1]},"title":"Newtype"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"t","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"t","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Newtype"],"Newtype"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[31,42],"name":"../../../support/bower_components/purescript-newtype/src/Data/Newtype.purs","start":[31,1]},"title":"wrap"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"t","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"t","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Newtype"],"Newtype"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[34,44],"name":"../../../support/bower_components/purescript-newtype/src/Data/Newtype.purs","start":[34,1]},"title":"unwrap"},{"children":[],"comments":"Given a constructor for a `Newtype`, this returns the appropriate `unwrap`\nfunction.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"t","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"t","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Newtype"],"Newtype"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[55,52],"name":"../../../support/bower_components/purescript-newtype/src/Data/Newtype.purs","start":[55,1]},"title":"un"},{"children":[],"comments":"This combinator unwraps the newtype, applies a monomorphic function to the \ncontained value and wraps the result back in the newtype\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"t","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"t","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Newtype"],"Newtype"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[60,56],"name":"../../../support/bower_components/purescript-newtype/src/Data/Newtype.purs","start":[60,1]},"title":"modify"},{"children":[],"comments":"This combinator is for when you have a higher order function that you want\nto use in the context of some newtype - `foldMap` being a common example:\n\n``` purescript\nala Additive foldMap [1,2,3,4] -- 10\nala Multiplicative foldMap [1,2,3,4] -- 24\nala Conj foldMap [true, false] -- false\nala Disj foldMap [true, false] -- true\n```\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"f","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"t","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"s","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"constraintClass":[["Prim","Coerce"],"Coercible"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"t","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Newtype"],"Newtype"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"s","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"constraintClass":[["Data","Newtype"],"Newtype"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"s","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[79,9],"name":"../../../support/bower_components/purescript-newtype/src/Data/Newtype.purs","start":[72,1]},"title":"ala"},{"children":[],"comments":"Similar to `ala` but useful for cases where you want to use an additional\nprojection with the higher order function:\n\n``` purescript\nalaF Additive foldMap String.length [\"hello\", \"world\"] -- 10\nalaF Multiplicative foldMap Math.abs [1.0, -2.0, 3.0, -4.0] -- 24.0\n```\n\nThe type admits other possibilities due to the polymorphic `Functor`\nconstraints, but the case described above works because ((->) a) is a\n`Functor`.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"f","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"g","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"t","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"s","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"constraintClass":[["Prim","Coerce"],"Coercible"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":"g","tag":"TypeVar"},{"annotation":[],"contents":"s","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":"g","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"constraintClass":[["Prim","Coerce"],"Coercible"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"t","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Newtype"],"Newtype"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"s","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"constraintClass":[["Data","Newtype"],"Newtype"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"g","tag":"TypeVar"},{"annotation":[],"contents":"s","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"g","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[102,9],"name":"../../../support/bower_components/purescript-newtype/src/Data/Newtype.purs","start":[93,1]},"title":"alaF"},{"children":[],"comments":"Lifts a function operate over newtypes. This can be used to lift a\nfunction to manipulate the contents of a single newtype, somewhat like\n`map` does for a `Functor`:\n\n``` purescript\nnewtype Label = Label String\nderive instance newtypeLabel :: Newtype Label _\n\ntoUpperLabel :: Label -> Label\ntoUpperLabel = over Label String.toUpper\n```\n\nBut the result newtype is polymorphic, meaning the result can be returned\nas an alternative newtype:\n\n``` purescript\nnewtype UppercaseLabel = UppercaseLabel String\nderive instance newtypeUppercaseLabel :: Newtype UppercaseLabel _\n\ntoUpperLabel' :: Label -> UppercaseLabel\ntoUpperLabel' = over Label String.toUpper\n```\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"t","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"s","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"t","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Newtype"],"Newtype"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"s","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"constraintClass":[["Data","Newtype"],"Newtype"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"s","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[134,7],"name":"../../../support/bower_components/purescript-newtype/src/Data/Newtype.purs","start":[127,1]},"title":"over"},{"children":[],"comments":"Much like `over`, but where the lifted function operates on values in a\n`Functor`:\n\n``` purescript\nfindLabel :: String -> Array Label -> Maybe Label\nfindLabel s = overF Label (Foldable.find (_ == s))\n```\n\nThe above example also demonstrates that the functor type is polymorphic\nhere too, the input is an `Array` but the result is a `Maybe`.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"f","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"g","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"t","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"s","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"constraintClass":[["Prim","Coerce"],"Coercible"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":"g","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":"g","tag":"TypeVar"},{"annotation":[],"contents":"s","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"constraintClass":[["Prim","Coerce"],"Coercible"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"t","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Newtype"],"Newtype"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"s","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"constraintClass":[["Data","Newtype"],"Newtype"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"g","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"g","tag":"TypeVar"},{"annotation":[],"contents":"s","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[156,9],"name":"../../../support/bower_components/purescript-newtype/src/Data/Newtype.purs","start":[147,1]},"title":"overF"},{"children":[],"comments":"The opposite of `over`: lowers a function that operates on `Newtype`d\nvalues to operate on the wrapped value instead.\n\n``` purescript\nnewtype Degrees = Degrees Number\nderive instance newtypeDegrees :: Newtype Degrees _\n\nnewtype NormalDegrees = NormalDegrees Number\nderive instance newtypeNormalDegrees :: Newtype NormalDegrees _\n\nnormaliseDegrees :: Degrees -> NormalDegrees\nnormaliseDegrees (Degrees deg) = NormalDegrees (deg % 360.0)\n\nasNormalDegrees :: Number -> Number\nasNormalDegrees = under Degrees normaliseDegrees\n```\n\nAs with `over` the `Newtype` is polymorphic, as illustrated in the example\nabove - both `Degrees` and `NormalDegrees` are instances of `Newtype`,\nso even though `normaliseDegrees` changes the result type we can still put\na `Number` in and get a `Number` out via `under`.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"t","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"s","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"t","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Newtype"],"Newtype"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"s","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"constraintClass":[["Data","Newtype"],"Newtype"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"s","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[187,7],"name":"../../../support/bower_components/purescript-newtype/src/Data/Newtype.purs","start":[180,1]},"title":"under"},{"children":[],"comments":"Much like `under`, but where the lifted function operates on values in a\n`Functor`:\n\n``` purescript\nnewtype EmailAddress = EmailAddress String\nderive instance newtypeEmailAddress :: Newtype EmailAddress _\n\nisValid :: EmailAddress -> Boolean\nisValid x = false -- imagine a slightly less strict predicate here\n\nfindValidEmailString :: Array String -> Maybe String\nfindValidEmailString = underF EmailAddress (Foldable.find isValid)\n```\n\nThe above example also demonstrates that the functor type is polymorphic\nhere too, the input is an `Array` but the result is a `Maybe`.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"f","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"g","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"t","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"s","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"constraintClass":[["Prim","Coerce"],"Coercible"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":"g","tag":"TypeVar"},{"annotation":[],"contents":"s","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":"g","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"constraintClass":[["Prim","Coerce"],"Coercible"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"t","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Newtype"],"Newtype"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"s","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"constraintClass":[["Data","Newtype"],"Newtype"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"g","tag":"TypeVar"},{"annotation":[],"contents":"s","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"g","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[215,9],"name":"../../../support/bower_components/purescript-newtype/src/Data/Newtype.purs","start":[206,1]},"title":"underF"},{"children":[],"comments":"Lifts a binary function to operate over newtypes.\n\n``` purescript\nnewtype Meter = Meter Int\nderive newtype instance newtypeMeter :: Newtype Meter _\nnewtype SquareMeter = SquareMeter Int\nderive newtype instance newtypeSquareMeter :: Newtype SquareMeter _\n\narea :: Meter -> Meter -> SquareMeter\narea = over2 Meter (*)\n```\n\nThe above example also demonstrates that the return type is polymorphic\nhere too.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"t","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"s","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"t","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Newtype"],"Newtype"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"s","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"constraintClass":[["Data","Newtype"],"Newtype"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"s","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[240,7],"name":"../../../support/bower_components/purescript-newtype/src/Data/Newtype.purs","start":[232,1]},"title":"over2"},{"children":[],"comments":"Much like `over2`, but where the lifted binary function operates on\nvalues in a `Functor`.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"f","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"g","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"t","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"s","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"constraintClass":[["Prim","Coerce"],"Coercible"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":"g","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":"g","tag":"TypeVar"},{"annotation":[],"contents":"s","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"constraintClass":[["Prim","Coerce"],"Coercible"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"t","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Newtype"],"Newtype"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"s","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"constraintClass":[["Data","Newtype"],"Newtype"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"g","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"g","tag":"TypeVar"},{"annotation":[],"contents":"s","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[255,9],"name":"../../../support/bower_components/purescript-newtype/src/Data/Newtype.purs","start":[245,1]},"title":"overF2"},{"children":[],"comments":"The opposite of `over2`: lowers a binary function that operates on `Newtype`d\nvalues to operate on the wrapped value instead.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"t","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"s","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"t","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Newtype"],"Newtype"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"s","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"constraintClass":[["Data","Newtype"],"Newtype"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"s","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[268,7],"name":"../../../support/bower_components/purescript-newtype/src/Data/Newtype.purs","start":[260,1]},"title":"under2"},{"children":[],"comments":"Much like `under2`, but where the lifted binary function operates on\nvalues in a `Functor`.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"f","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"g","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"t","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"s","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"constraintClass":[["Prim","Coerce"],"Coercible"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":"g","tag":"TypeVar"},{"annotation":[],"contents":"s","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":"g","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"constraintClass":[["Prim","Coerce"],"Coercible"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"t","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Newtype"],"Newtype"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"s","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"constraintClass":[["Data","Newtype"],"Newtype"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"g","tag":"TypeVar"},{"annotation":[],"contents":"s","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"g","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[283,9],"name":"../../../support/bower_components/purescript-newtype/src/Data/Newtype.purs","start":[273,1]},"title":"underF2"},{"children":[],"comments":"Similar to the function from the `Traversable` class, but operating within\na newtype instead.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"f","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"t","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"constraintClass":[["Prim","Coerce"],"Coercible"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"t","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Newtype"],"Newtype"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[295,9],"name":"../../../support/bower_components/purescript-newtype/src/Data/Newtype.purs","start":[288,1]},"title":"traverse"},{"children":[],"comments":"Similar to the function from the `Distributive` class, but operating within\na newtype instead.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"f","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"t","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"constraintClass":[["Prim","Coerce"],"Coercible"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"t","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Newtype"],"Newtype"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[307,7],"name":"../../../support/bower_components/purescript-newtype/src/Data/Newtype.purs","start":[300,1]},"title":"collect"}],"name":"Data.Newtype","reExports":[]}
+ tests/purs/publish/basic-example/output/Data.Ord.Generic/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Data","Ordering"],"Ordering"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[11,40],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ord/Generic.purs","start":[11,3]},"title":"genericCompare'"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ord","Generic"],"GenericOrd"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Generic","Rep"],"NoConstructors"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[14,27],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ord/Generic.purs","start":[13,1]},"title":"genericOrdNoConstructors"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ord","Generic"],"GenericOrd"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Generic","Rep"],"NoArguments"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[17,27],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ord/Generic.purs","start":[16,1]},"title":"genericOrdNoArguments"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Ord","Generic"],"GenericOrd"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"b","tag":"TypeVar"}],"constraintClass":[["Data","Ord","Generic"],"GenericOrd"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ord","Generic"],"GenericOrd"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Generic","Rep"],"Sum"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[23,39],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ord/Generic.purs","start":[19,1]},"title":"genericOrdSum"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Ord","Generic"],"GenericOrd"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"b","tag":"TypeVar"}],"constraintClass":[["Data","Ord","Generic"],"GenericOrd"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ord","Generic"],"GenericOrd"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Generic","Rep"],"Product"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[29,21],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ord/Generic.purs","start":[25,1]},"title":"genericOrdProduct"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Ord","Generic"],"GenericOrd"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ord","Generic"],"GenericOrd"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Generic","Rep"],"Constructor"],"tag":"TypeConstructor"},{"annotation":[],"contents":"name","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[32,76],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ord/Generic.purs","start":[31,1]},"title":"genericOrdConstructor"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Ord"],"Ord"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ord","Generic"],"GenericOrd"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Generic","Rep"],"Argument"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[35,62],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ord/Generic.purs","start":[34,1]},"title":"genericOrdArgument"}],"comments":null,"info":{"arguments":[["a",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[11,40],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ord/Generic.purs","start":[10,1]},"title":"GenericOrd"},{"children":[],"comments":"A `Generic` implementation of the `compare` member from the `Ord` type class.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"rep","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":"rep","tag":"TypeVar"}],"constraintClass":[["Data","Generic","Rep"],"Generic"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"rep","tag":"TypeVar"}],"constraintClass":[["Data","Ord","Generic"],"GenericOrd"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Data","Ordering"],"Ordering"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[38,86],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ord/Generic.purs","start":[38,1]},"title":"genericCompare"}],"name":"Data.Ord.Generic","reExports":[]}
+ tests/purs/publish/basic-example/output/Data.Ord/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Data","Ordering"],"Ordering"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[49,32],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ord.purs","start":[49,3]},"title":"compare"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ord"],"Ord"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[52,36],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ord.purs","start":[51,1]},"title":"ordBoolean"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ord"],"Ord"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[55,32],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ord.purs","start":[54,1]},"title":"ordInt"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ord"],"Ord"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Number"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[58,35],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ord.purs","start":[57,1]},"title":"ordNumber"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ord"],"Ord"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[61,35],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ord.purs","start":[60,1]},"title":"ordString"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ord"],"Ord"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Char"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[64,33],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ord.purs","start":[63,1]},"title":"ordChar"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ord"],"Ord"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[67,19],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ord.purs","start":[66,1]},"title":"ordUnit"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ord"],"Ord"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Void"],"Void"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[70,19],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ord.purs","start":[69,1]},"title":"ordVoid"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ord"],"Ord"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[73,19],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ord.purs","start":[72,1]},"title":"ordProxy"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Ord"],"Ord"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ord"],"Ord"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Array"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[82,17],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ord.purs","start":[75,1]},"title":"ordArray"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ord"],"Ord"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Ordering"],"Ordering"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[133,20],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ord.purs","start":[126,1]},"title":"ordOrdering"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"row","tag":"TypeVar"},{"annotation":[],"contents":"list","tag":"TypeVar"}],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"list","tag":"TypeVar"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"constraintClass":[["Data","Ord"],"OrdRecord"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ord"],"Ord"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[264,48],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ord.purs","start":[259,1]},"title":"ordRecord"}],"comments":"The `Ord` type class represents types which support comparisons with a\n_total order_.\n\n`Ord` instances should satisfy the laws of total orderings:\n\n- Reflexivity: `a <= a`\n- Antisymmetry: if `a <= b` and `b <= a` then `a == b`\n- Transitivity: if `a <= b` and `b <= c` then `a <= c`\n\n**Note:** The `Number` type is not an entirely law abiding member of this\nclass due to the presence of `NaN`, since `NaN <= NaN` evaluates to `false`\n","info":{"arguments":[["a",null]],"declType":"typeClass","fundeps":[],"superclasses":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Eq"],"Eq"],"constraintData":null,"constraintKindArgs":[]}]},"kind":null,"sourceSpan":{"end":[49,32],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ord.purs","start":[48,1]},"title":"Ord"},{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Ord"],"Ord"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"f","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Data","Ordering"],"Ordering"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[232,56],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ord.purs","start":[232,3]},"title":"compare1"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ord"],"Ord1"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Array"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[235,21],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ord.purs","start":[234,1]},"title":"ord1Array"}],"comments":"The `Ord1` type class represents totally ordered type constructors.\n","info":{"arguments":[["f",null]],"declType":"typeClass","fundeps":[],"superclasses":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"f","tag":"TypeVar"}],"constraintClass":[["Data","Eq"],"Eq1"],"constraintData":null,"constraintKindArgs":[]}]},"kind":{"keyword":"class","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Constraint"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[232,56],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ord.purs","start":[231,1]},"title":"Ord1"},{"children":[],"comments":"Test whether one value is _strictly less than_ another.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Ord"],"Ord"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[136,49],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ord.purs","start":[136,1]},"title":"lessThan"},{"children":[],"comments":null,"info":{"alias":[["Data","Ord"],{"Right":{"Left":{"Ident":"lessThan"}}}],"declType":"alias","fixity":{"associativity":"infixl","precedence":4}},"kind":null,"sourceSpan":{"end":[159,23],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ord.purs","start":[159,1]},"title":"(<)"},{"children":[],"comments":"Test whether one value is _non-strictly less than_ another.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Ord"],"Ord"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[148,53],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ord.purs","start":[148,1]},"title":"lessThanOrEq"},{"children":[],"comments":null,"info":{"alias":[["Data","Ord"],{"Right":{"Left":{"Ident":"lessThanOrEq"}}}],"declType":"alias","fixity":{"associativity":"infixl","precedence":4}},"kind":null,"sourceSpan":{"end":[160,28],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ord.purs","start":[160,1]},"title":"(<=)"},{"children":[],"comments":"Test whether one value is _strictly greater than_ another.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Ord"],"Ord"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[142,52],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ord.purs","start":[142,1]},"title":"greaterThan"},{"children":[],"comments":null,"info":{"alias":[["Data","Ord"],{"Right":{"Left":{"Ident":"greaterThan"}}}],"declType":"alias","fixity":{"associativity":"infixl","precedence":4}},"kind":null,"sourceSpan":{"end":[161,26],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ord.purs","start":[161,1]},"title":"(>)"},{"children":[],"comments":"Test whether one value is _non-strictly greater than_ another.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Ord"],"Ord"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[154,56],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ord.purs","start":[154,1]},"title":"greaterThanOrEq"},{"children":[],"comments":null,"info":{"alias":[["Data","Ord"],{"Right":{"Left":{"Ident":"greaterThanOrEq"}}}],"declType":"alias","fixity":{"associativity":"infixl","precedence":4}},"kind":null,"sourceSpan":{"end":[162,31],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ord.purs","start":[162,1]},"title":"(>=)"},{"children":[],"comments":"Compares two values by mapping them to a type with an `Ord` instance.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"b","tag":"TypeVar"}],"constraintClass":[["Data","Ord"],"Ord"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Data","Ordering"],"Ordering"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[165,67],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ord.purs","start":[165,1]},"title":"comparing"},{"children":[],"comments":"Take the minimum of two values. If they are considered equal, the first\nargument is chosen.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Ord"],"Ord"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[170,38],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ord.purs","start":[170,1]},"title":"min"},{"children":[],"comments":"Take the maximum of two values. If they are considered equal, the first\nargument is chosen.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Ord"],"Ord"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[179,38],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ord.purs","start":[179,1]},"title":"max"},{"children":[],"comments":"Clamp a value between a minimum and a maximum. For example:\n\n``` purescript\nlet f = clamp 0 10\nf (-5) == 0\nf 5 == 5\nf 15 == 10\n```\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Ord"],"Ord"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[194,45],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ord.purs","start":[194,1]},"title":"clamp"},{"children":[],"comments":"Test whether a value is between a minimum and a maximum (inclusive).\nFor example:\n\n``` purescript\nlet f = between 0 10\nf 0 == true\nf (-5) == false\nf 5 == true\nf 10 == true\nf 15 == false\n```\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Ord"],"Ord"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[208,53],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ord.purs","start":[208,1]},"title":"between"},{"children":[],"comments":"The absolute value function. `abs x` is defined as `if x >= zero then x\nelse negate x`.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Ord"],"Ord"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Ring"],"Ring"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[216,43],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ord.purs","start":[216,1]},"title":"abs"},{"children":[],"comments":"The sign function; returns `one` if the argument is positive,\n`negate one` if the argument is negative, or `zero` if the argument is `zero`.\nFor floating point numbers with signed zeroes, when called with a zero,\nthis function returns the argument in order to preserve the sign.\nFor any `x`, we should have `signum x * abs x == x`.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Ord"],"Ord"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Ring"],"Ring"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[224,46],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ord.purs","start":[224,1]},"title":"signum"},{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"},{"annotation":[],"contents":"rowlist","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Data","Ordering"],"Ordering"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[239,73],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ord.purs","start":[239,3]},"title":"compareRecord"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ord"],"OrdRecord"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim","RowList"],"Nil"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"}},"sourceSpan":{"end":[242,27],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ord.purs","start":[241,1]},"title":"ordRecordNil"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"rowlistTail","tag":"TypeVar"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"constraintClass":[["Data","Ord"],"OrdRecord"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"key","tag":"TypeVar"},{"annotation":[],"contents":"focus","tag":"TypeVar"},{"annotation":[],"contents":"rowTail","tag":"TypeVar"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"constraintClass":[["Prim","Row"],"Cons"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"key","tag":"TypeVar"}],"constraintClass":[["Data","Symbol"],"IsSymbol"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"focus","tag":"TypeVar"}],"constraintClass":[["Data","Ord"],"Ord"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ord"],"OrdRecord"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim","RowList"],"Cons"],"tag":"TypeConstructor"},{"annotation":[],"contents":"key","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"focus","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"rowlistTail","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"}},"sourceSpan":{"end":[257,57],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ord.purs","start":[244,1]},"title":"ordRecordCons"}],"comments":null,"info":{"arguments":[["rowlist",null],["row",null]],"declType":"typeClass","fundeps":[],"superclasses":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"rowlist","tag":"TypeVar"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"constraintClass":[["Data","Eq"],"EqRecord"],"constraintData":null,"constraintKindArgs":[]}]},"kind":{"keyword":"class","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim","RowList"],"RowList"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Constraint"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[239,73],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ord.purs","start":[238,1]},"title":"OrdRecord"}],"name":"Data.Ord","reExports":[]}
+ tests/purs/publish/basic-example/output/Data.Ordering/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":{"end":[13,19],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ordering.purs","start":[13,15]},"title":"LT"},{"comments":null,"info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":{"end":[13,24],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ordering.purs","start":[13,20]},"title":"GT"},{"comments":null,"info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":{"end":[13,29],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ordering.purs","start":[13,25]},"title":"EQ"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Eq"],"Eq"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Ordering"],"Ordering"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[19,17],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ordering.purs","start":[15,1]},"title":"eqOrdering"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semigroup"],"Semigroup"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Ordering"],"Ordering"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[24,18],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ordering.purs","start":[21,1]},"title":"semigroupOrdering"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Show"],"Show"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Ordering"],"Ordering"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[29,17],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ordering.purs","start":[26,1]},"title":"showOrdering"}],"comments":"The `Ordering` data type represents the three possible outcomes of\ncomparing two values:\n\n`LT` - The first value is _less than_ the second.\n`GT` - The first value is _greater than_ the second.\n`EQ` - The first value is _equal to_ the second.\n","info":{"dataDeclType":"data","declType":"data","roles":[],"typeArguments":[]},"kind":null,"sourceSpan":{"end":[13,29],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ordering.purs","start":[13,1]},"title":"Ordering"},{"children":[],"comments":"Reverses an `Ordering` value, flipping greater than for less than while\npreserving equality.\n","info":{"declType":"value","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Ordering"],"Ordering"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Data","Ordering"],"Ordering"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":null,"sourceSpan":{"end":[33,31],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ordering.purs","start":[33,1]},"title":"invert"}],"name":"Data.Ordering","reExports":[]}
+ tests/purs/publish/basic-example/output/Data.Reflectable/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":"Reflect a type `v` to its term-level representation.\n","info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"},{"annotation":[],"contents":"v","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"}},"sourceSpan":{"end":[21,30],"name":"../../../support/bower_components/purescript-prelude/src/Data/Reflectable.purs","start":[21,3]},"title":"reflectType"}],"comments":"A type-class for reflectable types.\n\nInstances for the following kinds are solved by the compiler:\n* Boolean\n* Int\n* Ordering\n* Symbol\n","info":{"arguments":[["v",null],["t",null]],"declType":"typeClass","fundeps":[[["v"],["t"]]],"superclasses":[]},"kind":{"keyword":"class","kind":{"annotation":[],"contents":{"identifier":"k","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Constraint"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[21,30],"name":"../../../support/bower_components/purescript-prelude/src/Data/Reflectable.purs","start":[19,1]},"title":"Reflectable"},{"children":[{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Reflectable"],"Reifiable"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[30,27],"name":"../../../support/bower_components/purescript-prelude/src/Data/Reflectable.purs","start":[30,1]},"title":"<anonymous>"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Reflectable"],"Reifiable"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[31,23],"name":"../../../support/bower_components/purescript-prelude/src/Data/Reflectable.purs","start":[31,1]},"title":"<anonymous>"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Reflectable"],"Reifiable"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Ordering"],"Ordering"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[32,28],"name":"../../../support/bower_components/purescript-prelude/src/Data/Reflectable.purs","start":[32,1]},"title":"<anonymous>"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Reflectable"],"Reifiable"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[33,26],"name":"../../../support/bower_components/purescript-prelude/src/Data/Reflectable.purs","start":[33,1]},"title":"<anonymous>"}],"comments":"A type class for reifiable types.\n\nInstances of this type class correspond to the `t` synthesized\nby the compiler when solving the `Reflectable` type class.\n","info":{"arguments":[["t",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[28,18],"name":"../../../support/bower_components/purescript-prelude/src/Data/Reflectable.purs","start":[28,1]},"title":"Reifiable"},{"children":[],"comments":"Reify a value of type `t` such that it can be consumed by a\nfunction constrained by the `Reflectable` type class. For\nexample:\n\n```purs\ntwiceFromType :: forall v. Reflectable v Int => Proxy v -> Int\ntwiceFromType = (_ * 2) <<< reflectType\n\ntwiceOfTerm :: Int\ntwiceOfTerm = reifyType 21 twiceFromType\n```\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"t","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"r","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"t","tag":"TypeVar"}],"constraintClass":[["Data","Reflectable"],"Reifiable"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":{"identifier":"v","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"v","tag":"TypeVar"},{"annotation":[],"contents":"t","tag":"TypeVar"}],"constraintClass":[["Data","Reflectable"],"Reflectable"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"},{"annotation":[],"contents":"v","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[49,94],"name":"../../../support/bower_components/purescript-prelude/src/Data/Reflectable.purs","start":[49,1]},"title":"reifyType"}],"name":"Data.Reflectable","reExports":[]}
+ tests/purs/publish/basic-example/output/Data.Ring.Generic/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[8,29],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ring/Generic.purs","start":[8,3]},"title":"genericSub'"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ring","Generic"],"GenericRing"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Generic","Rep"],"NoArguments"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[11,32],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ring/Generic.purs","start":[10,1]},"title":"genericRingNoArguments"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Ring"],"Ring"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ring","Generic"],"GenericRing"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Generic","Rep"],"Argument"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[14,61],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ring/Generic.purs","start":[13,1]},"title":"genericRingArgument"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Ring","Generic"],"GenericRing"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"b","tag":"TypeVar"}],"constraintClass":[["Data","Ring","Generic"],"GenericRing"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ring","Generic"],"GenericRing"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Generic","Rep"],"Product"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[17,96],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ring/Generic.purs","start":[16,1]},"title":"genericRingProduct"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Ring","Generic"],"GenericRing"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ring","Generic"],"GenericRing"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Generic","Rep"],"Constructor"],"tag":"TypeConstructor"},{"annotation":[],"contents":"name","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[20,82],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ring/Generic.purs","start":[19,1]},"title":"genericRingConstructor"}],"comments":null,"info":{"arguments":[["a",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[8,29],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ring/Generic.purs","start":[7,1]},"title":"GenericRing"},{"children":[],"comments":"A `Generic` implementation of the `sub` member from the `Ring` type class.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"rep","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":"rep","tag":"TypeVar"}],"constraintClass":[["Data","Generic","Rep"],"Generic"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"rep","tag":"TypeVar"}],"constraintClass":[["Data","Ring","Generic"],"GenericRing"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[23,76],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ring/Generic.purs","start":[23,1]},"title":"genericSub"}],"name":"Data.Ring.Generic","reExports":[]}
+ tests/purs/publish/basic-example/output/Data.Ring/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[28,21],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ring.purs","start":[28,3]},"title":"sub"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ring"],"Ring"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[33,15],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ring.purs","start":[32,1]},"title":"ringInt"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ring"],"Ring"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Number"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[36,15],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ring.purs","start":[35,1]},"title":"ringNumber"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ring"],"Ring"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[39,17],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ring.purs","start":[38,1]},"title":"ringUnit"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"b","tag":"TypeVar"}],"constraintClass":[["Data","Ring"],"Ring"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ring"],"Ring"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[42,24],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ring.purs","start":[41,1]},"title":"ringFn"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ring"],"Ring"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[45,18],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ring.purs","start":[44,1]},"title":"ringProxy"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"row","tag":"TypeVar"},{"annotation":[],"contents":"list","tag":"TypeVar"}],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"list","tag":"TypeVar"},{"annotation":[],"contents":"row","tag":"TypeVar"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"constraintClass":[["Data","Ring"],"RingRecord"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ring"],"Ring"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[48,40],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ring.purs","start":[47,1]},"title":"ringRecord"}],"comments":"The `Ring` class is for types that support addition, multiplication,\nand subtraction operations.\n\nInstances must satisfy the following laws in addition to the `Semiring`\nlaws:\n\n- Additive inverse: `a - a = zero`\n- Compatibility of `sub` and `negate`: `a - b = a + (zero - b)`\n","info":{"arguments":[["a",null]],"declType":"typeClass","fundeps":[],"superclasses":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Semiring"],"Semiring"],"constraintData":null,"constraintKindArgs":[]}]},"kind":null,"sourceSpan":{"end":[28,21],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ring.purs","start":[27,1]},"title":"Ring"},{"children":[],"comments":"`negate x` can be used as a shorthand for `zero - x`.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Ring"],"Ring"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[51,37],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ring.purs","start":[51,1]},"title":"negate"},{"children":[],"comments":null,"info":{"alias":[["Data","Ring"],{"Right":{"Left":{"Ident":"sub"}}}],"declType":"alias","fixity":{"associativity":"infixl","precedence":6}},"kind":null,"sourceSpan":{"end":[30,18],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ring.purs","start":[30,1]},"title":"(-)"},{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"},{"annotation":[],"contents":"rowlist","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"subrow","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[61,74],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ring.purs","start":[61,3]},"title":"subRecord"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ring"],"RingRecord"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim","RowList"],"Nil"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"tag":"REmpty"}],"tag":"TypeApp"}},"sourceSpan":{"end":[64,23],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ring.purs","start":[63,1]},"title":"ringRecordNil"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"key","tag":"TypeVar"}],"constraintClass":[["Data","Symbol"],"IsSymbol"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"key","tag":"TypeVar"},{"annotation":[],"contents":"focus","tag":"TypeVar"},{"annotation":[],"contents":"subrowTail","tag":"TypeVar"},{"annotation":[],"contents":"subrow","tag":"TypeVar"}],"constraintClass":[["Prim","Row"],"Cons"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"rowlistTail","tag":"TypeVar"},{"annotation":[],"contents":"row","tag":"TypeVar"},{"annotation":[],"contents":"subrowTail","tag":"TypeVar"}],"constraintClass":[["Data","Ring"],"RingRecord"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"focus","tag":"TypeVar"}],"constraintClass":[["Data","Ring"],"Ring"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ring"],"RingRecord"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim","RowList"],"Cons"],"tag":"TypeConstructor"},{"annotation":[],"contents":"key","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"focus","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"rowlistTail","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"subrow","tag":"TypeVar"}],"tag":"TypeApp"}},"sourceSpan":{"end":[78,56],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ring.purs","start":[66,1]},"title":"ringRecordCons"}],"comments":"A class for records where all fields have `Ring` instances, used to\nimplement the `Ring` instance for records.\n","info":{"arguments":[["rowlist",null],["row",null],["subrow",null]],"declType":"typeClass","fundeps":[[["rowlist"],["subrow"]]],"superclasses":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"rowlist","tag":"TypeVar"},{"annotation":[],"contents":"row","tag":"TypeVar"},{"annotation":[],"contents":"subrow","tag":"TypeVar"}],"constraintClass":[["Data","Semiring"],"SemiringRecord"],"constraintData":null,"constraintKindArgs":[]}]},"kind":{"keyword":"class","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim","RowList"],"RowList"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Constraint"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[61,74],"name":"../../../support/bower_components/purescript-prelude/src/Data/Ring.purs","start":[60,1]},"title":"RingRecord"}],"name":"Data.Ring","reExports":[]}
+ tests/purs/publish/basic-example/output/Data.Semigroup.First/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"declType":"dataConstructor"},"sourceSpan":{"end":[13,26],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup/First.purs","start":[13,17]},"title":"First"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Eq"],"Eq"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Eq"],"Eq"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semigroup","First"],"First"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[15,56],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup/First.purs","start":[15,1]},"title":"eqFirst"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Eq"],"Eq1"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Semigroup","First"],"First"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[16,38],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup/First.purs","start":[16,1]},"title":"eq1First"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Ord"],"Ord"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ord"],"Ord"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semigroup","First"],"First"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[18,59],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup/First.purs","start":[18,1]},"title":"ordFirst"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ord"],"Ord1"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Semigroup","First"],"First"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[19,40],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup/First.purs","start":[19,1]},"title":"ord1First"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Bounded"],"Bounded"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Bounded"],"Bounded"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semigroup","First"],"First"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[21,71],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup/First.purs","start":[21,1]},"title":"boundedFirst"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Show"],"Show"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Show"],"Show"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semigroup","First"],"First"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[24,46],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup/First.purs","start":[23,1]},"title":"showFirst"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Functor"],"Functor"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Semigroup","First"],"First"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[26,46],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup/First.purs","start":[26,1]},"title":"functorFirst"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Apply"],"Apply"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Semigroup","First"],"First"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[29,42],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup/First.purs","start":[28,1]},"title":"applyFirst"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Applicative"],"Applicative"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Semigroup","First"],"First"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[32,15],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup/First.purs","start":[31,1]},"title":"applicativeFirst"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Bind"],"Bind"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Semigroup","First"],"First"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[35,25],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup/First.purs","start":[34,1]},"title":"bindFirst"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Monad"],"Monad"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Semigroup","First"],"First"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[37,35],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup/First.purs","start":[37,1]},"title":"monadFirst"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semigroup"],"Semigroup"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semigroup","First"],"First"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[40,17],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup/First.purs","start":[39,1]},"title":"semigroupFirst"}],"comments":"Semigroup where `append` always takes the first option.\n\n``` purescript\nFirst x <> First y == First x\n```\n","info":{"dataDeclType":"newtype","declType":"data","roles":["Representational"],"typeArguments":[["a",null]]},"kind":null,"sourceSpan":{"end":[13,26],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup/First.purs","start":[13,1]},"title":"First"}],"name":"Data.Semigroup.First","reExports":[]}
+ tests/purs/publish/basic-example/output/Data.Semigroup.Generic/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[11,32],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup/Generic.purs","start":[11,3]},"title":"genericAppend'"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semigroup","Generic"],"GenericSemigroup"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Generic","Rep"],"NoConstructors"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[14,25],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup/Generic.purs","start":[13,1]},"title":"genericSemigroupNoConstructors"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semigroup","Generic"],"GenericSemigroup"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Generic","Rep"],"NoArguments"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[17,25],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup/Generic.purs","start":[16,1]},"title":"genericSemigroupNoArguments"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Semigroup","Generic"],"GenericSemigroup"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"b","tag":"TypeVar"}],"constraintClass":[["Data","Semigroup","Generic"],"GenericSemigroup"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semigroup","Generic"],"GenericSemigroup"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Generic","Rep"],"Product"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[21,58],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup/Generic.purs","start":[19,1]},"title":"genericSemigroupProduct"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Semigroup","Generic"],"GenericSemigroup"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semigroup","Generic"],"GenericSemigroup"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Generic","Rep"],"Constructor"],"tag":"TypeConstructor"},{"annotation":[],"contents":"name","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[24,88],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup/Generic.purs","start":[23,1]},"title":"genericSemigroupConstructor"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Semigroup"],"Semigroup"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semigroup","Generic"],"GenericSemigroup"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Generic","Rep"],"Argument"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[27,71],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup/Generic.purs","start":[26,1]},"title":"genericSemigroupArgument"}],"comments":null,"info":{"arguments":[["a",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[11,32],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup/Generic.purs","start":[10,1]},"title":"GenericSemigroup"},{"children":[],"comments":"A `Generic` implementation of the `append` member from the `Semigroup` type class.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"rep","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":"rep","tag":"TypeVar"}],"constraintClass":[["Data","Generic","Rep"],"Generic"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"rep","tag":"TypeVar"}],"constraintClass":[["Data","Semigroup","Generic"],"GenericSemigroup"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[30,84],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup/Generic.purs","start":[30,1]},"title":"genericAppend"}],"name":"Data.Semigroup.Generic","reExports":[]}
+ tests/purs/publish/basic-example/output/Data.Semigroup.Last/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"declType":"dataConstructor"},"sourceSpan":{"end":[13,24],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup/Last.purs","start":[13,16]},"title":"Last"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Eq"],"Eq"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Eq"],"Eq"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semigroup","Last"],"Last"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[15,54],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup/Last.purs","start":[15,1]},"title":"eqLast"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Eq"],"Eq1"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Semigroup","Last"],"Last"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[16,36],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup/Last.purs","start":[16,1]},"title":"eq1Last"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Ord"],"Ord"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ord"],"Ord"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semigroup","Last"],"Last"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[18,57],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup/Last.purs","start":[18,1]},"title":"ordLast"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Ord"],"Ord1"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Semigroup","Last"],"Last"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[19,38],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup/Last.purs","start":[19,1]},"title":"ord1Last"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Bounded"],"Bounded"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Bounded"],"Bounded"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semigroup","Last"],"Last"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[21,69],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup/Last.purs","start":[21,1]},"title":"boundedLast"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Show"],"Show"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Show"],"Show"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semigroup","Last"],"Last"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[24,44],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup/Last.purs","start":[23,1]},"title":"showLast"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Functor"],"Functor"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Semigroup","Last"],"Last"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[26,44],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup/Last.purs","start":[26,1]},"title":"functorLast"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Apply"],"Apply"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Semigroup","Last"],"Last"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[29,39],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup/Last.purs","start":[28,1]},"title":"applyLast"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Applicative"],"Applicative"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Semigroup","Last"],"Last"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[32,14],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup/Last.purs","start":[31,1]},"title":"applicativeLast"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Bind"],"Bind"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Semigroup","Last"],"Last"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[35,24],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup/Last.purs","start":[34,1]},"title":"bindLast"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Monad"],"Monad"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Semigroup","Last"],"Last"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[37,33],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup/Last.purs","start":[37,1]},"title":"monadLast"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semigroup"],"Semigroup"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semigroup","Last"],"Last"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[40,17],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup/Last.purs","start":[39,1]},"title":"semigroupLast"}],"comments":"Semigroup where `append` always takes the second option.\n\n``` purescript\nLast x <> Last y == Last y\n```\n","info":{"dataDeclType":"newtype","declType":"data","roles":["Representational"],"typeArguments":[["a",null]]},"kind":null,"sourceSpan":{"end":[13,24],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup/Last.purs","start":[13,1]},"title":"Last"}],"name":"Data.Semigroup.Last","reExports":[]}
+ tests/purs/publish/basic-example/output/Data.Semigroup/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[35,24],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup.purs","start":[35,3]},"title":"append"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semigroup"],"Semigroup"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[40,24],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup.purs","start":[39,1]},"title":"semigroupString"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semigroup"],"Semigroup"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[43,20],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup.purs","start":[42,1]},"title":"semigroupUnit"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semigroup"],"Semigroup"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Void"],"Void"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[46,20],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup.purs","start":[45,1]},"title":"semigroupVoid"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"s'","tag":"TypeVar"}],"constraintClass":[["Data","Semigroup"],"Semigroup"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semigroup"],"Semigroup"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"s","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"s'","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[49,28],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup.purs","start":[48,1]},"title":"semigroupFn"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semigroup"],"Semigroup"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Array"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[52,23],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup.purs","start":[51,1]},"title":"semigroupArray"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semigroup"],"Semigroup"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[55,21],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup.purs","start":[54,1]},"title":"semigroupProxy"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"row","tag":"TypeVar"},{"annotation":[],"contents":"list","tag":"TypeVar"}],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"list","tag":"TypeVar"},{"annotation":[],"contents":"row","tag":"TypeVar"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"constraintClass":[["Data","Semigroup"],"SemigroupRecord"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semigroup"],"Semigroup"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[58,46],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup.purs","start":[57,1]},"title":"semigroupRecord"}],"comments":"The `Semigroup` type class identifies an associative operation on a type.\n\nInstances are required to satisfy the following law:\n\n- Associativity: `(x <> y) <> z = x <> (y <> z)`\n\nOne example of a `Semigroup` is `String`, with `(<>)` defined as string\nconcatenation. Another example is `List a`, with `(<>)` defined as\nlist concatenation.\n\n### Newtypes for Semigroup\n\nThere are two other ways to implement an instance for this type class\nregardless of which type is used. These instances can be used by\nwrapping the values in one of the two newtypes below:\n1. `First` - Use the first argument every time: `append first _ = first`.\n2. `Last` - Use the last argument every time: `append _ last = last`.\n","info":{"arguments":[["a",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[35,24],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup.purs","start":[34,1]},"title":"Semigroup"},{"children":[],"comments":null,"info":{"alias":[["Data","Semigroup"],{"Right":{"Left":{"Ident":"append"}}}],"declType":"alias","fixity":{"associativity":"infixr","precedence":5}},"kind":null,"sourceSpan":{"end":[37,22],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup.purs","start":[37,1]},"title":"(<>)"},{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"},{"annotation":[],"contents":"rowlist","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"subrow","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[67,77],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup.purs","start":[67,3]},"title":"appendRecord"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semigroup"],"SemigroupRecord"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim","RowList"],"Nil"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"tag":"REmpty"}],"tag":"TypeApp"}},"sourceSpan":{"end":[70,26],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup.purs","start":[69,1]},"title":"semigroupRecordNil"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"key","tag":"TypeVar"}],"constraintClass":[["Data","Symbol"],"IsSymbol"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"key","tag":"TypeVar"},{"annotation":[],"contents":"focus","tag":"TypeVar"},{"annotation":[],"contents":"subrowTail","tag":"TypeVar"},{"annotation":[],"contents":"subrow","tag":"TypeVar"}],"constraintClass":[["Prim","Row"],"Cons"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"rowlistTail","tag":"TypeVar"},{"annotation":[],"contents":"row","tag":"TypeVar"},{"annotation":[],"contents":"subrowTail","tag":"TypeVar"}],"constraintClass":[["Data","Semigroup"],"SemigroupRecord"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"focus","tag":"TypeVar"}],"constraintClass":[["Data","Semigroup"],"Semigroup"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semigroup"],"SemigroupRecord"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim","RowList"],"Cons"],"tag":"TypeConstructor"},{"annotation":[],"contents":"key","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"focus","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"rowlistTail","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"subrow","tag":"TypeVar"}],"tag":"TypeApp"}},"sourceSpan":{"end":[84,59],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup.purs","start":[72,1]},"title":"semigroupRecordCons"}],"comments":"A class for records where all fields have `Semigroup` instances, used to\nimplement the `Semigroup` instance for records.\n","info":{"arguments":[["rowlist",null],["row",null],["subrow",null]],"declType":"typeClass","fundeps":[[["rowlist"],["subrow"]]],"superclasses":[]},"kind":{"keyword":"class","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim","RowList"],"RowList"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Constraint"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[67,77],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semigroup.purs","start":[66,1]},"title":"SemigroupRecord"}],"name":"Data.Semigroup","reExports":[]}
+ tests/purs/publish/basic-example/output/Data.Semiring.Generic/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[8,29],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semiring/Generic.purs","start":[8,3]},"title":"genericAdd'"},{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":"a","tag":"TypeVar"}},"sourceSpan":{"end":[9,20],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semiring/Generic.purs","start":[9,3]},"title":"genericZero'"},{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[10,29],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semiring/Generic.purs","start":[10,3]},"title":"genericMul'"},{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":"a","tag":"TypeVar"}},"sourceSpan":{"end":[11,19],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semiring/Generic.purs","start":[11,3]},"title":"genericOne'"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semiring","Generic"],"GenericSemiring"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Generic","Rep"],"NoArguments"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[17,28],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semiring/Generic.purs","start":[13,1]},"title":"genericSemiringNoArguments"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Semiring"],"Semiring"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semiring","Generic"],"GenericSemiring"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Generic","Rep"],"Argument"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[23,29],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semiring/Generic.purs","start":[19,1]},"title":"genericSemiringArgument"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Semiring","Generic"],"GenericSemiring"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"b","tag":"TypeVar"}],"constraintClass":[["Data","Semiring","Generic"],"GenericSemiring"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semiring","Generic"],"GenericSemiring"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Generic","Rep"],"Product"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[29,48],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semiring/Generic.purs","start":[25,1]},"title":"genericSemiringProduct"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Semiring","Generic"],"GenericSemiring"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semiring","Generic"],"GenericSemiring"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Generic","Rep"],"Constructor"],"tag":"TypeConstructor"},{"annotation":[],"contents":"name","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[35,40],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semiring/Generic.purs","start":[31,1]},"title":"genericSemiringConstructor"}],"comments":null,"info":{"arguments":[["a",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[11,19],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semiring/Generic.purs","start":[7,1]},"title":"GenericSemiring"},{"children":[],"comments":"A `Generic` implementation of the `zero` member from the `Semiring` type class.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"rep","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":"rep","tag":"TypeVar"}],"constraintClass":[["Data","Generic","Rep"],"Generic"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"rep","tag":"TypeVar"}],"constraintClass":[["Data","Semiring","Generic"],"GenericSemiring"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[38,71],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semiring/Generic.purs","start":[38,1]},"title":"genericZero"},{"children":[],"comments":"A `Generic` implementation of the `one` member from the `Semiring` type class.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"rep","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":"rep","tag":"TypeVar"}],"constraintClass":[["Data","Generic","Rep"],"Generic"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"rep","tag":"TypeVar"}],"constraintClass":[["Data","Semiring","Generic"],"GenericSemiring"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[42,70],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semiring/Generic.purs","start":[42,1]},"title":"genericOne"},{"children":[],"comments":"A `Generic` implementation of the `add` member from the `Semiring` type class.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"rep","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":"rep","tag":"TypeVar"}],"constraintClass":[["Data","Generic","Rep"],"Generic"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"rep","tag":"TypeVar"}],"constraintClass":[["Data","Semiring","Generic"],"GenericSemiring"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[46,80],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semiring/Generic.purs","start":[46,1]},"title":"genericAdd"},{"children":[],"comments":"A `Generic` implementation of the `mul` member from the `Semiring` type class.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"rep","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":"rep","tag":"TypeVar"}],"constraintClass":[["Data","Generic","Rep"],"Generic"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"rep","tag":"TypeVar"}],"constraintClass":[["Data","Semiring","Generic"],"GenericSemiring"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[50,80],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semiring/Generic.purs","start":[50,1]},"title":"genericMul"}],"name":"Data.Semiring.Generic","reExports":[]}
+ tests/purs/publish/basic-example/output/Data.Semiring/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[45,21],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semiring.purs","start":[45,3]},"title":"add"},{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":"a","tag":"TypeVar"}},"sourceSpan":{"end":[46,12],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semiring.purs","start":[46,3]},"title":"zero"},{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[47,21],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semiring.purs","start":[47,3]},"title":"mul"},{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":"a","tag":"TypeVar"}},"sourceSpan":{"end":[48,11],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semiring.purs","start":[48,3]},"title":"one"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semiring"],"Semiring"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[57,10],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semiring.purs","start":[53,1]},"title":"semiringInt"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semiring"],"Semiring"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Number"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[63,12],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semiring.purs","start":[59,1]},"title":"semiringNumber"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"b","tag":"TypeVar"}],"constraintClass":[["Data","Semiring"],"Semiring"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semiring"],"Semiring"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[69,18],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semiring.purs","start":[65,1]},"title":"semiringFn"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semiring"],"Semiring"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[75,13],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semiring.purs","start":[71,1]},"title":"semiringUnit"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semiring"],"Semiring"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[81,15],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semiring.purs","start":[77,1]},"title":"semiringProxy"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"row","tag":"TypeVar"},{"annotation":[],"contents":"list","tag":"TypeVar"}],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"list","tag":"TypeVar"},{"annotation":[],"contents":"row","tag":"TypeVar"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"constraintClass":[["Data","Semiring"],"SemiringRecord"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semiring"],"Semiring"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[87,63],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semiring.purs","start":[83,1]},"title":"semiringRecord"}],"comments":"The `Semiring` class is for types that support an addition and\nmultiplication operation.\n\nInstances must satisfy the following laws:\n\n- Commutative monoid under addition:\n - Associativity: `(a + b) + c = a + (b + c)`\n - Identity: `zero + a = a + zero = a`\n - Commutative: `a + b = b + a`\n- Monoid under multiplication:\n - Associativity: `(a * b) * c = a * (b * c)`\n - Identity: `one * a = a * one = a`\n- Multiplication distributes over addition:\n - Left distributivity: `a * (b + c) = (a * b) + (a * c)`\n - Right distributivity: `(a + b) * c = (a * c) + (b * c)`\n- Annihilation: `zero * a = a * zero = zero`\n\n**Note:** The `Number` and `Int` types are not fully law abiding\nmembers of this class hierarchy due to the potential for arithmetic\noverflows, and in the case of `Number`, the presence of `NaN` and\n`Infinity` values. The behaviour is unspecified in these cases.\n","info":{"arguments":[["a",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[48,11],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semiring.purs","start":[44,1]},"title":"Semiring"},{"children":[],"comments":null,"info":{"alias":[["Data","Semiring"],{"Right":{"Left":{"Ident":"add"}}}],"declType":"alias","fixity":{"associativity":"infixl","precedence":6}},"kind":null,"sourceSpan":{"end":[50,18],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semiring.purs","start":[50,1]},"title":"(+)"},{"children":[],"comments":null,"info":{"alias":[["Data","Semiring"],{"Right":{"Left":{"Ident":"mul"}}}],"declType":"alias","fixity":{"associativity":"infixl","precedence":7}},"kind":null,"sourceSpan":{"end":[51,18],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semiring.purs","start":[51,1]},"title":"(*)"},{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"},{"annotation":[],"contents":"rowlist","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"subrow","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[98,74],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semiring.purs","start":[98,3]},"title":"addRecord"},{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"},{"annotation":[],"contents":"rowlist","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"subrow","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[99,74],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semiring.purs","start":[99,3]},"title":"mulRecord"},{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"},{"annotation":[],"contents":"rowlist","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"subrow","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[100,59],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semiring.purs","start":[100,3]},"title":"oneRecord"},{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"},{"annotation":[],"contents":"rowlist","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"subrow","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[101,60],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semiring.purs","start":[101,3]},"title":"zeroRecord"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semiring"],"SemiringRecord"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim","RowList"],"Nil"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"tag":"REmpty"}],"tag":"TypeApp"}},"sourceSpan":{"end":[107,22],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semiring.purs","start":[103,1]},"title":"semiringRecordNil"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"key","tag":"TypeVar"}],"constraintClass":[["Data","Symbol"],"IsSymbol"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"key","tag":"TypeVar"},{"annotation":[],"contents":"focus","tag":"TypeVar"},{"annotation":[],"contents":"subrowTail","tag":"TypeVar"},{"annotation":[],"contents":"subrow","tag":"TypeVar"}],"constraintClass":[["Prim","Row"],"Cons"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"rowlistTail","tag":"TypeVar"},{"annotation":[],"contents":"row","tag":"TypeVar"},{"annotation":[],"contents":"subrowTail","tag":"TypeVar"}],"constraintClass":[["Data","Semiring"],"SemiringRecord"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"focus","tag":"TypeVar"}],"constraintClass":[["Data","Semiring"],"Semiring"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semiring"],"SemiringRecord"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim","RowList"],"Cons"],"tag":"TypeConstructor"},{"annotation":[],"contents":"key","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"focus","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"rowlistTail","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"subrow","tag":"TypeVar"}],"tag":"TypeApp"}},"sourceSpan":{"end":[140,74],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semiring.purs","start":[109,1]},"title":"semiringRecordCons"}],"comments":"A class for records where all fields have `Semiring` instances, used to\nimplement the `Semiring` instance for records.\n","info":{"arguments":[["rowlist",null],["row",null],["subrow",null]],"declType":"typeClass","fundeps":[[["rowlist"],["subrow"]]],"superclasses":[]},"kind":{"keyword":"class","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim","RowList"],"RowList"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Constraint"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[101,60],"name":"../../../support/bower_components/purescript-prelude/src/Data/Semiring.purs","start":[97,1]},"title":"SemiringRecord"}],"name":"Data.Semiring","reExports":[]}
+ tests/purs/publish/basic-example/output/Data.Show.Generic/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[15,30],"name":"../../../support/bower_components/purescript-prelude/src/Data/Show/Generic.purs","start":[15,3]},"title":"genericShow'"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Show","Generic"],"GenericShow"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Generic","Rep"],"NoConstructors"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[21,34],"name":"../../../support/bower_components/purescript-prelude/src/Data/Show/Generic.purs","start":[20,1]},"title":"genericShowNoConstructors"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Show","Generic"],"GenericShow"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"b","tag":"TypeVar"}],"constraintClass":[["Data","Show","Generic"],"GenericShow"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Show","Generic"],"GenericShow"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Generic","Rep"],"Sum"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[28,40],"name":"../../../support/bower_components/purescript-prelude/src/Data/Show/Generic.purs","start":[26,1]},"title":"genericShowSum"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Show","Generic"],"GenericShowArgs"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"name","tag":"TypeVar"}],"constraintClass":[["Data","Symbol"],"IsSymbol"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Show","Generic"],"GenericShow"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Generic","Rep"],"Constructor"],"tag":"TypeConstructor"},{"annotation":[],"contents":"name","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[48,47],"name":"../../../support/bower_components/purescript-prelude/src/Data/Show/Generic.purs","start":[37,1]},"title":"genericShowConstructor"}],"comments":null,"info":{"arguments":[["a",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[15,30],"name":"../../../support/bower_components/purescript-prelude/src/Data/Show/Generic.purs","start":[14,1]},"title":"GenericShow"},{"children":[],"comments":"A `Generic` implementation of the `show` member from the `Show` type class.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"rep","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":"rep","tag":"TypeVar"}],"constraintClass":[["Data","Generic","Rep"],"Generic"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"rep","tag":"TypeVar"}],"constraintClass":[["Data","Show","Generic"],"GenericShow"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[54,77],"name":"../../../support/bower_components/purescript-prelude/src/Data/Show/Generic.purs","start":[54,1]},"title":"genericShow"},{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Array"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[18,39],"name":"../../../support/bower_components/purescript-prelude/src/Data/Show/Generic.purs","start":[18,3]},"title":"genericShowArgs"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Show","Generic"],"GenericShowArgs"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Generic","Rep"],"NoArguments"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[24,25],"name":"../../../support/bower_components/purescript-prelude/src/Data/Show/Generic.purs","start":[23,1]},"title":"genericShowArgsNoArguments"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Show","Generic"],"GenericShowArgs"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"b","tag":"TypeVar"}],"constraintClass":[["Data","Show","Generic"],"GenericShowArgs"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Show","Generic"],"GenericShowArgs"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Generic","Rep"],"Product"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[35,73],"name":"../../../support/bower_components/purescript-prelude/src/Data/Show/Generic.purs","start":[30,1]},"title":"genericShowArgsProduct"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Show"],"Show"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Show","Generic"],"GenericShowArgs"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Generic","Rep"],"Argument"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[51,44],"name":"../../../support/bower_components/purescript-prelude/src/Data/Show/Generic.purs","start":[50,1]},"title":"genericShowArgsArgument"}],"comments":null,"info":{"arguments":[["a",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[18,39],"name":"../../../support/bower_components/purescript-prelude/src/Data/Show/Generic.purs","start":[17,1]},"title":"GenericShowArgs"}],"name":"Data.Show.Generic","reExports":[]}
+ tests/purs/publish/basic-example/output/Data.Show/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[24,22],"name":"../../../support/bower_components/purescript-prelude/src/Data/Show.purs","start":[24,3]},"title":"show"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Show"],"Show"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[27,18],"name":"../../../support/bower_components/purescript-prelude/src/Data/Show.purs","start":[26,1]},"title":"showUnit"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Show"],"Show"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[31,23],"name":"../../../support/bower_components/purescript-prelude/src/Data/Show.purs","start":[29,1]},"title":"showBoolean"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Show"],"Show"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[34,21],"name":"../../../support/bower_components/purescript-prelude/src/Data/Show.purs","start":[33,1]},"title":"showInt"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Show"],"Show"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Number"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[37,24],"name":"../../../support/bower_components/purescript-prelude/src/Data/Show.purs","start":[36,1]},"title":"showNumber"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Show"],"Show"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Char"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[40,22],"name":"../../../support/bower_components/purescript-prelude/src/Data/Show.purs","start":[39,1]},"title":"showChar"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Show"],"Show"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[43,24],"name":"../../../support/bower_components/purescript-prelude/src/Data/Show.purs","start":[42,1]},"title":"showString"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Show"],"Show"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Show"],"Show"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Array"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[46,28],"name":"../../../support/bower_components/purescript-prelude/src/Data/Show.purs","start":[45,1]},"title":"showArray"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Show"],"Show"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[49,19],"name":"../../../support/bower_components/purescript-prelude/src/Data/Show.purs","start":[48,1]},"title":"showProxy"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Show"],"Show"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Void"],"Void"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[52,16],"name":"../../../support/bower_components/purescript-prelude/src/Data/Show.purs","start":[51,1]},"title":"showVoid"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"rs","tag":"TypeVar"},{"annotation":[],"contents":"rs","tag":"TypeVar"}],"constraintClass":[["Prim","Row"],"Nub"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"rs","tag":"TypeVar"},{"annotation":[],"contents":"ls","tag":"TypeVar"}],"constraintClass":[["Prim","RowList"],"RowToList"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"ls","tag":"TypeVar"},{"annotation":[],"contents":"rs","tag":"TypeVar"}],"constraintClass":[["Data","Show"],"ShowRecordFields"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Show"],"Show"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"rs","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[60,74],"name":"../../../support/bower_components/purescript-prelude/src/Data/Show.purs","start":[54,1]},"title":"showRecord"}],"comments":"The `Show` type class represents those types which can be converted into\na human-readable `String` representation.\n\nWhile not required, it is recommended that for any expression `x`, the\nstring `show x` be executable PureScript code which evaluates to the same\nvalue as the expression `x`.\n","info":{"arguments":[["a",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":{"end":[24,22],"name":"../../../support/bower_components/purescript-prelude/src/Data/Show.purs","start":[23,1]},"title":"Show"},{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"},{"annotation":[],"contents":"rowlist","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[66,60],"name":"../../../support/bower_components/purescript-prelude/src/Data/Show.purs","start":[66,3]},"title":"showRecordFields"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Show"],"ShowRecordFields"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim","RowList"],"Nil"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"}},"sourceSpan":{"end":[69,28],"name":"../../../support/bower_components/purescript-prelude/src/Data/Show.purs","start":[68,1]},"title":"showRecordFieldsNil"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"key","tag":"TypeVar"}],"constraintClass":[["Data","Symbol"],"IsSymbol"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"focus","tag":"TypeVar"}],"constraintClass":[["Data","Show"],"Show"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Show"],"ShowRecordFields"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim","RowList"],"Cons"],"tag":"TypeConstructor"},{"annotation":[],"contents":"key","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"focus","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim","RowList"],"Nil"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"}},"sourceSpan":{"end":[79,42],"name":"../../../support/bower_components/purescript-prelude/src/Data/Show.purs","start":[71,1]},"title":"showRecordFieldsConsNil"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"key","tag":"TypeVar"}],"constraintClass":[["Data","Symbol"],"IsSymbol"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"rowlistTail","tag":"TypeVar"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"constraintClass":[["Data","Show"],"ShowRecordFields"],"constraintData":null,"constraintKindArgs":[]},{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"focus","tag":"TypeVar"}],"constraintClass":[["Data","Show"],"Show"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Show"],"ShowRecordFields"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim","RowList"],"Cons"],"tag":"TypeConstructor"},{"annotation":[],"contents":"key","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"focus","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"rowlistTail","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":"row","tag":"TypeVar"}],"tag":"TypeApp"}},"sourceSpan":{"end":[91,64],"name":"../../../support/bower_components/purescript-prelude/src/Data/Show.purs","start":[81,1]},"title":"showRecordFieldsCons"}],"comments":"A class for records where all fields have `Show` instances, used to\nimplement the `Show` instance for records.\n","info":{"arguments":[["rowlist",null],["row",null]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":{"keyword":"class","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim","RowList"],"RowList"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Constraint"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[66,60],"name":"../../../support/bower_components/purescript-prelude/src/Data/Show.purs","start":[65,1]},"title":"ShowRecordFields"}],"name":"Data.Show","reExports":[]}
+ tests/purs/publish/basic-example/output/Data.Symbol/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"},{"annotation":[],"contents":"sym","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[11,39],"name":"../../../support/bower_components/purescript-prelude/src/Data/Symbol.purs","start":[11,3]},"title":"reflectSymbol"}],"comments":"A class for known symbols\n","info":{"arguments":[["sym",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":{"keyword":"class","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Constraint"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[11,39],"name":"../../../support/bower_components/purescript-prelude/src/Data/Symbol.purs","start":[10,1]},"title":"IsSymbol"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"r","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":{"identifier":"sym","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"sym","tag":"TypeVar"}],"constraintClass":[["Data","Symbol"],"IsSymbol"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Type","Proxy"],"Proxy"],"tag":"TypeConstructor"},{"annotation":[],"contents":"sym","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[16,85],"name":"../../../support/bower_components/purescript-prelude/src/Data/Symbol.purs","start":[16,1]},"title":"reifySymbol"}],"name":"Data.Symbol","reExports":[]}
+ tests/purs/publish/basic-example/output/Data.Unit/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[],"comments":"The `Unit` type has a single inhabitant, called `unit`. It represents\nvalues with no computational content.\n\n`Unit` is often used, wrapped in a monadic type constructor, as the\nreturn type of a computation where only the _effects_ are important.\n\nWhen returning a value of type `Unit` from an FFI function, it is\nrecommended to use `undefined`, or not return a value at all.\n","info":{"dataDeclType":"data","declType":"data","roles":[],"typeArguments":[]},"kind":null,"sourceSpan":{"end":[11,33],"name":"../../../support/bower_components/purescript-prelude/src/Data/Unit.purs","start":[11,1]},"title":"Unit"},{"children":[],"comments":"`unit` is the sole inhabitant of the `Unit` type.\n","info":{"declType":"value","type":{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[14,28],"name":"../../../support/bower_components/purescript-prelude/src/Data/Unit.purs","start":[14,1]},"title":"unit"}],"name":"Data.Unit","reExports":[]}
+ tests/purs/publish/basic-example/output/Data.Void/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[],"comments":"An uninhabited data type. In other words, one can never create\na runtime value of type `Void` because no such value exists.\n\n`Void` is useful to eliminate the possibility of a value being created.\nFor example, a value of type `Either Void Boolean` can never have\na Left value created in PureScript.\n\nThis should not be confused with the keyword `void` that commonly appears in\nC-family languages, such as Java:\n```\npublic class Foo {\n void doSomething() { System.out.println(\"hello world!\"); }\n}\n```\n\nIn PureScript, one often uses `Unit` to achieve similar effects as\nthe `void` of C-family languages above.\n","info":{"dataDeclType":"newtype","declType":"data","roles":[],"typeArguments":[]},"kind":null,"sourceSpan":{"end":[20,25],"name":"../../../support/bower_components/purescript-prelude/src/Data/Void.purs","start":[20,1]},"title":"Void"},{"children":[],"comments":"Eliminator for the `Void` type.\nUseful for stating that some code branch is impossible because you've\n\"acquired\" a value of type `Void` (which you can't).\n\n```purescript\nrightOnly :: forall t . Either Void t -> t\nrightOnly (Left v) = absurd v\nrightOnly (Right t) = t\n```\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Void"],"Void"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[31,30],"name":"../../../support/bower_components/purescript-prelude/src/Data/Void.purs","start":[31,1]},"title":"absurd"}],"name":"Data.Void","reExports":[]}
+ tests/purs/publish/basic-example/output/Effect.Class.Console/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"m","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"m","tag":"TypeVar"}],"constraintClass":[["Effect","Class"],"MonadEffect"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[10,51],"name":"../../../support/bower_components/purescript-console/src/Effect/Class/Console.purs","start":[10,1]},"title":"log"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"m","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"m","tag":"TypeVar"}],"constraintClass":[["Effect","Class"],"MonadEffect"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Show"],"Show"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[13,62],"name":"../../../support/bower_components/purescript-console/src/Effect/Class/Console.purs","start":[13,1]},"title":"logShow"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"m","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"m","tag":"TypeVar"}],"constraintClass":[["Effect","Class"],"MonadEffect"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[16,52],"name":"../../../support/bower_components/purescript-console/src/Effect/Class/Console.purs","start":[16,1]},"title":"warn"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"m","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"m","tag":"TypeVar"}],"constraintClass":[["Effect","Class"],"MonadEffect"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Show"],"Show"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[19,63],"name":"../../../support/bower_components/purescript-console/src/Effect/Class/Console.purs","start":[19,1]},"title":"warnShow"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"m","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"m","tag":"TypeVar"}],"constraintClass":[["Effect","Class"],"MonadEffect"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[22,53],"name":"../../../support/bower_components/purescript-console/src/Effect/Class/Console.purs","start":[22,1]},"title":"error"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"m","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"m","tag":"TypeVar"}],"constraintClass":[["Effect","Class"],"MonadEffect"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Show"],"Show"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[25,64],"name":"../../../support/bower_components/purescript-console/src/Effect/Class/Console.purs","start":[25,1]},"title":"errorShow"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"m","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"m","tag":"TypeVar"}],"constraintClass":[["Effect","Class"],"MonadEffect"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[28,52],"name":"../../../support/bower_components/purescript-console/src/Effect/Class/Console.purs","start":[28,1]},"title":"info"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"m","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"m","tag":"TypeVar"}],"constraintClass":[["Effect","Class"],"MonadEffect"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Show"],"Show"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[31,63],"name":"../../../support/bower_components/purescript-console/src/Effect/Class/Console.purs","start":[31,1]},"title":"infoShow"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"m","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"m","tag":"TypeVar"}],"constraintClass":[["Effect","Class"],"MonadEffect"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[34,53],"name":"../../../support/bower_components/purescript-console/src/Effect/Class/Console.purs","start":[34,1]},"title":"debug"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"m","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"m","tag":"TypeVar"}],"constraintClass":[["Effect","Class"],"MonadEffect"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Show"],"Show"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[37,64],"name":"../../../support/bower_components/purescript-console/src/Effect/Class/Console.purs","start":[37,1]},"title":"debugShow"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"m","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"m","tag":"TypeVar"}],"constraintClass":[["Effect","Class"],"MonadEffect"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[40,52],"name":"../../../support/bower_components/purescript-console/src/Effect/Class/Console.purs","start":[40,1]},"title":"time"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"m","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"m","tag":"TypeVar"}],"constraintClass":[["Effect","Class"],"MonadEffect"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[43,55],"name":"../../../support/bower_components/purescript-console/src/Effect/Class/Console.purs","start":[43,1]},"title":"timeLog"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"m","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"m","tag":"TypeVar"}],"constraintClass":[["Effect","Class"],"MonadEffect"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[46,55],"name":"../../../support/bower_components/purescript-console/src/Effect/Class/Console.purs","start":[46,1]},"title":"timeEnd"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"m","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"m","tag":"TypeVar"}],"constraintClass":[["Effect","Class"],"MonadEffect"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[49,43],"name":"../../../support/bower_components/purescript-console/src/Effect/Class/Console.purs","start":[49,1]},"title":"clear"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"m","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"m","tag":"TypeVar"}],"constraintClass":[["Effect","Class"],"MonadEffect"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[52,53],"name":"../../../support/bower_components/purescript-console/src/Effect/Class/Console.purs","start":[52,1]},"title":"group"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"m","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"m","tag":"TypeVar"}],"constraintClass":[["Effect","Class"],"MonadEffect"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[55,62],"name":"../../../support/bower_components/purescript-console/src/Effect/Class/Console.purs","start":[55,1]},"title":"groupCollapsed"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"m","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"m","tag":"TypeVar"}],"constraintClass":[["Effect","Class"],"MonadEffect"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[58,46],"name":"../../../support/bower_components/purescript-console/src/Effect/Class/Console.purs","start":[58,1]},"title":"groupEnd"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"m","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"m","tag":"TypeVar"}],"constraintClass":[["Effect","Class"],"MonadEffect"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[61,61],"name":"../../../support/bower_components/purescript-console/src/Effect/Class/Console.purs","start":[61,1]},"title":"grouped"}],"name":"Effect.Class.Console","reExports":[]}
+ tests/purs/publish/basic-example/output/Effect.Class/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"declType":"typeClassMember","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":"m","tag":"TypeVar"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[16,42],"name":"../../../support/bower_components/purescript-effect/src/Effect/Class.purs","start":[16,3]},"title":"liftEffect"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect","Class"],"MonadEffect"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[19,24],"name":"../../../support/bower_components/purescript-effect/src/Effect/Class.purs","start":[18,1]},"title":"monadEffectEffect"}],"comments":"The `MonadEffect` class captures those monads which support native effects.\n\nInstances are provided for `Effect` itself, and the standard monad\ntransformers.\n\n`liftEffect` can be used in any appropriate monad transformer stack to lift an\naction of type `Effect a` into the monad.\n\n","info":{"arguments":[["m",null]],"declType":"typeClass","fundeps":[],"superclasses":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"m","tag":"TypeVar"}],"constraintClass":[["Control","Monad"],"Monad"],"constraintData":null,"constraintKindArgs":[]}]},"kind":{"keyword":"class","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Constraint"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[16,42],"name":"../../../support/bower_components/purescript-effect/src/Effect/Class.purs","start":[15,1]},"title":"MonadEffect"}],"name":"Effect.Class","reExports":[]}
+ tests/purs/publish/basic-example/output/Effect.Console/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[],"comments":"Write a message to the console.\n","info":{"declType":"value","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"kind":null,"sourceSpan":{"end":[12,17],"name":"../../../support/bower_components/purescript-console/src/Effect/Console.purs","start":[10,1]},"title":"log"},{"children":[],"comments":"Write a value to the console, using its `Show` instance to produce a\n`String`.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Show"],"Show"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[16,48],"name":"../../../support/bower_components/purescript-console/src/Effect/Console.purs","start":[16,1]},"title":"logShow"},{"children":[],"comments":"Write an warning to the console.\n","info":{"declType":"value","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"kind":null,"sourceSpan":{"end":[22,17],"name":"../../../support/bower_components/purescript-console/src/Effect/Console.purs","start":[20,1]},"title":"warn"},{"children":[],"comments":"Write an warning value to the console, using its `Show` instance to produce\na `String`.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Show"],"Show"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[26,49],"name":"../../../support/bower_components/purescript-console/src/Effect/Console.purs","start":[26,1]},"title":"warnShow"},{"children":[],"comments":"Write an error to the console.\n","info":{"declType":"value","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"kind":null,"sourceSpan":{"end":[32,17],"name":"../../../support/bower_components/purescript-console/src/Effect/Console.purs","start":[30,1]},"title":"error"},{"children":[],"comments":"Write an error value to the console, using its `Show` instance to produce a\n`String`.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Show"],"Show"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[36,50],"name":"../../../support/bower_components/purescript-console/src/Effect/Console.purs","start":[36,1]},"title":"errorShow"},{"children":[],"comments":"Write an info message to the console.\n","info":{"declType":"value","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"kind":null,"sourceSpan":{"end":[42,17],"name":"../../../support/bower_components/purescript-console/src/Effect/Console.purs","start":[40,1]},"title":"info"},{"children":[],"comments":"Write an info value to the console, using its `Show` instance to produce a\n`String`.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Show"],"Show"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[46,49],"name":"../../../support/bower_components/purescript-console/src/Effect/Console.purs","start":[46,1]},"title":"infoShow"},{"children":[],"comments":"Write an debug message to the console.\n","info":{"declType":"value","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"kind":null,"sourceSpan":{"end":[52,17],"name":"../../../support/bower_components/purescript-console/src/Effect/Console.purs","start":[50,1]},"title":"debug"},{"children":[],"comments":"Write an debug value to the console, using its `Show` instance to produce a\n`String`.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Show"],"Show"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[56,50],"name":"../../../support/bower_components/purescript-console/src/Effect/Console.purs","start":[56,1]},"title":"debugShow"},{"children":[],"comments":"Start a named timer.\n","info":{"declType":"value","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"kind":null,"sourceSpan":{"end":[60,45],"name":"../../../support/bower_components/purescript-console/src/Effect/Console.purs","start":[60,1]},"title":"time"},{"children":[],"comments":"Print the time since a named timer started in milliseconds.\n","info":{"declType":"value","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"kind":null,"sourceSpan":{"end":[63,48],"name":"../../../support/bower_components/purescript-console/src/Effect/Console.purs","start":[63,1]},"title":"timeLog"},{"children":[],"comments":"Stop a named timer and print time since it started in milliseconds.\n","info":{"declType":"value","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"kind":null,"sourceSpan":{"end":[66,48],"name":"../../../support/bower_components/purescript-console/src/Effect/Console.purs","start":[66,1]},"title":"timeEnd"},{"children":[],"comments":"Clears the console\n","info":{"declType":"value","type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":null,"sourceSpan":{"end":[69,36],"name":"../../../support/bower_components/purescript-console/src/Effect/Console.purs","start":[69,1]},"title":"clear"},{"children":[],"comments":"Creates a new inline group in the console. This indents following console\nmessages by an additional level, until `groupEnd` is called.\n","info":{"declType":"value","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"kind":null,"sourceSpan":{"end":[73,46],"name":"../../../support/bower_components/purescript-console/src/Effect/Console.purs","start":[73,1]},"title":"group"},{"children":[],"comments":"Same as `group`, but groups are collapsed by default.\n","info":{"declType":"value","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"kind":null,"sourceSpan":{"end":[76,55],"name":"../../../support/bower_components/purescript-console/src/Effect/Console.purs","start":[76,1]},"title":"groupCollapsed"},{"children":[],"comments":"Exits the current inline group in the console.\n","info":{"declType":"value","type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":null,"sourceSpan":{"end":[79,39],"name":"../../../support/bower_components/purescript-console/src/Effect/Console.purs","start":[79,1]},"title":"groupEnd"},{"children":[],"comments":"Perform an effect within the context of an inline group in the console.\nCalls `group` and `groupEnd` before and after the effect, respectively.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[83,52],"name":"../../../support/bower_components/purescript-console/src/Effect/Console.purs","start":[83,1]},"title":"grouped"}],"name":"Effect.Console","reExports":[]}
+ tests/purs/publish/basic-example/output/Effect.Uncurried/docs.json view
@@ -0,0 +1,1 @@+{"comments":"This module defines types for effectful uncurried functions, as well as\nfunctions for converting back and forth between them.\n\nThis makes it possible to give a PureScript type to JavaScript functions\nsuch as this one:\n\n```javascript\nfunction logMessage(level, message) {\n console.log(level + \": \" + message);\n}\n```\n\nIn particular, note that `logMessage` performs effects immediately after\nreceiving all of its parameters, so giving it the type `Data.Function.Fn2\nString String Unit`, while convenient, would effectively be a lie.\n\nOne way to handle this would be to convert the function into the normal\nPureScript form (namely, a curried function returning an Effect action),\nand performing the marshalling in JavaScript, in the FFI module, like this:\n\n```purescript\n-- In the PureScript file:\nforeign import logMessage :: String -> String -> Effect Unit\n```\n\n```javascript\n// In the FFI file:\nexports.logMessage = function(level) {\n return function(message) {\n return function() {\n logMessage(level, message);\n };\n };\n};\n```\n\nThis method, unfortunately, turns out to be both tiresome and error-prone.\nThis module offers an alternative solution. By providing you with:\n\n * the ability to give the real `logMessage` function a PureScript type,\n and\n * functions for converting between this form and the normal PureScript\n form,\n\nthe FFI boilerplate is no longer needed. The previous example becomes:\n\n```purescript\n-- In the PureScript file:\nforeign import logMessageImpl :: EffectFn2 String String Unit\n```\n\n```javascript\n// In the FFI file:\nexports.logMessageImpl = logMessage\n```\n\nYou can then use `runEffectFn2` to provide a nicer version:\n\n```purescript\nlogMessage :: String -> String -> Effect Unit\nlogMessage = runEffectFn2 logMessageImpl\n```\n\n(note that this has the same type as the original `logMessage`).\n\nEffectively, we have reduced the risk of errors by moving as much code into\nPureScript as possible, so that we can leverage the type system. Hopefully,\nthis is a little less tiresome too.\n\nHere's a slightly more advanced example. Here, because we are using\ncallbacks, we need to use `mkEffectFn{N}` as well.\n\nSuppose our `logMessage` changes so that it sometimes sends details of the\nmessage to some external server, and in those cases, we want the resulting\n`HttpResponse` (for whatever reason).\n\n```javascript\nfunction logMessage(level, message, callback) {\n console.log(level + \": \" + message);\n if (level > LogLevel.WARN) {\n LogAggregatorService.post(\"/logs\", {\n level: level,\n message: message\n }, callback);\n } else {\n callback(null);\n }\n}\n```\n\nThe import then looks like this:\n```purescript\nforeign import logMessageImpl\n EffectFn3\n String\n String\n (EffectFn1 (Nullable HttpResponse) Unit)\n Unit\n```\n\nAnd, as before, the FFI file is extremely simple:\n\n```javascript\nexports.logMessageImpl = logMessage\n```\n\nFinally, we use `runEffectFn{N}` and `mkEffectFn{N}` for a more comfortable\nPureScript version:\n\n```purescript\nlogMessage ::\n String ->\n String ->\n (Nullable HttpResponse -> Effect Unit) ->\n Effect Unit\nlogMessage level message callback =\n runEffectFn3 logMessageImpl level message (mkEffectFn1 callback)\n```\n\nThe general naming scheme for functions and types in this module is as\nfollows:\n\n* `EffectFn{N}` means, an uncurried function which accepts N arguments and\n performs some effects. The first N arguments are the actual function's\n argument. The last type argument is the return type.\n* `runEffectFn{N}` takes an `EffectFn` of N arguments, and converts it into\n the normal PureScript form: a curried function which returns an Effect\n action.\n* `mkEffectFn{N}` is the inverse of `runEffectFn{N}`. It can be useful for\n callbacks.\n\n","declarations":[{"children":[{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"r","tag":"TypeVar"}],"constraintClass":[["Data","Semigroup"],"Semigroup"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semigroup"],"Semigroup"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect","Uncurried"],"EffectFn1"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[229,74],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[228,1]},"title":"semigroupEffectFn1"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"r","tag":"TypeVar"}],"constraintClass":[["Data","Monoid"],"Monoid"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid"],"Monoid"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect","Uncurried"],"EffectFn1"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[259,36],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[258,1]},"title":"monoidEffectFn1"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Representational","Representational"],"typeArguments":[["t0",null],["t1",null]]},"kind":null,"sourceSpan":{"end":[138,54],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[138,1]},"title":"EffectFn1"},{"children":[{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"r","tag":"TypeVar"}],"constraintClass":[["Data","Semigroup"],"Semigroup"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semigroup"],"Semigroup"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect","Uncurried"],"EffectFn2"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[232,80],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[231,1]},"title":"semigroupEffectFn2"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"r","tag":"TypeVar"}],"constraintClass":[["Data","Monoid"],"Monoid"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid"],"Monoid"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect","Uncurried"],"EffectFn2"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[262,38],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[261,1]},"title":"monoidEffectFn2"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Representational","Representational","Representational"],"typeArguments":[["t0",null],["t1",null],["t2",null]]},"kind":null,"sourceSpan":{"end":[142,62],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[142,1]},"title":"EffectFn2"},{"children":[{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"r","tag":"TypeVar"}],"constraintClass":[["Data","Semigroup"],"Semigroup"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semigroup"],"Semigroup"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect","Uncurried"],"EffectFn3"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[235,86],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[234,1]},"title":"semigroupEffectFn3"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"r","tag":"TypeVar"}],"constraintClass":[["Data","Monoid"],"Monoid"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid"],"Monoid"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect","Uncurried"],"EffectFn3"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[265,40],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[264,1]},"title":"monoidEffectFn3"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Representational","Representational","Representational","Representational"],"typeArguments":[["t0",null],["t1",null],["t2",null],["t3",null]]},"kind":null,"sourceSpan":{"end":[146,70],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[146,1]},"title":"EffectFn3"},{"children":[{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"r","tag":"TypeVar"}],"constraintClass":[["Data","Semigroup"],"Semigroup"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semigroup"],"Semigroup"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect","Uncurried"],"EffectFn4"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[238,92],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[237,1]},"title":"semigroupEffectFn4"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"r","tag":"TypeVar"}],"constraintClass":[["Data","Monoid"],"Monoid"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid"],"Monoid"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect","Uncurried"],"EffectFn4"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[268,42],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[267,1]},"title":"monoidEffectFn4"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Representational","Representational","Representational","Representational","Representational"],"typeArguments":[["t0",null],["t1",null],["t2",null],["t3",null],["t4",null]]},"kind":null,"sourceSpan":{"end":[150,78],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[150,1]},"title":"EffectFn4"},{"children":[{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"r","tag":"TypeVar"}],"constraintClass":[["Data","Semigroup"],"Semigroup"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semigroup"],"Semigroup"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect","Uncurried"],"EffectFn5"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"e","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[241,98],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[240,1]},"title":"semigroupEffectFn5"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"r","tag":"TypeVar"}],"constraintClass":[["Data","Monoid"],"Monoid"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid"],"Monoid"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect","Uncurried"],"EffectFn5"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"e","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[271,44],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[270,1]},"title":"monoidEffectFn5"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Representational","Representational","Representational","Representational","Representational","Representational"],"typeArguments":[["t0",null],["t1",null],["t2",null],["t3",null],["t4",null],["t5",null]]},"kind":null,"sourceSpan":{"end":[154,86],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[154,1]},"title":"EffectFn5"},{"children":[{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"r","tag":"TypeVar"}],"constraintClass":[["Data","Semigroup"],"Semigroup"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semigroup"],"Semigroup"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect","Uncurried"],"EffectFn6"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"e","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"f","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[244,104],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[243,1]},"title":"semigroupEffectFn6"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"r","tag":"TypeVar"}],"constraintClass":[["Data","Monoid"],"Monoid"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid"],"Monoid"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect","Uncurried"],"EffectFn6"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"e","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"f","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[274,46],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[273,1]},"title":"monoidEffectFn6"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Representational","Representational","Representational","Representational","Representational","Representational","Representational"],"typeArguments":[["t0",null],["t1",null],["t2",null],["t3",null],["t4",null],["t5",null],["t6",null]]},"kind":null,"sourceSpan":{"end":[158,94],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[158,1]},"title":"EffectFn6"},{"children":[{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"r","tag":"TypeVar"}],"constraintClass":[["Data","Semigroup"],"Semigroup"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semigroup"],"Semigroup"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect","Uncurried"],"EffectFn7"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"e","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"f","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"g","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[247,110],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[246,1]},"title":"semigroupEffectFn7"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"r","tag":"TypeVar"}],"constraintClass":[["Data","Monoid"],"Monoid"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid"],"Monoid"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect","Uncurried"],"EffectFn7"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"e","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"f","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"g","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[277,48],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[276,1]},"title":"monoidEffectFn7"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Representational","Representational","Representational","Representational","Representational","Representational","Representational","Representational"],"typeArguments":[["t0",null],["t1",null],["t2",null],["t3",null],["t4",null],["t5",null],["t6",null],["t7",null]]},"kind":null,"sourceSpan":{"end":[162,102],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[162,1]},"title":"EffectFn7"},{"children":[{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"r","tag":"TypeVar"}],"constraintClass":[["Data","Semigroup"],"Semigroup"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semigroup"],"Semigroup"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect","Uncurried"],"EffectFn8"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"e","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"f","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"g","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"h","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[250,116],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[249,1]},"title":"semigroupEffectFn8"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"r","tag":"TypeVar"}],"constraintClass":[["Data","Monoid"],"Monoid"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid"],"Monoid"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect","Uncurried"],"EffectFn8"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"e","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"f","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"g","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"h","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[280,50],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[279,1]},"title":"monoidEffectFn8"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Representational","Representational","Representational","Representational","Representational","Representational","Representational","Representational","Representational"],"typeArguments":[["t0",null],["t1",null],["t2",null],["t3",null],["t4",null],["t5",null],["t6",null],["t7",null],["t8",null]]},"kind":null,"sourceSpan":{"end":[166,110],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[166,1]},"title":"EffectFn8"},{"children":[{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"r","tag":"TypeVar"}],"constraintClass":[["Data","Semigroup"],"Semigroup"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semigroup"],"Semigroup"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect","Uncurried"],"EffectFn9"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"e","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"f","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"g","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"h","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"i","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[253,122],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[252,1]},"title":"semigroupEffectFn9"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"r","tag":"TypeVar"}],"constraintClass":[["Data","Monoid"],"Monoid"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid"],"Monoid"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect","Uncurried"],"EffectFn9"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"e","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"f","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"g","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"h","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"i","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[283,52],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[282,1]},"title":"monoidEffectFn9"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Representational","Representational","Representational","Representational","Representational","Representational","Representational","Representational","Representational","Representational"],"typeArguments":[["t0",null],["t1",null],["t2",null],["t3",null],["t4",null],["t5",null],["t6",null],["t7",null],["t8",null],["t9",null]]},"kind":null,"sourceSpan":{"end":[170,118],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[170,1]},"title":"EffectFn9"},{"children":[{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"r","tag":"TypeVar"}],"constraintClass":[["Data","Semigroup"],"Semigroup"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semigroup"],"Semigroup"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect","Uncurried"],"EffectFn10"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"e","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"f","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"g","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"h","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"i","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"j","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[256,131],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[255,1]},"title":"semigroupEffectFn10"},{"comments":null,"info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"r","tag":"TypeVar"}],"constraintClass":[["Data","Monoid"],"Monoid"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid"],"Monoid"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect","Uncurried"],"EffectFn10"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"e","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"f","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"g","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"h","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"i","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"j","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[286,55],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[285,1]},"title":"monoidEffectFn10"}],"comments":null,"info":{"dataDeclType":"data","declType":"data","roles":["Representational","Representational","Representational","Representational","Representational","Representational","Representational","Representational","Representational","Representational","Representational"],"typeArguments":[["t0",null],["t1",null],["t2",null],["t3",null],["t4",null],["t5",null],["t6",null],["t7",null],["t8",null],["t9",null],["t10",null]]},"kind":null,"sourceSpan":{"end":[174,127],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[174,1]},"title":"EffectFn10"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"r","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect","Uncurried"],"EffectFn1"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[179,35],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[178,1]},"title":"mkEffectFn1"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"r","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect","Uncurried"],"EffectFn2"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[181,42],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[180,1]},"title":"mkEffectFn2"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"c","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"r","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect","Uncurried"],"EffectFn3"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[183,49],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[182,1]},"title":"mkEffectFn3"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"c","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"d","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"r","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect","Uncurried"],"EffectFn4"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[185,56],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[184,1]},"title":"mkEffectFn4"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"c","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"d","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"e","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"r","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"e","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect","Uncurried"],"EffectFn5"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"e","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[187,63],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[186,1]},"title":"mkEffectFn5"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"c","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"d","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"e","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"f","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"r","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"e","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"f","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect","Uncurried"],"EffectFn6"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"e","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"f","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[189,70],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[188,1]},"title":"mkEffectFn6"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"c","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"d","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"e","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"f","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"g","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"r","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"e","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"f","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"g","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect","Uncurried"],"EffectFn7"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"e","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"f","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"g","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[191,77],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[190,1]},"title":"mkEffectFn7"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"c","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"d","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"e","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"f","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"g","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"h","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"r","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"e","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"f","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"g","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"h","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect","Uncurried"],"EffectFn8"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"e","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"f","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"g","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"h","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[193,84],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[192,1]},"title":"mkEffectFn8"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"c","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"d","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"e","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"f","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"g","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"h","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"i","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"r","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"e","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"f","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"g","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"h","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"i","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect","Uncurried"],"EffectFn9"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"e","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"f","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"g","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"h","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"i","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[195,91],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[194,1]},"title":"mkEffectFn9"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"c","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"d","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"e","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"f","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"g","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"h","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"i","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"j","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"r","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"e","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"f","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"g","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"h","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"i","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"j","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect","Uncurried"],"EffectFn10"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"e","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"f","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"g","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"h","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"i","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"j","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[197,99],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[196,1]},"title":"mkEffectFn10"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"r","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect","Uncurried"],"EffectFn1"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[200,33],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[199,1]},"title":"runEffectFn1"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"r","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect","Uncurried"],"EffectFn2"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[202,40],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[201,1]},"title":"runEffectFn2"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"c","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"r","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect","Uncurried"],"EffectFn3"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[204,47],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[203,1]},"title":"runEffectFn3"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"c","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"d","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"r","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect","Uncurried"],"EffectFn4"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[206,54],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[205,1]},"title":"runEffectFn4"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"c","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"d","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"e","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"r","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect","Uncurried"],"EffectFn5"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"e","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"e","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[208,61],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[207,1]},"title":"runEffectFn5"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"c","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"d","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"e","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"f","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"r","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect","Uncurried"],"EffectFn6"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"e","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"f","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"e","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"f","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[210,68],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[209,1]},"title":"runEffectFn6"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"c","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"d","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"e","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"f","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"g","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"r","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect","Uncurried"],"EffectFn7"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"e","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"f","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"g","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"e","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"f","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"g","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[212,75],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[211,1]},"title":"runEffectFn7"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"c","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"d","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"e","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"f","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"g","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"h","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"r","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect","Uncurried"],"EffectFn8"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"e","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"f","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"g","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"h","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"e","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"f","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"g","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"h","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[214,82],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[213,1]},"title":"runEffectFn8"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"c","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"d","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"e","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"f","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"g","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"h","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"i","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"r","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect","Uncurried"],"EffectFn9"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"e","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"f","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"g","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"h","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"i","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"e","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"f","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"g","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"h","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"i","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[216,89],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[215,1]},"title":"runEffectFn9"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"c","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"d","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"e","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"f","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"g","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"h","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"i","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"j","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"r","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect","Uncurried"],"EffectFn10"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"e","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"f","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"g","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"h","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"i","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"j","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"c","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"d","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"e","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"f","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"g","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"h","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"i","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"j","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[218,97],"name":"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs","start":[217,1]},"title":"runEffectFn10"}],"name":"Effect.Uncurried","reExports":[]}
+ tests/purs/publish/basic-example/output/Effect.Unsafe/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[],"comments":"Run an effectful computation.\n\n*Note*: use of this function can result in arbitrary side-effects.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[8,62],"name":"../../../support/bower_components/purescript-effect/src/Effect/Unsafe.purs","start":[8,1]},"title":"unsafePerformEffect"}],"name":"Effect.Unsafe","reExports":[]}
+ tests/purs/publish/basic-example/output/Effect/docs.json view
@@ -0,0 +1,1 @@+{"comments":"This module provides the `Effect` type, which is used to represent\n_native_ effects. The `Effect` type provides a typed API for effectful\ncomputations, while at the same time generating efficient JavaScript.\n","declarations":[{"children":[{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Functor"],"Functor"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[21,15],"name":"../../../support/bower_components/purescript-effect/src/Effect.purs","start":[20,1]},"title":"functorEffect"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Apply"],"Apply"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[24,13],"name":"../../../support/bower_components/purescript-effect/src/Effect.purs","start":[23,1]},"title":"applyEffect"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Applicative"],"Applicative"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[27,15],"name":"../../../support/bower_components/purescript-effect/src/Effect.purs","start":[26,1]},"title":"applicativeEffect"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Bind"],"Bind"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[32,15],"name":"../../../support/bower_components/purescript-effect/src/Effect.purs","start":[31,1]},"title":"bindEffect"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Control","Monad"],"Monad"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"sourceSpan":{"end":[36,37],"name":"../../../support/bower_components/purescript-effect/src/Effect.purs","start":[36,1]},"title":"monadEffect"},{"comments":"The `Semigroup` instance for effects allows you to run two effects, one\nafter the other, and then combine their results using the result type's\n`Semigroup` instance.\n","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Semigroup"],"Semigroup"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Semigroup"],"Semigroup"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[42,24],"name":"../../../support/bower_components/purescript-effect/src/Effect.purs","start":[41,1]},"title":"semigroupEffect"},{"comments":"If you have a `Monoid a` instance, then `mempty :: Effect a` is defined as\n`pure mempty`.\n","info":{"declType":"instance","dependencies":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"}],"constraintClass":[["Data","Monoid"],"Monoid"],"constraintData":null,"constraintKindArgs":[]}],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Monoid"],"Monoid"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"sourceSpan":{"end":[47,24],"name":"../../../support/bower_components/purescript-effect/src/Effect.purs","start":[46,1]},"title":"monoidEffect"}],"comments":"A native effect. The type parameter denotes the return type of running the\neffect, that is, an `Effect Int` is a possibly-effectful computation which\neventually produces a value of the type `Int` when it finishes.\n","info":{"dataDeclType":"data","declType":"data","roles":["Representational"],"typeArguments":[["t0",null]]},"kind":null,"sourceSpan":{"end":[16,43],"name":"../../../support/bower_components/purescript-effect/src/Effect.purs","start":[16,1]},"title":"Effect"},{"children":[],"comments":"Loop until a condition becomes `true`.\n\n`untilE b` is an effectful computation which repeatedly runs the effectful\ncomputation `b`, until its return value is `true`.\n","info":{"declType":"value","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"kind":null,"sourceSpan":{"end":[53,55],"name":"../../../support/bower_components/purescript-effect/src/Effect.purs","start":[53,1]},"title":"untilE"},{"children":[],"comments":"Loop while a condition is `true`.\n\n`whileE b m` is effectful computation which runs the effectful computation\n`b`. If its result is `true`, it runs the effectful computation `m` and\nloops. If not, the computation ends.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[60,77],"name":"../../../support/bower_components/purescript-effect/src/Effect.purs","start":[60,1]},"title":"whileE"},{"children":[],"comments":"Loop over a consecutive collection of numbers.\n\n`forE lo hi f` runs the computation returned by the function `f` for each\nof the inputs between `lo` (inclusive) and `hi` (exclusive).\n","info":{"declType":"value","type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}},"kind":null,"sourceSpan":{"end":[66,73],"name":"../../../support/bower_components/purescript-effect/src/Effect.purs","start":[66,1]},"title":"forE"},{"children":[],"comments":"Loop over an array of values.\n\n`foreachE xs f` runs the computation returned by the function `f` for each\nof the inputs `xs`.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Array"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"tag":"ParensInType"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[72,82],"name":"../../../support/bower_components/purescript-effect/src/Effect.purs","start":[72,1]},"title":"foreachE"}],"name":"Effect","reExports":[]}
+ tests/purs/publish/basic-example/output/Main/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[{"comments":null,"info":{"arguments":[{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"declType":"dataConstructor"},"sourceSpan":{"end":[8,31],"name":"/home/jordan/programming/purescript/tests/purs/publish/basic-example/src/Main.purs","start":[8,16]},"title":"Target"},{"comments":null,"info":{"declType":"instance","dependencies":[],"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Data","Newtype"],"Newtype"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Main"],"Target"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":null,"tag":"TypeWildcard"}],"tag":"TypeApp"}},"sourceSpan":{"end":[10,50],"name":"/home/jordan/programming/purescript/tests/purs/publish/basic-example/src/Main.purs","start":[10,1]},"title":"newtypeTarget"}],"comments":null,"info":{"dataDeclType":"newtype","declType":"data","roles":[],"typeArguments":[]},"kind":null,"sourceSpan":{"end":[8,31],"name":"/home/jordan/programming/purescript/tests/purs/publish/basic-example/src/Main.purs","start":[8,1]},"title":"Target"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":[["Main"],"Target"],"tag":"TypeConstructor"}},"kind":null,"sourceSpan":{"end":[12,25],"name":"/home/jordan/programming/purescript/tests/purs/publish/basic-example/src/Main.purs","start":[12,1]},"title":"greetingTarget"},{"children":[],"comments":null,"info":{"declType":"value","type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Effect"],"Effect"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Data","Unit"],"Unit"],"tag":"TypeConstructor"}],"tag":"TypeApp"}},"kind":null,"sourceSpan":{"end":[15,20],"name":"/home/jordan/programming/purescript/tests/purs/publish/basic-example/src/Main.purs","start":[15,1]},"title":"main"}],"name":"Main","reExports":[]}
+ tests/purs/publish/basic-example/output/Prelude/docs.json view
@@ -0,0 +1,1 @@+{"comments":"`Prelude` is a module that re-exports many other foundational modules from the `purescript-prelude` library\n(e.g. the Monad type class hierarchy, the Monoid type classes, Eq, Ord, etc.).\n\nTypically, this module will be imported in most other libraries and projects as an open import.\n\n```\nmodule MyModule where\n\nimport Prelude -- open import\n\nimport Data.Maybe (Maybe(..)) -- closed import\n```\n","declarations":[],"name":"Prelude","reExports":[]}
+ tests/purs/publish/basic-example/output/Prim.Boolean/docs.json view
@@ -0,0 +1,1 @@+{"comments":"The Prim.Boolean module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains a type level `Boolean` data structure.","declarations":[{"children":[],"comments":"The 'True' boolean type.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"True"},{"children":[],"comments":"The 'False' boolean type.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"False"}],"name":"Prim.Boolean","reExports":[]}
+ tests/purs/publish/basic-example/output/Prim.Coerce/docs.json view
@@ -0,0 +1,1 @@+{"comments":"The Prim.Coerce module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains an automatically solved type class for coercing types that have provably-identical runtime representations with [purescript-safe-coerce](https://pursuit.purescript.org/packages/purescript-safe-coerce).","declarations":[{"children":[],"comments":"Coercible is a two-parameter type class that has instances for types `a`\nand `b` if the compiler can infer that they have the same representation.\nCoercible constraints are solved according to the following rules:\n\n* _reflexivity_, any type has the same representation as itself:\n`Coercible a a` holds.\n\n* _symmetry_, if a type `a` can be coerced to some other type `b`, then `b`\ncan also be coerced back to `a`: `Coercible a b` implies `Coercible b a`.\n\n* _transitivity_, if a type `a` can be coerced to some other type `b` which\ncan be coerced to some other type `c`, then `a` can also be coerced to `c`:\n`Coercible a b` and `Coercible b c` imply `Coercible a c`.\n\n* Newtypes can be freely wrapped and unwrapped when their constructor is\nin scope:\n\n newtype Age = Age Int\n\n`Coercible Int Age` and `Coercible Age Int` hold since `Age` has the same\nruntime representation than `Int`.\n\nNewtype constructors have to be in scope to preserve abstraction. It's\ncommon to declare a newtype to encode some invariants (non emptiness of\narrays with `Data.Array.NonEmpty.NonEmptyArray` for example), hide its\nconstructor and export smart constructors instead. Without this restriction,\nthe guarantees provided by such newtypes would be void.\n\n* If none of the above are applicable, two types of kind `Type` may be\ncoercible, but only if their heads are the same. For example,\n`Coercible (Maybe a) (Either a b)` does not hold because `Maybe` and\n`Either` are different. Those types don't share a common runtime\nrepresentation so coercing between them would be unsafe. In addition their\narguments may need to be identical or coercible, depending on the _roles_\nof the head's type parameters. Roles are documented in [the PureScript\nlanguage reference](https://github.com/purescript/documentation/blob/master/language/Roles.md).\n\nCoercible being polykinded, we can also coerce more than types of kind `Type`:\n\n* Rows are coercible when they have the same labels, when the corresponding\npairs of types are coercible and when their tails are coercible:\n`Coercible ( label :: a | r ) ( label :: b | s )` holds when\n`Coercible a b` and `Coercible r s` do. Closed rows cannot be coerced to\nopen rows.\n\n* Higher kinded types are coercible if they are coercible when fully\nsaturated: `Coercible (f :: _ -> Type) (g :: _ -> Type)` holds when\n`Coercible (f a) (g a)` does.\n\nThis rule may seem puzzling since there is no term of type `_ -> Type` to\napply `coerce` to, but it is necessary when coercing types with higher\nkinded parameters.\n","info":{"arguments":[["a",{"annotation":[],"contents":"k","tag":"TypeVar"}],["b",{"annotation":[],"contents":"k","tag":"TypeVar"}]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Coercible"}],"name":"Prim.Coerce","reExports":[]}
+ tests/purs/publish/basic-example/output/Prim.Int/docs.json view
@@ -0,0 +1,1 @@+{"comments":"The Prim.Int module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains automatically solved type classes for working with type-level intural numbers.","declarations":[{"children":[],"comments":"Compiler solved type class for adding type-level `Int`s.\n","info":{"arguments":[["left",{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],["right",{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],["sum",{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}]],"declType":"typeClass","fundeps":[[["left","right"],["sum"]],[["left","sum"],["right"]],[["right","sum"],["left"]]],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Add"},{"children":[],"comments":"Compiler solved type class for comparing two type-level `Int`s.\nProduces an `Ordering`.\n","info":{"arguments":[["left",{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],["right",{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],["ordering",{"annotation":[],"contents":[["Prim","Ordering"],"Ordering"],"tag":"TypeConstructor"}]],"declType":"typeClass","fundeps":[[["left","right"],["ordering"]]],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Compare"},{"children":[],"comments":"Compiler solved type class for multiplying type-level `Int`s.\n","info":{"arguments":[["left",{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],["right",{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],["product",{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}]],"declType":"typeClass","fundeps":[[["left","right"],["product"]]],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Mul"},{"children":[],"comments":"Compiler solved type class for converting a type-level `Int` into a type-level `String` (i.e. `Symbol`).\n","info":{"arguments":[["int",{"annotation":[],"contents":[["Prim"],"Int"],"tag":"TypeConstructor"}],["string",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}]],"declType":"typeClass","fundeps":[[["int"],["string"]]],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"ToString"}],"name":"Prim.Int","reExports":[]}
+ tests/purs/publish/basic-example/output/Prim.Ordering/docs.json view
@@ -0,0 +1,1 @@+{"comments":"The Prim.Ordering module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains a type level `Ordering` data structure.","declarations":[{"children":[],"comments":"The `Ordering` kind represents the three possibilities of comparing two\ntypes of the same kind: `LT` (less than), `EQ` (equal to), and\n`GT` (greater than).\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Ordering"},{"children":[],"comments":"The 'less than' ordering type.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim","Ordering"],"Ordering"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"LT"},{"children":[],"comments":"The 'equal to' ordering type.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim","Ordering"],"Ordering"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"EQ"},{"children":[],"comments":"The 'greater than' ordering type.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim","Ordering"],"Ordering"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"GT"}],"name":"Prim.Ordering","reExports":[]}
+ tests/purs/publish/basic-example/output/Prim.Row/docs.json view
@@ -0,0 +1,1 @@+{"comments":"The Prim.Row module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains automatically solved type classes for working with row types.","declarations":[{"children":[],"comments":"The Union type class is used to compute the union of two rows of types\n(left-biased, including duplicates).\n\nThe third type argument represents the union of the first two.\n","info":{"arguments":[["left",{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}],["right",{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}],["union",{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}]],"declType":"typeClass","fundeps":[[["left","right"],["union"]],[["right","union"],["left"]],[["union","left"],["right"]]],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Union"},{"children":[],"comments":"The Nub type class is used to remove duplicate labels from rows.\n","info":{"arguments":[["original",{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}],["nubbed",{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}]],"declType":"typeClass","fundeps":[[["original"],["nubbed"]]],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Nub"},{"children":[],"comments":"The Lacks type class asserts that a label does not occur in a given row.\n","info":{"arguments":[["label",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],["row",{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Lacks"},{"children":[],"comments":"The Cons type class is a 4-way relation which asserts that one row of\ntypes can be obtained from another by inserting a new label/type pair on\nthe left.\n","info":{"arguments":[["label",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],["a",{"annotation":[],"contents":"k","tag":"TypeVar"}],["tail",{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}],["row",{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}]],"declType":"typeClass","fundeps":[[["label","a","tail"],["row"]],[["label","row"],["a","tail"]]],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Cons"}],"name":"Prim.Row","reExports":[]}
+ tests/purs/publish/basic-example/output/Prim.RowList/docs.json view
@@ -0,0 +1,1 @@+{"comments":"The Prim.RowList module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains a type level list (`RowList`) that represents an ordered view of a row of types.","declarations":[{"children":[],"comments":"A type level list representation of a row of types.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"roles":[]},"kind":null,"sourceSpan":null,"title":"RowList"},{"children":[],"comments":"Constructs a new `RowList` from a label, a type, and an existing tail\n`RowList`. E.g: `Cons \"x\" Int (Cons \"y\" Int Nil)`.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":{"identifier":"k","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim","RowList"],"RowList"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim","RowList"],"RowList"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Cons"},{"children":[],"comments":"The empty `RowList`.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":{"identifier":"k","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim","RowList"],"RowList"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Nil"},{"children":[],"comments":"Compiler solved type class for generating a `RowList` from a closed row\nof types. Entries are sorted by label and duplicates are preserved in\nthe order they appeared in the row.\n","info":{"arguments":[["row",{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}],["list",{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim","RowList"],"RowList"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"}]],"declType":"typeClass","fundeps":[[["row"],["list"]]],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"RowToList"}],"name":"Prim.RowList","reExports":[]}
+ tests/purs/publish/basic-example/output/Prim.Symbol/docs.json view
@@ -0,0 +1,1 @@+{"comments":"The Prim.Symbol module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains automatically solved type classes for working with `Symbols`.","declarations":[{"children":[],"comments":"Compiler solved type class for appending `Symbol`s together.\n","info":{"arguments":[["left",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],["right",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],["appended",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}]],"declType":"typeClass","fundeps":[[["left","right"],["appended"]],[["right","appended"],["left"]],[["appended","left"],["right"]]],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Append"},{"children":[],"comments":"Compiler solved type class for comparing two `Symbol`s.\nProduces an `Ordering`.\n","info":{"arguments":[["left",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],["right",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],["ordering",{"annotation":[],"contents":[["Prim","Ordering"],"Ordering"],"tag":"TypeConstructor"}]],"declType":"typeClass","fundeps":[[["left","right"],["ordering"]]],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Compare"},{"children":[],"comments":"Compiler solved type class for either splitting up a symbol into its\nhead and tail or for combining a head and tail into a new symbol.\nRequires the head to be a single character and the combined string\ncannot be empty.\n","info":{"arguments":[["head",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],["tail",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],["symbol",{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}]],"declType":"typeClass","fundeps":[[["head","tail"],["symbol"]],[["symbol"],["head","tail"]]],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Cons"}],"name":"Prim.Symbol","reExports":[]}
+ tests/purs/publish/basic-example/output/Prim.TypeError/docs.json view
@@ -0,0 +1,1 @@+{"comments":"The Prim.TypeError module is embedded in the PureScript compiler. Unlike `Prim`, it is not imported implicitly. It contains type classes that provide custom type error and warning functionality.","declarations":[{"children":[],"comments":"The Warn type class allows a custom compiler warning to be displayed.\n\nFor more information, see\n[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md).\n","info":{"arguments":[["message",{"annotation":[],"contents":[["Prim","TypeError"],"Doc"],"tag":"TypeConstructor"}]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Warn"},{"children":[],"comments":"The Fail type class is part of the custom type errors feature. To provide\na custom type error when someone tries to use a particular instance,\nwrite that instance out with a Fail constraint.\n\nFor more information, see\n[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md).\n","info":{"arguments":[["message",{"annotation":[],"contents":[["Prim","TypeError"],"Doc"],"tag":"TypeConstructor"}]],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Fail"},{"children":[],"comments":"`Doc` is the kind of type-level documents.\n\nThis kind is used with the `Fail` and `Warn` type classes.\nBuild up a `Doc` with `Text`, `Quote`, `QuoteLabel`, `Beside`, and `Above`.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Doc"},{"children":[],"comments":"The Text type constructor makes a Doc from a Symbol\nto be used in a custom type error.\n\nFor more information, see\n[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md).\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim","TypeError"],"Doc"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Text"},{"children":[],"comments":"The Quote type constructor renders any concrete type as a Doc\nto be used in a custom type error.\n\nFor more information, see\n[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md).\n","info":{"declType":"externData","kind":{"annotation":[],"contents":{"identifier":"k","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim","TypeError"],"Doc"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Quote"},{"children":[],"comments":"The `QuoteLabel` type constructor will produce a `Doc` when given a `Symbol`. When the resulting `Doc` is rendered\nfor a `Warn` or `Fail` constraint, a syntactically valid label will be produced, escaping with quotes as needed.\n\nFor more information, see\n[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md).\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Symbol"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim","TypeError"],"Doc"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"roles":[]},"kind":null,"sourceSpan":null,"title":"QuoteLabel"},{"children":[],"comments":"The Beside type constructor combines two Docs horizontally\nto be used in a custom type error.\n\nFor more information, see\n[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md).\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim","TypeError"],"Doc"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim","TypeError"],"Doc"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim","TypeError"],"Doc"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Beside"},{"children":[],"comments":"The Above type constructor combines two Docs vertically\nin a custom type error.\n\nFor more information, see\n[the Custom Type Errors guide](https://github.com/purescript/documentation/blob/master/guides/Custom-Type-Errors.md).\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim","TypeError"],"Doc"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim","TypeError"],"Doc"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim","TypeError"],"Doc"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Above"}],"name":"Prim.TypeError","reExports":[]}
+ tests/purs/publish/basic-example/output/Prim/docs.json view
@@ -0,0 +1,1 @@+{"comments":"The `Prim` module is embedded in the PureScript compiler in order to provide compiler support for certain types — for example, value literals, or syntax sugar. It is implicitly imported unqualified in every module except those that list it as a qualified import.\n\n`Prim` does not include additional built-in types and kinds that are defined deeper in the compiler such as Type wildcards (e.g. `f :: _ -> Int`) and Quantified Types. Rather, these are documented in [the PureScript language reference](https://github.com/purescript/documentation/blob/master/language/Types.md).\n","declarations":[{"children":[],"comments":"A function, which takes values of the type specified by the first type\nparameter, and returns values of the type specified by the second.\nIn the JavaScript backend, this is a standard JavaScript Function.\n\nThe type constructor `(->)` is syntactic sugar for this type constructor.\nIt is recommended to use `(->)` rather than `Function`, where possible.\n\nThat is, prefer this:\n\n f :: Number -> Number\n\nto either of these:\n\n f :: Function Number Number\n f :: (->) Number Number\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Function"},{"children":[],"comments":"An Array: a data structure supporting efficient random access. In\nthe JavaScript backend, values of this type are represented as JavaScript\nArrays at runtime.\n\nConstruct values using literals:\n\n x = [1,2,3,4,5] :: Array Int\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Array"},{"children":[],"comments":"The type of records whose fields are known at compile time. In the\nJavaScript backend, values of this type are represented as JavaScript\nObjects at runtime.\n\nThe type signature here means that the `Record` type constructor takes\na row of concrete types. For example:\n\n type Person = Record (name :: String, age :: Number)\n\nThe syntactic sugar with curly braces `{ }` is generally preferred, though:\n\n type Person = { name :: String, age :: Number }\n\nThe row associates a type to each label which appears in the record.\n\n_Technical note_: PureScript allows duplicate labels in rows, and the\nmeaning of `Record r` is based on the _first_ occurrence of each label in\nthe row `r`.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Row"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Record"},{"children":[],"comments":"A double precision floating point number (IEEE 754).\n\nConstruct values of this type with literals.\nNegative literals must be wrapped in parentheses if the negation sign could be mistaken\nfor an infix operator:\n\n x = 35.23 :: Number\n y = -1.224e6 :: Number\n z = exp (-1.0) :: Number\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Number"},{"children":[],"comments":"A 32-bit signed integer. See the `purescript-integers` package for details\nof how this is accomplished when compiling to JavaScript.\n\nConstruct values of this type with literals. Hexadecimal syntax is supported.\nNegative literals must be wrapped in parentheses if the negation sign could be mistaken\nfor an infix operator:\n\n x = -23 :: Int\n y = 0x17 :: Int\n z = complement (-24) :: Int\n\nIntegers used as types are considered to have kind `Int`.\nUnlike value-level `Int`s, which must be representable as a 32-bit signed integer,\ntype-level `Int`s are unbounded. Hexadecimal support is also supported at the type level.\n\n type One :: Int\n type One = 1\n \n type Beyond32BitSignedInt :: Int\n type Beyond32BitSignedInt = 2147483648\n \n type HexInt :: Int\n type HexInt = 0x17\n\nNegative integer literals at the type level must be\nwrapped in parentheses if the negation sign could be mistaken for an infix operator.\n\n type NegativeOne = -1\n foo :: Proxy (-1) -> ...\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Int"},{"children":[],"comments":"A String. As in JavaScript, String values represent sequences of UTF-16\ncode units, which are not required to form a valid encoding of Unicode\ntext (for example, lone surrogates are permitted).\n\nConstruct values of this type with literals, using double quotes `\"`:\n\n x = \"hello, world\" :: String\n\nMulti-line string literals are also supported with triple quotes (`\"\"\"`):\n\n x = \"\"\"multi\n line\"\"\"\n\nAt the type level, string literals represent types with kind `Symbol`.\nThese types will have kind `String` in a future release:\n\n type Hello :: Symbol\n type Hello = \"Hello, world\"\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"String"},{"children":[],"comments":"A single character (UTF-16 code unit). The JavaScript representation is a\nnormal `String`, which is guaranteed to contain one code unit. This means\nthat astral plane characters (i.e. those with code point values greater\nthan `0xFFFF`) cannot be represented as `Char` values.\n\nConstruct values of this type with literals, using single quotes `'`:\n\n x = 'a' :: Char\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Char"},{"children":[],"comments":"A JavaScript Boolean value.\n\nConstruct values of this type with the literals `true` and `false`.\n\nThe `True` and `False` types defined in `Prim.Boolean` have this type as their kind.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Boolean"},{"children":[],"comments":"The Partial type class is used to indicate that a function is *partial,*\nthat is, it is not defined for all inputs. In practice, attempting to use\na partial function with a bad input will usually cause an error to be\nthrown, although it is not safe to assume that this will happen in all\ncases. For more information, see\n[purescript-partial](https://pursuit.purescript.org/packages/purescript-partial/).\n","info":{"arguments":[],"declType":"typeClass","fundeps":[],"superclasses":[]},"kind":null,"sourceSpan":null,"title":"Partial"},{"children":[],"comments":"`Type` is the kind of all proper types: those that classify value-level terms.\nFor example the type `Boolean` has kind `Type`; denoted by `Boolean :: Type`.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Type"},{"children":[],"comments":"`Constraint` is the kind of type class constraints.\nFor example, a type class declaration like this:\n\n class Semigroup a where\n append :: a -> a -> a\n\nhas the kind signature:\n\n class Semigroup :: Type -> Constraint\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Constraint"},{"children":[],"comments":"`Symbol` is the kind of type-level strings.\n\nConstruct types of this kind using the same literal syntax as documented\nfor strings.\n\n type Hello :: Symbol\n type Hello = \"Hello, world\"\n\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Symbol"},{"children":[],"comments":"`Row` is the kind constructor of label-indexed types which map type-level strings to other types.\nThe most common use of `Row` is `Row Type`, a row mapping labels to basic (of kind `Type`) types:\n\n type ExampleRow :: Row Type\n type ExampleRow = ( name :: String, values :: Array Int )\n\nThis is the kind of `Row` expected by the `Record` type constructor.\nMore advanced row kinds like `Row (Type -> Type)` are used much less frequently.\n","info":{"declType":"externData","kind":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"roles":[]},"kind":null,"sourceSpan":null,"title":"Row"}],"name":"Prim","reExports":[]}
+ tests/purs/publish/basic-example/output/Record.Unsafe/docs.json view
@@ -0,0 +1,1 @@+{"comments":"The functions in this module are highly unsafe as they treat records like\nstringly-keyed maps and can coerce the row of labels that a record has.\n\nThese function are intended for situations where there is some other way of\nproving things about the structure of the record - for example, when using\n`RowToList`. **They should never be used for general record manipulation.**\n","declarations":[{"children":[],"comments":"Checks if a record has a key, using a string for the key.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"r1","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"r1","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Boolean"],"tag":"TypeConstructor"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[10,70],"name":"../../../support/bower_components/purescript-prelude/src/Record/Unsafe.purs","start":[10,1]},"title":"unsafeHas"},{"children":[],"comments":"Unsafely gets a value from a record, using a string for the key.\n\nIf the key does not exist this will cause a runtime error elsewhere.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"r","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"r","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[15,64],"name":"../../../support/bower_components/purescript-prelude/src/Record/Unsafe.purs","start":[15,1]},"title":"unsafeGet"},{"children":[],"comments":"Unsafely sets a value on a record, using a string for the key.\n\nThe output record's row is unspecified so can be coerced to any row. If the\noutput type is incorrect it will cause a runtime error elsewhere.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"r1","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"r2","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"r1","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"r2","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[21,82],"name":"../../../support/bower_components/purescript-prelude/src/Record/Unsafe.purs","start":[21,1]},"title":"unsafeSet"},{"children":[],"comments":"Unsafely removes a value on a record, using a string for the key.\n\nThe output record's row is unspecified so can be coerced to any row. If the\noutput type is incorrect it will cause a runtime error elsewhere.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"r1","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"r2","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[["Prim"],"String"],"tag":"TypeConstructor"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"r1","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"},{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Record"],"tag":"TypeConstructor"},{"annotation":[],"contents":"r2","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"TypeApp"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[27,78],"name":"../../../support/bower_components/purescript-prelude/src/Record/Unsafe.purs","start":[27,1]},"title":"unsafeDelete"}],"name":"Record.Unsafe","reExports":[]}
+ tests/purs/publish/basic-example/output/Safe.Coerce/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[],"comments":"Coerce a value of one type to a value of some other type, without changing\nits runtime representation. This function behaves identically to\n`unsafeCoerce` at runtime. Unlike `unsafeCoerce`, it is safe, because the\n`Coercible` constraint prevents any use of this function from compiling\nunless the compiler can prove that the two types have the same runtime\nrepresentation.\n\nOne application for this function is to avoid doing work that you know is a\nno-op because of newtypes. For example, if you have an `Array (Conj a)` and you\nwant an `Array (Disj a)`, you could do `Data.Array.map (un Conj >>> Disj)`, but\nthis performs an unnecessary traversal of the array, with O(n) cost.\n`coerce` accomplishes the same with only O(1) cost:\n\n```purescript\nmapConjToDisj :: forall a. Array (Conj a) -> Array (Disj a)\nmapConjToDisj = coerce\n```\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"constraintAnn":[],"constraintArgs":[{"annotation":[],"contents":"a","tag":"TypeVar"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"constraintClass":[["Prim","Coerce"],"Coercible"],"constraintData":null,"constraintKindArgs":[]},{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"}],"tag":"ConstrainedType"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[26,46],"name":"../../../support/bower_components/purescript-safe-coerce/src/Safe/Coerce.purs","start":[26,1]},"title":"coerce"}],"name":"Safe.Coerce","reExports":[]}
+ tests/purs/publish/basic-example/output/Type.Proxy/docs.json view
@@ -0,0 +1,1 @@+{"comments":"The `Proxy` type and values are for situations where type information is\nrequired for an input to determine the type of an output, but where it is\nnot possible or convenient to provide a _value_ for the input.\n\nA hypothetical example: if you have a class that is used to handle the\nresult of an AJAX request, you may want to use this information to set the\nexpected content type of the request, so you might have a class something\nlike this:\n\n``` purescript\nclass AjaxResponse a where\n responseType :: a -> ResponseType\n fromResponse :: Foreign -> a\n```\n\nThe problem here is `responseType` requires a value of type `a`, but we\nwon't have a value of that type until the request has been completed. The\nsolution is to use a `Proxy` type instead:\n\n``` purescript\nclass AjaxResponse a where\n responseType :: Proxy a -> ResponseType\n fromResponse :: Foreign -> a\n```\n\nWe can now call `responseType (Proxy :: Proxy SomeContentType)` to produce\na `ResponseType` for `SomeContentType` without having to construct some\nempty version of `SomeContentType` first. In situations like this where\nthe `Proxy` type can be statically determined, it is recommended to pull\nout the definition to the top level and make a declaration like:\n\n``` purescript\n_SomeContentType :: Proxy SomeContentType\n_SomeContentType = Proxy\n```\n\nThat way the proxy value can be used as `responseType _SomeContentType`\nfor improved readability. However, this is not always possible, sometimes\nthe type required will be determined by a type variable. As PureScript has\nscoped type variables, we can do things like this:\n\n``` purescript\nmakeRequest :: URL -> ResponseType -> Aff _ Foreign\nmakeRequest = ...\n\nfetchData :: forall a. (AjaxResponse a) => URL -> Aff _ a\nfetchData url = fromResponse <$> makeRequest url (responseType (Proxy :: Proxy a))\n```\n","declarations":[{"children":[{"comments":null,"info":{"arguments":[],"declType":"dataConstructor"},"sourceSpan":{"end":[53,21],"name":"../../../support/bower_components/purescript-prelude/src/Type/Proxy.purs","start":[53,14]},"title":"Proxy"}],"comments":"Proxy type for all `kind`s.\n","info":{"dataDeclType":"data","declType":"data","roles":["Phantom"],"typeArguments":[["a",null]]},"kind":{"keyword":"data","kind":{"annotation":[],"contents":{"identifier":"k","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"k","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":[["Prim"],"Type"],"tag":"TypeConstructor"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"sourceSpan":{"end":[53,21],"name":"../../../support/bower_components/purescript-prelude/src/Type/Proxy.purs","start":[53,1]},"title":"Proxy"}],"name":"Type.Proxy","reExports":[]}
+ tests/purs/publish/basic-example/output/Unsafe.Coerce/docs.json view
@@ -0,0 +1,1 @@+{"comments":null,"declarations":[{"children":[],"comments":"A _highly unsafe_ function, which can be used to persuade the type system that\nany type is the same as any other type. When using this function, it is your\n(that is, the caller's) responsibility to ensure that the underlying\nrepresentation for both types is the same.\n\nBecause this function is extraordinarily flexible, type inference\ncan greatly suffer. It is highly recommended to define specializations of\nthis function rather than using it as-is. For example:\n\n```purescript\nfromBoolean :: Boolean -> Json\nfromBoolean = unsafeCoerce\n```\n\nThis way, you won't have any nasty surprises due to the inferred type being\ndifferent to what you expected.\n\nAfter the v0.14.0 PureScript release, some of what was accomplished via\n`unsafeCoerce` can now be accomplished via `coerce` from\n`purescript-safe-coerce`. See that library's documentation for more\ncontext.\n","info":{"declType":"value","type":{"annotation":[],"contents":{"identifier":"a","kind":null,"skolem":null,"type":{"annotation":[],"contents":{"identifier":"b","kind":null,"skolem":null,"type":{"annotation":[],"contents":[{"annotation":[],"contents":[{"annotation":[],"contents":[["Prim"],"Function"],"tag":"TypeConstructor"},{"annotation":[],"contents":"a","tag":"TypeVar"}],"tag":"TypeApp"},{"annotation":[],"contents":"b","tag":"TypeVar"}],"tag":"TypeApp"},"visibility":"TypeVarInvisible"},"tag":"ForAll"},"visibility":"TypeVarInvisible"},"tag":"ForAll"}},"kind":null,"sourceSpan":{"end":[27,50],"name":"../../../support/bower_components/purescript-unsafe-coerce/src/Unsafe/Coerce.purs","start":[27,1]},"title":"unsafeCoerce"}],"name":"Unsafe.Coerce","reExports":[]}
+ tests/purs/publish/basic-example/output/cache-db.json view
@@ -0,0 +1,1 @@+{"Control.Applicative":{"../../../support/bower_components/purescript-prelude/src/Control/Applicative.purs":["2022-08-18T20:04:00Z","5889c8a23c34d2d9c7d1fe41df1512314055fafda79900099b37a76451fb6394dac06633caf5c206c432817a9c07b892b18c3b99d1013a298acc85a579aee2f1"]},"Control.Apply":{"../../../support/bower_components/purescript-prelude/src/Control/Apply.js":["2022-08-18T20:04:00Z","73ee829e5dfad80f1d5f957d0e52b1d069ea798919d608b4733cedda4736681ec26d7e33501428966bf213b8a344c1272f7658867780c7237baf90da4c9d5ad3"],"../../../support/bower_components/purescript-prelude/src/Control/Apply.purs":["2022-08-18T20:04:00Z","524e797c42f16dbc375aa2403a4867a5744116d9302bda790333251ccf88d773e079fb8c3af1f87eccdc0c0bbf682b932a48506ca5f51ef441832177fafd4eb0"]},"Control.Bind":{"../../../support/bower_components/purescript-prelude/src/Control/Bind.js":["2022-08-18T20:04:00Z","abbbecd9697ae2109a9b74f70bfce37c0589e0d99b10e090660e1c76a491744c84fd459c53172256c70cdaffde3f0dc1abe0464fa32b977cf71e789425ca8bfe"],"../../../support/bower_components/purescript-prelude/src/Control/Bind.purs":["2022-08-18T20:04:00Z","27f217ea2d5e4ab2745ad05b6d0aa36ee8809dc9d5c22162f722b2f003cf140bb18747f158daeca469a1083b7b054f9a6a9681d092598b3ea25cada7fe510d75"]},"Control.Category":{"../../../support/bower_components/purescript-prelude/src/Control/Category.purs":["2022-08-18T20:04:00Z","6431719d022f6d4230f338935381a7e116a18cdf80c67bdf76d87a7624518bc9fd1e4adfe45c8a59d77f07caf7c8e9faae741e99fada42455143c4fb924e7988"]},"Control.Monad":{"../../../support/bower_components/purescript-prelude/src/Control/Monad.purs":["2022-08-18T20:04:00Z","5d13918b1f360fb201125c334399566fdef398f1b44af0754cb261b6e514481b26a0d4ad892944d4a52d513c41a20702d9973be000d9e2436c4fb48940cc07ca"]},"Control.Semigroupoid":{"../../../support/bower_components/purescript-prelude/src/Control/Semigroupoid.purs":["2022-08-18T20:04:00Z","f5b1e9fdd81471d37f763b7fff8bd94f2111fd9ad6092bc925e409d5c69261860045230cde5c95ebbb3141acce54372bcf4d01c9b044fd59959822c9576135e8"]},"Data.Boolean":{"../../../support/bower_components/purescript-prelude/src/Data/Boolean.purs":["2022-08-18T20:04:00Z","aa81cf83948d1c45051dcfb835b0caef7a8ed8a39c58d8126f4efde1973880dbcd169d36bbe8c82a62586c386810bf0824f018674a93c606e43bc451fb6c3819"]},"Data.BooleanAlgebra":{"../../../support/bower_components/purescript-prelude/src/Data/BooleanAlgebra.purs":["2022-08-18T20:04:00Z","464f2df7f5bc3fc5e64cb0462c841f93fa2a609545e10f0adce637185e345aa45eed2a7e164ba648bb947168279c999ef8cd9f5dab9fce9af3b9329a8829b971"]},"Data.Bounded":{"../../../support/bower_components/purescript-prelude/src/Data/Bounded.js":["2022-08-18T20:04:00Z","8bfa62b2e886ce6d58793d840513c68cefc1fa0c4a15a5e6a0c0ee5d607fea425f8080365c0f3f421116c4362eba447617cd65a221ee1e4cc0a75610752d3b75"],"../../../support/bower_components/purescript-prelude/src/Data/Bounded.purs":["2022-08-18T20:04:00Z","36762aa05b71843e1d2f23cc64b1a17ea3acf91745de39e8723a04f3cc12f50c83e6a9b8a58c0463eaed0e93dfe3112e1f896130bab0660a5a009391f00ed468"]},"Data.Bounded.Generic":{"../../../support/bower_components/purescript-prelude/src/Data/Bounded/Generic.purs":["2022-08-18T20:04:00Z","15f4f3499dd9c2a1f37345357db2f131cc57e37a4ddfaa8497dabd3d123abd8b9670bdd3910b84b6c44c8b63bf1873af783adb1edc8455985f244b6ecbef733b"]},"Data.CommutativeRing":{"../../../support/bower_components/purescript-prelude/src/Data/CommutativeRing.purs":["2022-08-18T20:04:00Z","c8bf53bf06454a74ba3a605d100b59bb5ba9111dd20e073713422c080075555b653bcaddde078d55130e737de30ba336920a099a6016fd4158af88b1f430b631"]},"Data.DivisionRing":{"../../../support/bower_components/purescript-prelude/src/Data/DivisionRing.purs":["2022-08-18T20:04:00Z","1f3c74ecd87798ace30371f036ef1590f7e4dbc5be05f51162f9b3700d61c0befd6a5b53ace34626103e500043de3b67225de2c442841106f6d8960658355aae"]},"Data.Eq":{"../../../support/bower_components/purescript-prelude/src/Data/Eq.js":["2022-08-18T20:04:00Z","6718a356e77f3fe29c3f353f02fd94583b4edf5a0a0d7bdfdbcb046e7ef3440781aaa466ee88f12be6a72f274eb9c51d4d051673f4893fc408e9053bb8d84368"],"../../../support/bower_components/purescript-prelude/src/Data/Eq.purs":["2022-08-18T20:04:00Z","65598d7093548c9848e1c661bb778ebd402f09b4584570c09082d765997056b335bf0f05397cd788c44bb2f00b3bd2115cba2ed45033ade9ac40d91efd64301d"]},"Data.Eq.Generic":{"../../../support/bower_components/purescript-prelude/src/Data/Eq/Generic.purs":["2022-08-18T20:04:00Z","88d9841c3e55b1063721bc8ff168aa8b53cd3581a8c3ffee6ed71a96ba4d2d20b7b454cb0e7f13b2fa7a6bcaf4ca0dfc609ce624f5ad74eece1e13a93b0a121d"]},"Data.EuclideanRing":{"../../../support/bower_components/purescript-prelude/src/Data/EuclideanRing.js":["2022-08-18T20:04:00Z","9bf37abbb8d5c826e2152f62c99251e9cfeac8226ead81262527a2c544765336b6a0a8df731664d1b7d7804ad821ddfb0bd2c58d91d61fea6232d6adaeb6fc69"],"../../../support/bower_components/purescript-prelude/src/Data/EuclideanRing.purs":["2022-08-18T20:04:00Z","252c8162d273ea69e96619d760b48f7302ad048ed2bdd542695fbf0489948d24369b2bd40addd7fa505e810cf411727fe9fd57546a3011ebe1fa3c534beac414"]},"Data.Field":{"../../../support/bower_components/purescript-prelude/src/Data/Field.purs":["2022-08-18T20:04:00Z","21c8a682ad74b9389e1c538ca1dbc5cc4da34b13945a1bd11812631f8f56e723e65f9452eba5b43ea8209f88c57e8566529667673b6b78ade1a08350a28b04cc"]},"Data.Function":{"../../../support/bower_components/purescript-prelude/src/Data/Function.purs":["2022-08-18T20:04:00Z","42320940aa4cdbab54308acc9ad8eac48cb3facf1f695eeb32c8473bdf31e6d51e9d689bd256c833cedd3cf40882c484153f56e8582bfc1353cc0f3b7867aa0f"]},"Data.Functor":{"../../../support/bower_components/purescript-prelude/src/Data/Functor.js":["2022-08-18T20:04:00Z","889e7781cb01bcb3007c8400d844b250905a7cc893d0391a09c2f907c8993271b0daf081548206d4c5a3948fdc7a51df5a99c6fe38c61a90ccdcb38f22886ae7"],"../../../support/bower_components/purescript-prelude/src/Data/Functor.purs":["2022-08-18T20:04:00Z","077d9d6d3e754807e5200b970988daf12894942995bb7f8698c0e0a2d08b64842dc5257efe088c045d7d0a6de2a10cb6c58b976b26243f66f69d0fa9791f60e7"]},"Data.Generic.Rep":{"../../../support/bower_components/purescript-prelude/src/Data/Generic/Rep.purs":["2022-08-18T20:04:00Z","69c6cac0ae8035b7a0bad28c1fb8c0c0d99bc93087392f5dbebac6a30bca3b5fa352741f93f432b7aa4c617e1f23d59939a69c716775e84375e112b4bb9175d1"]},"Data.HeytingAlgebra":{"../../../support/bower_components/purescript-prelude/src/Data/HeytingAlgebra.js":["2022-08-18T20:04:00Z","3603479b96cd22a9b312ef922b95d5b342ecd8d4b1b8984a15fcfa64b92ec66128f14fdc795c2c525c9b6e6912934f2ea542df9f30b3caac3bbb085ba3326265"],"../../../support/bower_components/purescript-prelude/src/Data/HeytingAlgebra.purs":["2022-08-18T20:04:00Z","d8942636d4f1804c94eb7527b48f48f500843d34e2ec0b45515f4d5c836ce4437806feb4a603735f1a799243f244a72c6fda218ffe5d58f7f0cbbcbfadb01bbd"]},"Data.HeytingAlgebra.Generic":{"../../../support/bower_components/purescript-prelude/src/Data/HeytingAlgebra/Generic.purs":["2022-08-18T20:04:00Z","ea49a37bf16af73cb930d0eb573bca8cc8e63de0a796c504f531f05d503976a59f464fa5a039a2ae9b486c9ba70857008bfb06acaaeaad6ee0f9f429355043e2"]},"Data.Monoid":{"../../../support/bower_components/purescript-prelude/src/Data/Monoid.purs":["2022-08-18T20:04:00Z","172ecdf1da579ac35b44cb9d87424b7bb45f27b2f49a0e51be34cc1d2863a15929436321b8ed46059601b3ba171053b4129067066be0596da42607d697d8d484"]},"Data.Monoid.Additive":{"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Additive.purs":["2022-08-18T20:04:00Z","514e26851127fb9b52c618a36f17758513d9a7ea6724866b208e2c2447c3c3b3a9a18218b715b765e5e1e00908e2ebc0d9f2e67171ab3e46543a01508b54de67"]},"Data.Monoid.Conj":{"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Conj.purs":["2022-08-18T20:04:00Z","441eb08d322aa39654f68fe39676ba5fe470252adc4da087c590245ff7b0b624885c57ade6e66f24485862873767198678a219afbd7c2fc68f2ca59978d7d9c2"]},"Data.Monoid.Disj":{"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Disj.purs":["2022-08-18T20:04:00Z","f38cea70c5a7216b6b17c796dfbc8b08d9f05bed22d81d3784322f9f06f127435b4c9009a2027c24efc998c781796b9007bc70bc3bd1eee935b1a9695077bc7a"]},"Data.Monoid.Dual":{"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Dual.purs":["2022-08-18T20:04:00Z","54058218c4c5323d42e95d54a1c64b9e2ded8afdaeef2f846ef123bd4fd6772551e2158a6a9802ca327bbc4fb995f4fd5d416fd59c7a6efc8f8fe9bc5e7dc709"]},"Data.Monoid.Endo":{"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Endo.purs":["2022-08-18T20:04:00Z","543f16c8df42353334deddd7e25a58340aaa3f4a902a997d6b08e3128ca0afb82b3ac720e8ca8d4475cfc063906df1439afd3f2e22f7684aeb9ee0bc2992e774"]},"Data.Monoid.Generic":{"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Generic.purs":["2022-08-18T20:04:00Z","9e2ef0cf0469c1e798f8767cb472ee1b0103dfd6b08ed0a777c89d5043358b70cf14c2784ea59f05795f648daf80e11b2150fa89a05bc8c0afa6dafeb2fc09ac"]},"Data.Monoid.Multiplicative":{"../../../support/bower_components/purescript-prelude/src/Data/Monoid/Multiplicative.purs":["2022-08-18T20:04:00Z","f0c40f939ed3a3f00712fc7485926733668101c201e5d57e19d72ce6be84455b7b2d7360d747154a9d071df9b72e4e5ad2ac2a36db093a1b702fed4e6f4de9e3"]},"Data.NaturalTransformation":{"../../../support/bower_components/purescript-prelude/src/Data/NaturalTransformation.purs":["2022-08-18T20:04:00Z","6b9fc42ec524a517d464dea99867c64345cdbcbada4260a772373a956961ad1c9a4a3a4f8ed4a0c7c7f3e36120068954141841c5d6bdc4e5898ea06435104bb7"]},"Data.Newtype":{"../../../support/bower_components/purescript-newtype/src/Data/Newtype.purs":["2022-04-27T15:04:33Z","4289a67b60c9760f41b6fb86b71bb0bb2c576b279ae447be7fe4c3ff408ea4705ca17522647bcd8da582ef646a4abfd53fc3310d4d9d6c68816a8ccd480140be"]},"Data.Ord":{"../../../support/bower_components/purescript-prelude/src/Data/Ord.js":["2022-08-18T20:04:00Z","d3f620d4e07a9ce41745d2df0c43701dc41726e4be601b790bb054089ca52d97380299b90fe88f166e2195d76c4cbe195d941e8619fd2d14242a6a347881b1a9"],"../../../support/bower_components/purescript-prelude/src/Data/Ord.purs":["2022-08-18T20:04:00Z","f0ca6f6131e2699584e55846fb9f4300b778c12f39f0c5a19286081c39c537c1a511c69d01ca6d7216776c73daeeced9ae0b6e1281d4b2e39abb4cc5432e6b75"]},"Data.Ord.Generic":{"../../../support/bower_components/purescript-prelude/src/Data/Ord/Generic.purs":["2022-08-18T20:04:00Z","d566cfa79ec03e335f632d3edc3b913081583188d8496897c1b0904c1895525caeb5b0464b76d40ae5ef79e5c7b516ad061c1d98aa6e1c649f555be4c839087e"]},"Data.Ordering":{"../../../support/bower_components/purescript-prelude/src/Data/Ordering.purs":["2022-08-18T20:04:00Z","321b8de9b25c2616a3dbc6bff2e2def1cf7592ad54e575bd2b62d440d5dd88d7b5332f6c68fc010424e36ac13d61b5bcaadcf619ff940c667360b2c102f6e2af"]},"Data.Reflectable":{"../../../support/bower_components/purescript-prelude/src/Data/Reflectable.js":["2022-08-18T20:04:00Z","1bbaef3b7bb472cbc13eb30d9a75f2d580d5950fe692a3e137322558a651d0352f8a7499538028404a611afecde17f551b7cbc4030bdaf0b50e6828362cf29bd"],"../../../support/bower_components/purescript-prelude/src/Data/Reflectable.purs":["2022-08-18T20:04:00Z","02beca227031091fd31673ff64153c2f84ba22c61f362acc88411643233fe91d8cabf6206319785f7b910d8dff7c81528ca7e05048e284bfc720e71f804f7a6c"]},"Data.Ring":{"../../../support/bower_components/purescript-prelude/src/Data/Ring.js":["2022-08-18T20:04:00Z","bce8767b39bf1d9af8182f80f91e376db07ae8912b991fcea6eaf37900f91c6b6ede6fb874c40ff5b3d40fc6a893468d0f0cb31106f6188ca52514ae0a081da6"],"../../../support/bower_components/purescript-prelude/src/Data/Ring.purs":["2022-08-18T20:04:00Z","4e727f1f786ced8ce8202805713a9a2810c6ef9522694535c219ce22f66e032ca374163c82db137dd7d2ded6ae4dc2786ee8b6efd1df810d5cbda9c7e2c0832e"]},"Data.Ring.Generic":{"../../../support/bower_components/purescript-prelude/src/Data/Ring/Generic.purs":["2022-08-18T20:04:00Z","8c94b1a5765b99950600e690e01e3da65cd7e43fe78f651f8531c45d41775572af47e62f21705857c82ae52251626c34f0f41180ee0563115f749c7bc0459324"]},"Data.Semigroup":{"../../../support/bower_components/purescript-prelude/src/Data/Semigroup.js":["2022-08-18T20:04:00Z","fb416511575b93baf1081317aba42e97da52fdb724c07110a05c360e5254528f54715a47fa22ed4298bbdfb62c8641c8ea5ef92af9a259d51164cf541026fabc"],"../../../support/bower_components/purescript-prelude/src/Data/Semigroup.purs":["2022-08-18T20:04:00Z","43c3fbd4ab0a7a5346bdc69ce26ad3e6143f1f0e92bf8e7601af43d2ad68cfe4080411029ba3a9f29592f75e139a8fb923e67237b8e1cee3024c54b32ccf0b5d"]},"Data.Semigroup.First":{"../../../support/bower_components/purescript-prelude/src/Data/Semigroup/First.purs":["2022-08-18T20:04:00Z","8ff357056284af9050954e7695babcc76f5f632019b66f635a49502170508a37b2cb20a2e863f022bf077726480d2cc32951fb910c80559806e50830f25e884e"]},"Data.Semigroup.Generic":{"../../../support/bower_components/purescript-prelude/src/Data/Semigroup/Generic.purs":["2022-08-18T20:04:00Z","8c07803971e03a3c3d4a617198eae5a3e825c411fd17af68eee57571717a2301eaf5ec5bd34bfddf14da1f1c40d780ab9538d02f22d1d19117135388c848ca89"]},"Data.Semigroup.Last":{"../../../support/bower_components/purescript-prelude/src/Data/Semigroup/Last.purs":["2022-08-18T20:04:00Z","75b3660341f9c0570031d2304c83eb8592098e2d96577c030ae969b3b958d00b21234c2c836377e7b338e4323fa4aa0c97a4a8abb7ed49e2741907a411eb0b08"]},"Data.Semiring":{"../../../support/bower_components/purescript-prelude/src/Data/Semiring.js":["2022-08-18T20:04:00Z","71c1f69848adaf5667acc7668bb53b42a14dd64f559e72d88ae879f123aa9d5892debb1758067b8c48bfcdbbd7392e2e9ea0e5d18603ab62dbdde5032662cf33"],"../../../support/bower_components/purescript-prelude/src/Data/Semiring.purs":["2022-08-18T20:04:00Z","70fe8b0c9eb461a6058b6c89ad182fb99d4e930f158b015a386ee67ece2445b5e7aba5e539dd7377822de1b045b80d1e439f191a2274c6e95c7fb3dba535d8c0"]},"Data.Semiring.Generic":{"../../../support/bower_components/purescript-prelude/src/Data/Semiring/Generic.purs":["2022-08-18T20:04:00Z","e1aeb61208e3b96999f07cc41307d50fa8025c2f688e9dc24d7286933a11cc1ec253375e10e25fb578801bcda7b18b7342bb13275f4ca72478a2aff9ea872799"]},"Data.Show":{"../../../support/bower_components/purescript-prelude/src/Data/Show.js":["2022-08-18T20:04:00Z","588e533a8d2dce9eb3815e58e38fe06ac7758adb50295d4325c47db26031d0ea48cb341d5e3d7caaeae40f4d95a9c3c5381feba3a50653d1a76e3835b0628f0d"],"../../../support/bower_components/purescript-prelude/src/Data/Show.purs":["2022-08-18T20:04:00Z","b52834da5151dffab06693e15efb93608a43ab7866901f86ee47191f085fade2d7ebbad800aff8ad7d7171d349e312bfc01dd4e8cad4eb6c12eacd50d9381764"]},"Data.Show.Generic":{"../../../support/bower_components/purescript-prelude/src/Data/Show/Generic.js":["2022-08-18T20:04:00Z","f8b9a3c651ceb9e8f2ee15ae532ecd371794b4e9f3b14eb0508656c1ae853654d7e3d3c719a9a98f0dcbc81df3b03266c05d3bc01c9b62d6d8ce29d4794e4b1b"],"../../../support/bower_components/purescript-prelude/src/Data/Show/Generic.purs":["2022-08-18T20:04:00Z","37b5a1168cd88f5f6f2d2a584cfe2c69e326b9f3e62291ec607c6e4a12da144450088fe65e95cbd04204d9c616a04696b5b3d0d7e444e8628b4a1eb3597c534d"]},"Data.Symbol":{"../../../support/bower_components/purescript-prelude/src/Data/Symbol.js":["2022-08-18T20:04:00Z","c980adfe8e297bfe8e257903de3ac13f5675c6f52ed95e8c2786fcacc52adde10b5de56c9432859c3c7c8f51d1866f2e8d4a961d60e1bff656def39e3b3cdcf7"],"../../../support/bower_components/purescript-prelude/src/Data/Symbol.purs":["2022-08-18T20:04:00Z","579409ca0036164a1a0534b266cc1c90de7b020ecea470cdedf0a97cc34ae1f25ab441df9789798dc30f6a4c8f6c6368c79dc5523d9de336e57dcc6325127cb2"]},"Data.Unit":{"../../../support/bower_components/purescript-prelude/src/Data/Unit.js":["2022-08-18T20:04:00Z","d7185d75aa1f2fe353e4e200ab4181472e354d6295cb2e6587a56636b1bc733be77b2f5616b20275fe7be0138a6442b2979864b1b234a813f8d9237baa4cd5f3"],"../../../support/bower_components/purescript-prelude/src/Data/Unit.purs":["2022-08-18T20:04:00Z","425d50d748941435bf7f4d6b61769e2b0931973280ba6dd91dcca3f963cc9223b2a7ccd5827611182348041c0813b3be828e2dacc54933ddc152d6e50f7f2f3d"]},"Data.Void":{"../../../support/bower_components/purescript-prelude/src/Data/Void.purs":["2022-08-18T20:04:00Z","28ae6f4ecd4ee9a07dc5c034f189a8740a9e14bef332d6bab73b8e3b2ea51ed2bec88d84862ff4cd989e671be324b019282a2678a6d73e59f05af414705bd47e"]},"Effect":{"../../../support/bower_components/purescript-effect/src/Effect.js":["2022-04-27T14:04:24Z","9683b917c04f50b5b8a41d8294b101d7787cd0a742840e6f05ec143f881bfb51807a2efd29a9296def2676e7c1860352f3d89f78f9205567575c5040f790da32"],"../../../support/bower_components/purescript-effect/src/Effect.purs":["2022-04-27T14:04:24Z","25ea461900466a6aade8a56c20921d46eb037a71efb12c4265dd378e760843e5793efb9f7cb47322511459136d9d4ecd6d09e5a089a432d96ef4af4530ad8e8d"]},"Effect.Class":{"../../../support/bower_components/purescript-effect/src/Effect/Class.purs":["2022-04-27T14:04:24Z","47e0114539e25826ffba341faf99133ed2499027f0955fa606d563d3504c6b41dc9d425dfa619c0c83b5fc2ab8dbb3c1bf2166b5980c5674fb93560c9b80d585"]},"Effect.Class.Console":{"../../../support/bower_components/purescript-console/src/Effect/Class/Console.purs":["2023-10-08T17:07:02Z","83dd2086be201a053908c2f6083c342c7ac3dd1eedd16d28eda405f97fe51c4d50363e837c79a95aef78de222d2fcf579c19fed4b5c3ba9f16ea7e537912a996"]},"Effect.Console":{"../../../support/bower_components/purescript-console/src/Effect/Console.js":["2023-10-08T17:07:02Z","b3d1b0aacf58d500207502e4fda74bf6ee203c3650c8ccc061eaafcac512ce76ee1347aa7d44630a1420013fd7ae262d5b7755b216002125d9c58d29ee84ec03"],"../../../support/bower_components/purescript-console/src/Effect/Console.purs":["2023-10-08T17:07:02Z","44ab0ee3661fb4d26d5cbeb22d2dcf111b3a4391c9f20c0ef906a27714d8a90524bd22eb1351c2795388f66241983242089b58377a8ea0723f17b259ace592c0"]},"Effect.Uncurried":{"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.js":["2022-04-27T14:04:24Z","4c6c5db78b72ff3b84623d894b05dd916cc0732dc08d1fd45d8b0768983fdd7377b7299add3c70475459d0e190af99e2176e4c17a8cfbf295c675456bd5ba7d2"],"../../../support/bower_components/purescript-effect/src/Effect/Uncurried.purs":["2022-04-27T14:04:24Z","a948cb1cab11f5019fe20dd697b5c6e248c3b29c7ab332c2cb9d792cfcb58021a77c0f4f71e1c8d7c0b3b9cb18bd1497a0d2f40680926390f3303ecb1fe25beb"]},"Effect.Unsafe":{"../../../support/bower_components/purescript-effect/src/Effect/Unsafe.js":["2022-04-27T14:04:24Z","e66a1117e55534d61b7cd8e1859b54ef97446e0374116867383d2027bd85b73e510cbd1e4e74067b740fffb66c11e243af8d0976b2dc225d9865d882486cccdd"],"../../../support/bower_components/purescript-effect/src/Effect/Unsafe.purs":["2022-04-27T14:04:24Z","c112c559df0f177472e96655b09165d5535f68caddc2b419b4cdfe796af19b962b0659cb609a2ce501002da7de34e66592b5491ebe6f538824c2db8a1e800ea7"]},"Main":{"src/Main.purs":["2021-10-25T20:49:21Z","55bdd6dd11fb1679cb11793dd2996de21972f7aa53826557273bd649004f5907ff8cf6dff840718a12084c421529c9da7d70f698689d3923ab4ae3d608591c66"]},"Prelude":{"../../../support/bower_components/purescript-prelude/src/Prelude.purs":["2022-08-18T20:04:00Z","c67b6a882790c17476eb477da2cfc71dc4c26f297e7b4581b5ae9b0d08040ea7c7b55ed3afb3e824806e573ea4dd307eaa7cb49cfb2a756973b226ee1023e6fc"]},"Record.Unsafe":{"../../../support/bower_components/purescript-prelude/src/Record/Unsafe.js":["2022-08-18T20:04:00Z","667d613a0e1265a710e98c9f6e64ff791b9e9b7227cdf699c3a25724077c02e42726c807c0387ca4484454fd853d5b41522bf2e048887f22a894413ef80cbb92"],"../../../support/bower_components/purescript-prelude/src/Record/Unsafe.purs":["2022-08-18T20:04:00Z","af8a7c83127f5e61853ad0e572be799c04e321562a375d51ab133706ac6a6777e169b057f01a709ad7aae2d8c7a5ae8daa28eae8793c4fe92e2e8f0cfaecf870"]},"Safe.Coerce":{"../../../support/bower_components/purescript-safe-coerce/src/Safe/Coerce.purs":["2022-04-27T14:56:52Z","595abade13e21ed7893a92b338d9e7c7bf56e9067d51ca25c387d6d93a1c5542925f062e282602e89476a45501645c76dbd57eac31cc4e5c1cf341e2902beb89"]},"Type.Proxy":{"../../../support/bower_components/purescript-prelude/src/Type/Proxy.purs":["2022-08-18T20:04:00Z","333d0ae90b05098eada860ad476ed9e1eacd67d969dc1573c74375610cf8de22e85a358a7783a0a461d7ffa6fe322d8c3e90696be02555a02793ac99aba687f2"]},"Unsafe.Coerce":{"../../../support/bower_components/purescript-unsafe-coerce/src/Unsafe/Coerce.js":["2022-04-27T14:15:44Z","031c3187f7ce65110a359260041309506e1ff39a97b6eb22c9a8f2e5c14b35db87d509bb5929f245c5d80df6ccd6dadf83579ebe4ac46650acdfa34a493cfc0d"],"../../../support/bower_components/purescript-unsafe-coerce/src/Unsafe/Coerce.purs":["2022-04-27T14:15:44Z","04b214d9cbbf0c438bb2af4b25f8db5d04f247059241982f718c6d83322c3180f0eced0eb5c410860dcdb35650e9129a1cffe87f7279308cc4cf6c6570bba74f"]}}
+ tests/purs/publish/basic-example/output/package.json view
@@ -0,0 +1,1 @@+{"type":"module"}
+ tests/purs/publish/basic-example/purs.json view
@@ -0,0 +1,14 @@+{+ "name": "basic-example",+ "version": "1.0.0",+ "license": "MIT",+ "location": {+ "githubOwner": "purescript",+ "githubRepo": "test"+ },+ "dependencies": {+ "console": ">=1.0.0 <2.0.0",+ "prelude": ">=1.0.0 <2.0.0",+ "effect": ">=1.0.0 <2.0.0"+ }+}
+ tests/purs/publish/basic-example/resolutions.json view
@@ -0,0 +1,23 @@+{+ "purescript-console": {+ "version": "1.0.0",+ "path": "../../../support/bower_components/purescript-console"+ },+ "purescript-effect": {+ "version": "1.0.0",+ "path": "../../../support/bower_components/purescript-effect"+ },+ "purescript-prelude": {+ "version": "1.0.0",+ "path": "../../../support/bower_components/purescript-prelude"+ },+ "purescript-newtype": {+ "path": "../../../support/bower_components/purescript-newtype"+ },+ "purescript-safe-coerce": {+ "path": "../../../support/bower_components/purescript-safe-coerce"+ },+ "purescript-unsafe-coerce": {+ "path": "../../../support/bower_components/purescript-unsafe-coerce"+ }+}
+ tests/purs/publish/basic-example/src/Main.purs view
@@ -0,0 +1,16 @@+module Main where++import Prelude+import Effect (Effect)+import Effect.Console (log)+import Data.Newtype (class Newtype, un)++newtype Target = Target String++derive instance newtypeTarget :: Newtype Target _++greetingTarget :: Target+greetingTarget = Target "world"++main :: Effect Unit+main = log ("hello, " <> un Target greetingTarget <> "!")
+ tests/purs/sourcemaps/Bug4034.js view
@@ -0,0 +1,51 @@+export const log = function (s) {+ return function () {+ console.log(s);+ };+};++export const warn = function (s) {+ return function () {+ console.warn(s);+ };+};++export const error = function (s) {+ return function () {+ console.error(s);+ };+};++export const info = function (s) {+ return function () {+ console.info(s);+ };+};++export const debug = function (s) {+ return function () {+ console.debug(s);+ };+};++export const time = function (s) {+ return function () {+ console.time(s);+ };+};++export const timeLog = function (s) {+ return function () {+ console.timeLog(s);+ };+};++export const timeEnd = function (s) {+ return function () {+ console.timeEnd(s);+ };+};++export const clear = function () {+ console.clear();+};
+ tests/purs/sourcemaps/Bug4034.out.js.map view
@@ -0,0 +1,1 @@+{"file":"index.js","mappings":";;;;;;;;AA2BA,eAAA;;WAAA;kCACwB;;;;;;AAXxB,cAAA;;WAAA;iCACsB;;;;;;AA6BtB,eAAA;;WAAA;kCACwB;;;;;;AAXxB,gBAAA;;WAAA;mCAC0B;;;;;;AAmB1B,gBAAA;;WAAA;mCAC0B","names":[],"sources":["../../tests/purs/sourcemaps/Bug4034.purs"],"version":3}
+ tests/purs/sourcemaps/Bug4034.purs view
@@ -0,0 +1,71 @@+-- | This module is the same as `purescript-effect@v6.0.0`'s `Effect.Console` file+-- | under a different module name.+-- | This verifies that null source spans are no longer emitted.+module SourceMaps.Bug4034 where++import Effect (Effect)++import Data.Show (class Show, show)+import Data.Unit (Unit)++-- | Write a message to the console.+foreign import log+ :: String+ -> Effect Unit++-- | Write a value to the console, using its `Show` instance to produce a+-- | `String`.+logShow :: forall a. Show a => a -> Effect Unit+logShow a = log (show a)++-- | Write an warning to the console.+foreign import warn+ :: String+ -> Effect Unit++-- | Write an warning value to the console, using its `Show` instance to produce+-- | a `String`.+warnShow :: forall a. Show a => a -> Effect Unit+warnShow a = warn (show a)++-- | Write an error to the console.+foreign import error+ :: String+ -> Effect Unit++-- | Write an error value to the console, using its `Show` instance to produce a+-- | `String`.+errorShow :: forall a. Show a => a -> Effect Unit+errorShow a = error (show a)++-- | Write an info message to the console.+foreign import info+ :: String+ -> Effect Unit++-- | Write an info value to the console, using its `Show` instance to produce a+-- | `String`.+infoShow :: forall a. Show a => a -> Effect Unit+infoShow a = info (show a)++-- | Write an debug message to the console.+foreign import debug+ :: String+ -> Effect Unit++-- | Write an debug value to the console, using its `Show` instance to produce a+-- | `String`.+debugShow :: forall a. Show a => a -> Effect Unit+debugShow a = debug (show a)++-- | Start a named timer.+foreign import time :: String -> Effect Unit++-- | Print the time since a named timer started in milliseconds.+foreign import timeLog :: String -> Effect Unit++-- | Stop a named timer and print time since it started in milliseconds.+foreign import timeEnd :: String -> Effect Unit++-- | Clears the console+foreign import clear :: Effect Unit
+ tests/purs/sourcemaps/Recipe.out.js.map view
@@ -0,0 +1,1 @@+{"file":"index.js","mappings":"","names":[],"sources":[],"version":3}
+ tests/purs/sourcemaps/Recipe.purs view
@@ -0,0 +1,3 @@+-- | This file demonstrates the naming convention to use for+-- | source map tests+module SourceMaps.Recipe where
+ tests/purs/warning/2140.out view
@@ -0,0 +1,11 @@+Warning found:+in module [33mMain[0m+at tests/purs/warning/2140.purs:5:3 - 5:36 (line 5, column 3 - line 5, column 36)++ Type variable [33ma[0m was shadowed.++in type declaration for [33mf[0m++See https://github.com/purescript/documentation/blob/master/errors/ShadowedTypeVar.md for more information,+or to contribute content related to this warning.+
+ tests/purs/warning/2140.purs view
@@ -0,0 +1,5 @@+-- @shouldWarnWith ShadowedTypeVar+module Main where++class Test a where+ f :: (forall a. a -> a) -> a -> a
+ tests/purs/warning/2383.out view
+ tests/purs/warning/2383.purs view
@@ -0,0 +1,13 @@+-- | This specifically shouldn't warn about `x` being shadowed in `main`+-- | See https://github.com/purescript/purescript/issues/2383+module Main where++import Prelude++import Effect (Effect)++main :: Effect Unit+main = do+ x <- let x = pure unit in x+ let _ = x -- don't warn x is unused+ pure unit
+ tests/purs/warning/2411.out view
@@ -0,0 +1,11 @@+Warning found:+in module [33mMain[0m+at tests/purs/warning/2411.purs:11:7 - 11:15 (line 11, column 7 - line 11, column 15)++ Name [33mx[0m was shadowed.++in value declaration [33mtest[0m++See https://github.com/purescript/documentation/blob/master/errors/ShadowedName.md for more information,+or to contribute content related to this warning.+
+ tests/purs/warning/2411.purs view
@@ -0,0 +1,16 @@+-- @shouldWarnWith ShadowedName+module Main where++import Prelude++import Effect (Effect)++test :: forall m. Monad m => Int -> m Unit+test x =+ let _ = x in -- don't mark x unused+ let x = unit+ in pure x++main :: Effect Unit+main = test 42+
+ tests/purs/warning/2542.out view
@@ -0,0 +1,16 @@+Warning found:+in module [33mMain[0m+at tests/purs/warning/2542.purs:16:1 - 16:18 (line 16, column 1 - line 16, column 18)++ No type declaration was provided for the top-level declaration of [33mmain[0m.+ It is good practice to provide type declarations as a form of documentation.+ The inferred type of [33mmain[0m was:+ [33m [0m+ [33m Effect Unit[0m+ [33m [0m++in value declaration [33mmain[0m++See https://github.com/purescript/documentation/blob/master/errors/MissingTypeDeclaration.md for more information,+or to contribute content related to this warning.+
+ tests/purs/warning/2542.purs view
@@ -0,0 +1,16 @@+-- @shouldWarnWith MissingTypeDeclaration+module Main where++import Effect.Console++type T = forall a. Array a++-- | Note: This should not raise a `ShadowedTypeVar` warning as the +-- | type `a` introduced in `T` should not be in scope +-- | in the definition of `bar`.+foo :: T+foo = bar where+ bar :: forall a. Array a+ bar = []++main = log "Done"
+ tests/purs/warning/4183.out view
@@ -0,0 +1,15 @@+Warning found:+in module [33mMain[0m+at tests/purs/warning/4183.purs:4:1 - 4:21 (line 4, column 1 - line 4, column 21)++ The inferred kind for the type declaration [33mT[0m contains polymorphic kinds.+ Consider adding a top-level kind signature as a form of documentation.+ [33m [0m+ [33m type T :: forall k. (k -> k) -> k -> k[0m+ [33m [0m++in type synonym [33mT[0m++See https://github.com/purescript/documentation/blob/master/errors/MissingKindDeclaration.md for more information,+or to contribute content related to this warning.+
+ tests/purs/warning/4183.purs view
@@ -0,0 +1,4 @@+-- @shouldWarnWith MissingKindDeclaration+module Main where++type T f a = f (f a)
+ tests/purs/warning/4256.out view
@@ -0,0 +1,34 @@+Warning 1 of 2:++ in module [33mMain[0m+ at tests/purs/warning/4256.purs:16:1 - 16:58 (line 16, column 1 - line 16, column 58)++ No type declaration was provided for the top-level declaration of [33mbaz[0m.+ It is good practice to provide type declarations as a form of documentation.+ The inferred type of [33mbaz[0m was:+ [33m [0m+ [33m forall c14 d15 b25 d27. d27 -> c14 -> b25 -> d15 -> d27[0m+ [33m [0m++ in value declaration [33mbaz[0m++ See https://github.com/purescript/documentation/blob/master/errors/MissingTypeDeclaration.md for more information,+ or to contribute content related to this warning.++Warning 2 of 2:++ in module [33mMain[0m+ at tests/purs/warning/4256.purs:8:1 - 8:37 (line 8, column 1 - line 8, column 37)++ No type declaration was provided for the top-level declaration of [33maddNumberSuffix'[0m.+ It is good practice to provide type declarations as a form of documentation.+ The inferred type of [33maddNumberSuffix'[0m was:+ [33m [0m+ [33m forall b34 c35 d36. b34 -> c35 -> d36 -> Int[0m+ [33m [0m++ in value declaration [33maddNumberSuffix'[0m++ See https://github.com/purescript/documentation/blob/master/errors/MissingTypeDeclaration.md for more information,+ or to contribute content related to this warning.+
+ tests/purs/warning/4256.purs view
@@ -0,0 +1,16 @@+-- @shouldWarnWith MissingTypeDeclaration+-- @shouldWarnWith MissingTypeDeclaration+module Main where++addNumberSuffix :: forall a b c d. a -> b -> c -> d -> a+addNumberSuffix a _ _ _ = a++addNumberSuffix' = addNumberSuffix 0++foo :: forall a b c d. a -> b -> c -> d -> a+foo a _ _ _ = a++bar :: forall a b c d. a -> b -> c -> d -> a+bar a _ _ _ = a++baz a x y = bar (foo a 2 3 4) (foo a 2 3 4) (foo x y a a)
+ tests/purs/warning/4268.out view
+ tests/purs/warning/4268.purs view
@@ -0,0 +1,4 @@+module Main where++f :: Partial => Int -> Int+f 0 = f 1
+ tests/purs/warning/4308.out view
@@ -0,0 +1,49 @@+Warning 1 of 3:++ in module [33mMain[0m+ at tests/purs/warning/4308.purs:13:6 - 13:7 (line 13, column 6 - line 13, column 7)++ Wildcard type definition has the inferred type+ [33m [0m+ [33m Int[0m+ [33m [0m++ in value declaration [33mg[0m++ See https://github.com/purescript/documentation/blob/master/errors/WildcardInferredType.md for more information,+ or to contribute content related to this warning.++Warning 2 of 3:++ in module [33mMain[0m+ at tests/purs/warning/4308.purs:14:13 - 14:14 (line 14, column 13 - line 14, column 14)++ Wildcard type definition has the inferred type+ [33m [0m+ [33m Int[0m+ [33m [0m++ in value declaration [33mg[0m++ See https://github.com/purescript/documentation/blob/master/errors/WildcardInferredType.md for more information,+ or to contribute content related to this warning.++Warning 3 of 3:++ in module [33mMain[0m+ at tests/purs/warning/4308.purs:14:25 - 14:26 (line 14, column 25 - line 14, column 26)++ Wildcard type definition has the inferred type+ [33m [0m+ [33m Int[0m+ [33m [0m+ in the following context:++ y :: [33mInt[0m+++ in value declaration [33mg[0m++ See https://github.com/purescript/documentation/blob/master/errors/WildcardInferredType.md for more information,+ or to contribute content related to this warning.+
+ tests/purs/warning/4308.purs view
@@ -0,0 +1,14 @@+-- @shouldWarnWith WildcardInferredType+-- @shouldWarnWith WildcardInferredType+-- @shouldWarnWith WildcardInferredType+module Main where++-- No warnings expected here because `f` has full type signature+f :: Int+f = (\(y :: _) -> (y :: _)) 42++-- All three warnings expected here because the type signature of `g` has a+-- wildcard in it. One warning for the top-level signature wildcard, one for the+-- wildcard in the lambda parameter pattern, and one in the lambda body.+g :: _+g = (\(y :: _) -> (y :: _)) 42
+ tests/purs/warning/4376.out view
@@ -0,0 +1,16 @@+Warning found:+in module [33mMain[0m+at tests/purs/warning/4376.purs:6:1 - 6:16 (line 6, column 1 - line 6, column 16)++ No type declaration was provided for the top-level declaration of [33mvalue[0m.+ It is good practice to provide type declarations as a form of documentation.+ The inferred type of [33mvalue[0m was:+ [33m [0m+ [33m forall @a. Maybe a[0m+ [33m [0m++in value declaration [33mvalue[0m++See https://github.com/purescript/documentation/blob/master/errors/MissingTypeDeclaration.md for more information,+or to contribute content related to this warning.+
+ tests/purs/warning/4376.purs view
@@ -0,0 +1,6 @@+-- @shouldWarnWith MissingTypeDeclaration+module Main where++data Maybe a = Just a | Nothing++value = Nothing
+ tests/purs/warning/4414.out view
+ tests/purs/warning/4414.purs view
@@ -0,0 +1,21 @@+module Main+ ( something+ , main+ )+ where++import Prelude++import Effect (Effect)+import Effect.Console (log)++something :: Boolean+something = 42 .?.?. 1++foo :: forall a. a -> a -> Boolean+foo _ _ = true++infix 7 foo as .?.?.++main :: Effect Unit+main = log "Done"
+ tests/purs/warning/CoercibleUnusedImport.out view
+ tests/purs/warning/CoercibleUnusedImport.purs view
@@ -0,0 +1,8 @@+module Main where++import N1+import N2 (N2(..))+import Safe.Coerce (coerce)++unwrap :: forall a. N2 a -> a+unwrap = coerce
+ tests/purs/warning/CoercibleUnusedImport/N1.purs view
@@ -0,0 +1,3 @@+module N1 where++newtype N1 a = N1 a
+ tests/purs/warning/CoercibleUnusedImport/N2.purs view
@@ -0,0 +1,5 @@+module N2 where++import N1++newtype N2 a = N2 (N1 a)
+ tests/purs/warning/CoercibleUnusedNewtypeCtorExplicitImport.out view
+ tests/purs/warning/CoercibleUnusedNewtypeCtorExplicitImport.purs view
@@ -0,0 +1,7 @@+module Main where++import N (N(N))+import Safe.Coerce (coerce)++unwrap :: forall a. N a -> a+unwrap = coerce
+ tests/purs/warning/CoercibleUnusedNewtypeCtorExplicitImport/N.purs view
@@ -0,0 +1,3 @@+module N where++newtype N a = N a
+ tests/purs/warning/CoercibleUnusedNewtypeCtorImplicitImport.out view
+ tests/purs/warning/CoercibleUnusedNewtypeCtorImplicitImport.purs view
@@ -0,0 +1,7 @@+module Main where++import N (N(..))+import Safe.Coerce (coerce)++unwrap :: forall a. N a -> a+unwrap = coerce
+ tests/purs/warning/CoercibleUnusedNewtypeCtorImplicitImport/N.purs view
@@ -0,0 +1,3 @@+module N where++newtype N a = N a
+ tests/purs/warning/CustomWarning.out view
@@ -0,0 +1,14 @@+Warning found:+in module [33mMain[0m+at tests/purs/warning/CustomWarning.purs:9:1 - 9:11 (line 9, column 1 - line 9, column 11)++ A custom warning occurred while solving type class constraints:++ Custom warning Int+++in value declaration [33mbar[0m++See https://github.com/purescript/documentation/blob/master/errors/UserDefinedWarning.md for more information,+or to contribute content related to this warning.+
+ tests/purs/warning/CustomWarning.purs view
@@ -0,0 +1,11 @@+-- @shouldWarnWith UserDefinedWarning+module Main where++import Prim.TypeError++foo :: forall t. Warn (Beside (Text "Custom warning ") (Quote t)) => t -> t+foo x = x++bar :: Int+bar = foo 42+
+ tests/purs/warning/CustomWarning2.out view
@@ -0,0 +1,14 @@+Warning found:+in module [33mMain[0m+at tests/purs/warning/CustomWarning2.purs:12:1 - 12:11 (line 12, column 1 - line 12, column 11)++ A custom warning occurred while solving type class constraints:++ foo+++in value declaration [33mbaz[0m++See https://github.com/purescript/documentation/blob/master/errors/UserDefinedWarning.md for more information,+or to contribute content related to this warning.+
+ tests/purs/warning/CustomWarning2.purs view
@@ -0,0 +1,13 @@+-- @shouldWarnWith UserDefinedWarning+module Main where++import Prim.TypeError++foo :: Warn (Text "foo") => Int -> Int+foo x = x++bar :: Warn (Text "foo") => Int+bar = foo 42++baz :: Int+baz = bar
+ tests/purs/warning/CustomWarning3.out view
@@ -0,0 +1,30 @@+Warning 1 of 2:++ in module [33mMain[0m+ at tests/purs/warning/CustomWarning3.purs:14:1 - 14:11 (line 14, column 1 - line 14, column 11)++ A custom warning occurred while solving type class constraints:++ foo+++ in value declaration [33mbaz[0m++ See https://github.com/purescript/documentation/blob/master/errors/UserDefinedWarning.md for more information,+ or to contribute content related to this warning.++Warning 2 of 2:++ in module [33mMain[0m+ at tests/purs/warning/CustomWarning3.purs:14:1 - 14:11 (line 14, column 1 - line 14, column 11)++ A custom warning occurred while solving type class constraints:++ bar+++ in value declaration [33mbaz[0m++ See https://github.com/purescript/documentation/blob/master/errors/UserDefinedWarning.md for more information,+ or to contribute content related to this warning.+
+ tests/purs/warning/CustomWarning3.purs view
@@ -0,0 +1,15 @@+-- @shouldWarnWith UserDefinedWarning+-- @shouldWarnWith UserDefinedWarning+module Main where++import Prim.TypeError++foo :: Warn (Text "foo") => Int -> Int+foo x = x++-- Defer the "foo" warning and warn with "bar" as well+bar :: Warn (Text "foo") => Warn (Text "bar") => Int+bar = foo 42++baz :: Int+baz = bar
+ tests/purs/warning/CustomWarning4.out view
@@ -0,0 +1,60 @@+Warning 1 of 4:++ in module [33mMain[0m+ at tests/purs/warning/CustomWarning4.purs:21:1 - 21:15 (line 21, column 1 - line 21, column 15)++ A custom warning occurred while solving type class constraints:++ Custom label hello+++ in value declaration [33mbaz'[0m++ See https://github.com/purescript/documentation/blob/master/errors/UserDefinedWarning.md for more information,+ or to contribute content related to this warning.++Warning 2 of 4:++ in module [33mMain[0m+ at tests/purs/warning/CustomWarning4.purs:24:1 - 24:16 (line 24, column 1 - line 24, column 16)++ A custom warning occurred while solving type class constraints:++ Custom label hello+++ in value declaration [33mbaz''[0m++ See https://github.com/purescript/documentation/blob/master/errors/UserDefinedWarning.md for more information,+ or to contribute content related to this warning.++Warning 3 of 4:++ in module [33mMain[0m+ at tests/purs/warning/CustomWarning4.purs:27:1 - 27:17 (line 27, column 1 - line 27, column 17)++ A custom warning occurred while solving type class constraints:++ Custom label "h e l l o"+++ in value declaration [33mbaz'''[0m++ See https://github.com/purescript/documentation/blob/master/errors/UserDefinedWarning.md for more information,+ or to contribute content related to this warning.++Warning 4 of 4:++ in module [33mMain[0m+ at tests/purs/warning/CustomWarning4.purs:30:1 - 30:18 (line 30, column 1 - line 30, column 18)++ A custom warning occurred while solving type class constraints:++ Custom label "hel\"lo"+++ in value declaration [33mbaz''''[0m++ See https://github.com/purescript/documentation/blob/master/errors/UserDefinedWarning.md for more information,+ or to contribute content related to this warning.+
+ tests/purs/warning/CustomWarning4.purs view
@@ -0,0 +1,31 @@+-- @shouldWarnWith UserDefinedWarning+-- @shouldWarnWith UserDefinedWarning+-- @shouldWarnWith UserDefinedWarning+-- @shouldWarnWith UserDefinedWarning+module Main where++import Prim.TypeError (class Warn, Beside, QuoteLabel, Text)+import Prim+import Type.RowList (class RowToList, Cons, Nil)++data Label (l :: Symbol) = Label++baz ::+ forall row label typ.+ RowToList row (Cons label typ Nil) =>+ Warn (Beside (Text "Custom label ") (QuoteLabel label)) =>+ Record row ->+ String+baz _ = ""++baz' :: String+baz' = baz { hello: 1 }++baz'' :: String+baz'' = baz { "hello": 1 }++baz''' :: String+baz''' = baz { "h e l l o": 1 }++baz'''' :: String+baz'''' = baz { "hel\"lo": 1 }
+ tests/purs/warning/DeprecatedCaseOfOffsideSyntax1.out view
@@ -0,0 +1,9 @@+Warning found:+at tests/purs/warning/DeprecatedCaseOfOffsideSyntax1.purs:9:3 - 9:4 (line 9, column 3 - line 9, column 4)++ Dedented expressions in case branches are deprecated and will be removed in a future release. Indent the branch's expression past it's binder instead.+++See https://github.com/purescript/documentation/blob/master/errors/WarningParsingModule.md for more information,+or to contribute content related to this warning.+
+ tests/purs/warning/DeprecatedCaseOfOffsideSyntax1.purs view
@@ -0,0 +1,9 @@+-- @shouldWarnWith WarningParsingModule+module DeprecatedCaseOfOffsideSyntax1 where++data Foo = Foo Int++test :: Foo -> Int+test = case _ of+ Foo i ->+ i
+ tests/purs/warning/DeprecatedCaseOfOffsideSyntax2.out view
@@ -0,0 +1,9 @@+Warning found:+at tests/purs/warning/DeprecatedCaseOfOffsideSyntax2.purs:8:3 - 8:4 (line 8, column 3 - line 8, column 4)++ Dedented expressions in case branches are deprecated and will be removed in a future release. Indent the branch's expression past it's binder instead.+++See https://github.com/purescript/documentation/blob/master/errors/WarningParsingModule.md for more information,+or to contribute content related to this warning.+
+ tests/purs/warning/DeprecatedCaseOfOffsideSyntax2.purs view
@@ -0,0 +1,8 @@+-- @shouldWarnWith WarningParsingModule+module DeprecatedCaseOfOffsideSyntax2 where++data Foo = Foo Int++test :: Foo -> Int+test = case _ of Foo i ->+ i
+ tests/purs/warning/DuplicateExportRef.out view
@@ -0,0 +1,77 @@+Warning 1 of 7:++ in module [33mMain[0m+ at tests/purs/warning/DuplicateExportRef.purs:8:1 - 30:28 (line 8, column 1 - line 30, column 28)++ Export list contains multiple references to type class [33mY[0m+++ See https://github.com/purescript/documentation/blob/master/errors/DuplicateExportRef.md for more information,+ or to contribute content related to this warning.++Warning 2 of 7:++ in module [33mMain[0m+ at tests/purs/warning/DuplicateExportRef.purs:8:1 - 30:28 (line 8, column 1 - line 30, column 28)++ Export list contains multiple references to type operator [33m(~>)[0m+++ See https://github.com/purescript/documentation/blob/master/errors/DuplicateExportRef.md for more information,+ or to contribute content related to this warning.++Warning 3 of 7:++ in module [33mMain[0m+ at tests/purs/warning/DuplicateExportRef.purs:8:1 - 30:28 (line 8, column 1 - line 30, column 28)++ Export list contains multiple references to type [33mX[0m+++ See https://github.com/purescript/documentation/blob/master/errors/DuplicateExportRef.md for more information,+ or to contribute content related to this warning.++Warning 4 of 7:++ in module [33mMain[0m+ at tests/purs/warning/DuplicateExportRef.purs:8:1 - 30:28 (line 8, column 1 - line 30, column 28)++ Export list contains multiple references to value [33mfn[0m+++ See https://github.com/purescript/documentation/blob/master/errors/DuplicateExportRef.md for more information,+ or to contribute content related to this warning.++Warning 5 of 7:++ in module [33mMain[0m+ at tests/purs/warning/DuplicateExportRef.purs:8:1 - 30:28 (line 8, column 1 - line 30, column 28)++ Export list contains multiple references to operator [33m(!)[0m+++ See https://github.com/purescript/documentation/blob/master/errors/DuplicateExportRef.md for more information,+ or to contribute content related to this warning.++Warning 6 of 7:++ in module [33mMain[0m+ at tests/purs/warning/DuplicateExportRef.purs:8:1 - 30:28 (line 8, column 1 - line 30, column 28)++ Export list contains multiple references to module [33mPrelude[0m+++ See https://github.com/purescript/documentation/blob/master/errors/DuplicateExportRef.md for more information,+ or to contribute content related to this warning.++Warning 7 of 7:++ in module [33mMain[0m+ at tests/purs/warning/DuplicateExportRef.purs:8:1 - 30:28 (line 8, column 1 - line 30, column 28)++ Export list contains multiple references to data constructor [33mX[0m+++ See https://github.com/purescript/documentation/blob/master/errors/DuplicateExportRef.md for more information,+ or to contribute content related to this warning.+
+ tests/purs/warning/DuplicateExportRef.purs view
@@ -0,0 +1,30 @@+-- @shouldWarnWith DuplicateExportRef+-- @shouldWarnWith DuplicateExportRef+-- @shouldWarnWith DuplicateExportRef+-- @shouldWarnWith DuplicateExportRef+-- @shouldWarnWith DuplicateExportRef+-- @shouldWarnWith DuplicateExportRef+-- @shouldWarnWith DuplicateExportRef+module Main+ ( X(X, X), X+ , fn, fn+ , (!), (!)+ , class Y, class Y+ , Natural, type (~>), type (~>)+ , module Prelude, module Prelude+ ) where++import Prelude (Unit)++data X = X++fn :: X -> X -> X+fn _ _ = X++infix 2 fn as !++class Y (a :: Type)++type Natural f g = forall (a :: Type). f a -> g a++infixl 1 type Natural as ~>
+ tests/purs/warning/DuplicateImport.out view
@@ -0,0 +1,10 @@+Warning found:+in module [33mMain[0m+at tests/purs/warning/DuplicateImport.purs:5:1 - 5:34 (line 5, column 1 - line 5, column 34)++ Duplicate import of [33mPrelude (Unit, unit, pure)[0m+++See https://github.com/purescript/documentation/blob/master/errors/DuplicateImport.md for more information,+or to contribute content related to this warning.+
+ tests/purs/warning/DuplicateImport.purs view
@@ -0,0 +1,10 @@+-- @shouldWarnWith DuplicateImport+module Main where++import Prelude (Unit, unit, pure)+import Prelude (Unit, unit, pure)++import Effect (Effect)++main :: Effect Unit+main = pure unit
+ tests/purs/warning/DuplicateImportRef.out view
@@ -0,0 +1,44 @@+Warning 1 of 4:++ in module [33mMain[0m+ at tests/purs/warning/DuplicateImportRef.purs:7:1 - 12:4 (line 7, column 1 - line 12, column 4)++ Import list contains multiple references to type class [33mFunctor[0m+++ See https://github.com/purescript/documentation/blob/master/errors/DuplicateImportRef.md for more information,+ or to contribute content related to this warning.++Warning 2 of 4:++ in module [33mMain[0m+ at tests/purs/warning/DuplicateImportRef.purs:7:1 - 12:4 (line 7, column 1 - line 12, column 4)++ Import list contains multiple references to type [33mUnit[0m+++ See https://github.com/purescript/documentation/blob/master/errors/DuplicateImportRef.md for more information,+ or to contribute content related to this warning.++Warning 3 of 4:++ in module [33mMain[0m+ at tests/purs/warning/DuplicateImportRef.purs:7:1 - 12:4 (line 7, column 1 - line 12, column 4)++ Import list contains multiple references to value [33munit[0m+++ See https://github.com/purescript/documentation/blob/master/errors/DuplicateImportRef.md for more information,+ or to contribute content related to this warning.++Warning 4 of 4:++ in module [33mMain[0m+ at tests/purs/warning/DuplicateImportRef.purs:7:1 - 12:4 (line 7, column 1 - line 12, column 4)++ Import list contains multiple references to operator [33m(<>)[0m+++ See https://github.com/purescript/documentation/blob/master/errors/DuplicateImportRef.md for more information,+ or to contribute content related to this warning.+
+ tests/purs/warning/DuplicateImportRef.purs view
@@ -0,0 +1,18 @@+-- @shouldWarnWith DuplicateImportRef+-- @shouldWarnWith DuplicateImportRef+-- @shouldWarnWith DuplicateImportRef+-- @shouldWarnWith DuplicateImportRef+module Main where++import Prelude+ ( Unit, Unit+ , unit, unit+ , class Functor, class Functor+ , (<>), (<>)+ )++u :: Unit+u = unit <> unit++fid :: forall f a. Functor f => f a -> f a+fid fa = fa
+ tests/purs/warning/DuplicateSelectiveImport.out view
@@ -0,0 +1,10 @@+Warning found:+in module [33mMain[0m+at tests/purs/warning/DuplicateSelectiveImport.purs:5:1 - 5:22 (line 5, column 1 - line 5, column 22)++ There is an existing import of [33mPrelude[0m, consider merging the import lists+++See https://github.com/purescript/documentation/blob/master/errors/DuplicateSelectiveImport.md for more information,+or to contribute content related to this warning.+
+ tests/purs/warning/DuplicateSelectiveImport.purs view
@@ -0,0 +1,10 @@+-- @shouldWarnWith DuplicateSelectiveImport+module Main where++import Prelude (Unit, unit)+import Prelude (pure)++import Effect (Effect)++main :: Effect Unit+main = pure unit
+ tests/purs/warning/HiddenConstructorsGeneric.out view
@@ -0,0 +1,11 @@+Warning found:+in module [33mMain[0m+at tests/purs/warning/HiddenConstructorsGeneric.purs:2:1 - 8:40 (line 2, column 1 - line 8, column 40)++ An export for [33mD[0m hides data constructors but the type declares an instance of [33mData.Generic.Rep.Generic[0m.+ Such instance allows to match and construct values of this type, effectively making the constructors public.+++See https://github.com/purescript/documentation/blob/master/errors/HiddenConstructors.md for more information,+or to contribute content related to this warning.+
+ tests/purs/warning/HiddenConstructorsGeneric.purs view
@@ -0,0 +1,8 @@+-- @shouldWarnWith HiddenConstructors+module Main (D) where++import Data.Generic.Rep (class Generic)++data D = D++derive instance genericD :: Generic D _
+ tests/purs/warning/HiddenConstructorsNewtype.out view
@@ -0,0 +1,11 @@+Warning found:+in module [33mMain[0m+at tests/purs/warning/HiddenConstructorsNewtype.purs:2:1 - 8:44 (line 2, column 1 - line 8, column 44)++ An export for [33mN[0m hides data constructors but the type declares an instance of [33mData.Newtype.Newtype[0m.+ Such instance allows to match and construct values of this type, effectively making the constructors public.+++See https://github.com/purescript/documentation/blob/master/errors/HiddenConstructors.md for more information,+or to contribute content related to this warning.+
+ tests/purs/warning/HiddenConstructorsNewtype.purs view
@@ -0,0 +1,8 @@+-- @shouldWarnWith HiddenConstructors+module Main (N) where++import Data.Newtype (class Newtype)++newtype N a = N a++derive instance newtypeN :: Newtype (N a) _
+ tests/purs/warning/HidingImport.out view
@@ -0,0 +1,28 @@+Warning 1 of 2:++ in module [33mMain[0m+ at tests/purs/warning/HidingImport.purs:6:1 - 6:30 (line 6, column 1 - line 6, column 30)++ Module [33mEffect[0m has unspecified imports, consider using the inclusive form:++ [33mimport Effect (Effect)[0m++++ See https://github.com/purescript/documentation/blob/master/errors/HidingImport.md for more information,+ or to contribute content related to this warning.++Warning 2 of 2:++ in module [33mMain[0m+ at tests/purs/warning/HidingImport.purs:5:1 - 5:28 (line 5, column 1 - line 5, column 28)++ Module [33mPrelude[0m has unspecified imports, consider using the inclusive form:++ [33mimport Prelude (Unit, pure, unit)[0m++++ See https://github.com/purescript/documentation/blob/master/errors/HidingImport.md for more information,+ or to contribute content related to this warning.+
+ tests/purs/warning/HidingImport.purs view
@@ -0,0 +1,9 @@+-- @shouldWarnWith HidingImport+-- @shouldWarnWith HidingImport+module Main where++import Prelude hiding (one)+import Effect hiding (untilE)++main :: Effect Unit+main = pure unit
+ tests/purs/warning/ImplicitImport.out view
@@ -0,0 +1,28 @@+Warning 1 of 2:++ in module [33mMain[0m+ at tests/purs/warning/ImplicitImport.purs:6:1 - 6:14 (line 6, column 1 - line 6, column 14)++ Module [33mEffect[0m has unspecified imports, consider using the explicit form:++ [33mimport Effect (Effect)[0m++++ See https://github.com/purescript/documentation/blob/master/errors/ImplicitImport.md for more information,+ or to contribute content related to this warning.++Warning 2 of 2:++ in module [33mMain[0m+ at tests/purs/warning/ImplicitImport.purs:5:1 - 5:15 (line 5, column 1 - line 5, column 15)++ Module [33mPrelude[0m has unspecified imports, consider using the explicit form:++ [33mimport Prelude (Unit, pure, unit)[0m++++ See https://github.com/purescript/documentation/blob/master/errors/ImplicitImport.md for more information,+ or to contribute content related to this warning.+
+ tests/purs/warning/ImplicitImport.purs view
@@ -0,0 +1,9 @@+-- @shouldWarnWith ImplicitImport+-- @shouldWarnWith ImplicitImport+module Main where++import Prelude+import Effect++main :: Effect Unit+main = pure unit
+ tests/purs/warning/ImplicitQualifiedImport.out view
@@ -0,0 +1,30 @@+Warning 1 of 2:++ in module [33mMain[0m+ at tests/purs/warning/ImplicitQualifiedImport.purs:7:1 - 7:19 (line 7, column 1 - line 7, column 19)++ Module [33mEffect[0m was imported as [33mE[0m with unspecified imports.+ As there are multiple modules being imported as [33mE[0m, consider using the explicit form:++ [33mimport Effect (Effect) as E[0m++++ See https://github.com/purescript/documentation/blob/master/errors/ImplicitQualifiedImport.md for more information,+ or to contribute content related to this warning.++Warning 2 of 2:++ in module [33mMain[0m+ at tests/purs/warning/ImplicitQualifiedImport.purs:8:1 - 8:27 (line 8, column 1 - line 8, column 27)++ Module [33mEffect.Console[0m was imported as [33mE[0m with unspecified imports.+ As there are multiple modules being imported as [33mE[0m, consider using the explicit form:++ [33mimport Effect.Console (log) as E[0m++++ See https://github.com/purescript/documentation/blob/master/errors/ImplicitQualifiedImport.md for more information,+ or to contribute content related to this warning.+
+ tests/purs/warning/ImplicitQualifiedImport.purs view
@@ -0,0 +1,11 @@+-- @shouldWarnWith ImplicitQualifiedImport+-- @shouldWarnWith ImplicitQualifiedImport+module Main where++import Data.Unit++import Effect as E+import Effect.Console as E++main :: E.Effect Unit+main = E.log "test"
+ tests/purs/warning/ImplicitQualifiedImportReExport.out view
@@ -0,0 +1,30 @@+Warning 1 of 2:++ in module [33mMain[0m+ at tests/purs/warning/ImplicitQualifiedImportReExport.purs:9:1 - 9:23 (line 9, column 1 - line 9, column 23)++ Module [33mData.Maybe[0m was imported as [33mX[0m with unspecified imports.+ As this module is being re-exported, consider using the explicit form:++ [33mimport Data.Maybe (Maybe(..), fromJust, fromMaybe, fromMaybe', isJust, isNothing, maybe, maybe', optional) as X[0m++++ See https://github.com/purescript/documentation/blob/master/errors/ImplicitQualifiedImportReExport.md for more information,+ or to contribute content related to this warning.++Warning 2 of 2:++ in module [33mMain[0m+ at tests/purs/warning/ImplicitQualifiedImportReExport.purs:10:1 - 10:24 (line 10, column 1 - line 10, column 24)++ Module [33mData.Either[0m was imported as [33mY[0m with unspecified imports.+ As this module is being re-exported, consider using the explicit form:++ [33mimport Data.Either (Either(..), blush, choose, either, fromLeft, fromLeft', fromRight, fromRight', hush, isLeft, isRight, note, note') as Y[0m++++ See https://github.com/purescript/documentation/blob/master/errors/ImplicitQualifiedImportReExport.md for more information,+ or to contribute content related to this warning.+
+ tests/purs/warning/ImplicitQualifiedImportReExport.purs view
@@ -0,0 +1,13 @@+-- @shouldWarnWith ImplicitQualifiedImportReExport+-- @shouldWarnWith ImplicitQualifiedImportReExport+module Main (module X, module Y, main) where++import Prelude++import Effect (Effect)+import Effect.Console (log)+import Data.Maybe as X+import Data.Either as Y++main :: Effect Unit+main = log "test"
+ tests/purs/warning/Kind-UnusedExplicitImport-1.out view
@@ -0,0 +1,17 @@+Warning found:+in module [33mMain[0m+at tests/purs/warning/Kind-UnusedExplicitImport-1.purs:6:1 - 6:47 (line 6, column 1 - line 6, column 47)++ The import of module [33mType.RowList[0m contains the following unused references:++ [33mListToRow[0m++ It could be replaced with:++ [33mimport Type.RowList (RowList)[0m++++See https://github.com/purescript/documentation/blob/master/errors/UnusedExplicitImport.md for more information,+or to contribute content related to this warning.+
+ tests/purs/warning/Kind-UnusedExplicitImport-1.purs view
@@ -0,0 +1,11 @@+-- @shouldWarnWith UnusedExplicitImport+module Main where++import Prelude (Unit, unit, pure)+import Effect (Effect)+import Type.RowList (class ListToRow, RowList)++class A (a :: RowList Type)++main :: Effect Unit+main = pure unit
+ tests/purs/warning/Kind-UnusedExplicitImport-2.out view
@@ -0,0 +1,17 @@+Warning found:+in module [33mMain[0m+at tests/purs/warning/Kind-UnusedExplicitImport-2.purs:6:1 - 6:47 (line 6, column 1 - line 6, column 47)++ The import of module [33mType.RowList[0m contains the following unused references:++ [33mRowList[0m++ It could be replaced with:++ [33mimport Type.RowList (class ListToRow)[0m++++See https://github.com/purescript/documentation/blob/master/errors/UnusedExplicitImport.md for more information,+or to contribute content related to this warning.+
+ tests/purs/warning/Kind-UnusedExplicitImport-2.purs view
@@ -0,0 +1,13 @@+-- @shouldWarnWith UnusedExplicitImport+module Main where++import Prelude (Unit, unit, pure)+import Effect (Effect)+import Type.RowList (class ListToRow, RowList)+import Type.Proxy (Proxy)++f :: forall l r. ListToRow l r => Proxy l -> Int+f _ = 0++main :: Effect Unit+main = pure unit
+ tests/purs/warning/Kind-UnusedImport.out view
@@ -0,0 +1,10 @@+Warning found:+in module [33mMain[0m+at tests/purs/warning/Kind-UnusedImport.purs:6:1 - 6:30 (line 6, column 1 - line 6, column 30)++ The import of [33mType.RowList[0m is redundant+++See https://github.com/purescript/documentation/blob/master/errors/UnusedImport.md for more information,+or to contribute content related to this warning.+
+ tests/purs/warning/Kind-UnusedImport.purs view
@@ -0,0 +1,9 @@+-- @shouldWarnWith UnusedImport+module Main where++import Prelude (Unit, unit, pure)+import Effect (Effect)+import Type.RowList (RowList)++main :: Effect Unit+main = pure unit
+ tests/purs/warning/KindReExport.out view
+ tests/purs/warning/KindReExport.purs view
@@ -0,0 +1,11 @@+-- | This test is to ensure that we do not get an incorrect 'unused kind'+-- | warning. See #3744+module Main (main, module X) where++import Prelude+import Effect (Effect)+import Effect.Console (log)+import Prim.Ordering (Ordering) as X++main :: Effect Unit+main = log "Done"
+ tests/purs/warning/MissingKindDeclaration.out view
@@ -0,0 +1,64 @@+Warning 1 of 4:++ in module [33mMain[0m+ at tests/purs/warning/MissingKindDeclaration.purs:7:1 - 7:21 (line 7, column 1 - line 7, column 21)++ The inferred kind for the data declaration [33mProxy[0m contains polymorphic kinds.+ Consider adding a top-level kind signature as a form of documentation.+ [33m [0m+ [33m data Proxy :: forall k. k -> Type[0m+ [33m [0m++ in type constructor [33mProxy[0m++ See https://github.com/purescript/documentation/blob/master/errors/MissingKindDeclaration.md for more information,+ or to contribute content related to this warning.++Warning 2 of 4:++ in module [33mMain[0m+ at tests/purs/warning/MissingKindDeclaration.purs:11:1 - 11:40 (line 11, column 1 - line 11, column 40)++ The inferred kind for the type declaration [33mNatural[0m contains polymorphic kinds.+ Consider adding a top-level kind signature as a form of documentation.+ [33m [0m+ [33m type Natural :: forall k. (k -> Type) -> (k -> Type) -> Type[0m+ [33m [0m++ in type synonym [33mNatural[0m++ See https://github.com/purescript/documentation/blob/master/errors/MissingKindDeclaration.md for more information,+ or to contribute content related to this warning.++Warning 3 of 4:++ in module [33mMain[0m+ at tests/purs/warning/MissingKindDeclaration.purs:9:1 - 9:20 (line 9, column 1 - line 9, column 20)++ The inferred kind for the newtype declaration [33mF[0m contains polymorphic kinds.+ Consider adding a top-level kind signature as a form of documentation.+ [33m [0m+ [33m newtype F :: forall k. k -> Type -> Type[0m+ [33m [0m++ in type constructor [33mF[0m++ See https://github.com/purescript/documentation/blob/master/errors/MissingKindDeclaration.md for more information,+ or to contribute content related to this warning.++Warning 4 of 4:++ in module [33mMain[0m+ at tests/purs/warning/MissingKindDeclaration.purs:13:1 - 13:18 (line 13, column 1 - line 13, column 18)++ The inferred kind for the class declaration [33mClazz[0m contains polymorphic kinds.+ Consider adding a top-level kind signature as a form of documentation.+ [33m [0m+ [33m class Clazz :: forall k1 k2 k3. k1 -> k2 -> k3 -> Constraint[0m+ [33m [0m++ in type class declaration for [33mClazz[0m++ See https://github.com/purescript/documentation/blob/master/errors/MissingKindDeclaration.md for more information,+ or to contribute content related to this warning.+
+ tests/purs/warning/MissingKindDeclaration.purs view
@@ -0,0 +1,13 @@+-- @shouldWarnWith MissingKindDeclaration+-- @shouldWarnWith MissingKindDeclaration+-- @shouldWarnWith MissingKindDeclaration+-- @shouldWarnWith MissingKindDeclaration+module Main where++data Proxy a = Proxy++newtype F a b = F b++type Natural f g = forall a. f a -> g a++class Clazz a b c
+ tests/purs/warning/MissingTypeDeclaration.out view
@@ -0,0 +1,16 @@+Warning found:+in module [33mMain[0m+at tests/purs/warning/MissingTypeDeclaration.purs:4:1 - 4:6 (line 4, column 1 - line 4, column 6)++ No type declaration was provided for the top-level declaration of [33mx[0m.+ It is good practice to provide type declarations as a form of documentation.+ The inferred type of [33mx[0m was:+ [33m [0m+ [33m Int[0m+ [33m [0m++in value declaration [33mx[0m++See https://github.com/purescript/documentation/blob/master/errors/MissingTypeDeclaration.md for more information,+or to contribute content related to this warning.+
+ tests/purs/warning/MissingTypeDeclaration.purs view
@@ -0,0 +1,4 @@+-- @shouldWarnWith MissingTypeDeclaration+module Main where++x = 0
+ tests/purs/warning/NewtypeInstance.out view
@@ -0,0 +1,15 @@+Warning found:+in module [33mMain[0m+at tests/purs/warning/NewtypeInstance.purs:8:1 - 8:38 (line 8, column 1 - line 8, column 38)++ The derived newtype instance for+ [33m [0m+ [33m Data.Ord.Ord X[0m+ [33m [0m+ does not include a derived superclass instance for [33mData.Eq.Eq[0m.++in value declaration [33mordX[0m++See https://github.com/purescript/documentation/blob/master/errors/MissingNewtypeSuperclassInstance.md for more information,+or to contribute content related to this warning.+
+ tests/purs/warning/NewtypeInstance.purs view
@@ -0,0 +1,8 @@+-- @shouldWarnWith MissingNewtypeSuperclassInstance+module Main where++import Prelude++newtype X = X String++derive newtype instance ordX :: Ord X
+ tests/purs/warning/NewtypeInstance2.out view
@@ -0,0 +1,19 @@+Warning found:+in module [33mMain[0m+at tests/purs/warning/NewtypeInstance2.purs:15:1 - 15:86 (line 15, column 1 - line 15, column 86)++ The derived newtype instance for+ [33m [0m+ [33m Main.MonadWriter w0 [0m+ [33m (MyWriter w0)[0m+ [33m [0m+ does not include a derived superclass instance for [33mControl.Monad.Monad[0m.++in value declaration [33mmonadWriterMyWriter[0m++where [33mw0[0m is a rigid type variable+ bound at (line 0, column 0 - line 0, column 0)++See https://github.com/purescript/documentation/blob/master/errors/MissingNewtypeSuperclassInstance.md for more information,+or to contribute content related to this warning.+
+ tests/purs/warning/NewtypeInstance2.purs view
@@ -0,0 +1,15 @@+-- @shouldWarnWith MissingNewtypeSuperclassInstance+module Main where++import Prelude+import Data.Tuple (Tuple(..))++class (Monad m, Monoid w) <= MonadWriter w m | m -> w where+ tell :: w -> m Unit++instance monadWriterTuple :: Monoid w => MonadWriter w (Tuple w) where+ tell w = Tuple w unit++newtype MyWriter w a = MyWriter (Tuple w a)++derive newtype instance monadWriterMyWriter :: Monoid w => MonadWriter w (MyWriter w)
+ tests/purs/warning/NewtypeInstance3.out view
@@ -0,0 +1,19 @@+Warning found:+in module [33mMain[0m+at tests/purs/warning/NewtypeInstance3.purs:21:1 - 21:86 (line 21, column 1 - line 21, column 86)++ The derived newtype instance for+ [33m [0m+ [33m Main.MonadWriter w0 [0m+ [33m (MyWriter w0)[0m+ [33m [0m+ does not include a derived superclass instance for [33mMain.MonadTell[0m.++in value declaration [33mmonadWriterMyWriter[0m++where [33mw0[0m is a rigid type variable+ bound at (line 0, column 0 - line 0, column 0)++See https://github.com/purescript/documentation/blob/master/errors/MissingNewtypeSuperclassInstance.md for more information,+or to contribute content related to this warning.+
+ tests/purs/warning/NewtypeInstance3.purs view
@@ -0,0 +1,21 @@+-- @shouldWarnWith MissingNewtypeSuperclassInstance+module Main where++import Prelude+import Data.Tuple (Tuple(..))++class (Monad m, Monoid w) <= MonadTell w m | m -> w where+ tell :: w -> m Unit++class (MonadTell w m) <= MonadWriter w m | m -> w where+ listen :: forall a. m a -> m (Tuple w a)++instance monadTellTuple :: Monoid w => MonadTell w (Tuple w) where+ tell w = Tuple w unit++instance monadWriterTuple :: Monoid w => MonadWriter w (Tuple w) where+ listen (Tuple w a) = Tuple w (Tuple w a)++newtype MyWriter w a = MyWriter (Tuple w a)++derive newtype instance monadWriterMyWriter :: Monoid w => MonadWriter w (MyWriter w)
+ tests/purs/warning/NewtypeInstance4.out view
@@ -0,0 +1,19 @@+Warning found:+in module [33mMain[0m+at tests/purs/warning/NewtypeInstance4.purs:23:1 - 23:86 (line 23, column 1 - line 23, column 86)++ The derived newtype instance for+ [33m [0m+ [33m Main.MonadWriter w0 [0m+ [33m (MyWriter w0)[0m+ [33m [0m+ implies an superclass instance for [33mMain.MonadTell[0m which could not be verified.++in value declaration [33mmonadWriterMyWriter[0m++where [33mw0[0m is a rigid type variable+ bound at (line 0, column 0 - line 0, column 0)++See https://github.com/purescript/documentation/blob/master/errors/UnverifiableSuperclassInstance.md for more information,+or to contribute content related to this warning.+
+ tests/purs/warning/NewtypeInstance4.purs view
@@ -0,0 +1,23 @@+-- @shouldWarnWith UnverifiableSuperclassInstance+module Main where++import Prelude+import Data.Tuple (Tuple(..))++class Monoid w <= MonadTell w m where+ tell :: w -> m Unit++class (MonadTell w m) <= MonadWriter w m where+ listen :: forall a. m a -> m (Tuple w a)++instance monadTellTuple :: Monoid w => MonadTell w (Tuple w) where+ tell w = Tuple w unit++instance monadWriterTuple :: Monoid w => MonadWriter w (Tuple w) where+ listen (Tuple w a) = Tuple w (Tuple w a)++newtype MyWriter w a = MyWriter (Tuple w a)++-- No fundep means this is unverifiable+derive newtype instance monadTellMyWriter :: Monoid w => MonadTell w (MyWriter w)+derive newtype instance monadWriterMyWriter :: Monoid w => MonadWriter w (MyWriter w)
+ tests/purs/warning/OverlappingPattern.out view
@@ -0,0 +1,28 @@+Warning 1 of 2:++ in module [33mMain[0m+ at tests/purs/warning/OverlappingPattern.purs:12:1 - 12:21 (line 12, column 1 - line 12, column 21)++ A case expression contains unreachable cases:++ B++ in value declaration [33mpat2[0m++ See https://github.com/purescript/documentation/blob/master/errors/OverlappingPattern.md for more information,+ or to contribute content related to this warning.++Warning 2 of 2:++ in module [33mMain[0m+ at tests/purs/warning/OverlappingPattern.purs:7:1 - 7:21 (line 7, column 1 - line 7, column 21)++ A case expression contains unreachable cases:++ A++ in value declaration [33mpat1[0m++ See https://github.com/purescript/documentation/blob/master/errors/OverlappingPattern.md for more information,+ or to contribute content related to this warning.+
+ tests/purs/warning/OverlappingPattern.purs view
@@ -0,0 +1,15 @@+-- @shouldWarnWith OverlappingPattern+-- @shouldWarnWith OverlappingPattern+module Main where++data X = A | B++pat1 :: X -> Boolean+pat1 A = true+pat1 A = true+pat1 B = false++pat2 :: X -> Boolean+pat2 A = true+pat2 _ = false+pat2 B = false
+ tests/purs/warning/ScopeShadowing.out view
@@ -0,0 +1,14 @@+Warning found:+in module [33mMain[0m+at tests/purs/warning/ScopeShadowing.purs:4:1 - 4:15 (line 4, column 1 - line 4, column 15)++ Shadowed definitions are in scope for type [33mUnit[0m from the following open imports:++ [33mimport Prelude[0m++ These will be ignored and the local declaration will be used.+++See https://github.com/purescript/documentation/blob/master/errors/ScopeShadowing.md for more information,+or to contribute content related to this warning.+
+ tests/purs/warning/ScopeShadowing.purs view
@@ -0,0 +1,13 @@+-- @shouldWarnWith ScopeShadowing+module Main where++import Prelude++-- No warning at the definition, only when the name is later resolved+data Unit = Unit++-- This is only a warning as the `Prelude` import is implicit. If `Unit` was+-- named explicitly in an import list, then this reference to `Unit`+-- would be a `ScopeConflict` error instead.+test :: Unit+test = const Unit unit
+ tests/purs/warning/ScopeShadowing2.out view
@@ -0,0 +1,14 @@+Warning found:+in module [33mMain[0m+at tests/purs/warning/ScopeShadowing2.purs:7:1 - 7:22 (line 7, column 1 - line 7, column 22)++ Shadowed definitions are in scope for value [33mappend[0m from the following open imports:++ [33mimport Data.Semigroup[0m++ These will be ignored and the local declaration will be used.+++See https://github.com/purescript/documentation/blob/master/errors/ScopeShadowing.md for more information,+or to contribute content related to this warning.+
+ tests/purs/warning/ScopeShadowing2.purs view
@@ -0,0 +1,10 @@+-- @shouldWarnWith ScopeShadowing+module Main+ ( append+ , module Data.Semigroup+ ) where++import Data.Semigroup++append :: forall a. a -> a -> a+append x _ = x
+ tests/purs/warning/ShadowedBinderPatternGuard.out view
@@ -0,0 +1,11 @@+Warning found:+in module [33mMain[0m+at tests/purs/warning/ShadowedBinderPatternGuard.purs:6:7 - 6:8 (line 6, column 7 - line 6, column 8)++ Name [33mi[0m was shadowed.++in value declaration [33mf[0m++See https://github.com/purescript/documentation/blob/master/errors/ShadowedName.md for more information,+or to contribute content related to this warning.+
+ tests/purs/warning/ShadowedBinderPatternGuard.purs view
@@ -0,0 +1,7 @@+-- @shouldWarnWith ShadowedName+module Main where++f :: Int -> Int+f _ | i <- true -- this i is shadowed+ , i <- 1234+ = i
+ tests/purs/warning/ShadowedNameParens.out view
@@ -0,0 +1,11 @@+Warning found:+in module [33mMain[0m+at tests/purs/warning/ShadowedNameParens.purs:7:5 - 7:6 (line 7, column 5 - line 7, column 6)++ Name [33mn[0m was shadowed.++in value declaration [33mf[0m++See https://github.com/purescript/documentation/blob/master/errors/ShadowedName.md for more information,+or to contribute content related to this warning.+
+ tests/purs/warning/ShadowedNameParens.purs view
@@ -0,0 +1,7 @@+-- @shouldWarnWith ShadowedName+module Main where++f :: Int -> Int -> Int+f n = + let _ = n in+ \(n) -> n
+ tests/purs/warning/ShadowedTypeVar.out view
@@ -0,0 +1,11 @@+Warning found:+in module [33mMain[0m+at tests/purs/warning/ShadowedTypeVar.purs:4:1 - 4:44 (line 4, column 1 - line 4, column 44)++ Type variable [33ma[0m was shadowed.++in type declaration for [33mf[0m++See https://github.com/purescript/documentation/blob/master/errors/ShadowedTypeVar.md for more information,+or to contribute content related to this warning.+
+ tests/purs/warning/ShadowedTypeVar.purs view
@@ -0,0 +1,5 @@+-- @shouldWarnWith ShadowedTypeVar+module Main where++f :: forall a. (forall a. a -> a) -> a -> a+f g x = g x
+ tests/purs/warning/TypeClassMethodSynonym.out view
@@ -0,0 +1,11 @@+Warning found:+in module [33mMain[0m+at tests/purs/warning/TypeClassMethodSynonym.purs:8:3 - 8:19 (line 8, column 3 - line 8, column 19)++ Type variable [33ma[0m was shadowed.++in type declaration for [33mc[0m++See https://github.com/purescript/documentation/blob/master/errors/ShadowedTypeVar.md for more information,+or to contribute content related to this warning.+
+ tests/purs/warning/TypeClassMethodSynonym.purs view
@@ -0,0 +1,8 @@+-- @shouldWarnWith ShadowedTypeVar+module Main where++class C :: Type -> Constraint+class C a where+ -- The `a` in the type below should refer to the `a`+ -- introduced by the `forall`, not the class head.+ c :: forall a. a
+ tests/purs/warning/UnambiguousQuantifiedKind.out view
@@ -0,0 +1,16 @@+Warning found:+in module [33mMain[0m+at tests/purs/warning/UnambiguousQuantifiedKind.purs:12:1 - 12:11 (line 12, column 1 - line 12, column 11)++ No type declaration was provided for the top-level declaration of [33mtest2[0m.+ It is good practice to provide type declarations as a form of documentation.+ The inferred type of [33mtest2[0m was:+ [33m [0m+ [33m Int[0m+ [33m [0m++in value declaration [33mtest2[0m++See https://github.com/purescript/documentation/blob/master/errors/MissingTypeDeclaration.md for more information,+or to contribute content related to this warning.+
+ tests/purs/warning/UnambiguousQuantifiedKind.purs view
@@ -0,0 +1,12 @@+-- @shouldWarnWith MissingTypeDeclaration+module Main where++data Proxy :: forall k. k -> Type+data Proxy a = Proxy++-- Should not trigger a warning+test1 :: forall k (a :: k). Proxy a+test1 = Proxy++-- Should trigger a warning+test2 = 42
+ tests/purs/warning/UnnecessaryFFIModule.js view
@@ -0,0 +1,1 @@+export var out = null;
+ tests/purs/warning/UnnecessaryFFIModule.out view
@@ -0,0 +1,13 @@+Warning found:+at tests/purs/warning/UnnecessaryFFIModule.purs:2:1 - 5:9 (line 2, column 1 - line 5, column 9)++ An unnecessary foreign module implementation was provided for module [33mMain[0m:++ tests/purs/warning/UnnecessaryFFIModule.js++ Module [33mMain[0m does not contain any foreign import declarations, so a foreign module is not necessary.+++See https://github.com/purescript/documentation/blob/master/errors/UnnecessaryFFIModule.md for more information,+or to contribute content related to this warning.+
+ tests/purs/warning/UnnecessaryFFIModule.purs view
@@ -0,0 +1,5 @@+-- @shouldWarnWith UnnecessaryFFIModule+module Main where++t :: Boolean+t = true
+ tests/purs/warning/UnusedDctorExplicitImport.out view
@@ -0,0 +1,17 @@+Warning found:+in module [33mMain[0m+at tests/purs/warning/UnusedDctorExplicitImport.purs:4:1 - 4:40 (line 4, column 1 - line 4, column 40)++ The import of type [33mOrdering[0m from module [33mData.Ordering[0m includes the following unused data constructors:++ [33mLT[0m++ It could be replaced with:++ [33mimport Data.Ordering (Ordering(EQ))[0m++++See https://github.com/purescript/documentation/blob/master/errors/UnusedDctorExplicitImport.md for more information,+or to contribute content related to this warning.+
+ tests/purs/warning/UnusedDctorExplicitImport.purs view
@@ -0,0 +1,8 @@+-- @shouldWarnWith UnusedDctorExplicitImport+module Main where++import Data.Ordering (Ordering(EQ, LT))++f :: Ordering -> Ordering+f EQ = EQ+f x = x
+ tests/purs/warning/UnusedDctorImportAll.out view
@@ -0,0 +1,14 @@+Warning found:+in module [33mMain[0m+at tests/purs/warning/UnusedDctorImportAll.purs:4:1 - 4:36 (line 4, column 1 - line 4, column 36)++ The import of type [33mOrdering[0m from module [33mData.Ordering[0m includes data constructors but only the type is used+ It could be replaced with:++ [33mimport Data.Ordering (Ordering)[0m++++See https://github.com/purescript/documentation/blob/master/errors/UnusedDctorImport.md for more information,+or to contribute content related to this warning.+
+ tests/purs/warning/UnusedDctorImportAll.purs view
@@ -0,0 +1,7 @@+-- @shouldWarnWith UnusedDctorImport+module Main where++import Data.Ordering (Ordering(..))++f :: Ordering -> Ordering+f x = x
+ tests/purs/warning/UnusedDctorImportExplicit.out view
@@ -0,0 +1,14 @@+Warning found:+in module [33mMain[0m+at tests/purs/warning/UnusedDctorImportExplicit.purs:4:1 - 4:36 (line 4, column 1 - line 4, column 36)++ The import of type [33mOrdering[0m from module [33mData.Ordering[0m includes data constructors but only the type is used+ It could be replaced with:++ [33mimport Data.Ordering (Ordering)[0m++++See https://github.com/purescript/documentation/blob/master/errors/UnusedDctorImport.md for more information,+or to contribute content related to this warning.+
+ tests/purs/warning/UnusedDctorImportExplicit.purs view
@@ -0,0 +1,7 @@+-- @shouldWarnWith UnusedDctorImport+module Main where++import Data.Ordering (Ordering(EQ))++f :: Ordering -> Ordering+f x = x
+ tests/purs/warning/UnusedExplicitImport.out view
@@ -0,0 +1,17 @@+Warning found:+in module [33mMain[0m+at tests/purs/warning/UnusedExplicitImport.purs:4:1 - 4:40 (line 4, column 1 - line 4, column 40)++ The import of module [33mPrelude[0m contains the following unused references:++ [33mbind[0m++ It could be replaced with:++ [33mimport Prelude (Unit, pure, unit)[0m++++See https://github.com/purescript/documentation/blob/master/errors/UnusedExplicitImport.md for more information,+or to contribute content related to this warning.+
+ tests/purs/warning/UnusedExplicitImport.purs view
@@ -0,0 +1,8 @@+-- @shouldWarnWith UnusedExplicitImport+module Main where++import Prelude (Unit, unit, pure, bind)+import Effect (Effect)++main :: Effect Unit+main = pure unit
+ tests/purs/warning/UnusedExplicitImportTypeOp.out view
@@ -0,0 +1,17 @@+Warning found:+in module [33mMain[0m+at tests/purs/warning/UnusedExplicitImportTypeOp.purs:6:1 - 6:30 (line 6, column 1 - line 6, column 30)++ The import of module [33mLib[0m contains the following unused references:++ [33m(~>)[0m++ It could be replaced with:++ [33mimport Lib (natId)[0m++++See https://github.com/purescript/documentation/blob/master/errors/UnusedExplicitImport.md for more information,+or to contribute content related to this warning.+
+ tests/purs/warning/UnusedExplicitImportTypeOp.purs view
@@ -0,0 +1,9 @@+-- @shouldWarnWith UnusedExplicitImport+module Main where++import Prelude (Unit, unit, pure)+import Effect (Effect)+import Lib (type (~>), natId)++main :: Effect Unit+main = natId (pure unit)
+ tests/purs/warning/UnusedExplicitImportTypeOp/Lib.purs view
@@ -0,0 +1,9 @@+module Lib where++type Nat ∷ ∀ k. (k → Type) → (k → Type) → Type+type Nat f g = ∀ x. f x → g x++infixr 4 type Nat as ~>++natId ∷ ∀ f. f ~> f+natId x = x
+ tests/purs/warning/UnusedExplicitImportValOp.out view
@@ -0,0 +1,17 @@+Warning found:+in module [33mMain[0m+at tests/purs/warning/UnusedExplicitImportValOp.purs:4:1 - 4:39 (line 4, column 1 - line 4, column 39)++ The import of module [33mPrelude[0m contains the following unused references:++ [33m(+)[0m++ It could be replaced with:++ [33mimport Prelude (Unit, pure, unit)[0m++++See https://github.com/purescript/documentation/blob/master/errors/UnusedExplicitImport.md for more information,+or to contribute content related to this warning.+
+ tests/purs/warning/UnusedExplicitImportValOp.purs view
@@ -0,0 +1,8 @@+-- @shouldWarnWith UnusedExplicitImport+module Main where++import Prelude (Unit, unit, pure, (+))+import Effect (Effect)++main :: Effect Unit+main = pure unit
+ tests/purs/warning/UnusedFFIImplementations.js view
@@ -0,0 +1,2 @@+export var yes = true;+export var no = false;
+ tests/purs/warning/UnusedFFIImplementations.out view
@@ -0,0 +1,12 @@+Warning found:+at tests/purs/warning/UnusedFFIImplementations.purs:2:1 - 4:30 (line 2, column 1 - line 4, column 30)++ The following definitions in the foreign module for module [33mMain[0m are unused:++ no++++See https://github.com/purescript/documentation/blob/master/errors/UnusedFFIImplementations.md for more information,+or to contribute content related to this warning.+
+ tests/purs/warning/UnusedFFIImplementations.purs view
@@ -0,0 +1,4 @@+-- @shouldWarnWith UnusedFFIImplementations+module Main where++foreign import yes :: Boolean
+ tests/purs/warning/UnusedImport.out view
@@ -0,0 +1,22 @@+Warning 1 of 2:++ in module [33mMain[0m+ at tests/purs/warning/UnusedImport.purs:8:1 - 8:14 (line 8, column 1 - line 8, column 14)++ The import of [33mEffect[0m is redundant+++ See https://github.com/purescript/documentation/blob/master/errors/UnusedImport.md for more information,+ or to contribute content related to this warning.++Warning 2 of 2:++ in module [33mMain[0m+ at tests/purs/warning/UnusedImport.purs:9:1 - 9:33 (line 9, column 1 - line 9, column 33)++ The qualified import of [33mEffect.Console[0m as [33mConsole[0m is redundant+++ See https://github.com/purescript/documentation/blob/master/errors/UnusedImport.md for more information,+ or to contribute content related to this warning.+
+ tests/purs/warning/UnusedImport.purs view
@@ -0,0 +1,12 @@+-- @shouldWarnWith UnusedImport+-- @shouldWarnWith UnusedImport+module Main where++import Data.Unit (Unit, unit)++-- All of the below are unused+import Effect+import Effect.Console as Console++main :: Unit+main = unit
+ tests/purs/warning/UnusedTypeVar.out view
@@ -0,0 +1,11 @@+Warning found:+in module [33mMain[0m+at tests/purs/warning/UnusedTypeVar.purs:4:1 - 4:24 (line 4, column 1 - line 4, column 24)++ Type variable [33mb[0m is ambiguous, since it is unused in the polymorphic type which introduces it.++in type declaration for [33mf[0m++See https://github.com/purescript/documentation/blob/master/errors/UnusedTypeVar.md for more information,+or to contribute content related to this warning.+
+ tests/purs/warning/UnusedTypeVar.purs view
@@ -0,0 +1,5 @@+-- @shouldWarnWith UnusedTypeVar+module Main where++f :: forall a b. a -> a+f x = x
+ tests/purs/warning/UnusedVar.out view
@@ -0,0 +1,108 @@+Warning 1 of 9:++ in module [33mMain[0m+ at tests/purs/warning/UnusedVar.purs:16:20 - 16:32 (line 16, column 20 - line 16, column 32)++ Name [33mlambdaUnused[0m was introduced but not used.++ in value declaration [33munusedInLambda[0m++ See https://github.com/purescript/documentation/blob/master/errors/UnusedName.md for more information,+ or to contribute content related to this warning.++Warning 2 of 9:++ in module [33mMain[0m+ at tests/purs/warning/UnusedVar.purs:20:7 - 20:20 (line 20, column 7 - line 20, column 20)++ Name [33mletUnused[0m was introduced but not used.++ in value declaration [33munusedLetName[0m++ See https://github.com/purescript/documentation/blob/master/errors/UnusedName.md for more information,+ or to contribute content related to this warning.++Warning 3 of 9:++ in module [33mMain[0m+ at tests/purs/warning/UnusedVar.purs:26:9 - 26:24 (line 26, column 9 - line 26, column 24)++ Name [33mwhereUnused[0m was introduced but not used.++ in value declaration [33munusedWhereIsLet[0m++ See https://github.com/purescript/documentation/blob/master/errors/UnusedName.md for more information,+ or to contribute content related to this warning.++Warning 4 of 9:++ in module [33mMain[0m+ at tests/purs/warning/UnusedVar.purs:30:11 - 30:23 (line 30, column 11 - line 30, column 23)++ Name [33mletArgUnused[0m was introduced but not used.++ in value declaration [33munusedLetArgument[0m++ See https://github.com/purescript/documentation/blob/master/errors/UnusedName.md for more information,+ or to contribute content related to this warning.++Warning 5 of 9:++ in module [33mMain[0m+ at tests/purs/warning/UnusedVar.purs:44:5 - 44:15 (line 44, column 5 - line 44, column 15)++ Name [33mcaseUnused[0m was introduced but not used.++ in value declaration [33munusedCaseBinder[0m++ See https://github.com/purescript/documentation/blob/master/errors/UnusedName.md for more information,+ or to contribute content related to this warning.++Warning 6 of 9:++ in module [33mMain[0m+ at tests/purs/warning/UnusedVar.purs:62:34 - 62:35 (line 62, column 34 - line 62, column 35)++ Name [33mx[0m was introduced but not used.++ in value declaration [33munusedShadowedByRecursiveBinding[0m++ See https://github.com/purescript/documentation/blob/master/errors/UnusedName.md for more information,+ or to contribute content related to this warning.++Warning 7 of 9:++ in module [33mMain[0m+ at tests/purs/warning/UnusedVar.purs:69:8 - 69:9 (line 69, column 8 - line 69, column 9)++ Name [33mx[0m was introduced but not used.++ in value declaration [33munusedShadowingLet[0m++ See https://github.com/purescript/documentation/blob/master/errors/UnusedName.md for more information,+ or to contribute content related to this warning.++Warning 8 of 9:++ in module [33mMain[0m+ at tests/purs/warning/UnusedVar.purs:87:7 - 87:8 (line 87, column 7 - line 87, column 8)++ Name [33mx[0m was introduced but not used.++ in value declaration [33mnotOops[0m++ See https://github.com/purescript/documentation/blob/master/errors/UnusedName.md for more information,+ or to contribute content related to this warning.++Warning 9 of 9:++ in module [33mMain[0m+ at tests/purs/warning/UnusedVar.purs:63:7 - 63:16 (line 63, column 7 - line 63, column 16)++ Name [33mx[0m was shadowed.++ in value declaration [33munusedShadowedByRecursiveBinding[0m++ See https://github.com/purescript/documentation/blob/master/errors/ShadowedName.md for more information,+ or to contribute content related to this warning.+
+ tests/purs/warning/UnusedVar.purs view
@@ -0,0 +1,104 @@+-- @shouldWarnWith UnusedName+-- @shouldWarnWith UnusedName+-- @shouldWarnWith UnusedName+-- @shouldWarnWith UnusedName+-- @shouldWarnWith UnusedName+-- @shouldWarnWith UnusedName+-- @shouldWarnWith UnusedName+-- @shouldWarnWith UnusedName+-- @shouldWarnWith ShadowedName+module Main where++data X = X+++unusedInLambda :: X+unusedInLambda = (\lambdaUnused -> X) X++unusedLetName :: X+unusedLetName =+ let letUnused = X in+ X++unusedWhereIsLet :: X+unusedWhereIsLet =+ X+ where whereUnused = X++unusedLetArgument :: X+unusedLetArgument = + let f x letArgUnused = x+ in f X X++notUnusedLet :: X+notUnusedLet =+ let f x = f' x+ f' x = f x+ in+ f X+++unusedCaseBinder :: X+unusedCaseBinder = + case X of+ caseUnused -> X++unusedObjUpdate :: { foo :: X }+unusedObjUpdate = + let x = X+ obj = { foo: X }+ in+ obj { foo = x }++-- The outer x is used in the let-bound expression, the let-binding variable is used in the body+notUnusedNonRecursiveBinding :: X -> X+notUnusedNonRecursiveBinding x = + let {x} = {x}+ in x++-- Almost like above but the outer x is not used, as x is bound recursively (Can also be true if there are no +-- arguments to x but in most cases this will error due to being cyclic)+unusedShadowedByRecursiveBinding :: X -> X+unusedShadowedByRecursiveBinding x = + let x _ = x X+ in x X++-- In this case the outer x is used but the new x binding is not+unusedShadowingLet :: X -> X+unusedShadowingLet x = + let (x) = x+ in X++-- 4110+oops ∷ { inner :: String } → String+oops box =+ let+ { inner } = box+ val = inner+ in+ val++-- like oops but switching order to show we don't +notOops ∷ { x :: String } -> String → String+notOops box x =+ let+ val = x+ _blah = x+ { x } = box+ in+ val++bindingGroupsNotRecognised :: Int+bindingGroupsNotRecognised =+ let+ f n = g n+ g n = f n+ + -- Second f is unused because this is multiple recursive binding groups, we don't warn because we assume+ -- it might be one binding group so there is a usage. If it would be 1 binding group there would be an error+ -- Shadowed variable warnings are similarly not aware of binding groups+ { x } = { x: 2 }+ h n = n+ f x = x+ in + h x
+ tests/purs/warning/UnusedVarDecls.out view
@@ -0,0 +1,23 @@+Warning 1 of 2:++ in module [33mMain[0m+ at tests/purs/warning/UnusedVarDecls.purs:13:15 - 13:24 (line 13, column 15 - line 13, column 24)++ Name [33munusedArg[0m was introduced but not used.++ in value declaration [33munusedArgDecl[0m++ See https://github.com/purescript/documentation/blob/master/errors/UnusedName.md for more information,+ or to contribute content related to this warning.++Warning 2 of 2:++ in module [33mMain[0m+ at tests/purs/warning/UnusedVarDecls.purs:16:1 - 17:4 (line 16, column 1 - line 17, column 4)++ Declaration [33munusedDecl[0m was not used, and is not exported.+++ See https://github.com/purescript/documentation/blob/master/errors/UnusedDeclaration.md for more information,+ or to contribute content related to this warning.+
+ tests/purs/warning/UnusedVarDecls.purs view
@@ -0,0 +1,17 @@+-- @shouldWarnWith UnusedName+-- @shouldWarnWith UnusedDeclaration++module Main+ ( unusedArgDecl+ , X(..)+ ) where++data X = X+++unusedArgDecl :: X -> X+unusedArgDecl unusedArg = X++unusedDecl :: X+unusedDecl = + X
+ tests/purs/warning/UnusedVarDo.out view
@@ -0,0 +1,48 @@+Warning 1 of 4:++ in module [33mMain[0m+ at tests/purs/warning/UnusedVarDo.purs:12:3 - 12:15 (line 12, column 3 - line 12, column 15)++ Name [33munusedDoBind[0m was introduced but not used.++ in value declaration [33munusedDoBinding[0m++ See https://github.com/purescript/documentation/blob/master/errors/UnusedName.md for more information,+ or to contribute content related to this warning.++Warning 2 of 4:++ in module [33mMain[0m+ at tests/purs/warning/UnusedVarDo.purs:24:7 - 24:23 (line 24, column 7 - line 24, column 23)++ Name [33munusedDoLet[0m was introduced but not used.++ in value declaration [33munusedDoLetBinding[0m++ See https://github.com/purescript/documentation/blob/master/errors/UnusedName.md for more information,+ or to contribute content related to this warning.++Warning 3 of 4:++ in module [33mMain[0m+ at tests/purs/warning/UnusedVarDo.purs:29:3 - 29:16 (line 29, column 3 - line 29, column 16)++ Name [33munusedAdoBind[0m was introduced but not used.++ in value declaration [33munusedAdoBinding[0m++ See https://github.com/purescript/documentation/blob/master/errors/UnusedName.md for more information,+ or to contribute content related to this warning.++Warning 4 of 4:++ in module [33mMain[0m+ at tests/purs/warning/UnusedVarDo.purs:34:7 - 34:24 (line 34, column 7 - line 34, column 24)++ Name [33munusedAdoLet[0m was introduced but not used.++ in value declaration [33munusedAdoLetBinding[0m++ See https://github.com/purescript/documentation/blob/master/errors/UnusedName.md for more information,+ or to contribute content related to this warning.+
+ tests/purs/warning/UnusedVarDo.purs view
@@ -0,0 +1,48 @@+-- @shouldWarnWith UnusedName+-- @shouldWarnWith UnusedName+-- @shouldWarnWith UnusedName+-- @shouldWarnWith UnusedName+module Main where++import Prelude+import Data.Maybe (Maybe)++unusedDoBinding :: Maybe Int+unusedDoBinding = do+ unusedDoBind <- pure 42+ pure 17++usedDoBinding :: Maybe Int+usedDoBinding = do+ fine <- pure 42+ let alsoFine = 1+ pure $ fine + alsoFine+++unusedDoLetBinding :: Maybe Int+unusedDoLetBinding = do+ let unusedDoLet = 42+ pure 17++unusedAdoBinding :: Maybe Int+unusedAdoBinding = ado+ unusedAdoBind <- pure 42+ in 17++unusedAdoLetBinding :: Maybe Int+unusedAdoLetBinding = ado+ let unusedAdoLet = 42+ in 17++notUnusedNonRecursiveBinding :: Int -> Maybe Int+notUnusedNonRecursiveBinding x = do+ let {x} = {x}+ pure x++-- 4110 in do syntax+oops ∷ { inner :: String } → String+oops box = do+ let+ { inner } = box+ val = inner+ val
+ tests/purs/warning/VTAsWildcardInferred.out view
+ tests/purs/warning/VTAsWildcardInferred.purs view
@@ -0,0 +1,28 @@+-- See https://github.com/purescript/purescript/issues/4487+module Main where++import Prelude+import Effect (Effect)+import Effect.Console (log)++f :: forall @a. a -> a+f = identity++test1 :: { x :: Int }+test1 = f @{ x :: _ } { x: 42 }++class Foo :: Type -> Type -> Type -> Constraint+class Foo a b c | a -> b c where+ fooMember :: a -> b++wrap :: forall @a. Array a -> Array (Array a)+wrap as = [as]++arrFooMember :: forall c. Array (Foo Int Boolean c => Int -> Boolean)+arrFooMember = [fooMember]++test2 :: forall c. Array (Array (Foo Int Boolean c => Int -> Boolean))+test2 = wrap @(Foo Int Boolean _ => _) arrFooMember -- neither wildcard should warn IMO++main :: Effect Unit+main = log "Done"
+ tests/purs/warning/WildcardInferredType.out view
@@ -0,0 +1,30 @@+Warning 1 of 2:++ in module [33mMain[0m+ at tests/purs/warning/WildcardInferredType.purs:7:6 - 7:7 (line 7, column 6 - line 7, column 7)++ Wildcard type definition has the inferred type+ [33m [0m+ [33m Int[0m+ [33m [0m++ in value declaration [33my[0m++ See https://github.com/purescript/documentation/blob/master/errors/WildcardInferredType.md for more information,+ or to contribute content related to this warning.++Warning 2 of 2:++ in module [33mMain[0m+ at tests/purs/warning/WildcardInferredType.purs:5:10 - 5:11 (line 5, column 10 - line 5, column 11)++ Wildcard type definition has the inferred type+ [33m [0m+ [33m Int[0m+ [33m [0m++ in value declaration [33mx[0m++ See https://github.com/purescript/documentation/blob/master/errors/WildcardInferredType.md for more information,+ or to contribute content related to this warning.+
+ tests/purs/warning/WildcardInferredType.purs view
@@ -0,0 +1,14 @@+-- @shouldWarnWith WildcardInferredType+-- @shouldWarnWith WildcardInferredType+module Main where++x = 0 :: _++y :: _+y = 0++z :: Int+z =+ let n :: _+ n = 0+ in n
+ tests/purs/warning/WildcardInferredType2.out view
@@ -0,0 +1,83 @@+Warning 1 of 5:++ in module [33mMain[0m+ at tests/purs/warning/WildcardInferredType2.purs:10:6 - 10:7 (line 10, column 6 - line 10, column 7)++ Wildcard type definition has the inferred type+ [33m [0m+ [33m Int[0m+ [33m [0m++ in value declaration [33mx[0m++ See https://github.com/purescript/documentation/blob/master/errors/WildcardInferredType.md for more information,+ or to contribute content related to this warning.++Warning 2 of 5:++ in module [33mMain[0m+ at tests/purs/warning/WildcardInferredType2.purs:51:9 - 51:10 (line 51, column 9 - line 51, column 10)++ Wildcard type definition has the inferred type+ [33m [0m+ [33m Int[0m+ [33m [0m++ in binding group foxtrot, echo++ See https://github.com/purescript/documentation/blob/master/errors/WildcardInferredType.md for more information,+ or to contribute content related to this warning.++Warning 3 of 5:++ in module [33mMain[0m+ at tests/purs/warning/WildcardInferredType2.purs:54:8 - 54:9 (line 54, column 8 - line 54, column 9)++ Wildcard type definition has the inferred type+ [33m [0m+ [33m Int[0m+ [33m [0m+ in the following context:++ m :: [33mInt[0m+++ in binding group foxtrot, echo++ See https://github.com/purescript/documentation/blob/master/errors/WildcardInferredType.md for more information,+ or to contribute content related to this warning.++Warning 4 of 5:++ in module [33mMain[0m+ at tests/purs/warning/WildcardInferredType2.purs:47:1 - 49:8 (line 47, column 1 - line 49, column 8)++ No type declaration was provided for the top-level declaration of [33mdelta[0m.+ It is good practice to provide type declarations as a form of documentation.+ The inferred type of [33mdelta[0m was:+ [33m [0m+ [33m Int -> Int[0m+ [33m [0m++ in binding group delta, charlie++ See https://github.com/purescript/documentation/blob/master/errors/MissingTypeDeclaration.md for more information,+ or to contribute content related to this warning.++Warning 5 of 5:++ in module [33mMain[0m+ at tests/purs/warning/WildcardInferredType2.purs:25:1 - 31:14 (line 25, column 1 - line 31, column 14)++ No type declaration was provided for the top-level declaration of [33malpha[0m.+ It is good practice to provide type declarations as a form of documentation.+ The inferred type of [33malpha[0m was:+ [33m [0m+ [33m Int[0m+ [33m [0m++ in value declaration [33malpha[0m++ See https://github.com/purescript/documentation/blob/master/errors/MissingTypeDeclaration.md for more information,+ or to contribute content related to this warning.+
+ tests/purs/warning/WildcardInferredType2.purs view
@@ -0,0 +1,60 @@+-- @shouldWarnWith WildcardInferredType+-- @shouldWarnWith MissingTypeDeclaration+-- @shouldWarnWith WildcardInferredType+-- @shouldWarnWith WildcardInferredType+-- @shouldWarnWith MissingTypeDeclaration+module Main where++import Prelude++x :: _+x = 42++y :: Int+y = 42 :: _++z :: Int+z = n+ where+ n :: _+ n = 42++-- Inner signatures can suppress warnings from more-inner wildcards,+-- even though a top-level signature is missing (see #4268)++alpha = f 0+ where+ f :: Int -> Int+ f m = n+ where+ n :: _+ n = m + 1 ++-- Tests for recursive binding groups (see #4268)++bravo :: Int -> Int+bravo m = if n > 0 then bravo (n - 1) else n+ where+ n :: _+ n = m++charlie :: Int -> Int+charlie m = if n > 0 then delta (n - 1) else n+ where+ n :: _+ n = m++delta m = if n > 0 then charlie (n - 1) else n+ where+ n = m++echo :: _ -> Int -- Partial signatures don't count!+echo m = if n > 0 then foxtrot (n - 1) else n+ where+ n :: _+ n = m++foxtrot :: Int -> Int+foxtrot m = if n > 0 then echo (n - 1) else n+ where+ n = m
+ tests/support/bower.json view
@@ -0,0 +1,39 @@+{+ "name": "purescript-test-suite-support",+ "dependencies": {+ "purescript-arrays": "^7.0.0",+ "purescript-assert": "^6.0.0",+ "purescript-bifunctors": "^6.0.0",+ "purescript-console": "^6.0.0",+ "purescript-control": "^6.0.0",+ "purescript-distributive": "^6.0.0",+ "purescript-effect": "^4.0.0",+ "purescript-either": "^6.1.0",+ "purescript-enums": "^6.0.0",+ "purescript-foldable-traversable": "^6.0.0",+ "purescript-functions": "^6.0.0",+ "purescript-gen": "^4.0.0",+ "purescript-identity": "^6.0.0",+ "purescript-integers": "^6.0.0",+ "purescript-invariant": "^6.0.0",+ "purescript-lazy": "^6.0.0",+ "purescript-lists": "^7.0.0",+ "purescript-maybe": "^6.0.0",+ "purescript-newtype": "^5.0.0",+ "purescript-nonempty": "^7.0.0",+ "purescript-numbers": "^9.0.0",+ "purescript-partial": "^4.0.0",+ "purescript-prelude": "^6.0.0",+ "purescript-psci-support": "^6.0.0",+ "purescript-refs": "^6.0.0",+ "purescript-safe-coerce": "^2.0.0",+ "purescript-st": "^6.1.0",+ "purescript-strings": "^6.0.0",+ "purescript-tailrec": "^6.1.0",+ "purescript-tuples": "^7.0.0",+ "purescript-type-equality": "^4.0.1",+ "purescript-typelevel-prelude": "^7.0.0",+ "purescript-unfoldable": "^6.0.0",+ "purescript-unsafe-coerce": "^6.0.0"+ }+}
+ tests/support/checkSourceMapValidity.js view
@@ -0,0 +1,33 @@+// Run as `node checkSourceMapValidity.js path/to/index.js.map`++const s = require("source-map");+const fs = require("fs");+const process = require("process");++if (process.argv.length < 3) {+ const errMsg = [+ "Script did not receive the source map file path as its only argument",+ "Rerun using `node checkSourceMapValidity.js path/to/index.js.map`"+ ].join("\n");+ throw new Error(errMsg);+}++const sourceMapFilePath = process.argv[2];+console.log(`Checking validity of source map for ${sourceMapFilePath}`);+const content = fs.readFileSync(sourceMapFilePath, {encoding: "utf-8"});+s.SourceMapConsumer.with(+ JSON.parse(content),+ null,+ (consumer) => {+ // We only use the `eachMapping` function to trigger an error+ // if a mapping is invalid.+ consumer.eachMapping(function () {});+ }+ )+ .then(() => console.log(`${sourceMapFilePath} sourcemap is valid`))+ .catch((e) => {+ console.error(` ${e.message}`);+ // See https://nodejs.org/dist/latest-v16.x/docs/api/process.html#processexitcode+ // for why we don't call `process.exit(1)`+ process.exitCode = 1;+ });
+ tests/support/package-lock.json view
@@ -0,0 +1,260 @@+{+ "name": "support",+ "lockfileVersion": 2,+ "requires": true,+ "packages": {+ "": {+ "dependencies": {+ "bower": "^1.8.8",+ "glob": "^5.0.14",+ "rimraf": "^2.5.2",+ "source-map": "^0.7.3"+ }+ },+ "node_modules/balanced-match": {+ "version": "1.0.2",+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",+ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="+ },+ "node_modules/bower": {+ "version": "1.8.14",+ "resolved": "https://registry.npmjs.org/bower/-/bower-1.8.14.tgz",+ "integrity": "sha512-8Rq058FD91q9Nwthyhw0la9fzpBz0iwZTrt51LWl+w+PnJgZk9J+5wp3nibsJcIUPglMYXr4NRBaR+TUj0OkBQ==",+ "bin": {+ "bower": "bin/bower"+ },+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/brace-expansion": {+ "version": "1.1.11",+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",+ "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",+ "dependencies": {+ "balanced-match": "^1.0.0",+ "concat-map": "0.0.1"+ }+ },+ "node_modules/concat-map": {+ "version": "0.0.1",+ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",+ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="+ },+ "node_modules/fs.realpath": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",+ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="+ },+ "node_modules/glob": {+ "version": "5.0.15",+ "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz",+ "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=",+ "dependencies": {+ "inflight": "^1.0.4",+ "inherits": "2",+ "minimatch": "2 || 3",+ "once": "^1.3.0",+ "path-is-absolute": "^1.0.0"+ },+ "engines": {+ "node": "*"+ }+ },+ "node_modules/inflight": {+ "version": "1.0.6",+ "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",+ "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",+ "dependencies": {+ "once": "^1.3.0",+ "wrappy": "1"+ }+ },+ "node_modules/inherits": {+ "version": "2.0.4",+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",+ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="+ },+ "node_modules/minimatch": {+ "version": "3.1.2",+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",+ "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",+ "dependencies": {+ "brace-expansion": "^1.1.7"+ },+ "engines": {+ "node": "*"+ }+ },+ "node_modules/once": {+ "version": "1.4.0",+ "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",+ "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",+ "dependencies": {+ "wrappy": "1"+ }+ },+ "node_modules/path-is-absolute": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",+ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/rimraf": {+ "version": "2.7.1",+ "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",+ "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==",+ "dependencies": {+ "glob": "^7.1.3"+ },+ "bin": {+ "rimraf": "bin.js"+ }+ },+ "node_modules/rimraf/node_modules/glob": {+ "version": "7.2.0",+ "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz",+ "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==",+ "dependencies": {+ "fs.realpath": "^1.0.0",+ "inflight": "^1.0.4",+ "inherits": "2",+ "minimatch": "^3.0.4",+ "once": "^1.3.0",+ "path-is-absolute": "^1.0.0"+ },+ "engines": {+ "node": "*"+ },+ "funding": {+ "url": "https://github.com/sponsors/isaacs"+ }+ },+ "node_modules/source-map": {+ "version": "0.7.3",+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz",+ "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==",+ "engines": {+ "node": ">= 8"+ }+ },+ "node_modules/wrappy": {+ "version": "1.0.2",+ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",+ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="+ }+ },+ "dependencies": {+ "balanced-match": {+ "version": "1.0.2",+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",+ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="+ },+ "bower": {+ "version": "1.8.14",+ "resolved": "https://registry.npmjs.org/bower/-/bower-1.8.14.tgz",+ "integrity": "sha512-8Rq058FD91q9Nwthyhw0la9fzpBz0iwZTrt51LWl+w+PnJgZk9J+5wp3nibsJcIUPglMYXr4NRBaR+TUj0OkBQ=="+ },+ "brace-expansion": {+ "version": "1.1.11",+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",+ "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",+ "requires": {+ "balanced-match": "^1.0.0",+ "concat-map": "0.0.1"+ }+ },+ "concat-map": {+ "version": "0.0.1",+ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",+ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="+ },+ "fs.realpath": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",+ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="+ },+ "glob": {+ "version": "5.0.15",+ "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz",+ "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=",+ "requires": {+ "inflight": "^1.0.4",+ "inherits": "2",+ "minimatch": "2 || 3",+ "once": "^1.3.0",+ "path-is-absolute": "^1.0.0"+ }+ },+ "inflight": {+ "version": "1.0.6",+ "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",+ "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",+ "requires": {+ "once": "^1.3.0",+ "wrappy": "1"+ }+ },+ "inherits": {+ "version": "2.0.4",+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",+ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="+ },+ "minimatch": {+ "version": "3.1.2",+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",+ "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",+ "requires": {+ "brace-expansion": "^1.1.7"+ }+ },+ "once": {+ "version": "1.4.0",+ "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",+ "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",+ "requires": {+ "wrappy": "1"+ }+ },+ "path-is-absolute": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",+ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18="+ },+ "rimraf": {+ "version": "2.7.1",+ "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",+ "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==",+ "requires": {+ "glob": "^7.1.3"+ },+ "dependencies": {+ "glob": {+ "version": "7.2.0",+ "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz",+ "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==",+ "requires": {+ "fs.realpath": "^1.0.0",+ "inflight": "^1.0.4",+ "inherits": "2",+ "minimatch": "^3.0.4",+ "once": "^1.3.0",+ "path-is-absolute": "^1.0.0"+ }+ }+ }+ },+ "source-map": {+ "version": "0.7.3",+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz",+ "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ=="+ },+ "wrappy": {+ "version": "1.0.2",+ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",+ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="+ }+ }+}
+ tests/support/package.json view
@@ -0,0 +1,9 @@+{+ "private": true,+ "dependencies": {+ "bower": "^1.8.8",+ "glob": "^5.0.14",+ "rimraf": "^2.5.2",+ "source-map": "^0.7.3"+ }+}
+ tests/support/prelude-resolutions.json view
@@ -0,0 +1,1 @@+{}
+ tests/support/psci/InteractivePrint.purs view
@@ -0,0 +1,11 @@+-- A module for testing the :print feature for configuring the function used+-- for printing repl results+module InteractivePrint where++import Prelude+import Effect (Effect)+import Effect.Console (log)+import Unsafe.Coerce (unsafeCoerce)++unsafeEval :: forall a. a -> Effect Unit+unsafeEval = log <<< unsafeCoerce
+ tests/support/psci/Reload.edit view
@@ -0,0 +1,4 @@+module Reload where++edited :: String+edited = "reload"
+ tests/support/psci/Reload.purs view
@@ -0,0 +1,4 @@+module Reload where++reload :: Int+reload = 0
+ tests/support/pscide/src/CompletionSpec.purs view
@@ -0,0 +1,18 @@+module CompletionSpec where++exampleValue :: Int+exampleValue = 42++exampleFunction :: Int -> Int+exampleFunction _ = 1++exampleInferredString = ""++infixl 5 exampleFunction as \°/ ++data ExampleTypeConstructor a b = ExampleTypeConstructor a b++infixl 5 type ExampleTypeConstructor as \°/ ++class ExampleClass where+ exampleMember :: Int
+ tests/support/pscide/src/CompletionSpecDocs.purs view
@@ -0,0 +1,19 @@+-- | Module Documentation+module CompletionSpecDocs where++-- | Doc x+something = "something"++-- | Doc *123*+withType :: Int+withType = 42++-- | This is+-- | a multi-line+-- | comment+multiline = "multiline"++-- | Doc for class+class DocClass where+ -- | doc for member+ member :: Int
+ tests/support/pscide/src/FindUsage.purs view
@@ -0,0 +1,12 @@+module FindUsage where++import FindUsage.Definition (usageId, ($%), Usage(..))+import FindUsage.Reexport (toBeReexported)++usagePatternMatch ∷ Usage → Usage+usagePatternMatch x = case x of+ Used _ → x+ _ $% _ → x++usageFn ∷ ∀ a. a → a+usageFn = usageId toBeReexported
+ tests/support/pscide/src/FindUsage/Definition.purs view
@@ -0,0 +1,13 @@+module FindUsage.Definition (Usage(..), ($%), usageId, toBeReexported) where++data Usage+ = Used Int+ | Usage Int Int++infixl 2 Usage as $%++usageId ∷ ∀ a. a → a+usageId x = x++toBeReexported ∷ ∀ a. a → a+toBeReexported = usageId
+ tests/support/pscide/src/FindUsage/Recursive.purs view
@@ -0,0 +1,8 @@+module FindUsage.Recursive where++data Nat = Suc Nat | Z++recursiveUsage :: Nat -> Int+recursiveUsage = case _ of+ Suc x -> recursiveUsage x+ Z -> 0
+ tests/support/pscide/src/FindUsage/RecursiveShadowed.purs view
@@ -0,0 +1,10 @@+module FindUsage.RecursiveShadowed where++data Nat = Suc Nat | Z++recursiveUsage :: Nat -> Int+recursiveUsage = case _ of+ Suc x ->+ let recursiveUsage = 3+ in recursiveUsage+ Z -> 0
+ tests/support/pscide/src/FindUsage/Reexport.purs view
@@ -0,0 +1,3 @@+module FindUsage.Reexport (module X) where++import FindUsage.Definition (toBeReexported) as X
+ tests/support/pscide/src/ImportsSpec.purs view
@@ -0,0 +1,3 @@+module ImportsSpec where++myId x = x
+ tests/support/pscide/src/ImportsSpec1.purs view
@@ -0,0 +1,32 @@+module ImportsSpec1+ ( exportedFunction+ , MyType+ , MyParamType+ , MyNewtype(..)+ , MyMaybe(..)+ , SpecialCase+ , X(..)+ , class ATypeClass+ , typeClassFun+ , OnlyTypeExported+ )+ where++exportedFunction ∷ ∀ a. a → a+exportedFunction x = x++type MyType = String++type MyParamType a = Array a++newtype MyNewtype = MyNewtype String++data MyMaybe a = MyJust a | MyNothing++data SpecialCase+data X = SpecialCase++newtype OnlyTypeExported = OnlyTypeExported String++class ATypeClass a where+ typeClassFun ∷ a -> a
+ tests/support/pscide/src/MatcherSpec.purs view
@@ -0,0 +1,7 @@+module MatcherSpec where++id :: forall a. a -> a+id x = x++const :: forall a b. a -> b -> a+const x _ = x
+ tests/support/pscide/src/RebuildSpecDep.purs view
@@ -0,0 +1,3 @@+module RebuildSpecDep where++dep = 42
+ tests/support/pscide/src/RebuildSpecSingleModule.fail view
@@ -0,0 +1,3 @@+module RebuildSpecSingleModule where++let anerror
+ tests/support/pscide/src/RebuildSpecSingleModule.purs view
@@ -0,0 +1,4 @@+module RebuildSpecSingleModule where++id x = x+lulz x y = x
+ tests/support/pscide/src/RebuildSpecWithDeps.purs view
@@ -0,0 +1,5 @@+module RebuildSpecWithDeps where++import RebuildSpecDep (dep)++x = dep
+ tests/support/pscide/src/RebuildSpecWithForeign.js view
@@ -0,0 +1,1 @@+export var f = 5;
+ tests/support/pscide/src/RebuildSpecWithForeign.purs view
@@ -0,0 +1,3 @@+module RebuildSpecWithForeign where++foreign import f :: Int
+ tests/support/pscide/src/RebuildSpecWithHiddenIdent.purs view
@@ -0,0 +1,6 @@+module RebuildSpecWithHiddenIdent (exported) where++hidden x _ = x++exported :: forall a. a -> a+exported x = x
+ tests/support/pscide/src/RebuildSpecWithMissingForeign.fail view
@@ -0,0 +1,3 @@+module RebuildSpecWithMissingForeign where++foreign import f :: Int