git.iko.soy/rowtype-yoga/purescript-native
on 0b07beb help sign in
703 files changed+39852−2697
since splitsnapshots
unifiedsplit
.gitignore−3 .travis.yml+86 CONTRIBUTING.md+39 CONTRIBUTORS.md+83 ChangeLog.md−3 INSTALL.md+53 LICENSE+4524−20 README-go.md−48 README.md+20−32 Setup.hs+4 app/Main.hs−250 appveyor.yml+51 appveyor/cache-buster.txt+8 bundle/.gitignore+4 bundle/README+24 bundle/build.sh+65 core-tests/.gitignore+3 core-tests/bower.json+60 core-tests/test-everything.sh+33 core-tests/tests/GenericDeriving.purs+30 core-tests/tests/Main.purs+9 default.nix−23 examples/.gitignore+1 examples/docs/bower.json+20 examples/docs/bower_components/purescript-prelude/src/Prelude.purs+8 examples/docs/src/Clash.purs+4 examples/docs/src/Clash1.purs+3 examples/docs/src/Clash1a.purs+9 examples/docs/src/Clash2.purs+3 examples/docs/src/Clash2a.purs+9 examples/docs/src/ConstrainedArgument.purs+9 examples/docs/src/DuplicateNames.purs+9 examples/docs/src/Example.purs+7 examples/docs/src/Example2.purs+7 examples/docs/src/ExplicitTypeSignatures.purs+18 examples/docs/src/ImportedTwice.purs+13 examples/docs/src/ImportedTwiceA.purs+8 examples/docs/src/ImportedTwiceB.purs+4 examples/docs/src/MultiVirtual.purs+6 examples/docs/src/MultiVirtual1.purs+4 examples/docs/src/MultiVirtual2.purs+9 examples/docs/src/MultiVirtual3.purs+4 examples/docs/src/NewOperators.purs+5 examples/docs/src/NewOperators2.purs+6 examples/docs/src/NotAllCtors.purs+5 examples/docs/src/ReExportedTypeClass.purs+5 examples/docs/src/SolitaryTypeClassMember.purs+6 examples/docs/src/SomeTypeClass.purs+5 examples/docs/src/Transitive1.purs+5 examples/docs/src/Transitive2.purs+5 examples/docs/src/Transitive3.purs+4 examples/docs/src/TypeClassWithoutMembers.purs+5 examples/docs/src/TypeClassWithoutMembersIntermediate.purs+5 examples/docs/src/TypeOpAliases.purs+18 examples/docs/src/UTF8.purs+7 examples/docs/src/Virtual.purs+5 examples/failing/1071.purs+8 examples/failing/1169.purs+12 examples/failing/1175.purs+11 examples/failing/1310.purs+18 examples/failing/1570.purs+6 examples/failing/1733.purs+6 examples/failing/1733/Thingy.purs+4 examples/failing/1825.purs+9 examples/failing/1881.purs+6 examples/failing/2128-class.purs+5 examples/failing/2128-instance.purs+8 examples/failing/365.purs+14 examples/failing/438.purs+15 examples/failing/881.purs+13 examples/failing/AnonArgument1.purs+5 examples/failing/AnonArgument2.purs+7 examples/failing/AnonArgument3.purs+5 examples/failing/ArgLengthMismatch.purs+7 examples/failing/ArrayType.purs+14 examples/failing/Arrays.purs+6 examples/failing/CaseBinderLengthsDiffer.purs+6 examples/failing/CaseDoesNotMatchAllConstructorArgs.purs+15 examples/failing/ConflictingExports.purs+6 examples/failing/ConflictingExports/A.purs+4 examples/failing/ConflictingExports/B.purs+4 examples/failing/ConflictingImports.purs+9 examples/failing/ConflictingImports/A.purs+4 examples/failing/ConflictingImports/B.purs+4 examples/failing/ConflictingImports2.purs+10 examples/failing/ConflictingImports2/A.purs+4 examples/failing/ConflictingImports2/B.purs+4 examples/failing/ConflictingQualifiedImports.purs+7 examples/failing/ConflictingQualifiedImports/A.purs+4 examples/failing/ConflictingQualifiedImports/B.purs+4 examples/failing/ConflictingQualifiedImports2.purs+5 examples/failing/ConflictingQualifiedImports2/A.purs+4 examples/failing/ConflictingQualifiedImports2/B.purs+4 examples/failing/ConstraintInference.purs+10 examples/failing/DctorOperatorAliasExport.purs+6 examples/failing/DeclConflictClassCtor.purs+6 examples/failing/DeclConflictClassSynonym.purs+8 examples/failing/DeclConflictClassType.purs+6 examples/failing/DeclConflictCtorClass.purs+6 examples/failing/DeclConflictCtorCtor.purs+6 examples/failing/DeclConflictSynonymClass.purs+8 examples/failing/DeclConflictSynonymType.purs+8 examples/failing/DeclConflictTypeClass.purs+6 examples/failing/DeclConflictTypeSynonym.purs+8 examples/failing/DeclConflictTypeType.purs+6 examples/failing/Do.purs+12 examples/failing/DoNotSuggestComposition.purs+13 examples/failing/DoNotSuggestComposition2.purs+7 examples/failing/DuplicateDeclarationsInLet.purs+12 examples/failing/DuplicateProperties1.purs+12 examples/failing/DuplicateProperties2.purs+12 examples/failing/DuplicateTypeVars.purs+6 examples/failing/Eff.purs+13 examples/failing/EmptyCase.purs+4 examples/failing/EmptyClass.purs+7 examples/failing/EmptyDo.purs+6 examples/failing/ExportConflictClass.purs+5 examples/failing/ExportConflictClass/A.purs+3 examples/failing/ExportConflictClass/B.purs+3 examples/failing/ExportConflictCtor.purs+5 examples/failing/ExportConflictCtor/A.purs+3 examples/failing/ExportConflictCtor/B.purs+3 examples/failing/ExportConflictType.purs+5 examples/failing/ExportConflictType/A.purs+3 examples/failing/ExportConflictType/B.purs+3 examples/failing/ExportConflictTypeOp.purs+5 examples/failing/ExportConflictTypeOp/A.purs+5 examples/failing/ExportConflictTypeOp/B.purs+5 examples/failing/ExportConflictValue.purs+5 examples/failing/ExportConflictValue/A.purs+4 examples/failing/ExportConflictValue/B.purs+4 examples/failing/ExportConflictValueOp.purs+5 examples/failing/ExportConflictValueOp/A.purs+6 examples/failing/ExportConflictValueOp/B.purs+6 examples/failing/ExportExplicit.purs+8 examples/failing/ExportExplicit1.purs+12 examples/failing/ExportExplicit1/M1.purs+3 examples/failing/ExportExplicit2.purs+8 examples/failing/ExportExplicit3.purs+10 examples/failing/ExportExplicit3/M1.purs+4 examples/failing/ExtraRecordField.purs+9 examples/failing/Foldable.purs+17 examples/failing/Generalization1.purs+11 examples/failing/Generalization2.purs+8 examples/failing/ImportExplicit.purs+4 examples/failing/ImportExplicit/M1.purs+3 examples/failing/ImportExplicit2.purs+4 examples/failing/ImportExplicit2/M1.purs+3 examples/failing/ImportHidingModule.purs+4 examples/failing/ImportHidingModule/A.purs+2 examples/failing/ImportHidingModule/B.purs+3 examples/failing/ImportModule.purs+4 examples/failing/ImportModule/M2.purs+3 examples/failing/InfiniteKind.purs+5 examples/failing/InfiniteType.purs+5 examples/failing/InstanceExport.purs+7 examples/failing/InstanceExport/InstanceExport.purs+11 examples/failing/IntOutOfRange.purs+6 examples/failing/InvalidOperatorInBinder.purs+12 examples/failing/KindError.purs+6 examples/failing/KindStar.purs+8 examples/failing/LeadingZeros1.purs+6 examples/failing/LeadingZeros2.purs+6 examples/failing/Let.purs+6 examples/failing/MPTCs.purs+10 examples/failing/MissingClassExport.purs+7 examples/failing/MissingClassMemberExport.purs+7 examples/failing/MissingRecordField.purs+10 examples/failing/MultipleErrors.purs+13 examples/failing/MultipleErrors2.purs+9 examples/failing/MultipleTypeOpFixities.purs+9 examples/failing/MultipleValueOpFixities.purs+9 examples/failing/MutRec.purs+9 examples/failing/MutRec2.purs+6 examples/failing/NewtypeMultiArgs.purs+6 examples/failing/NewtypeMultiCtor.purs+6 examples/failing/NullaryAbs.purs+6 examples/failing/Object.purs+8 examples/failing/OperatorAliasNoExport.purs+7 examples/failing/OperatorSections.purs+8 examples/failing/OrphanInstance.purs+7 examples/failing/OrphanInstance/Class.purs+4 examples/failing/OrphanTypeDecl.purs+4 examples/failing/OverlappingArguments.purs+6 examples/failing/OverlappingBinders.purs+9 examples/failing/OverlappingVars.purs+15 examples/failing/ProgrammableTypeErrors.purs+16 examples/failing/Rank2Types.purs+8 examples/failing/RequiredHiddenType.purs+9 examples/failing/Reserved.purs+7 examples/failing/RowConstructors1.purs+9 examples/failing/RowConstructors2.purs+9 examples/failing/RowConstructors3.purs+9 examples/failing/SkolemEscape.purs+8 examples/failing/SkolemEscape2.purs+10 examples/failing/SuggestComposition.purs+7 examples/failing/Superclasses1.purs+14 examples/failing/Superclasses2.purs+13 examples/failing/Superclasses3.purs+8 examples/failing/Superclasses5.purs+26 examples/failing/TopLevelCaseNoArgs.purs+8 examples/failing/TransitiveDctorExport.purs+5 examples/failing/TransitiveSynonymExport.purs+5 examples/failing/TypeClassInstances.purs+11 examples/failing/TypeClasses2.purs+9 examples/failing/TypeError.purs+6 examples/failing/TypeOperatorAliasNoExport.purs+6 examples/failing/TypeSynonyms.purs+8 examples/failing/TypeSynonyms2.purs+12 examples/failing/TypeSynonyms3.purs+12 examples/failing/TypeSynonyms4.purs+11 examples/failing/TypeSynonyms5.purs+6 examples/failing/TypeWildcards1.purs+7 examples/failing/TypeWildcards2.purs+7 examples/failing/TypeWildcards3.purs+10 examples/failing/TypedBinders.purs+10 examples/failing/TypedBinders2.purs+9 examples/failing/TypedBinders3.purs+13 examples/failing/TypedHole.purs+9 examples/failing/UnderscoreModuleName.purs+6 examples/failing/UnifyInTypeInstanceLookup.purs+22 examples/failing/UnknownType.purs+7 examples/passing/1185.purs+15 examples/passing/1335.purs+14 examples/passing/1570.purs+8 examples/passing/1664.purs+16 examples/passing/1697.purs+25 examples/passing/1881.purs+19 examples/passing/1991.purs+22 examples/passing/2018.purs+12 examples/passing/2018/A.purs+7 examples/passing/2018/B.purs+3 examples/passing/2049.purs+14 examples/passing/2138.purs+7 examples/passing/2138/Lib.purs+3 examples/passing/2172.js+5 examples/passing/2172.purs+10 examples/passing/2252.purs+15 examples/passing/652.purs+18 examples/passing/810.purs+14 examples/passing/862.purs+8 examples/passing/922.purs+20 examples/passing/Applicative.purs+16 examples/passing/ArrayType.purs+12 examples/passing/Auto.purs+16 examples/passing/AutoPrelude.purs+11 examples/passing/AutoPrelude2.purs+10 examples/passing/BindersInFunctions.purs+16 examples/passing/BindingGroups.purs+11 examples/passing/BlockString.purs+9 examples/passing/CaseInDo.purs+21 examples/passing/CaseInputWildcard.purs+18 examples/passing/CaseMultipleExpressions.purs+21 examples/passing/CaseStatement.purs+22 examples/passing/CheckFunction.purs+8 examples/passing/CheckSynonymBug.purs+13 examples/passing/CheckTypeClass.purs+18 examples/passing/Church.purs+18 examples/passing/ClassRefSyntax.purs+9 examples/passing/ClassRefSyntax/Lib.purs+4 examples/passing/Collatz.purs+21 examples/passing/Comparisons.purs+15 examples/passing/Conditional.purs+9 examples/passing/Console.purs+15 examples/passing/ConstraintInference.purs+10 examples/passing/ContextSimplification.purs+15 examples/passing/DataAndType.purs+10 examples/passing/DctorOperatorAlias.purs+34 examples/passing/DctorOperatorAlias/List.purs+5 examples/passing/DeepArrayBinder.purs+17 examples/passing/DeepCase.purs+15 examples/passing/Deriving.purs+34 examples/passing/Do.purs+68 examples/passing/Dollar.purs+16 examples/passing/Eff.purs+26 examples/passing/EmptyDataDecls.purs+20 examples/passing/EmptyRow.purs+11 examples/passing/EmptyTypeClass.purs+11 examples/passing/EqOrd.purs+18 examples/passing/ExplicitImportReExport.purs+11 examples/passing/ExplicitImportReExport/Bar.purs+3 examples/passing/ExplicitImportReExport/Foo.purs+4 examples/passing/ExplicitOperatorSections.purs+15 examples/passing/ExportExplicit.purs+10 examples/passing/ExportExplicit/M1.purs+10 examples/passing/ExportExplicit2.purs+8 examples/passing/ExportExplicit2/M1.purs+7 examples/passing/ExportedInstanceDeclarations.purs+45 examples/passing/ExtendedInfixOperators.purs+17 examples/passing/Fib.purs+18 examples/passing/FieldConsPuns.purs+13 examples/passing/FieldPuns.purs+10 examples/passing/FinalTagless.purs+25 examples/passing/FunctionScope.purs+13 examples/passing/Functions.purs+12 examples/passing/Functions2.purs+13 examples/passing/Generalization1.purs+11 examples/passing/Guards.purs+30 examples/passing/HoistError.purs+12 examples/passing/IfThenElseMaybe.purs+12 examples/passing/IfWildcard.purs+19 examples/passing/ImplicitEmptyImport.purs+9 examples/passing/Import.purs+6 examples/passing/Import/M1.purs+8 examples/passing/Import/M2.purs+6 examples/passing/ImportExplicit.purs+10 examples/passing/ImportExplicit/M1.purs+4 examples/passing/ImportHiding.purs+19 examples/passing/ImportQualified.purs+8 examples/passing/ImportQualified/M1.purs+3 examples/passing/InferRecFunWithConstrainedArgument.purs+11 examples/passing/InstanceBeforeClass.purs+12 examples/passing/IntAndChar.purs+19 examples/passing/JSReserved.purs+13 examples/passing/KindedType.purs+34 examples/passing/LargeSumType.purs+35 examples/passing/Let.purs+58 examples/passing/Let2.purs+20 examples/passing/LetInInstance.purs+15 examples/passing/LiberalTypeSynonyms.purs+22 examples/passing/MPTCs.purs+21 examples/passing/Match.purs+10 examples/passing/Module.purs+7 examples/passing/Module/M1.purs+14 examples/passing/Module/M2.purs+10 examples/passing/ModuleDeps.purs+6 examples/passing/ModuleDeps/M1.purs+5 examples/passing/ModuleDeps/M2.purs+5 examples/passing/ModuleDeps/M3.purs+3 examples/passing/ModuleExport.purs+8 examples/passing/ModuleExport/A.purs+3 examples/passing/ModuleExportDupes.purs+11 examples/passing/ModuleExportDupes/A.purs+3 examples/passing/ModuleExportDupes/B.purs+3 examples/passing/ModuleExportDupes/C.purs+4 examples/passing/ModuleExportExcluded.purs+11 examples/passing/ModuleExportExcluded/A.purs+6 examples/passing/ModuleExportQualified.purs+9 examples/passing/ModuleExportQualified/A.purs+3 examples/passing/ModuleExportSelf.purs+11 examples/passing/ModuleExportSelf/A.purs+5 examples/passing/Monad.purs+32 examples/passing/MonadState.purs+63 examples/passing/MultiArgFunctions.purs+27 examples/passing/MutRec.purs+20 examples/passing/MutRec2.purs+20 examples/passing/MutRec3.purs+20 examples/passing/NakedConstraint.purs+10 examples/passing/NamedPatterns.purs+10 examples/passing/NegativeBinder.purs+10 examples/passing/NegativeIntInRange.purs+9 examples/passing/Nested.purs+10 examples/passing/NestedTypeSynonyms.purs+12 examples/passing/NestedWhere.purs+13 examples/passing/Newtype.purs+23 examples/passing/NewtypeEff.purs+29 examples/passing/NewtypeWithRecordUpdate.purs+16 examples/passing/NonConflictingExports.purs+10 examples/passing/NonConflictingExports/A.purs+4 examples/passing/NumberLiterals.purs+39 examples/passing/ObjectGetter.purs+14 examples/passing/ObjectSynonym.purs+16 examples/passing/ObjectUpdate.purs+23 examples/passing/ObjectUpdate2.purs+18 examples/passing/ObjectUpdater.purs+26 examples/passing/ObjectWildcards.purs+20 examples/passing/Objects.purs+36 examples/passing/OneConstructor.purs+10 examples/passing/OperatorAlias.purs+11 examples/passing/OperatorAliasElsewhere.purs+9 examples/passing/OperatorAliasElsewhere/Def.purs+4 examples/passing/OperatorAssociativity.purs+25 examples/passing/OperatorInlining.purs+48 examples/passing/OperatorSections.purs+18 examples/passing/Operators.purs+91 examples/passing/Operators/Other.purs+7 examples/passing/OptimizerBug.purs+10 examples/passing/OptionalQualified.purs+12 examples/passing/OverlappingInstances.purs+17 examples/passing/OverlappingInstances2.purs+27 examples/passing/OverlappingInstances3.purs+20 examples/passing/ParensInTypedBinder.purs+20 examples/passing/PartialFunction.purs+11 examples/passing/Patterns.purs+23 examples/passing/PendingConflictingImports.purs+8 examples/passing/PendingConflictingImports/A.purs+4 examples/passing/PendingConflictingImports/B.purs+4 examples/passing/PendingConflictingImports2.purs+10 examples/passing/PendingConflictingImports2/A.purs+4 examples/passing/Person.purs+12 examples/passing/PrimedTypeName.purs+20 examples/passing/QualifiedNames.purs+11 examples/passing/QualifiedNames/Either.purs+5 examples/passing/QualifiedQualifiedImports.purs+6 examples/passing/Rank2Data.purs+30 examples/passing/Rank2Object.purs+11 examples/passing/Rank2TypeSynonym.purs+17 examples/passing/Rank2Types.purs+12 examples/passing/ReExportQualified.purs+7 examples/passing/ReExportQualified/A.purs+3 examples/passing/ReExportQualified/B.purs+3 examples/passing/ReExportQualified/C.purs+4 examples/passing/RebindableSyntax.purs+43 examples/passing/Recursion.purs+11 examples/passing/RedefinedFixity.purs+6 examples/passing/RedefinedFixity/M1.purs+6 examples/passing/RedefinedFixity/M2.purs+5 examples/passing/RedefinedFixity/M3.purs+6 examples/passing/ReservedWords.purs+19 examples/passing/ResolvableScopeConflict.purs+13 examples/passing/ResolvableScopeConflict/A.purs+4 examples/passing/ResolvableScopeConflict/B.purs+7 examples/passing/ResolvableScopeConflict2.purs+15 examples/passing/ResolvableScopeConflict2/A.purs+7 examples/passing/ResolvableScopeConflict3.purs+9 examples/passing/ResolvableScopeConflict3/A.purs+4 examples/passing/RowConstructors.purs+43 examples/passing/RowPolyInstanceContext.purs+23 examples/passing/RuntimeScopeIssue.purs+22 examples/passing/ScopedTypeVariables.purs+37 examples/passing/Sequence.purs+16 examples/passing/SequenceDesugared.purs+38 examples/passing/ShadowedModuleName.purs+8 examples/passing/ShadowedModuleName/Test.purs+6 examples/passing/ShadowedName.purs+11 examples/passing/ShadowedRename.purs+14 examples/passing/ShadowedTCO.purs+21 examples/passing/ShadowedTCOLet.purs+15 examples/passing/SignedNumericLiterals.purs+18 examples/passing/StringEscapes.purs+17 examples/passing/Superclasses1.purs+23 examples/passing/Superclasses3.purs+41 examples/passing/TCO.purs+20 examples/passing/TCOCase.purs+13 examples/passing/TailCall.purs+20 examples/passing/Tick.purs+8 examples/passing/TopLevelCase.purs+19 examples/passing/TransitiveImport.purs+9 examples/passing/TransitiveImport/Middle.purs+5 examples/passing/TransitiveImport/Test.purs+9 examples/passing/TypeClassMemberOrderChange.purs+16 examples/passing/TypeClasses.purs+71 examples/passing/TypeClassesInOrder.purs+12 examples/passing/TypeClassesWithOverlappingTypeVariables.purs+12 examples/passing/TypeDecl.purs+13 examples/passing/TypeOperators.purs+20 examples/passing/TypeOperators/A.purs+22 examples/passing/TypeSynonymInData.purs+12 examples/passing/TypeSynonyms.purs+28 examples/passing/TypeWildcards.purs+16 examples/passing/TypeWildcardsRecordExtension.purs+9 examples/passing/TypeWithoutParens.purs+12 examples/passing/TypeWithoutParens/Lib.purs+4 examples/passing/TypedBinders.purs+68 examples/passing/TypedWhere.purs+18 examples/passing/UTF8Sourcefile.purs+8 examples/passing/UnderscoreIdent.purs+13 examples/passing/UnicodeIdentifier.purs+7 examples/passing/UnicodeOperators.purs+22 examples/passing/UnicodeType.purs+22 examples/passing/Unit.purs+8 examples/passing/UnknownInTypeClassLookup.purs+15 examples/passing/UntupledConstraints.purs+17 examples/passing/Where.purs+49 examples/passing/WildcardType.purs+12 examples/passing/iota.purs+11 examples/passing/s.purs+8 examples/warning/DuplicateExportRef.purs+30 examples/warning/DuplicateImport.purs+10 examples/warning/DuplicateImportRef.purs+18 examples/warning/DuplicateSelectiveImport.purs+10 examples/warning/HidingImport.purs+9 examples/warning/ImplicitImport.purs+9 examples/warning/ImplicitQualifiedImport.purs+11 examples/warning/MissingTypeDeclaration.purs+4 examples/warning/OverlappingInstances.purs+17 examples/warning/OverlappingPattern.purs+15 examples/warning/ScopeShadowing.purs+13 examples/warning/ShadowedTypeVar.purs+5 examples/warning/UnnecessaryFFIModule.js+1 examples/warning/UnnecessaryFFIModule.purs+5 examples/warning/UnusedDctorExplicitImport.purs+8 examples/warning/UnusedDctorImportAll.purs+7 examples/warning/UnusedDctorImportExplicit.purs+7 examples/warning/UnusedExplicitImport.purs+8 examples/warning/UnusedFFIImplementations.js+2 examples/warning/UnusedFFIImplementations.purs+4 examples/warning/UnusedImport.purs+14 examples/warning/UnusedTypeVar.purs+5 examples/warning/WildcardInferredType.purs+23 hierarchy/Main.hs+115 license-generator/generate.hs+46 license-generator/header.txt+23 logo.png make_release_notes+2 package.yaml−86 psc-bundle/Main.hs+119 psc-bundle/README.md+18 psc-docs/Ctags.hs+13 psc-docs/Etags.hs+13 psc-docs/Main.hs+250 psc-docs/Tags.hs+18 psc-ide-client/Main.hs+46 psc-ide-server/Main.hs+158 psc-ide-server/PROTOCOL.md+552 psc-ide-server/README.md+44 psc-publish/Main.hs+50 psc/Main.hs+175 psci/Main.hs+364 psci/static/index.html+10 psci/static/index.js+63 psgo.cabal−145 purescript.cabal+525 src/CodeGen/IL.hs−321 src/CodeGen/IL/Common.hs−196 src/CodeGen/IL/Optimizer.hs−81 src/CodeGen/IL/Optimizer/Common.hs−18 src/CodeGen/IL/Optimizer/Inliner.hs−435 src/CodeGen/IL/Optimizer/MagicDo.hs−146 src/CodeGen/IL/Optimizer/TCO.hs−141 src/CodeGen/IL/Printer.hs−527 src/Control/Monad/Logger.hs+59 src/Control/Monad/Supply.hs+32 src/Control/Monad/Supply/Class.hs+24 src/Language/PureScript.hs+36 src/Language/PureScript/AST.hs+14 src/Language/PureScript/AST/Binders.hs+83 src/Language/PureScript/AST/Declarations.hs+625 src/Language/PureScript/AST/Exported.hs+154 src/Language/PureScript/AST/Literals.hs+37 src/Language/PureScript/AST/Operators.hs+53 src/Language/PureScript/AST/SourcePos.hs+80 src/Language/PureScript/AST/Traversals.hs+588 src/Language/PureScript/Bundle.hs+623 src/Language/PureScript/CodeGen.hs+8 src/Language/PureScript/CodeGen/JS.hs+449 src/Language/PureScript/CodeGen/JS/AST.hs+403 src/Language/PureScript/CodeGen/JS/Common.hs+232 src/Language/PureScript/CodeGen/JS/Optimizer.hs+79 src/Language/PureScript/CodeGen/JS/Optimizer/Blocks.hs+32 src/Language/PureScript/CodeGen/JS/Optimizer/Common.hs+82 src/Language/PureScript/CodeGen/JS/Optimizer/Inliner.hs+365 src/Language/PureScript/CodeGen/JS/Optimizer/MagicDo.hs+136 src/Language/PureScript/CodeGen/JS/Optimizer/TCO.hs+120 src/Language/PureScript/CodeGen/JS/Optimizer/Unused.hs+35 src/Language/PureScript/Comments.hs+17 src/Language/PureScript/Constants.hs+398 src/Language/PureScript/CoreFn.hs+15 src/Language/PureScript/CoreFn/Ann.hs+25 src/Language/PureScript/CoreFn/Binders.hs+42 src/Language/PureScript/CoreFn/Desugar.hs+270 src/Language/PureScript/CoreFn/Expr.hs+121 src/Language/PureScript/CoreFn/Meta.hs+42 src/Language/PureScript/CoreFn/Module.hs+22 src/Language/PureScript/CoreFn/Traversals.hs+77 src/Language/PureScript/Crash.hs+11 src/Language/PureScript/Docs.hs+14 src/Language/PureScript/Docs/AsMarkdown.hs+136 src/Language/PureScript/Docs/Convert.hs+192 src/Language/PureScript/Docs/Convert/ReExports.hs+510 src/Language/PureScript/Docs/Convert/Single.hs+200 src/Language/PureScript/Docs/ParseAndBookmark.hs+98 src/Language/PureScript/Docs/Render.hs+146 src/Language/PureScript/Docs/RenderedCode.hs+8 src/Language/PureScript/Docs/RenderedCode/Render.hs+212 src/Language/PureScript/Docs/RenderedCode/Types.hs+202 src/Language/PureScript/Docs/Types.hs+595 src/Language/PureScript/Docs/Utils/MonoidExtras.hs+9 src/Language/PureScript/Environment.hs+278 src/Language/PureScript/Errors.hs+1256 src/Language/PureScript/Errors/JSON.hs+73 src/Language/PureScript/Externs.hs+226 src/Language/PureScript/Ide.hs+196 src/Language/PureScript/Ide/CaseSplit.hs+150 src/Language/PureScript/Ide/Command.hs+147 src/Language/PureScript/Ide/Completion.hs+32 src/Language/PureScript/Ide/Conversions.hs+35 src/Language/PureScript/Ide/Error.hs+54 src/Language/PureScript/Ide/Externs.hs+124 src/Language/PureScript/Ide/Filter.hs+93 src/Language/PureScript/Ide/Imports.hs+332 src/Language/PureScript/Ide/Matcher.hs+124 src/Language/PureScript/Ide/Pursuit.hs+75 src/Language/PureScript/Ide/Rebuild.hs+164 src/Language/PureScript/Ide/Reexports.hs+116 src/Language/PureScript/Ide/SourceFile.hs+104 src/Language/PureScript/Ide/State.hs+213 src/Language/PureScript/Ide/Types.hs+260 src/Language/PureScript/Ide/Util.hs+95 src/Language/PureScript/Ide/Watcher.hs+49 src/Language/PureScript/Interactive.hs+289 src/Language/PureScript/Interactive/Completion.hs+222 src/Language/PureScript/Interactive/Directive.hs+100 src/Language/PureScript/Interactive/IO.hs+41 src/Language/PureScript/Interactive/Message.hs+52 src/Language/PureScript/Interactive/Module.hs+99 src/Language/PureScript/Interactive/Parser.hs+122 src/Language/PureScript/Interactive/Printer.hs+127 src/Language/PureScript/Interactive/Types.hs+145 src/Language/PureScript/Kinds.hs+46 src/Language/PureScript/Linter.hs+97 src/Language/PureScript/Linter/Exhaustive.hs+345 src/Language/PureScript/Linter/Imports.hs+364 src/Language/PureScript/Make.hs+470 src/Language/PureScript/ModuleDependencies.hs+100 src/Language/PureScript/Names.hs+205 src/Language/PureScript/Options.hs+39 src/Language/PureScript/Parser.hs+23 src/Language/PureScript/Parser/Common.hs+144 src/Language/PureScript/Parser/Declarations.hs+579 src/Language/PureScript/Parser/Kinds.hs+38 src/Language/PureScript/Parser/Lexer.hs+564 src/Language/PureScript/Parser/State.hs+18 src/Language/PureScript/Parser/Types.hs+128 src/Language/PureScript/Pretty.hs+17 src/Language/PureScript/Pretty/Common.hs+159 src/Language/PureScript/Pretty/JS.hs+308 src/Language/PureScript/Pretty/Kinds.hs+52 src/Language/PureScript/Pretty/Types.hs+170 src/Language/PureScript/Pretty/Values.hs+187 src/Language/PureScript/Publish.hs+411 src/Language/PureScript/Publish/BoxesHelpers.hs+44 src/Language/PureScript/Publish/ErrorsWarnings.hs+429 src/Language/PureScript/Publish/Utils.hs+41 src/Language/PureScript/Renamer.hs+191 src/Language/PureScript/Sugar.hs+67 src/Language/PureScript/Sugar/BindingGroups.hs+221 src/Language/PureScript/Sugar/CaseDeclarations.hs+188 src/Language/PureScript/Sugar/DoNotation.hs+63 src/Language/PureScript/Sugar/Names.hs+338 src/Language/PureScript/Sugar/Names/Common.hs+68 src/Language/PureScript/Sugar/Names/Env.hs+400 src/Language/PureScript/Sugar/Names/Exports.hs+305 src/Language/PureScript/Sugar/Names/Imports.hs+237 src/Language/PureScript/Sugar/ObjectWildcards.hs+92 src/Language/PureScript/Sugar/Operators.hs+415 src/Language/PureScript/Sugar/Operators/Binders.hs+26 src/Language/PureScript/Sugar/Operators/Common.hs+79 src/Language/PureScript/Sugar/Operators/Expr.hs+44 src/Language/PureScript/Sugar/Operators/Types.hs+27 src/Language/PureScript/Sugar/TypeClasses.hs+329 src/Language/PureScript/Sugar/TypeClasses/Deriving.hs+419 src/Language/PureScript/Sugar/TypeDeclarations.hs+63 src/Language/PureScript/Traversals.hs+27 src/Language/PureScript/TypeChecker.hs+424 src/Language/PureScript/TypeChecker/Entailment.hs+218 src/Language/PureScript/TypeChecker/Kinds.hs+267 src/Language/PureScript/TypeChecker/Monad.hs+291 src/Language/PureScript/TypeChecker/Rows.hs+53 src/Language/PureScript/TypeChecker/Skolems.hs+127 src/Language/PureScript/TypeChecker/Subsumption.hs+96 src/Language/PureScript/TypeChecker/Synonyms.hs+47 src/Language/PureScript/TypeChecker/Types.hs+759 src/Language/PureScript/TypeChecker/Unify.hs+217 src/Language/PureScript/TypeClassDictionaries.hs+47 src/Language/PureScript/Types.hs+323 src/System/IO/UTF8.hs+25 src/Tests.hs−141 stack-ghc-8.0.yaml+7 stack.nix−23 stack.yaml+6−21 support/ffi-loader.go−30 support/go.mod.ffi-loader−2 support/go.mod.output−2 support/go.mod.working−1 test/Spec.hs−2 tests/Language/PureScript/Ide/FilterSpec.hs+52 tests/Language/PureScript/Ide/Imports/IntegrationSpec.hs+83 tests/Language/PureScript/Ide/ImportsSpec.hs+130 tests/Language/PureScript/Ide/Integration.hs+285 tests/Language/PureScript/Ide/MatcherSpec.hs+47 tests/Language/PureScript/Ide/RebuildSpec.hs+57 tests/Language/PureScript/Ide/ReexportsSpec.hs+64 tests/Language/PureScript/Ide/SourceFile/IntegrationSpec.hs+36 tests/Language/PureScript/Ide/SourceFileSpec.hs+46 tests/Main.hs+44 tests/PscIdeSpec.hs+1 tests/TestCompiler.hs+286 tests/TestDocs.hs+310 tests/TestPscIde.hs+14 tests/TestPscPublish.hs+78 tests/TestPsci.hs+137 tests/TestUtils.hs+99 tests/support/.gitignore+2 tests/support/bower.json+12 tests/support/package.json+8 tests/support/psci/Sample.purs tests/support/pscide/.gitignore+7 tests/support/pscide/src/ImportsSpec.purs+3 tests/support/pscide/src/ImportsSpec1.purs+32 tests/support/pscide/src/MatcherSpec.purs+7 tests/support/pscide/src/RebuildSpecDep.purs+3 tests/support/pscide/src/RebuildSpecSingleModule.fail+3 tests/support/pscide/src/RebuildSpecSingleModule.purs+4 tests/support/pscide/src/RebuildSpecWithDeps.purs+5 tests/support/pscide/src/RebuildSpecWithForeign.js+1 tests/support/pscide/src/RebuildSpecWithForeign.purs+3 tests/support/pscide/src/RebuildSpecWithHiddenIdent.purs+6 tests/support/pscide/src/RebuildSpecWithMissingForeign.fail+3 tests/support/pscide/src/SourceFileSpec.purs+10 tests/support/setup-win.cmd+3 travis/build.sh+59 travis/convert-os-name.sh+14
.gitignore−3
@@ -14,10 +14,7 @@ bower_components/
1414node_modules
1515tmp/
1616.stack-work/
17−stack.yaml.lock
1817output
1918examples/docs/docs/
2019core-tests/full-core-docs.md
2120.psc-ide-port
22−.vscode/
23−result
.travis.ymlnew file+86
@@ -0,0 +1,86 @@
1+language: c
2+dist: trusty # because of perf issues
3+sudo: required
4+matrix:
5+ include:
6+ # The 'compiler' key is a hack to get Travis to use different caches for
7+ # each job in a build, in order to avoid the separate jobs stomping on each
8+ # other's caches. See https://github.com/travis-ci/travis-ci/issues/4393
9+ #
10+ # We use trusty boxes because they seem to be a bit faster.
11+ - compiler: cc-linux-lts-normal
12+ os: linux
13+ dist: trusty
14+ sudo: required
15+ env: BUILD_TYPE=normal DEPLOY=true
16+
17+ # - compiler: cc-linux-nightly-normal
18+ # os: linux
19+ # dist: trusty
20+ # sudo: required
21+ # env: BUILD_TYPE=normal STACKAGE_NIGHTLY=true
22+ # allow_failures: true
23+
24+ - compiler: cc-linux-ghc8.0-normal
25+ os: linux
26+ dist: trusty
27+ sudo: required
28+ env: BUILD_TYPE=normal STACK_YAML=stack-ghc-8.0.yaml
29+
30+ - compiler: cc-linux-lts-sdist
31+ os: linux
32+ dist: trusty
33+ sudo: required
34+ env: BUILD_TYPE=sdist COVERAGE=true
35+
36+ - compiler: cc-linux-lts-haddock
37+ os: linux
38+ dist: trusty
39+ sudo: required
40+ env: BUILD_TYPE=haddock
41+
42+ - compiler: cc-osx-lts-normal
43+ os: osx
44+ env: BUILD_TYPE=normal DEPLOY=true
45+
46+ - compiler: cc-osx-lts-sdist
47+ os: osx
48+ env: BUILD_TYPE=sdist
49+addons:
50+ apt:
51+ packages:
52+ - libgmp-dev
53+cache:
54+ directories:
55+ - $HOME/.local/bin
56+ - $HOME/.stack
57+install:
58+- | # Install stack.
59+ if test ! -f "$HOME/.local/bin/stack"
60+ then
61+ URL="https://www.stackage.org/stack/$TRAVIS_OS_NAME-x86_64"
62+ curl --location "$URL" > stack.tar.gz
63+ gunzip stack.tar.gz
64+ tar -x -f stack.tar --strip-components 1
65+ mkdir -p "$HOME/.local/bin"
66+ mv stack "$HOME/.local/bin/"
67+ fi
68+- npm install -g bower # for psc-docs / psc-publish tests
69+# Fix the CC environment variable, because Travis changes it
70+- export CC=gcc
71+- export OS_NAME=$(./travis/convert-os-name.sh)
72+script:
73+- travis/build.sh
74+before_deploy:
75+- ./bundle/build.sh $OS_NAME
76+deploy:
77+ provider: releases
78+ api_key: $RELEASE_KEY
79+ file:
80+ - bundle/$OS_NAME.tar.gz
81+ - bundle/$OS_NAME.sha
82+ skip_cleanup: true
83+ on:
84+ all_branches: true
85+ tags: true
86+ condition: "$DEPLOY = true"
CONTRIBUTING.mdnew file+39
@@ -0,0 +1,39 @@
1+An introductory overview of the compiler is available [here](https://www.youtube.com/watch?v=Y3P1dxqwFiE).
2+
3+Pull requests are encouraged.
4+
5+## Finding Issues to Work On
6+
7+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 ["easy" issues](https://github.com/purescript/purescript/labels/easy) to get started.
8+
9+## Pull Requests
10+
11+Please follow the following guidelines:
12+
13+- Add at least a test to `examples/passing/` and possibly to `examples/failing`.
14+- Build the binaries and libs with `cabal build`
15+- Install the binaries and libs with `cabal install`.
16+- Run `cabal configure --enable-tests && cabal build && cabal test` to build the test suite. You will need `npm` and `node` on your PATH to run the tests.
17+- Build the core libraries by running the script in `core-tests`.
18+
19+## Code Review
20+
21+To prevent core libraries from getting broken, every change must be reviewed. A pull request will be merged as long as one other team member has verified the changes.
22+
23+## Adding Dependencies
24+
25+Because the PureScript compiler is distributed in binary form, we include
26+the licenses of all dependencies, including transitive ones, in the LICENSE
27+file. Therefore, whenever the dependencies change, the LICENSE file should be
28+updated.
29+
30+This can be automated; see the `license-generator/generate.hs` file.
31+
32+## Writing Issues
33+
34+- If the issue is actually a question, please consider asking on Reddit, Stack Overflow or IRC first.
35+- Please include a minimal, repeatable test case with any bug report.
36+
37+## Copyright and Licensing
38+
39+For any code change, please append a copyright and licensing notice to the [CONTRIBUTORS.md](CONTRIBUTORS.md) file.
CONTRIBUTORS.mdnew file+83
@@ -0,0 +1,83 @@
1+## Contributors
2+
3+This file lists the contributors to the PureScript compiler project, and the terms under which their code is licensed.
4+
5+### Individuals
6+
7+- [@5outh](https://github.com/5outh) (Benjamin Kovach) - My existing contributions and all future contributions until further notice are Copyright Benjamin Kovach, and are licensed to the owners and users of the PureScript compiler project under the terms of the MIT license.
8+- [@andyarvanitis](https://github.com/andyarvanitis) (Andy Arvanitis) My existing contributions and all future contributions until further notice are Copyright Andy Arvanitis, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
9+- [@anthok88](https://github.com/anthoq88) - My existing contributions and all future contributions until further notice are Copyright anthoq88, and are licensed to the owners and users of the PureScript compiler project under the terms of the MIT license
10+- [@ardumont](https://github.com/ardumont) (Antoine R. Dumont) My existing contributions and all future contributions until further notice are Copyright Antoine R. Dumont, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
11+- [@aspidites](https://github.com/aspidites) (Edwin Marshall) My existing contributions and all future contributions until further notice are Copyright Edwin Marshall, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
12+- [@bagl](https://github.com/bagl) (Petr Vapenka) My existing contributions and all future contributions until further notice are Copyright Petr Vapenka, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
13+- [@balajirrao](https://github.com/balajirrao) (Balaji Rao) - My existing contributions and all future contributions until further notice are Copyright Balaji Rao, and are licensed to the owners and users of the PureScript compiler project under the terms of the MIT license.
14+- [@bergmark](https://github.com/bergmark) (Adam Bergmark) - My existing contributions and all future contributions until further notice are Copyright Adam Bergmark, and are licensed to the owners and users of the PureScript compiler project under the terms of the MIT license.
15+- [@bmjames](https://github.com/bmjames) (Ben James) My existing contributions and all future contributions until further notice are Copyright Ben James, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
16+- [@Bogdanp](https://github.com/Bogdanp) (Bogdan Paul Popa) My existing contributions and all future contributions until further notice are Copyright Bogdan Paul Popa, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
17+- [@bsermons](https://github.com/bsermons) (Brian Sermons) My existing contributions and all future contributions until further notice are Copyright Brian Sermons, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
18+- [@cdepillabout](https://github.com/cdepillabout) (Dennis Gosnell) My existing contributions and all future contributions until further notice are Copyright Dennis Gosnell, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
19+- [@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](http://opensource.org/licenses/MIT).
20+- [@codedmart](https://github.com/codedmart) (Brandon Martin) My existing contributions and all future contributions until further notice are Copyright Brandon Martin, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
21+- [@davidchambers](https://github.com/davidchambers) (David Chambers) My existing contributions and all future contributions until further notice are Copyright David Chambers, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
22+- [@DavidLindbom](https://github.com/DavidLindbom) (David Lindbom) My existing contributions and all future contributions until further notice are Copyright David Lindbom, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
23+- [@dckc](https://github.com/dckc) (Dan Connolly) My existing contributions and all future contributions until further notice are Copyright Dan Connolly, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
24+- [@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](http://opensource.org/licenses/MIT).
25+- [@eamelink](https://github.com/eamelink) (Erik Bakker) - My existing contributions and all future contributions until further notice are Copyright Erik Bakker, and are licensed to the owners and users of the PureScript compiler project under the terms of the MIT license.
26+- [@epost](https://github.com/epost) (Erik Post) - My existing contributions and all future contributions until further notice are Copyright Erik Post, and are licensed to the owners and users of the PureScript compiler project under the terms of the MIT license
27+- [@erdeszt](https://github.com/erdeszt) (Tibor Erdesz) My existing contributions and all future contributions until further notice are Copyright Tibor Erdesz, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
28+- [@etrepum](https://github.com/etrepum) (Bob Ippolito) My existing contributions and all future contributions until further notice are Copyright Bob Ippolito, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
29+- [@faineance](https://github.com/faineance) My existing contributions and all future contributions until further notice are Copyright faineance, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
30+- [@felixSchl](https://github.com/felixSchl) (Felix Schlitter) My existing contributions and all future contributions until further notice are Copyright Felix Schlitter, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
31+- [@FrigoEU](https://github.com/FrigoEU) (Simon Van Casteren) My existing contributions and all future contributions until further notice are Copyright Simon Van Casteren, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
32+- [@garyb](https://github.com/garyb) (Gary Burgess) My existing contributions and all future contributions until further notice are Copyright Gary Burgess, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
33+- [@hdgarrood](https://github.com/hdgarrood) (Harry Garrood) My existing contributions and all future contributions until further notice are Copyright Harry Garrood, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
34+- [@ianbollinger](https://github.com/ianbollinger) (Ian D. Bollinger) My existing contributions and all future contributions until further notice are Copyright Ian D. Bollinger, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
35+- [@ilovezfs](https://github.com/ilovezfs) - My existing contributions and all future contributions until further notice are Copyright ilovezfs, and are licensed to the owners and users of the PureScript compiler project under the terms of the MIT license
36+- [@izgzhen](https://github.com/izgzhen) (Zhen Zhang) My existing contributions and all future contributions until further notice are Copyright Zhen Zhang, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
37+- [@jacereda](https://github.com/jacereda) (Jorge Acereda) My existing contributions and all future contributions until further notice are Copyright Jorge Acereda, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
38+- [@japesinator](https://github.com/japesinator) (JP Smith) My existing contributions and all future contributions until further notice are Copyright JP Smith, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
39+- [@joneshf](https://github.com/joneshf) (Hardy Jones) - My existing contributions and all future contributions until further notice are Copyright Hardy Jones, and are licensed to the owners and users of the PureScript compiler project under the terms of the MIT license.
40+- [@kika](https://github.com/kika) (Kirill Pertsev) - My existing contributions and all future contributions until further notice are Copyright Kirill Pertsev, and are licensed to the owners and users of the PureScript compiler project under the terms of the MIT license.
41+- [@kRITZCREEK](https://github.com/kRITZCREEK) (Christoph Hegemann) - My existing contributions and all future contributions until further notice are Copyright Christoph Hegemann, and are licensed to the owners and users of the PureScript compiler project under the terms of the MIT license.
42+- [@L8D](https://github.com/L8D) (Tenor Biel) My existing contributions and all future contributions until further notice are Copyright Tenor Biel, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
43+- [@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](http://opensource.org/licenses/MIT).
44+- [@LiamGoodacre](https://github.com/LiamGoodacre) (Liam Goodacre) My existing contributions and all future contributions until further notice are Copyright Liam Goodacre, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
45+- [@lukerandall](https://github.com/lukerandall) (Luke Randall) My existing contributions and all future contributions until further notice are Copyright Luke Randall, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
46+- [@mgmeier](https://github.com/mgmeier) (Michael Karg) My existing contributions and all future contributions until further notice are Copyright Michael Gilliland, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
47+- [@michaelficarra](https://github.com/michaelficarra) (Michael Ficarra) My existing contributions and all future contributions until further notice are Copyright Michael Ficarra, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
48+- [@MichaelXavier](https://github.com/MichaelXavier) (Michael Xavier) - My existing contributions and all future contributions until further notice are Copyright Michael Xavier, and are licensed to the owners and users of the PureScript compiler project under the terms of the MIT license.
49+- [@mjgpy3](https://github.com/mjgpy3) (Michael Gilliland) My existing contributions and all future contributions until further notice are Copyright Michael Gilliland, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
50+- [@mpietrzak](https://github.com/mpietrzak) (Maciej Pietrzak) My existing contributions and all future contributions until further notice are Copyright Maciej Pietrzak, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
51+- [@mrhania](https://github.com/mrhania) (Łukasz Hanuszczak) - My existing contributions and all future contributions until further notice are Copyright Łukasz Hanuszczak, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
52+- [@nagisa](https://github.com/nagisa) I hereby release my [only contribution](https://github.com/purescript/purescript/commit/80287a5d0de619862d3b4cda9c1ee276d18fdcd8) into public domain.
53+- [@natefaubion](https://github.com/natefaubion) (Nathan Faubion) My existing contributions and all future contributions until further notice are Copyright Nathan Faubion, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
54+- [@nicodelpiano](https://github.com/nicodelpiano) (Nicolas Del Piano) My existing contributions and all future contributions until further notice are Copyright Nicolas Del Piano, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
55+- [@nullobject](https://github.com/nullobject) (Josh Bassett) My existing contributions and all future contributions until further notice are Copyright Josh Bassett, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
56+- [@nwolverson](https://github.com/nwolverson) (Nicholas Wolverson) My existing contributions and all future contributions until further notice are Copyright Nicholas Wolverson, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
57+- [@osa1](https://github.com/osa1) (Ömer Sinan Ağacan) - My existing contributions and all future contributions until further notice are Copyright Ömer Sinan Ağacan, and are licensed to the owners and users of the PureScript compiler project under the terms of the MIT license.
58+- [@paf31](https://github.com/paf31) (Phil Freeman) My existing contributions and all future contributions until further notice are Copyright Phil Freeman, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
59+- [@passy](https://github.com/passy) (Pascal Hartig) My existing contributions and all future contributions until further notice are Copyright Pascal Hartig, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
60+- [@paulyoung](https://github.com/paulyoung) (Paul Young) My existing contributions and all future contributions until further notice are Copyright Paul Young, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
61+- [@pelotom](https://github.com/pelotom) (Thomas Crockett) My existing contributions and all future contributions until further notice are Copyright Thomas Crockett, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
62+- [@phadej](https://github.com/phadej) (Oleg Grenrus) My existing contributions and all future contributions until further notice are Copyright Oleg Grenrus, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
63+- [@philopon](https://github.com/philopon) (Hirotomo Moriwaki) - My existing contributions and all future contributions until further notice are Copyright Hirotomo Moriwaki, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
64+- [@pseudonom](https://github.com/pseudonom) (Eric Easley) My existing contributions and all future contributions until further notice are Copyright Eric Easley, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
65+- [@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.
66+- [@robdaemon](https://github.com/robdaemon) (Robert Roland) My existing contributions and all future contributions until further notice are Copyright Robert Roland, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
67+- [@RossMeikleham](https://github.com/RossMeikleham) (Ross Meikleham) My existing contributions and all future contributions until further notice are Copyright Ross Meikleham, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
68+- [@rvion](https://github.com/rvion) (Rémi Vion) My existing contributions and all future contributions until further notice are Copyright Rémi Vion, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
69+- [@sebastiaanvisser](https://github.com/sebastiaanvisser) (Sebastiaan Visser) - My existing contributions and all future contributions until further notice are Copyright Sebastiaan Visser, and are licensed to the owners and users of the PureScript compiler project under the terms of the MIT license.
70+- [@senju](https://github.com/senju) - My existing contributions and all future contributions until further notice are Copyright senju, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
71+- [@sharkdp](https://github.com/sharkdp) (David Peter) My existing contributions and all future contributions until further notice are Copyright David Peter, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
72+- [@soupi](https://github.com/soupi) (Gil Mizrahi) My existing contributions and all future contributions until further notice are Copyright Gil Mizrahi, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
73+- [@sztupi](https://github.com/sztupi) (Attila Sztupak) My existing contributions and all future contributions until further notice are Copyright Attila Sztupak, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
74+- [@taku0](https://github.com/taku0) - My existing contributions and all future contributions until further notice are Copyright taku0, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
75+- [@tfausak](https://github.com/tfausak) (Taylor Fausak) My existing contributions and all future contributions until further notice are Copyright Taylor Fausak, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
76+- [@trofi](https://github.com/trofi) (Sergei Trofimovich) My existing contributions and all future contributions until further notice are Copyright Sergei Trofimovich, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
77+- [@utkarshkukreti](https://github.com/utkarshkukreti) (Utkarsh Kukreti) My existing contributions and all future contributions until further notice are Copyright Utkarsh Kukreti, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
78+- [@vkorablin](https://github.com/vkorablin) (Vladimir Korablin) - My existing contributions and all future contributions until further notice are Copyright Vladimir Korablin, and are licensed to the owners and users of the PureScript compiler project under the terms of the MIT license.
79+- [@zudov](https://github.com/zudov) (Konstantin Zudov) My existing contributions and all future contributions until further notice are Copyright Konstantin Zudov, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
80+
81+### Companies
82+
83+- [@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](http://opensource.org/licenses/MIT). - @jdegoes
ChangeLog.mddeleted−3
@@ -1,3 +0,0 @@
1−# Changelog for pscpp
2−
3−## Unreleased changes
INSTALL.mdnew file+53
@@ -0,0 +1,53 @@
1+# Installation information
2+
3+If you are having difficulty installing the PureScript compiler, feel free to
4+ask for help! A good place is the #purescript IRC channel on Freenode, or
5+alternatively Stack Overflow.
6+
7+## Using prebuilt binaries
8+
9+The prebuilt binaries are compiled with GHC 7.10.3, and therefore they should
10+run on any operating system supported by GHC 7.10.3, such as:
11+
12+* Windows 2000 or later,
13+* OS X 10.7 or later,
14+* Linux ??? (we're not sure what the minimum version is).
15+
16+This list is not exhaustive. If your OS is too old or not listed, or if the
17+binaries fail to run, you may be able to install the compiler by building it
18+from source; see below.
19+
20+It's probably safe to assume that other prebuilt distributions (eg, Homebrew,
21+Chocolatey, AUR, npm) use the same binaries, and therefore have the same
22+requirements.
23+
24+## Compiling from source
25+
26+GHC 7.10.1 or newer is required to compile from source. The easiest way is to
27+use stack:
28+
29+```
30+$ stack install --resolver=nightly purescript
31+```
32+
33+This will then copy the compiler and utilities into `~/.local/bin`.
34+
35+
36+If you don't have stack installed yet there are install instructions
37+[here](https://github.com/commercialhaskell/stack/blob/master/doc/install_and_upgrade.md).
38+
39+If you don't have ghc installed yet, stack will prompt you to run `stack setup`
40+which will install ghc for you.
41+
42+## The "curses" library
43+
44+`psci` depends on the `curses` library (via the Haskell package `terminfo`). If
45+you are having difficulty running the compiler, it may be because the `curses`
46+library is missing.
47+
48+On Linux, you will probably need to install `ncurses` manually. On Ubuntu, for
49+example, this can be done by running:
50+
51+```
52+$ sudo apt-get install libncurses5-dev
53+```
LICENSE+4524−20
@@ -1,30 +1,4534 @@
1−Copyright Andy Arvanitis (c) 2018
1+The MIT License (MIT)
22
3−All rights reserved.
3+Copyright (c) 2013-15 Phil Freeman, (c) 2014-2015 Gary Burgess, and other
4+contributors
45
5−Redistribution and use in source and binary forms, with or without
6−modification, are permitted provided that the following conditions are met:
6+Permission is hereby granted, free of charge, to any person obtaining a copy of
7+this software and associated documentation files (the "Software"), to deal in
8+the Software without restriction, including without limitation the rights to
9+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
10+the Software, and to permit persons to whom the Software is furnished to do so,
11+subject to the following conditions:
12+
13+The above copyright notice and this permission notice shall be included in all
14+copies or substantial portions of the Software.
15+
16+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
18+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
19+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22+
23+PureScript uses the following Haskell library packages. Their license files follow.
24+
25+ Glob
26+ SHA
27+ aeson
28+ aeson-better-errors
29+ aeson-pretty
30+ ansi-terminal
31+ ansi-wl-pprint
32+ appar
33+ array
34+ asn1-encoding
35+ asn1-parse
36+ asn1-types
37+ async
38+ attoparsec
39+ auto-update
40+ base
41+ base-compat
42+ base64-bytestring
43+ binary
44+ blaze-builder
45+ blaze-html
46+ blaze-markup
47+ bower-json
48+ boxes
49+ byteable
50+ byteorder
51+ bytestring
52+ bytestring-builder
53+ case-insensitive
54+ cereal
55+ clock
56+ cmdargs
57+ conduit
58+ conduit-extra
59+ connection
60+ containers
61+ cookie
62+ cryptonite
63+ data-default-class
64+ data-ordlist
65+ deepseq
66+ directory
67+ dlist
68+ easy-file
69+ edit-distance
70+ entropy
71+ exceptions
72+ fail
73+ fast-logger
74+ file-embed
75+ filepath
76+ fsnotify
77+ ghc-prim
78+ hashable
79+ haskeline
80+ hex
81+ hfsevents
82+ hourglass
83+ http-client
84+ http-client-tls
85+ http-date
86+ http-types
87+ http2
88+ integer-gmp
89+ iproute
90+ language-javascript
91+ lifted-base
92+ memory
93+ mime-types
94+ mmorph
95+ monad-control
96+ monad-logger
97+ monad-loops
98+ mtl
99+ network
100+ network-uri
101+ old-locale
102+ old-time
103+ optparse-applicative
104+ parallel
105+ parsec
106+ pattern-arrows
107+ pem
108+ pipes
109+ pipes-http
110+ primitive
111+ process
112+ protolude
113+ psqueues
114+ random
115+ regex-base
116+ regex-tdfa
117+ resourcet
118+ safe
119+ scientific
120+ semigroups
121+ simple-sendfile
122+ socks
123+ sourcemap
124+ spdx
125+ split
126+ stm
127+ stm-chans
128+ streaming-commons
129+ stringsearch
130+ syb
131+ tagged
132+ template-haskell
133+ terminfo
134+ text
135+ time
136+ time-locale-compat
137+ tls
138+ transformers
139+ transformers-base
140+ transformers-compat
141+ unix
142+ unix-compat
143+ unix-time
144+ unordered-containers
145+ utf8-string
146+ vault
147+ vector
148+ void
149+ wai
150+ wai-app-static
151+ wai-extra
152+ wai-logger
153+ wai-websockets
154+ warp
155+ websockets
156+ word8
157+ x509
158+ x509-store
159+ x509-system
160+ x509-validation
161+ zlib
162+
163+Glob LICENSE file:
164+
165+ The code in Glob is released under the license below. Copyrights to parts of
166+ the code are held by whoever wrote the code in question: see CREDITS.txt for a
167+ list of authors.
168+
169+ Copyright (c) 2008-2016 <authors>
170+ All rights reserved.
171+
172+ Redistribution and use in source and binary forms, with or without
173+ modification, are permitted provided that the following conditions are met:
174+ * Redistributions of source code must retain the above copyright
175+ notice, this list of conditions and the following disclaimer.
176+ * Redistributions in binary form must reproduce the above copyright
177+ notice, this list of conditions and the following disclaimer in the
178+ documentation and/or other materials provided with the distribution.
179+ * Neither the name of the project nor the names of its contributors may be
180+ used to endorse or promote products derived from this software without
181+ specific prior written permission.
182+
183+ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
184+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
185+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
186+ EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
187+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
188+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
189+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
190+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
191+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
192+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
193+
194+SHA LICENSE file:
195+
196+ Copyright (c) 2008, Galois, Inc.
197+ All rights reserved.
198+
199+ Redistribution and use in source and binary forms, with or without
200+ modification, are permitted provided that the following conditions
201+ are met:
202+
203+ * Redistributions of source code must retain the above copyright
204+ notice, this list of conditions and the following disclaimer.
205+ * Redistributions in binary form must reproduce the above copyright
206+ notice, this list of conditions and the following disclaimer in
207+ the documentation and/or other materials provided with the
208+ distribution.
209+ * Neither the name of the Galois, Inc. nor the names of its
210+ contributors may be used to endorse or promote products derived
211+ from this software without specific prior written permission.
212+
213+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
214+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
215+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
216+ FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
217+ COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
218+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
219+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
220+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
221+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
222+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
223+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
224+ POSSIBILITY OF SUCH DAMAGE.
225+
226+aeson LICENSE file:
227+
228+ Copyright (c) 2011, MailRank, Inc.
229+
230+ All rights reserved.
231+
232+ Redistribution and use in source and binary forms, with or without
233+ modification, are permitted provided that the following conditions
234+ are met:
235+
236+ 1. Redistributions of source code must retain the above copyright
237+ notice, this list of conditions and the following disclaimer.
238+
239+ 2. Redistributions in binary form must reproduce the above copyright
240+ notice, this list of conditions and the following disclaimer in the
241+ documentation and/or other materials provided with the distribution.
242+
243+ 3. Neither the name of the author nor the names of his contributors
244+ may be used to endorse or promote products derived from this software
245+ without specific prior written permission.
246+
247+ THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
248+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
249+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
250+ DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
251+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
252+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
253+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
254+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
255+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
256+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
257+ POSSIBILITY OF SUCH DAMAGE.
258+
259+aeson-better-errors LICENSE file:
260+
261+ Copyright (c) 2015 Harry Garrood
262+
263+ Permission is hereby granted, free of charge, to any person obtaining
264+ a copy of this software and associated documentation files (the
265+ "Software"), to deal in the Software without restriction, including
266+ without limitation the rights to use, copy, modify, merge, publish,
267+ distribute, sublicense, and/or sell copies of the Software, and to
268+ permit persons to whom the Software is furnished to do so, subject to
269+ the following conditions:
270+
271+ The above copyright notice and this permission notice shall be included
272+ in all copies or substantial portions of the Software.
273+
274+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
275+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
276+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
277+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
278+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
279+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
280+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
281+
282+aeson-pretty LICENSE file:
283+
284+ Copyright (c)2011, Falko Peters
285+
286+ All rights reserved.
287+
288+ Redistribution and use in source and binary forms, with or without
289+ modification, are permitted provided that the following conditions are met:
290+
291+ * Redistributions of source code must retain the above copyright
292+ notice, this list of conditions and the following disclaimer.
293+
294+ * Redistributions in binary form must reproduce the above
295+ copyright notice, this list of conditions and the following
296+ disclaimer in the documentation and/or other materials provided
297+ with the distribution.
298+
299+ * Neither the name of Falko Peters nor the names of other
300+ contributors may be used to endorse or promote products derived
301+ from this software without specific prior written permission.
302+
303+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
304+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
305+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
306+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
307+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
308+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
309+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
310+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
311+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
312+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
313+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
314+
315+ansi-terminal LICENSE file:
316+
317+ Copyright (c) 2008, Maximilian Bolingbroke
318+ All rights reserved.
319+
320+ Redistribution and use in source and binary forms, with or without modification, are permitted
321+ provided that the following conditions are met:
322+
323+ * Redistributions of source code must retain the above copyright notice, this list of
324+ conditions and the following disclaimer.
325+ * Redistributions in binary form must reproduce the above copyright notice, this list of
326+ conditions and the following disclaimer in the documentation and/or other materials
327+ provided with the distribution.
328+ * Neither the name of Maximilian Bolingbroke nor the names of other contributors may be used to
329+ endorse or promote products derived from this software without specific prior written permission.
330+
331+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
332+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
333+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
334+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
335+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
336+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
337+ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
338+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
339+
340+ansi-wl-pprint LICENSE file:
341+
342+ Copyright 2008, Daan Leijen and Max Bolingbroke. All rights reserved.
343+
344+ Redistribution and use in source and binary forms, with or without
345+ modification, are permitted provided that the following conditions are
346+ met:
347+
348+ * Redistributions of source code must retain the above copyright
349+ notice, this list of conditions and the following disclaimer.
350+
351+ * Redistributions in binary form must reproduce the above copyright
352+ notice, this list of conditions and the following disclaimer in
353+ the documentation and/or other materials provided with the
354+ distribution.
355+
356+ This software is provided by the copyright holders "as is" and any
357+ express or implied warranties, including, but not limited to, the
358+ implied warranties of merchantability and fitness for a particular
359+ purpose are disclaimed. In no event shall the copyright holders be
360+ liable for any direct, indirect, incidental, special, exemplary, or
361+ consequential damages (including, but not limited to, procurement of
362+ substitute goods or services; loss of use, data, or profits; or
363+ business interruption) however caused and on any theory of liability,
364+ whether in contract, strict liability, or tort (including negligence
365+ or otherwise) arising in any way out of the use of this software, even
366+ if advised of the possibility of such damage.
367+
368+appar LICENSE file:
369+
370+ Copyright (c) 2009, IIJ Innovation Institute Inc.
371+ All rights reserved.
372+
373+ Redistribution and use in source and binary forms, with or without
374+ modification, are permitted provided that the following conditions
375+ are met:
376+
377+ * Redistributions of source code must retain the above copyright
378+ notice, this list of conditions and the following disclaimer.
379+ * Redistributions in binary form must reproduce the above copyright
380+ notice, this list of conditions and the following disclaimer in
381+ the documentation and/or other materials provided with the
382+ distribution.
383+ * Neither the name of the copyright holders nor the names of its
384+ contributors may be used to endorse or promote products derived
385+ from this software without specific prior written permission.
386+
387+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
388+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
389+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
390+ FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
391+ COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
392+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
393+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
394+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
395+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
396+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
397+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
398+ POSSIBILITY OF SUCH DAMAGE.
399+
400+array LICENSE file:
401+
402+ This library (libraries/base) is derived from code from several
403+ sources:
404+
405+ * Code from the GHC project which is largely (c) The University of
406+ Glasgow, and distributable under a BSD-style license (see below),
407+
408+ * Code from the Haskell 98 Report which is (c) Simon Peyton Jones
409+ and freely redistributable (but see the full license for
410+ restrictions).
411+
412+ * Code from the Haskell Foreign Function Interface specification,
413+ which is (c) Manuel M. T. Chakravarty and freely redistributable
414+ (but see the full license for restrictions).
415+
416+ The full text of these licenses is reproduced below. All of the
417+ licenses are BSD-style or compatible.
418+
419+ -----------------------------------------------------------------------------
420+
421+ The Glasgow Haskell Compiler License
422+
423+ Copyright 2004, The University Court of the University of Glasgow.
424+ All rights reserved.
425+
426+ Redistribution and use in source and binary forms, with or without
427+ modification, are permitted provided that the following conditions are met:
428+
429+ - Redistributions of source code must retain the above copyright notice,
430+ this list of conditions and the following disclaimer.
431+
432+ - Redistributions in binary form must reproduce the above copyright notice,
433+ this list of conditions and the following disclaimer in the documentation
434+ and/or other materials provided with the distribution.
435+
436+ - Neither name of the University nor the names of its contributors may be
437+ used to endorse or promote products derived from this software without
438+ specific prior written permission.
439+
440+ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
441+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
442+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
443+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
444+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
445+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
446+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
447+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
448+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
449+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
450+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
451+ DAMAGE.
452+
453+ -----------------------------------------------------------------------------
454+
455+ Code derived from the document "Report on the Programming Language
456+ Haskell 98", is distributed under the following license:
457+
458+ Copyright (c) 2002 Simon Peyton Jones
459+
460+ The authors intend this Report to belong to the entire Haskell
461+ community, and so we grant permission to copy and distribute it for
462+ any purpose, provided that it is reproduced in its entirety,
463+ including this Notice. Modified versions of this Report may also be
464+ copied and distributed for any purpose, provided that the modified
465+ version is clearly presented as such, and that it does not claim to
466+ be a definition of the Haskell 98 Language.
467+
468+ -----------------------------------------------------------------------------
469+
470+ Code derived from the document "The Haskell 98 Foreign Function
471+ Interface, An Addendum to the Haskell 98 Report" is distributed under
472+ the following license:
473+
474+ Copyright (c) 2002 Manuel M. T. Chakravarty
475+
476+ The authors intend this Report to belong to the entire Haskell
477+ community, and so we grant permission to copy and distribute it for
478+ any purpose, provided that it is reproduced in its entirety,
479+ including this Notice. Modified versions of this Report may also be
480+ copied and distributed for any purpose, provided that the modified
481+ version is clearly presented as such, and that it does not claim to
482+ be a definition of the Haskell 98 Foreign Function Interface.
483+
484+ -----------------------------------------------------------------------------
485+
486+asn1-encoding LICENSE file:
487+
488+ Copyright (c) 2010-2013 Vincent Hanquez <vincent@snarc.org>
489+
490+ All rights reserved.
491+
492+ Redistribution and use in source and binary forms, with or without
493+ modification, are permitted provided that the following conditions
494+ are met:
495+ 1. Redistributions of source code must retain the above copyright
496+ notice, this list of conditions and the following disclaimer.
497+ 2. Redistributions in binary form must reproduce the above copyright
498+ notice, this list of conditions and the following disclaimer in the
499+ documentation and/or other materials provided with the distribution.
500+ 3. Neither the name of the author nor the names of his contributors
501+ may be used to endorse or promote products derived from this software
502+ without specific prior written permission.
503+
504+ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
505+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
506+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
507+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
508+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
509+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
510+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
511+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
512+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
513+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
514+ SUCH DAMAGE.
515+
516+asn1-parse LICENSE file:
517+
518+ Copyright (c) 2010-2013 Vincent Hanquez <vincent@snarc.org>
519+
520+ All rights reserved.
521+
522+ Redistribution and use in source and binary forms, with or without
523+ modification, are permitted provided that the following conditions
524+ are met:
525+ 1. Redistributions of source code must retain the above copyright
526+ notice, this list of conditions and the following disclaimer.
527+ 2. Redistributions in binary form must reproduce the above copyright
528+ notice, this list of conditions and the following disclaimer in the
529+ documentation and/or other materials provided with the distribution.
530+ 3. Neither the name of the author nor the names of his contributors
531+ may be used to endorse or promote products derived from this software
532+ without specific prior written permission.
533+
534+ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
535+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
536+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
537+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
538+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
539+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
540+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
541+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
542+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
543+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
544+ SUCH DAMAGE.
545+
546+asn1-types LICENSE file:
547+
548+ Copyright (c) 2010-2013 Vincent Hanquez <vincent@snarc.org>
549+
550+ All rights reserved.
551+
552+ Redistribution and use in source and binary forms, with or without
553+ modification, are permitted provided that the following conditions
554+ are met:
555+ 1. Redistributions of source code must retain the above copyright
556+ notice, this list of conditions and the following disclaimer.
557+ 2. Redistributions in binary form must reproduce the above copyright
558+ notice, this list of conditions and the following disclaimer in the
559+ documentation and/or other materials provided with the distribution.
560+ 3. Neither the name of the author nor the names of his contributors
561+ may be used to endorse or promote products derived from this software
562+ without specific prior written permission.
563+
564+ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
565+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
566+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
567+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
568+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
569+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
570+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
571+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
572+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
573+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
574+ SUCH DAMAGE.
575+
576+async LICENSE file:
577+
578+ Copyright (c) 2012, Simon Marlow
579+
580+ All rights reserved.
581+
582+ Redistribution and use in source and binary forms, with or without
583+ modification, are permitted provided that the following conditions are met:
584+
585+ * Redistributions of source code must retain the above copyright
586+ notice, this list of conditions and the following disclaimer.
587+
588+ * Redistributions in binary form must reproduce the above
589+ copyright notice, this list of conditions and the following
590+ disclaimer in the documentation and/or other materials provided
591+ with the distribution.
592+
593+ * Neither the name of Simon Marlow nor the names of other
594+ contributors may be used to endorse or promote products derived
595+ from this software without specific prior written permission.
596+
597+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
598+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
599+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
600+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
601+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
602+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
603+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
604+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
605+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
606+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
607+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
608+
609+attoparsec LICENSE file:
610+
611+ Copyright (c) Lennart Kolmodin
612+
613+ All rights reserved.
614+
615+ Redistribution and use in source and binary forms, with or without
616+ modification, are permitted provided that the following conditions
617+ are met:
618+
619+ 1. Redistributions of source code must retain the above copyright
620+ notice, this list of conditions and the following disclaimer.
621+
622+ 2. Redistributions in binary form must reproduce the above copyright
623+ notice, this list of conditions and the following disclaimer in the
624+ documentation and/or other materials provided with the distribution.
625+
626+ 3. Neither the name of the author nor the names of his contributors
627+ may be used to endorse or promote products derived from this software
628+ without specific prior written permission.
629+
630+ THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
631+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
632+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
633+ DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
634+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
635+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
636+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
637+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
638+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
639+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
640+ POSSIBILITY OF SUCH DAMAGE.
641+
642+auto-update LICENSE file:
643+
644+ Copyright (c) 2014 Michael Snoyman
645+
646+ Permission is hereby granted, free of charge, to any person obtaining
647+ a copy of this software and associated documentation files (the
648+ "Software"), to deal in the Software without restriction, including
649+ without limitation the rights to use, copy, modify, merge, publish,
650+ distribute, sublicense, and/or sell copies of the Software, and to
651+ permit persons to whom the Software is furnished to do so, subject to
652+ the following conditions:
653+
654+ The above copyright notice and this permission notice shall be included
655+ in all copies or substantial portions of the Software.
656+
657+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
658+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
659+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
660+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
661+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
662+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
663+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
664+
665+base LICENSE file:
666+
667+ This library (libraries/base) is derived from code from several
668+ sources:
669+
670+ * Code from the GHC project which is largely (c) The University of
671+ Glasgow, and distributable under a BSD-style license (see below),
672+
673+ * Code from the Haskell 98 Report which is (c) Simon Peyton Jones
674+ and freely redistributable (but see the full license for
675+ restrictions).
676+
677+ * Code from the Haskell Foreign Function Interface specification,
678+ which is (c) Manuel M. T. Chakravarty and freely redistributable
679+ (but see the full license for restrictions).
680+
681+ The full text of these licenses is reproduced below. All of the
682+ licenses are BSD-style or compatible.
683+
684+ -----------------------------------------------------------------------------
685+
686+ The Glasgow Haskell Compiler License
687+
688+ Copyright 2004, The University Court of the University of Glasgow.
689+ All rights reserved.
690+
691+ Redistribution and use in source and binary forms, with or without
692+ modification, are permitted provided that the following conditions are met:
693+
694+ - Redistributions of source code must retain the above copyright notice,
695+ this list of conditions and the following disclaimer.
696+
697+ - Redistributions in binary form must reproduce the above copyright notice,
698+ this list of conditions and the following disclaimer in the documentation
699+ and/or other materials provided with the distribution.
700+
701+ - Neither name of the University nor the names of its contributors may be
702+ used to endorse or promote products derived from this software without
703+ specific prior written permission.
704+
705+ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
706+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
707+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
708+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
709+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
710+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
711+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
712+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
713+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
714+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
715+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
716+ DAMAGE.
717+
718+ -----------------------------------------------------------------------------
719+
720+ Code derived from the document "Report on the Programming Language
721+ Haskell 98", is distributed under the following license:
722+
723+ Copyright (c) 2002 Simon Peyton Jones
724+
725+ The authors intend this Report to belong to the entire Haskell
726+ community, and so we grant permission to copy and distribute it for
727+ any purpose, provided that it is reproduced in its entirety,
728+ including this Notice. Modified versions of this Report may also be
729+ copied and distributed for any purpose, provided that the modified
730+ version is clearly presented as such, and that it does not claim to
731+ be a definition of the Haskell 98 Language.
732+
733+ -----------------------------------------------------------------------------
734+
735+ Code derived from the document "The Haskell 98 Foreign Function
736+ Interface, An Addendum to the Haskell 98 Report" is distributed under
737+ the following license:
738+
739+ Copyright (c) 2002 Manuel M. T. Chakravarty
740+
741+ The authors intend this Report to belong to the entire Haskell
742+ community, and so we grant permission to copy and distribute it for
743+ any purpose, provided that it is reproduced in its entirety,
744+ including this Notice. Modified versions of this Report may also be
745+ copied and distributed for any purpose, provided that the modified
746+ version is clearly presented as such, and that it does not claim to
747+ be a definition of the Haskell 98 Foreign Function Interface.
748+
749+ -----------------------------------------------------------------------------
750+
751+base-compat LICENSE file:
752+
753+ Copyright (c) 2012-2016 Simon Hengel <sol@typeful.net> and Ryan Scott <ryan.gl.scott@gmail.com>
754+
755+ Permission is hereby granted, free of charge, to any person obtaining a copy
756+ of this software and associated documentation files (the "Software"), to deal
757+ in the Software without restriction, including without limitation the rights
758+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
759+ copies of the Software, and to permit persons to whom the Software is
760+ furnished to do so, subject to the following conditions:
761+
762+ The above copyright notice and this permission notice shall be included in
763+ all copies or substantial portions of the Software.
764+
765+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
766+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
767+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
768+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
769+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
770+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
771+ THE SOFTWARE.
772+
773+base64-bytestring LICENSE file:
774+
775+ Copyright (c) 2010 Bryan O'Sullivan <bos@serpentine.com>
776+
777+ All rights reserved.
778+
779+ Redistribution and use in source and binary forms, with or without
780+ modification, are permitted provided that the following conditions
781+ are met:
782+
783+ 1. Redistributions of source code must retain the above copyright
784+ notice, this list of conditions and the following disclaimer.
785+
786+ 2. Redistributions in binary form must reproduce the above copyright
787+ notice, this list of conditions and the following disclaimer in the
788+ documentation and/or other materials provided with the distribution.
789+
790+ 3. Neither the name of the author nor the names of his contributors
791+ may be used to endorse or promote products derived from this software
792+ without specific prior written permission.
793+
794+ THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
795+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
796+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
797+ DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
798+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
799+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
800+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
801+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
802+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
803+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
804+ POSSIBILITY OF SUCH DAMAGE.
805+
806+binary LICENSE file:
807+
808+ Copyright (c) Lennart Kolmodin
809+
810+ All rights reserved.
811+
812+ Redistribution and use in source and binary forms, with or without
813+ modification, are permitted provided that the following conditions
814+ are met:
815+
816+ 1. Redistributions of source code must retain the above copyright
817+ notice, this list of conditions and the following disclaimer.
818+
819+ 2. Redistributions in binary form must reproduce the above copyright
820+ notice, this list of conditions and the following disclaimer in the
821+ documentation and/or other materials provided with the distribution.
822+
823+ 3. Neither the name of the author nor the names of his contributors
824+ may be used to endorse or promote products derived from this software
825+ without specific prior written permission.
826+
827+ THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
828+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
829+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
830+ DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
831+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
832+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
833+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
834+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
835+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
836+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
837+ POSSIBILITY OF SUCH DAMAGE.
838+
839+blaze-builder LICENSE file:
840+
841+ Copyright Jasper Van der Jeugt 2010, Simon Meier 2010 & 2011
842+
843+ All rights reserved.
844+
845+ Redistribution and use in source and binary forms, with or without
846+ modification, are permitted provided that the following conditions are met:
847+
848+ * Redistributions of source code must retain the above copyright
849+ notice, this list of conditions and the following disclaimer.
850+
851+ * Redistributions in binary form must reproduce the above
852+ copyright notice, this list of conditions and the following
853+ disclaimer in the documentation and/or other materials provided
854+ with the distribution.
855+
856+ * Neither the name of Jasper Van der Jeugt nor the names of other
857+ contributors may be used to endorse or promote products derived
858+ from this software without specific prior written permission.
859+
860+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
861+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
862+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
863+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
864+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
865+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
866+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
867+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
868+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
869+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
870+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
871+
872+blaze-html LICENSE file:
873+
874+ Copyright Jasper Van der Jeugt 2010
875+
876+ All rights reserved.
877+
878+ Redistribution and use in source and binary forms, with or without
879+ modification, are permitted provided that the following conditions are met:
880+
881+ * Redistributions of source code must retain the above copyright
882+ notice, this list of conditions and the following disclaimer.
883+
884+ * Redistributions in binary form must reproduce the above
885+ copyright notice, this list of conditions and the following
886+ disclaimer in the documentation and/or other materials provided
887+ with the distribution.
888+
889+ * Neither the name of Jasper Van der Jeugt nor the names of other
890+ contributors may be used to endorse or promote products derived
891+ from this software without specific prior written permission.
892+
893+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
894+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
895+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
896+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
897+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
898+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
899+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
900+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
901+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
902+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
903+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
904+
905+blaze-markup LICENSE file:
906+
907+ Copyright Jasper Van der Jeugt 2010
908+
909+ All rights reserved.
910+
911+ Redistribution and use in source and binary forms, with or without
912+ modification, are permitted provided that the following conditions are met:
913+
914+ * Redistributions of source code must retain the above copyright
915+ notice, this list of conditions and the following disclaimer.
916+
917+ * Redistributions in binary form must reproduce the above
918+ copyright notice, this list of conditions and the following
919+ disclaimer in the documentation and/or other materials provided
920+ with the distribution.
921+
922+ * Neither the name of Jasper Van der Jeugt nor the names of other
923+ contributors may be used to endorse or promote products derived
924+ from this software without specific prior written permission.
925+
926+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
927+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
928+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
929+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
930+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
931+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
932+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
933+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
934+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
935+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
936+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
937+
938+bower-json LICENSE file:
939+
940+ Copyright (c) 2015 Harry Garrood
941+
942+ Permission is hereby granted, free of charge, to any person obtaining
943+ a copy of this software and associated documentation files (the
944+ "Software"), to deal in the Software without restriction, including
945+ without limitation the rights to use, copy, modify, merge, publish,
946+ distribute, sublicense, and/or sell copies of the Software, and to
947+ permit persons to whom the Software is furnished to do so, subject to
948+ the following conditions:
949+
950+ The above copyright notice and this permission notice shall be included
951+ in all copies or substantial portions of the Software.
952+
953+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
954+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
955+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
956+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
957+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
958+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
959+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
960+
961+boxes LICENSE file:
962+
963+ Copyright (c) Brent Yorgey 2008
964+
965+ Redistribution and use in source and binary forms, with or without
966+ modification, are permitted provided that the following conditions
967+ are met:
968+ 1. Redistributions of source code must retain the above copyright
969+ notice, this list of conditions and the following disclaimer.
970+ 2. Redistributions in binary form must reproduce the above copyright
971+ notice, this list of conditions and the following disclaimer in the
972+ documentation and/or other materials provided with the distribution.
973+ 3. Neither the name of the author nor the names of other contributors
974+ may be used to endorse or promote products derived from this software
975+ without specific prior written permission.
976+
977+ All other rights are reserved.
978+
979+ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND
980+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
981+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
982+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
983+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
984+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
985+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
986+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
987+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
988+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
989+ SUCH DAMAGE.
990+
991+byteable LICENSE file:
992+
993+ Copyright (c) 2013 Vincent Hanquez <vincent@snarc.org>
994+
995+ All rights reserved.
996+
997+ Redistribution and use in source and binary forms, with or without
998+ modification, are permitted provided that the following conditions
999+ are met:
1000+ 1. Redistributions of source code must retain the above copyright
1001+ notice, this list of conditions and the following disclaimer.
1002+ 2. Redistributions in binary form must reproduce the above copyright
1003+ notice, this list of conditions and the following disclaimer in the
1004+ documentation and/or other materials provided with the distribution.
1005+ 3. Neither the name of the author nor the names of his contributors
1006+ may be used to endorse or promote products derived from this software
1007+ without specific prior written permission.
1008+
1009+ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS AS IS'' AND
1010+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1011+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1012+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
1013+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1014+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1015+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1016+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1017+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1018+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1019+ SUCH DAMAGE.
1020+
1021+byteorder LICENSE file:
1022+
1023+ Copyright 2009, Antoine Latter
1024+
1025+ All rights reserved.
1026+
1027+ Redistribution and use in source and binary forms, with or without
1028+ modification, are permitted provided that the following conditions are met:
1029+
1030+ * Redistributions of source code must retain the above copyright
1031+ notice, this list of conditions and the following disclaimer.
1032+
1033+ * Redistributions in binary form must reproduce the above
1034+ copyright notice, this list of conditions and the following
1035+ disclaimer in the documentation and/or other materials provided
1036+ with the distribution.
1037+
1038+ * Neither the name of the author nor the names of other
1039+ contributors may be used to endorse or promote products derived
1040+ from this software without specific prior written permission.
1041+
1042+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1043+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1044+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1045+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1046+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1047+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1048+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1049+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1050+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1051+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1052+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1053+
1054+bytestring LICENSE file:
1055+
1056+ Copyright (c) Don Stewart 2005-2009
1057+ (c) Duncan Coutts 2006-2015
1058+ (c) David Roundy 2003-2005
1059+ (c) Simon Meier 2010-2011
1060+
1061+ All rights reserved.
1062+
1063+ Redistribution and use in source and binary forms, with or without
1064+ modification, are permitted provided that the following conditions
1065+ are met:
1066+ 1. Redistributions of source code must retain the above copyright
1067+ notice, this list of conditions and the following disclaimer.
1068+ 2. Redistributions in binary form must reproduce the above copyright
1069+ notice, this list of conditions and the following disclaimer in the
1070+ documentation and/or other materials provided with the distribution.
1071+ 3. Neither the name of the author nor the names of his contributors
1072+ may be used to endorse or promote products derived from this software
1073+ without specific prior written permission.
1074+
1075+ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1076+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1077+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1078+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
1079+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1080+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1081+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1082+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1083+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1084+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1085+ SUCH DAMAGE.
1086+
1087+bytestring-builder LICENSE file:
1088+
1089+ Copyright Jasper Van der Jeugt 2010, Simon Meier 2010-2013
1090+
1091+ All rights reserved.
1092+
1093+ Redistribution and use in source and binary forms, with or without
1094+ modification, are permitted provided that the following conditions are met:
1095+
1096+ * Redistributions of source code must retain the above copyright
1097+ notice, this list of conditions and the following disclaimer.
1098+
1099+ * Redistributions in binary form must reproduce the above
1100+ copyright notice, this list of conditions and the following
1101+ disclaimer in the documentation and/or other materials provided
1102+ with the distribution.
1103+
1104+ * Neither the name of Jasper Van der Jeugt nor the names of other
1105+ contributors may be used to endorse or promote products derived
1106+ from this software without specific prior written permission.
1107+
1108+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1109+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1110+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1111+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1112+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1113+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1114+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1115+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1116+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1117+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1118+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1119+
1120+case-insensitive LICENSE file:
1121+
1122+ Copyright (c) 2011-2013 Bas van Dijk
1123+
1124+ All rights reserved.
1125+
1126+ Redistribution and use in source and binary forms, with or without
1127+ modification, are permitted provided that the following conditions are
1128+ met:
1129+
1130+ * Redistributions of source code must retain the above copyright
1131+ notice, this list of conditions and the following disclaimer.
1132+
1133+ * Redistributions in binary form must reproduce the above
1134+ copyright notice, this list of conditions and the following
1135+ disclaimer in the documentation and/or other materials provided
1136+ with the distribution.
1137+
1138+ * The name of Bas van Dijk and the names of contributors may NOT
1139+ be used to endorse or promote products derived from this
1140+ software without specific prior written permission.
1141+
1142+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1143+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1144+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1145+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1146+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1147+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1148+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1149+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1150+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1151+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1152+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1153+
1154+cereal LICENSE file:
1155+
1156+ Copyright (c) Lennart Kolmodin, Galois, Inc.
1157+
1158+ All rights reserved.
1159+
1160+ Redistribution and use in source and binary forms, with or without
1161+ modification, are permitted provided that the following conditions
1162+ are met:
1163+
1164+ 1. Redistributions of source code must retain the above copyright
1165+ notice, this list of conditions and the following disclaimer.
1166+
1167+ 2. Redistributions in binary form must reproduce the above copyright
1168+ notice, this list of conditions and the following disclaimer in the
1169+ documentation and/or other materials provided with the distribution.
1170+
1171+ 3. Neither the name of the author nor the names of his contributors
1172+ may be used to endorse or promote products derived from this software
1173+ without specific prior written permission.
1174+
1175+ THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
1176+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
1177+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
1178+ DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
1179+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1180+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1181+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1182+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
1183+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
1184+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
1185+ POSSIBILITY OF SUCH DAMAGE.
1186+
1187+clock LICENSE file:
1188+
1189+ Copyright (c) 2009-2012, Cetin Sert
1190+ Copyright (c) 2010, Eugene Kirpichov
1191+
1192+ All rights reserved.
1193+
1194+ Redistribution and use in source and binary forms, with or without
1195+ modification, are permitted provided that the following conditions are
1196+ met:
1197+
1198+ * Redistributions of source code must retain the above copyright
1199+ notice, this list of conditions and the following disclaimer.
1200+
1201+ * Redistributions in binary form must reproduce the above
1202+ copyright notice, this list of conditions and the following
1203+ disclaimer in the documentation and/or other materials provided
1204+ with the distribution.
1205+
1206+ * The names of contributors may not be used to endorse or promote
1207+ products derived from this software without specific prior
1208+ written permission.
1209+
1210+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1211+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1212+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1213+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1214+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1215+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1216+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1217+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1218+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1219+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1220+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1221+
1222+cmdargs LICENSE file:
1223+
1224+ Copyright Neil Mitchell 2009-2016.
1225+ All rights reserved.
1226+
1227+ Redistribution and use in source and binary forms, with or without
1228+ modification, are permitted provided that the following conditions are
1229+ met:
1230+
1231+ * Redistributions of source code must retain the above copyright
1232+ notice, this list of conditions and the following disclaimer.
1233+
1234+ * Redistributions in binary form must reproduce the above
1235+ copyright notice, this list of conditions and the following
1236+ disclaimer in the documentation and/or other materials provided
1237+ with the distribution.
1238+
1239+ * Neither the name of Neil Mitchell nor the names of other
1240+ contributors may be used to endorse or promote products derived
1241+ from this software without specific prior written permission.
1242+
1243+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1244+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1245+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1246+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1247+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1248+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1249+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1250+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1251+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1252+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1253+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1254+
1255+conduit LICENSE file:
1256+
1257+ Copyright (c) 2012 Michael Snoyman, http://www.yesodweb.com/
1258+
1259+ Permission is hereby granted, free of charge, to any person obtaining
1260+ a copy of this software and associated documentation files (the
1261+ "Software"), to deal in the Software without restriction, including
1262+ without limitation the rights to use, copy, modify, merge, publish,
1263+ distribute, sublicense, and/or sell copies of the Software, and to
1264+ permit persons to whom the Software is furnished to do so, subject to
1265+ the following conditions:
1266+
1267+ The above copyright notice and this permission notice shall be
1268+ included in all copies or substantial portions of the Software.
1269+
1270+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
1271+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1272+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
1273+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
1274+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
1275+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
1276+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1277+
1278+conduit-extra LICENSE file:
1279+
1280+ Copyright (c) 2012 Michael Snoyman, http://www.yesodweb.com/
1281+
1282+ Permission is hereby granted, free of charge, to any person obtaining
1283+ a copy of this software and associated documentation files (the
1284+ "Software"), to deal in the Software without restriction, including
1285+ without limitation the rights to use, copy, modify, merge, publish,
1286+ distribute, sublicense, and/or sell copies of the Software, and to
1287+ permit persons to whom the Software is furnished to do so, subject to
1288+ the following conditions:
1289+
1290+ The above copyright notice and this permission notice shall be
1291+ included in all copies or substantial portions of the Software.
1292+
1293+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
1294+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1295+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
1296+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
1297+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
1298+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
1299+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1300+
1301+connection LICENSE file:
1302+
1303+ Copyright (c) 2012 Vincent Hanquez <vincent@snarc.org>
1304+
1305+ All rights reserved.
1306+
1307+ Redistribution and use in source and binary forms, with or without
1308+ modification, are permitted provided that the following conditions
1309+ are met:
1310+ 1. Redistributions of source code must retain the above copyright
1311+ notice, this list of conditions and the following disclaimer.
1312+ 2. Redistributions in binary form must reproduce the above copyright
1313+ notice, this list of conditions and the following disclaimer in the
1314+ documentation and/or other materials provided with the distribution.
1315+ 3. Neither the name of the author nor the names of his contributors
1316+ may be used to endorse or promote products derived from this software
1317+ without specific prior written permission.
1318+
1319+ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1320+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1321+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1322+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
1323+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1324+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1325+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1326+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1327+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1328+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1329+ SUCH DAMAGE.
1330+
1331+containers LICENSE file:
1332+
1333+ The Glasgow Haskell Compiler License
1334+
1335+ Copyright 2004, The University Court of the University of Glasgow.
1336+ All rights reserved.
1337+
1338+ Redistribution and use in source and binary forms, with or without
1339+ modification, are permitted provided that the following conditions are met:
1340+
1341+ - Redistributions of source code must retain the above copyright notice,
1342+ this list of conditions and the following disclaimer.
1343+
1344+ - Redistributions in binary form must reproduce the above copyright notice,
1345+ this list of conditions and the following disclaimer in the documentation
1346+ and/or other materials provided with the distribution.
1347+
1348+ - Neither name of the University nor the names of its contributors may be
1349+ used to endorse or promote products derived from this software without
1350+ specific prior written permission.
1351+
1352+ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
1353+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
1354+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
1355+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
1356+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
1357+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1358+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
1359+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
1360+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1361+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1362+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
1363+ DAMAGE.
1364+
1365+cookie LICENSE file:
1366+
1367+ Copyright (c) 2010 Michael Snoyman, http://www.yesodweb.com/
1368+
1369+ Permission is hereby granted, free of charge, to any person obtaining
1370+ a copy of this software and associated documentation files (the
1371+ "Software"), to deal in the Software without restriction, including
1372+ without limitation the rights to use, copy, modify, merge, publish,
1373+ distribute, sublicense, and/or sell copies of the Software, and to
1374+ permit persons to whom the Software is furnished to do so, subject to
1375+ the following conditions:
1376+
1377+ The above copyright notice and this permission notice shall be
1378+ included in all copies or substantial portions of the Software.
1379+
1380+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
1381+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1382+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
1383+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
1384+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
1385+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
1386+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1387+
1388+cryptonite LICENSE file:
1389+
1390+ Copyright (c) 2006-2015 Vincent Hanquez <vincent@snarc.org>
1391+
1392+ All rights reserved.
1393+
1394+ Redistribution and use in source and binary forms, with or without
1395+ modification, are permitted provided that the following conditions
1396+ are met:
1397+
1398+ 1. Redistributions of source code must retain the above copyright
1399+ notice, this list of conditions and the following disclaimer.
1400+ 2. Redistributions in binary form must reproduce the above copyright
1401+ notice, this list of conditions and the following disclaimer in the
1402+ documentation and/or other materials provided with the distribution.
1403+ 3. Neither the name of the author nor the names of his contributors
1404+ may be used to endorse or promote products derived from this software
1405+ without specific prior written permission.
1406+
1407+ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS AS IS'' AND
1408+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1409+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1410+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
1411+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1412+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1413+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1414+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1415+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1416+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1417+ SUCH DAMAGE.
1418+
1419+data-default-class LICENSE file:
1420+
1421+ Copyright (c) 2013 Lukas Mai
1422+
1423+ All rights reserved.
1424+
1425+ Redistribution and use in source and binary forms, with or without modification,
1426+ are permitted provided that the following conditions are met:
1427+
1428+ * Redistributions of source code must retain the above copyright notice, this
1429+ list of conditions and the following disclaimer.
1430+ * Redistributions in binary form must reproduce the above copyright notice,
1431+ this list of conditions and the following disclaimer in the documentation
1432+ and/or other materials provided with the distribution.
1433+ * Neither the name of the author nor the names of his contributors
1434+ may be used to endorse or promote products derived from this software
1435+ without specific prior written permission.
1436+
1437+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
1438+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
1439+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
1440+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
1441+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1442+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
1443+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
1444+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
1445+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1446+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1447+
1448+data-ordlist LICENSE file:
1449+
1450+ Copyright (c) 2009-2010, Melding Monads
1451+ All rights reserved.
1452+
1453+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1454+
1455+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
1456+ * 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.
1457+ * 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.
1458+
1459+ 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.
1460+
1461+deepseq LICENSE file:
1462+
1463+ This library (deepseq) is derived from code from the GHC project which
1464+ is largely (c) The University of Glasgow, and distributable under a
1465+ BSD-style license (see below).
1466+
1467+ -----------------------------------------------------------------------------
1468+
1469+ The Glasgow Haskell Compiler License
1470+
1471+ Copyright 2001-2009, The University Court of the University of Glasgow.
1472+ All rights reserved.
1473+
1474+ Redistribution and use in source and binary forms, with or without
1475+ modification, are permitted provided that the following conditions are met:
1476+
1477+ - Redistributions of source code must retain the above copyright notice,
1478+ this list of conditions and the following disclaimer.
1479+
1480+ - Redistributions in binary form must reproduce the above copyright notice,
1481+ this list of conditions and the following disclaimer in the documentation
1482+ and/or other materials provided with the distribution.
1483+
1484+ - Neither name of the University nor the names of its contributors may be
1485+ used to endorse or promote products derived from this software without
1486+ specific prior written permission.
1487+
1488+ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
1489+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
1490+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
1491+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
1492+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
1493+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1494+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
1495+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
1496+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1497+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1498+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
1499+ DAMAGE.
1500+
1501+ -----------------------------------------------------------------------------
1502+
1503+directory LICENSE file:
1504+
1505+ This library (libraries/base) is derived from code from two
1506+ sources:
1507+
1508+ * Code from the GHC project which is largely (c) The University of
1509+ Glasgow, and distributable under a BSD-style license (see below),
1510+
1511+ * Code from the Haskell 98 Report which is (c) Simon Peyton Jones
1512+ and freely redistributable (but see the full license for
1513+ restrictions).
1514+
1515+ The full text of these licenses is reproduced below. Both of the
1516+ licenses are BSD-style or compatible.
1517+
1518+ -----------------------------------------------------------------------------
1519+
1520+ The Glasgow Haskell Compiler License
1521+
1522+ Copyright 2004, The University Court of the University of Glasgow.
1523+ All rights reserved.
1524+
1525+ Redistribution and use in source and binary forms, with or without
1526+ modification, are permitted provided that the following conditions are met:
1527+
1528+ - Redistributions of source code must retain the above copyright notice,
1529+ this list of conditions and the following disclaimer.
1530+
1531+ - Redistributions in binary form must reproduce the above copyright notice,
1532+ this list of conditions and the following disclaimer in the documentation
1533+ and/or other materials provided with the distribution.
1534+
1535+ - Neither name of the University nor the names of its contributors may be
1536+ used to endorse or promote products derived from this software without
1537+ specific prior written permission.
1538+
1539+ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
1540+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
1541+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
1542+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
1543+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
1544+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1545+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
1546+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
1547+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1548+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1549+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
1550+ DAMAGE.
1551+
1552+ -----------------------------------------------------------------------------
1553+
1554+ Code derived from the document "Report on the Programming Language
1555+ Haskell 98", is distributed under the following license:
1556+
1557+ Copyright (c) 2002 Simon Peyton Jones
1558+
1559+ The authors intend this Report to belong to the entire Haskell
1560+ community, and so we grant permission to copy and distribute it for
1561+ any purpose, provided that it is reproduced in its entirety,
1562+ including this Notice. Modified versions of this Report may also be
1563+ copied and distributed for any purpose, provided that the modified
1564+ version is clearly presented as such, and that it does not claim to
1565+ be a definition of the Haskell 98 Language.
1566+
1567+ -----------------------------------------------------------------------------
1568+
1569+dlist LICENSE file:
1570+
1571+ Copyright (c) 2006-2009 Don Stewart, 2013-2016 Sean Leather
1572+
1573+ All rights reserved.
1574+
1575+ Redistribution and use in source and binary forms, with or without
1576+ modification, are permitted provided that the following conditions are
1577+ met:
1578+
1579+ * Redistributions of source code must retain the above copyright
1580+ notice, this list of conditions and the following disclaimer.
1581+
1582+ * Redistributions in binary form must reproduce the above
1583+ copyright notice, this list of conditions and the following
1584+ disclaimer in the documentation and/or other materials provided
1585+ with the distribution.
1586+
1587+ * Neither the name of Don Stewart nor the names of other
1588+ contributors may be used to endorse or promote products derived
1589+ from this software without specific prior written permission.
1590+
1591+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1592+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1593+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1594+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1595+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1596+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1597+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1598+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1599+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1600+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1601+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1602+
1603+easy-file LICENSE file:
1604+
1605+ Copyright (c) 2009, IIJ Innovation Institute Inc.
1606+ All rights reserved.
1607+
1608+ Redistribution and use in source and binary forms, with or without
1609+ modification, are permitted provided that the following conditions
1610+ are met:
1611+
1612+ * Redistributions of source code must retain the above copyright
1613+ notice, this list of conditions and the following disclaimer.
1614+ * Redistributions in binary form must reproduce the above copyright
1615+ notice, this list of conditions and the following disclaimer in
1616+ the documentation and/or other materials provided with the
1617+ distribution.
1618+ * Neither the name of the copyright holders nor the names of its
1619+ contributors may be used to endorse or promote products derived
1620+ from this software without specific prior written permission.
1621+
1622+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1623+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1624+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
1625+ FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
1626+ COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
1627+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
1628+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
1629+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
1630+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1631+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
1632+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
1633+ POSSIBILITY OF SUCH DAMAGE.
1634+
1635+edit-distance LICENSE file:
1636+
1637+ Copyright (c) 2008-2013 Maximilian Bolingbroke
1638+ All rights reserved.
1639+
1640+ Redistribution and use in source and binary forms, with or without modification, are permitted
1641+ provided that the following conditions are met:
1642+
1643+ * Redistributions of source code must retain the above copyright notice, this list of
1644+ conditions and the following disclaimer.
1645+ * Redistributions in binary form must reproduce the above copyright notice, this list of
1646+ conditions and the following disclaimer in the documentation and/or other materials
1647+ provided with the distribution.
1648+ * Neither the name of Maximilian Bolingbroke nor the names of other contributors may be used to
1649+ endorse or promote products derived from this software without specific prior written permission.
1650+
1651+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
1652+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
1653+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
1654+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1655+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1656+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
1657+ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
1658+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1659+
1660+entropy LICENSE file:
1661+
1662+ Copyright (c) Thomas DuBuisson
1663+
1664+ All rights reserved.
1665+
1666+ Redistribution and use in source and binary forms, with or without
1667+ modification, are permitted provided that the following conditions
1668+ are met:
1669+
1670+ 1. Redistributions of source code must retain the above copyright
1671+ notice, this list of conditions and the following disclaimer.
1672+
1673+ 2. Redistributions in binary form must reproduce the above copyright
1674+ notice, this list of conditions and the following disclaimer in the
1675+ documentation and/or other materials provided with the distribution.
1676+
1677+ 3. Neither the name of the author nor the names of his contributors
1678+ may be used to endorse or promote products derived from this software
1679+ without specific prior written permission.
1680+
1681+ THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
1682+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
1683+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
1684+ DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
1685+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1686+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1687+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1688+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
1689+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
1690+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
1691+ POSSIBILITY OF SUCH DAMAGE.
1692+
1693+exceptions LICENSE file:
1694+
1695+ Copyright 2013-2015 Edward Kmett
1696+ Copyright 2012 Google Inc.
1697+
1698+ All rights reserved.
1699+
1700+ Redistribution and use in source and binary forms, with or without
1701+ modification, are permitted provided that the following conditions
1702+ are met:
1703+
1704+ 1. Redistributions of source code must retain the above copyright
1705+ notice, this list of conditions and the following disclaimer.
1706+
1707+ 2. Redistributions in binary form must reproduce the above copyright
1708+ notice, this list of conditions and the following disclaimer in the
1709+ documentation and/or other materials provided with the distribution.
1710+
1711+ 3. Neither the name of the author nor the names of his contributors
1712+ may be used to endorse or promote products derived from this software
1713+ without specific prior written permission.
1714+
1715+ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
1716+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
1717+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
1718+ DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
1719+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1720+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1721+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1722+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
1723+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
1724+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
1725+ POSSIBILITY OF SUCH DAMAGE.
1726+
1727+fail LICENSE file:
1728+
1729+ Copyright (c) 2015, David Luposchainsky & Herbert Valerio Riedel
1730+
1731+ All rights reserved.
1732+
1733+ Redistribution and use in source and binary forms, with or without
1734+ modification, are permitted provided that the following conditions are met:
1735+
1736+ * Redistributions of source code must retain the above copyright
1737+ notice, this list of conditions and the following disclaimer.
1738+
1739+ * Redistributions in binary form must reproduce the above
1740+ copyright notice, this list of conditions and the following
1741+ disclaimer in the documentation and/or other materials provided
1742+ with the distribution.
1743+
1744+ * Neither the name of Herbert Valerio Riedel nor the names of other
1745+ contributors may be used to endorse or promote products derived
1746+ from this software without specific prior written permission.
1747+
1748+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1749+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1750+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1751+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1752+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1753+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1754+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1755+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1756+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1757+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1758+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1759+
1760+fast-logger LICENSE file:
1761+
1762+ Copyright (c) 2009, IIJ Innovation Institute Inc.
1763+ All rights reserved.
1764+
1765+ Redistribution and use in source and binary forms, with or without
1766+ modification, are permitted provided that the following conditions
1767+ are met:
1768+
1769+ * Redistributions of source code must retain the above copyright
1770+ notice, this list of conditions and the following disclaimer.
1771+ * Redistributions in binary form must reproduce the above copyright
1772+ notice, this list of conditions and the following disclaimer in
1773+ the documentation and/or other materials provided with the
1774+ distribution.
1775+ * Neither the name of the copyright holders nor the names of its
1776+ contributors may be used to endorse or promote products derived
1777+ from this software without specific prior written permission.
1778+
1779+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1780+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1781+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
1782+ FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
1783+ COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
1784+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
1785+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
1786+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
1787+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1788+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
1789+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
1790+ POSSIBILITY OF SUCH DAMAGE.
1791+
1792+file-embed LICENSE file:
1793+
1794+ The following license covers this documentation, and the source code, except
1795+ where otherwise indicated.
1796+
1797+ Copyright 2008, Michael Snoyman. All rights reserved.
1798+
1799+ Redistribution and use in source and binary forms, with or without
1800+ modification, are permitted provided that the following conditions are met:
1801+
1802+ * Redistributions of source code must retain the above copyright notice, this
1803+ list of conditions and the following disclaimer.
1804+
1805+ * Redistributions in binary form must reproduce the above copyright notice,
1806+ this list of conditions and the following disclaimer in the documentation
1807+ and/or other materials provided with the distribution.
1808+
1809+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY EXPRESS OR
1810+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
1811+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
1812+ EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,
1813+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
1814+ NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
1815+ OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
1816+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
1817+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
1818+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1819+
1820+filepath LICENSE file:
1821+
1822+ Copyright Neil Mitchell 2005-2015.
1823+ All rights reserved.
1824+
1825+ Redistribution and use in source and binary forms, with or without
1826+ modification, are permitted provided that the following conditions are
1827+ met:
1828+
1829+ * Redistributions of source code must retain the above copyright
1830+ notice, this list of conditions and the following disclaimer.
1831+
1832+ * Redistributions in binary form must reproduce the above
1833+ copyright notice, this list of conditions and the following
1834+ disclaimer in the documentation and/or other materials provided
1835+ with the distribution.
1836+
1837+ * Neither the name of Neil Mitchell nor the names of other
1838+ contributors may be used to endorse or promote products derived
1839+ from this software without specific prior written permission.
1840+
1841+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1842+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1843+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1844+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1845+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1846+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1847+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1848+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1849+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1850+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1851+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1852+
1853+fsnotify LICENSE file:
1854+
1855+ Copyright (c) 2012, Mark Dittmer
1856+
1857+ All rights reserved.
1858+
1859+ Redistribution and use in source and binary forms, with or without
1860+ modification, are permitted provided that the following conditions are met:
1861+
1862+ * Redistributions of source code must retain the above copyright
1863+ notice, this list of conditions and the following disclaimer.
1864+
1865+ * Redistributions in binary form must reproduce the above
1866+ copyright notice, this list of conditions and the following
1867+ disclaimer in the documentation and/or other materials provided
1868+ with the distribution.
1869+
1870+ * Neither the name of Mark Dittmer nor the names of other
1871+ contributors may be used to endorse or promote products derived
1872+ from this software without specific prior written permission.
1873+
1874+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1875+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1876+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1877+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1878+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1879+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1880+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1881+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1882+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1883+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1884+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1885+
1886+ghc-prim LICENSE file:
1887+
1888+ This library (libraries/ghc-prim) is derived from code from several
1889+ sources:
1890+
1891+ * Code from the GHC project which is largely (c) The University of
1892+ Glasgow, and distributable under a BSD-style license (see below),
1893+
1894+ * Code from the Haskell 98 Report which is (c) Simon Peyton Jones
1895+ and freely redistributable (but see the full license for
1896+ restrictions).
1897+
1898+ The full text of these licenses is reproduced below. All of the
1899+ licenses are BSD-style or compatible.
1900+
1901+ -----------------------------------------------------------------------------
1902+
1903+ The Glasgow Haskell Compiler License
1904+
1905+ Copyright 2004, The University Court of the University of Glasgow.
1906+ All rights reserved.
1907+
1908+ Redistribution and use in source and binary forms, with or without
1909+ modification, are permitted provided that the following conditions are met:
1910+
1911+ - Redistributions of source code must retain the above copyright notice,
1912+ this list of conditions and the following disclaimer.
1913+
1914+ - Redistributions in binary form must reproduce the above copyright notice,
1915+ this list of conditions and the following disclaimer in the documentation
1916+ and/or other materials provided with the distribution.
1917+
1918+ - Neither name of the University nor the names of its contributors may be
1919+ used to endorse or promote products derived from this software without
1920+ specific prior written permission.
1921+
1922+ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
1923+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
1924+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
1925+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
1926+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
1927+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1928+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
1929+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
1930+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1931+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1932+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
1933+ DAMAGE.
1934+
1935+ -----------------------------------------------------------------------------
1936+
1937+ Code derived from the document "Report on the Programming Language
1938+ Haskell 98", is distributed under the following license:
1939+
1940+ Copyright (c) 2002 Simon Peyton Jones
1941+
1942+ The authors intend this Report to belong to the entire Haskell
1943+ community, and so we grant permission to copy and distribute it for
1944+ any purpose, provided that it is reproduced in its entirety,
1945+ including this Notice. Modified versions of this Report may also be
1946+ copied and distributed for any purpose, provided that the modified
1947+ version is clearly presented as such, and that it does not claim to
1948+ be a definition of the Haskell 98 Language.
1949+
1950+
1951+hashable LICENSE file:
1952+
1953+ Copyright Milan Straka 2010
1954+
1955+ All rights reserved.
1956+
1957+ Redistribution and use in source and binary forms, with or without
1958+ modification, are permitted provided that the following conditions are met:
1959+
1960+ * Redistributions of source code must retain the above copyright
1961+ notice, this list of conditions and the following disclaimer.
1962+
1963+ * Redistributions in binary form must reproduce the above
1964+ copyright notice, this list of conditions and the following
1965+ disclaimer in the documentation and/or other materials provided
1966+ with the distribution.
1967+
1968+ * Neither the name of Milan Straka nor the names of other
1969+ contributors may be used to endorse or promote products derived
1970+ from this software without specific prior written permission.
1971+
1972+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1973+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1974+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1975+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1976+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1977+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1978+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1979+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1980+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1981+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1982+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1983+
1984+haskeline LICENSE file:
1985+
1986+ Copyright 2007-2009, Judah Jacobson.
1987+ All Rights Reserved.
1988+
1989+ Redistribution and use in source and binary forms, with or without
1990+ modification, are permitted provided that the following conditions are met:
1991+
1992+ - Redistribution of source code must retain the above copyright notice,
1993+ this list of conditions and the following disclaimer.
1994+
1995+ - Redistribution in binary form must reproduce the above copyright notice,
1996+ this list of conditions and the following disclaimer in the documentation
1997+ and/or other materials provided with the distribution.
1998+
1999+ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY
2000+ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
2001+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
2002+ DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE CONTRIBUTORS BE LIABLE
2003+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2004+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
2005+ SERVICES; LOSS OF USE, DATA OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
2006+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
2007+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
2008+ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2009+
2010+hex LICENSE file:
2011+
2012+ Page not found: Sorry, it's just not here.
2013+
2014+hfsevents LICENSE file:
2015+
2016+ Copyright (c) 2012, Luite Stegeman
2017+
2018+ All rights reserved.
2019+
2020+ Redistribution and use in source and binary forms, with or without
2021+ modification, are permitted provided that the following conditions are met:
2022+
2023+ * Redistributions of source code must retain the above copyright
2024+ notice, this list of conditions and the following disclaimer.
2025+
2026+ * Redistributions in binary form must reproduce the above
2027+ copyright notice, this list of conditions and the following
2028+ disclaimer in the documentation and/or other materials provided
2029+ with the distribution.
2030+
2031+ * Neither the name of Luite Stegeman nor the names of other
2032+ contributors may be used to endorse or promote products derived
2033+ from this software without specific prior written permission.
2034+
2035+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2036+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2037+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2038+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2039+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2040+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2041+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2042+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2043+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2044+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2045+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2046+
2047+hourglass LICENSE file:
2048+
2049+ Copyright (c) 2014 Vincent Hanquez <vincent@snarc.org>
2050+
2051+ All rights reserved.
2052+
2053+ Redistribution and use in source and binary forms, with or without
2054+ modification, are permitted provided that the following conditions
2055+ are met:
2056+ 1. Redistributions of source code must retain the above copyright
2057+ notice, this list of conditions and the following disclaimer.
2058+ 2. Redistributions in binary form must reproduce the above copyright
2059+ notice, this list of conditions and the following disclaimer in the
2060+ documentation and/or other materials provided with the distribution.
2061+ 3. Neither the name of the author nor the names of his contributors
2062+ may be used to endorse or promote products derived from this software
2063+ without specific prior written permission.
2064+
2065+ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS AS IS'' AND
2066+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2067+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2068+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
2069+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2070+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2071+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2072+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2073+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2074+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2075+ SUCH DAMAGE.
2076+
2077+http-client LICENSE file:
2078+
2079+ The MIT License (MIT)
2080+
2081+ Copyright (c) 2013 Michael Snoyman
2082+
2083+ Permission is hereby granted, free of charge, to any person obtaining a copy of
2084+ this software and associated documentation files (the "Software"), to deal in
2085+ the Software without restriction, including without limitation the rights to
2086+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
2087+ the Software, and to permit persons to whom the Software is furnished to do so,
2088+ subject to the following conditions:
2089+
2090+ The above copyright notice and this permission notice shall be included in all
2091+ copies or substantial portions of the Software.
2092+
2093+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2094+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
2095+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
2096+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
2097+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
2098+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2099+
2100+http-client-tls LICENSE file:
2101+
2102+ The MIT License (MIT)
2103+
2104+ Copyright (c) 2013 Michael Snoyman
2105+
2106+ Permission is hereby granted, free of charge, to any person obtaining a copy of
2107+ this software and associated documentation files (the "Software"), to deal in
2108+ the Software without restriction, including without limitation the rights to
2109+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
2110+ the Software, and to permit persons to whom the Software is furnished to do so,
2111+ subject to the following conditions:
2112+
2113+ The above copyright notice and this permission notice shall be included in all
2114+ copies or substantial portions of the Software.
2115+
2116+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2117+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
2118+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
2119+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
2120+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
2121+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2122+
2123+http-date LICENSE file:
2124+
2125+ Copyright (c) 2009, IIJ Innovation Institute Inc.
2126+ All rights reserved.
2127+
2128+ Redistribution and use in source and binary forms, with or without
2129+ modification, are permitted provided that the following conditions
2130+ are met:
2131+
2132+ * Redistributions of source code must retain the above copyright
2133+ notice, this list of conditions and the following disclaimer.
2134+ * Redistributions in binary form must reproduce the above copyright
2135+ notice, this list of conditions and the following disclaimer in
2136+ the documentation and/or other materials provided with the
2137+ distribution.
2138+ * Neither the name of the copyright holders nor the names of its
2139+ contributors may be used to endorse or promote products derived
2140+ from this software without specific prior written permission.
2141+
2142+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2143+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2144+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
2145+ FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
2146+ COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
2147+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
2148+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
2149+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
2150+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2151+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
2152+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2153+ POSSIBILITY OF SUCH DAMAGE.
2154+
2155+http-types LICENSE file:
2156+
2157+ Copyright (c) 2011, Aristid Breitkreuz
2158+ Copyright (c) 2011, Michael Snoyman
2159+
2160+ All rights reserved.
2161+
2162+ Redistribution and use in source and binary forms, with or without
2163+ modification, are permitted provided that the following conditions are met:
2164+
2165+ * Redistributions of source code must retain the above copyright
2166+ notice, this list of conditions and the following disclaimer.
2167+
2168+ * Redistributions in binary form must reproduce the above
2169+ copyright notice, this list of conditions and the following
2170+ disclaimer in the documentation and/or other materials provided
2171+ with the distribution.
2172+
2173+ * Neither the name of Aristid Breitkreuz nor the names of other
2174+ contributors may be used to endorse or promote products derived
2175+ from this software without specific prior written permission.
2176+
2177+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2178+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2179+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2180+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2181+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2182+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2183+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2184+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2185+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2186+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2187+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2188+
2189+http2 LICENSE file:
2190+
2191+ Copyright (c) 2013, IIJ Innovation Institute Inc.
2192+ All rights reserved.
2193+
2194+ Redistribution and use in source and binary forms, with or without
2195+ modification, are permitted provided that the following conditions
2196+ are met:
2197+
2198+ * Redistributions of source code must retain the above copyright
2199+ notice, this list of conditions and the following disclaimer.
2200+ * Redistributions in binary form must reproduce the above copyright
2201+ notice, this list of conditions and the following disclaimer in
2202+ the documentation and/or other materials provided with the
2203+ distribution.
2204+ * Neither the name of the copyright holders nor the names of its
2205+ contributors may be used to endorse or promote products derived
2206+ from this software without specific prior written permission.
2207+
2208+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2209+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2210+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
2211+ FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
2212+ COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
2213+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
2214+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
2215+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
2216+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2217+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
2218+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2219+ POSSIBILITY OF SUCH DAMAGE.
2220+
2221+integer-gmp LICENSE file:
2222+
2223+ Copyright (c) 2014, Herbert Valerio Riedel
2224+
2225+ All rights reserved.
2226+
2227+ Redistribution and use in source and binary forms, with or without
2228+ modification, are permitted provided that the following conditions are met:
2229+
2230+ * Redistributions of source code must retain the above copyright
2231+ notice, this list of conditions and the following disclaimer.
2232+
2233+ * Redistributions in binary form must reproduce the above
2234+ copyright notice, this list of conditions and the following
2235+ disclaimer in the documentation and/or other materials provided
2236+ with the distribution.
2237+
2238+ * Neither the name of Herbert Valerio Riedel nor the names of other
2239+ contributors may be used to endorse or promote products derived
2240+ from this software without specific prior written permission.
2241+
2242+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2243+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2244+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2245+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2246+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2247+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2248+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2249+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2250+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2251+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2252+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2253+
2254+iproute LICENSE file:
2255+
2256+ Copyright (c) 2009, IIJ Innovation Institute Inc.
2257+ All rights reserved.
2258+
2259+ Redistribution and use in source and binary forms, with or without
2260+ modification, are permitted provided that the following conditions
2261+ are met:
2262+
2263+ * Redistributions of source code must retain the above copyright
2264+ notice, this list of conditions and the following disclaimer.
2265+ * Redistributions in binary form must reproduce the above copyright
2266+ notice, this list of conditions and the following disclaimer in
2267+ the documentation and/or other materials provided with the
2268+ distribution.
2269+ * Neither the name of the copyright holders nor the names of its
2270+ contributors may be used to endorse or promote products derived
2271+ from this software without specific prior written permission.
2272+
2273+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2274+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2275+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
2276+ FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
2277+ COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
2278+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
2279+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
2280+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
2281+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2282+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
2283+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2284+ POSSIBILITY OF SUCH DAMAGE.
2285+
2286+language-javascript LICENSE file:
2287+
2288+ Copyright (c)2010, Alan Zimmerman
2289+
2290+ All rights reserved.
2291+
2292+ Redistribution and use in source and binary forms, with or without
2293+ modification, are permitted provided that the following conditions are met:
2294+
2295+ * Redistributions of source code must retain the above copyright
2296+ notice, this list of conditions and the following disclaimer.
2297+
2298+ * Redistributions in binary form must reproduce the above
2299+ copyright notice, this list of conditions and the following
2300+ disclaimer in the documentation and/or other materials provided
2301+ with the distribution.
2302+
2303+ * Neither the name of Alan Zimmerman nor the names of other
2304+ contributors may be used to endorse or promote products derived
2305+ from this software without specific prior written permission.
2306+
2307+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2308+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2309+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2310+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2311+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2312+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2313+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2314+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2315+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2316+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2317+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2318+
2319+lifted-base LICENSE file:
2320+
2321+ Copyright © 2010-2012, Bas van Dijk, Anders Kaseorg
2322+ All rights reserved.
2323+
2324+ Redistribution and use in source and binary forms, with or without
2325+ modification, are permitted provided that the following conditions are
2326+ met:
2327+
2328+ • Redistributions of source code must retain the above copyright
2329+ notice, this list of conditions and the following disclaimer.
2330+
2331+ • Redistributions in binary form must reproduce the above copyright
2332+ notice, this list of conditions and the following disclaimer in the
2333+ documentation and/or other materials provided with the distribution.
2334+
2335+ • Neither the name of the author nor the names of other contributors
2336+ may be used to endorse or promote products derived from this
2337+ software without specific prior written permission.
2338+
2339+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2340+ “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2341+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2342+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2343+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2344+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2345+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2346+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2347+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2348+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2349+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2350+
2351+memory LICENSE file:
2352+
2353+ Copyright (c) 2015 Vincent Hanquez <vincent@snarc.org>
2354+
2355+ All rights reserved.
2356+
2357+ Redistribution and use in source and binary forms, with or without
2358+ modification, are permitted provided that the following conditions
2359+ are met:
2360+
2361+ 1. Redistributions of source code must retain the above copyright
2362+ notice, this list of conditions and the following disclaimer.
2363+ 2. Redistributions in binary form must reproduce the above copyright
2364+ notice, this list of conditions and the following disclaimer in the
2365+ documentation and/or other materials provided with the distribution.
2366+ 3. Neither the name of the author nor the names of his contributors
2367+ may be used to endorse or promote products derived from this software
2368+ without specific prior written permission.
2369+
2370+ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS AS IS'' AND
2371+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2372+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2373+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
2374+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2375+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2376+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2377+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2378+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2379+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2380+ SUCH DAMAGE.
2381+
2382+mime-types LICENSE file:
2383+
2384+ Copyright (c) 2012 Michael Snoyman, http://www.yesodweb.com/
2385+
2386+ Permission is hereby granted, free of charge, to any person obtaining
2387+ a copy of this software and associated documentation files (the
2388+ "Software"), to deal in the Software without restriction, including
2389+ without limitation the rights to use, copy, modify, merge, publish,
2390+ distribute, sublicense, and/or sell copies of the Software, and to
2391+ permit persons to whom the Software is furnished to do so, subject to
2392+ the following conditions:
2393+
2394+ The above copyright notice and this permission notice shall be
2395+ included in all copies or substantial portions of the Software.
2396+
2397+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
2398+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2399+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
2400+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
2401+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
2402+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
2403+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2404+
2405+mmorph LICENSE file:
2406+
2407+ Copyright (c) 2013, Gabriel Gonzalez
2408+ All rights reserved.
2409+
2410+ Redistribution and use in source and binary forms, with or without modification,
2411+ are permitted provided that the following conditions are met:
2412+
2413+ * Redistributions of source code must retain the above copyright notice, this
2414+ list of conditions and the following disclaimer.
2415+ * Redistributions in binary form must reproduce the above copyright notice, this
2416+ list of conditions and the following disclaimer in the documentation and/or
2417+ other materials provided with the distribution.
2418+ * Neither the name of Gabriel Gonzalez nor the names of other contributors may
2419+ be used to endorse or promote products derived from this software without
2420+ specific prior written permission.
2421+
2422+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
2423+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
2424+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
2425+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
2426+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
2427+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
2428+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
2429+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2430+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
2431+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2432+
2433+monad-control LICENSE file:
2434+
2435+ Copyright © 2010, Bas van Dijk, Anders Kaseorg
2436+ All rights reserved.
2437+
2438+ Redistribution and use in source and binary forms, with or without
2439+ modification, are permitted provided that the following conditions are
2440+ met:
2441+
2442+ • Redistributions of source code must retain the above copyright
2443+ notice, this list of conditions and the following disclaimer.
2444+
2445+ • Redistributions in binary form must reproduce the above copyright
2446+ notice, this list of conditions and the following disclaimer in the
2447+ documentation and/or other materials provided with the distribution.
2448+
2449+ • Neither the name of the author nor the names of other contributors
2450+ may be used to endorse or promote products derived from this
2451+ software without specific prior written permission.
2452+
2453+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2454+ “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2455+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2456+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2457+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2458+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2459+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2460+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2461+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2462+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2463+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2464+
2465+monad-logger LICENSE file:
2466+
2467+ Copyright (c) 2012 Michael Snoyman, http://www.yesodweb.com/
2468+
2469+ Permission is hereby granted, free of charge, to any person obtaining
2470+ a copy of this software and associated documentation files (the
2471+ "Software"), to deal in the Software without restriction, including
2472+ without limitation the rights to use, copy, modify, merge, publish,
2473+ distribute, sublicense, and/or sell copies of the Software, and to
2474+ permit persons to whom the Software is furnished to do so, subject to
2475+ the following conditions:
2476+
2477+ The above copyright notice and this permission notice shall be
2478+ included in all copies or substantial portions of the Software.
2479+
2480+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
2481+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2482+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
2483+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
2484+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
2485+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
2486+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2487+
2488+monad-loops LICENSE file:
2489+
2490+ Page not found: Sorry, it's just not here.
2491+
2492+mtl LICENSE file:
2493+
2494+ The Glasgow Haskell Compiler License
2495+
2496+ Copyright 2004, The University Court of the University of Glasgow.
2497+ All rights reserved.
2498+
2499+ Redistribution and use in source and binary forms, with or without
2500+ modification, are permitted provided that the following conditions are met:
2501+
2502+ - Redistributions of source code must retain the above copyright notice,
2503+ this list of conditions and the following disclaimer.
2504+
2505+ - Redistributions in binary form must reproduce the above copyright notice,
2506+ this list of conditions and the following disclaimer in the documentation
2507+ and/or other materials provided with the distribution.
2508+
2509+ - Neither name of the University nor the names of its contributors may be
2510+ used to endorse or promote products derived from this software without
2511+ specific prior written permission.
2512+
2513+ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
2514+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
2515+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
2516+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
2517+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
2518+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2519+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
2520+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
2521+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2522+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2523+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
2524+ DAMAGE.
2525+
2526+network LICENSE file:
2527+
2528+ Copyright (c) 2002-2010, The University Court of the University of Glasgow.
2529+ Copyright (c) 2007-2010, Johan Tibell
2530+
2531+ Redistribution and use in source and binary forms, with or without
2532+ modification, are permitted provided that the following conditions are met:
2533+
2534+ - Redistributions of source code must retain the above copyright notice,
2535+ this list of conditions and the following disclaimer.
2536+
2537+ - Redistributions in binary form must reproduce the above copyright notice,
2538+ this list of conditions and the following disclaimer in the documentation
2539+ and/or other materials provided with the distribution.
2540+
2541+ - Neither name of the University nor the names of its contributors may be
2542+ used to endorse or promote products derived from this software without
2543+ specific prior written permission.
2544+
2545+ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
2546+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
2547+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
2548+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
2549+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
2550+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2551+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
2552+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
2553+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2554+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2555+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
2556+ DAMAGE.
2557+
2558+network-uri LICENSE file:
2559+
2560+ Copyright (c) 2002-2010, The University Court of the University of Glasgow.
2561+ Copyright (c) 2007-2010, Johan Tibell
2562+
2563+ Redistribution and use in source and binary forms, with or without
2564+ modification, are permitted provided that the following conditions are met:
2565+
2566+ - Redistributions of source code must retain the above copyright notice,
2567+ this list of conditions and the following disclaimer.
2568+
2569+ - Redistributions in binary form must reproduce the above copyright notice,
2570+ this list of conditions and the following disclaimer in the documentation
2571+ and/or other materials provided with the distribution.
2572+
2573+ - Neither name of the University nor the names of its contributors may be
2574+ used to endorse or promote products derived from this software without
2575+ specific prior written permission.
2576+
2577+ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
2578+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
2579+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
2580+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
2581+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
2582+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2583+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
2584+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
2585+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2586+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2587+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
2588+ DAMAGE.
2589+
2590+old-locale LICENSE file:
2591+
2592+ This library (libraries/base) is derived from code from two
2593+ sources:
2594+
2595+ * Code from the GHC project which is largely (c) The University of
2596+ Glasgow, and distributable under a BSD-style license (see below),
2597+
2598+ * Code from the Haskell 98 Report which is (c) Simon Peyton Jones
2599+ and freely redistributable (but see the full license for
2600+ restrictions).
2601+
2602+ The full text of these licenses is reproduced below. Both of the
2603+ licenses are BSD-style or compatible.
2604+
2605+ -----------------------------------------------------------------------------
2606+
2607+ The Glasgow Haskell Compiler License
2608+
2609+ Copyright 2004, The University Court of the University of Glasgow.
2610+ All rights reserved.
2611+
2612+ Redistribution and use in source and binary forms, with or without
2613+ modification, are permitted provided that the following conditions are met:
2614+
2615+ - Redistributions of source code must retain the above copyright notice,
2616+ this list of conditions and the following disclaimer.
2617+
2618+ - Redistributions in binary form must reproduce the above copyright notice,
2619+ this list of conditions and the following disclaimer in the documentation
2620+ and/or other materials provided with the distribution.
2621+
2622+ - Neither name of the University nor the names of its contributors may be
2623+ used to endorse or promote products derived from this software without
2624+ specific prior written permission.
2625+
2626+ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
2627+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
2628+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
2629+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
2630+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
2631+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2632+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
2633+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
2634+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2635+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2636+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
2637+ DAMAGE.
2638+
2639+ -----------------------------------------------------------------------------
2640+
2641+ Code derived from the document "Report on the Programming Language
2642+ Haskell 98", is distributed under the following license:
2643+
2644+ Copyright (c) 2002 Simon Peyton Jones
2645+
2646+ The authors intend this Report to belong to the entire Haskell
2647+ community, and so we grant permission to copy and distribute it for
2648+ any purpose, provided that it is reproduced in its entirety,
2649+ including this Notice. Modified versions of this Report may also be
2650+ copied and distributed for any purpose, provided that the modified
2651+ version is clearly presented as such, and that it does not claim to
2652+ be a definition of the Haskell 98 Language.
2653+
2654+ -----------------------------------------------------------------------------
2655+
2656+old-time LICENSE file:
2657+
2658+ This library (libraries/base) is derived from code from two
2659+ sources:
2660+
2661+ * Code from the GHC project which is largely (c) The University of
2662+ Glasgow, and distributable under a BSD-style license (see below),
2663+
2664+ * Code from the Haskell 98 Report which is (c) Simon Peyton Jones
2665+ and freely redistributable (but see the full license for
2666+ restrictions).
2667+
2668+ The full text of these licenses is reproduced below. Both of the
2669+ licenses are BSD-style or compatible.
2670+
2671+ -----------------------------------------------------------------------------
2672+
2673+ The Glasgow Haskell Compiler License
2674+
2675+ Copyright 2004, The University Court of the University of Glasgow.
2676+ All rights reserved.
2677+
2678+ Redistribution and use in source and binary forms, with or without
2679+ modification, are permitted provided that the following conditions are met:
2680+
2681+ - Redistributions of source code must retain the above copyright notice,
2682+ this list of conditions and the following disclaimer.
2683+
2684+ - Redistributions in binary form must reproduce the above copyright notice,
2685+ this list of conditions and the following disclaimer in the documentation
2686+ and/or other materials provided with the distribution.
2687+
2688+ - Neither name of the University nor the names of its contributors may be
2689+ used to endorse or promote products derived from this software without
2690+ specific prior written permission.
2691+
2692+ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
2693+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
2694+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
2695+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
2696+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
2697+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2698+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
2699+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
2700+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2701+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2702+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
2703+ DAMAGE.
2704+
2705+ -----------------------------------------------------------------------------
2706+
2707+ Code derived from the document "Report on the Programming Language
2708+ Haskell 98", is distributed under the following license:
2709+
2710+ Copyright (c) 2002 Simon Peyton Jones
2711+
2712+ The authors intend this Report to belong to the entire Haskell
2713+ community, and so we grant permission to copy and distribute it for
2714+ any purpose, provided that it is reproduced in its entirety,
2715+ including this Notice. Modified versions of this Report may also be
2716+ copied and distributed for any purpose, provided that the modified
2717+ version is clearly presented as such, and that it does not claim to
2718+ be a definition of the Haskell 98 Language.
2719+
2720+ -----------------------------------------------------------------------------
2721+
2722+optparse-applicative LICENSE file:
2723+
2724+ Copyright (c) 2012, Paolo Capriotti
2725+
2726+ All rights reserved.
2727+
2728+ Redistribution and use in source and binary forms, with or without
2729+ modification, are permitted provided that the following conditions are met:
2730+
2731+ * Redistributions of source code must retain the above copyright
2732+ notice, this list of conditions and the following disclaimer.
2733+
2734+ * Redistributions in binary form must reproduce the above
2735+ copyright notice, this list of conditions and the following
2736+ disclaimer in the documentation and/or other materials provided
2737+ with the distribution.
2738+
2739+ * Neither the name of Paolo Capriotti nor the names of other
2740+ contributors may be used to endorse or promote products derived
2741+ from this software without specific prior written permission.
2742+
2743+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2744+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2745+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2746+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2747+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2748+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2749+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2750+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2751+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2752+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2753+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2754+
2755+parallel LICENSE file:
2756+
2757+ This library (libraries/parallel) is derived from code from
2758+ the GHC project which is largely (c) The University of
2759+ Glasgow, and distributable under a BSD-style license (see below).
2760+
2761+ -----------------------------------------------------------------------------
2762+
2763+ The Glasgow Haskell Compiler License
2764+
2765+ Copyright 2004, The University Court of the University of Glasgow.
2766+ All rights reserved.
2767+
2768+ Redistribution and use in source and binary forms, with or without
2769+ modification, are permitted provided that the following conditions are met:
2770+
2771+ - Redistributions of source code must retain the above copyright notice,
2772+ this list of conditions and the following disclaimer.
2773+
2774+ - Redistributions in binary form must reproduce the above copyright notice,
2775+ this list of conditions and the following disclaimer in the documentation
2776+ and/or other materials provided with the distribution.
2777+
2778+ - Neither name of the University nor the names of its contributors may be
2779+ used to endorse or promote products derived from this software without
2780+ specific prior written permission.
2781+
2782+ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
2783+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
2784+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
2785+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
2786+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
2787+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2788+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
2789+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
2790+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2791+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2792+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
2793+ DAMAGE.
2794+
2795+ -----------------------------------------------------------------------------
2796+
2797+parsec LICENSE file:
2798+
2799+ Copyright 1999-2000, Daan Leijen; 2007, Paolo Martini. All rights reserved.
2800+
2801+ Redistribution and use in source and binary forms, with or without
2802+ modification, are permitted provided that the following conditions are met:
2803+
2804+ * Redistributions of source code must retain the above copyright notice,
2805+ this list of conditions and the following disclaimer.
2806+ * Redistributions in binary form must reproduce the above copyright
2807+ notice, this list of conditions and the following disclaimer in the
2808+ documentation and/or other materials provided with the distribution.
2809+
2810+ This software is provided by the copyright holders "as is" and any express or
2811+ implied warranties, including, but not limited to, the implied warranties of
2812+ merchantability and fitness for a particular purpose are disclaimed. In no
2813+ event shall the copyright holders be liable for any direct, indirect,
2814+ incidental, special, exemplary, or consequential damages (including, but not
2815+ limited to, procurement of substitute goods or services; loss of use, data,
2816+ or profits; or business interruption) however caused and on any theory of
2817+ liability, whether in contract, strict liability, or tort (including
2818+ negligence or otherwise) arising in any way out of the use of this software,
2819+ even if advised of the possibility of such damage.
2820+
2821+pattern-arrows LICENSE file:
2822+
2823+ The MIT License (MIT)
2824+
2825+ Copyright (c) 2013 Phil Freeman
2826+
2827+ Permission is hereby granted, free of charge, to any person obtaining a copy of
2828+ this software and associated documentation files (the "Software"), to deal in
2829+ the Software without restriction, including without limitation the rights to
2830+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
2831+ the Software, and to permit persons to whom the Software is furnished to do so,
2832+ subject to the following conditions:
2833+
2834+ The above copyright notice and this permission notice shall be included in all
2835+ copies or substantial portions of the Software.
2836+
2837+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2838+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
2839+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
2840+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
2841+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
2842+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2843+
2844+pem LICENSE file:
2845+
2846+ Copyright (c) 2010-2012 Vincent Hanquez <vincent@snarc.org>
2847+
2848+ All rights reserved.
2849+
2850+ Redistribution and use in source and binary forms, with or without
2851+ modification, are permitted provided that the following conditions
2852+ are met:
2853+ 1. Redistributions of source code must retain the above copyright
2854+ notice, this list of conditions and the following disclaimer.
2855+ 2. Redistributions in binary form must reproduce the above copyright
2856+ notice, this list of conditions and the following disclaimer in the
2857+ documentation and/or other materials provided with the distribution.
2858+ 3. Neither the name of the author nor the names of his contributors
2859+ may be used to endorse or promote products derived from this software
2860+ without specific prior written permission.
2861+
2862+ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2863+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2864+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2865+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
2866+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2867+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2868+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2869+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2870+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2871+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2872+ SUCH DAMAGE.
2873+
2874+pipes LICENSE file:
2875+
2876+ Copyright (c) 2012-2016 Gabriel Gonzalez
2877+ All rights reserved.
2878+
2879+ Redistribution and use in source and binary forms, with or without modification,
2880+ are permitted provided that the following conditions are met:
2881+ * Redistributions of source code must retain the above copyright notice,
2882+ this list of conditions and the following disclaimer.
2883+ * Redistributions in binary form must reproduce the above copyright notice,
2884+ this list of conditions and the following disclaimer in the documentation
2885+ and/or other materials provided with the distribution.
2886+ * Neither the name of Gabriel Gonzalez nor the names of other contributors
2887+ may be used to endorse or promote products derived from this software
2888+ without specific prior written permission.
2889+
2890+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
2891+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
2892+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
2893+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
2894+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
2895+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
2896+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
2897+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2898+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
2899+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2900+
2901+pipes-http LICENSE file:
2902+
2903+ Copyright (c) 2014 Gabriel Gonzalez
2904+ All rights reserved.
2905+
2906+ Redistribution and use in source and binary forms, with or without modification,
2907+ are permitted provided that the following conditions are met:
2908+ * Redistributions of source code must retain the above copyright notice,
2909+ this list of conditions and the following disclaimer.
2910+ * Redistributions in binary form must reproduce the above copyright notice,
2911+ this list of conditions and the following disclaimer in the documentation
2912+ and/or other materials provided with the distribution.
2913+ * Neither the name of Gabriel Gonzalez nor the names of other contributors
2914+ may be used to endorse or promote products derived from this software
2915+ without specific prior written permission.
2916+
2917+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
2918+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
2919+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
2920+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
2921+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
2922+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
2923+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
2924+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2925+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
2926+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2927+
2928+primitive LICENSE file:
2929+
2930+ Copyright (c) 2008-2009, Roman Leshchinskiy
2931+ All rights reserved.
2932+
2933+ Redistribution and use in source and binary forms, with or without
2934+ modification, are permitted provided that the following conditions are met:
2935+
2936+ - Redistributions of source code must retain the above copyright notice,
2937+ this list of conditions and the following disclaimer.
2938+
2939+ - Redistributions in binary form must reproduce the above copyright notice,
2940+ this list of conditions and the following disclaimer in the documentation
2941+ and/or other materials provided with the distribution.
2942+
2943+ - Neither name of the University nor the names of its contributors may be
2944+ used to endorse or promote products derived from this software without
2945+ specific prior written permission.
2946+
2947+ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
2948+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
2949+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
2950+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
2951+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
2952+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2953+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
2954+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
2955+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2956+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2957+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
2958+ DAMAGE.
2959+
2960+
2961+process LICENSE file:
2962+
2963+ This library (libraries/process) is derived from code from two
2964+ sources:
2965+
2966+ * Code from the GHC project which is largely (c) The University of
2967+ Glasgow, and distributable under a BSD-style license (see below),
2968+
2969+ * Code from the Haskell 98 Report which is (c) Simon Peyton Jones
2970+ and freely redistributable (but see the full license for
2971+ restrictions).
2972+
2973+ The full text of these licenses is reproduced below. Both of the
2974+ licenses are BSD-style or compatible.
2975+
2976+ -----------------------------------------------------------------------------
2977+
2978+ The Glasgow Haskell Compiler License
2979+
2980+ Copyright 2004, The University Court of the University of Glasgow.
2981+ All rights reserved.
2982+
2983+ Redistribution and use in source and binary forms, with or without
2984+ modification, are permitted provided that the following conditions are met:
2985+
2986+ - Redistributions of source code must retain the above copyright notice,
2987+ this list of conditions and the following disclaimer.
2988+
2989+ - Redistributions in binary form must reproduce the above copyright notice,
2990+ this list of conditions and the following disclaimer in the documentation
2991+ and/or other materials provided with the distribution.
2992+
2993+ - Neither name of the University nor the names of its contributors may be
2994+ used to endorse or promote products derived from this software without
2995+ specific prior written permission.
2996+
2997+ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
2998+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
2999+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
3000+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
3001+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
3002+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3003+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
3004+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
3005+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3006+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3007+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
3008+ DAMAGE.
3009+
3010+ -----------------------------------------------------------------------------
3011+
3012+ Code derived from the document "Report on the Programming Language
3013+ Haskell 98", is distributed under the following license:
3014+
3015+ Copyright (c) 2002 Simon Peyton Jones
3016+
3017+ The authors intend this Report to belong to the entire Haskell
3018+ community, and so we grant permission to copy and distribute it for
3019+ any purpose, provided that it is reproduced in its entirety,
3020+ including this Notice. Modified versions of this Report may also be
3021+ copied and distributed for any purpose, provided that the modified
3022+ version is clearly presented as such, and that it does not claim to
3023+ be a definition of the Haskell 98 Language.
3024+
3025+ -----------------------------------------------------------------------------
3026+
3027+protolude LICENSE file:
3028+
3029+ Copyright (c) 2016, Stephen Diehl
3030+
3031+ Permission is hereby granted, free of charge, to any person obtaining a copy
3032+ of this software and associated documentation files (the "Software"), to
3033+ deal in the Software without restriction, including without limitation the
3034+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
3035+ sell copies of the Software, and to permit persons to whom the Software is
3036+ furnished to do so, subject to the following conditions:
3037+
3038+ The above copyright notice and this permission notice shall be included in
3039+ all copies or substantial portions of the Software.
3040+
3041+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3042+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3043+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3044+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3045+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
3046+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
3047+ IN THE SOFTWARE.
3048+
3049+psqueues LICENSE file:
3050+
3051+ The Glasgow Haskell Compiler License
3052+
3053+ Copyright 2004, The University Court of the University of Glasgow.
3054+ All rights reserved.
3055+
3056+ Redistribution and use in source and binary forms, with or without
3057+ modification, are permitted provided that the following conditions are met:
3058+
3059+ - Redistributions of source code must retain the above copyright notice,
3060+ this list of conditions and the following disclaimer.
3061+
3062+ - Redistributions in binary form must reproduce the above copyright notice,
3063+ this list of conditions and the following disclaimer in the documentation
3064+ and/or other materials provided with the distribution.
3065+
3066+ - Neither name of the University nor the names of its contributors may be
3067+ used to endorse or promote products derived from this software without
3068+ specific prior written permission.
3069+
3070+ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
3071+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
3072+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
3073+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
3074+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
3075+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3076+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
3077+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
3078+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3079+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3080+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
3081+ DAMAGE.
3082+
3083+random LICENSE file:
3084+
3085+ This library (libraries/base) is derived from code from two
3086+ sources:
3087+
3088+ * Code from the GHC project which is largely (c) The University of
3089+ Glasgow, and distributable under a BSD-style license (see below),
3090+
3091+ * Code from the Haskell 98 Report which is (c) Simon Peyton Jones
3092+ and freely redistributable (but see the full license for
3093+ restrictions).
3094+
3095+ The full text of these licenses is reproduced below. Both of the
3096+ licenses are BSD-style or compatible.
3097+
3098+ -----------------------------------------------------------------------------
3099+
3100+ The Glasgow Haskell Compiler License
3101+
3102+ Copyright 2004, The University Court of the University of Glasgow.
3103+ All rights reserved.
3104+
3105+ Redistribution and use in source and binary forms, with or without
3106+ modification, are permitted provided that the following conditions are met:
3107+
3108+ - Redistributions of source code must retain the above copyright notice,
3109+ this list of conditions and the following disclaimer.
3110+
3111+ - Redistributions in binary form must reproduce the above copyright notice,
3112+ this list of conditions and the following disclaimer in the documentation
3113+ and/or other materials provided with the distribution.
3114+
3115+ - Neither name of the University nor the names of its contributors may be
3116+ used to endorse or promote products derived from this software without
3117+ specific prior written permission.
3118+
3119+ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
3120+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
3121+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
3122+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
3123+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
3124+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3125+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
3126+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
3127+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3128+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3129+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
3130+ DAMAGE.
3131+
3132+ -----------------------------------------------------------------------------
3133+
3134+ Code derived from the document "Report on the Programming Language
3135+ Haskell 98", is distributed under the following license:
3136+
3137+ Copyright (c) 2002 Simon Peyton Jones
3138+
3139+ The authors intend this Report to belong to the entire Haskell
3140+ community, and so we grant permission to copy and distribute it for
3141+ any purpose, provided that it is reproduced in its entirety,
3142+ including this Notice. Modified versions of this Report may also be
3143+ copied and distributed for any purpose, provided that the modified
3144+ version is clearly presented as such, and that it does not claim to
3145+ be a definition of the Haskell 98 Language.
3146+
3147+ -----------------------------------------------------------------------------
3148+
3149+regex-base LICENSE file:
3150+
3151+ This modile is under this "3 clause" BSD license:
3152+
3153+ Copyright (c) 2007, Christopher Kuklewicz
3154+ All rights reserved.
3155+
3156+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
3157+
3158+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
3159+ * 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.
3160+ * The names of the contributors may not be used to endorse or promote products derived from this software without specific prior written permission.
3161+
3162+ 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.
3163+
3164+regex-tdfa LICENSE file:
3165+
3166+ This modile is under this "3 clause" BSD license:
3167+
3168+ Copyright (c) 2007-2009, Christopher Kuklewicz
3169+ All rights reserved.
3170+
3171+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
3172+
3173+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
3174+ * 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.
3175+ * The names of the contributors may not be used to endorse or promote products derived from this software without specific prior written permission.
3176+
3177+ 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.
3178+
3179+resourcet LICENSE file:
3180+
3181+ Copyright (c)2011, Michael Snoyman
3182+
3183+ All rights reserved.
3184+
3185+ Redistribution and use in source and binary forms, with or without
3186+ modification, are permitted provided that the following conditions are met:
3187+
3188+ * Redistributions of source code must retain the above copyright
3189+ notice, this list of conditions and the following disclaimer.
3190+
3191+ * Redistributions in binary form must reproduce the above
3192+ copyright notice, this list of conditions and the following
3193+ disclaimer in the documentation and/or other materials provided
3194+ with the distribution.
3195+
3196+ * Neither the name of Michael Snoyman nor the names of other
3197+ contributors may be used to endorse or promote products derived
3198+ from this software without specific prior written permission.
3199+
3200+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
3201+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3202+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
3203+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3204+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
3205+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3206+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3207+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3208+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3209+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3210+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3211+
3212+safe LICENSE file:
3213+
3214+ Copyright Neil Mitchell 2007-2015.
3215+ All rights reserved.
3216+
3217+ Redistribution and use in source and binary forms, with or without
3218+ modification, are permitted provided that the following conditions are
3219+ met:
3220+
3221+ * Redistributions of source code must retain the above copyright
3222+ notice, this list of conditions and the following disclaimer.
3223+
3224+ * Redistributions in binary form must reproduce the above
3225+ copyright notice, this list of conditions and the following
3226+ disclaimer in the documentation and/or other materials provided
3227+ with the distribution.
3228+
3229+ * Neither the name of Neil Mitchell nor the names of other
3230+ contributors may be used to endorse or promote products derived
3231+ from this software without specific prior written permission.
3232+
3233+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
3234+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3235+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
3236+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3237+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
3238+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3239+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3240+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3241+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3242+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3243+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3244+
3245+scientific LICENSE file:
3246+
3247+ Copyright (c) 2013, Bas van Dijk
3248+
3249+ All rights reserved.
3250+
3251+ Redistribution and use in source and binary forms, with or without
3252+ modification, are permitted provided that the following conditions are met:
3253+
3254+ * Redistributions of source code must retain the above copyright
3255+ notice, this list of conditions and the following disclaimer.
3256+
3257+ * Redistributions in binary form must reproduce the above
3258+ copyright notice, this list of conditions and the following
3259+ disclaimer in the documentation and/or other materials provided
3260+ with the distribution.
3261+
3262+ * Neither the name of Bas van Dijk nor the names of other
3263+ contributors may be used to endorse or promote products derived
3264+ from this software without specific prior written permission.
3265+
3266+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
3267+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3268+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
3269+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3270+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
3271+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3272+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3273+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3274+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3275+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3276+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3277+
3278+semigroups LICENSE file:
3279+
3280+ Copyright 2011-2015 Edward Kmett
3281+
3282+ All rights reserved.
3283+
3284+ Redistribution and use in source and binary forms, with or without
3285+ modification, are permitted provided that the following conditions
3286+ are met:
3287+
3288+ 1. Redistributions of source code must retain the above copyright
3289+ notice, this list of conditions and the following disclaimer.
3290+
3291+ 2. Redistributions in binary form must reproduce the above copyright
3292+ notice, this list of conditions and the following disclaimer in the
3293+ documentation and/or other materials provided with the distribution.
3294+
3295+ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
3296+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
3297+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
3298+ DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
3299+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3300+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3301+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3302+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
3303+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
3304+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3305+ POSSIBILITY OF SUCH DAMAGE.
3306+
3307+simple-sendfile LICENSE file:
3308+
3309+ Copyright (c) 2009, IIJ Innovation Institute Inc.
3310+ All rights reserved.
3311+
3312+ Redistribution and use in source and binary forms, with or without
3313+ modification, are permitted provided that the following conditions
3314+ are met:
3315+
3316+ * Redistributions of source code must retain the above copyright
3317+ notice, this list of conditions and the following disclaimer.
3318+ * Redistributions in binary form must reproduce the above copyright
3319+ notice, this list of conditions and the following disclaimer in
3320+ the documentation and/or other materials provided with the
3321+ distribution.
3322+ * Neither the name of the copyright holders nor the names of its
3323+ contributors may be used to endorse or promote products derived
3324+ from this software without specific prior written permission.
3325+
3326+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
3327+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3328+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
3329+ FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
3330+ COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
3331+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
3332+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
3333+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
3334+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3335+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
3336+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3337+ POSSIBILITY OF SUCH DAMAGE.
3338+
3339+socks LICENSE file:
3340+
3341+ Copyright (c) 2010-2011 Vincent Hanquez <vincent@snarc.org>
3342+
3343+ All rights reserved.
3344+
3345+ Redistribution and use in source and binary forms, with or without
3346+ modification, are permitted provided that the following conditions
3347+ are met:
3348+ 1. Redistributions of source code must retain the above copyright
3349+ notice, this list of conditions and the following disclaimer.
3350+ 2. Redistributions in binary form must reproduce the above copyright
3351+ notice, this list of conditions and the following disclaimer in the
3352+ documentation and/or other materials provided with the distribution.
3353+ 3. Neither the name of the author nor the names of his contributors
3354+ may be used to endorse or promote products derived from this software
3355+ without specific prior written permission.
3356+
3357+ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
3358+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
3359+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
3360+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
3361+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3362+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3363+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3364+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3365+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3366+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3367+ SUCH DAMAGE.
3368+
3369+sourcemap LICENSE file:
3370+
3371+ Copyright (c) 2012, Chris Done
3372+
3373+ All rights reserved.
3374+
3375+ Redistribution and use in source and binary forms, with or without
3376+ modification, are permitted provided that the following conditions are met:
3377+
3378+ * Redistributions of source code must retain the above copyright
3379+ notice, this list of conditions and the following disclaimer.
3380+
3381+ * Redistributions in binary form must reproduce the above
3382+ copyright notice, this list of conditions and the following
3383+ disclaimer in the documentation and/or other materials provided
3384+ with the distribution.
3385+
3386+ * Neither the name of Chris Done nor the names of other
3387+ contributors may be used to endorse or promote products derived
3388+ from this software without specific prior written permission.
3389+
3390+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
3391+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3392+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
3393+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3394+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
3395+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3396+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3397+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3398+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3399+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3400+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3401+
3402+spdx LICENSE file:
3403+
3404+ Copyright (c) 2015, Oleg Grenrus
3405+
3406+ All rights reserved.
3407+
3408+ Redistribution and use in source and binary forms, with or without
3409+ modification, are permitted provided that the following conditions are met:
3410+
3411+ * Redistributions of source code must retain the above copyright
3412+ notice, this list of conditions and the following disclaimer.
3413+
3414+ * Redistributions in binary form must reproduce the above
3415+ copyright notice, this list of conditions and the following
3416+ disclaimer in the documentation and/or other materials provided
3417+ with the distribution.
3418+
3419+ * Neither the name of Oleg Grenrus nor the names of other
3420+ contributors may be used to endorse or promote products derived
3421+ from this software without specific prior written permission.
3422+
3423+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
3424+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3425+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
3426+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3427+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
3428+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3429+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3430+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3431+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3432+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3433+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3434+
3435+split LICENSE file:
3436+
3437+ Copyright (c) 2008 Brent Yorgey, Louis Wasserman
3438+
3439+ All rights reserved.
3440+
3441+ Redistribution and use in source and binary forms, with or without
3442+ modification, are permitted provided that the following conditions
3443+ are met:
3444+ 1. Redistributions of source code must retain the above copyright
3445+ notice, this list of conditions and the following disclaimer.
3446+ 2. Redistributions in binary form must reproduce the above copyright
3447+ notice, this list of conditions and the following disclaimer in the
3448+ documentation and/or other materials provided with the distribution.
3449+ 3. Neither the name of the author nor the names of other contributors
3450+ may be used to endorse or promote products derived from this software
3451+ without specific prior written permission.
3452+
3453+ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND
3454+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
3455+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
3456+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
3457+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3458+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3459+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3460+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3461+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3462+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3463+ SUCH DAMAGE.
3464+
3465+stm LICENSE file:
3466+
3467+ The Glasgow Haskell Compiler License
3468+
3469+ Copyright 2004, The University Court of the University of Glasgow.
3470+ All rights reserved.
3471+
3472+ Redistribution and use in source and binary forms, with or without
3473+ modification, are permitted provided that the following conditions are met:
3474+
3475+ - Redistributions of source code must retain the above copyright notice,
3476+ this list of conditions and the following disclaimer.
3477+
3478+ - Redistributions in binary form must reproduce the above copyright notice,
3479+ this list of conditions and the following disclaimer in the documentation
3480+ and/or other materials provided with the distribution.
3481+
3482+ - Neither name of the University nor the names of its contributors may be
3483+ used to endorse or promote products derived from this software without
3484+ specific prior written permission.
3485+
3486+ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
3487+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
3488+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
3489+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
3490+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
3491+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3492+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
3493+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
3494+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3495+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3496+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
3497+ DAMAGE.
3498+
3499+stm-chans LICENSE file:
3500+
3501+ === stm-chans license ===
3502+
3503+ Copyright (c) 2011--2013, wren gayle romano.
3504+ ALL RIGHTS RESERVED.
3505+
3506+ Redistribution and use in source and binary forms, with or without
3507+ modification, are permitted provided that the following conditions
3508+ are met:
3509+
3510+ * Redistributions of source code must retain the above copyright
3511+ notice, this list of conditions and the following disclaimer.
3512+
3513+ * Redistributions in binary form must reproduce the above
3514+ copyright notice, this list of conditions and the following
3515+ disclaimer in the documentation and/or other materials provided
3516+ with the distribution.
3517+
3518+ * Neither the name of the copyright holders nor the names of
3519+ other contributors may be used to endorse or promote products
3520+ derived from this software without specific prior written
3521+ permission.
3522+
3523+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
3524+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3525+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
3526+ FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
3527+ COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
3528+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
3529+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
3530+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
3531+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3532+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
3533+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3534+ POSSIBILITY OF SUCH DAMAGE.
3535+
3536+
3537+streaming-commons LICENSE file:
3538+
3539+ The MIT License (MIT)
3540+
3541+ Copyright (c) 2014 FP Complete
3542+
3543+ Permission is hereby granted, free of charge, to any person obtaining a copy
3544+ of this software and associated documentation files (the "Software"), to deal
3545+ in the Software without restriction, including without limitation the rights
3546+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
3547+ copies of the Software, and to permit persons to whom the Software is
3548+ furnished to do so, subject to the following conditions:
3549+
3550+ The above copyright notice and this permission notice shall be included in all
3551+ copies or substantial portions of the Software.
3552+
3553+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3554+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3555+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3556+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3557+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
3558+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3559+ SOFTWARE.
3560+
3561+stringsearch LICENSE file:
3562+
3563+ Page not found: Sorry, it's just not here.
3564+
3565+syb LICENSE file:
3566+
3567+ This library (libraries/syb) is derived from code from several
3568+ sources:
3569+
3570+ * Code from the GHC project which is largely (c) The University of
3571+ Glasgow, and distributable under a BSD-style license (see below),
3572+
3573+ * Code from the Haskell 98 Report which is (c) Simon Peyton Jones
3574+ and freely redistributable (but see the full license for
3575+ restrictions).
3576+
3577+ * Code from the Haskell Foreign Function Interface specification,
3578+ which is (c) Manuel M. T. Chakravarty and freely redistributable
3579+ (but see the full license for restrictions).
3580+
3581+ The full text of these licenses is reproduced below. All of the
3582+ licenses are BSD-style or compatible.
3583+
3584+ -----------------------------------------------------------------------------
3585+
3586+ The Glasgow Haskell Compiler License
3587+
3588+ Copyright 2004, The University Court of the University of Glasgow.
3589+ All rights reserved.
3590+
3591+ Redistribution and use in source and binary forms, with or without
3592+ modification, are permitted provided that the following conditions are met:
3593+
3594+ - Redistributions of source code must retain the above copyright notice,
3595+ this list of conditions and the following disclaimer.
3596+
3597+ - Redistributions in binary form must reproduce the above copyright notice,
3598+ this list of conditions and the following disclaimer in the documentation
3599+ and/or other materials provided with the distribution.
3600+
3601+ - Neither name of the University nor the names of its contributors may be
3602+ used to endorse or promote products derived from this software without
3603+ specific prior written permission.
3604+
3605+ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
3606+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
3607+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
3608+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
3609+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
3610+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3611+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
3612+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
3613+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3614+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3615+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
3616+ DAMAGE.
3617+
3618+ -----------------------------------------------------------------------------
3619+
3620+ Code derived from the document "Report on the Programming Language
3621+ Haskell 98", is distributed under the following license:
3622+
3623+ Copyright (c) 2002 Simon Peyton Jones
3624+
3625+ The authors intend this Report to belong to the entire Haskell
3626+ community, and so we grant permission to copy and distribute it for
3627+ any purpose, provided that it is reproduced in its entirety,
3628+ including this Notice. Modified versions of this Report may also be
3629+ copied and distributed for any purpose, provided that the modified
3630+ version is clearly presented as such, and that it does not claim to
3631+ be a definition of the Haskell 98 Language.
3632+
3633+ -----------------------------------------------------------------------------
3634+
3635+ Code derived from the document "The Haskell 98 Foreign Function
3636+ Interface, An Addendum to the Haskell 98 Report" is distributed under
3637+ the following license:
3638+
3639+ Copyright (c) 2002 Manuel M. T. Chakravarty
3640+
3641+ The authors intend this Report to belong to the entire Haskell
3642+ community, and so we grant permission to copy and distribute it for
3643+ any purpose, provided that it is reproduced in its entirety,
3644+ including this Notice. Modified versions of this Report may also be
3645+ copied and distributed for any purpose, provided that the modified
3646+ version is clearly presented as such, and that it does not claim to
3647+ be a definition of the Haskell 98 Foreign Function Interface.
3648+
3649+ -----------------------------------------------------------------------------
3650+
3651+tagged LICENSE file:
3652+
3653+ Copyright (c) 2009-2015 Edward Kmett
3654+ All rights reserved.
3655+
3656+ Redistribution and use in source and binary forms, with or without
3657+ modification, are permitted provided that the following conditions are
3658+ met:
3659+
3660+ * Redistributions of source code must retain the above copyright
3661+ notice, this list of conditions and the following disclaimer.
3662+
3663+ * Redistributions in binary form must reproduce the above
3664+ copyright notice, this list of conditions and the following
3665+ disclaimer in the documentation and/or other materials provided
3666+ with the distribution.
3667+
3668+ * Neither the name of Edward Kmett nor the names of other
3669+ contributors may be used to endorse or promote products derived
3670+ from this software without specific prior written permission.
3671+
3672+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
3673+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3674+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
3675+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3676+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
3677+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3678+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3679+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3680+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3681+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3682+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3683+
3684+template-haskell LICENSE file:
3685+
3686+
3687+ The Glasgow Haskell Compiler License
3688+
3689+ Copyright 2002-2007, The University Court of the University of Glasgow.
3690+ All rights reserved.
3691+
3692+ Redistribution and use in source and binary forms, with or without
3693+ modification, are permitted provided that the following conditions are met:
3694+
3695+ - Redistributions of source code must retain the above copyright notice,
3696+ this list of conditions and the following disclaimer.
3697+
3698+ - Redistributions in binary form must reproduce the above copyright notice,
3699+ this list of conditions and the following disclaimer in the documentation
3700+ and/or other materials provided with the distribution.
3701+
3702+ - Neither name of the University nor the names of its contributors may be
3703+ used to endorse or promote products derived from this software without
3704+ specific prior written permission.
3705+
3706+ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
3707+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
3708+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
3709+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
3710+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
3711+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3712+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
3713+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
3714+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3715+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3716+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
3717+ DAMAGE.
3718+
3719+
3720+terminfo LICENSE file:
3721+
3722+ Copyright 2007, Judah Jacobson.
3723+ All Rights Reserved.
3724+
3725+ Redistribution and use in source and binary forms, with or without
3726+ modification, are permitted provided that the following conditions are met:
3727+
3728+ - Redistribution of source code must retain the above copyright notice,
3729+ this list of conditions and the following disclamer.
3730+
3731+ - Redistribution in binary form must reproduce the above copyright notice,
3732+ this list of conditions and the following disclamer in the documentation
3733+ and/or other materials provided with the distribution.
3734+
3735+ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY
3736+ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
3737+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
3738+ DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE CONTRIBUTORS BE LIABLE
3739+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3740+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
3741+ SERVICES; LOSS OF USE, DATA OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
3742+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
3743+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
3744+ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3745+
3746+text LICENSE file:
3747+
3748+ Copyright (c) 2008-2009, Tom Harper
3749+ All rights reserved.
3750+
3751+ Redistribution and use in source and binary forms, with or without
3752+ modification, are permitted provided that the following conditions
3753+ are met:
3754+
3755+ * Redistributions of source code must retain the above copyright
3756+ notice, this list of conditions and the following disclaimer.
3757+
3758+ * Redistributions in binary form must reproduce the above
3759+ copyright notice, this list of conditions and the following
3760+ disclaimer in the documentation and/or other materials provided
3761+ with the distribution.
3762+
3763+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
3764+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3765+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
3766+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3767+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
3768+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3769+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3770+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3771+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3772+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3773+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3774+
3775+time LICENSE file:
3776+
3777+ TimeLib is Copyright (c) Ashley Yakeley, 2004-2014. All rights reserved.
3778+ Certain sections are Copyright 2004, The University Court of the University of Glasgow. All rights reserved.
3779+
3780+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
3781+
3782+ - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
3783+
3784+ - 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.
3785+
3786+ 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.
3787+
3788+time-locale-compat LICENSE file:
3789+
3790+ Copyright (c) 2014, Kei Hibino
3791+
3792+ All rights reserved.
3793+
3794+ Redistribution and use in source and binary forms, with or without
3795+ modification, are permitted provided that the following conditions are met:
3796+
3797+ * Redistributions of source code must retain the above copyright
3798+ notice, this list of conditions and the following disclaimer.
3799+
3800+ * Redistributions in binary form must reproduce the above
3801+ copyright notice, this list of conditions and the following
3802+ disclaimer in the documentation and/or other materials provided
3803+ with the distribution.
3804+
3805+ * Neither the name of Kei Hibino nor the names of other
3806+ contributors may be used to endorse or promote products derived
3807+ from this software without specific prior written permission.
3808+
3809+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
3810+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3811+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
3812+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3813+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
3814+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3815+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3816+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3817+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3818+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3819+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3820+
3821+tls LICENSE file:
3822+
3823+ Copyright (c) 2010-2015 Vincent Hanquez <vincent@snarc.org>
3824+
3825+ All rights reserved.
3826+
3827+ Redistribution and use in source and binary forms, with or without
3828+ modification, are permitted provided that the following conditions
3829+ are met:
3830+ 1. Redistributions of source code must retain the above copyright
3831+ notice, this list of conditions and the following disclaimer.
3832+ 2. Redistributions in binary form must reproduce the above copyright
3833+ notice, this list of conditions and the following disclaimer in the
3834+ documentation and/or other materials provided with the distribution.
3835+ 3. Neither the name of the author nor the names of his contributors
3836+ may be used to endorse or promote products derived from this software
3837+ without specific prior written permission.
3838+
3839+ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
3840+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
3841+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
3842+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
3843+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3844+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3845+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3846+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3847+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3848+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3849+ SUCH DAMAGE.
3850+
3851+transformers LICENSE file:
3852+
3853+ The Glasgow Haskell Compiler License
3854+
3855+ Copyright 2004, The University Court of the University of Glasgow.
3856+ All rights reserved.
3857+
3858+ Redistribution and use in source and binary forms, with or without
3859+ modification, are permitted provided that the following conditions are met:
3860+
3861+ - Redistributions of source code must retain the above copyright notice,
3862+ this list of conditions and the following disclaimer.
3863+
3864+ - Redistributions in binary form must reproduce the above copyright notice,
3865+ this list of conditions and the following disclaimer in the documentation
3866+ and/or other materials provided with the distribution.
3867+
3868+ - Neither name of the University nor the names of its contributors may be
3869+ used to endorse or promote products derived from this software without
3870+ specific prior written permission.
3871+
3872+ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
3873+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
3874+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
3875+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
3876+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
3877+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3878+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
3879+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
3880+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3881+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3882+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
3883+ DAMAGE.
3884+
3885+transformers-base LICENSE file:
3886+
3887+ Copyright (c) 2011, Mikhail Vorozhtsov, Bas van Dijk
3888+ All rights reserved.
3889+
3890+ Redistribution and use in source and binary forms, with or without
3891+ modification, are permitted provided that the following conditions are met:
3892+
3893+ - Redistributions of source code must retain the above copyright notice,
3894+ this list of conditions and the following disclaimer.
3895+ - Redistributions in binary form must reproduce the above copyright
3896+ notice, this list of conditions and the following disclaimer in the
3897+ documentation and/or other materials provided with the distribution.
3898+ - Neither the names of the copyright owners nor the names of the
3899+ contributors may be used to endorse or promote products derived
3900+ from this software without specific prior written permission.
3901+
3902+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
3903+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3904+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
3905+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3906+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
3907+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3908+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3909+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3910+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3911+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3912+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3913+
3914+
3915+transformers-compat LICENSE file:
3916+
3917+ Copyright 2012-2015 Edward Kmett
3918+
3919+ All rights reserved.
3920+
3921+ Redistribution and use in source and binary forms, with or without
3922+ modification, are permitted provided that the following conditions
3923+ are met:
3924+
3925+ 1. Redistributions of source code must retain the above copyright
3926+ notice, this list of conditions and the following disclaimer.
3927+
3928+ 2. Redistributions in binary form must reproduce the above copyright
3929+ notice, this list of conditions and the following disclaimer in the
3930+ documentation and/or other materials provided with the distribution.
3931+
3932+ 3. Neither the name of the author nor the names of his contributors
3933+ may be used to endorse or promote products derived from this software
3934+ without specific prior written permission.
3935+
3936+ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
3937+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
3938+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
3939+ DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
3940+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3941+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3942+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3943+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
3944+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
3945+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3946+ POSSIBILITY OF SUCH DAMAGE.
3947+
3948+unix LICENSE file:
3949+
3950+ The Glasgow Haskell Compiler License
3951+
3952+ Copyright 2004, The University Court of the University of Glasgow.
3953+ All rights reserved.
3954+
3955+ Redistribution and use in source and binary forms, with or without
3956+ modification, are permitted provided that the following conditions are met:
3957+
3958+ - Redistributions of source code must retain the above copyright notice,
3959+ this list of conditions and the following disclaimer.
3960+
3961+ - Redistributions in binary form must reproduce the above copyright notice,
3962+ this list of conditions and the following disclaimer in the documentation
3963+ and/or other materials provided with the distribution.
3964+
3965+ - Neither name of the University nor the names of its contributors may be
3966+ used to endorse or promote products derived from this software without
3967+ specific prior written permission.
3968+
3969+ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
3970+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
3971+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
3972+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
3973+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
3974+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3975+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
3976+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
3977+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3978+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3979+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
3980+ DAMAGE.
3981+
3982+unix-compat LICENSE file:
3983+
3984+ Copyright (c) 2007-2008, Björn Bringert
3985+ Copyright (c) 2007-2009, Duncan Coutts
3986+ Copyright (c) 2010-2011, Jacob Stanley
3987+ Copyright (c) 2011, Bryan O'Sullivan
3988+ All rights reserved.
3989+
3990+ Redistribution and use in source and binary forms, with or without
3991+ modification, are permitted provided that the following conditions are met:
3992+
3993+ - Redistributions of source code must retain the above copyright notice,
3994+ this list of conditions and the following disclaimer.
3995+ - Redistributions in binary form must reproduce the above copyright
3996+ notice, this list of conditions and the following disclaimer in the
3997+ documentation and/or other materials provided with the distribution.
3998+ - Neither the names of the copyright owners nor the names of the
3999+ contributors may be used to endorse or promote products derived
4000+ from this software without specific prior written permission.
4001+
4002+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4003+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
4004+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
4005+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
4006+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
4007+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
4008+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
4009+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
4010+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
4011+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
4012+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4013+
4014+unix-time LICENSE file:
4015+
4016+ Copyright (c) 2009, IIJ Innovation Institute Inc.
4017+ All rights reserved.
4018+
4019+ Redistribution and use in source and binary forms, with or without
4020+ modification, are permitted provided that the following conditions
4021+ are met:
4022+
4023+ * Redistributions of source code must retain the above copyright
4024+ notice, this list of conditions and the following disclaimer.
4025+ * Redistributions in binary form must reproduce the above copyright
4026+ notice, this list of conditions and the following disclaimer in
4027+ the documentation and/or other materials provided with the
4028+ distribution.
4029+ * Neither the name of the copyright holders nor the names of its
4030+ contributors may be used to endorse or promote products derived
4031+ from this software without specific prior written permission.
4032+
4033+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4034+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
4035+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
4036+ FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
4037+ COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
4038+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
4039+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
4040+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
4041+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
4042+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
4043+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
4044+ POSSIBILITY OF SUCH DAMAGE.
4045+
4046+unordered-containers LICENSE file:
4047+
4048+ Copyright (c) 2010, Johan Tibell
4049+
4050+ All rights reserved.
4051+
4052+ Redistribution and use in source and binary forms, with or without
4053+ modification, are permitted provided that the following conditions are met:
4054+
4055+ * Redistributions of source code must retain the above copyright
4056+ notice, this list of conditions and the following disclaimer.
4057+
4058+ * Redistributions in binary form must reproduce the above
4059+ copyright notice, this list of conditions and the following
4060+ disclaimer in the documentation and/or other materials provided
4061+ with the distribution.
4062+
4063+ * Neither the name of Johan Tibell nor the names of other
4064+ contributors may be used to endorse or promote products derived
4065+ from this software without specific prior written permission.
4066+
4067+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4068+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
4069+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
4070+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
4071+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
4072+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
4073+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
4074+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
4075+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
4076+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
4077+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4078+
4079+utf8-string LICENSE file:
4080+
4081+ * Copyright (c) 2007, Galois Inc.
4082+ * All rights reserved.
4083+ *
4084+ * Redistribution and use in source and binary forms, with or without
4085+ * modification, are permitted provided that the following conditions are met:
4086+ * * Redistributions of source code must retain the above copyright
4087+ * notice, this list of conditions and the following disclaimer.
4088+ * * Redistributions in binary form must reproduce the above copyright
4089+ * notice, this list of conditions and the following disclaimer in the
4090+ * documentation and/or other materials provided with the distribution.
4091+ * * Neither the name of Galois Inc. nor the
4092+ * names of its contributors may be used to endorse or promote products
4093+ * derived from this software without specific prior written permission.
4094+ *
4095+ * THIS SOFTWARE IS PROVIDED BY Galois Inc. ``AS IS'' AND ANY
4096+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
4097+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
4098+ * DISCLAIMED. IN NO EVENT SHALL Galois Inc. BE LIABLE FOR ANY
4099+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
4100+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
4101+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
4102+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
4103+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
4104+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4105+
4106+vault LICENSE file:
4107+
4108+ Copyright (c)2011, Heinrich Apfelmus
4109+
4110+ All rights reserved.
4111+
4112+ Redistribution and use in source and binary forms, with or without
4113+ modification, are permitted provided that the following conditions are met:
4114+
4115+ * Redistributions of source code must retain the above copyright
4116+ notice, this list of conditions and the following disclaimer.
4117+
4118+ * Redistributions in binary form must reproduce the above
4119+ copyright notice, this list of conditions and the following
4120+ disclaimer in the documentation and/or other materials provided
4121+ with the distribution.
4122+
4123+ * Neither the name of Heinrich Apfelmus nor the names of other
4124+ contributors may be used to endorse or promote products derived
4125+ from this software without specific prior written permission.
4126+
4127+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4128+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
4129+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
4130+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
4131+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
4132+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
4133+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
4134+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
4135+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
4136+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
4137+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4138+
4139+vector LICENSE file:
4140+
4141+ Copyright (c) 2008-2012, Roman Leshchinskiy
4142+ All rights reserved.
4143+
4144+ Redistribution and use in source and binary forms, with or without
4145+ modification, are permitted provided that the following conditions are met:
4146+
4147+ - Redistributions of source code must retain the above copyright notice,
4148+ this list of conditions and the following disclaimer.
4149+
4150+ - Redistributions in binary form must reproduce the above copyright notice,
4151+ this list of conditions and the following disclaimer in the documentation
4152+ and/or other materials provided with the distribution.
4153+
4154+ - Neither name of the University nor the names of its contributors may be
4155+ used to endorse or promote products derived from this software without
4156+ specific prior written permission.
4157+
4158+ THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
4159+ GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
4160+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
4161+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
4162+ UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
4163+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
4164+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
4165+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
4166+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
4167+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
4168+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
4169+ DAMAGE.
4170+
4171+
4172+void LICENSE file:
4173+
4174+ Copyright 2015 Edward Kmett
4175+
4176+ All rights reserved.
4177+
4178+ Redistribution and use in source and binary forms, with or without
4179+ modification, are permitted provided that the following conditions
4180+ are met:
4181+
4182+ 1. Redistributions of source code must retain the above copyright
4183+ notice, this list of conditions and the following disclaimer.
4184+
4185+ 2. Redistributions in binary form must reproduce the above copyright
4186+ notice, this list of conditions and the following disclaimer in the
4187+ documentation and/or other materials provided with the distribution.
4188+
4189+ 3. Neither the name of the author nor the names of his contributors
4190+ may be used to endorse or promote products derived from this software
4191+ without specific prior written permission.
4192+
4193+ THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
4194+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
4195+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
4196+ DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
4197+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
4198+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
4199+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
4200+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
4201+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
4202+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
4203+ POSSIBILITY OF SUCH DAMAGE.
4204+
4205+wai LICENSE file:
4206+
4207+ Copyright (c) 2012 Michael Snoyman, http://www.yesodweb.com/
4208+
4209+ Permission is hereby granted, free of charge, to any person obtaining
4210+ a copy of this software and associated documentation files (the
4211+ "Software"), to deal in the Software without restriction, including
4212+ without limitation the rights to use, copy, modify, merge, publish,
4213+ distribute, sublicense, and/or sell copies of the Software, and to
4214+ permit persons to whom the Software is furnished to do so, subject to
4215+ the following conditions:
4216+
4217+ The above copyright notice and this permission notice shall be
4218+ included in all copies or substantial portions of the Software.
4219+
4220+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
4221+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
4222+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
4223+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
4224+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
4225+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
4226+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4227+
4228+wai-app-static LICENSE file:
4229+
4230+ Copyright (c) 2012 Michael Snoyman, http://www.yesodweb.com/
4231+
4232+ Permission is hereby granted, free of charge, to any person obtaining
4233+ a copy of this software and associated documentation files (the
4234+ "Software"), to deal in the Software without restriction, including
4235+ without limitation the rights to use, copy, modify, merge, publish,
4236+ distribute, sublicense, and/or sell copies of the Software, and to
4237+ permit persons to whom the Software is furnished to do so, subject to
4238+ the following conditions:
4239+
4240+ The above copyright notice and this permission notice shall be
4241+ included in all copies or substantial portions of the Software.
4242+
4243+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
4244+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
4245+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
4246+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
4247+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
4248+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
4249+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4250+
4251+wai-extra LICENSE file:
4252+
4253+ Copyright (c) 2012 Michael Snoyman, http://www.yesodweb.com/
4254+
4255+ Permission is hereby granted, free of charge, to any person obtaining
4256+ a copy of this software and associated documentation files (the
4257+ "Software"), to deal in the Software without restriction, including
4258+ without limitation the rights to use, copy, modify, merge, publish,
4259+ distribute, sublicense, and/or sell copies of the Software, and to
4260+ permit persons to whom the Software is furnished to do so, subject to
4261+ the following conditions:
4262+
4263+ The above copyright notice and this permission notice shall be
4264+ included in all copies or substantial portions of the Software.
4265+
4266+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
4267+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
4268+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
4269+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
4270+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
4271+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
4272+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4273+
4274+wai-logger LICENSE file:
4275+
4276+ Copyright (c) 2009, IIJ Innovation Institute Inc.
4277+ All rights reserved.
4278+
4279+ Redistribution and use in source and binary forms, with or without
4280+ modification, are permitted provided that the following conditions
4281+ are met:
74282
84283 * Redistributions of source code must retain the above copyright
94284 notice, this list of conditions and the following disclaimer.
4285+ * Redistributions in binary form must reproduce the above copyright
4286+ notice, this list of conditions and the following disclaimer in
4287+ the documentation and/or other materials provided with the
4288+ distribution.
4289+ * Neither the name of the copyright holders nor the names of its
4290+ contributors may be used to endorse or promote products derived
4291+ from this software without specific prior written permission.
4292+
4293+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4294+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
4295+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
4296+ FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
4297+ COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
4298+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
4299+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
4300+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
4301+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
4302+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
4303+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
4304+ POSSIBILITY OF SUCH DAMAGE.
4305+
4306+wai-websockets LICENSE file:
4307+
4308+ Copyright (c) 2012 Michael Snoyman, http://www.yesodweb.com/
4309+
4310+ Permission is hereby granted, free of charge, to any person obtaining
4311+ a copy of this software and associated documentation files (the
4312+ "Software"), to deal in the Software without restriction, including
4313+ without limitation the rights to use, copy, modify, merge, publish,
4314+ distribute, sublicense, and/or sell copies of the Software, and to
4315+ permit persons to whom the Software is furnished to do so, subject to
4316+ the following conditions:
4317+
4318+ The above copyright notice and this permission notice shall be
4319+ included in all copies or substantial portions of the Software.
4320+
4321+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
4322+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
4323+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
4324+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
4325+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
4326+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
4327+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4328+
4329+warp LICENSE file:
4330+
4331+ Copyright (c) 2012 Michael Snoyman, http://www.yesodweb.com/
4332+
4333+ Permission is hereby granted, free of charge, to any person obtaining
4334+ a copy of this software and associated documentation files (the
4335+ "Software"), to deal in the Software without restriction, including
4336+ without limitation the rights to use, copy, modify, merge, publish,
4337+ distribute, sublicense, and/or sell copies of the Software, and to
4338+ permit persons to whom the Software is furnished to do so, subject to
4339+ the following conditions:
4340+
4341+ The above copyright notice and this permission notice shall be
4342+ included in all copies or substantial portions of the Software.
4343+
4344+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
4345+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
4346+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
4347+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
4348+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
4349+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
4350+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
104351
11− * Redistributions in binary form must reproduce the above
12− copyright notice, this list of conditions and the following
13− disclaimer in the documentation and/or other materials provided
14− with the distribution.
4352+websockets LICENSE file:
154353
16− * Neither the name of Author name here nor the names of other
4354+ Page not found: Sorry, it's just not here.
4355+
4356+word8 LICENSE file:
4357+
4358+ Copyright (c) 2012, IIJ Innovation Institute Inc.
4359+ All rights reserved.
4360+
4361+ Redistribution and use in source and binary forms, with or without
4362+ modification, are permitted provided that the following conditions
4363+ are met:
4364+
4365+ * Redistributions of source code must retain the above copyright
4366+ notice, this list of conditions and the following disclaimer.
4367+ * Redistributions in binary form must reproduce the above copyright
4368+ notice, this list of conditions and the following disclaimer in
4369+ the documentation and/or other materials provided with the
4370+ distribution.
4371+ * Neither the name of the copyright holders nor the names of its
174372 contributors may be used to endorse or promote products derived
184373 from this software without specific prior written permission.
194374
20−THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21−"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22−LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23−A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24−OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25−SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26−LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27−DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28−THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29−(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30−OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4375+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4376+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
4377+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
4378+ FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
4379+ COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
4380+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
4381+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
4382+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
4383+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
4384+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
4385+ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
4386+ POSSIBILITY OF SUCH DAMAGE.
4387+
4388+x509 LICENSE file:
4389+
4390+ Copyright (c) 2010-2013 Vincent Hanquez <vincent@snarc.org>
4391+
4392+ All rights reserved.
4393+
4394+ Redistribution and use in source and binary forms, with or without
4395+ modification, are permitted provided that the following conditions
4396+ are met:
4397+ 1. Redistributions of source code must retain the above copyright
4398+ notice, this list of conditions and the following disclaimer.
4399+ 2. Redistributions in binary form must reproduce the above copyright
4400+ notice, this list of conditions and the following disclaimer in the
4401+ documentation and/or other materials provided with the distribution.
4402+ 3. Neither the name of the author nor the names of his contributors
4403+ may be used to endorse or promote products derived from this software
4404+ without specific prior written permission.
4405+
4406+ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
4407+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
4408+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
4409+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
4410+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
4411+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
4412+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
4413+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
4414+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
4415+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
4416+ SUCH DAMAGE.
4417+
4418+x509-store LICENSE file:
4419+
4420+ Copyright (c) 2010-2013 Vincent Hanquez <vincent@snarc.org>
4421+
4422+ All rights reserved.
4423+
4424+ Redistribution and use in source and binary forms, with or without
4425+ modification, are permitted provided that the following conditions
4426+ are met:
4427+ 1. Redistributions of source code must retain the above copyright
4428+ notice, this list of conditions and the following disclaimer.
4429+ 2. Redistributions in binary form must reproduce the above copyright
4430+ notice, this list of conditions and the following disclaimer in the
4431+ documentation and/or other materials provided with the distribution.
4432+ 3. Neither the name of the author nor the names of his contributors
4433+ may be used to endorse or promote products derived from this software
4434+ without specific prior written permission.
4435+
4436+ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
4437+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
4438+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
4439+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
4440+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
4441+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
4442+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
4443+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
4444+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
4445+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
4446+ SUCH DAMAGE.
4447+
4448+x509-system LICENSE file:
4449+
4450+ Copyright (c) 2010-2013 Vincent Hanquez <vincent@snarc.org>
4451+
4452+ All rights reserved.
4453+
4454+ Redistribution and use in source and binary forms, with or without
4455+ modification, are permitted provided that the following conditions
4456+ are met:
4457+ 1. Redistributions of source code must retain the above copyright
4458+ notice, this list of conditions and the following disclaimer.
4459+ 2. Redistributions in binary form must reproduce the above copyright
4460+ notice, this list of conditions and the following disclaimer in the
4461+ documentation and/or other materials provided with the distribution.
4462+ 3. Neither the name of the author nor the names of his contributors
4463+ may be used to endorse or promote products derived from this software
4464+ without specific prior written permission.
4465+
4466+ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
4467+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
4468+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
4469+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
4470+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
4471+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
4472+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
4473+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
4474+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
4475+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
4476+ SUCH DAMAGE.
4477+
4478+x509-validation LICENSE file:
4479+
4480+ Copyright (c) 2010-2013 Vincent Hanquez <vincent@snarc.org>
4481+
4482+ All rights reserved.
4483+
4484+ Redistribution and use in source and binary forms, with or without
4485+ modification, are permitted provided that the following conditions
4486+ are met:
4487+ 1. Redistributions of source code must retain the above copyright
4488+ notice, this list of conditions and the following disclaimer.
4489+ 2. Redistributions in binary form must reproduce the above copyright
4490+ notice, this list of conditions and the following disclaimer in the
4491+ documentation and/or other materials provided with the distribution.
4492+ 3. Neither the name of the author nor the names of his contributors
4493+ may be used to endorse or promote products derived from this software
4494+ without specific prior written permission.
4495+
4496+ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
4497+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
4498+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
4499+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
4500+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
4501+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
4502+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
4503+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
4504+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
4505+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
4506+ SUCH DAMAGE.
4507+
4508+zlib LICENSE file:
4509+
4510+ Copyright (c) 2006-2015, Duncan Coutts
4511+ All rights reserved.
4512+
4513+ Redistribution and use in source and binary forms, with or without
4514+ modification, are permitted provided that the following conditions are met:
4515+
4516+ 1. Redistributions of source code must retain the above copyright notice,
4517+ this list of conditions and the following disclaimer.
4518+ 2. Redistributions in binary form must reproduce the above copyright
4519+ notice, this list of conditions and the following disclaimer in the
4520+ documentation and/or other materials provided with the distribution.
4521+ 3. This clause is intentionally left blank.
4522+
4523+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
4524+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
4525+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
4526+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
4527+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
4528+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
4529+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
4530+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
4531+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
4532+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
4533+ POSSIBILITY OF SUCH DAMAGE.
4534+
README-go.mddeleted−48
@@ -1,48 +0,0 @@
1−
2−### psgo
3−
4−#### Performance
5−
6−* No runtime system beyond some support types and functions
7−* Uses PureScript's normal tail call optimization techniques for generated Go code
8−
9−#### Differences from PureScript:
10−
11−* Foreign imports/exports are Go instead of JavaScript – see [standard library foreign implementations](https://github.com/andyarvanitis/purescript-native-go-ffi)
12−* No Go-specific REPL
13−
14−#### Other notes:
15−
16−* The provided `Any` type is just an alias for `interface{}`
17−* PureScript types are represented in Go with:
18−
19− | PureScript | Go |
20− |------------|----|
21− |`Array` | `[]Any`|
22− |`String` | `string`|
23− |`Number` | `float64`|
24− |`Int` | `int`|
25− |`Char` | `string` (single UTF-8 entity)|
26− |`Boolean` | `bool`|
27− |Records | `map[string]Any`|
28−
29−#### Future ideas:
30−
31−* Nice facilities (modules) for concurrency/parallelism, using goroutines
32−
33−
34−#### Getting Started
35−This assumes you are running macOS (OS X) or a Unix-like system (Linux, *BSD, etc.).
36−
37−1. Choose a working directory wherever you like. Then create a `src` subdirectory under it, which will be where you will place your own PureScript source files.
38−
39−1. Initialize your project with `spago init`, and install any dependencies with `spago install` (please see their instructions if you haven't used it before).
40−
41−1. Add the `backend = "psgo"` option to your `spago.dhall` file. That way `spago` will use the psgo backend when compiling.
42−
43−1. You should now be ready to build a PureScript program:
44− * As stated above, place your source file(s) in the working directory's `src` subdirectory and execute `spago build`.
45−
46− * This will generate the Go source tree for your program and then build an executable binary. The resulting executable will be in your working directory and will be named `Main`. The generated source files will be under `output/`.
47−
48−---
README.md+20−32
@@ -1,41 +1,29 @@
1−[![PureScript](https://raw.githubusercontent.com/purescript/purescript/master/logo.png)](http://purescript.org)
1+[![PureScript](logo.png)](http://purescript.org)
22
3−This is a platform-native compiler backend for [PureScript](https://github.com/purescript/purescript). It attempts to generate "sane", debuggable, and portable [C++11](https://isocpp.org/wiki/faq/cpp11) (or later) or [Go](https://golang.org/) code as an intermediate language, which is then compiled to a native executable binary. This also enables easy interoperability with existing C/C++ or Go frameworks and libraries on a number of platforms.
3+A small strongly typed programming language with expressive types that compiles to Javascript, written in and inspired by Haskell.
44
5−There are two utilities in the purescript-native "suite": `pscpp` and `psgo`. The source code in this branch is for `psgo`, the purescript-to-Go transpiler. For the source code of the `pscpp` purescript-to-C++ transpiler, please see the [cpp branch](https://github.com/andyarvanitis/purescript-native/tree/cpp).
5+[![Hackage](https://img.shields.io/hackage/v/purescript.svg)](http://hackage.haskell.org/package/purescript) [![Build Status](https://api.travis-ci.org/purescript/purescript.svg?branch=master)](http://travis-ci.org/purescript/purescript)
66
7−#### Platforms
8−* Although purescript-native should work on any platform supporting PureScript and modern C++ or Go, the generated code and resulting binary executables have been tested on:
9− * macOS Mojave 10.14.5 – full test suite
10− * For C++, Xcode 10.2.1's `clang` was used
11− * For Go, `go` version 1.12.7 was used
12− * Windows 10 x64 – full test suite
13− * C++: Visual Studio 2017 and `clang`
14− * Go: `go` version 1.12.7
15− * Linux Debian 9.5 amd64 – full test suite (C++)
16− * Default versions of `clang` and `gcc`
17− * Linux Debian 10 amd64 – full test suite (Go)
18− * Default version of `go`
19− * Raspberry Pi 3 B+ Raspbian official build (ARM), default versions of `clang` and `gcc`
7+[![Stackage LTS 2](http://stackage.org/package/purescript/badge/lts-2)](http://stackage.org/lts-2/package/purescript)
8+[![Stackage LTS 3](http://stackage.org/package/purescript/badge/lts-3)](http://stackage.org/lts-3/package/purescript)
9+[![Stackage Nightly](http://stackage.org/package/purescript/badge/nightly)](http://stackage.org/nightly/package/purescript)
2010
11+## Language info
2112
22−#### Requirements for building `pscpp` and `psgo`
13+- [PureScript home](http://purescript.org)
14+- [Releases & changelog](https://github.com/purescript/purescript/releases)
15+- [Contributing to PureScript](https://github.com/purescript/purescript/blob/master/CONTRIBUTING.md)
2316
24−* [Haskell Stack](https://docs.haskellstack.org/en/stable/README/) (if you're running macOS 10.14.5+, you can use pre-built binaries from [here](https://github.com/andyarvanitis/purescript-native/releases/))
17+## Resources
2518
26−#### Requirements for using PureScript + purescript-native
19+- [PureScript book](https://leanpub.com/purescript/read)
20+- [Wiki](http://wiki.purescript.org)
21+- [Try PureScript](http://try.purescript.org)
22+- [Pursuit Package Index](http://pursuit.purescript.org/)
2723
28−* A recent version (0.13+) of [purescript](https://github.com/purescript/purescript/releases).
24+## Help!
2925
30−* For `pscpp`, a C++11-capable toolchain, e.g. recent versions of clang, gcc, Microsoft Visual Studio
31− * GNU Make + `psc-package` is the default supported build tool, but you should be able to use your favorite package manager, C++ build system, tools, debuggers, etc.
32−* For `psgo`, the [Go toolchain](https://golang.org) for your system
33− * You can use your favorite PureScript package manager and build tools – but for simplicity, [`spago`](https://github.com/spacchetti/spago) is recommended.
34−
35−
36−#### For more information and a Getting Started guide, please see
37−* [`pscpp`](https://github.com/andyarvanitis/purescript-native/blob/cpp/README-cpp.md)
38−* [`psgo`](https://github.com/andyarvanitis/purescript-native/blob/golang/README-go.md)
39−
40−
41−---
26+- [#purescript IRC @ FreeNode](http://webchat.freenode.net/?channels=purescript)
27+- [PureScript on StackOverflow](http://stackoverflow.com/questions/tagged/purescript)
28+- [Google Group](https://groups.google.com/forum/#!forum/purescript)
29+- [Gitter Channel](https://gitter.im/purescript/purescript?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
Setup.hs+4
@@ -1,2 +1,6 @@
1+module Main where
2+
13import Distribution.Simple
4+
5+main :: IO ()
26main = defaultMain
app/Main.hsdeleted−250
@@ -1,250 +0,0 @@
1−{-# LANGUAGE OverloadedStrings #-}
2−{-# LANGUAGE RankNTypes #-}
3−{-# LANGUAGE TemplateHaskell #-}
4−
5−module Main where
6−
7−import Control.Monad (when)
8−import qualified Control.Monad.Parallel as Par
9−import Data.Aeson
10−import Data.Aeson.Types
11−import Data.Char
12−import Data.FileEmbed (embedFile)
13−import Data.List (delete, intercalate, isPrefixOf, nub, partition, (\\))
14−import Data.Maybe
15−import Data.Monoid ((<>))
16−import Data.Version
17−import Control.Monad.Supply
18−import Control.Monad.Supply.Class
19−import Text.Printf
20−
21−import System.Environment
22−import System.Directory (createDirectoryIfMissing, doesDirectoryExist, doesFileExist, getCurrentDirectory, getModificationTime)
23−import System.FilePath ((</>), joinPath, splitDirectories, takeDirectory)
24−import System.FilePath.Find
25−import System.Process
26−
27−import Data.Text (Text)
28−import qualified Data.Text as T
29−import qualified Data.Text.Encoding as T
30−import qualified Data.Text.Lazy as L
31−import qualified Data.Text.Lazy.Encoding as L
32−import qualified Data.ByteString as B
33−
34−import Development.GitRev
35−
36−import Language.PureScript.AST.Literals
37−import Language.PureScript.CoreFn
38−import Language.PureScript.CoreFn.FromJSON
39−
40−import CodeGen.IL
41−import CodeGen.IL.Common
42−import CodeGen.IL.Printer
43−
44−import Tests
45−
46−data Command = Build | Run (Maybe String)
47−
48−parseJson :: Text -> Value
49−parseJson text
50− | Just fileJson <- decode . L.encodeUtf8 $ L.fromStrict text = fileJson
51− | otherwise = error "Bad json"
52−
53−jsonToModule :: Value -> Module Ann
54−jsonToModule value =
55− case parse moduleFromJSON value of
56− Success (_, r) -> r
57− _ -> error "Failed parsing corefn. Psgo currently supports purescript <= 0.13.8"
58−
59−splitArgs :: [String] -> ([String], Maybe String, [String])
60−splitArgs args =
61− let (opts, files) = partition (isPrefixOf "--") args
62− opts' = (map . map) toLower opts
63− (moduleName, files') =
64− if null files
65− then (Nothing, files)
66− else
67− if "--run" `elem` opts' && length (files) >= 1
68− then do
69− let file0 = head files
70− files' = tail files
71− case file0 of
72− "Main.main" -> (Just "Main", files')
73− "Test.Main.main" -> (Just "Test.Main", files')
74− _ -> (Nothing, files)
75− else (Nothing, files)
76− in (opts, moduleName, files')
77−
78−main :: IO ()
79−main = do
80− args <- getArgs
81− -- let (opts, files) = partition (isPrefixOf "--") args
82− let (opts, moduleName, files) = splitArgs args
83− opts' = (map . map) toLower opts
84− if "--tests" `elem` opts'
85− then runTests
86− else do
87− if "--help" `elem` opts' || "--version" `elem` opts'
88− then do
89− when ("--help" `elem` opts') $ do
90− putStrLn help
91− when ("--version" `elem` opts') $ do
92− let branch = $(gitBranch)
93− details | branch == "golang" = "master, commit " ++ $(gitHash)
94− | otherwise = branch
95− putStrLn $ details ++ if $(gitDirty) then " (DIRTY)" else ""
96− else do
97− if null files
98− then do
99− currentDir <- getCurrentDirectory
100− processFiles opts' [currentDir]
101− else
102− processFiles opts' files
103− if "--run" `elem` opts
104− then runBuildTool $ Run moduleName
105− else when ("--no-build" `notElem` opts) $
106− runBuildTool Build
107− return ()
108− where
109− processFiles :: [String] -> [FilePath] -> IO ()
110− processFiles opts [file] = do
111− isDir <- doesDirectoryExist file
112− if isDir then do
113− files <- find always (fileName ==? corefn) file
114− if null files
115− then errorNoCorefnFiles
116− else generateFiles opts files
117− else generateFiles opts [file]
118− processFiles opts files = do
119− generateFiles opts files
120− basePath :: [FilePath] -> FilePath
121− basePath files =
122− let filepath = takeDirectory (head files) in
123− joinPath $ (init $ splitDirectories filepath)
124− generateFiles :: [String] -> [FilePath] -> IO ()
125− generateFiles opts files = do
126− let baseOutpath = basePath files
127− writeSupportFiles baseOutpath
128− Par.mapM (generateCode opts baseOutpath) files
129− return ()
130− runBuildTool :: Command -> IO ()
131− runBuildTool cmd = do
132− project <- projectEnv
133− case cmd of
134− Build -> do
135− callProcess "go" ["build", T.unpack project </> modPrefix' </> "Main"]
136− Run moduleName -> do
137− callProcess "go" ["run", T.unpack project </> modPrefix' </> fromMaybe "Main" moduleName]
138− return ()
139−
140−generateCode :: [String] -> FilePath -> FilePath -> IO ()
141−generateCode opts baseOutpath jsonFile = do
142− jsonModTime <- getModificationTime jsonFile
143− let filepath = takeDirectory jsonFile
144− dirparts = splitDirectories $ filepath
145− mname = last dirparts
146− basedir = joinPath $ init dirparts
147− mname' = T.pack mname
148− possibleFileName = basedir </> (T.unpack mname') </> implFileName mname'
149− exists <- doesFileExist possibleFileName
150− if exists
151− then do
152− modTime <- getModificationTime possibleFileName
153− when (modTime < jsonModTime) $
154− transpile opts baseOutpath jsonFile
155− else transpile opts baseOutpath jsonFile
156−
157−transpile :: [String] -> FilePath -> FilePath -> IO ()
158−transpile opts baseOutpath jsonFile = do
159− jsonText <- T.decodeUtf8 <$> B.readFile jsonFile
160− project <- projectEnv
161− let module' = jsonToModule $ parseJson jsonText
162− ((_, foreigns, asts, implHeader, implFooter), _) <- runSupplyT 5 (moduleToIL module' project)
163− let mn = moduleNameToIL' $ moduleName module'
164− implementation = prettyPrintIL asts
165− outpath = joinPath [baseOutpath, T.unpack mn]
166− implPath = outpath </> implFileName mn
167− createDirectoryIfMissing True outpath
168− putStrLn implPath
169− B.writeFile implPath $ T.encodeUtf8 (implHeader <> implementation <> implFooter)
170−
171−writeSupportFiles :: FilePath -> IO ()
172−writeSupportFiles baseOutpath = do
173− currentDir <- getCurrentDirectory
174− let outputdir = T.pack $ baseOutpath \\ currentDir
175− ffiOutpath = currentDir </> subdir
176− createDirectoryIfMissing True baseOutpath
177− createDirectoryIfMissing True ffiOutpath
178− writeModuleFile outputdir currentDir $(embedFile "support/go.mod.working")
179− writeModuleFile outputdir baseOutpath $(embedFile "support/go.mod.output")
180− writeModuleFile outputdir ffiOutpath $(embedFile "support/go.mod.ffi-loader")
181− writeLoaderFile ffiOutpath $(embedFile "support/ffi-loader.go")
182− where
183− writeModuleFile :: Text -> FilePath -> B.ByteString -> IO ()
184− writeModuleFile outputdir path modText = do
185− let goModSource = path </> "go.mod"
186− goModSourceExists <- doesFileExist goModSource
187− when (not goModSourceExists) $ do
188− project <- projectEnv
189− let project' = T.unpack project
190− outputdir' = tail $ T.unpack outputdir
191− modText' = T.replace "$PROJECT" project $ T.decodeUtf8 modText
192− replaceLoader = project' </> ffiLoader' <> "=." </> subdir
193− replaceOutput = project' </> modPrefix' <> "=." </> outputdir'
194− B.writeFile goModSource $ T.encodeUtf8 modText'
195− callProcess "go" ["mod", "edit", "-replace", replaceLoader]
196− callProcess "go" ["mod", "edit", "-replace", replaceOutput]
197− callProcess "go" ["clean", "-modcache"]
198− writeLoaderFile :: FilePath -> B.ByteString -> IO ()
199− writeLoaderFile ffiOutpath loaderText = do
200− let loaderSource = ffiOutpath </> "ffi_loader.go"
201− loaderSourceExists <- doesFileExist loaderSource
202− when (not loaderSourceExists) $ do
203− B.writeFile loaderSource loaderText
204−
205−implFileName :: Text -> FilePath
206−implFileName mn = ((\c -> if c == '.' then '_' else c) <$> T.unpack mn) <> ".go"
207−
208−projectEnv :: IO Text
209−projectEnv = do
210− T.pack . fromMaybe defaultProject <$> lookupEnv goproject
211−
212−help :: String
213−help = "Usage: psgo OPTIONS COREFN-FILES\n\
214− \ PureScript to native (via go) compiler\n\n\
215− \Available options:\n\
216− \ --help Show this help text\n\n\
217− \ --version Show the version number\n\n\
218− \ --run Run the generated go code directly, without building an\n\
219− \ executable\n\
220− \ --no-build Generate go source files, but do not build an executable\n\
221− \ --tests Run test cases (under construction)\n\n\
222− \See also:\n\
223− \ purs compile --help\n"
224−
225−corefn :: String
226−corefn = "corefn.json"
227−
228−goSrc :: String
229−goSrc = ".go"
230−
231−goproject :: String
232−goproject = "GOPROJECT"
233−
234−defaultProject :: String
235−defaultProject = "project.localhost"
236−
237−modPrefix' :: String
238−modPrefix' = T.unpack modPrefix
239−
240−ffiLoader' :: String
241−ffiLoader' = T.unpack ffiLoader
242−
243−subdir :: String
244−subdir = T.unpack modLabel
245−
246−errorNoCorefnFiles :: IO ()
247−errorNoCorefnFiles = do
248− ioError . userError $ "no compiled purescript '" <> corefn <> "' files found –\n" <>
249− " make sure to use the '--codegen corefn' option with your purs\n" <>
250− " project build tool"
appveyor.ymlnew file+51
@@ -0,0 +1,51 @@
1+platform: x64
2+version: '{build}'
3+environment:
4+ # Keep the path as short as possible, just in case.
5+ STACK_ROOT: c:\s
6+ RELEASE_USER: purescript
7+ RELEASE_REPO: purescript
8+cache:
9+- c:\s -> appveyor/cache-buster.txt
10+install:
11+- git submodule update --init
12+- ps: Install-Product node 5
13+- npm install -g bower
14+
15+- ps: |
16+ New-Item -ItemType Directory -Force -Path C:\tools
17+ $env:Path += ";C:\tools"
18+ (New-Object Net.WebClient).DownloadFile('https://www.stackage.org/stack/windows-x86_64', 'c:\tools\stack.zip')
19+ pushd c:\tools
20+ 7z x c:\tools\stack.zip stack.exe
21+ popd
22+
23+- stack --no-terminal --verbosity=error setup 1>stack-setup.log 2>&1 || type stack-setup.log
24+
25+build_script:
26+# Override the default build script.
27+- echo ""
28+test_script:
29+- stack -j1 --no-terminal test --pedantic
30+on_success:
31+- ps: |
32+ function UploadFile
33+ {
34+ github-release upload --user $env:RELEASE_USER --repo $env:RELEASE_REPO --tag $env:APPVEYOR_REPO_TAG_NAME --file $args[0] --name $args[0]
35+ }
36+
37+ if ($env:APPVEYOR_REPO_TAG_NAME)
38+ {
39+ bash ./bundle/build.sh win64
40+
41+ (New-Object Net.WebClient).DownloadFile('https://github.com/aktau/github-release/releases/download/v0.6.2/windows-amd64-github-release.zip', 'c:\tools\github-release.zip')
42+ pushd c:\tools
43+ 7z x github-release.zip bin/windows/amd64/github-release.exe
44+ Copy-Item bin/windows/amd64/github-release.exe github-release.exe
45+ popd
46+
47+ pushd bundle
48+ UploadFile win64.tar.gz
49+ UploadFile win64.sha
50+ popd
51+ }
appveyor/cache-buster.txtnew file+8
@@ -0,0 +1,8 @@
1+This file acts as a cache buster for the AppVeyor (Windows CI) build
2+cache. In order to invalidate the AppVeyor build cache, simply make a
3+change to the number at the end of this file and commit.
4+
5+See http://www.appveyor.com/docs/build-cache#cache-dependencies for more
6+information.
7+
8+Increment me to invalidate the cache: 0
bundle/.gitignorenew file+4
@@ -0,0 +1,4 @@
1+build/
2+*.tar.gz
3+*.sha
4+*.md5
bundle/READMEnew file+24
@@ -0,0 +1,24 @@
1+ ____ ____ _ _
2+| _ \ _ _ _ __ ___/ ___| ___ _ __(_)_ __ | |_
3+| |_) | | | | '__/ _ \___ \ / __| '__| | '_ \| __|
4+| __/| |_| | | | __/___) | (__| | | | |_) | |_
5+|_| \__,_|_| \___|____/ \___|_| |_| .__/ \__|
6+ |_|
7+
8+Installation Instructions
9+-------------------------
10+
11+This bundle contains the following executables:
12+
13+- psc The PureScript compiler
14+- psci The PureScript interactive REPL (requires NodeJS)
15+- psc-docs A Markdown documentation generator for PureScript code
16+- psc-bundle Bundles together CommonJS modules produced by `psc` into a
17+ single JavaScript file; useful for running in the browser.
18+- psc-publish Generates documentation packages for uploading to Pursuit
19+- psc-ide-server Provides Editor Support in the form of type information and
20+ autocompletion
21+- psc-ide-client Utility to query psc-ide-server
22+
23+Copy these files anywhere on your PATH.
24+
bundle/build.shnew file+65
@@ -0,0 +1,65 @@
1+## This script can be run on any supported OS to create a binary .tar.gz
2+## bundle.
3+## For Windows, msysgit contains all of the pieces needed to run this script.
4+set -e
5+
6+OS=$1
7+
8+if [ -z $OS ]
9+then
10+ echo "Usage: build.sh osname"
11+ exit 1
12+fi
13+
14+pushd $(stack path --project-root)
15+
16+LOCAL_INSTALL_ROOT=$(stack path --local-install-root)
17+
18+if [ "$OS" = "win64" ]
19+then
20+ BIN_EXT=".exe"
21+else
22+ BIN_EXT=""
23+fi
24+
25+# Make the staging directory
26+mkdir -p bundle/build/purescript
27+
28+# Strip the binaries, and copy them to the staging directory
29+for BIN in psc psci psc-docs psc-publish psc-bundle psc-ide-server psc-ide-client
30+do
31+ FULL_BIN="$LOCAL_INSTALL_ROOT/bin/${BIN}${BIN_EXT}"
32+ if [ "$OS" != "win64" ]
33+ then
34+ strip "$FULL_BIN"
35+ fi
36+ cp "$FULL_BIN" bundle/build/purescript
37+done
38+
39+# Copy extra files to the staging directory
40+cp bundle/README bundle/build/purescript/
41+cp LICENSE bundle/build/purescript/
42+cp INSTALL.md bundle/build/purescript/
43+
44+stack list-dependencies >bundle/build/purescript/dependencies.txt
45+
46+# Make the binary bundle
47+pushd bundle/build > /dev/null
48+tar -zcvf ../${OS}.tar.gz purescript
49+popd > /dev/null
50+
51+# Calculate the SHA hash
52+if [ "$OS" = "win64" ]
53+then
54+ # msys/mingw does not include shasum. :(
55+ SHASUM="openssl dgst -sha1"
56+else
57+ SHASUM="shasum"
58+fi
59+
60+$SHASUM bundle/${OS}.tar.gz > bundle/${OS}.sha
61+
62+# Remove the staging directory
63+rm -rf build/
64+
65+popd > /dev/null
core-tests/.gitignorenew file+3
@@ -0,0 +1,3 @@
1+core-docs.md
2+bower_components/
3+output/
core-tests/bower.jsonnew file+60
@@ -0,0 +1,60 @@
1+{
2+ "name": "core-tests",
3+ "homepage": "https://github.com/purescript/purescript",
4+ "authors": [
5+ "Phil Freeman <paf31@cantab.net>"
6+ ],
7+ "ignore": [
8+ "**/.*",
9+ "node_modules",
10+ "bower_components",
11+ "test",
12+ "tests"
13+ ],
14+ "dependencies": {
15+ "purescript-arrays": "#8c9ada5762",
16+ "purescript-bifunctors": "#9e3b2864ce",
17+ "purescript-console": "#db29da9aca",
18+ "purescript-const": "#cf538a65d8",
19+ "purescript-contravariant": "#9ae6d7c99c",
20+ "purescript-control": "#97096c7e26",
21+ "purescript-distributive": "#ba81c64ffd",
22+ "purescript-eff": "#dbd6c4a415",
23+ "purescript-either": "#54f4efd423",
24+ "purescript-enums": "#9332412e52",
25+ "purescript-exceptions": "#522a0cea50",
26+ "purescript-exists": "#e828c8341e",
27+ "purescript-foldable-traversable": "#df37787855",
28+ "purescript-foreign": "#64890cbbdb",
29+ "purescript-free": "#f8ab7c5f05",
30+ "purescript-functions": "#e417541936",
31+ "purescript-functor-coproducts": "#7654d9dea4",
32+ "purescript-generics": "#d09cb16ca3",
33+ "purescript-globals": "#113ee398be",
34+ "purescript-graphs": "#0b7089afa2",
35+ "purescript-identity": "#204ac5f46a",
36+ "purescript-inject": "#3ae4880bad",
37+ "purescript-integers": "#58d7605dd5",
38+ "purescript-lazy": "#bf4b34d673",
39+ "purescript-maps": "#d9e4c6599a",
40+ "purescript-math": "#99797b6494",
41+ "purescript-maybe": "#1b60a07038",
42+ "purescript-monoid": "#a8c8bb9d73",
43+ "purescript-parallel": "#c7296ab008",
44+ "purescript-prelude": "#318ee857bd",
45+ "purescript-profunctor": "#a649126cea",
46+ "purescript-proxy": "#c494b11bd7",
47+ "purescript-quickcheck": "#4a15c93f12",
48+ "purescript-random": "#68314c21e2",
49+ "purescript-refs": "#f47e1059a3",
50+ "purescript-semirings": "#c40efda15f",
51+ "purescript-sets": "#1eaabf177f",
52+ "purescript-st": "#077d9a2d7e",
53+ "purescript-strings": "#87dd5f1694",
54+ "purescript-tailrec": "#3c11db00ba",
55+ "purescript-transformers": "#2d0a471ce4",
56+ "purescript-tuples": "#4fe689ef93",
57+ "purescript-unfoldable": "#e2382f30d8",
58+ "purescript-validation": "#f43ff0fbdd"
59+ }
60+}
core-tests/test-everything.shnew file+33
@@ -0,0 +1,33 @@
1+#!/usr/bin/env bash
2+
3+set -e
4+
5+force_recompile='false'
6+force_reinstall='false'
7+
8+while getopts 'ci' flag; do
9+ case "${flag}" in
10+ c) force_recompile='true' ;;
11+ i) force_reinstall='true' ;;
12+ *) error "Unexpected option ${flag}" ;;
13+ esac
14+done
15+
16+if [ "$force_reinstall" = "true" ] && [ -d "bower_components" ]; then
17+ echo "Reinstalling core packages..."
18+ rm -r bower_components
19+fi
20+
21+# todo : fix this once core libraries reach 1.0
22+yes 1 | bower i
23+
24+if [ "$force_recompile" = "true" ] && [ -d "output" ]; then
25+ echo "Recompiling..."
26+ rm -r output
27+fi
28+
29+stack exec psc 'tests/**/*.purs' 'bower_components/purescript-*/src/**/*.purs'
30+
31+stack exec psc-docs 'bower_components/purescript-*/src/**/*.purs' > core-docs.md
32+
33+NODE_PATH=output node -e "require('Test.Main').main()"
core-tests/tests/GenericDeriving.pursnew file+30
@@ -0,0 +1,30 @@
1+module Test.GenericDeriving where
2+
3+import Prelude
4+
5+import Control.Monad.Eff (Eff)
6+import Control.Monad.Eff.Console (CONSOLE, log, logShow)
7+import Data.Generic (class Generic, gShow, gEq)
8+import Partial.Unsafe (unsafePartial)
9+
10+data Empty
11+
12+derive instance genericEmpty :: Partial => Generic Empty
13+
14+data A a
15+ = A Number String
16+ | B Int
17+ | C (Array (A a))
18+ | D { "asgård" :: a }
19+ | E Empty
20+
21+derive instance genericA :: (Partial, Generic b) => Generic (A b)
22+
23+newtype X b = X b
24+
25+derive instance genericX :: Generic (X String)
26+
27+main :: forall eff. Eff (console :: CONSOLE | eff) Unit
28+main = unsafePartial do
29+ log $ gShow (D { "asgård": C [ A 1.0 "test", B 42, D { "asgård": true } ] })
30+ logShow $ gEq (C [B 0]) (C [B 0] :: A Empty)
core-tests/tests/Main.pursnew file+9
@@ -0,0 +1,9 @@
1+module Test.Main where
2+
3+import Prelude
4+import Control.Monad.Eff (Eff)
5+import Control.Monad.Eff.Console (CONSOLE)
6+import Test.GenericDeriving as GenericDeriving
7+
8+main :: forall eff. Eff (console :: CONSOLE | eff) Unit
9+main = GenericDeriving.main
default.nixdeleted−23
@@ -1,23 +0,0 @@
1−let
2− haskellNix = import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz) {};
3− nixpkgsSrc = haskellNix.sources.nixpkgs-1903; # has hsc2hs-0.68.4
4−
5− hsc2hsOverlay = self: super: {
6− buildPackages = super.buildPackages // {
7− hsc2hs = super.haskellPackages.hsc2hs;
8− };
9− };
10−
11− nixpkgsArgs = haskellNix.nixpkgsArgs // {
12− overlays = haskellNix.nixpkgsArgs.overlays ++ [ hsc2hsOverlay ];
13− };
14−in
15−{ pkgs ? import nixpkgsSrc nixpkgsArgs
16−}:
17−
18−pkgs.haskell-nix.stackProject {
19− src = pkgs.haskell-nix.haskellLib.cleanGit {
20− name = "purescript-native";
21− src = ./.;
22− };
23−}
examples/.gitignorenew file+1
@@ -0,0 +1 @@
1+shelltest/tests
examples/docs/bower.jsonnew file+20
@@ -0,0 +1,20 @@
1+{
2+ "name": "docs-test-package",
3+ "version": "1.0.0",
4+ "moduleType": [
5+ "node"
6+ ],
7+ "repository": {
8+ "type": "git",
9+ "url": "git://github.com/not-real/not-a-real-repo.git"
10+ },
11+ "ignore": [
12+ "**/.*",
13+ "node_modules",
14+ "bower_components",
15+ "output"
16+ ],
17+ "dependencies": {
18+ },
19+ "license": "MIT"
20+}
examples/docs/bower_components/purescript-prelude/src/Prelude.pursnew file+8
@@ -0,0 +1,8 @@
1+module Prelude where
2+
3+newtype Unit = Unit {}
4+
5+unit :: Unit
6+unit = Unit {}
7+
8+data Boolean2 = True | False
examples/docs/src/Clash.pursnew file+4
@@ -0,0 +1,4 @@
1+module Clash (module Clash1) where
2+
3+import Clash1 as Clash1
4+import Clash2 as Clash2
examples/docs/src/Clash1.pursnew file+3
@@ -0,0 +1,3 @@
1+module Clash1 (module Clash1a) where
2+
3+import Clash1a
examples/docs/src/Clash1a.pursnew file+9
@@ -0,0 +1,9 @@
1+module Clash1a where
2+
3+value :: Int
4+value = 0
5+
6+type Type = Int
7+
8+class TypeClass a where
9+ typeClassMember :: a
examples/docs/src/Clash2.pursnew file+3
@@ -0,0 +1,3 @@
1+module Clash2 (module Clash2a) where
2+
3+import Clash2a
examples/docs/src/Clash2a.pursnew file+9
@@ -0,0 +1,9 @@
1+module Clash2a where
2+
3+value :: String
4+value = "hello"
5+
6+type Type = String
7+
8+class TypeClass a b where
9+ typeClassMember :: a -> b
examples/docs/src/ConstrainedArgument.pursnew file+9
@@ -0,0 +1,9 @@
1+module ConstrainedArgument where
2+
3+class Foo t
4+
5+type WithoutArgs = forall a. (Partial => a) -> a
6+type WithArgs = forall a. (Foo a => a) -> a
7+type MultiWithoutArgs = forall a. ((Partial, Partial) => a) -> a
8+type MultiWithArgs = forall a b. ((Foo a, Foo b) => a) -> a
9+
examples/docs/src/DuplicateNames.pursnew file+9
@@ -0,0 +1,9 @@
1+module DuplicateNames
2+ ( module DuplicateNames
3+ , module Prelude
4+ ) where
5+
6+import Prelude (Unit)
7+
8+unit :: Int
9+unit = 0
examples/docs/src/Example.pursnew file+7
@@ -0,0 +1,7 @@
1+module Example
2+ ( module Prelude
3+ , module Example2
4+ ) where
5+
6+import Prelude (Unit())
7+import Example2 (one)
examples/docs/src/Example2.pursnew file+7
@@ -0,0 +1,7 @@
1+module Example2 where
2+
3+one :: Int
4+one = 1
5+
6+two :: Int
7+two = 2
examples/docs/src/ExplicitTypeSignatures.pursnew file+18
@@ -0,0 +1,18 @@
1+
2+module ExplicitTypeSignatures where
3+
4+-- This should use the explicit type signature so that the type variable name
5+-- is preserved.
6+explicit :: forall something. something -> something
7+explicit x
8+ | true = x
9+ | false = x
10+
11+-- This should use the inferred type.
12+anInt :: _
13+anInt = 0
14+
15+-- This should infer a type.
16+aNumber = 1.0
17+
18+foreign import nestedForAll :: forall c. (forall a b. c)
examples/docs/src/ImportedTwice.pursnew file+13
@@ -0,0 +1,13 @@
1+-- See also an example in the wild: purescript-transformers v0.8.4.
2+-- Control.Monad.RWS.Trans re-exports `lift` from both Control.Monad.Trans
3+-- (where it is originally defined) and Control.Monad.RWS.Class (which
4+-- re-exports it from Control.Monad.Trans).
5+
6+module ImportedTwice
7+ ( module ImportedTwiceA
8+ , module ImportedTwiceB
9+ )
10+ where
11+
12+import ImportedTwiceA
13+import ImportedTwiceB
examples/docs/src/ImportedTwiceA.pursnew file+8
@@ -0,0 +1,8 @@
1+module ImportedTwiceA
2+ ( module ImportedTwiceB )
3+ where
4+
5+import ImportedTwiceB
6+
7+bar :: Int
8+bar = 1
examples/docs/src/ImportedTwiceB.pursnew file+4
@@ -0,0 +1,4 @@
1+module ImportedTwiceB where
2+
3+foo :: Int
4+foo = 0
examples/docs/src/MultiVirtual.pursnew file+6
@@ -0,0 +1,6 @@
1+module MultiVirtual
2+ ( module X )
3+ where
4+
5+import MultiVirtual1 as X
6+import MultiVirtual2 as X
examples/docs/src/MultiVirtual1.pursnew file+4
@@ -0,0 +1,4 @@
1+module MultiVirtual1 where
2+
3+foo :: Int
4+foo = 1
examples/docs/src/MultiVirtual2.pursnew file+9
@@ -0,0 +1,9 @@
1+module MultiVirtual2
2+ ( module MultiVirtual2
3+ , module MultiVirtual3
4+ ) where
5+
6+import MultiVirtual3
7+
8+bar :: Int
9+bar = 2
examples/docs/src/MultiVirtual3.pursnew file+4
@@ -0,0 +1,4 @@
1+module MultiVirtual3 where
2+
3+baz :: Int
4+baz = 3
examples/docs/src/NewOperators.pursnew file+5
@@ -0,0 +1,5 @@
1+module NewOperators
2+ ( module NewOperators2 )
3+ where
4+
5+import NewOperators2
examples/docs/src/NewOperators2.pursnew file+6
@@ -0,0 +1,6 @@
1+module NewOperators2 where
2+
3+infixl 8 _compose as >>>
4+
5+_compose :: forall a b c. (b -> c) -> (a -> b) -> (a -> c)
6+_compose f g x = f (g x)
examples/docs/src/NotAllCtors.pursnew file+5
@@ -0,0 +1,5 @@
1+module NotAllCtors
2+ ( module Prelude )
3+ where
4+
5+import Prelude (Boolean2(True))
examples/docs/src/ReExportedTypeClass.pursnew file+5
@@ -0,0 +1,5 @@
1+module ReExportedTypeClass
2+ ( module SomeTypeClass )
3+ where
4+
5+import SomeTypeClass
examples/docs/src/SolitaryTypeClassMember.pursnew file+6
@@ -0,0 +1,6 @@
1+module SolitaryTypeClassMember
2+ ( module SomeTypeClass )
3+ where
4+
5+import SomeTypeClass (member)
6+
examples/docs/src/SomeTypeClass.pursnew file+5
@@ -0,0 +1,5 @@
1+
2+module SomeTypeClass where
3+
4+class SomeClass a where
5+ member :: a
examples/docs/src/Transitive1.pursnew file+5
@@ -0,0 +1,5 @@
1+module Transitive1
2+ ( module Transitive2 )
3+ where
4+
5+import Transitive2
examples/docs/src/Transitive2.pursnew file+5
@@ -0,0 +1,5 @@
1+module Transitive2
2+ ( module Transitive3 )
3+ where
4+
5+import Transitive3
examples/docs/src/Transitive3.pursnew file+4
@@ -0,0 +1,4 @@
1+module Transitive3 where
2+
3+transitive3 :: Int
4+transitive3 = 0
examples/docs/src/TypeClassWithoutMembers.pursnew file+5
@@ -0,0 +1,5 @@
1+module TypeClassWithoutMembers
2+ ( module TypeClassWithoutMembersIntermediate )
3+ where
4+
5+import TypeClassWithoutMembersIntermediate
examples/docs/src/TypeClassWithoutMembersIntermediate.pursnew file+5
@@ -0,0 +1,5 @@
1+module TypeClassWithoutMembersIntermediate
2+ ( module SomeTypeClass )
3+ where
4+
5+import SomeTypeClass (class SomeClass)
examples/docs/src/TypeOpAliases.pursnew file+18
@@ -0,0 +1,18 @@
1+module TypeOpAliases where
2+
3+type AltFn a b = a -> b
4+
5+infixr 6 type AltFn as ~>
6+
7+foreign import test1 :: forall a b. a ~> b
8+foreign import test2 :: forall a b c. a ~> b ~> c
9+foreign import test3 :: forall a b c d. a ~> (b ~> c) ~> d
10+foreign import test4 :: forall a b c d. ((a ~> b) ~> c) ~> d
11+
12+data Tuple a b = Tuple a b
13+
14+infixl 6 Tuple as ×
15+infixl 6 type Tuple as ×
16+
17+third ∷ ∀ a b c. a × b × c → c
18+third (a × b × c) = c
examples/docs/src/UTF8.pursnew file+7
@@ -0,0 +1,7 @@
1+module UTF8 where
2+
3+import Prelude (Unit, unit)
4+
5+-- | üÜäÄ 😰
6+thing :: Unit
7+thing = unit
examples/docs/src/Virtual.pursnew file+5
@@ -0,0 +1,5 @@
1+module Virtual
2+ ( module VirtualPrelude )
3+ where
4+
5+import Prelude as VirtualPrelude
examples/failing/1071.pursnew file+8
@@ -0,0 +1,8 @@
1+-- @shouldFailWith KindsDoNotUnify
2+module Main where
3+
4+class Foo a b where
5+ foo :: a -> b
6+
7+bar :: forall a. (Foo a) => a -> a
8+bar a = a
examples/failing/1169.pursnew file+12
@@ -0,0 +1,12 @@
1+-- @shouldFailWith IncorrectConstructorArity
2+module Test where
3+
4+data Outer a = Outer a
5+
6+data Inner a b = Inner a b
7+
8+test1 :: forall a b. Outer (Inner a b) -> Boolean
9+test1 (Outer (Inner _)) = true
10+
11+test2 :: forall a b. Inner a b -> Boolean
12+test2 (Inner _) = true
examples/failing/1175.pursnew file+11
@@ -0,0 +1,11 @@
1+-- @shouldFailWith TypesDoNotUnify
2+module X where
3+
4+class Foo where
5+ foo :: String
6+
7+instance f :: Foo where
8+ foo = "a"
9+ where
10+ bar :: String
11+ bar = 1
examples/failing/1310.pursnew file+18
@@ -0,0 +1,18 @@
1+-- @shouldFailWith NoInstanceFound
2+
3+module Issue1310 where
4+
5+import Prelude
6+import Control.Monad.Eff
7+import Control.Monad.Eff.Console
8+
9+class Inject f g where
10+ inj :: forall a. f a -> g a
11+
12+instance inject :: Inject f f where
13+ inj x = x
14+
15+foreign import data Oops :: !
16+
17+main :: forall eff. Eff (oops :: Oops | eff) Unit
18+main = inj (log "Oops")
examples/failing/1570.pursnew file+6
@@ -0,0 +1,6 @@
1+-- @shouldFailWith ExpectedType
2+module M where
3+
4+data F a = F a
5+
6+test = \(x :: F) -> x
examples/failing/1733.pursnew file+6
@@ -0,0 +1,6 @@
1+-- @shouldFailWith UnknownName
2+module Main where
3+
4+import Thingy as Thing
5+
6+main = Thing.doesntExist "hi"
examples/failing/1733/Thingy.pursnew file+4
@@ -0,0 +1,4 @@
1+module Thingy where
2+
3+foo :: Int
4+foo = 1
examples/failing/1825.pursnew file+9
@@ -0,0 +1,9 @@
1+-- @shouldFailWith UnknownName
2+
3+module Main where
4+
5+data W = X | Y | Z
6+
7+bad X a = a
8+bad Y _ = a
9+bad Z a = a
examples/failing/1881.pursnew file+6
@@ -0,0 +1,6 @@
1+-- @shouldFailWith ErrorParsingModule
2+module Main where
3+
4+foo =
5+bar :: Int
6+bar = 3
examples/failing/2128-class.pursnew file+5
@@ -0,0 +1,5 @@
1+-- @shouldFailWith ErrorParsingModule
2+module Main where
3+
4+class Foo a where
5+ foo :: a -> !!!
examples/failing/2128-instance.pursnew file+8
@@ -0,0 +1,8 @@
1+-- @shouldFailWith ErrorParsingModule
2+module Main where
3+
4+class Foo a where
5+ foo :: a
6+
7+instance fooInt :: Foo Int where
8+ foo = !!!
examples/failing/365.pursnew file+14
@@ -0,0 +1,14 @@
1+-- @shouldFailWith CycleInDeclaration
2+module Main where
3+
4+import Prelude
5+
6+class C a where
7+ f :: a -> a
8+ g :: a -> a
9+
10+instance cS :: C String where
11+ f s = s
12+ g = f
13+
14+main = g "Done"
examples/failing/438.pursnew file+15
@@ -0,0 +1,15 @@
1+-- @shouldFailWith PossiblyInfiniteInstance
2+
3+-- See issue 438 for details: this test is mainly here to test that code like
4+-- this doesn't cause the compiler to loop.
5+
6+module Main where
7+
8+import Prelude
9+
10+data Fix f = In (f (Fix f))
11+
12+instance eqFix :: (Eq (f (Fix f))) => Eq (Fix f) where
13+ eq (In f) (In g) = f == g
14+
15+example = In [] == In []
examples/failing/881.pursnew file+13
@@ -0,0 +1,13 @@
1+-- @shouldFailWith DuplicateValueDeclaration
2+module Main where
3+
4+data X = X | Y
5+
6+class Foo a where
7+ foo :: a -> a
8+ bar :: a
9+
10+instance fooX :: Foo X where
11+ foo X = X
12+ bar = X
13+ foo Y = Y
examples/failing/AnonArgument1.pursnew file+5
@@ -0,0 +1,5 @@
1+-- @shouldFailWith IncorrectAnonymousArgument
2+module Main where
3+
4+test :: Int -> Int
5+test = _
examples/failing/AnonArgument2.pursnew file+7
@@ -0,0 +1,7 @@
1+-- @shouldFailWith IncorrectAnonymousArgument
2+module Main where
3+
4+import Prelude
5+
6+test :: Int -> Int
7+test = 1 + 2 * _
examples/failing/AnonArgument3.pursnew file+5
@@ -0,0 +1,5 @@
1+-- @shouldFailWith IncorrectAnonymousArgument
2+module Main where
3+
4+test :: Int -> Int
5+test = 1 + _
examples/failing/ArgLengthMismatch.pursnew file+7
@@ -0,0 +1,7 @@
1+-- @shouldFailWith ArgListLengthsDiffer
2+module ArgLengthMismatch where
3+
4+import Prelude
5+
6+f x y = true
7+f = false
examples/failing/ArrayType.pursnew file+14
@@ -0,0 +1,14 @@
1+-- @shouldFailWith TypesDoNotUnify
2+
3+module Main where
4+
5+import Prelude
6+import Control.Monad.Eff.Console
7+
8+bar :: Number -> Number -> Number
9+bar n m = n + m
10+
11+foo = x `bar` y
12+ where
13+ x = 1
14+ y = []
examples/failing/Arrays.pursnew file+6
@@ -0,0 +1,6 @@
1+-- @shouldFailWith TypesDoNotUnify
2+module Main where
3+
4+foreign import ix :: forall a. Array a -> Int -> a
5+
6+test = \arr -> arr `ix` (0 `ix` 0)
examples/failing/CaseBinderLengthsDiffer.pursnew file+6
@@ -0,0 +1,6 @@
1+-- @shouldFailWith CaseBinderLengthDiffers
2+module Main where
3+
4+test = case 1, 2 of
5+ 1, 2, 3 -> 42
6+ _, _ -> 43
examples/failing/CaseDoesNotMatchAllConstructorArgs.pursnew file+15
@@ -0,0 +1,15 @@
1+-- @shouldFailWith IncorrectConstructorArity
2+module Main where
3+
4+import Prelude
5+
6+data Person = Person String Int
7+
8+data TwoPeople = Two Person Person
9+
10+getName p = case p of
11+ (Two (Person n) (Person n2 a2)) -> n
12+ _ -> "Unknown"
13+
14+
15+name = getName (Two (Person "Jimmy" 20) (Person "" 1))
examples/failing/ConflictingExports.pursnew file+6
@@ -0,0 +1,6 @@
1+-- @shouldFailWith ScopeConflict
2+-- Fails here because re-exporting forces any scope conflicts to be resolved
3+module Main (module A, module B) where
4+
5+ import A
6+ import B
examples/failing/ConflictingExports/A.pursnew file+4
@@ -0,0 +1,4 @@
1+module A where
2+
3+thing :: Int
4+thing = 1
examples/failing/ConflictingExports/B.pursnew file+4
@@ -0,0 +1,4 @@
1+module B where
2+
3+thing :: Int
4+thing = 2
examples/failing/ConflictingImports.pursnew file+9
@@ -0,0 +1,9 @@
1+-- @shouldFailWith ScopeConflict
2+module Main where
3+
4+import A
5+import B
6+
7+-- Error due to referencing `thing` which is in scope as A.thing and B.thing
8+what :: Int
9+what = thing
examples/failing/ConflictingImports/A.pursnew file+4
@@ -0,0 +1,4 @@
1+module A where
2+
3+thing :: Int
4+thing = 1
examples/failing/ConflictingImports/B.pursnew file+4
@@ -0,0 +1,4 @@
1+module B where
2+
3+thing :: Int
4+thing = 2
examples/failing/ConflictingImports2.pursnew file+10
@@ -0,0 +1,10 @@
1+-- @shouldFailWith ScopeConflict
2+module Main where
3+
4+import A (thing)
5+import B (thing)
6+
7+-- Error due to referencing `thing` which is explicitly in scope as A.thing
8+-- and B.thing
9+what :: Int
10+what = thing
examples/failing/ConflictingImports2/A.pursnew file+4
@@ -0,0 +1,4 @@
1+module A where
2+
3+thing :: Int
4+thing = 1
examples/failing/ConflictingImports2/B.pursnew file+4
@@ -0,0 +1,4 @@
1+module B where
2+
3+thing :: Int
4+thing = 2
examples/failing/ConflictingQualifiedImports.pursnew file+7
@@ -0,0 +1,7 @@
1+-- @shouldFailWith ScopeConflict
2+module Main where
3+
4+import A as X
5+import B as X
6+
7+foo = X.thing
examples/failing/ConflictingQualifiedImports/A.pursnew file+4
@@ -0,0 +1,4 @@
1+module A where
2+
3+thing :: Int
4+thing = 1
examples/failing/ConflictingQualifiedImports/B.pursnew file+4
@@ -0,0 +1,4 @@
1+module B where
2+
3+thing :: Int
4+thing = 2
examples/failing/ConflictingQualifiedImports2.pursnew file+5
@@ -0,0 +1,5 @@
1+-- @shouldFailWith ScopeConflict
2+module Main (module X) where
3+
4+import A as X
5+import B as X
examples/failing/ConflictingQualifiedImports2/A.pursnew file+4
@@ -0,0 +1,4 @@
1+module A where
2+
3+thing :: Int
4+thing = 1
examples/failing/ConflictingQualifiedImports2/B.pursnew file+4
@@ -0,0 +1,4 @@
1+module B where
2+
3+thing :: Int
4+thing = 2
examples/failing/ConstraintInference.pursnew file+10
@@ -0,0 +1,10 @@
1+-- @shouldFailWith NoInstanceFound
2+
3+module Main where
4+
5+import Prelude
6+
7+spin :: forall a b. a -> b
8+spin x = spin x
9+
10+test = show <<< spin
examples/failing/DctorOperatorAliasExport.pursnew file+6
@@ -0,0 +1,6 @@
1+-- @shouldFailWith TransitiveDctorExportError
2+module Data.List (List, (:)) where
3+
4+ data List a = Cons a (List a) | Nil
5+
6+ infixr 6 Cons as :
examples/failing/DeclConflictClassCtor.pursnew file+6
@@ -0,0 +1,6 @@
1+-- @shouldFailWith DeclConflict
2+module Main where
3+
4+data T = Fail
5+
6+class Fail
examples/failing/DeclConflictClassSynonym.pursnew file+8
@@ -0,0 +1,8 @@
1+-- @shouldFailWith DeclConflict
2+module Main where
3+
4+import Prelude
5+
6+type Fail = Unit
7+
8+class Fail
examples/failing/DeclConflictClassType.pursnew file+6
@@ -0,0 +1,6 @@
1+-- @shouldFailWith DeclConflict
2+module Main where
3+
4+class Fail
5+
6+data Fail
examples/failing/DeclConflictCtorClass.pursnew file+6
@@ -0,0 +1,6 @@
1+-- @shouldFailWith DeclConflict
2+module Main where
3+
4+class Fail
5+
6+data T = Fail
examples/failing/DeclConflictCtorCtor.pursnew file+6
@@ -0,0 +1,6 @@
1+-- @shouldFailWith DeclConflict
2+module Main where
3+
4+data T1 = Fail
5+
6+data T2 = Fail
examples/failing/DeclConflictSynonymClass.pursnew file+8
@@ -0,0 +1,8 @@
1+-- @shouldFailWith DeclConflict
2+module Main where
3+
4+import Prelude
5+
6+class Fail
7+
8+type Fail = Unit
examples/failing/DeclConflictSynonymType.pursnew file+8
@@ -0,0 +1,8 @@
1+-- @shouldFailWith DeclConflict
2+module Main where
3+
4+import Prelude
5+
6+data Fail
7+
8+type Fail = Unit
examples/failing/DeclConflictTypeClass.pursnew file+6
@@ -0,0 +1,6 @@
1+-- @shouldFailWith DeclConflict
2+module Main where
3+
4+class Fail
5+
6+data Fail
examples/failing/DeclConflictTypeSynonym.pursnew file+8
@@ -0,0 +1,8 @@
1+-- @shouldFailWith DeclConflict
2+module Main where
3+
4+import Prelude
5+
6+type Fail = Unit
7+
8+data Fail
examples/failing/DeclConflictTypeType.pursnew file+6
@@ -0,0 +1,6 @@
1+-- @shouldFailWith DeclConflict
2+module Main where
3+
4+data Fail
5+
6+data Fail
examples/failing/Do.pursnew file+12
@@ -0,0 +1,12 @@
1+-- @shouldFailWith InvalidDoBind
2+-- @shouldFailWith InvalidDoLet
3+module Main where
4+
5+import Prelude
6+
7+test1 = do let x = 1
8+
9+test2 y = do x <- y
10+
11+test3 = do pure 1
12+ pure 2
examples/failing/DoNotSuggestComposition.pursnew file+13
@@ -0,0 +1,13 @@
1+-- @shouldFailWith TypesDoNotUnify
2+-- TODO: Check that this does not produce a "function composition is (<<<)"
3+-- suggestion.
4+module DoNotSuggestComposition where
5+
6+import Prelude
7+
8+x = { y: 3 }
9+
10+foo :: String -> String
11+foo y = y
12+
13+bar = foo x
examples/failing/DoNotSuggestComposition2.pursnew file+7
@@ -0,0 +1,7 @@
1+-- @shouldFailWith CannotApplyFunction
2+-- TODO: Check that this does not produce a "function composition is (<<<)"
3+-- suggestion.
4+
5+module DoNotSuggestComposition2 where
6+
7+foo = let x = { y: 3 } in x 2
examples/failing/DuplicateDeclarationsInLet.pursnew file+12
@@ -0,0 +1,12 @@
1+-- @shouldFailWith OverlappingNamesInLet
2+module Main where
3+
4+import Prelude
5+
6+foo = a
7+ where
8+ a :: Number
9+ a = 1
10+
11+ a :: Number
12+ a = 2
examples/failing/DuplicateProperties1.pursnew file+12
@@ -0,0 +1,12 @@
1+-- @shouldFailWith TypesDoNotUnify
2+module DuplicateProperties where
3+
4+import Prelude
5+
6+foreign import data Test :: # * -> *
7+
8+foreign import subtractX :: forall r. Test (x :: Unit | r) -> Test r
9+
10+foreign import hasX :: Test (x :: Unit, y :: Unit)
11+
12+baz = subtractX (subtractX hasX)
examples/failing/DuplicateProperties2.pursnew file+12
@@ -0,0 +1,12 @@
1+-- @shouldFailWith DuplicateLabel
2+module DuplicateProperties where
3+
4+import Prelude
5+
6+foreign import data Test :: # * -> *
7+
8+foreign import subtractX :: forall r. Test (x :: Unit | r) -> Test r
9+
10+foreign import hasX :: forall r. Test (x :: Unit, y :: Unit | r)
11+
12+baz = subtractX (subtractX hasX)
examples/failing/DuplicateTypeVars.pursnew file+6
@@ -0,0 +1,6 @@
1+-- @shouldFailWith DuplicateTypeArgument
2+module Main where
3+
4+import Prelude
5+
6+type Foo a a = a
examples/failing/Eff.pursnew file+13
@@ -0,0 +1,13 @@
1+-- @shouldFailWith TypesDoNotUnify
2+module Main where
3+
4+import Prelude
5+import Control.Monad.Eff
6+import Control.Monad.ST
7+import Control.Monad.Eff.Console
8+
9+test = pureST (do
10+ ref <- newSTRef 0
11+ log "ST"
12+ modifySTRef ref $ \n -> n + 1
13+ readSTRef ref)
examples/failing/EmptyCase.pursnew file+4
@@ -0,0 +1,4 @@
1+-- @shouldFailWith ErrorParsingModule
2+module Main where
3+
4+error err = case err of \_ -> 1
examples/failing/EmptyClass.pursnew file+7
@@ -0,0 +1,7 @@
1+-- @shouldFailWith ErrorParsingModule
2+module Main where
3+
4+class Foo x where
5+
6+bar :: String
7+bar = "hello"
examples/failing/EmptyDo.pursnew file+6
@@ -0,0 +1,6 @@
1+-- @shouldFailWith ErrorParsingModule
2+
3+module Main where
4+
5+main = do
6+
examples/failing/ExportConflictClass.pursnew file+5
@@ -0,0 +1,5 @@
1+-- @shouldFailWith ExportConflict
2+module C (module A, module B) where
3+
4+import A as A
5+import B as B
examples/failing/ExportConflictClass/A.pursnew file+3
@@ -0,0 +1,3 @@
1+module A where
2+
3+class X
examples/failing/ExportConflictClass/B.pursnew file+3
@@ -0,0 +1,3 @@
1+module B where
2+
3+class X
examples/failing/ExportConflictCtor.pursnew file+5
@@ -0,0 +1,5 @@
1+-- @shouldFailWith ExportConflict
2+module C (module A, module B) where
3+
4+import A as A
5+import B as B
examples/failing/ExportConflictCtor/A.pursnew file+3
@@ -0,0 +1,3 @@
1+module A where
2+
3+data T1 = X
examples/failing/ExportConflictCtor/B.pursnew file+3
@@ -0,0 +1,3 @@
1+module B where
2+
3+data T2 = X
examples/failing/ExportConflictType.pursnew file+5
@@ -0,0 +1,5 @@
1+-- @shouldFailWith ExportConflict
2+module C (module A, module B) where
3+
4+import A as A
5+import B as B
examples/failing/ExportConflictType/A.pursnew file+3
@@ -0,0 +1,3 @@
1+module A where
2+
3+data T
examples/failing/ExportConflictType/B.pursnew file+3
@@ -0,0 +1,3 @@
1+module B where
2+
3+data T
examples/failing/ExportConflictTypeOp.pursnew file+5
@@ -0,0 +1,5 @@
1+-- @shouldFailWith ExportConflict
2+module C (module A, module B) where
3+
4+import A as A
5+import B as B
examples/failing/ExportConflictTypeOp/A.pursnew file+5
@@ -0,0 +1,5 @@
1+module A where
2+
3+type T1 a b = a -> b
4+
5+infixr 4 type T1 as ??
examples/failing/ExportConflictTypeOp/B.pursnew file+5
@@ -0,0 +1,5 @@
1+module B where
2+
3+type T2 a b = a -> b
4+
5+infixr 4 type T2 as ??
examples/failing/ExportConflictValue.pursnew file+5
@@ -0,0 +1,5 @@
1+-- @shouldFailWith ExportConflict
2+module C (module A, module B) where
3+
4+import A as A
5+import B as B
examples/failing/ExportConflictValue/A.pursnew file+4
@@ -0,0 +1,4 @@
1+module A where
2+
3+x :: Boolean
4+x = true
examples/failing/ExportConflictValue/B.pursnew file+4
@@ -0,0 +1,4 @@
1+module B where
2+
3+x :: Boolean
4+x = false
examples/failing/ExportConflictValueOp.pursnew file+5
@@ -0,0 +1,5 @@
1+-- @shouldFailWith ExportConflict
2+module C (module A, module B) where
3+
4+import A as A
5+import B as B
examples/failing/ExportConflictValueOp/A.pursnew file+6
@@ -0,0 +1,6 @@
1+module A where
2+
3+f1 :: forall a b. a -> b -> a
4+f1 x _ = x
5+
6+infix 0 f1 as !!
examples/failing/ExportConflictValueOp/B.pursnew file+6
@@ -0,0 +1,6 @@
1+module B where
2+
3+f2 :: forall a b. a -> b -> a
4+f2 x _ = x
5+
6+infix 0 f2 as !!
examples/failing/ExportExplicit.pursnew file+8
@@ -0,0 +1,8 @@
1+-- @shouldFailWith UnknownExport
2+-- should fail as z does not exist in the module
3+module M1 (x, y, z) where
4+
5+import Prelude
6+
7+x = 1
8+y = 2
examples/failing/ExportExplicit1.pursnew file+12
@@ -0,0 +1,12 @@
1+-- @shouldFailWith UnknownName
2+module Main where
3+
4+import M1
5+import Control.Monad.Eff.Console (log)
6+
7+testX = X
8+
9+-- should fail as Y constructor is not exported from M1
10+testY = Y
11+
12+main = log "Done"
examples/failing/ExportExplicit1/M1.pursnew file+3
@@ -0,0 +1,3 @@
1+module M1 (X(X)) where
2+
3+data X = X | Y
examples/failing/ExportExplicit2.pursnew file+8
@@ -0,0 +1,8 @@
1+-- @shouldFailWith UnknownExportDataConstructor
2+-- should fail as Y is not a data constructor for X
3+module M1 (X(Y)) where
4+
5+import Prelude
6+
7+data X = X
8+data Y = Y
examples/failing/ExportExplicit3.pursnew file+10
@@ -0,0 +1,10 @@
1+-- @shouldFailWith UnknownName
2+module Main where
3+
4+import M1 as M
5+import Control.Monad.Eff.Console (log)
6+
7+-- should fail as Z is not exported from M1
8+testZ = M.Z
9+
10+main = log "Done"
examples/failing/ExportExplicit3/M1.pursnew file+4
@@ -0,0 +1,4 @@
1+module M1 (X(..)) where
2+
3+data X = X | Y
4+data Z = Z
examples/failing/ExtraRecordField.pursnew file+9
@@ -0,0 +1,9 @@
1+-- @shouldFailWith AdditionalProperty
2+module ExtraRecordField where
3+
4+import Prelude ((<>))
5+
6+full :: { first :: String, last :: String } -> String
7+full p = p.first <> " " <> p.last
8+
9+oops = full { first: "Jane", last: "Smith", age: 29 }
examples/failing/Foldable.pursnew file+17
@@ -0,0 +1,17 @@
1+-- @shouldFailWith CycleInDeclaration
2+module Main where
3+
4+import Prelude
5+
6+class Foldable f where
7+ fold :: forall a b. (a -> b -> b) -> b -> f a -> b
8+ size :: forall a. f a -> Number
9+
10+data L a = C a (L a) | N
11+
12+instance foldableL :: Foldable L where
13+ fold _ z N = z
14+ fold f z (C x xs) = x `f` (fold f z xs)
15+ size = fold (const ((+) 1.0)) 0.0
16+
17+x = size (C 1 (C 2 (C 3 N)))
examples/failing/Generalization1.pursnew file+11
@@ -0,0 +1,11 @@
1+-- @shouldFailWith CannotGeneralizeRecursiveFunction
2+module Main where
3+
4+import Prelude
5+
6+foo 0 x _ = x
7+foo n x y = x <> bar (n - 1) x y
8+
9+bar 0 x _ = x
10+bar n x y = y <> foo (n - 1) x y
11+
examples/failing/Generalization2.pursnew file+8
@@ -0,0 +1,8 @@
1+-- @shouldFailWith CannotGeneralizeRecursiveFunction
2+module Main where
3+
4+import Prelude
5+
6+test n m | n <= 1 = m
7+ | otherwise = test (n - 1) (m <> m)
8+
examples/failing/ImportExplicit.pursnew file+4
@@ -0,0 +1,4 @@
1+-- @shouldFailWith UnknownImport
2+module Main where
3+
4+import M1 (X(..))
examples/failing/ImportExplicit/M1.pursnew file+3
@@ -0,0 +1,3 @@
1+module M1 where
2+
3+foo = "foo"
examples/failing/ImportExplicit2.pursnew file+4
@@ -0,0 +1,4 @@
1+-- @shouldFailWith UnknownImportDataConstructor
2+module Main where
3+
4+import M1 (X(Z, Q))
examples/failing/ImportExplicit2/M1.pursnew file+3
@@ -0,0 +1,3 @@
1+module M1 where
2+
3+data X = Y
examples/failing/ImportHidingModule.pursnew file+4
@@ -0,0 +1,4 @@
1+-- @shouldFailWith ImportHidingModule
2+module Main where
3+
4+import B hiding (module A)
examples/failing/ImportHidingModule/A.pursnew file+2
@@ -0,0 +1,2 @@
1+module A where
2+x = 1
examples/failing/ImportHidingModule/B.pursnew file+3
@@ -0,0 +1,3 @@
1+module B (module B, module A) where
2+import A
3+y = 1
examples/failing/ImportModule.pursnew file+4
@@ -0,0 +1,4 @@
1+-- @shouldFailWith UnknownName
2+module Main where
3+
4+import M1
examples/failing/ImportModule/M2.pursnew file+3
@@ -0,0 +1,3 @@
1+module M2 where
2+
3+data X = X
examples/failing/InfiniteKind.pursnew file+5
@@ -0,0 +1,5 @@
1+-- @shouldFailWith InfiniteKind
2+
3+module Main where
4+
5+data F a = F (a a)
examples/failing/InfiniteType.pursnew file+5
@@ -0,0 +1,5 @@
1+-- @shouldFailWith InfiniteType
2+
3+module Main where
4+
5+f a = a a
examples/failing/InstanceExport.pursnew file+7
@@ -0,0 +1,7 @@
1+-- @shouldFailWith TransitiveExportError
2+module Test where
3+
4+import InstanceExport
5+import Prelude
6+
7+test = f $ S "Test"
examples/failing/InstanceExport/InstanceExport.pursnew file+11
@@ -0,0 +1,11 @@
1+module InstanceExport (S(..), f) where
2+
3+import Prelude
4+
5+newtype S = S String
6+
7+class F a where
8+ f :: a -> String
9+
10+instance fs :: F S where
11+ f (S s) = s
examples/failing/IntOutOfRange.pursnew file+6
@@ -0,0 +1,6 @@
1+-- @shouldFailWith IntOutOfRange
2+
3+module Main where
4+
5+n :: Int
6+n = 2147483648
examples/failing/InvalidOperatorInBinder.pursnew file+12
@@ -0,0 +1,12 @@
1+-- @shouldFailWith InvalidOperatorInBinder
2+module Main where
3+
4+data List a = Cons a (List a) | Nil
5+
6+cons ∷ ∀ a. a → List a → List a
7+cons = Cons
8+
9+infixl 6 cons as :
10+
11+get ∷ ∀ a. List a → a
12+get (_ : x : _) = x
examples/failing/KindError.pursnew file+6
@@ -0,0 +1,6 @@
1+-- @shouldFailWith KindsDoNotUnify
2+module Main where
3+
4+import Prelude
5+
6+data KindError f a = One f | Two (f a)
examples/failing/KindStar.pursnew file+8
@@ -0,0 +1,8 @@
1+-- @shouldFailWith ExpectedType
2+
3+module X where
4+
5+data List a = Nil | Cons a (List a)
6+
7+test :: List
8+test = Nil
examples/failing/LeadingZeros1.pursnew file+6
@@ -0,0 +1,6 @@
1+-- @shouldFailWith ErrorParsingModule
2+module Main where
3+
4+import Prelude
5+
6+x = 01
examples/failing/LeadingZeros2.pursnew file+6
@@ -0,0 +1,6 @@
1+-- @shouldFailWith ErrorParsingModule
2+module Main where
3+
4+import Prelude
5+
6+x = 00.1
examples/failing/Let.pursnew file+6
@@ -0,0 +1,6 @@
1+-- @shouldFailWith CycleInDeclaration
2+module Main where
3+
4+import Prelude
5+
6+test = let x = x in x
examples/failing/MPTCs.pursnew file+10
@@ -0,0 +1,10 @@
1+-- @shouldFailWith KindsDoNotUnify
2+module Main where
3+
4+import Prelude
5+
6+class Foo a where
7+ f :: a -> a
8+
9+instance fooStringString :: Foo String String where
10+ f a = a
examples/failing/MissingClassExport.pursnew file+7
@@ -0,0 +1,7 @@
1+-- @shouldFailWith TransitiveExportError
2+module Test (bar) where
3+
4+import Prelude
5+
6+class Foo a where
7+ bar :: a -> a
examples/failing/MissingClassMemberExport.pursnew file+7
@@ -0,0 +1,7 @@
1+-- @shouldFailWith TransitiveExportError
2+module Test (class Foo) where
3+
4+import Prelude
5+
6+class Foo a where
7+ bar :: a -> a
examples/failing/MissingRecordField.pursnew file+10
@@ -0,0 +1,10 @@
1+-- @shouldFailWith PropertyIsMissing
2+module MissingRecordField where
3+
4+import Prelude ((>))
5+
6+john = { first: "John", last: "Smith" }
7+
8+isOver50 p = p.age > 50.0
9+
10+result = isOver50 john
examples/failing/MultipleErrors.pursnew file+13
@@ -0,0 +1,13 @@
1+-- @shouldFailWith TypesDoNotUnify
2+-- @shouldFailWith TypesDoNotUnify
3+module MultipleErrors where
4+
5+import Prelude
6+
7+foo :: Int -> Int
8+foo 0 = "Test"
9+foo n = bar (n - 1)
10+
11+bar :: Int -> Int
12+bar 0 = "Test"
13+bar n = foo (n - 1)
examples/failing/MultipleErrors2.pursnew file+9
@@ -0,0 +1,9 @@
1+-- @shouldFailWith UnknownName
2+-- @shouldFailWith UnknownName
3+module MultipleErrors2 where
4+
5+import Prelude
6+
7+foo = itDoesntExist
8+
9+bar = neitherDoesThis
examples/failing/MultipleTypeOpFixities.pursnew file+9
@@ -0,0 +1,9 @@
1+-- @shouldFailWith MultipleTypeOpFixities
2+module MultipleTypeOpFixities where
3+
4+import Prelude
5+
6+type Op x y = Op x y
7+
8+infix 2 type Op as !?
9+infix 2 type Op as !?
examples/failing/MultipleValueOpFixities.pursnew file+9
@@ -0,0 +1,9 @@
1+-- @shouldFailWith MultipleValueOpFixities
2+module MultipleValueOpFixities where
3+
4+import Prelude
5+
6+add x y = x + y
7+
8+infix 2 add as !?
9+infix 2 add as !?
examples/failing/MutRec.pursnew file+9
@@ -0,0 +1,9 @@
1+-- @shouldFailWith CycleInDeclaration
2+-- @shouldFailWith CycleInDeclaration
3+module MutRec where
4+
5+import Prelude
6+
7+x = y
8+
9+y = x
examples/failing/MutRec2.pursnew file+6
@@ -0,0 +1,6 @@
1+-- @shouldFailWith CycleInDeclaration
2+module Main where
3+
4+import Prelude
5+
6+x = x
examples/failing/NewtypeMultiArgs.pursnew file+6
@@ -0,0 +1,6 @@
1+-- @shouldFailWith InvalidNewtype
2+module Main where
3+
4+import Prelude
5+
6+newtype Thing = Thing String Boolean
examples/failing/NewtypeMultiCtor.pursnew file+6
@@ -0,0 +1,6 @@
1+-- @shouldFailWith InvalidNewtype
2+module Main where
3+
4+import Prelude
5+
6+newtype Thing = Thing String | Other
examples/failing/NullaryAbs.pursnew file+6
@@ -0,0 +1,6 @@
1+-- @shouldFailWith ErrorParsingModule
2+module Main where
3+
4+import Prelude
5+
6+func = \ -> "no"
examples/failing/Object.pursnew file+8
@@ -0,0 +1,8 @@
1+-- @shouldFailWith PropertyIsMissing
2+module Main where
3+
4+import Prelude
5+
6+test o = o.foo
7+
8+test1 = test {}
examples/failing/OperatorAliasNoExport.pursnew file+7
@@ -0,0 +1,7 @@
1+-- @shouldFailWith TransitiveExportError
2+module Test ((?!)) where
3+
4+infixl 4 what as ?!
5+
6+what :: forall a b. a -> b -> a
7+what a _ = a
examples/failing/OperatorSections.pursnew file+8
@@ -0,0 +1,8 @@
1+-- @shouldFailWith CannotApplyFunction
2+module Main where
3+
4+import Prelude
5+
6+main = do
7+ (true `not` _)
8+
examples/failing/OrphanInstance.pursnew file+7
@@ -0,0 +1,7 @@
1+-- @shouldFailWith OrphanInstance
2+module Test where
3+
4+import Class
5+
6+instance cBoolean :: C Boolean where
7+ op a = a
examples/failing/OrphanInstance/Class.pursnew file+4
@@ -0,0 +1,4 @@
1+module Class where
2+
3+class C a where
4+ op :: a -> a
examples/failing/OrphanTypeDecl.pursnew file+4
@@ -0,0 +1,4 @@
1+-- @shouldFailWith OrphanTypeDeclaration
2+module OrphanTypeDecl where
3+
4+fn :: Number -> Boolean
examples/failing/OverlappingArguments.pursnew file+6
@@ -0,0 +1,6 @@
1+-- @shouldFailWith OverlappingArgNames
2+module OverlappingArguments where
3+
4+import Prelude
5+
6+f x x = x
examples/failing/OverlappingBinders.pursnew file+9
@@ -0,0 +1,9 @@
1+-- @shouldFailWith OverlappingArgNames
2+module OverlappingBinders where
3+
4+import Prelude
5+
6+data S a = S a (S a)
7+
8+f x = case x of
9+ (S y (S y@(S z zs))) -> y
examples/failing/OverlappingVars.pursnew file+15
@@ -0,0 +1,15 @@
1+-- @shouldFailWith NoInstanceFound
2+module Main where
3+
4+import Prelude
5+
6+class OverlappingVars a where
7+ f :: a -> a
8+
9+data Foo a b = Foo a b
10+
11+instance overlappingVarsFoo :: OverlappingVars (Foo a a) where
12+ f a = a
13+
14+test = f (Foo "" 0)
15+
examples/failing/ProgrammableTypeErrors.pursnew file+16
@@ -0,0 +1,16 @@
1+-- @shouldFailWith NoInstanceFound
2+
3+module Main where
4+
5+import Prelude
6+import Control.Monad.Eff (Eff)
7+import Control.Monad.Eff.Console (log)
8+
9+class MyShow a where
10+ myShow :: a -> String
11+
12+instance cannotShowFunctions :: Fail "Cannot show functions" => MyShow (a -> b) where
13+ myShow _ = "unreachable"
14+
15+main :: Eff _ _
16+main = log (myShow (_ + 1))
examples/failing/Rank2Types.pursnew file+8
@@ -0,0 +1,8 @@
1+-- @shouldFailWith TypesDoNotUnify
2+module Main where
3+
4+import Prelude
5+
6+foreign import test :: (forall a. a -> a) -> Number
7+
8+test1 = test (\n -> n + 1)
examples/failing/RequiredHiddenType.pursnew file+9
@@ -0,0 +1,9 @@
1+-- @shouldFailWith TransitiveExportError
2+-- exporting `a` should fail as `A` is hidden
3+module Foo (B(..), a, b) where
4+
5+data A = A
6+data B = B
7+
8+a = A
9+b = B
examples/failing/Reserved.pursnew file+7
@@ -0,0 +1,7 @@
1+-- @shouldFailWith ErrorParsingModule
2+module Main where
3+
4+import Prelude
5+
6+(<) :: Number -> Number -> Number
7+(<) a b = !(a >= b)
examples/failing/RowConstructors1.pursnew file+9
@@ -0,0 +1,9 @@
1+-- @shouldFailWith KindsDoNotUnify
2+module Main where
3+
4+import Control.Monad.Eff.Console (log)
5+
6+data Foo = Bar
7+type Baz = { | Foo }
8+
9+main = log "Done"
examples/failing/RowConstructors2.pursnew file+9
@@ -0,0 +1,9 @@
1+-- @shouldFailWith KindsDoNotUnify
2+module Main where
3+
4+import Control.Monad.Eff.Console (log)
5+
6+type Foo r = (x :: Number | r)
7+type Bar = { | Foo }
8+
9+main = log "Done"
examples/failing/RowConstructors3.pursnew file+9
@@ -0,0 +1,9 @@
1+-- @shouldFailWith KindsDoNotUnify
2+module Main where
3+
4+import Control.Monad.Eff.Console (log)
5+
6+type Foo = { x :: Number }
7+type Bar = { | Foo }
8+
9+main = log "Done"
examples/failing/SkolemEscape.pursnew file+8
@@ -0,0 +1,8 @@
1+-- @shouldFailWith EscapedSkolem
2+module Main where
3+
4+import Prelude
5+
6+foreign import foo :: (forall a. a -> a) -> Number
7+
8+test = \x -> foo x
examples/failing/SkolemEscape2.pursnew file+10
@@ -0,0 +1,10 @@
1+-- @shouldFailWith EscapedSkolem
2+module Main where
3+
4+import Prelude
5+import Control.Monad.Eff
6+import Control.Monad.ST
7+
8+test _ = do
9+ r <- runST (newSTRef 0)
10+ pure 0
examples/failing/SuggestComposition.pursnew file+7
@@ -0,0 +1,7 @@
1+-- @shouldFailWith TypesDoNotUnify
2+-- TODO: Ensure the correct suggestion is produced.
3+module SuggestComposition where
4+
5+import Prelude
6+
7+f = g . g where g = (_ + 1)
examples/failing/Superclasses1.pursnew file+14
@@ -0,0 +1,14 @@
1+-- @shouldFailWith NoInstanceFound
2+module Main where
3+
4+import Prelude
5+
6+class Su a where
7+ su :: a -> a
8+
9+class (Su a) <= Cl a where
10+ cl :: a -> a -> a
11+
12+instance clNumber :: Cl Number where
13+ cl n m = n + m
14+
examples/failing/Superclasses2.pursnew file+13
@@ -0,0 +1,13 @@
1+-- @shouldFailWith CycleInTypeSynonym
2+-- TODO: Should this have its own error, perhaps CycleInTypeClassDeclaration?
3+module CycleInSuperclasses where
4+
5+import Prelude
6+
7+class (Foo a) <= Bar a
8+
9+class (Bar a) <= Foo a
10+
11+instance barString :: Bar String
12+
13+instance fooString :: Foo String
examples/failing/Superclasses3.pursnew file+8
@@ -0,0 +1,8 @@
1+-- @shouldFailWith UndefinedTypeVariable
2+module UnknownSuperclassTypeVar where
3+
4+import Prelude
5+
6+class Foo a
7+
8+class (Foo b) <= Bar a
examples/failing/Superclasses5.pursnew file+26
@@ -0,0 +1,26 @@
1+-- @shouldFailWith NoInstanceFound
2+
3+module Main where
4+
5+import Prelude
6+import Control.Monad.Eff.Console (logShow)
7+
8+class Su a where
9+ su :: a -> a
10+
11+class (Su (Array a)) <= Cl a where
12+ cl :: a -> a -> a
13+
14+instance suNumber :: Su Number where
15+ su n = n + 1.0
16+
17+instance suArray :: (Su a) => Su (Array a) where
18+ su [x] = [su x]
19+
20+instance clNumber :: Cl Number where
21+ cl n m = n + m
22+
23+test :: forall a. (Cl a) => a -> Array a
24+test x = su [cl x x]
25+
26+main = logShow $ test 10.0
examples/failing/TopLevelCaseNoArgs.pursnew file+8
@@ -0,0 +1,8 @@
1+-- @shouldFailWith DuplicateValueDeclaration
2+module Main where
3+
4+import Prelude
5+
6+foo :: Number
7+foo = 1
8+foo = 2
examples/failing/TransitiveDctorExport.pursnew file+5
@@ -0,0 +1,5 @@
1+-- @shouldFailWith TransitiveExportError
2+module Main (Y(..)) where
3+
4+type X = Int
5+data Y = Y X
examples/failing/TransitiveSynonymExport.pursnew file+5
@@ -0,0 +1,5 @@
1+-- @shouldFailWith TransitiveExportError
2+module Main (Y()) where
3+
4+type X = Int
5+type Y = X
examples/failing/TypeClassInstances.pursnew file+11
@@ -0,0 +1,11 @@
1+-- @shouldFailWith MissingClassMember
2+module Main where
3+
4+import Prelude
5+
6+class A a where
7+ a :: a -> String
8+ b :: a -> Number
9+
10+instance aString :: A String where
11+ a s = s
examples/failing/TypeClasses2.pursnew file+9
@@ -0,0 +1,9 @@
1+-- @shouldFailWith NoInstanceFound
2+module Main where
3+
4+import Prelude ()
5+
6+class Show a where
7+ show :: a -> String
8+
9+test = show "testing"
examples/failing/TypeError.pursnew file+6
@@ -0,0 +1,6 @@
1+-- @shouldFailWith TypesDoNotUnify
2+module Main where
3+
4+import Prelude
5+
6+test = 1 <> "A"
examples/failing/TypeOperatorAliasNoExport.pursnew file+6
@@ -0,0 +1,6 @@
1+-- @shouldFailWith TransitiveExportError
2+module Test (type (×)) where
3+
4+data Tuple a b = Tuple a b
5+
6+infixl 6 type Tuple as ×
examples/failing/TypeSynonyms.pursnew file+8
@@ -0,0 +1,8 @@
1+-- @shouldFailWith CycleInTypeSynonym
2+module Main where
3+
4+import Prelude
5+
6+type T1 = Array T2
7+
8+type T2 = T1
examples/failing/TypeSynonyms2.pursnew file+12
@@ -0,0 +1,12 @@
1+-- @shouldFailWith TypeSynonymInstance
2+module Main where
3+
4+import Prelude
5+
6+class Foo a where
7+ foo :: a -> String
8+
9+type Bar = String
10+
11+instance fooBar :: Foo Bar where
12+ foo s = s
examples/failing/TypeSynonyms3.pursnew file+12
@@ -0,0 +1,12 @@
1+-- @shouldFailWith TypeSynonymInstance
2+module Main where
3+
4+import Prelude
5+
6+class Foo a where
7+ foo :: a -> String
8+
9+type Bar = String
10+
11+instance fooBar :: Foo Bar where
12+ foo s = s
examples/failing/TypeSynonyms4.pursnew file+11
@@ -0,0 +1,11 @@
1+-- @shouldFailWith PartiallyAppliedSynonym
2+module TypeSynonyms4 where
3+
4+import Prelude
5+
6+type F x y = x -> y
7+
8+type G x = F x
9+
10+f :: G String String -> String
11+f k = k "Done"
examples/failing/TypeSynonyms5.pursnew file+6
@@ -0,0 +1,6 @@
1+-- @shouldFailWith CycleInTypeSynonym
2+module Main where
3+
4+import Prelude
5+
6+type T = T
examples/failing/TypeWildcards1.pursnew file+7
@@ -0,0 +1,7 @@
1+-- @shouldFailWith ErrorParsingModule
2+module TypeWildcards where
3+
4+import Prelude
5+
6+type Test = _
7+
examples/failing/TypeWildcards2.pursnew file+7
@@ -0,0 +1,7 @@
1+-- @shouldFailWith ErrorParsingModule
2+module TypeWildcards where
3+
4+import Prelude
5+
6+data Test = Test _
7+
examples/failing/TypeWildcards3.pursnew file+10
@@ -0,0 +1,10 @@
1+-- @shouldFailWith ErrorParsingModule
2+module TypeWildcards where
3+
4+import Prelude
5+
6+data Foo a = Foo
7+
8+instance showFoo :: Show (Foo _) where
9+ show Foo = "Foo"
10+
examples/failing/TypedBinders.pursnew file+10
@@ -0,0 +1,10 @@
1+-- @shouldFailWith ErrorParsingModule
2+module Main where
3+
4+import Control.Monad.Eff.Console (log)
5+
6+test = (\f :: Int -> Int -> f 10) id
7+
8+main = do
9+ let t1 = test
10+ log "Done"
examples/failing/TypedBinders2.pursnew file+9
@@ -0,0 +1,9 @@
1+-- @shouldFailWith TypesDoNotUnify
2+module Main where
3+
4+import Prelude
5+import Control.Monad.Eff.Console (log)
6+
7+main = do
8+ s :: String <- log "Foo"
9+ log "Done"
examples/failing/TypedBinders3.pursnew file+13
@@ -0,0 +1,13 @@
1+-- @shouldFailWith TypesDoNotUnify
2+module Main where
3+
4+import Prelude
5+import Control.Monad.Eff.Console (log)
6+
7+test = case 1 of
8+ (0 :: String) -> true
9+ _ -> false
10+
11+main = do
12+ let t = test
13+ log "Done"
examples/failing/TypedHole.pursnew file+9
@@ -0,0 +1,9 @@
1+-- @shouldFailWith HoleInferredType
2+module Main where
3+
4+import Prelude
5+import Control.Monad.Eff (Eff)
6+import Control.Monad.Eff.Console (CONSOLE, log)
7+
8+main :: forall e. Eff (console :: CONSOLE | e) Unit
9+main = ?ummm
examples/failing/UnderscoreModuleName.pursnew file+6
@@ -0,0 +1,6 @@
1+-- @shouldFailWith ErrorParsingModule
2+module Bad_Module where
3+
4+import Control.Monad.Eff.Console (log)
5+
6+main = log "Done"
examples/failing/UnifyInTypeInstanceLookup.pursnew file+22
@@ -0,0 +1,22 @@
1+-- @shouldFailWith NoInstanceFound
2+-- See issue #390.
3+-- TODO: Improve this error.
4+module Main where
5+
6+import Prelude
7+
8+data Z = Z
9+data S n = S n
10+
11+data T
12+data F
13+
14+class EQ x y b
15+instance eqT :: EQ x x T
16+instance eqF :: EQ x y F
17+
18+foreign import test :: forall a b. (EQ a b T) => a -> b -> a
19+
20+foreign import anyNat :: forall a. a
21+
22+test1 = test anyNat (S Z)
examples/failing/UnknownType.pursnew file+7
@@ -0,0 +1,7 @@
1+-- @shouldFailWith UnknownName
2+module Main where
3+
4+import Prelude
5+
6+test :: Number -> Something
7+test = {}
examples/passing/1185.pursnew file+15
@@ -0,0 +1,15 @@
1+module Main where
2+
3+import Control.Monad.Eff.Console (log)
4+
5+data Person = Person String Boolean
6+
7+getName :: Person -> String
8+getName p = case p of
9+ Person name true -> name
10+ _ -> "Unknown"
11+
12+name :: String
13+name = getName (Person "John Smith" true)
14+
15+main = log "Done"
examples/passing/1335.pursnew file+14
@@ -0,0 +1,14 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+x :: forall a. a -> String
7+x a = y "Test"
8+ where
9+ y :: forall a. (Show a) => a -> String
10+ y a = show (a :: a)
11+
12+main = do
13+ log (x 0)
14+ log "Done"
examples/passing/1570.pursnew file+8
@@ -0,0 +1,8 @@
1+module Main where
2+
3+import Control.Monad.Eff.Console (log)
4+
5+test :: forall a. a -> a
6+test = \(x :: a) -> x
7+
8+main = log "Done"
examples/passing/1664.pursnew file+16
@@ -0,0 +1,16 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff
5+import Control.Monad.Eff.Console
6+
7+data Identity a = Identity a
8+
9+newtype IdentityEff e a = IdentityEff (Eff e (Identity a))
10+
11+test :: forall e a. IdentityEff e a -> IdentityEff e Unit
12+test (IdentityEff action) = IdentityEff $ do
13+ (Identity x :: Identity _) <- action
14+ pure $ Identity unit
15+
16+main = log "Done"
examples/passing/1697.pursnew file+25
@@ -0,0 +1,25 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+_2 :: forall a. a -> a
7+_2 a = a
8+
9+x :: forall m. (Monad m) => m Unit
10+x = do
11+ _ <- pure unit
12+ pure unit
13+
14+y :: forall m. (Monad m) => m Unit
15+y = do
16+ _ <- pure unit
17+ pure unit
18+
19+wtf :: forall m. (Monad m) => m Unit
20+wtf = do
21+ _ <- pure unit
22+ let tmp = _2 1
23+ pure unit
24+
25+main = log "Done"
examples/passing/1881.pursnew file+19
@@ -0,0 +1,19 @@
1+module Main where
2+
3+import Control.Monad.Eff.Console (log)
4+
5+foo =
6+ 1
7+
8+bar
9+ = 2
10+
11+baz
12+ =
13+ 3
14+
15+qux
16+ =
17+ 3
18+
19+main = log "Done"
examples/passing/1991.pursnew file+22
@@ -0,0 +1,22 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+singleton :: forall a. a -> Array a
7+singleton x = [x]
8+
9+empty :: forall a. Array a
10+empty = []
11+
12+foldMap :: forall a m. (Semigroup m) => (a -> m) -> Array a -> m
13+foldMap f [a, b, c, d, e] = f a <> f b <> f c <> f d <> f e
14+foldMap f xs = foldMap f xs -- spin, not used
15+
16+regression :: Array Int
17+regression =
18+ let as = [1,2,3,4,5]
19+ as' = foldMap (\x -> if 1 < x && x < 4 then singleton x else empty) as
20+ in as'
21+
22+main = log "Done"
examples/passing/2018.pursnew file+12
@@ -0,0 +1,12 @@
1+module Main where
2+
3+import Prelude
4+import A (foo)
5+import B (Foo(..))
6+import Control.Monad.Eff (Eff)
7+import Control.Monad.Eff.Console (CONSOLE, log)
8+
9+main :: forall e. Eff (console :: CONSOLE | e) Unit
10+main = do
11+ let tmp = foo X
12+ log "Done"
examples/passing/2018/A.pursnew file+7
@@ -0,0 +1,7 @@
1+module A where
2+
3+import B as Main
4+
5+-- Prior to the 2018 fix this would be detected as a cycle between A and Main.
6+foo ∷ Main.Foo → Main.Foo
7+foo x = x
examples/passing/2018/B.pursnew file+3
@@ -0,0 +1,3 @@
1+module B where
2+
3+data Foo = X | Y
examples/passing/2049.pursnew file+14
@@ -0,0 +1,14 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+data List a = Cons a (List a) | Nil
7+
8+infixr 6 Cons as :
9+
10+f :: List { x :: Int, y :: Int } -> Int
11+f ( r@{ x } : _) = x + r.y
12+f _ = 0
13+
14+main = log "Done"
examples/passing/2138.pursnew file+7
@@ -0,0 +1,7 @@
1+module Main where
2+
3+import Control.Monad.Eff.Console (log)
4+
5+import Lib (A(B,C))
6+
7+main = log "Done"
examples/passing/2138/Lib.pursnew file+3
@@ -0,0 +1,3 @@
1+module Lib (A(..), A) where
2+
3+data A = B | C
examples/passing/2172.jsnew file+5
@@ -0,0 +1,5 @@
1+exports['a\''] = 0;
2+exports["\x62\x27"] = 1;
3+// NOTE: I wanted to use "\c'" here, but langauge-javascript doesn't support it...
4+exports["c'"] = 2;
5+exports["\u0064\u0027"] = 3;
examples/passing/2172.pursnew file+10
@@ -0,0 +1,10 @@
1+module Main where
2+
3+import Control.Monad.Eff.Console (log)
4+
5+foreign import a' :: Number
6+foreign import b' :: Number
7+foreign import c' :: Number
8+foreign import d' :: Number
9+
10+main = log "Done"
examples/passing/2252.pursnew file+15
@@ -0,0 +1,15 @@
1+module Main where
2+
3+import Control.Monad.Eff.Console (log)
4+
5+data T a = T
6+
7+ti :: T Int
8+ti = T
9+
10+t :: forall a. T a
11+t = T
12+
13+xs = [ti, t, t]
14+
15+main = log "Done"
examples/passing/652.pursnew file+18
@@ -0,0 +1,18 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+class Foo a b
7+
8+class Bar a c
9+
10+class (Foo a b, Bar a c) <= Baz a b c
11+
12+instance foo :: Foo (a -> b) a
13+
14+instance bar :: Bar (a -> b) b
15+
16+instance baz :: (Eq a) => Baz (a -> b) a b
17+
18+main = log "Done"
examples/passing/810.pursnew file+14
@@ -0,0 +1,14 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+data Maybe a = Nothing | Just a
7+
8+test :: forall a. Maybe a -> Maybe a
9+test m = o.x
10+ where
11+ o = case m of Nothing -> { x : Nothing }
12+ Just a -> { x : Just a }
13+
14+main = log "Done"
examples/passing/862.pursnew file+8
@@ -0,0 +1,8 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console
5+
6+id' = (\x -> x) <$> \y -> y
7+
8+main = log (id' "Done")
examples/passing/922.pursnew file+20
@@ -0,0 +1,20 @@
1+module Main where
2+
3+import Prelude
4+
5+import Control.Monad.Eff.Console
6+
7+class Default a where
8+ def :: a
9+
10+instance defaultString :: Default String where
11+ def = "Done"
12+
13+data I a = I a
14+
15+instance defaultI :: (Default a) => Default (I a) where
16+ def = I def
17+
18+main = do
19+ case def of
20+ I s -> log s
examples/passing/Applicative.pursnew file+16
@@ -0,0 +1,16 @@
1+module Main where
2+
3+import Control.Monad.Eff.Console (log)
4+
5+class Applicative f where
6+ pure :: forall a. a -> f a
7+ apply :: forall a b. f (a -> b) -> f a -> f b
8+
9+data Maybe a = Nothing | Just a
10+
11+instance applicativeMaybe :: Applicative Maybe where
12+ pure = Just
13+ apply (Just f) (Just a) = Just (f a)
14+ apply _ _ = Nothing
15+
16+main = log "Done"
examples/passing/ArrayType.pursnew file+12
@@ -0,0 +1,12 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+class Pointed p where
7+ point :: forall a. a -> p a
8+
9+instance pointedArray :: Pointed Array where
10+ point a = [a]
11+
12+main = log "Done"
examples/passing/Auto.pursnew file+16
@@ -0,0 +1,16 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+data Auto s i o = Auto { state :: s, step :: s -> i -> o }
7+
8+type SomeAuto i o = forall r. (forall s. Auto s i o -> r) -> r
9+
10+exists :: forall s i o. s -> (s -> i -> o) -> SomeAuto i o
11+exists = \state step f -> f (Auto { state: state, step: step })
12+
13+run :: forall i o. SomeAuto i o -> i -> o
14+run = \s i -> s (\a -> case a of Auto a -> a.step a.state i)
15+
16+main = log "Done"
examples/passing/AutoPrelude.pursnew file+11
@@ -0,0 +1,11 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+f x = x * 10.0
7+g y = y - 10.0
8+
9+main = do
10+ log $ show $ (f <<< g) 100.0
11+ log "Done"
examples/passing/AutoPrelude2.pursnew file+10
@@ -0,0 +1,10 @@
1+module Main where
2+
3+import Prelude
4+import Prelude as P
5+import Control.Monad.Eff.Console
6+
7+f :: forall a. a -> a
8+f = P.id
9+
10+main = P.($) log ((f P.<<< f) "Done")
examples/passing/BindersInFunctions.pursnew file+16
@@ -0,0 +1,16 @@
1+module Main where
2+
3+import Prelude
4+import Partial.Unsafe (unsafePartial)
5+import Test.Assert (assert')
6+import Control.Monad.Eff (Eff)
7+import Control.Monad.Eff.Console (log)
8+
9+snd :: forall a. Partial => Array a -> a
10+snd = \[_, y] -> y
11+
12+main :: Eff _ _
13+main = do
14+ let ts = unsafePartial (snd [1.0, 2.0])
15+ assert' "Incorrect result from 'snd'." (ts == 2.0)
16+ log "Done"
examples/passing/BindingGroups.pursnew file+11
@@ -0,0 +1,11 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+foo = bar
7+ where bar r = r + 1.0
8+
9+r = foo 2.0
10+
11+main = log "Done"
examples/passing/BlockString.pursnew file+9
@@ -0,0 +1,9 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+foo :: String
7+foo = """foo"""
8+
9+main = log "Done"
examples/passing/CaseInDo.pursnew file+21
@@ -0,0 +1,21 @@
1+module Main where
2+
3+import Prelude
4+import Partial.Unsafe (unsafeCrashWith)
5+import Control.Monad.Eff.Console
6+import Control.Monad.Eff
7+
8+doIt :: forall eff. Eff eff Boolean
9+doIt = pure true
10+
11+set = do
12+ log "Testing..."
13+ case 0 of
14+ 0 -> doIt
15+ _ -> pure false
16+
17+main = do
18+ b <- set
19+ case b of
20+ true -> log "Done"
21+ false -> unsafeCrashWith "Failed"
examples/passing/CaseInputWildcard.pursnew file+18
@@ -0,0 +1,18 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff (Eff)
5+import Control.Monad.Eff.Console (log, CONSOLE)
6+
7+data Foo = X | Y
8+
9+what ∷ Foo → Int → Boolean → Foo
10+what x = case _, x, _ of
11+ 0, X, true → X
12+ 0, Y, true → X
13+ _, _, _ → Y
14+
15+main :: forall e. Eff (console :: CONSOLE | e) Unit
16+main = do
17+ let tmp = what Y 0 true
18+ log "Done"
examples/passing/CaseMultipleExpressions.pursnew file+21
@@ -0,0 +1,21 @@
1+module Main where
2+
3+import Prelude
4+import Partial.Unsafe (unsafeCrashWith)
5+import Control.Monad.Eff.Console
6+import Control.Monad.Eff
7+
8+doIt :: forall eff. Eff eff Boolean
9+doIt = pure true
10+
11+set = do
12+ log "Testing..."
13+ case 42, 10 of
14+ 42, 10 -> doIt
15+ _ , _ -> pure false
16+
17+main = do
18+ b <- set
19+ case b of
20+ true -> log "Done"
21+ false -> unsafeCrashWith "Failed"
examples/passing/CaseStatement.pursnew file+22
@@ -0,0 +1,22 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+data A = A | B | C
7+
8+f a _ A = a
9+f _ a B = a
10+f _ _ C = "Done"
11+
12+g a _ A = a
13+g _ b B = b
14+g _ _ C = C
15+
16+data M a = N | J a
17+
18+h f N a = a
19+h f a N = a
20+h f (J a) (J b) = J (f a b)
21+
22+main = log $ f "Done" "Failed" A
examples/passing/CheckFunction.pursnew file+8
@@ -0,0 +1,8 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+test = ((\x -> x+1.0) >>> (\x -> x*2.0)) 4.0
7+
8+main = log "Done"
examples/passing/CheckSynonymBug.pursnew file+13
@@ -0,0 +1,13 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+length :: forall a. Array a -> Int
7+length _ = 0
8+
9+type Foo a = Array a
10+
11+foo _ = length ([] :: Foo Number)
12+
13+main = log "Done"
examples/passing/CheckTypeClass.pursnew file+18
@@ -0,0 +1,18 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+data Bar a = Bar
7+data Baz
8+
9+class Foo a where
10+ foo :: Bar a -> Baz
11+
12+foo_ :: forall a. (Foo a) => a -> Baz
13+foo_ x = foo ((mkBar :: forall a. (Foo a) => a -> Bar a) x)
14+
15+mkBar :: forall a. a -> Bar a
16+mkBar _ = Bar
17+
18+main = log "Done"
examples/passing/Church.pursnew file+18
@@ -0,0 +1,18 @@
1+module Main where
2+
3+import Control.Monad.Eff.Console (log)
4+
5+type List a = forall r. r -> (a -> r -> r) -> r
6+
7+empty :: forall a. List a
8+empty = \r f -> r
9+
10+cons :: forall a. a -> List a -> List a
11+cons = \a l r f -> f a (l r f)
12+
13+append :: forall a. List a -> List a -> List a
14+append = \l1 l2 r f -> l2 (l1 r f) f
15+
16+test = append (cons 1 empty) (cons 2 empty)
17+
18+main = log "Done"
examples/passing/ClassRefSyntax.pursnew file+9
@@ -0,0 +1,9 @@
1+module Main where
2+
3+import Lib (class X, go)
4+import Control.Monad.Eff.Console (log)
5+
6+go' :: forall a. (X a) => a -> a
7+go' = go
8+
9+main = log "Done"
examples/passing/ClassRefSyntax/Lib.pursnew file+4
@@ -0,0 +1,4 @@
1+module Lib (class X, go) where
2+
3+class X a where
4+ go :: a -> a
examples/passing/Collatz.pursnew file+21
@@ -0,0 +1,21 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff
5+import Control.Monad.ST
6+import Control.Monad.Eff.Console (log, logShow)
7+
8+collatz :: Int -> Int
9+collatz n = runPure (runST (do
10+ r <- newSTRef n
11+ count <- newSTRef 0
12+ untilE $ do
13+ modifySTRef count $ (+) 1
14+ m <- readSTRef r
15+ writeSTRef r $ if m `mod` 2 == 0 then m / 2 else 3 * m + 1
16+ pure $ m == 1
17+ readSTRef count))
18+
19+main = do
20+ logShow $ collatz 1000
21+ log "Done"
examples/passing/Comparisons.pursnew file+15
@@ -0,0 +1,15 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff
5+import Control.Monad.Eff.Console
6+import Test.Assert
7+
8+main = do
9+ assert (1.0 < 2.0)
10+ assert (2.0 == 2.0)
11+ assert (3.0 > 1.0)
12+ assert ("a" < "b")
13+ assert ("a" == "a")
14+ assert ("z" > "a")
15+ log "Done"
examples/passing/Conditional.pursnew file+9
@@ -0,0 +1,9 @@
1+module Main where
2+
3+import Control.Monad.Eff.Console (log)
4+
5+fns = \f -> if f true then f else \x -> x
6+
7+not = \x -> if x then false else true
8+
9+main = log "Done"
examples/passing/Console.pursnew file+15
@@ -0,0 +1,15 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff
5+import Control.Monad.Eff.Console
6+
7+replicateM_ :: forall m a. (Monad m) => Number -> m a -> m {}
8+replicateM_ 0.0 _ = pure {}
9+replicateM_ n act = do
10+ act
11+ replicateM_ (n - 1.0) act
12+
13+main = do
14+ replicateM_ 10.0 (log "Hello World!")
15+ log "Done"
examples/passing/ConstraintInference.pursnew file+10
@@ -0,0 +1,10 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+shout = log <<< (_ <> "!") <<< show
7+
8+main = do
9+ shout "Test"
10+ log "Done"
examples/passing/ContextSimplification.pursnew file+15
@@ -0,0 +1,15 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console
5+
6+shout = log <<< (_ <> "!") <<< show
7+
8+-- Here, we should simplify the context so that only one Show
9+-- constraint is added.
10+usesShowTwice true = shout
11+usesShowTwice false = logShow
12+
13+main = do
14+ usesShowTwice true "Test"
15+ log "Done"
examples/passing/DataAndType.pursnew file+10
@@ -0,0 +1,10 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+data A = A B
7+
8+type B = A
9+
10+main = log "Done"
examples/passing/DctorOperatorAlias.pursnew file+34
@@ -0,0 +1,34 @@
1+module Main where
2+
3+ import Prelude (Unit, bind, (==))
4+ import Control.Monad.Eff (Eff)
5+ import Control.Monad.Eff.Console (CONSOLE, log)
6+ import Test.Assert (ASSERT, assert')
7+ import List (List(..), (:))
8+ import List as L
9+
10+ -- unqualified
11+ infixl 6 Cons as !
12+
13+ -- qualified
14+ infixl 6 L.Cons as !!
15+
16+ get1 ∷ ∀ a. a → List a → a
17+ get1 y xs = case xs of
18+ _ : x : _ → x
19+ _ → y
20+
21+ get2 ∷ ∀ a. a → List a → a
22+ get2 _ (_ : x : _) = x
23+ get2 y _ = y
24+
25+ get3 ∷ ∀ a. a → List a → a
26+ get3 _ (_ ! (x ! _)) = x
27+ get3 y _ = y
28+
29+ main ∷ Eff (assert ∷ ASSERT, console ∷ CONSOLE) Unit
30+ main = do
31+ assert' "Incorrect result!" (get1 0 (1 : 2 : 3 : Nil) == 2)
32+ assert' "Incorrect result!" (get2 0 (1 ! (2 ! (3 ! Nil))) == 2)
33+ assert' "Incorrect result!" (get3 0.0 (1.0 : 2.0 : (3.0 ! Nil)) == 2.0)
34+ log "Done"
examples/passing/DctorOperatorAlias/List.pursnew file+5
@@ -0,0 +1,5 @@
1+module List where
2+
3+data List a = Cons a (List a) | Nil
4+
5+infixr 6 Cons as :
examples/passing/DeepArrayBinder.pursnew file+17
@@ -0,0 +1,17 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff
5+import Control.Monad.Eff.Console (log)
6+import Test.Assert
7+
8+data List a = Cons a (List a) | Nil
9+
10+match2 :: List Number -> Number
11+match2 (Cons x (Cons y xs)) = x * y + match2 xs
12+match2 _ = 0.0
13+
14+main = do
15+ 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)))))))))
16+ assert' "Incorrect result!" (result == 100.0)
17+ log "Done"
examples/passing/DeepCase.pursnew file+15
@@ -0,0 +1,15 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log, logShow)
5+
6+f x y =
7+ let
8+ g = case y of
9+ 0.0 -> x
10+ x -> 1.0 + x * x
11+ in g + x + y
12+
13+main = do
14+ logShow $ f 1.0 10.0
15+ log "Done"
examples/passing/Deriving.pursnew file+34
@@ -0,0 +1,34 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+import Test.Assert
6+
7+data V
8+
9+derive instance eqV :: Eq V
10+
11+derive instance ordV :: Ord V
12+
13+data X = X Int | Y String
14+
15+derive instance eqX :: Eq X
16+
17+derive instance ordX :: Ord X
18+
19+newtype Z = Z { left :: X, right :: X }
20+
21+derive instance eqZ :: Eq Z
22+
23+main = do
24+ assert $ X 0 == X 0
25+ assert $ X 0 /= X 1
26+ assert $ Y "Foo" == Y "Foo"
27+ assert $ Y "Foo" /= Y "Bar"
28+ assert $ X 0 < X 1
29+ assert $ X 0 < Y "Foo"
30+ assert $ Y "Bar" < Y "Baz"
31+ assert $ z == z
32+ log "Done"
33+ where
34+ z = Z { left: X 0, right: Y "Foo" }
examples/passing/Do.pursnew file+68
@@ -0,0 +1,68 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+data Maybe a = Nothing | Just a
7+
8+instance functorMaybe :: Functor Maybe where
9+ map f Nothing = Nothing
10+ map f (Just x) = Just (f x)
11+
12+instance applyMaybe :: Apply Maybe where
13+ apply (Just f) (Just x) = Just (f x)
14+ apply _ _ = Nothing
15+
16+instance applicativeMaybe :: Applicative Maybe where
17+ pure = Just
18+
19+instance bindMaybe :: Bind Maybe where
20+ bind Nothing _ = Nothing
21+ bind (Just a) f = f a
22+
23+instance monadMaybe :: Monad Maybe
24+
25+test1 = \_ -> do
26+ Just "abc"
27+
28+test2 = \_ -> do
29+ x <- Just 1.0
30+ y <- Just 2.0
31+ Just (x + y)
32+
33+test3 = \_ -> do
34+ Just 1.0
35+ Nothing :: Maybe Number
36+ Just 2.0
37+
38+test4 mx my = do
39+ x <- mx
40+ y <- my
41+ Just (x + y + 1.0)
42+
43+test5 mx my mz = do
44+ x <- mx
45+ y <- my
46+ let sum = x + y
47+ z <- mz
48+ Just (z + sum + 1.0)
49+
50+test6 mx = \_ -> do
51+ let
52+ f :: forall a. Maybe a -> a
53+ f (Just x) = x
54+ Just (f mx)
55+
56+test8 = \_ -> do
57+ Just (do
58+ Just 1.0)
59+
60+test9 = \_ -> (+) <$> Just 1.0 <*> Just 2.0
61+
62+test10 _ = do
63+ let
64+ f x = g x * 3.0
65+ g x = f x / 2.0
66+ Just (f 10.0)
67+
68+main = log "Done"
examples/passing/Dollar.pursnew file+16
@@ -0,0 +1,16 @@
1+module Main where
2+
3+import Control.Monad.Eff.Console (log)
4+
5+applyFn :: forall a b. (a -> b) -> a -> b
6+applyFn f x = f x
7+
8+infixr 1000 applyFn as $
9+
10+id x = x
11+
12+test1 x = id $ id $ id $ id $ x
13+
14+test2 x = id id $ id x
15+
16+main = log "Done"
examples/passing/Eff.pursnew file+26
@@ -0,0 +1,26 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff
5+import Control.Monad.ST
6+import Control.Monad.Eff.Console (log, logShow)
7+
8+test1 = do
9+ log "Line 1"
10+ log "Line 2"
11+
12+test2 = runPure (runST (do
13+ ref <- newSTRef 0.0
14+ modifySTRef ref $ \n -> n + 1.0
15+ readSTRef ref))
16+
17+test3 = pureST (do
18+ ref <- newSTRef 0.0
19+ modifySTRef ref $ \n -> n + 1.0
20+ readSTRef ref)
21+
22+main = do
23+ test1
24+ logShow test2
25+ logShow test3
26+ log "Done"
examples/passing/EmptyDataDecls.pursnew file+20
@@ -0,0 +1,20 @@
1+module Main where
2+
3+import Prelude
4+import Test.Assert
5+import Control.Monad.Eff.Console (log)
6+
7+data Z
8+data S n
9+
10+data ArrayBox n a = ArrayBox (Array a)
11+
12+nil :: forall a. ArrayBox Z a
13+nil = ArrayBox []
14+
15+cons' :: forall a n. a -> ArrayBox n a -> ArrayBox (S n) a
16+cons' x (ArrayBox xs) = ArrayBox $ append [x] xs
17+
18+main = case cons' 1 $ cons' 2 $ cons' 3 nil of
19+ ArrayBox [1, 2, 3] -> log "Done"
20+ _ -> assert' "Failed" false
examples/passing/EmptyRow.pursnew file+11
@@ -0,0 +1,11 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+data Foo r = Foo { | r }
7+
8+test :: Foo ()
9+test = Foo {}
10+
11+main = log "Done"
examples/passing/EmptyTypeClass.pursnew file+11
@@ -0,0 +1,11 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff
5+import Control.Monad.Eff.Console
6+
7+head :: forall a. Partial => Array a -> a
8+head [x] = x
9+
10+main :: Eff _ _
11+main = log "Done"
examples/passing/EqOrd.pursnew file+18
@@ -0,0 +1,18 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log, logShow)
5+
6+data Pair a b = Pair a b
7+
8+instance ordPair :: (Ord a, Ord b) => Ord (Pair a b) where
9+ compare (Pair a1 b1) (Pair a2 b2) = case compare a1 a2 of
10+ EQ -> compare b1 b2
11+ r -> r
12+
13+instance eqPair :: (Eq a, Eq b) => Eq (Pair a b) where
14+ eq (Pair a1 b1) (Pair a2 b2) = a1 == a2 && b1 == b2
15+
16+main = do
17+ logShow $ Pair 1.0 2.0 == Pair 1.0 2.0
18+ log "Done"
examples/passing/ExplicitImportReExport.pursnew file+11
@@ -0,0 +1,11 @@
1+-- from #1244
2+module Main where
3+
4+import Prelude
5+import Control.Monad.Eff.Console (log)
6+import Bar (foo)
7+
8+baz :: Int
9+baz = foo
10+
11+main = log "Done"
examples/passing/ExplicitImportReExport/Bar.pursnew file+3
@@ -0,0 +1,3 @@
1+module Bar (module Foo) where
2+
3+import Foo
examples/passing/ExplicitImportReExport/Foo.pursnew file+4
@@ -0,0 +1,4 @@
1+module Foo where
2+
3+foo :: Int
4+foo = 3
examples/passing/ExplicitOperatorSections.pursnew file+15
@@ -0,0 +1,15 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+subtractOne :: Int -> Int
7+subtractOne = (_ - 1)
8+
9+addOne :: Int -> Int
10+addOne = (1 + _)
11+
12+named :: Int -> Int
13+named = (_ `sub` 1)
14+
15+main = log "Done"
examples/passing/ExportExplicit.pursnew file+10
@@ -0,0 +1,10 @@
1+module Main where
2+
3+import M1
4+import Control.Monad.Eff.Console (log)
5+
6+testX = X
7+testZ = Z
8+testFoo = foo
9+
10+main = log "Done"
examples/passing/ExportExplicit/M1.pursnew file+10
@@ -0,0 +1,10 @@
1+module M1 (X(X), Z(..), foo) where
2+
3+data X = X | Y
4+data Z = Z
5+
6+foo :: Int
7+foo = 0
8+
9+bar :: Int
10+bar = 1
examples/passing/ExportExplicit2.pursnew file+8
@@ -0,0 +1,8 @@
1+module Main where
2+
3+import M1
4+import Control.Monad.Eff.Console (log)
5+
6+testBar = bar
7+
8+main = log "Done"
examples/passing/ExportExplicit2/M1.pursnew file+7
@@ -0,0 +1,7 @@
1+module M1 (bar) where
2+
3+foo :: Int
4+foo = 0
5+
6+bar :: Int
7+bar = foo
examples/passing/ExportedInstanceDeclarations.pursnew file+45
@@ -0,0 +1,45 @@
1+-- Tests that instances for non-exported classes / types do not appear in the
2+-- result of `exportedDeclarations`.
3+module Main
4+ ( Const(..)
5+ , class Foo
6+ , foo
7+ , main
8+ ) where
9+
10+import Prelude
11+import Control.Monad.Eff.Console (log)
12+
13+data Const a b = Const a
14+
15+class Foo a where
16+ foo :: a
17+
18+data NonexportedType = NonexportedType
19+
20+class NonexportedClass a where
21+ notExported :: a
22+
23+-- There are three places that a nonexported type or type class can occur,
24+-- leading an instance to count as non-exported:
25+-- * Constraints
26+-- * The type class itself
27+-- * The instance types
28+
29+-- Case 1: constraints
30+instance nonExportedFoo :: (NonexportedClass a) => Foo a where
31+ foo = notExported
32+
33+-- Another instance of case 1:
34+instance nonExportedFoo2 :: (Foo NonexportedType) => Foo (a -> a) where
35+ foo = id
36+
37+-- Case 2: type class
38+instance nonExportedNonexportedType :: NonexportedClass (Const Int a) where
39+ notExported = Const 0
40+
41+-- Case 3: instance types
42+instance constFoo :: Foo (Const NonexportedType b) where
43+ foo = Const NonexportedType
44+
45+main = log "Done"
examples/passing/ExtendedInfixOperators.pursnew file+17
@@ -0,0 +1,17 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log, logShow)
5+import Data.Function (on)
6+
7+comparing :: forall a b. (Ord b) => (a -> b) -> a -> a -> Ordering
8+comparing f = compare `on` f
9+
10+null [] = true
11+null _ = false
12+
13+test = [1.0, 2.0, 3.0] `comparing null` [4.0, 5.0, 6.0]
14+
15+main = do
16+ logShow test
17+ log "Done"
examples/passing/Fib.pursnew file+18
@@ -0,0 +1,18 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff (whileE)
5+import Control.Monad.Eff.Console (log, logShow)
6+import Control.Monad.ST (runST, newSTRef, readSTRef, writeSTRef)
7+
8+main = do
9+ runST do
10+ n1 <- newSTRef 1.0
11+ n2 <- newSTRef 1.0
12+ whileE ((>) 1000.0 <$> readSTRef n1) $ do
13+ n1' <- readSTRef n1
14+ n2' <- readSTRef n2
15+ writeSTRef n2 $ n1' + n2'
16+ writeSTRef n1 n2'
17+ logShow n2'
18+ log "Done"
examples/passing/FieldConsPuns.pursnew file+13
@@ -0,0 +1,13 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log, logShow)
5+
6+greet { greeting, name } = log $ greeting <> ", " <> name <> "."
7+
8+main = do
9+ greet { greeting, name }
10+ log "Done"
11+ where
12+ greeting = "Hello"
13+ name = "World"
examples/passing/FieldPuns.pursnew file+10
@@ -0,0 +1,10 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console
5+
6+greet { greeting, name } = log $ greeting <> ", " <> name <> "."
7+
8+main = do
9+ greet { greeting: "Hello", name: "World" }
10+ log "Done"
examples/passing/FinalTagless.pursnew file+25
@@ -0,0 +1,25 @@
1+module Main where
2+
3+import Prelude hiding (add)
4+import Control.Monad.Eff.Console (log, logShow)
5+
6+class E e where
7+ num :: Number -> e Number
8+ add :: e Number -> e Number -> e Number
9+
10+type Expr a = forall e. (E e) => e a
11+
12+data Id a = Id a
13+
14+instance exprId :: E Id where
15+ num = Id
16+ add (Id n) (Id m) = Id (n + m)
17+
18+runId (Id a) = a
19+
20+three :: Expr Number
21+three = add (num 1.0) (num 2.0)
22+
23+main = do
24+ logShow $ runId three
25+ log "Done"
examples/passing/FunctionScope.pursnew file+13
@@ -0,0 +1,13 @@
1+module Main where
2+
3+import Prelude
4+import Test.Assert
5+import Control.Monad.Eff.Console (log)
6+
7+mkValue :: Number -> Number
8+mkValue id = id
9+
10+main = do
11+ let value = mkValue 1.0
12+ assert $ value == 1.0
13+ log "Done"
examples/passing/Functions.pursnew file+12
@@ -0,0 +1,12 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+test1 = \_ -> 0.0
7+
8+test2 = \a b -> a + b + 1.0
9+
10+test3 = \a -> a
11+
12+main = log "Done"
examples/passing/Functions2.pursnew file+13
@@ -0,0 +1,13 @@
1+module Main where
2+
3+import Prelude
4+import Test.Assert
5+import Control.Monad.Eff.Console (log)
6+
7+test :: forall a b. a -> b -> a
8+test = \const _ -> const
9+
10+main = do
11+ let value = test "Done" {}
12+ assert' "Not done" $ value == "Done"
13+ log "Done"
examples/passing/Generalization1.pursnew file+11
@@ -0,0 +1,11 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (logShow, log)
5+
6+main = do
7+ logShow (sum 1.0 2.0)
8+ logShow (sum 1 2)
9+ log "Done"
10+
11+sum x y = x + y
examples/passing/Guards.pursnew file+30
@@ -0,0 +1,30 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+collatz = \x -> case x of
7+ y | y `mod` 2.0 == 0.0 -> y / 2.0
8+ y -> y * 3.0 + 1.0
9+
10+-- Guards have access to current scope
11+collatz2 = \x y -> case x of
12+ z | y > 0.0 -> z / 2.0
13+ z -> z * 3.0 + 1.0
14+
15+min :: forall a. (Ord a) => a -> a -> a
16+min n m | n < m = n
17+ | otherwise = m
18+
19+max :: forall a. (Ord a) => a -> a -> a
20+max n m = case unit of
21+ _ | m < n -> n
22+ | otherwise -> m
23+
24+testIndentation :: Number -> Number -> Number
25+testIndentation x y | x > 0.0
26+ = x + y
27+ | otherwise
28+ = y - x
29+
30+main = log $ min "Done" "ZZZZ"
examples/passing/HoistError.pursnew file+12
@@ -0,0 +1,12 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff
5+import Control.Monad.Eff.Console
6+import Test.Assert
7+
8+main = do
9+ let x = 0.0
10+ assert $ x == 0.0
11+ let x = 1.0 + 1.0
12+ log "Done"
examples/passing/IfThenElseMaybe.pursnew file+12
@@ -0,0 +1,12 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+data Maybe a = Nothing | Just a
7+
8+test1 = if true then Just 10 else Nothing
9+
10+test2 = if true then Nothing else Just 10
11+
12+main = log "Done"
examples/passing/IfWildcard.pursnew file+19
@@ -0,0 +1,19 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff (Eff)
5+import Control.Monad.Eff.Console (log, CONSOLE)
6+
7+data Foo = X | Y
8+
9+cond ∷ ∀ a. Boolean → a → a → a
10+cond = if _ then _ else _
11+
12+what ∷ Boolean → Foo
13+what = if _ then X else Y
14+
15+main :: forall e. Eff (console :: CONSOLE | e) Unit
16+main = do
17+ let tmp1 = what true
18+ tmp2 = cond true 0 1
19+ log "Done"
examples/passing/ImplicitEmptyImport.pursnew file+9
@@ -0,0 +1,9 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+main = do
7+ log "Hello"
8+ log "Goodbye"
9+ log "Done"
examples/passing/Import.pursnew file+6
@@ -0,0 +1,6 @@
1+module Main where
2+
3+import M2
4+import Control.Monad.Eff.Console (log)
5+
6+main = log "Done"
examples/passing/Import/M1.pursnew file+8
@@ -0,0 +1,8 @@
1+module M1 where
2+
3+import Prelude ()
4+
5+id :: forall a. a -> a
6+id = \x -> x
7+
8+foo = id
examples/passing/Import/M2.pursnew file+6
@@ -0,0 +1,6 @@
1+module M2 where
2+
3+import Prelude ()
4+import M1
5+
6+main = \_ -> foo 42
examples/passing/ImportExplicit.pursnew file+10
@@ -0,0 +1,10 @@
1+module Main where
2+
3+import M1 (X(..))
4+import Control.Monad.Eff.Console (log)
5+
6+testX :: X
7+testX = X
8+testY = Y
9+
10+main = log "Done"
examples/passing/ImportExplicit/M1.pursnew file+4
@@ -0,0 +1,4 @@
1+module M1 where
2+
3+data X = X | Y
4+data Z = Z
examples/passing/ImportHiding.pursnew file+19
@@ -0,0 +1,19 @@
1+module Main where
2+
3+import Control.Monad.Eff.Console
4+import Prelude hiding (
5+ show, -- a value
6+ class Show, -- a type class
7+ Unit(..) -- a constructor
8+ )
9+
10+show = 1.0
11+
12+class Show a where
13+ noshow :: a -> a
14+
15+data Unit = X | Y
16+
17+main = do
18+ logShow show
19+ log "Done"
examples/passing/ImportQualified.pursnew file+8
@@ -0,0 +1,8 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff
5+import M1
6+import Control.Monad.Eff.Console as C
7+
8+main = C.log (log "Done")
examples/passing/ImportQualified/M1.pursnew file+3
@@ -0,0 +1,3 @@
1+module M1 where
2+
3+log x = x
examples/passing/InferRecFunWithConstrainedArgument.pursnew file+11
@@ -0,0 +1,11 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log, logShow)
5+
6+test 100 = 100
7+test n = test(1 + n)
8+
9+main = do
10+ logShow (test 0)
11+ log "Done"
examples/passing/InstanceBeforeClass.pursnew file+12
@@ -0,0 +1,12 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+instance fooNumber :: Foo Number where
7+ foo = 0.0
8+
9+class Foo a where
10+ foo :: a
11+
12+main = log "Done"
examples/passing/IntAndChar.pursnew file+19
@@ -0,0 +1,19 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff
5+import Control.Monad.Eff.Console (log)
6+import Test.Assert
7+
8+f 1 = 1
9+f _ = 0
10+
11+g 'a' = 'a'
12+g _ = 'b'
13+
14+main = do
15+ assert $ f 1 == 1
16+ assert $ f 0 == 0
17+ assert $ g 'a' == 'a'
18+ assert $ g 'b' == 'b'
19+ log "Done"
examples/passing/JSReserved.pursnew file+13
@@ -0,0 +1,13 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+yield = 0
7+member = 1
8+
9+public = \return -> return
10+
11+this catch = catch
12+
13+main = log "Done"
examples/passing/KindedType.pursnew file+34
@@ -0,0 +1,34 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+type Star2Star f = f :: * -> *
7+
8+type Star t = t :: *
9+
10+test1 :: Star2Star Array String
11+test1 = ["test"]
12+
13+f :: Star (String -> String)
14+f s = s
15+
16+test2 = f "test"
17+
18+data Proxy (f :: * -> *) = Proxy
19+
20+test3 :: Proxy Array
21+test3 = Proxy
22+
23+type Test (f :: * -> *) = f String
24+
25+test4 :: Test Array
26+test4 = ["test"]
27+
28+class Clazz (a :: *) where
29+ def :: a
30+
31+instance clazzString :: Clazz String where
32+ def = "test"
33+
34+main = log "Done"
examples/passing/LargeSumType.pursnew file+35
@@ -0,0 +1,35 @@
1+module Main where
2+
3+import Control.Monad.Eff.Console (log)
4+
5+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
6+
7+explode A A = "A"
8+explode B B = "B"
9+explode C C = "C"
10+explode D D = "D"
11+explode E E = "E"
12+explode F F = "F"
13+explode G G = "G"
14+explode H H = "H"
15+explode I I = "I"
16+explode J J = "J"
17+explode K K = "K"
18+explode L L = "L"
19+explode M M = "M"
20+explode N N = "N"
21+explode O O = "O"
22+explode P P = "P"
23+explode Q Q = "Q"
24+explode R R = "R"
25+explode S S = "S"
26+explode T T = "T"
27+explode U U = "U"
28+explode V V = "V"
29+explode W W = "W"
30+explode X X = "X"
31+explode Y Y = "Y"
32+explode Z Z = "Z"
33+explode _ _ = ""
34+
35+main = log "Done"
examples/passing/Let.pursnew file+58
@@ -0,0 +1,58 @@
1+module Main where
2+
3+import Prelude
4+import Partial.Unsafe (unsafePartial)
5+import Control.Monad.Eff
6+import Control.Monad.Eff.Console (log, logShow)
7+import Control.Monad.ST
8+
9+test1 x = let
10+ y :: Number
11+ y = x + 1.0
12+ in y
13+
14+test2 x y =
15+ let x' = x + 1.0 in
16+ let y' = y + 1.0 in
17+ x' + y'
18+
19+test3 = let f x y z = x + y + z in
20+ f 1.0 2.0 3.0
21+
22+test4 = let
23+ f x [y, z] = x y z
24+ in f (+) [1.0, 2.0]
25+
26+test5 = let
27+ f x | x > 0.0 = g (x / 2.0) + 1.0
28+ f x = 0.0
29+ g x = f (x - 1.0) + 1.0
30+ in f 10.0
31+
32+test7 = let
33+ f :: forall a. a -> a
34+ f x = x
35+ in if f true then f 1.0 else f 2.0
36+
37+test8 :: Number -> Number
38+test8 x = let
39+ go y | (x - 0.1 < y * y) && (y * y < x + 0.1) = y
40+ go y = go $ (y + x / y) / 2.0
41+ in go x
42+
43+test10 _ =
44+ let
45+ f x = g x * 3.0
46+ g x = f x / 2.0
47+ in f 10.0
48+
49+main :: Eff _ _
50+main = do
51+ logShow (test1 1.0)
52+ logShow (test2 1.0 2.0)
53+ logShow test3
54+ unsafePartial (logShow test4)
55+ logShow test5
56+ logShow test7
57+ logShow (test8 100.0)
58+ log "Done"
examples/passing/Let2.pursnew file+20
@@ -0,0 +1,20 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log, logShow)
5+
6+test =
7+ let f :: Number -> Boolean
8+ f 0.0 = false
9+ f n = g (n - 1.0)
10+
11+ g :: Number -> Boolean
12+ g 0.0 = true
13+ g n = f (n - 1.0)
14+
15+ x = f 1.0
16+ in not x
17+
18+main = do
19+ logShow test
20+ log "Done"
examples/passing/LetInInstance.pursnew file+15
@@ -0,0 +1,15 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+class Foo a where
7+ foo :: a -> String
8+
9+instance fooString :: Foo String where
10+ foo = go
11+ where
12+ go :: String -> String
13+ go s = s
14+
15+main = log "Done"
examples/passing/LiberalTypeSynonyms.pursnew file+22
@@ -0,0 +1,22 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+type Reader = (->) String
7+
8+foo :: Reader String
9+foo s = s
10+
11+type AndFoo r = (foo :: String | r)
12+
13+getFoo :: forall r. Prim.Record (AndFoo r) -> String
14+getFoo o = o.foo
15+
16+type F r = { | r } -> { | r }
17+
18+f :: (forall r. F r) -> String
19+f g = case g { x: "Hello" } of
20+ { x: x } -> x
21+
22+main = log "Done"
examples/passing/MPTCs.pursnew file+21
@@ -0,0 +1,21 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+class NullaryTypeClass where
7+ greeting :: String
8+
9+instance nullaryTypeClass :: NullaryTypeClass where
10+ greeting = "Hello, World!"
11+
12+class Coerce a b where
13+ coerce :: a -> b
14+
15+instance coerceRefl :: Coerce a a where
16+ coerce a = a
17+
18+instance coerceShow :: Show a => Coerce a String where
19+ coerce = show
20+
21+main = log "Done"
examples/passing/Match.pursnew file+10
@@ -0,0 +1,10 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+data Foo a = Foo
7+
8+foo = \f -> case f of Foo -> "foo"
9+
10+main = log "Done"
examples/passing/Module.pursnew file+7
@@ -0,0 +1,7 @@
1+module Main where
2+
3+import M1
4+import M2
5+import Control.Monad.Eff.Console (log)
6+
7+main = log "Done"
examples/passing/Module/M1.pursnew file+14
@@ -0,0 +1,14 @@
1+module M1 where
2+
3+import Prelude
4+
5+data Foo = Foo String
6+
7+foo :: Foo -> String
8+foo = \f -> case f of Foo s -> s <> "foo"
9+
10+bar :: Foo -> String
11+bar = foo
12+
13+incr :: Int -> Int
14+incr x = x + 1
examples/passing/Module/M2.pursnew file+10
@@ -0,0 +1,10 @@
1+module M2 where
2+
3+import Prelude
4+import M1 as M1
5+
6+baz :: M1.Foo -> String
7+baz = M1.foo
8+
9+match :: M1.Foo -> String
10+match = \f -> case f of M1.Foo s -> s <> "foo"
examples/passing/ModuleDeps.pursnew file+6
@@ -0,0 +1,6 @@
1+module Main where
2+
3+import M1
4+import Control.Monad.Eff.Console (log)
5+
6+main = log "Done"
examples/passing/ModuleDeps/M1.pursnew file+5
@@ -0,0 +1,5 @@
1+module M1 where
2+
3+import M2 as M2
4+
5+foo = M2.bar
examples/passing/ModuleDeps/M2.pursnew file+5
@@ -0,0 +1,5 @@
1+module M2 where
2+
3+import M3 as M3
4+
5+bar = M3.baz
examples/passing/ModuleDeps/M3.pursnew file+3
@@ -0,0 +1,3 @@
1+module M3 where
2+
3+baz = 1
examples/passing/ModuleExport.pursnew file+8
@@ -0,0 +1,8 @@
1+module Main where
2+
3+import Control.Monad.Eff.Console (log, logShow)
4+import A
5+
6+main = do
7+ logShow (show 1.0)
8+ log "Done"
examples/passing/ModuleExport/A.pursnew file+3
@@ -0,0 +1,3 @@
1+module A (module Prelude) where
2+
3+import Prelude
examples/passing/ModuleExportDupes.pursnew file+11
@@ -0,0 +1,11 @@
1+module Main where
2+
3+ import Control.Monad.Eff.Console
4+ import A
5+ import B
6+ import C
7+ import Prelude
8+
9+ main = do
10+ logShow (show 1.0)
11+ log "Done"
examples/passing/ModuleExportDupes/A.pursnew file+3
@@ -0,0 +1,3 @@
1+module A (module Prelude) where
2+
3+import Prelude
examples/passing/ModuleExportDupes/B.pursnew file+3
@@ -0,0 +1,3 @@
1+module B (module Prelude) where
2+
3+import Prelude
examples/passing/ModuleExportDupes/C.pursnew file+4
@@ -0,0 +1,4 @@
1+module C (module Prelude, module A) where
2+
3+import Prelude
4+import A
examples/passing/ModuleExportExcluded.pursnew file+11
@@ -0,0 +1,11 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log, logShow)
5+import A (foo)
6+
7+otherwise = false
8+
9+main = do
10+ logShow "1.0"
11+ log "Done"
examples/passing/ModuleExportExcluded/A.pursnew file+6
@@ -0,0 +1,6 @@
1+module A (module Prelude, foo) where
2+
3+import Prelude
4+
5+foo :: Number -> Number
6+foo _ = 0.0
examples/passing/ModuleExportQualified.pursnew file+9
@@ -0,0 +1,9 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log, logShow)
5+import A as B
6+
7+main = do
8+ logShow (B.show 1.0)
9+ log "Done"
examples/passing/ModuleExportQualified/A.pursnew file+3
@@ -0,0 +1,3 @@
1+module A (module Prelude) where
2+
3+import Prelude
examples/passing/ModuleExportSelf.pursnew file+11
@@ -0,0 +1,11 @@
1+module Main where
2+
3+import Control.Monad.Eff.Console
4+import A
5+
6+bar :: Foo
7+bar = true
8+
9+main = do
10+ logShow (show bar)
11+ log "Done"
examples/passing/ModuleExportSelf/A.pursnew file+5
@@ -0,0 +1,5 @@
1+module A (module A, module Prelude) where
2+
3+import Prelude
4+
5+type Foo = Boolean
examples/passing/Monad.pursnew file+32
@@ -0,0 +1,32 @@
1+module Main where
2+
3+import Control.Monad.Eff.Console (log)
4+
5+type Monad m = { return :: forall a. a -> m a
6+ , bind :: forall a b. m a -> (a -> m b) -> m b }
7+
8+data Id a = Id a
9+
10+id :: Monad Id
11+id = { return : Id
12+ , bind : \ma f -> case ma of Id a -> f a }
13+
14+data Maybe a = Nothing | Just a
15+
16+maybe :: Monad Maybe
17+maybe = { return : Just
18+ , bind : \ma f -> case ma of
19+ Nothing -> Nothing
20+ Just a -> f a
21+ }
22+
23+test :: forall m. Monad m -> m Number
24+test = \m -> m.bind (m.return 1.0) (\n1 ->
25+ m.bind (m.return "Test") (\n2 ->
26+ m.return n1))
27+
28+test1 = test id
29+
30+test2 = test maybe
31+
32+main = log "Done"
examples/passing/MonadState.pursnew file+63
@@ -0,0 +1,63 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console
5+
6+data Tuple a b = Tuple a b
7+
8+instance showTuple :: (Show a, Show b) => Show (Tuple a b) where
9+ show (Tuple a b) = "(" <> show a <> ", " <> show b <> ")"
10+
11+class Monad m <= MonadState s m where
12+ get :: m s
13+ put :: s -> m Unit
14+
15+data State s a = State (s -> Tuple s a)
16+
17+runState s (State f) = f s
18+
19+instance functorState :: Functor (State s) where
20+ map = liftM1
21+
22+instance applyState :: Apply (State s) where
23+ apply = ap
24+
25+instance applicativeState :: Applicative (State s) where
26+ pure a = State $ \s -> Tuple s a
27+
28+instance bindState :: Bind (State s) where
29+ bind f g = State $ \s -> case runState s f of
30+ Tuple s1 a -> runState s1 (g a)
31+
32+instance monadState :: Monad (State s)
33+
34+instance monadStateState :: MonadState s (State s) where
35+ get = State (\s -> Tuple s s)
36+ put s = State (\_ -> Tuple s unit)
37+
38+-- Without the call to same, the following strange (but correct, in the absence of
39+-- functional dependencies) type:
40+--
41+-- forall m t1 t2.
42+-- ( Bind m
43+-- , MonadState t1 m
44+-- , MonadState t2 m
45+-- ) => (t1 -> t2) -> m Unit
46+--
47+-- With the type hint, the inferred type is more sensible:
48+--
49+-- forall m t.
50+-- ( Bind m
51+-- , MonadState t m
52+-- ) => (t -> t) -> m Unit
53+modify f =
54+ do
55+ s <- get
56+ put (same f s)
57+ where
58+ same :: forall a. (a -> a) -> (a -> a)
59+ same = id
60+
61+main = do
62+ logShow $ runState 0 (modify (_ + 1))
63+ log "Done"
examples/passing/MultiArgFunctions.pursnew file+27
@@ -0,0 +1,27 @@
1+module Main where
2+
3+import Prelude
4+import Data.Function.Uncurried
5+import Control.Monad.Eff
6+import Control.Monad.Eff.Console
7+
8+f = mkFn2 $ \a b -> runFn2 g a b + runFn2 g b a
9+
10+g = mkFn2 $ \a b -> case {} of
11+ _ | a <= 0.0 || b <= 0.0 -> b
12+ _ -> runFn2 f (a - 0.0) (b - 0.0)
13+
14+main = do
15+ runFn0 (mkFn0 $ \_ -> log $ show 0.0)
16+ runFn1 (mkFn1 $ \a -> log $ show a) 0.0
17+ runFn2 (mkFn2 $ \a b -> log $ show [a, b]) 0.0 0.0
18+ runFn3 (mkFn3 $ \a b c -> log $ show [a, b, c]) 0.0 0.0 0.0
19+ runFn4 (mkFn4 $ \a b c d -> log $ show [a, b, c, d]) 0.0 0.0 0.0 0.0
20+ runFn5 (mkFn5 $ \a b c d e -> log $ show [a, b, c, d, e]) 0.0 0.0 0.0 0.0 0.0
21+ 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
22+ 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
23+ 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
24+ 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
25+ 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
26+ logShow $ runFn2 g 0.0 0.0
27+ log "Done"
examples/passing/MutRec.pursnew file+20
@@ -0,0 +1,20 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+f 0.0 = 0.0
7+f x = g x + 0.0
8+
9+g x = f (x / 0.0)
10+
11+data Even = Zero | Even Odd
12+
13+data Odd = Odd Even
14+
15+evenToNumber Zero = 0.0
16+evenToNumber (Even n) = oddToNumber n + 0.0
17+
18+oddToNumber (Odd n) = evenToNumber n + 0.0
19+
20+main = log "Done"
examples/passing/MutRec2.pursnew file+20
@@ -0,0 +1,20 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+data A = A B
7+
8+data B = B A
9+
10+foreign import data S :: *
11+
12+f :: A -> S
13+f a = case a of A b -> g b
14+
15+g b = case b of B a -> f a
16+
17+showN :: A -> S
18+showN a = f a
19+
20+main = log "Done"
examples/passing/MutRec3.pursnew file+20
@@ -0,0 +1,20 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+data A = A B
7+
8+data B = B A
9+
10+foreign import data S :: *
11+
12+f a = case a of A b -> g b
13+
14+g :: B -> S
15+g b = case b of B a -> f a
16+
17+showN :: A -> S
18+showN a = f a
19+
20+main = log "Done"
examples/passing/NakedConstraint.pursnew file+10
@@ -0,0 +1,10 @@
1+module Main where
2+
3+import Control.Monad.Eff.Console
4+
5+data List a = Nil | Cons a (List a)
6+
7+head :: (Partial) => List Int -> Int
8+head (Cons x _) = x
9+
10+main = log "Done"
examples/passing/NamedPatterns.pursnew file+10
@@ -0,0 +1,10 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+foo = \x -> case x of
7+ y@{ foo: "Foo" } -> y
8+ y -> y
9+
10+main = log "Done"
examples/passing/NegativeBinder.pursnew file+10
@@ -0,0 +1,10 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+test :: Number -> Boolean
7+test -1.0 = false
8+test _ = true
9+
10+main = log "Done"
examples/passing/NegativeIntInRange.pursnew file+9
@@ -0,0 +1,9 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+n :: Int
7+n = -2147483648
8+
9+main = log "Done"
examples/passing/Nested.pursnew file+10
@@ -0,0 +1,10 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+data Extend r a = Extend { prev :: r a, next :: a }
7+
8+data Matrix r a = Square (r (r a)) | Bigger (Matrix (Extend r) a)
9+
10+main = log "Done"
examples/passing/NestedTypeSynonyms.pursnew file+12
@@ -0,0 +1,12 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+type X = String
7+type Y = X -> X
8+
9+fn :: Y
10+fn a = a
11+
12+main = log (fn "Done")
examples/passing/NestedWhere.pursnew file+13
@@ -0,0 +1,13 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+f x = g x
7+ where
8+ g x = go x
9+ where
10+ go x = go1 (x - 1.0)
11+ go1 x = go x
12+
13+main = log "Done"
examples/passing/Newtype.pursnew file+23
@@ -0,0 +1,23 @@
1+module Main where
2+
3+import Prelude hiding (apply)
4+import Control.Monad.Eff
5+import Control.Monad.Eff.Console
6+
7+newtype Thing = Thing String
8+
9+instance showThing :: Show Thing where
10+ show (Thing x) = "Thing " <> show x
11+
12+newtype Box a = Box a
13+
14+instance showBox :: (Show a) => Show (Box a) where
15+ show (Box x) = "Box " <> show x
16+
17+apply f x = f x
18+
19+main = do
20+ logShow $ Thing "hello"
21+ logShow $ Box 42.0
22+ logShow $ apply Box 9000.0
23+ log "Done"
examples/passing/NewtypeEff.pursnew file+29
@@ -0,0 +1,29 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console
5+import Control.Monad.Eff
6+
7+newtype T a = T (Eff (console :: CONSOLE) a)
8+
9+runT :: forall a. T a -> Eff (console :: CONSOLE) a
10+runT (T t) = t
11+
12+instance functorT :: Functor T where
13+ map f (T t) = T (f <$> t)
14+
15+instance applyT :: Apply T where
16+ apply (T f) (T x) = T (f <*> x)
17+
18+instance applicativeT :: Applicative T where
19+ pure t = T (pure t)
20+
21+instance bindT :: Bind T where
22+ bind (T t) f = T (t >>= \x -> runT (f x))
23+
24+instance monadT :: Monad T
25+
26+main = runT do
27+ T $ log "Done"
28+ T $ log "Done"
29+ T $ log "Done"
examples/passing/NewtypeWithRecordUpdate.pursnew file+16
@@ -0,0 +1,16 @@
1+-- https://github.com/purescript/purescript/issues/812.0
2+
3+module Main where
4+
5+import Prelude
6+import Control.Monad.Eff.Console
7+
8+newtype NewType a = NewType (Record a)
9+
10+rec1 :: Record (a :: Number, b :: Number, c:: Number)
11+rec1 = { a: 0.0, b: 0.0, c: 0.0 }
12+
13+rec2 :: NewType (a :: Number, b :: Number, c :: Number)
14+rec2 = NewType (rec1 { a = 1.0 })
15+
16+main = log "Done"
examples/passing/NonConflictingExports.pursnew file+10
@@ -0,0 +1,10 @@
1+-- No failure here as the export `thing` only refers to Main.thing
2+module Main (thing, main) where
3+
4+import A
5+import Control.Monad.Eff.Console (log)
6+
7+thing :: Int
8+thing = 2
9+
10+main = log "Done"
examples/passing/NonConflictingExports/A.pursnew file+4
@@ -0,0 +1,4 @@
1+module A where
2+
3+thing :: Int
4+thing = 1
examples/passing/NumberLiterals.pursnew file+39
@@ -0,0 +1,39 @@
1+module Main where
2+
3+-- See issue #2115.
4+
5+import Prelude
6+import Test.Assert (assert')
7+import Control.Monad.Eff.Console (log)
8+
9+main = do
10+ test "0.17" 0.17
11+ test "0.25996181067141905" 0.25996181067141905
12+ test "0.3572019862807257" 0.3572019862807257
13+ test "0.46817723004874223" 0.46817723004874223
14+ test "0.9640035681058178" 0.9640035681058178
15+ test "4.23808622486133" 4.23808622486133
16+ test "4.540362294799751" 4.540362294799751
17+ test "5.212384849884261" 5.212384849884261
18+ test "13.958257048123212" 13.958257048123212
19+ test "32.96176575630599" 32.96176575630599
20+ test "38.47735512322269" 38.47735512322269
21+
22+ test "10000000000" 1e10
23+ test "10000000000" 1.0e10
24+ test "0.00001" 1e-5
25+ test "0.00001" 1.0e-5
26+ test "1.5339794352098402e-118" 1.5339794352098402e-118
27+ test "2.108934760892056e-59" 2.108934760892056e-59
28+ test "2.250634744599241e-19" 2.250634744599241e-19
29+ test "5.960464477539063e-8" 5.960464477539063e-8
30+ test "5e-324" 5e-324
31+ test "5e-324" 5.0e-324
32+
33+ log "Done"
34+
35+test str num =
36+ if (show num == str)
37+ then pure unit
38+ else flip assert' false $
39+ "Expected " <> show str <> ", got " <> show (show num) <> "."
examples/passing/ObjectGetter.pursnew file+14
@@ -0,0 +1,14 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log, logShow)
5+
6+getX = _.x
7+
8+point = { x: 1.0, y: 0.0 }
9+
10+main = do
11+ logShow $ getX point
12+ log $ _." 123 string Prop Name " { " 123 string Prop Name ": "OK" }
13+ log $ (_.x >>> _.y) { x: { y: "Nested" } }
14+ log $ _.value { value: "Done" }
examples/passing/ObjectSynonym.pursnew file+16
@@ -0,0 +1,16 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+type Inner = Number
7+
8+inner :: Inner
9+inner = 0.0
10+
11+type Outer = { inner :: Inner }
12+
13+outer :: Outer
14+outer = { inner: inner }
15+
16+main = log "Done"
examples/passing/ObjectUpdate.pursnew file+23
@@ -0,0 +1,23 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+update1 = \o -> o { foo = "Foo" }
7+
8+update2 :: forall r. { foo :: String | r } -> { foo :: String | r }
9+update2 = \o -> o { foo = "Foo" }
10+
11+replace = \o -> case o of
12+ { foo: "Foo" } -> o { foo = "Bar" }
13+ { foo: "Bar" } -> o { bar = "Baz" }
14+ o -> o
15+
16+polyUpdate :: forall a r. { foo :: a | r } -> { foo :: String | r }
17+polyUpdate = \o -> o { foo = "Foo" }
18+
19+inferPolyUpdate = \o -> o { foo = "Foo" }
20+
21+main = do
22+ log ((update1 {foo: ""}).foo)
23+ log "Done"
examples/passing/ObjectUpdate2.pursnew file+18
@@ -0,0 +1,18 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+type X r = { | r }
7+
8+x :: X (baz :: String)
9+x = { baz: "baz" }
10+
11+blah :: forall r. X r -> X r
12+blah x = x
13+
14+test = blah x
15+ { baz = "blah"
16+ }
17+
18+main = log "Done"
examples/passing/ObjectUpdater.pursnew file+26
@@ -0,0 +1,26 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff
5+import Control.Monad.Eff.Console
6+import Test.Assert
7+
8+getValue :: forall e. Eff (| e) Boolean
9+getValue = pure true
10+
11+main = do
12+ let record = { value: false }
13+ record' <- record { value = _ } <$> getValue
14+ assert $ record'.value == true
15+
16+ let point = { x: 1.0, y: 1.0 }
17+ x = 10.0
18+ point' = (point { x = _, y = x }) 100.0
19+
20+ assert $ point'.x == 100.0
21+ assert $ point'.y == 10.0
22+
23+ let record2 = (_ { x = _ }) { x: 0.0 } 10.0
24+ assert $ record2.x == 10.0
25+
26+ log "Done"
examples/passing/ObjectWildcards.pursnew file+20
@@ -0,0 +1,20 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff
5+import Control.Monad.Eff.Console
6+import Test.Assert
7+
8+mkRecord = { foo: _, bar: _, baz: "baz" }
9+
10+getValue :: forall e. Eff (| e) Boolean
11+getValue = pure true
12+
13+main = do
14+ obj <- { value: _ } <$> getValue
15+ logShow obj.value
16+ let x = 1.0
17+ point <- { x: _, y: x } <$> pure 2.0
18+ assert $ point.x == 2.0
19+ assert $ point.y == 1.0
20+ log (mkRecord 1.0 "Done").bar
examples/passing/Objects.pursnew file+36
@@ -0,0 +1,36 @@
1+module Main where
2+
3+import Prelude hiding (append)
4+import Control.Monad.Eff.Console (log)
5+
6+test = \x -> x.foo + x.bar + 1.0
7+
8+append = \o -> { foo: o.foo, bar: 1.0 }
9+
10+apTest = append({foo : "Foo", baz: "Baz"})
11+
12+f = (\a -> a.b.c) { b: { c: 1.0, d: "Hello" }, e: "World" }
13+
14+g = (\a -> a.f { x: 1.0, y: "y" }) { f: \o -> o.x + 1.0 }
15+
16+typed :: { foo :: Number }
17+typed = { foo: 0.0 }
18+
19+test2 = \x -> x."!@#"
20+
21+test3 = typed."foo"
22+
23+test4 = test2 weirdObj
24+ where
25+ weirdObj :: { "!@#" :: Number }
26+ weirdObj = { "!@#": 1.0 }
27+
28+test5 = case { "***": 1.0 } of
29+ { "***": n } -> n
30+
31+test6 = case { "***": 1.0 } of
32+ { "***": n } -> n
33+
34+test7 {a: snoog , b : blah } = blah
35+
36+main = log "Done"
examples/passing/OneConstructor.pursnew file+10
@@ -0,0 +1,10 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+data One a = One a
7+
8+one' (One a) = a
9+
10+main = log "Done"
examples/passing/OperatorAlias.pursnew file+11
@@ -0,0 +1,11 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console
5+
6+infixl 4 what as ?!
7+
8+what :: forall a b. a -> b -> a
9+what a _ = a
10+
11+main = log $ "Done" ?! true
examples/passing/OperatorAliasElsewhere.pursnew file+9
@@ -0,0 +1,9 @@
1+module Main where
2+
3+import Prelude
4+import Def (what)
5+import Control.Monad.Eff.Console
6+
7+infixl 4 what as ?!
8+
9+main = log $ "Done" ?! true
examples/passing/OperatorAliasElsewhere/Def.pursnew file+4
@@ -0,0 +1,4 @@
1+module Def where
2+
3+what :: forall a b. a -> b -> a
4+what a _ = a
examples/passing/OperatorAssociativity.pursnew file+25
@@ -0,0 +1,25 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff
5+import Control.Monad.Eff.Console
6+import Test.Assert
7+
8+bug :: Number -> Number -> Number
9+bug a b = 0.0 - (a - b)
10+
11+main = do
12+ assert (bug 0.0 2.0 == 2.0)
13+ assert (0.0 - (0.0 - 2.0) == 2.0)
14+ assert (0.0 - (0.0 + 2.0) == -2.0)
15+ assert (6.0 / (3.0 * 2.0) == 1.0)
16+ assert ((6.0 / 3.0) * 2.0 == 4.0)
17+ assert (not (1.0 < 0.0) == true)
18+ assert (not ((negate 1.0) < 0.0) == false)
19+ assert (negate (1.0 + 10.0) == -11.0)
20+ assert (2.0 * 3.0 / 4.0 == 1.5)
21+ assert (1.0 * 2.0 * 3.0 * 4.0 * 5.0 / 6.0 == 20.0)
22+ assert (1.0 + 10.0 - 5.0 == 6.0)
23+ assert (1.0 + 10.0 * 5.0 == 51.0)
24+ assert (10.0 * 5.0 - 1.0 == 49.0)
25+ log "Done"
examples/passing/OperatorInlining.pursnew file+48
@@ -0,0 +1,48 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (logShow, log)
5+
6+main = do
7+
8+ -- semiringNumber
9+ logShow (1.0 + 2.0)
10+ logShow (1.0 * 2.0)
11+
12+ -- ringNumber
13+ logShow (1.0 - 2.0)
14+ logShow (negate 1.0)
15+
16+ -- moduleSemiringNumber
17+ logShow (1.0 / 2.0)
18+
19+ -- ordNumber
20+ logShow (1.0 > 2.0)
21+ logShow (1.0 < 2.0)
22+ logShow (1.0 <= 2.0)
23+ logShow (1.0 >= 2.0)
24+ logShow (1.0 == 2.0)
25+
26+ -- eqNumber
27+ logShow (1.0 == 2.0)
28+ logShow (1.0 /= 2.0)
29+
30+ -- eqString
31+ logShow ("foo" == "bar")
32+ logShow ("foo" /= "bar")
33+
34+ -- eqBoolean
35+ logShow (true == false)
36+ logShow (true /= false)
37+
38+ -- semigroupString
39+ logShow ("foo" <> "bar")
40+
41+ -- latticeBoolean
42+ logShow (top && true)
43+ logShow (bottom || false)
44+
45+ -- complementedLatticeBoolean
46+ logShow (not true)
47+
48+ log "Done"
examples/passing/OperatorSections.pursnew file+18
@@ -0,0 +1,18 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+import Test.Assert
6+
7+main = do
8+ assert $ (_ / 2.0) 4.0 == 2.0
9+ assert $ (2.0 / _) 4.0 == 0.5
10+ assert $ (_ `const` 1.0) 2.0 == 2.0
11+ assert $ (1.0 `const` _) 2.0 == 1.0
12+ let foo = { x: 2.0 }
13+ assert $ (_ / foo.x) 4.0 == 2.0
14+ assert $ (foo.x / _) 4.0 == 0.5
15+ let div x y = x.x / y.x
16+ assert $ (_ `div` foo { x = 4.0 }) { x: 4.0 } == 1.0
17+ assert $ (foo { x = 4.0 } `div` _) { x: 4.0 } == 1.0
18+ log "Done"
examples/passing/Operators.pursnew file+91
@@ -0,0 +1,91 @@
1+module Main where
2+
3+import Prelude
4+import Other (foo)
5+import Other as Other
6+import Control.Monad.Eff
7+import Control.Monad.Eff.Console
8+
9+op1 :: forall a. a -> a -> a
10+op1 x _ = x
11+
12+infix 4 op1 as ?!
13+
14+test1 :: forall n. (Semiring n) => n -> n -> (n -> n -> n) -> n
15+test1 x y z = x * y + z x y
16+
17+test2 = (\x -> x.foo false) { foo : \_ -> 1.0 }
18+
19+test3 = (\x y -> x)(1.0 + 2.0 * (1.0 + 2.0)) (true && (false || false))
20+
21+k = \x -> \y -> x
22+
23+test4 = 1 `k` 2
24+
25+op2 :: Number -> Number -> Number
26+op2 x y = x * y + y
27+
28+infixl 5 op2 as %%
29+
30+test5 = 1.0 %% 2.0 %% 3.0
31+
32+test6 = ((\x -> x) `k` 2.0) 3.0
33+
34+op3 :: String -> String -> String
35+op3 = \s1 s2 -> s1 <> s2
36+
37+infix 4 op3 as <+>
38+
39+test7 = "Hello" <+> "World!"
40+
41+op4 :: forall a b. (a -> b) -> a -> b
42+op4 = \f x -> f x
43+
44+infix 4 op4 as @@
45+
46+test8 = foo @@ "Hello World"
47+
48+test9 = Other.foo @@ "Hello World"
49+
50+test10 = "Hello" `Other.baz` "World"
51+
52+op5 :: forall a. Array a -> Array a -> Array a
53+op5 = \as -> \bs -> as
54+
55+infix 4 op5 as ...
56+
57+test11 = [1.0, 2.0, 0.0] ... [4.0, 5.0, 6.0]
58+
59+test14 :: Number -> Number -> Boolean
60+test14 a b = a < b
61+
62+test15 :: Number -> Number -> Boolean
63+test15 a b = const false $ a `test14` b
64+
65+test17 :: Number
66+test17 = negate (-1.0)
67+
68+test18 :: Number
69+test18 = negate $ negate 1.0
70+
71+test19 :: Number
72+test19 = negate $ negate (-1.0)
73+
74+main = do
75+ let t1 = test1 1.0 2.0 (\x y -> x + y)
76+ let t2 = test2
77+ let t3 = test3
78+ let t4 = test4
79+ let t5 = test5
80+ let t6 = test6
81+ let t7 = test7
82+ let t8 = test8
83+ let t9 = test9
84+ let t10 = test10
85+ let t11 = test11
86+ let t14 = test14 1.0 2.0
87+ let t15 = test15 1.0 2.0
88+ let t17 = test17
89+ let t18 = test18
90+ let t19 = test19
91+ log "Done"
examples/passing/Operators/Other.pursnew file+7
@@ -0,0 +1,7 @@
1+module Other where
2+
3+foo :: String -> String
4+foo s = s
5+
6+baz :: String -> String -> String
7+baz s _ = s
examples/passing/OptimizerBug.pursnew file+10
@@ -0,0 +1,10 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+x a = 1.0 + y a
7+
8+y a = x a
9+
10+main = log "Done"
examples/passing/OptionalQualified.pursnew file+12
@@ -0,0 +1,12 @@
1+module Main where
2+
3+import Prelude as P
4+
5+-- qualified import without the "qualified" keyword
6+import Control.Monad.Eff.Console as Console
7+
8+bind = P.bind
9+
10+main = do
11+ message <- P.pure "Done"
12+ Console.log message
examples/passing/OverlappingInstances.pursnew file+17
@@ -0,0 +1,17 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+import Test.Assert (assert)
6+
7+data A = A
8+
9+instance showA1 :: Show A where
10+ show A = "Instance 1"
11+
12+instance showA2 :: Show A where
13+ show A = "Instance 2"
14+
15+main = do
16+ assert $ show A == "Instance 1"
17+ log "Done"
examples/passing/OverlappingInstances2.pursnew file+27
@@ -0,0 +1,27 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+import Test.Assert (assert)
6+
7+data A = A | B
8+
9+instance eqA1 :: Eq A where
10+ eq A A = true
11+ eq B B = true
12+ eq _ _ = false
13+
14+instance eqA2 :: Eq A where
15+ eq _ _ = true
16+
17+instance ordA :: Ord A where
18+ compare A B = LT
19+ compare B A = GT
20+ compare _ _ = EQ
21+
22+test :: forall a. (Ord a) => a -> a -> String
23+test x y = show $ x == y
24+
25+main = do
26+ assert $ test A B == "false"
27+ log "Done"
examples/passing/OverlappingInstances3.pursnew file+20
@@ -0,0 +1,20 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+import Test.Assert (assert)
6+
7+class Foo a
8+
9+instance foo1 :: Foo Number
10+
11+instance foo2 :: Foo Number
12+
13+test :: forall a. (Foo a) => a -> a
14+test a = a
15+
16+test1 = test 0.0
17+
18+main = do
19+ assert (test1 == 0.0)
20+ log "Done"
examples/passing/ParensInTypedBinder.pursnew file+20
@@ -0,0 +1,20 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff (Eff)
5+import Control.Monad.Eff.Console (CONSOLE, log)
6+
7+foo :: Array Int
8+foo = do
9+ xss :: Array (Array Int) <- [[[1,2,3], [4, 5]], [[6]]]
10+ xs :: Array Int <- xss
11+ xs
12+
13+main ::
14+ forall eff.
15+ Eff
16+ ( console :: CONSOLE
17+ | eff
18+ )
19+ Unit
20+main = log "Done"
examples/passing/PartialFunction.pursnew file+11
@@ -0,0 +1,11 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff
5+import Control.Monad.Eff.Console
6+
7+fn :: Partial => Number -> Number
8+fn 0.0 = 0.0
9+fn 1.0 = 2.0
10+
11+main = log "Done"
examples/passing/Patterns.pursnew file+23
@@ -0,0 +1,23 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+test = \x -> case x of
7+ { str: "Foo", bool: true } -> true
8+ { str: "Bar", bool: b } -> b
9+ _ -> false
10+
11+f = \o -> case o of
12+ { foo: "Foo" } -> o.bar
13+ _ -> 0
14+
15+h = \o -> case o of
16+ a@[_,_,_] -> a
17+ _ -> []
18+
19+isDesc :: Array Number -> Boolean
20+isDesc [x, y] | x > y = true
21+isDesc _ = false
22+
23+main = log "Done"
examples/passing/PendingConflictingImports.pursnew file+8
@@ -0,0 +1,8 @@
1+module Main where
2+
3+-- No error as we never force `thing` to be resolved in `Main`
4+import A
5+import B
6+import Control.Monad.Eff.Console (log)
7+
8+main = log "Done"
examples/passing/PendingConflictingImports/A.pursnew file+4
@@ -0,0 +1,4 @@
1+module A where
2+
3+thing :: Int
4+thing = 1
examples/passing/PendingConflictingImports/B.pursnew file+4
@@ -0,0 +1,4 @@
1+module B where
2+
3+thing :: Int
4+thing = 2
examples/passing/PendingConflictingImports2.pursnew file+10
@@ -0,0 +1,10 @@
1+module Main where
2+
3+import A
4+import Control.Monad.Eff.Console (log)
5+
6+-- No error as we never force `thing` to be resolved in `Main`
7+thing :: Int
8+thing = 2
9+
10+main = log "Done"
examples/passing/PendingConflictingImports2/A.pursnew file+4
@@ -0,0 +1,4 @@
1+module A where
2+
3+thing :: Int
4+thing = 1
examples/passing/Person.pursnew file+12
@@ -0,0 +1,12 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+data Person = Person { name :: String, age :: Number }
7+
8+showPerson :: Person -> String
9+showPerson = \p -> case p of
10+ Person o -> o.name <> ", aged " <> show o.age
11+
12+main = log "Done"
examples/passing/PrimedTypeName.pursnew file+20
@@ -0,0 +1,20 @@
1+module Main (T, T', T'', T''', main) where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+data T a = T
7+type T' = T Unit
8+
9+data T'' = TP
10+
11+foreign import data T''' ∷ *
12+
13+instance eqT ∷ Eq T'' where
14+ eq _ _ = true
15+
16+type A' a b = b → a
17+
18+infixr 4 type A' as ↫
19+
20+main = log "Done"
examples/passing/QualifiedNames.pursnew file+11
@@ -0,0 +1,11 @@
1+module Main where
2+
3+import Prelude
4+import Either as Either
5+import Control.Monad.Eff.Console (log)
6+
7+either :: forall a b c. (a -> c) -> (b -> c) -> Either.Either a b -> c
8+either f _ (Either.Left x) = f x
9+either _ g (Either.Right y) = g y
10+
11+main = log (either id id (Either.Left "Done"))
examples/passing/QualifiedNames/Either.pursnew file+5
@@ -0,0 +1,5 @@
1+module Either where
2+
3+import Prelude
4+
5+data Either a b = Left a | Right b
examples/passing/QualifiedQualifiedImports.pursnew file+6
@@ -0,0 +1,6 @@
1+module Main where
2+
3+-- qualified import with qualified imported names
4+import Control.Monad.Eff.Console (log) as Console
5+
6+main = Console.log "Done"
examples/passing/Rank2Data.pursnew file+30
@@ -0,0 +1,30 @@
1+module Main where
2+
3+import Prelude hiding (add)
4+import Control.Monad.Eff.Console (log)
5+
6+data Id = Id forall a. a -> a
7+
8+runId = \id a -> case id of
9+ Id f -> f a
10+
11+data Nat = Nat forall r. r -> (r -> r) -> r
12+
13+runNat = \nat -> case nat of
14+ Nat f -> f 0.0 (\n -> n + 1.0)
15+
16+zero' = Nat (\zero' _ -> zero')
17+
18+succ = \n -> case n of
19+ Nat f -> Nat (\zero' succ -> succ (f zero' succ))
20+
21+add = \n m -> case n of
22+ Nat f -> case m of
23+ Nat g -> Nat (\zero' succ -> g (f zero' succ) succ)
24+
25+one' = succ zero'
26+two = succ zero'
27+four = add two two
28+fourNumber = runNat four
29+
30+main = log "Done"
examples/passing/Rank2Object.pursnew file+11
@@ -0,0 +1,11 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console
5+
6+data Foo = Foo { id :: forall a. a -> a }
7+
8+foo :: Foo -> Number
9+foo (Foo { id: f }) = f 0.0
10+
11+main = log "Done"
examples/passing/Rank2TypeSynonym.pursnew file+17
@@ -0,0 +1,17 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log, logShow)
5+
6+type Foo a = forall f. (Monad f) => f a
7+
8+foo :: forall a. a -> Foo a
9+foo x = pure x
10+
11+bar :: Foo Number
12+bar = foo 3.0
13+
14+main = do
15+ x <- bar
16+ logShow x
17+ log "Done"
examples/passing/Rank2Types.pursnew file+12
@@ -0,0 +1,12 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+test1 :: (forall a. (a -> a)) -> Number
7+test1 = \f -> f 0.0
8+
9+forever :: forall m a b. (forall a b. m a -> (a -> m b) -> m b) -> m a -> m b
10+forever = \bind action -> bind action $ \_ -> forever bind action
11+
12+main = log "Done"
examples/passing/ReExportQualified.pursnew file+7
@@ -0,0 +1,7 @@
1+module Main where
2+
3+import Prelude
4+import C
5+import Control.Monad.Eff.Console (log)
6+
7+main = log (x <> y)
examples/passing/ReExportQualified/A.pursnew file+3
@@ -0,0 +1,3 @@
1+module A where
2+
3+x = "Do"
examples/passing/ReExportQualified/B.pursnew file+3
@@ -0,0 +1,3 @@
1+module B where
2+
3+y = "ne"
examples/passing/ReExportQualified/C.pursnew file+4
@@ -0,0 +1,4 @@
1+module C (module A, module M2) where
2+
3+import A
4+import B as M2
examples/passing/RebindableSyntax.pursnew file+43
@@ -0,0 +1,43 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+example1 :: String
7+example1 = do
8+ "Do"
9+ " notation"
10+ " for"
11+ " Semigroup"
12+ where
13+ bind x f = x <> f unit
14+
15+applySecond :: forall f a b. (Apply f) => f a -> f b -> f b
16+applySecond fa fb = const id <$> fa <*> fb
17+
18+infixl 4 applySecond as *>
19+
20+newtype Const a b = Const a
21+
22+runConst :: forall a b. Const a b -> a
23+runConst (Const a) = a
24+
25+instance functorConst :: Functor (Const a) where
26+ map _ (Const a) = Const a
27+
28+instance applyConst :: (Semigroup a) => Apply (Const a) where
29+ apply (Const a1) (Const a2) = Const (a1 <> a2)
30+
31+example2 :: Const String Unit
32+example2 = do
33+ Const "Do"
34+ Const " notation"
35+ Const " for"
36+ Const " Apply"
37+ where
38+ bind x f = x *> f unit
39+
40+main = do
41+ log example1
42+ log $ runConst example2
43+ log "Done"
examples/passing/Recursion.pursnew file+11
@@ -0,0 +1,11 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+fib = \n -> case n of
7+ 0.0 -> 1.0
8+ 1.0 -> 1.0
9+ n -> fib (n - 1.0) + fib (n - 2.0)
10+
11+main = log "Done"
examples/passing/RedefinedFixity.pursnew file+6
@@ -0,0 +1,6 @@
1+module Main where
2+
3+import M3
4+import Control.Monad.Eff.Console (log)
5+
6+main = log "Done"
examples/passing/RedefinedFixity/M1.pursnew file+6
@@ -0,0 +1,6 @@
1+module M1 where
2+
3+applyFn :: forall a b. (forall c d. c -> d) -> a -> b
4+applyFn f a = f a
5+
6+infixr 1000 applyFn as $
examples/passing/RedefinedFixity/M2.pursnew file+5
@@ -0,0 +1,5 @@
1+module M2 where
2+
3+import Prelude ()
4+
5+import M1
examples/passing/RedefinedFixity/M3.pursnew file+6
@@ -0,0 +1,6 @@
1+module M3 where
2+
3+import Prelude ()
4+
5+import M1
6+import M2
examples/passing/ReservedWords.pursnew file+19
@@ -0,0 +1,19 @@
1+-- See https://github.com/purescript/purescript/issues/606
2+module Main where
3+
4+import Prelude
5+import Control.Monad.Eff
6+import Control.Monad.Eff.Console (log)
7+
8+o :: { type :: String }
9+o = { type: "o" }
10+
11+p :: { type :: String }
12+p = o { type = "p" }
13+
14+f :: forall r. { type :: String | r } -> String
15+f { type: "p" } = "Done"
16+f _ = "Fail"
17+
18+main :: Eff _ _
19+main = log $ f { type: p.type, foo: "bar" }
examples/passing/ResolvableScopeConflict.pursnew file+13
@@ -0,0 +1,13 @@
1+module Main where
2+
3+import A (thing)
4+import B
5+import Control.Monad.Eff.Console (log)
6+
7+-- Not an error as although we have `thing` in scope from both A and B, it is
8+-- imported explicitly from A, giving it a resolvable solution.
9+what :: Boolean -> Int
10+what true = thing
11+what false = zing
12+
13+main = log "Done"
examples/passing/ResolvableScopeConflict/A.pursnew file+4
@@ -0,0 +1,4 @@
1+module A where
2+
3+thing :: Int
4+thing = 1
examples/passing/ResolvableScopeConflict/B.pursnew file+7
@@ -0,0 +1,7 @@
1+module B where
2+
3+thing :: Int
4+thing = 2
5+
6+zing :: Int
7+zing = 3
examples/passing/ResolvableScopeConflict2.pursnew file+15
@@ -0,0 +1,15 @@
1+module Main where
2+
3+import A
4+import Control.Monad.Eff.Console (log)
5+
6+thing :: Int
7+thing = 1
8+
9+-- Not an error as although we have `thing` in scope from both Main and A,
10+-- as the local declaration takes precedence over the implicit import
11+what :: Boolean -> Int
12+what true = thing
13+what false = zing
14+
15+main = log "Done"
examples/passing/ResolvableScopeConflict2/A.pursnew file+7
@@ -0,0 +1,7 @@
1+module A where
2+
3+thing :: Int
4+thing = 2
5+
6+zing :: Int
7+zing = 3
examples/passing/ResolvableScopeConflict3.pursnew file+9
@@ -0,0 +1,9 @@
1+module Main (thing, main, module A) where
2+
3+import A
4+import Control.Monad.Eff.Console (log)
5+
6+thing :: Int
7+thing = 2
8+
9+main = log "Done"
examples/passing/ResolvableScopeConflict3/A.pursnew file+4
@@ -0,0 +1,4 @@
1+module A where
2+
3+thing :: Int
4+thing = 1
examples/passing/RowConstructors.pursnew file+43
@@ -0,0 +1,43 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+type Foo = (x :: Number | (y :: Number | (z :: Number)))
7+type Bar = (x :: Number, y :: Number, z :: Number)
8+type Baz = { w :: Number | Bar }
9+
10+foo :: { | Foo }
11+foo = { x: 0.0, y: 0.0, z: 0.0 }
12+
13+bar :: { | Bar }
14+bar = { x: 0.0, y: 0.0, z: 0.0 }
15+
16+id' :: Record Foo -> Record Bar
17+id' = id
18+
19+foo' :: { | Foo }
20+foo' = id' foo
21+
22+bar' :: { | Bar }
23+bar' = id' bar
24+
25+baz :: Baz
26+baz = { x: 0.0, y: 0.0, z: 0.0, w: 0.0 }
27+
28+type Quux r = (q :: Number | r)
29+type Norf r = (q' :: Number | Quux r)
30+
31+quux :: { f :: { | Foo } | Quux Bar }
32+quux = { f: foo', x: 0.0, y: 0.0, z: 0.0, q: 0.0 }
33+
34+quux' :: { | Norf Bar }
35+quux' = { x: 0.0, y: 0.0, z: 0.0, q: 0.0, q': 0.0 }
36+
37+wildcard :: { w :: Number | _ } -> Baz
38+wildcard { w: w } = { x: w, y: w, z: w, w: w }
39+
40+wildcard' :: { | Quux _ } -> Number
41+wildcard' { q: q } = q
42+
43+main = log "Done"
examples/passing/RowPolyInstanceContext.pursnew file+23
@@ -0,0 +1,23 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+class T s m where
7+ state :: (s -> s) -> m Unit
8+
9+data S s a = S (s -> { new :: s, ret :: a })
10+
11+instance st :: T s (S s) where
12+ state f = S $ \s -> { new: f s, ret: unit }
13+
14+test1 :: forall r . S { foo :: String | r } Unit
15+test1 = state $ \o -> o { foo = o.foo <> "!" }
16+
17+test2 :: forall m r . (T { foo :: String | r } m) => m Unit
18+test2 = state $ \o -> o { foo = o.foo <> "!" }
19+
20+main = do
21+ let t1 = test1
22+ let t2 = test2
23+ log "Done"
examples/passing/RuntimeScopeIssue.pursnew file+22
@@ -0,0 +1,22 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log, logShow)
5+
6+class A a where
7+ a :: a -> Boolean
8+
9+class B a where
10+ b :: a -> Boolean
11+
12+instance aNumber :: A Number where
13+ a 0.0 = true
14+ a n = b (n - 1.0)
15+
16+instance bNumber :: B Number where
17+ b 0.0 = false
18+ b n = a (n - 1.0)
19+
20+main = do
21+ logShow $ a 10.0
22+ log "Done"
examples/passing/ScopedTypeVariables.pursnew file+37
@@ -0,0 +1,37 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+test1 :: forall a. (a -> a) -> a -> a
7+test1 f x = g (g x)
8+ where
9+ g :: a -> a
10+ g y = f (f y)
11+
12+test2 :: forall a. (a -> a) -> a -> a
13+test2 = h
14+ where
15+ h :: forall b. (b -> b) -> b -> b
16+ h f x = g (g x)
17+ where
18+ g :: b -> b
19+ g y = f (f y)
20+
21+test3 :: Number
22+test3 = ((\b -> b :: b) :: forall b. b -> b) 0.0
23+
24+test4 :: forall a. (a -> a) -> a -> a
25+test4 = h
26+ where
27+ h :: forall b. (b -> b) -> b -> b
28+ h f x = g (g x)
29+ where
30+ g :: b -> b
31+ g y = j (f (f y))
32+ where
33+ j :: forall b. b -> b
34+ j x = x
35+
36+
37+main = log "Done"
examples/passing/Sequence.pursnew file+16
@@ -0,0 +1,16 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff
5+import Control.Monad.Eff.Console (log)
6+
7+data List a = Cons a (List a) | Nil
8+
9+class Sequence t where
10+ sequence :: forall m a. (Monad m) => t (m a) -> m (t a)
11+
12+instance sequenceList :: Sequence List where
13+ sequence Nil = pure Nil
14+ sequence (Cons x xs) = Cons <$> x <*> sequence xs
15+
16+main = sequence $ Cons (log "Done") Nil
examples/passing/SequenceDesugared.pursnew file+38
@@ -0,0 +1,38 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff
5+import Control.Monad.Eff.Console (log)
6+
7+data List a = Cons a (List a) | Nil
8+
9+data Sequence t = Sequence (forall m a. (Monad m) => t (m a) -> m (t a))
10+
11+sequence :: forall t. Sequence t -> (forall m a. (Monad m) => t (m a) -> m (t a))
12+sequence (Sequence s) = s
13+
14+sequenceListSeq :: forall m a. (Monad m) => List (m a) -> m (List a)
15+sequenceListSeq Nil = pure Nil
16+sequenceListSeq (Cons x xs) = Cons <$> x <*> sequenceListSeq xs
17+
18+sequenceList :: Sequence List
19+sequenceList = Sequence (sequenceListSeq)
20+
21+sequenceList' :: Sequence List
22+sequenceList' = Sequence ((\val -> case val of
23+ Nil -> pure Nil
24+ Cons x xs -> Cons <$> x <*> sequence sequenceList' xs))
25+
26+sequenceList'' :: Sequence List
27+sequenceList'' = Sequence (sequenceListSeq :: forall m a. (Monad m) => List (m a) -> m (List a))
28+
29+sequenceList''' :: Sequence List
30+sequenceList''' = Sequence ((\val -> case val of
31+ Nil -> pure Nil
32+ Cons x xs -> Cons <$> x <*> sequence sequenceList''' xs) :: forall m a. (Monad m) => List (m a) -> m (List a))
33+
34+main = do
35+ sequence sequenceList $ Cons (log "Done") Nil
36+ sequence sequenceList' $ Cons (log "Done") Nil
37+ sequence sequenceList'' $ Cons (log "Done") Nil
38+ sequence sequenceList''' $ Cons (log "Done") Nil
examples/passing/ShadowedModuleName.pursnew file+8
@@ -0,0 +1,8 @@
1+module Main where
2+
3+import Test
4+import Control.Monad.Eff.Console
5+
6+data Test = Test
7+
8+main = log (runZ (Z "Done"))
examples/passing/ShadowedModuleName/Test.pursnew file+6
@@ -0,0 +1,6 @@
1+module Test where
2+
3+data Z = Z String
4+
5+runZ :: Z -> String
6+runZ (Z s) = s
examples/passing/ShadowedName.pursnew file+11
@@ -0,0 +1,11 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console
5+import Control.Monad.Eff.Console (log)
6+
7+done :: String
8+done = let str = "Not yet done" in
9+ let str = "Done" in str
10+
11+main = log done
examples/passing/ShadowedRename.pursnew file+14
@@ -0,0 +1,14 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff
5+import Control.Monad.Eff.Console
6+import Test.Assert
7+
8+foo foo = let foo_1 = \_ -> foo
9+ foo_2 = foo_1 unit + 1.0
10+ in foo_2
11+
12+main = do
13+ assert $ foo 1.0 == 2.0
14+ log "Done"
examples/passing/ShadowedTCO.pursnew file+21
@@ -0,0 +1,21 @@
1+module Main where
2+
3+import Prelude hiding (add)
4+import Control.Monad.Eff.Console (log)
5+
6+runNat f = f 0.0 (\n -> n + 1.0)
7+
8+zero' z _ = z
9+
10+succ f zero' succ = succ (f zero' succ)
11+
12+add f g zero' succ = g (f zero' succ) succ
13+
14+one' = succ zero'
15+two = succ one'
16+four = add two two
17+fourNumber = runNat four
18+
19+main = do
20+ log $ show fourNumber
21+ log "Done"
examples/passing/ShadowedTCOLet.pursnew file+15
@@ -0,0 +1,15 @@
1+module Main where
2+
3+import Prelude
4+import Partial.Unsafe (unsafePartial)
5+import Control.Monad.Eff
6+import Control.Monad.Eff.Console (log)
7+
8+f x y z =
9+ let f 1.0 2.0 3.0 = 1.0
10+ in f x z y
11+
12+main :: Eff _ _
13+main = do
14+ log $ show $ unsafePartial f 1.0 3.0 2.0
15+ log "Done"
examples/passing/SignedNumericLiterals.pursnew file+18
@@ -0,0 +1,18 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+p = 0.5
7+q = 1.0
8+x = -1.0
9+y = -0.5
10+z = 0.5
11+w = 1.0
12+
13+f :: Number -> Number
14+f x = -x
15+
16+test1 = 2.0 - 1.0
17+
18+main = log "Done"
examples/passing/StringEscapes.pursnew file+17
@@ -0,0 +1,17 @@
1+module Main where
2+
3+import Prelude ((==), bind)
4+import Test.Assert (assert)
5+import Control.Monad.Eff.Console (log)
6+
7+singleCharacter = "\0\b\t\n\v\f\r\"\\" == "\x0\x8\x9\xA\xB\xC\xD\x22\x5C"
8+hex = "\x1D306\x2603\x3C6\xE0\x0" == "𝌆☃φà\0"
9+decimal = "\119558\9731\966\224\0" == "𝌆☃φà\0"
10+surrogatePair = "\xD834\xDF06" == "\x1D306"
11+
12+main = do
13+ assert singleCharacter
14+ assert hex
15+ assert decimal
16+ assert surrogatePair
17+ log "Done"
examples/passing/Superclasses1.pursnew file+23
@@ -0,0 +1,23 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log, logShow)
5+
6+class Su a where
7+ su :: a -> a
8+
9+class (Su a) <= Cl a where
10+ cl :: a -> a -> a
11+
12+instance suNumber :: Su Number where
13+ su n = n + 1.0
14+
15+instance clNumber :: Cl Number where
16+ cl n m = n + m
17+
18+test :: forall a. (Cl a) => a -> a
19+test a = su (cl a a)
20+
21+main = do
22+ logShow $ test 10.0
23+ log "Done"
examples/passing/Superclasses3.pursnew file+41
@@ -0,0 +1,41 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console
5+import Control.Monad.Eff
6+
7+class (Monad m) <= MonadWriter w m where
8+ tell :: w -> m Unit
9+
10+testFunctor :: forall m. (Monad m) => m Number -> m Number
11+testFunctor n = (+) 1.0 <$> n
12+
13+test :: forall w m. (Monad m, MonadWriter w m) => w -> m Unit
14+test w = do
15+ tell w
16+ tell w
17+ tell w
18+
19+data MTrace a = MTrace (Eff (console :: CONSOLE) a)
20+
21+runMTrace :: forall a. MTrace a -> Eff (console :: CONSOLE) a
22+runMTrace (MTrace a) = a
23+
24+instance functorMTrace :: Functor MTrace where
25+ map = liftM1
26+
27+instance applyMTrace :: Apply MTrace where
28+ apply = ap
29+
30+instance applicativeMTrace :: Applicative MTrace where
31+ pure = MTrace <<< pure
32+
33+instance bindMTrace :: Bind MTrace where
34+ bind m f = MTrace (runMTrace m >>= (runMTrace <<< f))
35+
36+instance monadMTrace :: Monad MTrace
37+
38+instance writerMTrace :: MonadWriter String MTrace where
39+ tell s = MTrace (log s)
40+
41+main = runMTrace $ test "Done"
examples/passing/TCO.pursnew file+20
@@ -0,0 +1,20 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log, logShow)
5+
6+main = do
7+ let f x = x + 1
8+ let v = 0
9+ logShow (applyN 0 f v)
10+ logShow (applyN 1 f v)
11+ logShow (applyN 2 f v)
12+ logShow (applyN 3 f v)
13+ logShow (applyN 4 f v)
14+ log "Done"
15+
16+applyN :: forall a. Int -> (a -> a) -> a -> a
17+applyN = go id
18+ where
19+ go f n _ | n <= 0 = f
20+ go f n g = go (f >>> g) (n - 1) g
examples/passing/TCOCase.pursnew file+13
@@ -0,0 +1,13 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+data Data = One | More Data
7+
8+main = log (from (to 10000.0 One))
9+ where
10+ to 0.0 a = a
11+ to n a = to (n - 1.0) (More a)
12+ from One = "Done"
13+ from (More d) = from d
examples/passing/TailCall.pursnew file+20
@@ -0,0 +1,20 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log, logShow)
5+
6+data L a = C a (L a) | N
7+
8+test :: Number -> L Number -> Number
9+test n N = n
10+test n (C x xs) = test (n + x) xs
11+
12+loop :: forall a. Number -> a
13+loop x = loop (x + 1.0)
14+
15+notATailCall = \x ->
16+ (\notATailCall -> notATailCall x) (\x -> x)
17+
18+main = do
19+ logShow (test 0.0 (1.0 `C` (2.0 `C` (3.0 `C` N))))
20+ log "Done"
examples/passing/Tick.pursnew file+8
@@ -0,0 +1,8 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+test' x = x
7+
8+main = log "Done"
examples/passing/TopLevelCase.pursnew file+19
@@ -0,0 +1,19 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+gcd :: Number -> Number -> Number
7+gcd 0.0 x = x
8+gcd x 0.0 = x
9+gcd x y | x > y = gcd (x `mod` y) y
10+gcd x y = gcd (y `mod` x) x
11+
12+guardsTest [x] | x > 0.0 = []
13+guardsTest xs = xs
14+
15+data A = A
16+
17+parseTest A 0.0 = 0.0
18+
19+main = log "Done"
examples/passing/TransitiveImport.pursnew file+9
@@ -0,0 +1,9 @@
1+module Main where
2+
3+ import Prelude
4+ import Middle
5+ import Control.Monad.Eff.Console
6+
7+ main = do
8+ logShow (middle unit)
9+ log "Done"
examples/passing/TransitiveImport/Middle.pursnew file+5
@@ -0,0 +1,5 @@
1+module Middle where
2+
3+import Test (test)
4+
5+middle = test
examples/passing/TransitiveImport/Test.pursnew file+9
@@ -0,0 +1,9 @@
1+module Test where
2+
3+import Prelude
4+
5+class TestCls a where
6+ test :: a -> a
7+
8+instance unitTestCls :: TestCls Unit where
9+ test _ = unit
examples/passing/TypeClassMemberOrderChange.pursnew file+16
@@ -0,0 +1,16 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+class Test a where
7+ fn :: a -> a -> a
8+ val :: a
9+
10+instance testBoolean :: Test Boolean where
11+ val = true
12+ fn x y = y
13+
14+main = do
15+ log (show (fn true val))
16+ log "Done"
examples/passing/TypeClasses.pursnew file+71
@@ -0,0 +1,71 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+test1 = \_ -> show "testing"
7+
8+f :: forall a. (Show a) => a -> String
9+f x = show x
10+
11+test2 = \_ -> f "testing"
12+
13+test7 :: forall a. (Show a) => a -> String
14+test7 = show
15+
16+test8 = \_ -> show $ "testing"
17+
18+data Data a = Data a
19+
20+instance showData :: (Show a) => Show (Data a) where
21+ show (Data a) = "Data (" <> show a <> ")"
22+
23+test3 = \_ -> show (Data "testing")
24+
25+instance functorData :: Functor Data where
26+ map = liftM1
27+
28+instance applyData :: Apply Data where
29+ apply = ap
30+
31+instance applicativeData :: Applicative Data where
32+ pure = Data
33+
34+instance bindData :: Bind Data where
35+ bind (Data a) f = f a
36+
37+instance monadData :: Monad Data
38+
39+data Maybe a = Nothing | Just a
40+
41+instance functorMaybe :: Functor Maybe where
42+ map = liftM1
43+
44+instance applyMaybe :: Apply Maybe where
45+ apply = ap
46+
47+instance applicativeMaybe :: Applicative Maybe where
48+ pure = Just
49+
50+instance bindMaybe :: Bind Maybe where
51+ bind Nothing _ = Nothing
52+ bind (Just a) f = f a
53+
54+instance monadMaybe :: Monad Maybe
55+
56+test4 :: forall a m. (Monad m) => a -> m Number
57+test4 = \_ -> pure 1.0
58+
59+test5 = \_ -> Just 1.0 >>= \n -> pure (n + 1.0)
60+
61+ask r = r
62+
63+runReader r f = f r
64+
65+test9 _ = runReader 0.0 $ do
66+ n <- ask
67+ pure $ n + 1.0
68+
69+main = do
70+ log (test7 "Hello")
71+ log "Done"
examples/passing/TypeClassesInOrder.pursnew file+12
@@ -0,0 +1,12 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+class Foo a where
7+ foo :: a -> String
8+
9+instance fooString :: Foo String where
10+ foo s = s
11+
12+main = log $ foo "Done"
examples/passing/TypeClassesWithOverlappingTypeVariables.pursnew file+12
@@ -0,0 +1,12 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+data Either a b = Left a | Right b
7+
8+instance functorEither :: Functor (Either a) where
9+ map _ (Left x) = Left x
10+ map f (Right y) = Right (f y)
11+
12+main = log "Done"
examples/passing/TypeDecl.pursnew file+13
@@ -0,0 +1,13 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+k :: String -> Number -> String
7+k x y = x
8+
9+iterate :: forall a. Number -> (a -> a) -> a -> a
10+iterate 0.0 f a = a
11+iterate n f a = iterate (n - 1.0) f (f a)
12+
13+main = log "Done"
examples/passing/TypeOperators.pursnew file+20
@@ -0,0 +1,20 @@
1+module Main where
2+
3+import A (type (~>), type (/\), (/\))
4+import Control.Monad.Eff.Console (log)
5+
6+natty ∷ ∀ f. f ~> f
7+natty x = x
8+
9+data Compose f g a = Compose (f (g a))
10+
11+testPrecedence1 ∷ ∀ f g. Compose f g ~> Compose f g
12+testPrecedence1 x = x
13+
14+testPrecedence2 ∷ ∀ f g. f ~> g → f ~> g
15+testPrecedence2 nat fx = nat fx
16+
17+swap ∷ ∀ a b. a /\ b → b /\ a
18+swap (a /\ b) = b /\ a
19+
20+main = log "Done"
examples/passing/TypeOperators/A.pursnew file+22
@@ -0,0 +1,22 @@
1+module A
2+( Tuple(..)
3+, type (/\)
4+, (/\)
5+, Natural
6+, type (~>)
7+) where
8+
9+data Tuple a b = Tuple a b
10+
11+infixl 6 Tuple as /\
12+infixl 6 type Tuple as /\
13+
14+type Natural f g = ∀ a. f a → g a
15+
16+infixr 0 type Natural as ~>
17+
18+tup ∷ ∀ a b. a → b → b /\ a
19+tup a b = b /\ a
20+
21+tupX ∷ ∀ a b c. a /\ b /\ c → c
22+tupX (a /\ b /\ c) = c
examples/passing/TypeSynonymInData.pursnew file+12
@@ -0,0 +1,12 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+type A a = Array a
7+
8+data Foo a = Foo (A a) | Bar
9+
10+foo (Foo []) = Bar
11+
12+main = log "Done"
examples/passing/TypeSynonyms.pursnew file+28
@@ -0,0 +1,28 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+type Lens a b =
7+ { get :: a -> b
8+ , set :: a -> b -> a
9+ }
10+
11+composeLenses :: forall a b c. Lens a b -> Lens b c -> Lens a c
12+composeLenses = \l1 -> \l2 ->
13+ { get: \a -> l2.get (l1.get a)
14+ , set: \a c -> l1.set a (l2.set (l1.get a) c)
15+ }
16+
17+type Pair a b = { fst :: a, snd :: b }
18+
19+fst :: forall a b. Lens (Pair a b) a
20+fst =
21+ { get: \p -> p.fst
22+ , set: \p a -> { fst: a, snd: p.snd }
23+ }
24+
25+test1 :: forall a b c. Lens (Pair (Pair a b) c) a
26+test1 = composeLenses fst fst
27+
28+main = log "Done"
examples/passing/TypeWildcards.pursnew file+16
@@ -0,0 +1,16 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+testTopLevel :: _ -> _
7+testTopLevel n = n + 1.0
8+
9+test :: forall a. (Eq a) => (a -> a) -> a -> a
10+test f a = go (f a) a
11+ where
12+ go :: _ -> _ -> _
13+ go a1 a2 | a1 == a2 = a1
14+ go a1 _ = go (f a1) a1
15+
16+main = log "Done"
examples/passing/TypeWildcardsRecordExtension.pursnew file+9
@@ -0,0 +1,9 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+foo :: forall a. {b :: Number | a} -> {b :: Number | _}
7+foo f = f
8+
9+main = log "Done"
examples/passing/TypeWithoutParens.pursnew file+12
@@ -0,0 +1,12 @@
1+module Main where
2+
3+import Lib (X, Y)
4+import Control.Monad.Eff.Console (log)
5+
6+idX :: X -> X
7+idX x = x
8+
9+idY :: Y -> Y
10+idY y = y
11+
12+main = log "Done"
examples/passing/TypeWithoutParens/Lib.pursnew file+4
@@ -0,0 +1,4 @@
1+module Lib (X, Y) where
2+
3+data X = X
4+type Y = X
examples/passing/TypedBinders.pursnew file+68
@@ -0,0 +1,68 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+data Tuple a b = Tuple a b
7+
8+class MonadState s m where
9+ get :: m s
10+ put :: s -> m {}
11+
12+data State s a = State (s -> Tuple s a)
13+
14+runState s (State f) = f s
15+
16+instance functorState :: Functor (State s) where
17+ map = liftM1
18+
19+instance applyState :: Apply (State s) where
20+ apply = ap
21+
22+instance applicativeState :: Applicative (State s) where
23+ pure a = State $ \s -> Tuple s a
24+
25+instance bindState :: Bind (State s) where
26+ bind f g = State $ \s -> case runState s f of
27+ Tuple s1 a -> runState s1 (g a)
28+
29+instance monadState :: Monad (State s)
30+
31+instance monadStateState :: MonadState s (State s) where
32+ get = State (\s -> Tuple s s)
33+ put s = State (\_ -> Tuple s {})
34+
35+modify :: forall m s. (Monad m, MonadState s m) => (s -> s) -> m {}
36+modify f = do
37+ s <- get
38+ put (f s)
39+
40+test :: Tuple String String
41+test = runState "" $ do
42+ modify $ (<>) "World!"
43+ modify $ (<>) "Hello, "
44+ str :: String <- get
45+ pure str
46+
47+test2 :: (Int -> Int) -> Int
48+test2 = (\(f :: Int -> Int) -> f 10)
49+
50+test3 :: Int -> Boolean
51+test3 n = case n of
52+ (0 :: Int) -> true
53+ _ -> false
54+
55+test4 :: Tuple Int Int -> Tuple Int Int
56+test4 = (\(Tuple a b :: Tuple Int Int) -> Tuple b a)
57+
58+type Int1 = Int
59+
60+test5 :: Int1 -> Int1
61+test5 = \(x :: Int1) -> x
62+
63+main = do
64+ let t1 = test
65+ t2 = test2 id
66+ t3 = test3 1
67+ t4 = test4 (Tuple 1 0)
68+ log "Done"
examples/passing/TypedWhere.pursnew file+18
@@ -0,0 +1,18 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+data E a b = L a | R b
7+
8+data L a = C a (L a) | N
9+
10+lefts :: forall a b. L (E a b) -> L a
11+lefts = go N
12+ where
13+ go :: forall a b. L a -> L (E a b) -> L a
14+ go ls N = ls
15+ go ls (C (L a) rest) = go (C a ls) rest
16+ go ls (C _ rest) = go ls rest
17+
18+main = log "Done"
examples/passing/UTF8Sourcefile.pursnew file+8
@@ -0,0 +1,8 @@
1+module Main where
2+
3+import Control.Monad.Eff.Console
4+
5+-- '→' is multibyte sequence \u2192.
6+utf8multibyte = "Hello λ→ world!!"
7+
8+main = log "Done"
examples/passing/UnderscoreIdent.pursnew file+13
@@ -0,0 +1,13 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+data Data_type = Con_Structor | Con_2 String
7+
8+type Type_name = Data_type
9+
10+done (Con_2 s) = s
11+done _ = "Failed"
12+
13+main = log (done (Con_2 "Done"))
examples/passing/UnicodeIdentifier.pursnew file+7
@@ -0,0 +1,7 @@
1+module Main where
2+
3+import Control.Monad.Eff.Console (log)
4+
5+f asgård = asgård
6+
7+main = log (f "Done")
examples/passing/UnicodeOperators.pursnew file+22
@@ -0,0 +1,22 @@
1+module Main where
2+
3+import Control.Monad.Eff.Console (log)
4+
5+compose :: forall a b c. (b -> c) -> (a -> b) -> a -> c
6+compose f g a = f (g a)
7+
8+infixr 9 compose as ∘
9+
10+test1 = (\x -> x) ∘ \y -> y
11+
12+elem :: forall a b. a -> (a -> Boolean) -> Boolean
13+elem x f = f x
14+
15+infixl 1 elem as ∈
16+
17+emptySet :: forall a. a -> Boolean
18+emptySet _ = true
19+
20+test2 = 1 ∈ emptySet
21+
22+main = log "Done"
examples/passing/UnicodeType.pursnew file+22
@@ -0,0 +1,22 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+class Monad m ⇐ Monad1 m where
7+ f1 :: Int
8+
9+class Monad m <= Monad2 m where
10+ f2 :: Int
11+
12+f ∷ ∀ m. Monad m ⇒ Int → m Int
13+f n = do
14+ n' ← pure n
15+ pure n'
16+
17+f' :: forall m. Monad m => Int -> m Int
18+f' n = do
19+ n' <- pure n
20+ pure n'
21+
22+main = log "Done"
examples/passing/Unit.pursnew file+8
@@ -0,0 +1,8 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (logShow, log)
5+
6+main = do
7+ logShow (const unit $ "Hello world")
8+ log "Done"
examples/passing/UnknownInTypeClassLookup.pursnew file+15
@@ -0,0 +1,15 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+class EQ a b
7+
8+instance eqAA :: EQ a a
9+
10+test :: forall a b. (EQ a b) => a -> b -> String
11+test _ _ = "Done"
12+
13+runTest a = test a a
14+
15+main = log $ runTest 0.0
examples/passing/UntupledConstraints.pursnew file+17
@@ -0,0 +1,17 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+class Show a <= Nonsense a where
7+ method :: a -> a
8+
9+data Box a = Box a
10+
11+instance showBox :: Show a => Show (Box a) where
12+ show (Box a) = "Box " <> show a
13+
14+strangeThing :: forall m. Semigroup (m Unit) => m Unit -> m Unit -> m Unit
15+strangeThing x y = x <> y
16+
17+main = log "Done"
examples/passing/Where.pursnew file+49
@@ -0,0 +1,49 @@
1+module Main where
2+
3+import Prelude
4+import Partial.Unsafe (unsafePartial)
5+import Control.Monad.Eff
6+import Control.Monad.Eff.Console (logShow, log)
7+
8+test1 x = y
9+ where
10+ y :: Number
11+ y = x + 1.0
12+
13+test2 x y = x' + y'
14+ where
15+ x' = x + 1.0
16+ y' = y + 1.0
17+
18+test3 = f 1.0 2.0 3.0
19+ where f x y z = x + y + z
20+
21+test4 = f (+) [1.0, 2.0]
22+ where f x [y, z] = x y z
23+
24+test5 = g 10.0
25+ where
26+ f x | x > 0.0 = g (x / 2.0) + 1.0
27+ f x = 0.0
28+ g x = f (x - 1.0) + 1.0
29+
30+test6 = if f true then f 1.0 else f 2.0
31+ where f :: forall a. a -> a
32+ f x = x
33+
34+test7 :: Number -> Number
35+test7 x = go x
36+ where
37+ go y | (x - 0.1 < y * y) && (y * y < x + 0.1) = y
38+ go y = go $ (y + x / y) / 2.0
39+
40+main :: Eff _ _
41+main = do
42+ logShow (test1 1.0)
43+ logShow (test2 1.0 2.0)
44+ logShow test3
45+ unsafePartial (logShow test4)
46+ logShow test5
47+ logShow test6
48+ logShow (test7 100.0)
49+ log "Done"
examples/passing/WildcardType.pursnew file+12
@@ -0,0 +1,12 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+f1 :: (_ -> _) -> _
7+f1 g = g 1
8+
9+f2 :: _ -> _
10+f2 _ = "Done"
11+
12+main = log $ f1 f2
examples/passing/iota.pursnew file+11
@@ -0,0 +1,11 @@
1+module Main where
2+
3+import Control.Monad.Eff.Console (log)
4+
5+s = \x -> \y -> \z -> x z (y z)
6+
7+k = \x -> \y -> x
8+
9+iota = \x -> x s k
10+
11+main = log "Done"
examples/passing/s.pursnew file+8
@@ -0,0 +1,8 @@
1+module Main where
2+
3+import Prelude
4+import Control.Monad.Eff.Console (log)
5+
6+s = \x y z -> x z (y z)
7+
8+main = log "Done"
examples/warning/DuplicateExportRef.pursnew file+30
@@ -0,0 +1,30 @@
1+-- @shouldWarnWith DuplicateExportRef
2+-- @shouldWarnWith DuplicateExportRef
3+-- @shouldWarnWith DuplicateExportRef
4+-- @shouldWarnWith DuplicateExportRef
5+-- @shouldWarnWith DuplicateExportRef
6+-- @shouldWarnWith DuplicateExportRef
7+-- @shouldWarnWith DuplicateExportRef
8+module Main
9+ ( X(X, X), X
10+ , fn, fn
11+ , (!), (!)
12+ , class Y, class Y
13+ , Natural, type (~>), type (~>)
14+ , module Prelude, module Prelude
15+ ) where
16+
17+import Prelude (Unit)
18+
19+data X = X
20+
21+fn :: X -> X -> X
22+fn _ _ = X
23+
24+infix 2 fn as !
25+
26+class Y a
27+
28+type Natural f g = forall a. f a -> g a
29+
30+infixl 1 type Natural as ~>
examples/warning/DuplicateImport.pursnew file+10
@@ -0,0 +1,10 @@
1+-- @shouldWarnWith DuplicateImport
2+module Main where
3+
4+import Prelude (Unit, unit, pure)
5+import Prelude (Unit, unit, pure)
6+
7+import Control.Monad.Eff (Eff)
8+
9+main :: Eff () Unit
10+main = pure unit
examples/warning/DuplicateImportRef.pursnew file+18
@@ -0,0 +1,18 @@
1+-- @shouldWarnWith DuplicateImportRef
2+-- @shouldWarnWith DuplicateImportRef
3+-- @shouldWarnWith DuplicateImportRef
4+-- @shouldWarnWith DuplicateImportRef
5+module Main where
6+
7+import Prelude
8+ ( Unit, Unit
9+ , unit, unit
10+ , class Functor, class Functor
11+ , (<>), (<>)
12+ )
13+
14+u :: Unit
15+u = unit <> unit
16+
17+fid :: forall f a. Functor f => f a -> f a
18+fid fa = fa
examples/warning/DuplicateSelectiveImport.pursnew file+10
@@ -0,0 +1,10 @@
1+-- @shouldWarnWith DuplicateSelectiveImport
2+module Main where
3+
4+import Prelude (Unit, unit)
5+import Prelude (pure)
6+
7+import Control.Monad.Eff (Eff)
8+
9+main :: Eff () Unit
10+main = pure unit
examples/warning/HidingImport.pursnew file+9
@@ -0,0 +1,9 @@
1+-- @shouldWarnWith HidingImport
2+-- @shouldWarnWith HidingImport
3+module Main where
4+
5+import Prelude hiding (one)
6+import Control.Monad.Eff hiding (runPure)
7+
8+main :: Eff () Unit
9+main = pure unit
examples/warning/ImplicitImport.pursnew file+9
@@ -0,0 +1,9 @@
1+-- @shouldWarnWith ImplicitImport
2+-- @shouldWarnWith ImplicitImport
3+module Main where
4+
5+import Prelude
6+import Control.Monad.Eff
7+
8+main :: Eff () Unit
9+main = pure unit
examples/warning/ImplicitQualifiedImport.pursnew file+11
@@ -0,0 +1,11 @@
1+-- @shouldWarnWith ImplicitQualifiedImport
2+-- @shouldWarnWith ImplicitQualifiedImport
3+module Main where
4+
5+import Data.Unit
6+
7+import Control.Monad.Eff as E
8+import Control.Monad.Eff.Console as E
9+
10+main :: E.Eff (console :: E.CONSOLE) Unit
11+main = E.log "test"
examples/warning/MissingTypeDeclaration.pursnew file+4
@@ -0,0 +1,4 @@
1+-- @shouldWarnWith MissingTypeDeclaration
2+module Main where
3+
4+x = 0
examples/warning/OverlappingInstances.pursnew file+17
@@ -0,0 +1,17 @@
1+-- @shouldWarnWith OverlappingInstances
2+module Main where
3+
4+class Test a where
5+ test :: a -> a
6+
7+instance testRefl :: Test a where
8+ test x = x
9+
10+instance testInt :: Test Int where
11+ test _ = 0
12+
13+-- The OverlappingInstances instances warning only arises when there are two
14+-- choices for a dictionary, not when the instances are defined. So without
15+-- `value` this module would not raise a warning.
16+value :: Int
17+value = test 1
examples/warning/OverlappingPattern.pursnew file+15
@@ -0,0 +1,15 @@
1+-- @shouldWarnWith OverlappingPattern
2+-- @shouldWarnWith OverlappingPattern
3+module Main where
4+
5+data X = A | B
6+
7+pat1 :: X -> Boolean
8+pat1 A = true
9+pat1 A = true
10+pat1 B = false
11+
12+pat2 :: X -> Boolean
13+pat2 A = true
14+pat2 _ = false
15+pat2 B = false
examples/warning/ScopeShadowing.pursnew file+13
@@ -0,0 +1,13 @@
1+-- @shouldWarnWith ScopeShadowing
2+module Main where
3+
4+import Prelude
5+
6+-- No warning at the definition, only when the name is later resolved
7+data Unit = Unit
8+
9+-- This is only a warning as the `Prelude` import is implicit. If `Unit` was
10+-- named explicitly in an import list, then this refernce to `Unit`
11+-- would be a `ScopeConflict` error instead.
12+test :: Unit
13+test = const Unit unit
examples/warning/ShadowedTypeVar.pursnew file+5
@@ -0,0 +1,5 @@
1+-- @shouldWarnWith ShadowedTypeVar
2+module Main where
3+
4+f :: forall a. (forall a. a -> a) -> a -> a
5+f g x = g x
examples/warning/UnnecessaryFFIModule.jsnew file+1
@@ -0,0 +1 @@
1+exports.out = null;
examples/warning/UnnecessaryFFIModule.pursnew file+5
@@ -0,0 +1,5 @@
1+-- @shouldWarnWith UnnecessaryFFIModule
2+module Main where
3+
4+t :: Boolean
5+t = true
examples/warning/UnusedDctorExplicitImport.pursnew file+8
@@ -0,0 +1,8 @@
1+-- @shouldWarnWith UnusedDctorExplicitImport
2+module Main where
3+
4+import Data.Ordering (Ordering(EQ, LT))
5+
6+f :: Ordering -> Ordering
7+f EQ = EQ
8+f x = x
examples/warning/UnusedDctorImportAll.pursnew file+7
@@ -0,0 +1,7 @@
1+-- @shouldWarnWith UnusedDctorImport
2+module Main where
3+
4+import Data.Ordering (Ordering(..))
5+
6+f :: Ordering -> Ordering
7+f x = x
examples/warning/UnusedDctorImportExplicit.pursnew file+7
@@ -0,0 +1,7 @@
1+-- @shouldWarnWith UnusedDctorImport
2+module Main where
3+
4+import Data.Ordering (Ordering(EQ))
5+
6+f :: Ordering -> Ordering
7+f x = x
examples/warning/UnusedExplicitImport.pursnew file+8
@@ -0,0 +1,8 @@
1+-- @shouldWarnWith UnusedExplicitImport
2+module Main where
3+
4+import Prelude (Unit, unit, pure, bind)
5+import Control.Monad.Eff (Eff)
6+
7+main :: Eff () Unit
8+main = pure unit
examples/warning/UnusedFFIImplementations.jsnew file+2
@@ -0,0 +1,2 @@
1+exports.yes = true;
2+exports.no = false;
examples/warning/UnusedFFIImplementations.pursnew file+4
@@ -0,0 +1,4 @@
1+-- @shouldWarnWith UnusedFFIImplementations
2+module Main where
3+
4+foreign import yes :: Boolean
examples/warning/UnusedImport.pursnew file+14
@@ -0,0 +1,14 @@
1+-- @shouldWarnWith UnusedImport
2+-- @shouldWarnWith UnusedImport
3+-- @shouldWarnWith UnusedImport
4+module Main where
5+
6+import Data.Unit (Unit, unit)
7+
8+-- All of the below are unused
9+import Control.Monad.Eff
10+import Control.Monad.Eff.Console as Console
11+import Test.Assert ()
12+
13+main :: Unit
14+main = unit
examples/warning/UnusedTypeVar.pursnew file+5
@@ -0,0 +1,5 @@
1+-- @shouldWarnWith UnusedTypeVar
2+module Main where
3+
4+f :: forall a b. a -> a
5+f x = x
examples/warning/WildcardInferredType.pursnew file+23
@@ -0,0 +1,23 @@
1+-- @shouldWarnWith WildcardInferredType
2+-- @shouldWarnWith WildcardInferredType
3+-- @shouldWarnWith WildcardInferredType
4+-- @shouldWarnWith WildcardInferredType
5+module Main where
6+
7+x :: Int
8+x = 0 :: _
9+
10+y :: _
11+y = 0
12+
13+z :: Int
14+z =
15+ let n :: _
16+ n = 0
17+ in n
18+
19+w :: Int
20+w = n
21+ where
22+ n :: _
23+ n = 0
hierarchy/Main.hsnew file+115
@@ -0,0 +1,115 @@
1+-----------------------------------------------------------------------------
2+--
3+-- Module : Main
4+-- Copyright : (c) Hardy Jones 2014
5+-- License : MIT (http://opensource.org/licenses/MIT)
6+--
7+-- Maintainer : Hardy Jones <jones3.hardy@gmail.com>
8+-- Stability : experimental
9+-- Portability :
10+--
11+-- |
12+-- Generate Directed Graphs of PureScript TypeClasses
13+--
14+-----------------------------------------------------------------------------
15+
16+{-# LANGUAGE TupleSections #-}
17+{-# LANGUAGE DataKinds #-}
18+
19+module Main where
20+
21+import Control.Monad (unless)
22+
23+import Data.List (intercalate,nub,sort)
24+import Data.Foldable (for_)
25+import Data.Version (showVersion)
26+
27+import Options.Applicative
28+import System.Directory (createDirectoryIfMissing)
29+import System.FilePath ((</>))
30+import System.FilePath.Glob (glob)
31+import System.Exit (exitFailure, exitSuccess)
32+import System.IO (hPutStr, stderr)
33+import System.IO.UTF8 (readUTF8File)
34+
35+import qualified Language.PureScript as P
36+import qualified Paths_purescript as Paths
37+
38+data HierarchyOptions = HierarchyOptions
39+ { hierachyInput :: FilePath
40+ , hierarchyOutput :: Maybe FilePath
41+ }
42+
43+newtype SuperMap = SuperMap { unSuperMap :: Either (P.ProperName 'P.ClassName) (P.ProperName 'P.ClassName, P.ProperName 'P.ClassName) }
44+ deriving Eq
45+
46+instance Show SuperMap where
47+ show (SuperMap (Left sub)) = show sub
48+ show (SuperMap (Right (super, sub))) = show super ++ " -> " ++ show sub
49+
50+instance Ord SuperMap where
51+ compare (SuperMap s) (SuperMap s') = getCls s `compare` getCls s'
52+ where
53+ getCls = either id snd
54+
55+runModuleName :: P.ModuleName -> String
56+runModuleName (P.ModuleName pns) = intercalate "_" (P.runProperName `map` pns)
57+
58+readInput :: [FilePath] -> IO (Either P.MultipleErrors [P.Module])
59+readInput paths = do
60+ content <- mapM (\path -> (path, ) <$> readUTF8File path) paths
61+ return $ map snd <$> P.parseModulesFromFiles id content
62+
63+compile :: HierarchyOptions -> IO ()
64+compile (HierarchyOptions inputGlob mOutput) = do
65+ input <- glob inputGlob
66+ modules <- readInput input
67+ case modules of
68+ Left errs -> hPutStr stderr (P.prettyPrintMultipleErrors P.defaultPPEOptions errs) >> exitFailure
69+ Right ms -> do
70+ for_ ms $ \(P.Module _ _ moduleName decls _) ->
71+ let name = runModuleName moduleName
72+ tcs = filter P.isTypeClassDeclaration decls
73+ supers = sort . nub . filter (not . null) $ fmap superClasses tcs
74+ prologue = "digraph " ++ name ++ " {\n"
75+ body = intercalate "\n" (concatMap (fmap (\s -> " " ++ show s ++ ";")) supers)
76+ epilogue = "\n}"
77+ hier = prologue ++ body ++ epilogue
78+ in unless (null supers) $ case mOutput of
79+ Just output -> do
80+ createDirectoryIfMissing True output
81+ writeFile (output </> name) hier
82+ Nothing -> putStrLn hier
83+ exitSuccess
84+
85+superClasses :: P.Declaration -> [SuperMap]
86+superClasses (P.TypeClassDeclaration sub _ supers@(_:_) _) =
87+ fmap (\(P.Constraint (P.Qualified _ super) _ _) -> SuperMap (Right (super, sub))) supers
88+superClasses (P.TypeClassDeclaration sub _ _ _) = [SuperMap (Left sub)]
89+superClasses (P.PositionedDeclaration _ _ decl) = superClasses decl
90+superClasses _ = []
91+
92+inputFile :: Parser FilePath
93+inputFile = strArgument $
94+ metavar "FILE"
95+ <> value "main.purs"
96+ <> showDefault
97+ <> help "The input file to generate a hierarchy from"
98+
99+outputFile :: Parser (Maybe FilePath)
100+outputFile = optional . strOption $
101+ short 'o'
102+ <> long "output"
103+ <> help "The output directory"
104+
105+pscOptions :: Parser HierarchyOptions
106+pscOptions = HierarchyOptions <$> inputFile
107+ <*> outputFile
108+
109+main :: IO ()
110+main = execParser opts >>= compile
111+ where
112+ opts = info (helper <*> pscOptions) infoModList
113+ infoModList = fullDesc <> headerInfo <> footerInfo
114+ headerInfo = header "hierarchy - Creates a GraphViz directed graph of PureScript TypeClasses"
115+ footerInfo = footer $ "hierarchy " ++ showVersion Paths.version
license-generator/generate.hsnew file+46
@@ -0,0 +1,46 @@
1+-- |
2+-- A small script which regenerates the LICENSE file with all
3+-- dependencies' licenses, when the dependencies are provided via standard
4+-- input.
5+--
6+-- It is recommended to run this as follows:
7+--
8+-- stack list-dependencies | cut -f 1 -d ' ' | stack exec runhaskell license-generator/generate.hs > LICENSE
9+--
10+
11+module Main (main) where
12+
13+import Control.Monad (forM_)
14+import Data.Char (isSpace)
15+import Data.List
16+import System.Process
17+import System.IO (hPutStrLn, stderr, getContents)
18+
19+echoHeader :: IO ()
20+echoHeader =
21+ readFile "license-generator/header.txt" >>= putStr
22+
23+depsNames :: IO [String]
24+depsNames =
25+ fmap (filter (/= "purescript") . lines) getContents
26+
27+depsLicense :: String -> IO ()
28+depsLicense dep = do
29+ let licenseFile = if dep == "Glob" then "LICENSE.txt" else "LICENSE"
30+ hPutStrLn stderr dep
31+ license <- readProcess "curl" ["--silent", "https://hackage.haskell.org/package/" ++ dep ++ "/src/" ++ licenseFile] ""
32+ putStrLn $ dep ++ " LICENSE file:"
33+ putStrLn ""
34+ putStrLn $ f license
35+ where
36+ f = unlines . map (trimEnd . (" " ++)) . lines
37+ trimEnd = reverse . dropWhile isSpace . reverse
38+
39+main :: IO ()
40+main = do
41+ deps <-depsNames
42+ echoHeader
43+ putStrLn ""
44+ forM_ deps $ \d -> putStr " " >> putStrLn d
45+ putStrLn ""
46+ forM_ deps depsLicense
license-generator/header.txtnew file+23
@@ -0,0 +1,23 @@
1+The MIT License (MIT)
2+
3+Copyright (c) 2013-15 Phil Freeman, (c) 2014-2015 Gary Burgess, and other
4+contributors
5+
6+Permission is hereby granted, free of charge, to any person obtaining a copy of
7+this software and associated documentation files (the "Software"), to deal in
8+the Software without restriction, including without limitation the rights to
9+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
10+the Software, and to permit persons to whom the Software is furnished to do so,
11+subject to the following conditions:
12+
13+The above copyright notice and this permission notice shall be included in all
14+copies or substantial portions of the Software.
15+
16+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
18+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
19+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22+
23+PureScript uses the following Haskell library packages. Their license files follow.
logo.pngnew file

Binary file not shown.

make_release_notesnew file+2
@@ -0,0 +1,2 @@
1+curl https://api.github.com/repos/purescript/purescript/pulls?state=closed\&per_page=100 \
2+ | jq -r '.[] | ("- " + .title + " (@" + .user.login + ")")'
package.yamldeleted−86
@@ -1,86 +0,0 @@
1−name: psgo
2−version: 0.1.0.0
3−github: "andyarvanitis/purescript-native"
4−license: BSD3
5−author: "Andy Arvanitis"
6−maintainer: "example@example.com"
7−copyright: "2018 Andy Arvanitis"
8−
9−extra-source-files:
10−- README.md
11−- ChangeLog.md
12−- stack.yaml
13−- support/*
14−
15−# Metadata used when publishing your package
16−# synopsis: Short description of your package
17−# category: Web
18−
19−# To avoid duplicated efforts in documentation and dealing with the
20−# complications of embedding Haddock markup inside cabal files, it is
21−# common to point users to the README.md file.
22−description: Please see the README on Github at <https://github.com/andyarvanitis/purescript-native#readme>
23−
24−dependencies:
25−- base >= 4.7 && < 5
26−- bytestring >= 0.10.8.2 && < 0.11
27−- purescript
28−- base-compat >=0.6.0
29−- protolude >=0.1.6
30−- text
31−- containers
32−- filepath
33−- monad-parallel >= 0.7.2.2 && <0.8
34−- pattern-arrows >=0.0.2 && <0.1
35−- safe >=0.3.9 && <0.4
36−- transformers >=0.3.0 && <0.6
37−- mtl >=2.1.0 && <2.3.0
38−- aeson >=1.0 && <1.5
39−- directory
40−- process
41−- file-embed
42−- filemanip
43−- gitrev
44−
45−library:
46− source-dirs: src
47− default-extensions:
48− - ConstraintKinds
49− - DataKinds
50− - DeriveFunctor
51− - EmptyDataDecls
52− - FlexibleContexts
53− - KindSignatures
54− - LambdaCase
55− - MultiParamTypeClasses
56− - NoImplicitPrelude
57− - PatternGuards
58− - PatternSynonyms
59− - RankNTypes
60− - RecordWildCards
61− - OverloadedStrings
62− - ScopedTypeVariables
63− - TupleSections
64− - ViewPatterns
65−
66−executables:
67− psgo:
68− main: Main.hs
69− source-dirs: app
70− ghc-options:
71− - -threaded
72− - -rtsopts
73− - -with-rtsopts=-N
74− dependencies:
75− - psgo
76−
77−tests:
78− psgo-test:
79− main: Spec.hs
80− source-dirs: test
81− ghc-options:
82− - -threaded
83− - -rtsopts
84− - -with-rtsopts=-N
85− dependencies:
86− - psgo
psc-bundle/Main.hsnew file+119
@@ -0,0 +1,119 @@
1+{-# LANGUAGE FlexibleContexts #-}
2+{-# LANGUAGE ScopedTypeVariables #-}
3+{-# LANGUAGE TupleSections #-}
4+{-# LANGUAGE RecordWildCards #-}
5+
6+-- | Bundles compiled PureScript modules for the browser.
7+module Main (main) where
8+
9+import Data.Traversable (for)
10+import Data.Version (showVersion)
11+
12+import Control.Applicative
13+import Control.Monad
14+import Control.Monad.Error.Class
15+import Control.Monad.Trans.Except
16+import Control.Monad.IO.Class
17+
18+import System.FilePath (takeDirectory)
19+import System.FilePath.Glob (glob)
20+import System.Exit (exitFailure)
21+import System.IO (stderr, stdout, hPutStrLn, hSetEncoding, utf8)
22+import System.IO.UTF8 (readUTF8File)
23+import System.Directory (createDirectoryIfMissing)
24+
25+import Language.PureScript.Bundle
26+
27+import Options.Applicative as Opts
28+
29+import qualified Paths_purescript as Paths
30+
31+-- | Command line options.
32+data Options = Options
33+ { optionsInputFiles :: [FilePath]
34+ , optionsOutputFile :: Maybe FilePath
35+ , optionsEntryPoints :: [String]
36+ , optionsMainModule :: Maybe String
37+ , optionsNamespace :: String
38+ } deriving Show
39+
40+-- | The main application function.
41+-- This function parses the input files, performs dead code elimination, filters empty modules
42+-- and generates and prints the final Javascript bundle.
43+app :: (MonadError ErrorMessage m, MonadIO m) => Options -> m String
44+app Options{..} = do
45+ inputFiles <- concat <$> mapM (liftIO . glob) optionsInputFiles
46+ when (null inputFiles) . liftIO $ do
47+ hPutStrLn stderr "psc-bundle: No input files."
48+ exitFailure
49+ input <- for inputFiles $ \filename -> do
50+ js <- liftIO (readUTF8File filename)
51+ mid <- guessModuleIdentifier filename
52+ length js `seq` return (mid, js) -- evaluate readFile till EOF before returning, not to exhaust file handles
53+
54+ let entryIds = map (`ModuleIdentifier` Regular) optionsEntryPoints
55+
56+ bundle input entryIds optionsMainModule optionsNamespace
57+
58+-- | Command line options parser.
59+options :: Parser Options
60+options = Options <$> some inputFile
61+ <*> optional outputFile
62+ <*> many entryPoint
63+ <*> optional mainModule
64+ <*> namespace
65+ where
66+ inputFile :: Parser FilePath
67+ inputFile = strArgument $
68+ metavar "FILE"
69+ <> help "The input .js file(s)"
70+
71+ outputFile :: Parser FilePath
72+ outputFile = strOption $
73+ short 'o'
74+ <> long "output"
75+ <> help "The output .js file"
76+
77+ entryPoint :: Parser String
78+ entryPoint = strOption $
79+ short 'm'
80+ <> long "module"
81+ <> help "Entry point module name(s). All code which is not a transitive dependency of an entry point module will be removed."
82+
83+ mainModule :: Parser String
84+ mainModule = strOption $
85+ long "main"
86+ <> help "Generate code to run the main method in the specified module."
87+
88+ namespace :: Parser String
89+ namespace = strOption $
90+ short 'n'
91+ <> long "namespace"
92+ <> Opts.value "PS"
93+ <> showDefault
94+ <> help "Specify the namespace that PureScript modules will be exported to when running in the browser."
95+
96+-- | Make it go.
97+main :: IO ()
98+main = do
99+ hSetEncoding stdout utf8
100+ hSetEncoding stderr utf8
101+ opts <- execParser (info (version <*> helper <*> options) infoModList)
102+ output <- runExceptT (app opts)
103+ case output of
104+ Left err -> do
105+ hPutStrLn stderr (unlines (printErrorMessage err))
106+ exitFailure
107+ Right js ->
108+ case optionsOutputFile opts of
109+ Just outputFile -> do
110+ createDirectoryIfMissing True (takeDirectory outputFile)
111+ writeFile outputFile js
112+ Nothing -> putStrLn js
113+ where
114+ infoModList = fullDesc <> headerInfo <> footerInfo
115+ headerInfo = header "psc-bundle - Bundles compiled PureScript modules for the browser"
116+ footerInfo = footer $ "psc-bundle " ++ showVersion Paths.version
117+
118+ version :: Parser (a -> a)
119+ version = abortOption (InfoMsg (showVersion Paths.version)) $ long "version" <> help "Show the version number" <> hidden
psc-bundle/README.mdnew file+18
@@ -0,0 +1,18 @@
1+# psc-bundle
2+
3+A dead code elimination tool for PureScript-style CommonJS modules. This can be used as an alternative to Browserify.
4+
5+## Usage
6+
7+ psc-bundle FILE (-m|--module ARG) [--main ARG] [--namespace ARG]
8+
9+Options:
10+
11+- The input .js file(s)
12+- Entry point module name(s) are specified with `-m` or `--module`. All code which is not a transitive dependency of an entry point module will be removed.
13+- The main module is (optionally) specified using `--main`. If specified, this will generate code to run the main method in the specified module.
14+- The browser namespace defaults to `PS`, and can be overridden with `--namespace`.
15+
16+For example, to bundle the modules in the `output` directory, with main module `Main`:
17+
18+ psc-bundle output/**/*.js -m Main --main Main
psc-docs/Ctags.hsnew file+13
@@ -0,0 +1,13 @@
1+module Ctags (dumpCtags) where
2+
3+import qualified Language.PureScript as P
4+import Tags
5+import Data.List (sort)
6+
7+dumpCtags :: [(String, P.Module)] -> [String]
8+dumpCtags = sort . concatMap renderModCtags
9+
10+renderModCtags :: (String, P.Module) -> [String]
11+renderModCtags (path, mdl) = sort tagLines
12+ where tagLines = map tagLine $ tags mdl
13+ tagLine (name, line) = name ++ "\t" ++ path ++ "\t" ++ show line
psc-docs/Etags.hsnew file+13
@@ -0,0 +1,13 @@
1+module Etags (dumpEtags) where
2+
3+import qualified Language.PureScript as P
4+import Tags
5+
6+dumpEtags :: [(String, P.Module)] -> [String]
7+dumpEtags = concatMap renderModEtags
8+
9+renderModEtags :: (String, P.Module) -> [String]
10+renderModEtags (path, mdl) = ["\x0c", path ++ "," ++ show tagsLen] ++ tagLines
11+ where tagsLen = sum $ map length tagLines
12+ tagLines = map tagLine $ tags mdl
13+ tagLine (name, line) = "\x7f" ++ name ++ "\x01" ++ show line ++ ","
psc-docs/Main.hsnew file+250
@@ -0,0 +1,250 @@
1+{-# LANGUAGE TupleSections #-}
2+
3+module Main where
4+
5+import Control.Applicative
6+import Control.Monad.Trans.Except (runExceptT)
7+import Control.Arrow (first, second)
8+import Control.Category ((>>>))
9+import Control.Monad.Writer
10+import Data.Function (on)
11+import Data.List
12+import Data.Maybe (fromMaybe)
13+import Data.Tuple (swap)
14+import Data.Version (showVersion)
15+
16+import Options.Applicative
17+import qualified Text.PrettyPrint.ANSI.Leijen as PP
18+
19+import qualified Language.PureScript as P
20+import qualified Paths_purescript as Paths
21+import System.Exit (exitFailure)
22+import System.IO (hPutStrLn, hPrint, hSetEncoding, stderr, stdout, utf8)
23+import System.IO.UTF8 (readUTF8File)
24+import System.Directory (createDirectoryIfMissing)
25+import System.FilePath (takeDirectory)
26+import System.FilePath.Glob (glob)
27+
28+import Etags
29+import Ctags
30+import qualified Language.PureScript.Docs as D
31+import qualified Language.PureScript.Docs.AsMarkdown as D
32+
33+-- Available output formats
34+data Format = Markdown -- Output documentation in Markdown format
35+ | Ctags -- Output ctags symbol index suitable for use with vi
36+ | Etags -- Output etags symbol index suitable for use with emacs
37+ deriving (Show, Eq, Ord)
38+
39+-- | Available methods of outputting Markdown documentation
40+data DocgenOutput
41+ = EverythingToStdOut
42+ | ToStdOut [P.ModuleName]
43+ | ToFiles [(P.ModuleName, FilePath)]
44+ deriving (Show)
45+
46+data PSCDocsOptions = PSCDocsOptions
47+ { pscdFormat :: Format
48+ , pscdInputFiles :: [FilePath]
49+ , pscdDocgen :: DocgenOutput
50+ }
51+ deriving (Show)
52+
53+docgen :: PSCDocsOptions -> IO ()
54+docgen (PSCDocsOptions fmt inputGlob output) = do
55+ input <- concat <$> mapM glob inputGlob
56+ case fmt of
57+ Etags -> dumpTags input dumpEtags
58+ Ctags -> dumpTags input dumpCtags
59+ Markdown -> do
60+ ms <- runExceptT (D.parseAndBookmark input []
61+ >>= (fst >>> D.convertModulesInPackage))
62+ >>= successOrExit
63+
64+ case output of
65+ EverythingToStdOut ->
66+ putStrLn (D.runDocs (D.modulesAsMarkdown ms))
67+ ToStdOut names -> do
68+ let (ms', missing) = takeByName ms names
69+ guardMissing missing
70+ putStrLn (D.runDocs (D.modulesAsMarkdown ms'))
71+ ToFiles names -> do
72+ let (ms', missing) = takeByName' ms names
73+ guardMissing missing
74+
75+ let ms'' = groupBy ((==) `on` fst) . sortBy (compare `on` fst) $ map swap ms'
76+ forM_ ms'' $ \grp -> do
77+ let fp = fst (head grp)
78+ createDirectoryIfMissing True (takeDirectory fp)
79+ writeFile fp (D.runDocs (D.modulesAsMarkdown (map snd grp)))
80+
81+ where
82+ guardMissing [] = return ()
83+ guardMissing [mn] = do
84+ hPutStrLn stderr ("psc-docs: error: unknown module \"" ++ P.runModuleName mn ++ "\"")
85+ exitFailure
86+ guardMissing mns = do
87+ hPutStrLn stderr "psc-docs: error: unknown modules:"
88+ forM_ mns $ \mn ->
89+ hPutStrLn stderr (" * " ++ P.runModuleName mn)
90+ exitFailure
91+
92+ successOrExit :: Either P.MultipleErrors a -> IO a
93+ successOrExit act =
94+ case act of
95+ Right x ->
96+ return x
97+ Left err -> do
98+ hPutStrLn stderr $ P.prettyPrintMultipleErrors P.defaultPPEOptions err
99+ exitFailure
100+
101+ takeByName = takeModulesByName D.modName
102+ takeByName' = takeModulesByName' D.modName
103+
104+-- |
105+-- Given a list of module names and a list of modules, return a list of modules
106+-- whose names appeared in the given name list, together with a list of names
107+-- for which no module could be found in the module list.
108+--
109+takeModulesByName :: (Eq n) => (m -> n) -> [m] -> [n] -> ([m], [n])
110+takeModulesByName getModuleName modules names =
111+ first (map fst) (takeModulesByName' getModuleName modules (map (,()) names))
112+
113+-- |
114+-- Like takeModulesByName, but also keeps some extra information with each
115+-- module.
116+--
117+takeModulesByName' :: (Eq n) => (m -> n) -> [m] -> [(n, a)] -> ([(m, a)], [n])
118+takeModulesByName' getModuleName modules = foldl go ([], [])
119+ where
120+ go (ms, missing) (name, x) =
121+ case find ((== name) . getModuleName) modules of
122+ Just m -> ((m, x) : ms, missing)
123+ Nothing -> (ms, name : missing)
124+
125+dumpTags :: [FilePath] -> ([(String, P.Module)] -> [String]) -> IO ()
126+dumpTags input renderTags = do
127+ e <- P.parseModulesFromFiles (fromMaybe "") <$> mapM (fmap (first Just) . parseFile) (nub input)
128+ case e of
129+ Left err -> do
130+ hPrint stderr err
131+ exitFailure
132+ Right ms ->
133+ ldump (renderTags (pairs ms))
134+
135+ where
136+ pairs :: [(Maybe String, m)] -> [(String, m)]
137+ pairs = map (first (fromMaybe ""))
138+
139+ ldump :: [String] -> IO ()
140+ ldump = mapM_ putStrLn
141+
142+parseFile :: FilePath -> IO (FilePath, String)
143+parseFile input = (,) input <$> readUTF8File input
144+
145+inputFile :: Parser FilePath
146+inputFile = strArgument $
147+ metavar "FILE"
148+ <> help "The input .purs file(s)"
149+
150+instance Read Format where
151+ readsPrec _ "etags" = [(Etags, "")]
152+ readsPrec _ "ctags" = [(Ctags, "")]
153+ readsPrec _ "markdown" = [(Markdown, "")]
154+ readsPrec _ _ = []
155+
156+format :: Parser Format
157+format = option auto $ value Markdown
158+ <> long "format"
159+ <> metavar "FORMAT"
160+ <> help "Set output FORMAT (markdown | etags | ctags)"
161+
162+docgenModule :: Parser String
163+docgenModule = strOption $
164+ long "docgen"
165+ <> help "A list of module names which should appear in the output. This can optionally include file paths to write individual modules to, by separating with a colon ':'. For example, Prelude:docs/Prelude.md. This option may be specified multiple times."
166+
167+pscDocsOptions :: Parser (Format, [FilePath], [String])
168+pscDocsOptions = (,,) <$> format <*> many inputFile <*> many docgenModule
169+
170+parseDocgen :: [String] -> Either String DocgenOutput
171+parseDocgen [] = Right EverythingToStdOut
172+parseDocgen xs = go xs
173+ where
174+ go = intersperse " "
175+ >>> concat
176+ >>> words
177+ >>> map parseItem
178+ >>> combine
179+
180+data DocgenOutputItem
181+ = IToStdOut P.ModuleName
182+ | IToFile (P.ModuleName, FilePath)
183+
184+parseItem :: String -> DocgenOutputItem
185+parseItem s = case elemIndex ':' s of
186+ Just i ->
187+ s # splitAt i
188+ >>> first P.moduleNameFromString
189+ >>> second (drop 1)
190+ >>> IToFile
191+ Nothing ->
192+ IToStdOut (P.moduleNameFromString s)
193+
194+ where
195+ infixr 1 #
196+ (#) = flip ($)
197+
198+combine :: [DocgenOutputItem] -> Either String DocgenOutput
199+combine [] = Right EverythingToStdOut
200+combine (x:xs) = foldM go (initial x) xs
201+ where
202+ initial (IToStdOut m) = ToStdOut [m]
203+ initial (IToFile m) = ToFiles [m]
204+
205+ go (ToStdOut ms) (IToStdOut m) = Right (ToStdOut (m:ms))
206+ go (ToFiles ms) (IToFile m) = Right (ToFiles (m:ms))
207+ go _ _ = Left "Can't mix module names and module name/file path pairs in the same invocation."
208+
209+buildOptions :: (Format, [FilePath], [String]) -> IO PSCDocsOptions
210+buildOptions (fmt, input, mapping) =
211+ case parseDocgen mapping of
212+ Right mapping' -> return (PSCDocsOptions fmt input mapping')
213+ Left err -> do
214+ hPutStrLn stderr "psc-docs: error in --docgen option:"
215+ hPutStrLn stderr (" " ++ err)
216+ exitFailure
217+
218+main :: IO ()
219+main = do
220+ hSetEncoding stdout utf8
221+ hSetEncoding stderr utf8
222+ execParser opts >>= buildOptions >>= docgen
223+ where
224+ opts = info (version <*> helper <*> pscDocsOptions) infoModList
225+ infoModList = fullDesc <> headerInfo <> footerInfo
226+ headerInfo = header "psc-docs - Generate Markdown documentation from PureScript source files"
227+ footerInfo = footerDoc $ Just $ PP.vcat
228+ [ examples, PP.empty, PP.text ("psc-docs " ++ showVersion Paths.version) ]
229+
230+ version :: Parser (a -> a)
231+ version = abortOption (InfoMsg (showVersion Paths.version)) $ long "version" <> help "Show the version number" <> hidden
232+
233+examples :: PP.Doc
234+examples =
235+ PP.vcat $ map PP.text
236+ [ "Examples:"
237+ , " print documentation for Data.List to stdout:"
238+ , " psc-docs \"src/**/*.purs\" \"bower_components/*/src/**/*.purs\" \\"
239+ , " --docgen Data.List"
240+ , ""
241+ , " write documentation for Data.List to docs/Data.List.md:"
242+ , " psc-docs \"src/**/*.purs\" \"bower_components/*/src/**/*.purs\" \\"
243+ , " --docgen Data.List:docs/Data.List.md"
244+ , ""
245+ , " write documentation for Data.List to docs/Data.List.md, and"
246+ , " documentation for Data.List.Lazy to docs/Data.List.Lazy.md:"
247+ , " psc-docs \"src/**/*.purs\" \"bower_components/*/src/**/*.purs\" \\"
248+ , " --docgen Data.List:docs/Data.List.md \\"
249+ , " --docgen Data.List.Lazy:docs/Data.List.Lazy.md"
250+ ]
psc-docs/Tags.hsnew file+18
@@ -0,0 +1,18 @@
1+module Tags where
2+
3+import qualified Language.PureScript as P
4+
5+tags :: P.Module -> [(String, Int)]
6+tags = concatMap dtags . P.exportedDeclarations
7+ where dtags (P.PositionedDeclaration sp _ d) = map tag $ names d
8+ where tag name = (name, line)
9+ line = P.sourcePosLine $ P.spanStart sp
10+ dtags _ = []
11+ names (P.DataDeclaration _ name _ dcons) = P.runProperName name : consNames
12+ where consNames = map (\(cname, _) -> P.runProperName cname) dcons
13+ names (P.TypeDeclaration ident _) = [P.showIdent ident]
14+ names (P.ExternDeclaration ident _) = [P.showIdent ident]
15+ names (P.TypeSynonymDeclaration name _ _) = [P.runProperName name]
16+ names (P.TypeClassDeclaration name _ _ _) = [P.runProperName name]
17+ names (P.TypeInstanceDeclaration name _ _ _ _) = [P.showIdent name]
18+ names _ = []
psc-ide-client/Main.hsnew file+46
@@ -0,0 +1,46 @@
1+{-# LANGUAGE OverloadedStrings #-}
2+module Main where
3+
4+import Prelude ()
5+import Prelude.Compat
6+
7+import Control.Exception
8+import qualified Data.ByteString.Char8 as BS8
9+import qualified Data.Text.IO as T
10+import Data.Version (showVersion)
11+import Network
12+import Options.Applicative
13+import System.Exit
14+import System.IO
15+
16+import qualified Paths_purescript as Paths
17+
18+data Options = Options
19+ { optionsPort :: PortID
20+ }
21+
22+main :: IO ()
23+main = do
24+ Options port <- execParser opts
25+ client port
26+ where
27+ parser =
28+ Options <$>
29+ (PortNumber . fromIntegral <$>
30+ option auto (long "port" <> short 'p' <> value (4242 :: Integer)))
31+ opts = info (version <*> helper <*> parser) mempty
32+ version = abortOption (InfoMsg (showVersion Paths.version)) $ long "version" <> help "Show the version number" <> hidden
33+
34+client :: PortID -> IO ()
35+client port = do
36+ h <-
37+ connectTo "127.0.0.1" port `catch`
38+ (\(SomeException e) ->
39+ putStrLn
40+ ("Couldn't connect to psc-ide-server on port: " ++
41+ show port ++ " Error: " ++ show e) >>
42+ exitFailure)
43+ T.hPutStrLn h =<< T.getLine
44+ BS8.putStrLn =<< BS8.hGetLine h
45+ hFlush stdout
46+ hClose h
psc-ide-server/Main.hsnew file+158
@@ -0,0 +1,158 @@
1+-----------------------------------------------------------------------------
2+--
3+-- Module : Main
4+-- Description : The server accepting commands for psc-ide
5+-- Copyright : Christoph Hegemann 2016
6+-- License : MIT (http://opensource.org/licenses/MIT)
7+--
8+-- Maintainer : Christoph Hegemann <christoph.hegemann1337@gmail.com>
9+-- Stability : experimental
10+--
11+-- |
12+-- The server accepting commands for psc-ide
13+-----------------------------------------------------------------------------
14+
15+{-# LANGUAGE FlexibleContexts #-}
16+{-# LANGUAGE MultiParamTypeClasses #-}
17+{-# LANGUAGE OverloadedStrings #-}
18+{-# LANGUAGE PackageImports #-}
19+{-# LANGUAGE TemplateHaskell #-}
20+{-# LANGUAGE NoImplicitPrelude #-}
21+
22+module Main where
23+
24+import Protolude
25+
26+import qualified Data.Aeson as Aeson
27+import Control.Concurrent.STM
28+import "monad-logger" Control.Monad.Logger
29+import qualified Data.Text.IO as T
30+import qualified Data.ByteString.Lazy.Char8 as BS8
31+import Data.Version (showVersion)
32+import Language.PureScript.Ide
33+import Language.PureScript.Ide.Util
34+import Language.PureScript.Ide.Error
35+import Language.PureScript.Ide.Types
36+import Language.PureScript.Ide.Watcher
37+import Network hiding (socketPort, accept)
38+import Network.BSD (getProtocolNumber)
39+import Network.Socket hiding (PortNumber, Type,
40+ sClose)
41+import Options.Applicative hiding ((<>))
42+import System.Directory
43+import System.FilePath
44+import System.IO hiding (putStrLn, print)
45+import System.IO.Error (isEOFError)
46+
47+import qualified Paths_purescript as Paths
48+
49+listenOnLocalhost :: PortNumber -> IO Socket
50+listenOnLocalhost port = do
51+ proto <- getProtocolNumber "tcp"
52+ localhost <- inet_addr "127.0.0.1"
53+ bracketOnError
54+ (socket AF_INET Stream proto)
55+ sClose
56+ (\sock -> do
57+ setSocketOption sock ReuseAddr 1
58+ bindSocket sock (SockAddrInet port localhost)
59+ listen sock maxListenQueue
60+ pure sock)
61+
62+data Options = Options
63+ { optionsDirectory :: Maybe FilePath
64+ , optionsGlobs :: [FilePath]
65+ , optionsOutputPath :: FilePath
66+ , optionsPort :: PortNumber
67+ , optionsNoWatch :: Bool
68+ , optionsDebug :: Bool
69+ }
70+
71+main :: IO ()
72+main = do
73+ Options dir globs outputPath port noWatch debug <- execParser opts
74+ maybe (pure ()) setCurrentDirectory dir
75+ ideState <- newTVarIO emptyIdeState
76+ cwd <- getCurrentDirectory
77+ let fullOutputPath = cwd </> outputPath
78+
79+ unlessM (doesDirectoryExist fullOutputPath) $ do
80+ putStrLn ("Your output directory didn't exist. I'll create it at: " <> fullOutputPath)
81+ createDirectory fullOutputPath
82+ putText "This usually means you didn't compile your project yet."
83+ putText "psc-ide needs you to compile your project (for example by running pulp build)"
84+
85+ unless noWatch $
86+ void (forkFinally (watcher ideState fullOutputPath) print)
87+
88+ let conf = Configuration {confDebug = debug, confOutputPath = outputPath, confGlobs = globs}
89+ env = IdeEnvironment {ideStateVar = ideState, ideConfiguration = conf}
90+ startServer port env
91+ where
92+ parser =
93+ Options
94+ <$> optional (strOption (long "directory" `mappend` short 'd'))
95+ <*> many (argument str (metavar "Source GLOBS..."))
96+ <*> strOption (long "output-directory" `mappend` value "output/")
97+ <*> (fromIntegral <$>
98+ option auto (long "port" `mappend` short 'p' `mappend` value (4242 :: Integer)))
99+ <*> switch (long "no-watch")
100+ <*> switch (long "debug")
101+ opts = info (version <*> helper <*> parser) mempty
102+ version = abortOption
103+ (InfoMsg (showVersion Paths.version))
104+ (long "version" `mappend` help "Show the version number")
105+
106+startServer :: PortNumber -> IdeEnvironment -> IO ()
107+startServer port env = withSocketsDo $ do
108+ sock <- listenOnLocalhost port
109+ runLogger (runReaderT (forever (loop sock)) env)
110+ where
111+ runLogger = runStdoutLoggingT . filterLogger (\_ _ -> confDebug (ideConfiguration env))
112+
113+ loop :: (Ide m, MonadLogger m) => Socket -> m ()
114+ loop sock = do
115+ accepted <- runExceptT $ acceptCommand sock
116+ case accepted of
117+ Left err -> $(logDebug) err
118+ Right (cmd, h) -> do
119+ case decodeT cmd of
120+ Just cmd' -> do
121+ result <- runExceptT (handleCommand cmd')
122+ -- $(logDebug) ("Answer was: " <> T.pack (show result))
123+ liftIO (hFlush stdout)
124+ case result of
125+ Right r -> liftIO $ BS8.hPutStrLn h (Aeson.encode r)
126+ Left err -> liftIO $ BS8.hPutStrLn h (Aeson.encode err)
127+ Nothing -> do
128+ $(logDebug) ("Parsing the command failed. Command: " <> cmd)
129+ liftIO $ do
130+ T.hPutStrLn h (encodeT (GeneralError "Error parsing Command."))
131+ hFlush stdout
132+ liftIO (hClose h)
133+
134+
135+acceptCommand :: (MonadIO m, MonadLogger m, MonadError Text m)
136+ => Socket -> m (Text, Handle)
137+acceptCommand sock = do
138+ h <- acceptConnection
139+ $(logDebug) "Accepted a connection"
140+ cmd' <- liftIO (catchJust
141+ -- this means that the connection was
142+ -- terminated without receiving any input
143+ (\e -> if isEOFError e then Just () else Nothing)
144+ (Just <$> T.hGetLine h)
145+ (const (pure Nothing)))
146+ case cmd' of
147+ Nothing -> throwError "Connection was closed before any input arrived"
148+ Just cmd -> do
149+ $(logDebug) cmd
150+ pure (cmd, h)
151+ where
152+ acceptConnection = liftIO $ do
153+ -- Use low level accept to prevent accidental reverse name resolution
154+ (s,_) <- accept sock
155+ h <- socketToHandle s ReadWriteMode
156+ hSetEncoding h utf8
157+ hSetBuffering h LineBuffering
158+ pure h
psc-ide-server/PROTOCOL.mdnew file+552
@@ -0,0 +1,552 @@
1+# Protocol
2+
3+Encode the following JSON formats into a single line string and pass them to
4+`psc-ide-client`s stdin. You can then read the result from `psc-ide-client`s
5+stdout as a single line. The result needs to be unwrapped from the "wrapper"
6+which separates success from failure. This wrapper is described at the end of
7+this document.
8+
9+## Command:
10+### Load
11+The `load` command "loads" the requested modules into the server for completion
12+and type info. If the `params` object is left off, the `load` command will try
13+to detect all the compiled modules in your project and load them.
14+
15+**Params:**
16+ - `modules :: (optional) [ModuleName]`: A list of modules to load.
17+ psc-ide-server will try to parse all the declarations in these modules
18+
19+```json
20+{
21+ "command": "load",
22+ "params": (optional) {
23+ "modules": (optional)["Module.Name1", "Module.Name2"]
24+ }
25+}
26+```
27+
28+**Result:**
29+
30+The Load Command returns a string with a summary about the loading process.
31+
32+### Type
33+The `type` command looks up the type for a given identifier. It also returns the
34+definition position, if it can be found in the passed source files.
35+
36+**Params:**
37+ - `search :: String`: The identifier to look for. Only matches on equality.
38+ - `filters :: (optional) [Filter]`: These filters will be applied before looking for the
39+ identifier. These filters get combined with *AND*, so a candidate must match *ALL*
40+ of them to be eligible.
41+ - `currentModule :: (optional) String`: see *Complete* command
42+```json
43+{
44+ "command": "type",
45+ "params": {
46+ "search": "filterM",
47+ "filters": [{..}],
48+ "currentModule": "Main"
49+ }
50+}
51+```
52+
53+**Result:**
54+The possible types are returned in the same format as completions + eventual position information
55+```json
56+[
57+ {
58+ "module": "Data.Array",
59+ "identifier": "filter",
60+ "type": "forall a. (a -> Boolean) -> Array a -> Array a"
61+ },
62+ {
63+ "module": "Data.Array",
64+ "identifier": "filter",
65+ "type": "forall a. (a -> Boolean) -> Array a -> Array a",
66+ "definedAt":
67+ {
68+ "name": "/path/to/file",
69+ "start": [1, 3],
70+ "end": [3, 1]
71+ }
72+ }
73+]
74+```
75+
76+### Complete
77+The `complete` command looks up possible completions/corrections.
78+
79+**Params**:
80+ - `filters :: [Filter]`: The same as for the `type` command. A candidate must
81+ match all filters.
82+ - `matcher :: (optional) Matcher`: The strategy used for matching candidates
83+ after filtering. Results are scored internally and will be returned in the
84+ descending order where the nth element is better then the n+1-th.
85+ - `currentModule :: (optional) String`: The current modules name. If it matches
86+ with the rebuild cache non-exported modules will also be completed. You can
87+ fill the rebuild cache by using the "Rebuild" command.
88+
89+ If no matcher is given every candidate, that passes the filters, is returned
90+ in no particular order.
91+
92+```json
93+{
94+ "command": "complete",
95+ "params": {
96+ "filters": [{..}, {..}],
97+ "matcher": {..}
98+ "currentModule": "Main"
99+ }
100+}
101+```
102+
103+**Result:**
104+
105+The following format is returned as the Result:
106+
107+```json
108+[
109+ {
110+ "module": "Data.Array",
111+ "identifier": "filter",
112+ "type": "forall a. (a -> Boolean) -> Array a -> Array a"
113+ }
114+]
115+```
116+
117+
118+### CaseSplit
119+
120+The CaseSplit command takes a line of source code, an area in that line of code
121+and replaces it with all patterns for a given type. The parameter `annotations`
122+is used to turn type annotations on or off for the constructor fields.
123+
124+```json
125+{
126+ "command": "caseSplit",
127+ "params": {
128+ "line": "elem a as",
129+ "begin": 8,
130+ "end": 10,
131+ "annotations": true,
132+ "type": "List"
133+ }
134+}
135+```
136+
137+**Result:**
138+
139+The following format is returned as the Result:
140+
141+```json
142+[
143+ "elem a Nil",
144+ "elem a (Cons (_ :: a) (_ :: List a))"
145+]
146+```
147+You should then be able to replace the affected line of code in the editor with the new suggestions.
148+
149+### Add Clause
150+
151+The AddClause command takes a typedeclaration and generates a function template for the given type.
152+The `annotations` option turns type annotations on or off for the function arguments.
153+
154+```json
155+{
156+ "command": "addClause",
157+ "params": {
158+ "line": "elem :: forall a. (Eq a) => a -> List a",
159+ "annotations": true
160+ }
161+}
162+```
163+
164+**Result:**
165+
166+The following format is returned as the Result:
167+
168+```json
169+[
170+ "elem :: forall a. (Eq a) => a -> List a",
171+ "elem ( _ :: a) = ?elem"
172+]
173+```
174+You should then be able to replace the affected line of code in the editor with the new suggestions.
175+
176+### Import
177+
178+For now all of the import related commands work with a file on the filesystem.
179+
180+You can specify it with the `file` parameter.
181+
182+If you supply the optional `outfile` parameter, the output will be written to
183+that file, and an info message will be returned from the client.
184+
185+If you don't supply `outfile`, the server responds with a list of strings which,
186+when inserted into a file linewise create the module with the applied changes.
187+
188+Arguments:
189+
190+- `file` :: String
191+- `outfile` :: Maybe String
192+- `filters` :: Maybe [Filter]
193+
194+Example:
195+
196+```json
197+{
198+ "command": "import",
199+ "params": {
200+ "file": "/home/creek/Documents/chromacannon/src/Main.purs",
201+ "outfile": "/home/creek/Documents/chromacannon/src/Main.purs",
202+ "filters": [{
203+ "filter": "modules",
204+ "params": {
205+ "modules": ["My.Module"]
206+ }
207+ }],
208+ "importCommand": {
209+ "yadda": "yadda"
210+ }
211+ }
212+}
213+```
214+
215+
216+#### Subcommand `addImplicitImport`
217+
218+This command just adds an unqualified import for the given modulename.
219+
220+Arguments:
221+- `moduleName :: String`
222+
223+Example:
224+```json
225+{
226+ "command": "import",
227+ "params": {
228+ "file": "/home/creek/Documents/chromacannon/src/Main.purs",
229+ "importCommand": {
230+ "importCommand": "addImplicitImport",
231+ "module": "Data.Array.LOL"
232+ }
233+ }
234+}
235+```
236+#### Subcommand `addImport`
237+
238+This command takes an identifier and searches the currently loaded modules for
239+it. If it finds no matches it responds with an Error. If it finds exactly one
240+match it adds the import and returns. If it finds more than one match it
241+responds with a list of the found matches as completions like the complete
242+command.
243+
244+You can also supply a list of filters like the ones for completion. This way you
245+can narrow down the search to a certain module and resolve the case in which
246+more then one match was found.
247+
248+Arguments:
249+- `moduleName :: String`
250+- `filters :: [Filter]`
251+
252+Example:
253+```json
254+{
255+ "command": "import",
256+ "params": {
257+ "file": "/home/creek/Documents/chromacannon/src/Demo.purs",
258+ "outfile": "/home/creek/Documents/chromacannon/src/Demo.purs",
259+ "importCommand": {
260+ "importCommand": "addImport",
261+ "identifier": "bind"
262+ }
263+ }
264+}
265+```
266+
267+### Rebuild
268+
269+The `rebuild` command provides a fast rebuild for a single module. It doesn't
270+recompile the entire project though. All the modules dependencies need to be
271+loaded. A successful rebuild will be stored to allow for completions of private
272+identifiers.
273+
274+Arguments:
275+ - `file :: String` the path to the module to rebuild
276+
277+```json
278+{
279+ "command": "rebuild",
280+ "params": {
281+ "file": "/path/to/file.purs"
282+ }
283+}
284+```
285+
286+**Result**
287+
288+In the Success case you get a list of warnings in the compilers json format.
289+
290+In the Error case you get the errors in the compilers json format
291+
292+### Pursuit
293+The `pursuit` command looks up the packages/completions for a given identifier from Pursuit.
294+
295+**Params:**
296+ - `query :: String`: With `type: "package"` this should be a module name. With
297+ `type: "completion"` this can be any string to look up.
298+ - `type :: String`: Takes the following values:
299+ - `package`: Looks for packages that contain the given module name.
300+ - `completion` Looks for declarations for the query from Pursuit.
301+
302+```json
303+{
304+ "command": "pursuit",
305+ "params": {
306+ "query": "Data.Array",
307+ "type": "package"
308+ }
309+}
310+```
311+
312+**Result:**
313+
314+`package` returns:
315+
316+```json
317+[
318+ {
319+ "module": "Module1.Name",
320+ "package": "purescript-packagename"
321+ }
322+]
323+```
324+
325+`completion` returns:
326+
327+```json
328+[
329+ {
330+ "module": "Data.Array",
331+ "identifier": "filter",
332+ "type": "forall a. (a -> Boolean) -> Array a -> Array a",
333+ "package": "purescript-arrays"
334+ }
335+]
336+```
337+
338+### List
339+
340+#### Loaded Modules
341+
342+`list` of type `loadedModules` lists all loaded modules (This means they can be searched for completions etc)
343+
344+```json
345+{
346+ "command": "list",
347+ "params": {
348+ "type": "loadedModules"
349+ }
350+}
351+```
352+
353+#### Response:
354+
355+The list loadedModules command returns a list of strings.
356+
357+#### Available Modules
358+
359+`list` of type `availableModules` lists all available modules. (This basically
360+means the contents of the `output/` folder.))
361+
362+```json
363+{
364+ "command": "list",
365+ "params": {
366+ "type": "availableModules"
367+ }
368+}
369+```
370+
371+#### Response:
372+
373+The list availableModules command returns a list of strings.
374+
375+#### Imports
376+
377+The list commmand can also list the imports for a given file.
378+
379+```json
380+{
381+ "command": "list",
382+ "params": {
383+ "type": "import",
384+ "file": "/home/kritzcreek/Documents/psc-ide/examples/Main.purs"
385+ }
386+}
387+```
388+
389+#### Response:
390+
391+The list import command returns a list of imports where imports are of the following form:
392+
393+Implicit Import(`import Data.Array`):
394+```json
395+[
396+ {
397+ "module": "Data.Array",
398+ "importType": "implicit"
399+ }
400+]
401+```
402+
403+Implicit qualified Import(`import qualified Data.Array as A`):
404+```json
405+[
406+ {
407+ "module": "Data.Array",
408+ "importType": "implicit",
409+ "qualifier": "A"
410+ }
411+]
412+```
413+
414+Explicit Import(`import Data.Array (filter, filterM, join)`):
415+```json
416+[
417+ {
418+ "module": "Data.Array",
419+ "importType": "explicit",
420+ "identifiers": ["filter", "filterM", "join"]
421+ }
422+]
423+```
424+
425+Hiding Import(`import Data.Array hiding (filter, filterM, join)`):
426+```json
427+[
428+ {
429+ "module": "Data.Array",
430+ "importType": "hiding",
431+ "identifiers": ["filter", "filterM", "join"]
432+ }
433+]
434+```
435+### Cwd/Quit/Reset
436+`cwd` returns the working directory of the server(should be your project root).
437+
438+`quit` quits the server.
439+
440+`reset` resets all loaded modules.
441+
442+```json
443+{
444+ "command": "cwd|quit|reset"
445+}
446+```
447+
448+**Result:**
449+These commands return strings.
450+
451+## Filter:
452+
453+### Exact filter
454+The Exact filter only keeps identifiers that are equal to the search term.
455+
456+```json
457+{
458+ "filter": "exact",
459+ "params": {
460+ "search": "filterM"
461+ }
462+}
463+```
464+### Prefix filter
465+The Prefix filter keeps identifiers/modules/data declarations that
466+are prefixed by the search term.
467+
468+```json
469+{
470+ "filter": "prefix",
471+ "params": {
472+ "search": "filt"
473+ }
474+}
475+```
476+
477+### Module filter
478+The Module filter only keeps identifiers that appear in the listed modules.
479+
480+```json
481+{
482+ "filter": "modules",
483+ "params": {
484+ "modules": ["My.Module"]
485+ }
486+}
487+```
488+
489+### Dependency filter
490+The Dependency filter only keeps identifiers that appear in the listed modules
491+and in any of their dependencies/imports.
492+
493+```json
494+{
495+ "filter": "dependencies",
496+ "params": {
497+ "modules": ["My.Module"]
498+ }
499+}
500+```
501+
502+## Matcher:
503+
504+### Flex matcher
505+Matches any occurence of the search string with intersections
506+
507+The scoring measures how far the matches span the string, where
508+closer is better. The matches then get sorted with highest score first.
509+
510+Examples:
511+- flMa matches **fl**ex**Ma**tcher. Score: 14.28
512+- sons matches **so**rtCompletio**ns**. Score: 6.25
513+```json
514+
515+{
516+ "matcher": "flex",
517+ "params": {
518+ "search": "filt"
519+ }
520+}
521+```
522+
523+### Distance Matcher
524+
525+The Distance matcher is meant to provide corrections for typos. It calculates
526+the edit distance in between the search and the loaded identifiers.
527+
528+```json
529+{
530+ "matcher": "distance",
531+ "params": {
532+ "search": "dilterM",
533+ "maximumDistance": 3
534+ }
535+}
536+```
537+
538+## Responses
539+
540+All Responses are wrapped in the following format:
541+
542+```json
543+{
544+ "resultType": "success|error",
545+ "result": Result|Error
546+}
547+```
548+
549+### Error
550+
551+Errors at this point are merely Error strings. Newlines are escaped like `\n`
552+and should be taken care of by the editor-plugin.
psc-ide-server/README.mdnew file+44
@@ -0,0 +1,44 @@
1+psc-ide
2+===
3+
4+A tool which provides editor support for the PureScript programming language.
5+
6+## Editor Integration
7+* [@epost](https://github.com/epost) wrote a plugin to integrate psc-ide with Emacs at https://github.com/epost/psc-ide-emacs.
8+* Atom integration is available with https://github.com/nwolverson/atom-ide-purescript.
9+* Visual Studio Code integration is available with https://github.com/nwolverson/vscode-ide-purescript.
10+* Vim integration is available here: https://github.com/FrigoEU/psc-ide-vim.
11+
12+## Running the Server
13+
14+Start the server by running the `psc-ide-server [SOURCEGLOBS]` executable, where
15+`SOURCEGLOBS` are (optional) globs that match your PureScript sourcefiles.
16+
17+It supports the following options:
18+
19+- `-p / --port` specify a port. Defaults to 4242
20+- `-d / --directory` specify the toplevel directory of your project. Defaults to
21+ the current directory
22+- `--output-directory`: Specify where to look for compiled output inside your
23+ project directory. Defaults to `output/`, relative to either the current
24+ directory or the directory specified by `-d`.
25+- `--debug`: Enables some logging meant for debugging
26+- `--no-watch`: Disables the filewatcher
27+- `--version`: Output psc-ide version
28+
29+## Issuing queries
30+
31+After you started the server you can start issuing requests using
32+`psc-ide-client`. Make sure you start by loading the modules before you try to
33+query them.
34+
35+`psc-ide-server` expects the build externs.purs inside the `output/` folder of
36+your project after running `pulp build` or `psc-make` respectively.
37+
38+(If you changed the port of the server you can change the port for
39+`psc-ide-client` by using the -p option accordingly)
40+
41+## Protocol
42+
43+For documentation about the protocol have a look at:
44+[PROTOCOL.md](PROTOCOL.md)
psc-publish/Main.hsnew file+50
@@ -0,0 +1,50 @@
1+
2+module Main where
3+
4+import Data.Version (Version(..), showVersion)
5+import qualified Data.Aeson as A
6+import qualified Data.ByteString.Lazy.Char8 as BL
7+
8+import Options.Applicative hiding (str)
9+
10+import System.IO (hSetEncoding, stderr, stdout, utf8)
11+
12+import qualified Paths_purescript as Paths
13+import Language.PureScript.Publish
14+import Language.PureScript.Publish.ErrorsWarnings
15+
16+dryRun :: Parser Bool
17+dryRun = switch $
18+ long "dry-run"
19+ <> help "Produce no output, and don't require a tagged version to be checked out."
20+
21+dryRunOptions :: PublishOptions
22+dryRunOptions = defaultPublishOptions
23+ { publishGetVersion = return dummyVersion
24+ , publishWorkingTreeDirty = warn DirtyWorkingTree_Warn
25+ }
26+ where dummyVersion = ("0.0.0", Version [0,0,0] [])
27+
28+main :: IO ()
29+main = do
30+ hSetEncoding stdout utf8
31+ hSetEncoding stderr utf8
32+ execParser opts >>= publish
33+ where
34+ opts = info (version <*> helper <*> dryRun) infoModList
35+ infoModList = fullDesc <> headerInfo <> footerInfo
36+ headerInfo = header "psc-publish - Generates documentation packages for upload to http://pursuit.purescript.org"
37+ footerInfo = footer $ "psc-publish " ++ showVersion Paths.version
38+
39+ version :: Parser (a -> a)
40+ version = abortOption (InfoMsg (showVersion Paths.version)) $ long "version" <> help "Show the version number" <> hidden
41+
42+publish :: Bool -> IO ()
43+publish isDryRun =
44+ if isDryRun
45+ then do
46+ _ <- unsafePreparePackage dryRunOptions
47+ putStrLn "Dry run completed, no errors."
48+ else do
49+ pkg <- unsafePreparePackage defaultPublishOptions
50+ BL.putStrLn (A.encode pkg)
psc/Main.hsnew file+175
@@ -0,0 +1,175 @@
1+{-# LANGUAGE DataKinds #-}
2+{-# LANGUAGE FlexibleContexts #-}
3+{-# LANGUAGE RecordWildCards #-}
4+{-# LANGUAGE ScopedTypeVariables #-}
5+{-# LANGUAGE TupleSections #-}
6+
7+module Main where
8+
9+import Control.Applicative
10+import Control.Monad
11+import Control.Monad.Writer.Strict
12+
13+import qualified Data.Aeson as A
14+import Data.Bool (bool)
15+import qualified Data.ByteString.Lazy as B
16+import qualified Data.ByteString.UTF8 as BU8
17+import qualified Data.Map as M
18+import Data.Version (showVersion)
19+
20+import qualified Language.PureScript as P
21+import Language.PureScript.Errors.JSON
22+import Language.PureScript.Make
23+
24+import Options.Applicative as Opts
25+
26+import qualified Paths_purescript as Paths
27+
28+import qualified System.Console.ANSI as ANSI
29+import System.Exit (exitSuccess, exitFailure)
30+import System.FilePath.Glob (glob)
31+import System.IO (hSetEncoding, hPutStrLn, stdout, stderr, utf8)
32+import System.IO.UTF8
33+
34+data PSCMakeOptions = PSCMakeOptions
35+ { pscmInput :: [FilePath]
36+ , pscmOutputDir :: FilePath
37+ , pscmOpts :: P.Options
38+ , pscmUsePrefix :: Bool
39+ , pscmJSONErrors :: Bool
40+ }
41+
42+-- | Argumnets: verbose, use JSON, warnings, errors
43+printWarningsAndErrors :: Bool -> Bool -> P.MultipleErrors -> Either P.MultipleErrors a -> IO ()
44+printWarningsAndErrors verbose False warnings errors = do
45+ cc <- bool Nothing (Just P.defaultCodeColor) <$> ANSI.hSupportsANSI stderr
46+ let ppeOpts = P.defaultPPEOptions { P.ppeCodeColor = cc, P.ppeFull = verbose }
47+ when (P.nonEmpty warnings) $
48+ hPutStrLn stderr (P.prettyPrintMultipleWarnings ppeOpts warnings)
49+ case errors of
50+ Left errs -> do
51+ hPutStrLn stderr (P.prettyPrintMultipleErrors ppeOpts errs)
52+ exitFailure
53+ Right _ -> return ()
54+printWarningsAndErrors verbose True warnings errors = do
55+ hPutStrLn stderr . BU8.toString . B.toStrict . A.encode $
56+ JSONResult (toJSONErrors verbose P.Warning warnings)
57+ (either (toJSONErrors verbose P.Error) (const []) errors)
58+ either (const exitFailure) (const (return ())) errors
59+
60+compile :: PSCMakeOptions -> IO ()
61+compile PSCMakeOptions{..} = do
62+ input <- globWarningOnMisses (unless pscmJSONErrors . warnFileTypeNotFound) pscmInput
63+ when (null input && not pscmJSONErrors) $ do
64+ hPutStrLn stderr "psc: No input files."
65+ exitFailure
66+ moduleFiles <- readInput input
67+ (makeErrors, makeWarnings) <- runMake pscmOpts $ do
68+ ms <- P.parseModulesFromFiles id moduleFiles
69+ let filePathMap = M.fromList $ map (\(fp, P.Module _ _ mn _ _) -> (mn, Right fp)) ms
70+ foreigns <- inferForeignModules filePathMap
71+ let makeActions = buildMakeActions pscmOutputDir filePathMap foreigns pscmUsePrefix
72+ P.make makeActions (map snd ms)
73+ printWarningsAndErrors (P.optionsVerboseErrors pscmOpts) pscmJSONErrors makeWarnings makeErrors
74+ exitSuccess
75+
76+warnFileTypeNotFound :: String -> IO ()
77+warnFileTypeNotFound = hPutStrLn stderr . ("psc: No files found using pattern: " ++)
78+
79+globWarningOnMisses :: (String -> IO ()) -> [FilePath] -> IO [FilePath]
80+globWarningOnMisses warn = concatMapM globWithWarning
81+ where
82+ globWithWarning pattern' = do
83+ paths <- glob pattern'
84+ when (null paths) $ warn pattern'
85+ return paths
86+ concatMapM f = fmap concat . mapM f
87+
88+readInput :: [FilePath] -> IO [(FilePath, String)]
89+readInput inputFiles = forM inputFiles $ \inFile -> (inFile, ) <$> readUTF8File inFile
90+
91+inputFile :: Parser FilePath
92+inputFile = strArgument $
93+ metavar "FILE"
94+ <> help "The input .purs file(s)"
95+
96+outputDirectory :: Parser FilePath
97+outputDirectory = strOption $
98+ short 'o'
99+ <> long "output"
100+ <> Opts.value "output"
101+ <> showDefault
102+ <> help "The output directory"
103+
104+noTco :: Parser Bool
105+noTco = switch $
106+ long "no-tco"
107+ <> help "Disable tail call optimizations"
108+
109+noMagicDo :: Parser Bool
110+noMagicDo = switch $
111+ long "no-magic-do"
112+ <> help "Disable the optimization that overloads the do keyword to generate efficient code specifically for the Eff monad"
113+
114+noOpts :: Parser Bool
115+noOpts = switch $
116+ long "no-opts"
117+ <> help "Skip the optimization phase"
118+
119+comments :: Parser Bool
120+comments = switch $
121+ short 'c'
122+ <> long "comments"
123+ <> help "Include comments in the generated code"
124+
125+verboseErrors :: Parser Bool
126+verboseErrors = switch $
127+ short 'v'
128+ <> long "verbose-errors"
129+ <> help "Display verbose error messages"
130+
131+noPrefix :: Parser Bool
132+noPrefix = switch $
133+ short 'p'
134+ <> long "no-prefix"
135+ <> help "Do not include comment header"
136+
137+jsonErrors :: Parser Bool
138+jsonErrors = switch $
139+ long "json-errors"
140+ <> help "Print errors to stderr as JSON"
141+sourceMaps :: Parser Bool
142+sourceMaps = switch $
143+ long "source-maps"
144+ <> help "Generate source maps"
145+
146+
147+options :: Parser P.Options
148+options = P.Options <$> noTco
149+ <*> noMagicDo
150+ <*> pure Nothing
151+ <*> noOpts
152+ <*> verboseErrors
153+ <*> (not <$> comments)
154+ <*> sourceMaps
155+
156+pscMakeOptions :: Parser PSCMakeOptions
157+pscMakeOptions = PSCMakeOptions <$> many inputFile
158+ <*> outputDirectory
159+ <*> options
160+ <*> (not <$> noPrefix)
161+ <*> jsonErrors
162+
163+main :: IO ()
164+main = do
165+ hSetEncoding stdout utf8
166+ hSetEncoding stderr utf8
167+ execParser opts >>= compile
168+ where
169+ opts = info (version <*> helper <*> pscMakeOptions) infoModList
170+ infoModList = fullDesc <> headerInfo <> footerInfo
171+ headerInfo = header "psc - Compiles PureScript to Javascript"
172+ footerInfo = footer $ "psc " ++ showVersion Paths.version
173+
174+ version :: Parser (a -> a)
175+ version = abortOption (InfoMsg (showVersion Paths.version)) $ long "version" <> help "Show the version number" <> hidden
psci/Main.hsnew file+364
@@ -0,0 +1,364 @@
1+{-# LANGUAGE DataKinds #-}
2+{-# LANGUAGE DoAndIfThenElse #-}
3+{-# LANGUAGE GADTs #-}
4+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
5+{-# LANGUAGE MultiParamTypeClasses #-}
6+{-# LANGUAGE OverloadedStrings #-}
7+{-# LANGUAGE PatternGuards #-}
8+{-# LANGUAGE RecordWildCards #-}
9+{-# LANGUAGE ScopedTypeVariables #-}
10+{-# LANGUAGE TemplateHaskell #-}
11+{-# LANGUAGE TupleSections #-}
12+
13+module Main (main) where
14+
15+import Prelude ()
16+import Prelude.Compat
17+
18+import Data.FileEmbed (embedStringFile)
19+import Data.Monoid ((<>))
20+import Data.String (IsString(..))
21+import Data.Text (Text, unpack)
22+import Data.Traversable (for)
23+import Data.Version (showVersion)
24+
25+import Control.Applicative (many, (<|>))
26+import Control.Concurrent (forkIO)
27+import Control.Concurrent.MVar (MVar, newEmptyMVar, putMVar, takeMVar,
28+ tryPutMVar)
29+import Control.Concurrent.STM (TVar, atomically, newTVarIO, writeTVar,
30+ readTVarIO,
31+ TChan, newBroadcastTChanIO, dupTChan,
32+ readTChan, writeTChan)
33+import Control.Exception (fromException)
34+import Control.Monad
35+import Control.Monad.IO.Class (liftIO)
36+import Control.Monad.Trans.Class
37+import Control.Monad.Trans.Except (ExceptT(..), runExceptT)
38+import Control.Monad.Trans.State.Strict (StateT, evalStateT)
39+import Control.Monad.Trans.Reader (ReaderT, runReaderT)
40+
41+import qualified Language.PureScript as P
42+import qualified Language.PureScript.Bundle as Bundle
43+import Language.PureScript.Interactive
44+
45+import Network.HTTP.Types.Header (hContentType, hCacheControl,
46+ hPragma, hExpires)
47+import Network.HTTP.Types.Status (status200, status404, status503)
48+import qualified Network.Wai as Wai
49+import qualified Network.Wai.Handler.Warp as Warp
50+import qualified Network.Wai.Handler.WebSockets as WS
51+import qualified Network.WebSockets as WS
52+
53+import qualified Options.Applicative as Opts
54+
55+import qualified Paths_purescript as Paths
56+
57+import System.Console.Haskeline
58+import System.IO.UTF8 (readUTF8File)
59+import System.Exit
60+import System.FilePath ((</>))
61+import System.FilePath.Glob (glob)
62+import System.Process (readProcessWithExitCode)
63+
64+-- | Command line options
65+data PSCiOptions = PSCiOptions
66+ { psciMultiLineMode :: Bool
67+ , psciInputFile :: [FilePath]
68+ , psciBackend :: Backend
69+ }
70+
71+multiLineMode :: Opts.Parser Bool
72+multiLineMode = Opts.switch $
73+ Opts.long "multi-line-mode"
74+ <> Opts.short 'm'
75+ <> Opts.help "Run in multi-line mode (use ^D to terminate commands)"
76+
77+inputFile :: Opts.Parser FilePath
78+inputFile = Opts.strArgument $
79+ Opts.metavar "FILE"
80+ <> Opts.help "Optional .purs files to load on start"
81+
82+nodeFlagsFlag :: Opts.Parser [String]
83+nodeFlagsFlag = Opts.option parser $
84+ Opts.long "node-opts"
85+ <> Opts.metavar "NODE_OPTS"
86+ <> Opts.value []
87+ <> Opts.help "Flags to pass to node, separated by spaces"
88+ where
89+ parser = words <$> Opts.str
90+
91+port :: Opts.Parser Int
92+port = Opts.option Opts.auto $
93+ Opts.long "port"
94+ <> Opts.short 'p'
95+ <> Opts.help "The web server port"
96+
97+backend :: Opts.Parser Backend
98+backend =
99+ (browserBackend <$> port)
100+ <|> (nodeBackend <$> nodeFlagsFlag)
101+
102+psciOptions :: Opts.Parser PSCiOptions
103+psciOptions = PSCiOptions <$> multiLineMode
104+ <*> many inputFile
105+ <*> backend
106+
107+version :: Opts.Parser (a -> a)
108+version = Opts.abortOption (Opts.InfoMsg (showVersion Paths.version)) $
109+ Opts.long "version" <>
110+ Opts.help "Show the version number" <>
111+ Opts.hidden
112+
113+getOpt :: IO PSCiOptions
114+getOpt = Opts.execParser opts
115+ where
116+ opts = Opts.info (version <*> Opts.helper <*> psciOptions) infoModList
117+ infoModList = Opts.fullDesc <> headerInfo <> footerInfo
118+ headerInfo = Opts.header "psci - Interactive mode for PureScript"
119+ footerInfo = Opts.footer $ "psci " ++ showVersion Paths.version
120+
121+-- | Parses the input and returns either a command, or an error as a 'String'.
122+getCommand :: forall m. MonadException m => Bool -> InputT m (Either String (Maybe Command))
123+getCommand singleLineMode = handleInterrupt (return (Right Nothing)) $ do
124+ firstLine <- withInterrupt $ getInputLine "> "
125+ case firstLine of
126+ Nothing -> return (Right (Just QuitPSCi)) -- Ctrl-D when input is empty
127+ Just "" -> return (Right Nothing)
128+ Just s | singleLineMode || head s == ':' -> return . fmap Just $ parseCommand s
129+ Just s -> fmap Just . parseCommand <$> go [s]
130+ where
131+ go :: [String] -> InputT m String
132+ go ls = maybe (return . unlines $ reverse ls) (go . (:ls)) =<< getInputLine " "
133+
134+-- | Make a JavaScript bundle for the browser.
135+bundle :: IO (Either Bundle.ErrorMessage String)
136+bundle = runExceptT $ do
137+ inputFiles <- liftIO (glob (".psci_modules" </> "node_modules" </> "*" </> "*.js"))
138+ input <- for inputFiles $ \filename -> do
139+ js <- liftIO (readUTF8File filename)
140+ mid <- Bundle.guessModuleIdentifier filename
141+ length js `seq` return (mid, js)
142+ Bundle.bundle input [] Nothing "PSCI"
143+
144+indexJS :: IsString string => string
145+indexJS = $(embedStringFile "psci/static/index.js")
146+
147+indexPage :: IsString string => string
148+indexPage = $(embedStringFile "psci/static/index.html")
149+
150+-- | All of the functions required to implement a PSCi backend
151+data Backend = forall state. Backend
152+ { _backendSetup :: IO state
153+ -- ^ Initialize, and call the continuation when the backend is ready
154+ , _backendEval :: state -> String -> IO ()
155+ -- ^ Evaluate JavaScript code
156+ , _backendReload :: state -> IO ()
157+ -- ^ Reload the compiled code
158+ , _backendShutdown :: state -> IO ()
159+ -- ^ Shut down the backend
160+ }
161+
162+-- | Commands which can be sent to the browser
163+data BrowserCommand
164+ = Eval (MVar String)
165+ -- ^ Evaluate the latest JS
166+ | Reload
167+ -- ^ Reload the page
168+
169+-- | State for the browser backend
170+data BrowserState = BrowserState
171+ { browserCommands :: TChan BrowserCommand
172+ -- ^ A channel which receives data when the compiled JS has
173+ -- been updated
174+ , browserShutdownNotice :: MVar ()
175+ -- ^ An MVar which becomes full when the server should shut down
176+ , browserIndexJS :: TVar (Maybe String)
177+ -- ^ A TVar holding the latest compiled JS
178+ , browserBundleJS :: TVar (Maybe String)
179+ -- ^ A TVar holding the latest bundled JS
180+ }
181+
182+browserBackend :: Int -> Backend
183+browserBackend serverPort = Backend setup evaluate reload shutdown
184+ where
185+ setup :: IO BrowserState
186+ setup = do
187+ shutdownVar <- newEmptyMVar
188+ cmdChan <- newBroadcastTChanIO
189+ indexJs <- newTVarIO Nothing
190+ bundleJs <- newTVarIO Nothing
191+
192+ let
193+ handleWebsocket :: WS.PendingConnection -> IO ()
194+ handleWebsocket pending = do
195+ conn <- WS.acceptRequest pending
196+ -- Fork a thread to keep the connection alive
197+ WS.forkPingThread conn 10
198+ -- Clone the command channel
199+ cmdChanCopy <- atomically $ dupTChan cmdChan
200+ -- Listen for commands
201+ forever $ do
202+ cmd <- atomically $ readTChan cmdChanCopy
203+ case cmd of
204+ Eval resultVar -> void $ do
205+ WS.sendTextData conn ("eval" :: Text)
206+ result <- WS.receiveData conn
207+ -- With many connected clients, all but one of
208+ -- these attempts will fail.
209+ tryPutMVar resultVar (unpack result)
210+ Reload ->
211+ WS.sendTextData conn ("reload" :: Text)
212+
213+ shutdownHandler :: IO () -> IO ()
214+ shutdownHandler stopServer = void . forkIO $ do
215+ () <- takeMVar shutdownVar
216+ stopServer
217+
218+ onException :: Maybe Wai.Request -> SomeException -> IO ()
219+ onException req ex
220+ | Just (_ :: WS.ConnectionException) <- fromException ex
221+ = return () -- ignore websocket disconnects
222+ | otherwise = Warp.defaultOnException req ex
223+
224+ staticServer :: Wai.Application
225+ staticServer req respond =
226+ case Wai.pathInfo req of
227+ [] ->
228+ respond $ Wai.responseLBS status200
229+ [(hContentType, "text/html")]
230+ indexPage
231+ ["js", "index.js"] ->
232+ respond $ Wai.responseLBS status200
233+ [(hContentType, "application/javascript")]
234+ indexJS
235+ ["js", "latest.js"] -> do
236+ may <- readTVarIO indexJs
237+ case may of
238+ Nothing ->
239+ respond $ Wai.responseLBS status503 [] "Service not available"
240+ Just js ->
241+ respond $ Wai.responseLBS status200
242+ [ (hContentType, "application/javascript")
243+ , (hCacheControl, "no-cache, no-store, must-revalidate")
244+ , (hPragma, "no-cache")
245+ , (hExpires, "0")
246+ ]
247+ (fromString js)
248+ ["js", "bundle.js"] -> do
249+ may <- readTVarIO bundleJs
250+ case may of
251+ Nothing ->
252+ respond $ Wai.responseLBS status503 [] "Service not available"
253+ Just js ->
254+ respond $ Wai.responseLBS status200
255+ [ (hContentType, "application/javascript")]
256+ (fromString js)
257+ _ -> respond $ Wai.responseLBS status404 [] "Not found"
258+
259+ let browserState = BrowserState cmdChan shutdownVar indexJs bundleJs
260+ createBundle browserState
261+
262+ putStrLn $ "Serving http://localhost:" <> show serverPort <> "/. Waiting for connections..."
263+ _ <- forkIO $ Warp.runSettings ( Warp.setInstallShutdownHandler shutdownHandler
264+ . Warp.setPort serverPort
265+ . Warp.setOnException onException
266+ $ Warp.defaultSettings
267+ ) $
268+ WS.websocketsOr WS.defaultConnectionOptions
269+ handleWebsocket
270+ staticServer
271+ return browserState
272+
273+ createBundle :: BrowserState -> IO ()
274+ createBundle state = do
275+ putStrLn "Bundling Javascript..."
276+ ejs <- bundle
277+ case ejs of
278+ Left err -> do
279+ putStrLn (unlines (Bundle.printErrorMessage err))
280+ exitFailure
281+ Right js ->
282+ atomically $ writeTVar (browserBundleJS state) (Just js)
283+
284+ reload :: BrowserState -> IO ()
285+ reload state = do
286+ createBundle state
287+ atomically $ writeTChan (browserCommands state) Reload
288+
289+ shutdown :: BrowserState -> IO ()
290+ shutdown state = putMVar (browserShutdownNotice state) ()
291+
292+ evaluate :: BrowserState -> String -> IO ()
293+ evaluate state js = liftIO $ do
294+ resultVar <- newEmptyMVar
295+ atomically $ do
296+ writeTVar (browserIndexJS state) (Just js)
297+ writeTChan (browserCommands state) (Eval resultVar)
298+ result <- takeMVar resultVar
299+ putStrLn result
300+
301+nodeBackend :: [String] -> Backend
302+nodeBackend nodeArgs = Backend setup eval reload shutdown
303+ where
304+ setup :: IO ()
305+ setup = return ()
306+
307+ eval :: () -> String -> IO ()
308+ eval _ _ = do
309+ writeFile indexFile "require('$PSCI')['$main']();"
310+ process <- findNodeProcess
311+ result <- traverse (\node -> readProcessWithExitCode node (nodeArgs ++ [indexFile]) "") process
312+ case result of
313+ Just (ExitSuccess, out, _) -> putStrLn out
314+ Just (ExitFailure _, _, err) -> putStrLn err
315+ Nothing -> putStrLn "Couldn't find node.js"
316+
317+ reload :: () -> IO ()
318+ reload _ = return ()
319+
320+ shutdown :: () -> IO ()
321+ shutdown _ = return ()
322+
323+-- | Get command line options and drop into the REPL
324+main :: IO ()
325+main = getOpt >>= loop
326+ where
327+ loop :: PSCiOptions -> IO ()
328+ loop PSCiOptions{..} = do
329+ inputFiles <- concat <$> traverse glob psciInputFile
330+ e <- runExceptT $ do
331+ modules <- ExceptT (loadAllModules inputFiles)
332+ unless (supportModuleIsDefined (map snd modules)) . liftIO $ do
333+ putStrLn supportModuleMessage
334+ exitFailure
335+ (externs, env) <- ExceptT . runMake . make $ modules
336+ return (modules, externs, env)
337+ case psciBackend of
338+ Backend setup eval reload (shutdown :: state -> IO ()) ->
339+ case e of
340+ Left errs -> putStrLn (P.prettyPrintMultipleErrors P.defaultPPEOptions errs) >> exitFailure
341+ Right (modules, externs, env) -> do
342+ historyFilename <- getHistoryFilename
343+ let settings = defaultSettings { historyFile = Just historyFilename }
344+ initialState = PSCiState [] [] (zip (map snd modules) externs)
345+ config = PSCiConfig inputFiles env
346+ runner = flip runReaderT config
347+ . flip evalStateT initialState
348+ . runInputT (setComplete completion settings)
349+
350+ go :: state -> InputT (StateT PSCiState (ReaderT PSCiConfig IO)) ()
351+ go state = do
352+ c <- getCommand (not psciMultiLineMode)
353+ case c of
354+ Left err -> outputStrLn err >> go state
355+ Right Nothing -> go state
356+ Right (Just QuitPSCi) -> do
357+ outputStrLn quitMessage
358+ liftIO $ shutdown state
359+ Right (Just c') -> do
360+ handleInterrupt (outputStrLn "Interrupted.")
361+ (withInterrupt (lift (handleCommand (liftIO . eval state) (liftIO (reload state)) c')))
362+ go state
363+ putStrLn prologueMessage
364+ setup >>= runner . go
psci/static/index.htmlnew file+10
@@ -0,0 +1,10 @@
1+<!DOCTYPE html>
2+<html>
3+<head>
4+ <title>PureScript Interactive</title>
5+ <script src='js/bundle.js'></script>
6+ <script src='js/index.js'></script>
7+</head>
8+<body>
9+</body>
10+</html>
psci/static/index.jsnew file+63
@@ -0,0 +1,63 @@
1+var get = function get(uri, callback, onError) {
2+ var request = new XMLHttpRequest();
3+ request.addEventListener('load', function() {
4+ callback(request.responseText);
5+ });
6+ request.addEventListener('error', onError);
7+ request.open('GET', uri);
8+ request.send();
9+};
10+var evaluate = function evaluate(js) {
11+ var buffer = [];
12+ // Save the old console.log function
13+ var oldLog = console.log;
14+ console.log = function(s) {
15+ // Push log output into a temporary buffer
16+ // which will be returned to PSCi.
17+ buffer.push(s);
18+ };
19+ // Replace any require(...) statements with lookups on the PSCI object.
20+ var replaced = js.replace(/require\("[^"]*"\)/g, function(s) {
21+ return "PSCI['" + s.substring(12, s.length - 2) + "']";
22+ });
23+ // Wrap the module and evaluate it.
24+ var wrapped =
25+ [ 'var module = {};'
26+ , '(function(module) {'
27+ , replaced
28+ , '})(module);'
29+ , 'return module.exports["$main"] && module.exports["$main"]();'
30+ ].join('\n');
31+ new Function(wrapped)();
32+ // Restore console.log
33+ console.log = oldLog;
34+ return buffer.join('\n');
35+};
36+window.onload = function() {
37+ var socket = new WebSocket('ws://0.0.0.0:' + location.port);
38+ var evalNext = function reload() {
39+ get('js/latest.js', function(response) {
40+ try {
41+ var result = evaluate(response);
42+ socket.send(result);
43+ } catch (ex) {
44+ socket.send(ex.stack);
45+ }
46+ }, function(err) {
47+ socket.send('Error sending JavaScript');
48+ });
49+ };
50+ socket.onopen = function() {
51+ console.log('Connected');
52+ socket.onmessage = function(event) {
53+ switch (event.data) {
54+ case 'eval':
55+ evalNext();
56+ break;
57+ case 'reload':
58+ location.reload();
59+ break;
60+ }
61+ };
62+ };
63+};
psgo.cabaldeleted−145
@@ -1,145 +0,0 @@
1−cabal-version: 1.12
2−
3−-- This file has been generated from package.yaml by hpack version 0.35.0.
4−--
5−-- see: https://github.com/sol/hpack
6−
7−name: psgo
8−version: 0.1.0.0
9−description: Please see the README on Github at <https://github.com/andyarvanitis/purescript-native#readme>
10−homepage: https://github.com/andyarvanitis/purescript-native#readme
11−bug-reports: https://github.com/andyarvanitis/purescript-native/issues
12−author: Andy Arvanitis
13−maintainer: example@example.com
14−copyright: 2018 Andy Arvanitis
15−license: BSD3
16−license-file: LICENSE
17−build-type: Simple
18−extra-source-files:
19− README.md
20− ChangeLog.md
21− stack.yaml
22− support/ffi-loader.go
23− support/go.mod.ffi-loader
24− support/go.mod.output
25− support/go.mod.working
26−
27−source-repository head
28− type: git
29− location: https://github.com/andyarvanitis/purescript-native
30−
31−library
32− exposed-modules:
33− CodeGen.IL
34− CodeGen.IL.Common
35− CodeGen.IL.Optimizer
36− CodeGen.IL.Optimizer.Common
37− CodeGen.IL.Optimizer.Inliner
38− CodeGen.IL.Optimizer.MagicDo
39− CodeGen.IL.Optimizer.TCO
40− CodeGen.IL.Printer
41− Tests
42− other-modules:
43− Paths_psgo
44− hs-source-dirs:
45− src
46− default-extensions:
47− ConstraintKinds
48− DataKinds
49− DeriveFunctor
50− EmptyDataDecls
51− FlexibleContexts
52− KindSignatures
53− LambdaCase
54− MultiParamTypeClasses
55− NoImplicitPrelude
56− PatternGuards
57− PatternSynonyms
58− RankNTypes
59− RecordWildCards
60− OverloadedStrings
61− ScopedTypeVariables
62− TupleSections
63− ViewPatterns
64− build-depends:
65− aeson >=1.0 && <1.5
66− , base >=4.7 && <5
67− , base-compat >=0.6.0
68− , bytestring >=0.10.8.2 && <0.11
69− , containers
70− , directory
71− , file-embed
72− , filemanip
73− , filepath
74− , gitrev
75− , monad-parallel >=0.7.2.2 && <0.8
76− , mtl >=2.1.0 && <2.3.0
77− , pattern-arrows >=0.0.2 && <0.1
78− , process
79− , protolude >=0.1.6
80− , purescript
81− , safe >=0.3.9 && <0.4
82− , text
83− , transformers >=0.3.0 && <0.6
84− default-language: Haskell2010
85−
86−executable psgo
87− main-is: Main.hs
88− other-modules:
89− Paths_psgo
90− hs-source-dirs:
91− app
92− ghc-options: -threaded -rtsopts -with-rtsopts=-N
93− build-depends:
94− aeson >=1.0 && <1.5
95− , base >=4.7 && <5
96− , base-compat >=0.6.0
97− , bytestring >=0.10.8.2 && <0.11
98− , containers
99− , directory
100− , file-embed
101− , filemanip
102− , filepath
103− , gitrev
104− , monad-parallel >=0.7.2.2 && <0.8
105− , mtl >=2.1.0 && <2.3.0
106− , pattern-arrows >=0.0.2 && <0.1
107− , process
108− , protolude >=0.1.6
109− , psgo
110− , purescript
111− , safe >=0.3.9 && <0.4
112− , text
113− , transformers >=0.3.0 && <0.6
114− default-language: Haskell2010
115−
116−test-suite psgo-test
117− type: exitcode-stdio-1.0
118− main-is: Spec.hs
119− other-modules:
120− Paths_psgo
121− hs-source-dirs:
122− test
123− ghc-options: -threaded -rtsopts -with-rtsopts=-N
124− build-depends:
125− aeson >=1.0 && <1.5
126− , base >=4.7 && <5
127− , base-compat >=0.6.0
128− , bytestring >=0.10.8.2 && <0.11
129− , containers
130− , directory
131− , file-embed
132− , filemanip
133− , filepath
134− , gitrev
135− , monad-parallel >=0.7.2.2 && <0.8
136− , mtl >=2.1.0 && <2.3.0
137− , pattern-arrows >=0.0.2 && <0.1
138− , process
139− , protolude >=0.1.6
140− , psgo
141− , purescript
142− , safe >=0.3.9 && <0.4
143− , text
144− , transformers >=0.3.0 && <0.6
145− default-language: Haskell2010
purescript.cabalnew file+525
@@ -0,0 +1,525 @@
1+name: purescript
2+version: 0.9.3
3+cabal-version: >=1.8
4+build-type: Simple
5+license: MIT
6+license-file: LICENSE
7+copyright: (c) 2013-15 Phil Freeman, (c) 2014-15 Gary Burgess
8+maintainer: Phil Freeman <paf31@cantab.net>
9+stability: experimental
10+synopsis: PureScript Programming Language Compiler
11+description: A small strongly, statically typed programming language with expressive types, inspired by Haskell and compiling to Javascript.
12+category: Language
13+Homepage: http://www.purescript.org/
14+author: Phil Freeman <paf31@cantab.net>,
15+ Gary Burgess <gary.burgess@gmail.com>,
16+ Hardy Jones <jones3.hardy@gmail.com>,
17+ Harry Garrood <harry@garrood.me>,
18+ Christoph Hegemann <christoph.hegemann1337@gmail.com>
19+
20+tested-with: GHC==7.10.3
21+
22+extra-source-files: examples/passing/*.purs
23+ , examples/passing/*.js
24+ , examples/passing/2018/*.purs
25+ , examples/passing/2138/*.purs
26+ , examples/passing/ClassRefSyntax/*.purs
27+ , examples/passing/DctorOperatorAlias/*.purs
28+ , examples/passing/ExplicitImportReExport/*.purs
29+ , examples/passing/ExportExplicit/*.purs
30+ , examples/passing/ExportExplicit2/*.purs
31+ , examples/passing/Import/*.purs
32+ , examples/passing/ImportExplicit/*.purs
33+ , examples/passing/ImportQualified/*.purs
34+ , examples/passing/Module/*.purs
35+ , examples/passing/ModuleDeps/*.purs
36+ , examples/passing/ModuleExport/*.purs
37+ , examples/passing/ModuleExportDupes/*.purs
38+ , examples/passing/ModuleExportExcluded/*.purs
39+ , examples/passing/ModuleExportQualified/*.purs
40+ , examples/passing/ModuleExportSelf/*.purs
41+ , examples/passing/NonConflictingExports/*.purs
42+ , examples/passing/OperatorAliasElsewhere/*.purs
43+ , examples/passing/Operators/*.purs
44+ , examples/passing/PendingConflictingImports/*.purs
45+ , examples/passing/PendingConflictingImports2/*.purs
46+ , examples/passing/QualifiedNames/*.purs
47+ , examples/passing/RedefinedFixity/*.purs
48+ , examples/passing/ReExportQualified/*.purs
49+ , examples/passing/ResolvableScopeConflict/*.purs
50+ , examples/passing/ResolvableScopeConflict2/*.purs
51+ , examples/passing/ResolvableScopeConflict3/*.purs
52+ , examples/passing/ShadowedModuleName/*.purs
53+ , examples/passing/TransitiveImport/*.purs
54+ , examples/passing/TypeOperators/*.purs
55+ , examples/passing/TypeWithoutParens/*.purs
56+ , examples/failing/*.purs
57+ , examples/failing/1733/*.purs
58+ , examples/failing/ConflictingExports/*.purs
59+ , examples/failing/ConflictingImports/*.purs
60+ , examples/failing/ConflictingImports2/*.purs
61+ , examples/failing/ConflictingQualifiedImports/*.purs
62+ , examples/failing/ConflictingQualifiedImports2/*.purs
63+ , examples/failing/ExportConflictClass/*.purs
64+ , examples/failing/ExportConflictCtor/*.purs
65+ , examples/failing/ExportConflictType/*.purs
66+ , examples/failing/ExportConflictTypeOp/*.purs
67+ , examples/failing/ExportConflictValue/*.purs
68+ , examples/failing/ExportConflictValueOp/*.purs
69+ , examples/failing/ExportExplicit1/*.purs
70+ , examples/failing/ExportExplicit3/*.purs
71+ , examples/failing/ImportExplicit/*.purs
72+ , examples/failing/ImportExplicit2/*.purs
73+ , examples/failing/ImportHidingModule/*.purs
74+ , examples/failing/ImportModule/*.purs
75+ , examples/failing/InstanceExport/*.purs
76+ , examples/failing/OrphanInstance/*.purs
77+ , examples/warning/*.purs
78+ , examples/warning/*.js
79+ , examples/docs/bower_components/purescript-prelude/src/*.purs
80+ , examples/docs/bower.json
81+ , examples/docs/src/*.purs
82+ , psci/static/index.html
83+ , psci/static/index.js
84+ , tests/support/package.json
85+ , tests/support/bower.json
86+ , tests/support/setup-win.cmd
87+ , tests/support/psci/*.purs
88+ , tests/support/pscide/src/*.purs
89+ , tests/support/pscide/src/*.js
90+ , tests/support/pscide/src/*.fail
91+ , stack.yaml
92+ , README.md
93+ , INSTALL.md
94+ , CONTRIBUTORS.md
95+ , CONTRIBUTING.md
96+
97+source-repository head
98+ type: git
99+ location: https://github.com/purescript/purescript.git
100+
101+library
102+ build-depends: base >=4.8 && <5,
103+ aeson >= 0.8 && < 1.1,
104+ aeson-better-errors >= 0.8,
105+ ansi-terminal >= 0.6.2 && < 0.7,
106+ base-compat >=0.6.0,
107+ bower-json >= 0.8,
108+ boxes >= 0.1.4 && < 0.2.0,
109+ bytestring -any,
110+ containers -any,
111+ clock -any,
112+ data-ordlist >= 0.4.7.0,
113+ directory >= 1.2,
114+ dlist -any,
115+ edit-distance -any,
116+ filepath -any,
117+ fsnotify >= 0.2.1,
118+ Glob >= 0.7 && < 0.8,
119+ haskeline >= 0.7.0.0,
120+ http-client >= 0.4.30 && <0.5,
121+ http-types -any,
122+ language-javascript == 0.6.*,
123+ lifted-base >= 0.2.3 && < 0.2.4,
124+ monad-control >= 1.0.0.0 && < 1.1,
125+ monad-logger >= 0.3 && < 0.4,
126+ mtl >= 2.1.0 && < 2.3.0,
127+ parallel >= 3.2 && < 3.3,
128+ parsec >=3.1.10,
129+ pattern-arrows >= 0.0.2 && < 0.1,
130+ pipes >= 4.0.0 && < 4.3.0,
131+ pipes-http -any,
132+ process >= 1.2.0 && < 1.5,
133+ protolude >= 0.1.6,
134+ regex-tdfa -any,
135+ safe >= 0.3.9 && < 0.4,
136+ semigroups >= 0.16.2 && < 0.19,
137+ sourcemap >= 0.1.6,
138+ spdx == 0.2.*,
139+ split -any,
140+ stm >= 0.2.4.0,
141+ syb -any,
142+ text -any,
143+ time -any,
144+ transformers >= 0.3.0 && < 0.6,
145+ transformers-base >= 0.4.0 && < 0.5,
146+ transformers-compat >= 0.3.0,
147+ unordered-containers -any,
148+ utf8-string >= 1 && < 2,
149+ vector -any
150+
151+ exposed-modules: Language.PureScript
152+ Language.PureScript.AST
153+ Language.PureScript.AST.Binders
154+ Language.PureScript.AST.Declarations
155+ Language.PureScript.AST.Operators
156+ Language.PureScript.AST.Literals
157+ Language.PureScript.AST.SourcePos
158+ Language.PureScript.AST.Traversals
159+ Language.PureScript.AST.Exported
160+ Language.PureScript.Bundle
161+ Language.PureScript.Crash
162+ Language.PureScript.Externs
163+ Language.PureScript.CodeGen
164+ Language.PureScript.CodeGen.JS
165+ Language.PureScript.CodeGen.JS.AST
166+ Language.PureScript.CodeGen.JS.Common
167+ Language.PureScript.CodeGen.JS.Optimizer
168+ Language.PureScript.CodeGen.JS.Optimizer.Blocks
169+ Language.PureScript.CodeGen.JS.Optimizer.Common
170+ Language.PureScript.CodeGen.JS.Optimizer.Inliner
171+ Language.PureScript.CodeGen.JS.Optimizer.MagicDo
172+ Language.PureScript.CodeGen.JS.Optimizer.TCO
173+ Language.PureScript.CodeGen.JS.Optimizer.Unused
174+ Language.PureScript.Constants
175+ Language.PureScript.CoreFn
176+ Language.PureScript.CoreFn.Ann
177+ Language.PureScript.CoreFn.Binders
178+ Language.PureScript.CoreFn.Desugar
179+ Language.PureScript.CoreFn.Expr
180+ Language.PureScript.CoreFn.Meta
181+ Language.PureScript.CoreFn.Module
182+ Language.PureScript.CoreFn.Traversals
183+ Language.PureScript.Comments
184+ Language.PureScript.Environment
185+ Language.PureScript.Errors
186+ Language.PureScript.Errors.JSON
187+ Language.PureScript.Kinds
188+ Language.PureScript.Linter
189+ Language.PureScript.Linter.Exhaustive
190+ Language.PureScript.Linter.Imports
191+ Language.PureScript.Make
192+ Language.PureScript.ModuleDependencies
193+ Language.PureScript.Names
194+ Language.PureScript.Options
195+ Language.PureScript.Parser
196+ Language.PureScript.Parser.Lexer
197+ Language.PureScript.Parser.Common
198+ Language.PureScript.Parser.Declarations
199+ Language.PureScript.Parser.Kinds
200+ Language.PureScript.Parser.State
201+ Language.PureScript.Parser.Types
202+ Language.PureScript.Pretty
203+ Language.PureScript.Pretty.Common
204+ Language.PureScript.Pretty.JS
205+ Language.PureScript.Pretty.Kinds
206+ Language.PureScript.Pretty.Types
207+ Language.PureScript.Pretty.Values
208+ Language.PureScript.Renamer
209+ Language.PureScript.Sugar
210+ Language.PureScript.Sugar.BindingGroups
211+ Language.PureScript.Sugar.CaseDeclarations
212+ Language.PureScript.Sugar.DoNotation
213+ Language.PureScript.Sugar.Names
214+ Language.PureScript.Sugar.Names.Common
215+ Language.PureScript.Sugar.Names.Env
216+ Language.PureScript.Sugar.Names.Exports
217+ Language.PureScript.Sugar.Names.Imports
218+ Language.PureScript.Sugar.ObjectWildcards
219+ Language.PureScript.Sugar.Operators
220+ Language.PureScript.Sugar.Operators.Common
221+ Language.PureScript.Sugar.Operators.Expr
222+ Language.PureScript.Sugar.Operators.Binders
223+ Language.PureScript.Sugar.Operators.Types
224+ Language.PureScript.Sugar.TypeClasses
225+ Language.PureScript.Sugar.TypeClasses.Deriving
226+ Language.PureScript.Sugar.TypeDeclarations
227+ Language.PureScript.Traversals
228+ Language.PureScript.TypeChecker
229+ Language.PureScript.TypeChecker.Entailment
230+ Language.PureScript.TypeChecker.Kinds
231+ Language.PureScript.TypeChecker.Monad
232+ Language.PureScript.TypeChecker.Rows
233+ Language.PureScript.TypeChecker.Skolems
234+ Language.PureScript.TypeChecker.Subsumption
235+ Language.PureScript.TypeChecker.Synonyms
236+ Language.PureScript.TypeChecker.Types
237+ Language.PureScript.TypeChecker.Unify
238+ Language.PureScript.TypeClassDictionaries
239+ Language.PureScript.Types
240+
241+ Language.PureScript.Docs
242+ Language.PureScript.Docs.Convert
243+ Language.PureScript.Docs.Convert.Single
244+ Language.PureScript.Docs.Convert.ReExports
245+ Language.PureScript.Docs.Render
246+ Language.PureScript.Docs.Types
247+ Language.PureScript.Docs.RenderedCode
248+ Language.PureScript.Docs.RenderedCode.Types
249+ Language.PureScript.Docs.RenderedCode.Render
250+ Language.PureScript.Docs.AsMarkdown
251+ Language.PureScript.Docs.ParseAndBookmark
252+ Language.PureScript.Docs.Utils.MonoidExtras
253+
254+ Language.PureScript.Publish
255+ Language.PureScript.Publish.Utils
256+ Language.PureScript.Publish.ErrorsWarnings
257+ Language.PureScript.Publish.BoxesHelpers
258+
259+ Language.PureScript.Ide
260+ Language.PureScript.Ide.CaseSplit
261+ Language.PureScript.Ide.Command
262+ Language.PureScript.Ide.Completion
263+ Language.PureScript.Ide.Conversions
264+ Language.PureScript.Ide.Externs
265+ Language.PureScript.Ide.Error
266+ Language.PureScript.Ide.Imports
267+ Language.PureScript.Ide.Filter
268+ Language.PureScript.Ide.Matcher
269+ Language.PureScript.Ide.Pursuit
270+ Language.PureScript.Ide.Rebuild
271+ Language.PureScript.Ide.Reexports
272+ Language.PureScript.Ide.SourceFile
273+ Language.PureScript.Ide.State
274+ Language.PureScript.Ide.Types
275+ Language.PureScript.Ide.Util
276+ Language.PureScript.Ide.Watcher
277+
278+ Language.PureScript.Interactive
279+ Language.PureScript.Interactive.Types
280+ Language.PureScript.Interactive.Parser
281+ Language.PureScript.Interactive.Directive
282+ Language.PureScript.Interactive.Completion
283+ Language.PureScript.Interactive.IO
284+ Language.PureScript.Interactive.Message
285+ Language.PureScript.Interactive.Module
286+ Language.PureScript.Interactive.Printer
287+
288+ Control.Monad.Logger
289+ Control.Monad.Supply
290+ Control.Monad.Supply.Class
291+
292+ System.IO.UTF8
293+
294+ extensions: ConstraintKinds
295+ DataKinds
296+ DeriveFunctor
297+ EmptyDataDecls
298+ FlexibleContexts
299+ KindSignatures
300+ LambdaCase
301+ MultiParamTypeClasses
302+ NoImplicitPrelude
303+ PatternGuards
304+ PatternSynonyms
305+ RankNTypes
306+ RecordWildCards
307+ ScopedTypeVariables
308+ TupleSections
309+ ViewPatterns
310+ exposed: True
311+ buildable: True
312+ hs-source-dirs: src
313+ other-modules: Paths_purescript
314+ ghc-options: -Wall -O2
315+
316+executable psc
317+ build-depends: base >=4 && <5,
318+ purescript -any,
319+ aeson >= 0.8 && < 1.1,
320+ ansi-terminal >= 0.6.2 && < 0.7,
321+ base-compat >=0.6.0,
322+ bytestring -any,
323+ containers -any,
324+ directory -any,
325+ filepath -any,
326+ Glob >= 0.7 && < 0.8,
327+ mtl -any,
328+ optparse-applicative >= 0.12.1,
329+ parsec -any,
330+ time -any,
331+ transformers -any,
332+ transformers-compat -any,
333+ utf8-string >= 1 && < 2
334+ main-is: Main.hs
335+ buildable: True
336+ hs-source-dirs: psc
337+ other-modules: Paths_purescript
338+ ghc-options: -Wall -O2 -fno-warn-unused-do-bind -threaded -rtsopts "-with-rtsopts=-N"
339+
340+executable psci
341+ build-depends: base >=4 && <5,
342+ purescript -any,
343+ base-compat >=0.6.0,
344+ boxes >= 0.1.4 && < 0.2.0,
345+ bytestring -any,
346+ containers -any,
347+ directory -any,
348+ filepath -any,
349+ file-embed -any,
350+ Glob -any,
351+ haskeline >= 0.7.0.0,
352+ http-types == 0.9.*,
353+ mtl -any,
354+ optparse-applicative >= 0.12.1,
355+ parsec -any,
356+ process -any,
357+ stm >= 0.2.4.0,
358+ text -any,
359+ time -any,
360+ transformers -any,
361+ transformers-compat -any,
362+ wai == 3.*,
363+ wai-websockets == 3.*,
364+ warp == 3.*,
365+ websockets >= 0.9 && <0.10
366+ main-is: Main.hs
367+ buildable: True
368+ hs-source-dirs: psci
369+ other-modules: Paths_purescript
370+ ghc-options: -Wall -O2
371+
372+executable psc-docs
373+ build-depends: base >=4 && <5,
374+ purescript -any,
375+ ansi-wl-pprint -any,
376+ directory -any,
377+ filepath -any,
378+ Glob -any,
379+ mtl -any,
380+ optparse-applicative >= 0.12.1,
381+ process -any,
382+ split -any,
383+ transformers -any,
384+ transformers-compat -any
385+ main-is: Main.hs
386+ other-modules: Paths_purescript
387+ buildable: True
388+ hs-source-dirs: psc-docs
389+ other-modules: Ctags
390+ Etags
391+ Tags
392+ ghc-options: -Wall -O2
393+
394+executable psc-publish
395+ build-depends: base >=4 && <5,
396+ purescript -any,
397+ aeson -any,
398+ bytestring -any,
399+ optparse-applicative -any
400+ main-is: Main.hs
401+ other-modules: Paths_purescript
402+ buildable: True
403+ hs-source-dirs: psc-publish
404+ ghc-options: -Wall -O2
405+
406+executable psc-hierarchy
407+ build-depends: base >=4 && <5,
408+ purescript -any,
409+ directory -any,
410+ filepath -any,
411+ Glob -any,
412+ mtl -any,
413+ optparse-applicative >= 0.12.1,
414+ parsec -any,
415+ process -any
416+ main-is: Main.hs
417+ other-modules: Paths_purescript
418+ buildable: True
419+ hs-source-dirs: hierarchy
420+ other-modules:
421+ ghc-options: -Wall -O2
422+
423+executable psc-bundle
424+ main-is: Main.hs
425+ other-modules: Paths_purescript
426+ other-extensions:
427+ build-depends: base >=4 && <5,
428+ purescript -any,
429+ directory -any,
430+ filepath -any,
431+ Glob -any,
432+ mtl -any,
433+ optparse-applicative >= 0.12.1,
434+ transformers -any,
435+ transformers-compat -any
436+ ghc-options: -Wall -O2
437+ hs-source-dirs: psc-bundle
438+
439+executable psc-ide-server
440+ main-is: Main.hs
441+ other-modules: Paths_purescript
442+ other-extensions:
443+ build-depends: base >=4 && <5,
444+ aeson >= 0.8 && < 1.1,
445+ bytestring -any,
446+ purescript -any,
447+ base-compat >=0.6.0,
448+ directory -any,
449+ filepath -any,
450+ monad-logger -any,
451+ mtl -any,
452+ network -any,
453+ optparse-applicative >= 0.12.1,
454+ protolude >= 0.1.6,
455+ stm -any,
456+ text -any,
457+ transformers -any,
458+ transformers-compat -any
459+ ghc-options: -Wall -O2 -threaded
460+ hs-source-dirs: psc-ide-server
461+
462+executable psc-ide-client
463+ main-is: Main.hs
464+ other-modules: Paths_purescript
465+ other-extensions:
466+ build-depends: base >=4 && <5,
467+ base-compat >=0.6.0,
468+ bytestring -any,
469+ mtl -any,
470+ network -any,
471+ optparse-applicative >= 0.12.1,
472+ text -any
473+ ghc-options: -Wall -O2
474+ hs-source-dirs: psc-ide-client
475+
476+test-suite tests
477+ build-depends: base >=4 && <5,
478+ purescript -any,
479+ aeson -any,
480+ aeson-better-errors -any,
481+ base-compat -any,
482+ boxes -any,
483+ bytestring -any,
484+ containers -any,
485+ directory -any,
486+ filepath -any,
487+ Glob -any,
488+ haskeline >= 0.7.0.0,
489+ hspec -any,
490+ hspec-discover -any,
491+ HUnit -any,
492+ mtl -any,
493+ optparse-applicative -any,
494+ parsec -any,
495+ process -any,
496+ protolude >= 0.1.6,
497+ silently -any,
498+ stm -any,
499+ text -any,
500+ time -any,
501+ transformers -any,
502+ transformers-compat -any,
503+ utf8-string -any,
504+ vector -any
505+ ghc-options: -Wall
506+ type: exitcode-stdio-1.0
507+ main-is: Main.hs
508+ other-modules: TestUtils
509+ TestCompiler
510+ TestDocs
511+ TestPscPublish
512+ TestPsci
513+ TestPscIde
514+ PscIdeSpec
515+ Language.PureScript.Ide.FilterSpec
516+ Language.PureScript.Ide.ImportsSpec
517+ Language.PureScript.Ide.Imports.IntegrationSpec
518+ Language.PureScript.Ide.Integration
519+ Language.PureScript.Ide.MatcherSpec
520+ Language.PureScript.Ide.RebuildSpec
521+ Language.PureScript.Ide.ReexportsSpec
522+ Language.PureScript.Ide.SourceFile.IntegrationSpec
523+ Language.PureScript.Ide.SourceFileSpec
524+ buildable: True
525+ hs-source-dirs: tests
src/CodeGen/IL.hsdeleted−321
@@ -1,321 +0,0 @@
1−-- | This module generates code in the core imperative representation from
2−-- elaborated PureScript code.
3−module CodeGen.IL
4− ( module AST
5− , module Common
6− , moduleToIL
7− ) where
8−
9−import Prelude.Compat
10−import Protolude (ordNub)
11−
12−import Control.Arrow ((&&&))
13−import Control.Monad (forM, liftM, replicateM, void)
14−import Control.Monad.Supply.Class
15−
16−import Data.List ((\\), delete, intersect, nub)
17−import qualified Data.Foldable as F
18−import qualified Data.Map as M
19−import Data.Maybe (fromMaybe, isNothing, mapMaybe)
20−import Data.Monoid ((<>))
21−import Data.String (fromString)
22−import Data.Text (Text)
23−import qualified Data.Text as T
24−
25−import Language.PureScript.AST.SourcePos
26−import Language.PureScript.CoreImp.AST (AST)
27−import qualified Language.PureScript.CoreImp.AST as AST
28−import Language.PureScript.CoreFn
29−import Language.PureScript.Crash
30−import Language.PureScript.Names
31−import Language.PureScript.Options
32−import Language.PureScript.PSString (PSString, mkString)
33−import Language.PureScript.Traversals (sndM)
34−import qualified Language.PureScript.Constants as C
35−
36−import System.FilePath.Posix ((</>))
37−
38−import CodeGen.IL.Common as Common
39−import CodeGen.IL.Optimizer
40−import CodeGen.IL.Printer
41−
42−data DeclType = ModuleDecl | LetDecl | RecLetDecl deriving (Eq)
43−
44−-- | Generate code in the simplified intermediate representation for all declarations in a
45−-- module.
46−moduleToIL
47− :: forall m
48− -- . (Monad m, MonadReader Options m, MonadSupply m, MonadError MultipleErrors m)
49− . (Monad m, MonadSupply m)
50− => Module Ann
51− -> Text
52− -> m (Text, [Text], [AST], Text, Text)
53−moduleToIL (Module _ coms mn _ imps _ foreigns decls) project =
54− do
55− ilDecls <- mapM (bindToIL ModuleDecl) decls
56− optimized <- traverse (traverse (optimize modName')) ilDecls
57− let optimized' = concat optimized
58− values = annotValue <$> optimized'
59− foreigns' = moduleIdentToIL <$> foreigns
60− interface = interfaceSource modName values foreigns
61− imports = nub . concat $ importToIL <$> optimized'
62− implHeader = implHeaderSource modName imports project
63− implFooter = implFooterSource (runModuleName mn) foreigns
64− return $ (interface, foreigns', optimized', implHeader, implFooter)
65− where
66− modName = moduleNameToIL mn
67− modName' = AST.Var Nothing modName
68−
69− annotValue :: AST -> (Text, Bool)
70− annotValue (AST.Function _ (Just name) [] (AST.Block _ [AST.Return _ ret]))
71− | isLiteral ret = (name, True)
72− annotValue (AST.Function _ (Just name) [] _) = (name, False)
73− annotValue _ = error "Unexpected top-level value form"
74−
75− -- | Extracts all declaration names from a binding group.
76− getNames :: Bind Ann -> [Ident]
77− getNames (NonRec _ ident _) = [ident]
78− getNames (Rec vals) = map (snd . fst) vals
79−
80− -- | Generates IL code for a module import
81− --
82− importToIL :: AST -> [Text]
83− importToIL = AST.everything (++) modRef
84− where
85− modRef (AST.Indexer _ (AST.Var _ _) (AST.Var _ mname))
86− | not $ T.null mname = [extract mname]
87− modRef _ = []
88− extract :: Text -> Text
89− extract = T.replace "_" "." . T.dropWhileEnd (=='_')
90−
91− -- |
92− -- Generate code in the simplified intermediate representation for a declaration
93− --
94− bindToIL :: DeclType -> Bind Ann -> m [AST]
95− bindToIL dt (NonRec ann ident val) = return <$> nonRecToIL dt ann ident val
96− bindToIL dt (Rec vals) = forM vals (uncurry . uncurry $ nonRecToIL dt')
97− where
98− dt' = if dt == LetDecl then RecLetDecl else dt
99−
100− -- | Generate code in the simplified intermediate representation for a single non-recursive
101− -- declaration.
102− --
103− -- The main purpose of this function is to handle code generation for comments.
104− nonRecToIL :: DeclType -> Ann -> Ident -> Expr Ann -> m AST
105− nonRecToIL dt a i e@(extractAnn -> (_, com, _, _)) | not (null com) = do
106− -- withoutComment <- asks optionsNoComments
107− let withoutComment = False
108− if withoutComment
109− then nonRecToIL dt a i (modifyAnn removeComments e)
110− else AST.Comment Nothing com <$> nonRecToIL dt a i (modifyAnn removeComments e)
111− nonRecToIL ModuleDecl (ss, _, _, _) ident val = do
112− il <- valueToIL val
113− pure $ AST.Function Nothing (Just $ moduleIdentToIL ident) [] (AST.Block Nothing [AST.Return Nothing il])
114− nonRecToIL RecLetDecl (ss, _, _, _) ident val = do
115− ilExpr <- valueToIL val
116− pure $ AST.Assignment Nothing (AST.Var Nothing $ identToIL ident) ilExpr
117− nonRecToIL _ (ss, _, _, _) ident val = do
118− il <- valueToIL val
119− pure $ AST.VariableIntroduction Nothing (identToIL ident) (Just il)
120−
121− -- | Generate code in the simplified intermediate representation for a variable based on a
122− -- PureScript identifier.
123− var :: Ident -> AST
124− var = AST.Var Nothing . identToIL
125−
126− accessorString :: PSString -> AST -> AST
127− accessorString prop = AST.Indexer Nothing (AST.StringLiteral Nothing prop)
128−
129− -- | Generate code in the simplified intermediate representation for a value or expression.
130−
131− valueToIL :: Expr Ann -> m AST
132− valueToIL (Literal (pos, _, _, _) l) = literalToValueIL pos l
133− valueToIL (Accessor _ prop val) =
134− accessorString prop <$> valueToIL val
135− valueToIL (ObjectUpdate _ o ps) = do
136− obj <- valueToIL o
137− updates <- mapM (sndM valueToIL) ps
138− obj' <- freshName'
139− let objVar = AST.Var Nothing obj'
140− copy = AST.VariableIntroduction Nothing obj' (Just $ copyDict obj)
141− assign (k, v) = AST.Assignment Nothing (accessorString k objVar) v
142− sts = copy : (assign <$> updates) ++ [AST.Return Nothing objVar]
143− return $ AST.App Nothing (AST.Function Nothing Nothing [] (AST.Block Nothing sts)) []
144− valueToIL (Abs _ arg val) = do
145− ret <- valueToIL val
146− let ilArg = case arg of
147− UnusedIdent -> []
148− _ -> [identToIL arg]
149− return $ AST.Function Nothing Nothing ilArg (AST.Block Nothing [AST.Return Nothing ret])
150− valueToIL e@App{} = do
151− let (f, args) = unApp e []
152− args' <- mapM valueToIL args
153− fn <- valueToIL f
154− case f of
155− Var (_, _, _, Just IsNewtype) _ -> return (head args')
156− _ -> flip (foldl (\fn a -> AST.App Nothing fn [a])) args' <$> valueToIL f
157− where
158− unApp :: Expr Ann -> [Expr Ann] -> (Expr Ann, [Expr Ann])
159− unApp (App _ val arg) args = unApp val (arg : args)
160− unApp other args = (other, args)
161− valueToIL (Var _ ident) = return $ varToIL ident
162− valueToIL (Case (ss, _, _, _) values binders) = do
163− vals <- mapM valueToIL values
164− bindersToIL ss binders vals
165− valueToIL (Let _ ds val) = do
166− let recurs = concatMap getNames $ filter isRec ds
167− recurDs = (\v -> AST.VariableIntroduction Nothing (identToIL v) Nothing) <$> recurs
168− ds' <- concat <$> mapM (bindToIL LetDecl) ds
169− ret <- valueToIL val
170− return $ AST.App Nothing (AST.Function Nothing Nothing [] (AST.Block Nothing (recurDs ++ ds' ++ [AST.Return Nothing ret]))) []
171− where
172− isRec :: Bind Ann -> Bool
173− isRec (Rec _) = True
174− isRec _ = False
175− valueToIL (Constructor (_, _, _, Just IsNewtype) _ (ProperName ctor) _) = error "IsNewtype"
176− valueToIL (Constructor _ _ (ProperName ctor) fields) =
177− let body = AST.ObjectLiteral Nothing $ (mkString ctor, AST.BooleanLiteral Nothing True) :
178− ((\field -> (mkString (identToIL field), var field)) `map` fields)
179− fn = foldr (\f inner -> AST.Function Nothing Nothing [identToIL f] (AST.Block Nothing [AST.Return Nothing inner])) body fields
180− in return fn
181−
182−
183− iife :: Text -> [AST] -> AST
184− iife v exprs = AST.App Nothing (AST.Function Nothing Nothing [] (AST.Block Nothing $ exprs ++ [AST.Return Nothing $ AST.Var Nothing v])) []
185−
186− literalToValueIL :: SourceSpan -> Literal (Expr Ann) -> m AST
187− literalToValueIL ss (NumericLiteral (Left i)) = return $ AST.NumericLiteral (Just ss) (Left i)
188− literalToValueIL ss (NumericLiteral (Right n)) = return $ AST.NumericLiteral (Just ss) (Right n)
189− literalToValueIL ss (StringLiteral s) = return $ AST.StringLiteral (Just ss) s
190− literalToValueIL ss (CharLiteral c) = return $ AST.StringLiteral (Just ss) (fromString [c])
191− literalToValueIL ss (BooleanLiteral b) = return $ AST.BooleanLiteral (Just ss) b
192− literalToValueIL ss (ArrayLiteral xs) = AST.ArrayLiteral (Just ss) <$> mapM valueToIL xs
193− literalToValueIL ss (ObjectLiteral ps) = AST.ObjectLiteral (Just ss) <$> mapM (sndM valueToIL) ps
194−
195− -- | Generate code in the simplified intermediate representation for a reference to a
196− -- variable.
197− varToIL :: Qualified Ident -> AST
198− varToIL (Qualified Nothing ident) = var ident
199− varToIL qual = qualifiedToIL id qual
200−
201− -- | Generate code in the simplified intermediate representation for a reference to a
202− -- variable that may have a qualified name.
203− qualifiedToIL :: (a -> Ident) -> Qualified a -> AST
204− qualifiedToIL f (Qualified (Just (ModuleName mn')) a) | mn' == C.prim = AST.Var Nothing . moduleIdentToIL $ f a
205− qualifiedToIL f (Qualified (Just mn') a) | mn /= mn' = AST.Indexer Nothing (AST.Var Nothing . moduleIdentToIL $ f a) (AST.Var Nothing (moduleNameToIL mn'))
206− qualifiedToIL f (Qualified _ a) = AST.Indexer Nothing (AST.Var Nothing . moduleIdentToIL $ f a) (AST.Var Nothing "")
207−
208− -- foreignIdent :: Ident -> AST
209− -- foreignIdent ident = accessorString (mkString $ runIdent ident) (AST.Var Nothing "$foreign")
210−
211− -- | Generate code in the simplified intermediate representation for pattern match binders
212− -- and guards.
213− bindersToIL :: SourceSpan -> [CaseAlternative Ann] -> [AST] -> m AST
214− bindersToIL ss binders vals = do
215− valNames <- replicateM (length vals) freshName'
216− let assignments = zipWith (AST.VariableIntroduction Nothing) valNames (map Just vals)
217− ils <- forM binders $ \(CaseAlternative bs result) -> do
218− ret <- guardsToIL result
219− go valNames ret bs
220− return $ AST.App Nothing (AST.Function Nothing Nothing [] (AST.Block Nothing (assignments ++ concat ils ++ [AST.Throw Nothing (AST.StringLiteral Nothing $ mkString failedPatternMessage)])))
221− []
222− where
223− go :: [Text] -> [AST] -> [Binder Ann] -> m [AST]
224− go _ done [] = return done
225− go (v:vs) done' (b:bs) = do
226− done'' <- go vs done' bs
227− binderToIL v done'' b
228− go _ _ _ = internalError "Invalid arguments to bindersToIL"
229−
230− failedPatternMessage :: Text
231− failedPatternMessage = "Failed pattern match at " <> runModuleName mn <> " " <> displayStartEndPos ss
232−
233− guardsToIL :: Either [(Guard Ann, Expr Ann)] (Expr Ann) -> m [AST]
234− guardsToIL (Left gs) = traverse genGuard gs where
235− genGuard (cond, val) = do
236− cond' <- valueToIL cond
237− val' <- valueToIL val
238− return
239− (AST.IfElse Nothing (AST.Binary Nothing AST.EqualTo cond' (AST.BooleanLiteral Nothing True))
240− (AST.Block Nothing [AST.Return Nothing val']) Nothing)
241−
242− guardsToIL (Right v) = return . AST.Return Nothing <$> valueToIL v
243−
244− -- | Generate code in the simplified intermediate representation for a pattern match
245− -- binder.
246− binderToIL :: Text -> [AST] -> Binder Ann -> m [AST]
247− binderToIL _ done NullBinder{} = return done
248− binderToIL varName done (LiteralBinder _ l) =
249− literalToBinderIL varName done l
250− binderToIL varName done (VarBinder _ ident) =
251− return (AST.VariableIntroduction Nothing (identToIL ident) (Just (AST.Var Nothing varName)) : done)
252− binderToIL varName done (ConstructorBinder (_, _, _, Just IsNewtype) _ _ [b]) =
253− binderToIL varName done b
254− binderToIL varName done (ConstructorBinder (_, _, _, Just (IsConstructor ctorType fields)) _ (Qualified _ (ProperName ctor)) bs) = do
255− il <- go (zip fields bs) done
256− return $ case ctorType of
257− ProductType -> il
258− SumType ->
259− [AST.IfElse Nothing (AST.InstanceOf Nothing (AST.Var Nothing varName) (AST.StringLiteral Nothing (mkString ctor)))
260− (AST.Block Nothing il)
261− Nothing]
262− where
263− go :: [(Ident, Binder Ann)] -> [AST] -> m [AST]
264− go [] done' = return done'
265− go ((field, binder) : remain) done' = do
266− argVar <- freshName'
267− done'' <- go remain done'
268− il <- binderToIL argVar done'' binder
269− return (AST.VariableIntroduction Nothing argVar (Just $ accessorString (mkString $ identToIL field) $ AST.Var Nothing varName) : il)
270−
271− binderToIL _ _ ConstructorBinder{} =
272− internalError "binderToIL: Invalid ConstructorBinder in binderToIL"
273− binderToIL varName done (NamedBinder _ ident binder) = do
274− il <- binderToIL varName done binder
275− return (AST.VariableIntroduction Nothing (identToIL ident) (Just (AST.Var Nothing varName)) : il)
276−
277− literalToBinderIL :: Text -> [AST] -> Literal (Binder Ann) -> m [AST]
278− literalToBinderIL varName done (NumericLiteral num) =
279− return [AST.IfElse Nothing (AST.Binary Nothing AST.EqualTo (AST.Var Nothing varName) (AST.NumericLiteral Nothing num)) (AST.Block Nothing done) Nothing]
280− literalToBinderIL varName done (CharLiteral c) =
281− return [AST.IfElse Nothing (AST.Binary Nothing AST.EqualTo (AST.Var Nothing varName) (AST.StringLiteral Nothing (fromString [c]))) (AST.Block Nothing done) Nothing]
282− literalToBinderIL varName done (StringLiteral str) =
283− return [AST.IfElse Nothing (AST.Binary Nothing AST.EqualTo (AST.Var Nothing varName) (AST.StringLiteral Nothing str)) (AST.Block Nothing done) Nothing]
284− literalToBinderIL varName done (BooleanLiteral True) =
285− return [AST.IfElse Nothing (AST.Binary Nothing AST.EqualTo (AST.Var Nothing varName) (AST.BooleanLiteral Nothing True)) (AST.Block Nothing done) Nothing]
286− literalToBinderIL varName done (BooleanLiteral False) =
287− return [AST.IfElse Nothing (AST.Binary Nothing AST.EqualTo (AST.Var Nothing varName) (AST.BooleanLiteral Nothing False)) (AST.Block Nothing done) Nothing]
288− -- return [AST.IfElse Nothing (AST.Unary Nothing AST.Not (AST.Var Nothing varName)) (AST.Block Nothing done) Nothing]
289− literalToBinderIL varName done (ObjectLiteral bs) = go done bs
290− where
291− go :: [AST] -> [(PSString, Binder Ann)] -> m [AST]
292− go done' [] = return done'
293− go done' ((prop, binder):bs') = do
294− propVar <- freshName'
295− done'' <- go done' bs'
296− il <- binderToIL propVar done'' binder
297− return (AST.VariableIntroduction Nothing propVar (Just (accessorString prop (AST.Var Nothing varName))) : il)
298− literalToBinderIL varName done (ArrayLiteral bs) = do
299− il <- go done 0 bs
300− return [AST.IfElse Nothing (AST.Binary Nothing AST.EqualTo
301− (arrayLength $ AST.Var Nothing varName)
302− (AST.NumericLiteral Nothing (Left (fromIntegral $ length bs))))
303− (AST.Block Nothing il) Nothing]
304− where
305− go :: [AST] -> Integer -> [Binder Ann] -> m [AST]
306− go done' _ [] = return done'
307− go done' index (binder:bs') = do
308− elVar <- freshName'
309− done'' <- go done' (index + 1) bs'
310− il <- binderToIL elVar done'' binder
311− return (AST.VariableIntroduction Nothing elVar (Just (AST.Indexer Nothing (AST.NumericLiteral Nothing (Left index)) (AST.Var Nothing varName))) : il)
312−
313−emptyAnn :: Ann
314−emptyAnn = (SourceSpan "" (SourcePos 0 0) (SourcePos 0 0), [], Nothing, Nothing)
315−
316−arrayLength :: AST -> AST
317−arrayLength a = AST.App Nothing (AST.Var Nothing arrayLengthFn) [a]
318−-- arrayLength a = AST.Var Nothing (arrayLengthFn <> "(" <> prettyPrintIL1 a <> ")")
319−
320−copyDict :: AST -> AST
321−copyDict a = AST.App Nothing (AST.Var Nothing copyDictFn) [a]
src/CodeGen/IL/Common.hsdeleted−196
@@ -1,196 +0,0 @@
1−-- | Common code generation utility functions
2−module CodeGen.IL.Common where
3−
4−import Prelude.Compat
5−
6−import Control.Monad.Supply.Class (MonadSupply, freshName)
7−import Data.Char
8−import Data.Maybe (maybe)
9−import Data.Monoid ((<>))
10−import Data.Text (Text)
11−import qualified Data.Text as T
12−
13−import Language.PureScript.Crash
14−import Language.PureScript.Names
15−
16−import qualified Language.PureScript.Constants as C
17−
18−moduleNameToIL :: ModuleName -> Text
19−moduleNameToIL (ModuleName mn) =
20− let name = T.replace "." "_" mn
21− in if nameIsILBuiltIn name then (name <> moduleRenamerMarker) else name
22−
23−moduleNameToIL' :: ModuleName -> Text
24−moduleNameToIL' (ModuleName mn) = T.replace "_" "." mn
25−
26−-- | Convert an 'Ident' into a valid IL identifier:
27−--
28−-- * Alphanumeric characters are kept unmodified.
29−--
30−-- * Reserved IL identifiers are wrapped with '_'.
31−--
32−identToIL :: Ident -> Text
33−identToIL UnusedIdent = unusedName
34−identToIL (Ident "$__unused") = unusedName
35−identToIL (Ident name) | name == C.undefined = undefinedName -- Note: done in Printer.hs too
36−identToIL (Ident name) = properToIL name
37−identToIL (GenIdent _ _) = internalError "GenIdent in identToIL"
38−
39−moduleIdentToIL :: Ident -> Text
40−moduleIdentToIL UnusedIdent = unusedName
41−moduleIdentToIL (Ident name) | name == C.undefined = undefinedName
42−moduleIdentToIL (Ident name) = moduleProperToIL name
43−moduleIdentToIL (GenIdent _ _) = internalError "GenIdent in identToIL"
44−
45−undefinedName :: Text
46−undefinedName = "Undefined"
47−
48−unusedName :: Text
49−unusedName = "_"
50−
51−properToIL :: Text -> Text
52−properToIL name
53− | nameIsILReserved name = "ˉ" <> name
54− | otherwise = T.concatMap identCharToText name
55−
56−-- | Attempts to find a human-readable name for a symbol, if none has been specified returns the
57−-- ordinal value.
58−identCharToText :: Char -> Text
59−identCharToText 'ṩ' = "_ṩ"
60−identCharToText c | isAlphaNum c = T.singleton c
61−identCharToText '_' = "_"
62−identCharToText '\'' = "ꞌ" -- lowercase saltillo
63−identCharToText c = error (show (ord c)) -- TODO: should never occur now(?)
64−
65−moduleProperToIL :: Text -> Text
66−moduleProperToIL = T.concatMap identCharToText
67−
68−-- | Checks whether an identifier name is reserved in IL.
69−nameIsILReserved :: Text -> Bool
70−nameIsILReserved name =
71− name `elem` ilAnyReserved
72−
73−-- | Checks whether a name matches a built-in value in IL.
74−nameIsILBuiltIn :: Text -> Bool
75−nameIsILBuiltIn name =
76− name `elem`
77− [ "Any"
78− , "Apply"
79− , "Contains"
80− , "CopyDict"
81− , "Dict"
82− , "EffFn"
83− , "Fn"
84− , "Foreign"
85− , "Get"
86− , "Index"
87− , "Is"
88− , "Length"
89− , "Once"
90− , "Run"
91− , "Undefined"
92− ]
93−
94−ilAnyReserved :: [Text]
95−ilAnyReserved =
96− concat
97− [ ilKeywords
98− , ilLiterals
99− ]
100−
101−ilKeywords :: [Text]
102−ilKeywords =
103− [ "break"
104− , "case"
105− , "chan"
106− , "const"
107− , "continue"
108− , "default"
109− , "defer"
110− , "else"
111− , "fallthrough"
112− , "for"
113− , "func"
114− , "go"
115− , "goto"
116− , "if"
117− , "import"
118− , "interface"
119− , "map"
120− , "package"
121− , "range"
122− , "return"
123− , "select"
124− , "struct"
125− , "switch"
126− , "type"
127− , "var"
128− ]
129−
130−ilLiterals :: [Text]
131−ilLiterals =
132− [ "init"
133− , "nil"
134− , "int"
135− , "int8"
136− , "int16"
137− , "int32"
138− , "int64"
139− , "uint"
140− , "uint8"
141− , "uint16"
142− , "uint32"
143− , "uint64"
144− , "uintptr"
145− , "float32"
146− , "float64"
147− , "complex64"
148− , "complex128"
149− , "byte"
150− , "rune"
151− , "string"
152− ]
153−
154−withPrefix :: Text -> Text
155−withPrefix s = "Ꞌ" <> s -- uppercase saltillo
156−
157−anyType :: Text
158−anyType = "Any"
159−
160−dictType :: Text
161−dictType = "Dict"
162−
163−arrayType :: Text
164−arrayType = "[]" <> anyType
165−
166−uncurriedFnType :: Int -> Text
167−uncurriedFnType i = "Fn" <> (T.pack . show $ i)
168−
169−int :: Text
170−int = "int"
171−
172−float :: Text
173−float = "float64"
174−
175−bool :: Text
176−bool = "bool"
177−
178−string :: Text
179−string = "string"
180−
181−arrayLengthFn :: Text
182−arrayLengthFn = "Length"
183−
184−indexFn :: Text
185−indexFn = "Index"
186−
187−copyDictFn :: Text
188−copyDictFn = "CopyDict"
189−
190−freshName' :: MonadSupply m => m Text
191−freshName' = do
192− name <- freshName
193− return $ T.replace "$" "ṩ" name
194−
195−moduleRenamerMarker :: Text
196−moduleRenamerMarker = "__"
src/CodeGen/IL/Optimizer.hsdeleted−81
@@ -1,81 +0,0 @@
1−-- | This module optimizes code in the intermediate representation.
2−module CodeGen.IL.Optimizer (optimize) where
3−
4−import Prelude.Compat
5−
6−import Control.Monad.Supply.Class (MonadSupply)
7−import Data.Text (Text)
8−import Language.PureScript.CoreImp.AST
9−import Language.PureScript.CoreImp.Optimizer.Blocks
10−import Language.PureScript.CoreImp.Optimizer.Common hiding (isDict)
11−import Language.PureScript.CoreImp.Optimizer.Inliner (etaConvert, evaluateIifes, inlineVariables, unThunk)
12−import Language.PureScript.CoreImp.Optimizer.Unused
13−
14−import CodeGen.IL.Common (unusedName)
15−import CodeGen.IL.Optimizer.Inliner
16−import CodeGen.IL.Optimizer.MagicDo
17−import CodeGen.IL.Optimizer.TCO
18−
19−import qualified Language.PureScript.Constants as C
20−
21−-- | Apply a series of optimizer passes to simplified IL code
22−optimize :: MonadSupply m => AST -> AST -> m AST
23−optimize mn il = do
24− il' <- untilFixedPoint (inlineFnComposition . inlineUnsafeCoerce . inlineUnsafePartial . tidyUp) il
25− il'' <- untilFixedPoint (return . ignoreUnusedResults . inlineCommonValues . inlineCommonOperators . tidyUp) . tco mn . inlineST
26− =<< untilFixedPoint (return . magicDoST)
27− =<< untilFixedPoint (return . magicDoEff)
28− =<< untilFixedPoint (return . magicDoEffect) il'
29− untilFixedPoint (return . collapseVarDeclarations) il''
30− where
31− tidyUp :: AST -> AST
32− tidyUp = applyAll
33− [ collapseNestedBlocks
34− , collapseNestedIfs
35− , collapseIfChecks
36− , removeCodeAfterReturnStatements
37− , unThunk
38− , etaConvert
39− , evaluateIifes
40− , inlineVariables
41− ]
42−
43−untilFixedPoint :: (Monad m, Eq a) => (a -> m a) -> a -> m a
44−untilFixedPoint f = go
45− where
46− go a = do
47− a' <- f a
48− if a' == a then return a' else go a'
49−
50−collapseIfChecks :: AST -> AST
51−collapseIfChecks = everywhere collapse where
52− collapse :: AST -> AST
53− collapse (IfElse _ (Binary _ EqualTo (BooleanLiteral _ True) (BooleanLiteral _ True)) (Block _ [exprs]) _) = exprs
54− collapse (IfElse _ (Binary _ EqualTo (Indexer _ (Var _ prop) (Var _ val)) (BooleanLiteral _ True)) (Block _ [exprs]) _)
55− | prop == "otherwise" && val == "Data_Boolean" = exprs
56− collapse exprs = exprs
57−
58−collapseVarDeclarations :: AST -> AST
59−collapseVarDeclarations = everywhere collapse where
60− collapse :: AST -> AST
61− collapse (Block ss sts) = Block ss (go Nothing sts)
62− collapse s = s
63−
64− go :: Maybe Text -> [AST] -> [AST]
65− go _ [] = []
66− go Nothing (decl@(VariableIntroduction _ var (Just _)) : sts) = decl : go (Just var) (go Nothing sts)
67− go (Just var') ((VariableIntroduction ss var (Just val)) : sts)
68− | var == var' = (Assignment ss (Var Nothing var) val) : go (Just var') sts
69− go var' (s:sts) = s : go var' sts
70−
71−ignoreUnusedResults :: AST -> AST
72−ignoreUnusedResults = everywhere $ removeFromBlock go
73− where
74− go :: [AST] -> [AST]
75− go [] = []
76− go (VariableIntroduction ss var (Just s) : sts)
77− | not $ any (everything (||) (isUsed var)) sts = sts'
78− where
79− sts' | App{} <- s = s : (go sts)
80− | otherwise = go sts
81− go (s:sts) = s : go sts
src/CodeGen/IL/Optimizer/Common.hsdeleted−18
@@ -1,18 +0,0 @@
1−-- | Common functions used by the various optimizer phases
2−module CodeGen.IL.Optimizer.Common where
3−
4−import Prelude.Compat
5−
6−import Data.Text (Text)
7−
8−import Language.PureScript.CoreImp.AST
9−import Language.PureScript.PSString (PSString, decodeString)
10−
11−isDict :: (Text, PSString) -> AST -> Bool
12−isDict (moduleName, dictName) (Indexer _ (Var _ x) (Var _ y)) =
13− Just x == decodeString dictName && y == moduleName
14−isDict _ _ = False
15−
16−isDict' :: [(Text, PSString)] -> AST -> Bool
17−isDict' xs il = any (`isDict` il) xs
18−
src/CodeGen/IL/Optimizer/Inliner.hsdeleted−435
@@ -1,435 +0,0 @@
1−-- | This module performs basic inlining of known functions
2−module CodeGen.IL.Optimizer.Inliner
3− ( inlineCommonValues
4− , inlineCommonOperators
5− , inlineFnComposition
6− , inlineUnsafeCoerce
7− , inlineUnsafePartial
8− ) where
9−
10−import Prelude.Compat
11−
12−import Control.Monad.Supply.Class (MonadSupply)
13−
14−import Data.Either (rights)
15−import Data.Maybe (fromMaybe)
16−import Data.String (IsString, fromString)
17−import Data.Text (Text)
18−import qualified Data.Text as T
19−
20−import Language.PureScript.PSString (PSString, decodeString, mkString)
21−import Language.PureScript.CoreImp.AST
22−import Language.PureScript.CoreImp.Optimizer.Common hiding (isDict, isDict')
23−import Language.PureScript.AST (SourceSpan(..))
24−import qualified Language.PureScript.Constants as C
25−
26−import CodeGen.IL.Common
27−import CodeGen.IL.Optimizer.Common
28−
29−-- TODO: Potential bug:
30−-- Shouldn't just inline this case: { var x = 0; x.toFixed(10); }
31−-- Needs to be: { 0..toFixed(10); }
32−-- Probably needs to be fixed in pretty-printer instead.
33−shouldInline :: AST -> Bool
34−shouldInline (Var _ _) = True
35−shouldInline (NumericLiteral _ _) = True
36−shouldInline (StringLiteral _ _) = True
37−shouldInline (BooleanLiteral _ _) = True
38−shouldInline (Indexer _ index val) = shouldInline index && shouldInline val
39−shouldInline _ = False
40−
41−inlineCommonValues :: AST -> AST
42−inlineCommonValues = everywhere convert
43− where
44− convert :: AST -> AST
45− convert (App ss fn [dict])
46− | isDict' [semiringNumber, semiringInt] dict && isDict fnZero fn = NumericLiteral ss (Left 0)
47− | isDict' [semiringNumber, semiringInt] dict && isDict fnOne fn = NumericLiteral ss (Left 1)
48− | isDict boundedBoolean dict && isDict fnBottom fn = BooleanLiteral ss False
49− | isDict boundedBoolean dict && isDict fnTop fn = BooleanLiteral ss True
50− convert (App ss (App _ fn [dict]) [x])
51− | isDict ringInt dict && isDict fnNegate fn = Unary ss Negate (unbox x $ snd ringInt)
52− convert (App ss (App _ (App _ fn [dict]) [x]) [y])
53− | isDict semiringInt dict && isDict fnAdd fn = intOp ss Add semiringInt x y
54− | isDict semiringInt dict && isDict fnMultiply fn = intOp ss Multiply semiringInt x y
55− | isDict ringInt dict && isDict fnSubtract fn = intOp ss Subtract ringInt x y
56− convert other = other
57− fnZero = (C.dataSemiring, C.zero)
58− fnOne = (C.dataSemiring, C.one)
59− fnBottom = (C.dataBounded, C.bottom)
60− fnTop = (C.dataBounded, C.top)
61− fnAdd = (C.dataSemiring, C.add)
62− fnMultiply = (C.dataSemiring, C.mul)
63− fnSubtract = (C.dataRing, C.sub)
64− fnNegate = (C.dataRing, C.negate)
65− intOp ss op (_, d) x y = Binary ss op (unbox x d) (unbox y d)
66−
67−inlineCommonOperators :: AST -> AST
68−inlineCommonOperators = everywhereTopDown $ applyAll $
69− [ binary semiringNumber opAdd Add
70− , binary semiringNumber opMul Multiply
71−
72− , binary ringNumber opSub Subtract
73− , unary ringNumber opNegate Negate
74−
75− , binary euclideanRingNumber opDiv Divide
76−
77− -- , binary eqNumber opEq EqualTo
78− -- , binary eqNumber opNotEq NotEqualTo
79− , binary eqInt opEq EqualTo
80− , binary eqInt opNotEq NotEqualTo
81− , binary eqString opEq EqualTo
82− , binary eqString opNotEq NotEqualTo
83− , binary eqChar opEq EqualTo
84− , binary eqChar opNotEq NotEqualTo
85− , binary eqBoolean opEq EqualTo
86− , binary eqBoolean opNotEq NotEqualTo
87−
88− , binary ordBoolean opLessThan LessThan
89− , binary ordBoolean opLessThanOrEq LessThanOrEqualTo
90− , binary ordBoolean opGreaterThan GreaterThan
91− , binary ordBoolean opGreaterThanOrEq GreaterThanOrEqualTo
92− , binary ordChar opLessThan LessThan
93− , binary ordChar opLessThanOrEq LessThanOrEqualTo
94− , binary ordChar opGreaterThan GreaterThan
95− , binary ordChar opGreaterThanOrEq GreaterThanOrEqualTo
96− , binary ordInt opLessThan LessThan
97− , binary ordInt opLessThanOrEq LessThanOrEqualTo
98− , binary ordInt opGreaterThan GreaterThan
99− , binary ordInt opGreaterThanOrEq GreaterThanOrEqualTo
100− , binary ordNumber opLessThan LessThan
101− , binary ordNumber opLessThanOrEq LessThanOrEqualTo
102− , binary ordNumber opGreaterThan GreaterThan
103− , binary ordNumber opGreaterThanOrEq GreaterThanOrEqualTo
104− , binary ordString opLessThan LessThan
105− , binary ordString opLessThanOrEq LessThanOrEqualTo
106− , binary ordString opGreaterThan GreaterThan
107− , binary ordString opGreaterThanOrEq GreaterThanOrEqualTo
108−
109− , binary semigroupString opAppend Add
110−
111− , binary heytingAlgebraBoolean opConj And
112− , binary heytingAlgebraBoolean opDisj Or
113− , unary heytingAlgebraBoolean opNot Not
114−
115− , binary' C.dataIntBits C.or BitwiseOr
116− , binary' C.dataIntBits C.and BitwiseAnd
117− , binary' C.dataIntBits C.xor BitwiseXor
118− , binary' C.dataIntBits C.shl ShiftLeft
119− , binary' C.dataIntBits C.shr ShiftRight
120− , unary' C.dataIntBits C.complement BitwiseNot
121−
122− , inlineNonClassFunction (isModFn (C.dataFunction, C.apply)) $ \f x -> App Nothing f [x]
123− , inlineNonClassFunction (isModFn (C.dataFunction, C.applyFlipped)) $ \x f -> App Nothing f [x]
124− , inlineUnsafeIndex (isModFnWithDict (C.dataArray, C.unsafeIndex)) $ flip (Indexer Nothing)
125− ] ++
126− [ fn | i <- [0..10], fn <- [ mkFn i, runFn i ] ] ++
127− [ fn | i <- [0..10], fn <- [ mkEffFn C.controlMonadEffUncurried C.mkEffFn i, runEffFn C.controlMonadEffUncurried C.runEffFn i ] ] ++
128− [ fn | i <- [0..10], fn <- [ mkEffFn C.effectUncurried C.mkEffectFn i, runEffFn C.effectUncurried C.runEffectFn i ] ]
129− where
130− binary :: (Text, PSString) -> (Text, PSString) -> BinaryOperator -> AST -> AST
131− binary dict@(_, d) fns op = convert where
132− convert :: AST -> AST
133− convert (App ss (App _ (App _ fn [dict']) [x]) [y])
134− | isDict dict dict' && isDict fns fn = Binary ss op (unbox x d) (unbox y d)
135− convert other = other
136− binary' :: Text -> PSString -> BinaryOperator -> AST -> AST
137− binary' moduleName opString op = convert where
138− convert :: AST -> AST
139− convert (App ss (App _ fn [x]) [y]) | isDict (moduleName, opString) fn = Binary ss op (unbox x mn) (unbox y mn)
140− convert other = other
141− mn :: PSString
142− mn = mkString moduleName
143− unary :: (Text, PSString) -> (Text, PSString) -> UnaryOperator -> AST -> AST
144− unary dicts@(_, d) fns op = convert where
145− convert :: AST -> AST
146− convert (App ss (App _ fn [dict']) [x]) | isDict dicts dict' && isDict fns fn = Unary ss op (unbox x d)
147− convert other = other
148− unary' :: Text -> PSString -> UnaryOperator -> AST -> AST
149− unary' moduleName fnName op = convert where
150− convert :: AST -> AST
151− convert (App ss fn [x]) | isDict (moduleName, fnName) fn = Unary ss op (unbox x fnName)
152− convert other = other
153−
154− mkFn :: Int -> AST -> AST
155− mkFn = mkFn' C.dataFunctionUncurried C.mkFn $ \ss1 ss2 ss3 args il ->
156− Function ss1 Nothing args (Block ss2 [Return ss3 il])
157−
158− mkEffFn :: Text -> Text -> Int -> AST -> AST
159− mkEffFn modName fnName = mkFn' modName fnName $ \ss1 ss2 ss3 args il ->
160− Function ss1 Nothing args (Block ss2 [Return ss3 (App ss3 il [])])
161−
162− mkFn' :: Text -> Text -> (Maybe SourceSpan -> Maybe SourceSpan -> Maybe SourceSpan -> [Text] -> AST -> AST) -> Int -> AST -> AST
163− mkFn' modName fnName res 0 = convert where
164− convert :: AST -> AST
165− convert (App _ mkFnN [Function s1 Nothing [_] (Block s2 [Return s3 il])]) | isNFn modName fnName 0 mkFnN =
166− res s1 s2 s3 [] il
167− convert other = other
168− mkFn' modName fnName res n = convert where
169− convert :: AST -> AST
170− convert orig@(App ss mkFnN [fn]) | isNFn modName fnName n mkFnN =
171− case collectArgs n [] fn of
172− Just (args, [Return ss' ret]) -> res ss ss ss' args ret
173− _ -> orig
174− convert other = other
175− collectArgs :: Int -> [Text] -> AST -> Maybe ([Text], [AST])
176− collectArgs 1 acc (Function _ Nothing [oneArg] (Block _ il)) | length acc == n - 1 = Just (reverse (oneArg : acc), il)
177− collectArgs m acc (Function _ Nothing [oneArg] (Block _ [Return _ ret])) = collectArgs (m - 1) (oneArg : acc) ret
178− collectArgs _ _ _ = Nothing
179−
180− isNFn :: Text -> Text -> Int -> AST -> Bool
181− isNFn expectMod prefix n (Indexer _ (Var _ name) (Var _ modName)) | modName == expectMod =
182− name == fromString (T.unpack prefix <> show n)
183− isNFn _ _ _ _ = False
184−
185− runFn :: Int -> AST -> AST
186− runFn = runFn' C.dataFunctionUncurried C.runFn (\ss f args ->
187− let len = length args
188− typ = mkString $ uncurriedFnType len in
189− if len > 0
190− then App ss (App Nothing (StringLiteral Nothing typ) [f]) args
191− else App ss f args)
192− runEffFn :: Text -> Text -> Int -> AST -> AST
193− runEffFn modName fnName = runFn' modName fnName $ \ss fn acc ->
194− let typ = mkString . uncurriedFnType $ length acc in
195− Function ss Nothing [] (Block ss [Return ss (App ss (App Nothing (StringLiteral Nothing typ) [fn]) acc)])
196−
197− runFn' :: Text -> Text -> (Maybe SourceSpan -> AST -> [AST] -> AST) -> Int -> AST -> AST
198− runFn' modName runFnName res n = convert where
199− convert :: AST -> AST
200− convert il = fromMaybe il $ go n [] il
201−
202− go :: Int -> [AST] -> AST -> Maybe AST
203− go 0 acc (App ss runFnN [fn]) | isNFn modName runFnName n runFnN && length acc == n =
204− Just $ res ss fn acc
205− go m acc (App _ lhs [arg]) = go (m - 1) (arg : acc) lhs
206− go _ _ _ = Nothing
207−
208− inlineNonClassFunction :: (AST -> Bool) -> (AST -> AST -> AST) -> AST -> AST
209− inlineNonClassFunction p f = convert where
210− convert :: AST -> AST
211− convert (App _ (App _ op' [x]) [y]) | p op' = f x y
212− convert other = other
213−
214− inlineUnsafeIndex :: (AST -> Bool) -> (AST -> AST -> AST) -> AST -> AST
215− inlineUnsafeIndex p _ = convert where
216− convert :: AST -> AST
217− convert (App _ (App ss op' [x]) [y@NumericLiteral{}])
218− | p op' = Indexer ss y x
219− convert (App _ (App ss op' [x]) [y])
220− | p op' = App ss (Var Nothing indexFn) [x, y]
221− convert other = other
222−
223− isModFn :: (Text, PSString) -> AST -> Bool
224− isModFn (m, op) (Indexer _ (Var _ op') (Var _ m')) =
225− m == m' && decodeString op == Just op'
226− isModFn _ _ = False
227−
228− isModFnWithDict :: (Text, PSString) -> AST -> Bool
229− isModFnWithDict (m, op) (App _ (Indexer _ (Var _ op') (Var _ m')) [Var _ _]) =
230− m == m' && decodeString op == Just op'
231− isModFnWithDict _ _ = False
232−
233−-- (f <<< g $ x) = f (g x)
234−-- (f <<< g) = \x -> f (g x)
235−inlineFnComposition :: forall m. MonadSupply m => AST -> m AST
236−inlineFnComposition = everywhereTopDownM convert where
237− convert :: AST -> m AST
238− convert (App s1 (App s2 (App _ (App _ fn [dict']) [x]) [y]) [z])
239− | isFnCompose dict' fn = return $ App s1 x [App s2 y [z]]
240− | isFnComposeFlipped dict' fn = return $ App s2 y [App s1 x [z]]
241− convert app@(App ss (App _ (App _ fn [dict']) _) _)
242− | isFnCompose dict' fn || isFnComposeFlipped dict' fn = mkApps ss <$> goApps app <*> freshName'
243− convert other = return other
244−
245− mkApps :: Maybe SourceSpan -> [Either AST (Text, AST)] -> Text -> AST
246− mkApps ss fns a = App ss (Function ss Nothing [] (Block ss $ vars <> [Return Nothing comp])) []
247− where
248− vars = uncurry (VariableIntroduction ss) . fmap Just <$> rights fns
249− comp = Function ss Nothing [a] (Block ss [Return Nothing apps])
250− apps = foldr (\fn acc -> App ss (mkApp fn) [acc]) (Var ss a) fns
251−
252− mkApp :: Either AST (Text, AST) -> AST
253− mkApp = either id $ \(name, arg) -> Var (getSourceSpan arg) name
254−
255− goApps :: AST -> m [Either AST (Text, AST)]
256− goApps (App _ (App _ (App _ fn [dict']) [x]) [y])
257− | isFnCompose dict' fn = mappend <$> goApps x <*> goApps y
258− | isFnComposeFlipped dict' fn = mappend <$> goApps y <*> goApps x
259− goApps app@(App {}) = pure . Right . (,app) <$> freshName'
260− goApps other = pure [Left other]
261−
262− isFnCompose :: AST -> AST -> Bool
263− isFnCompose dict' fn = isDict semigroupoidFn dict' && isDict fnCompose fn
264−
265− isFnComposeFlipped :: AST -> AST -> Bool
266− isFnComposeFlipped dict' fn = isDict semigroupoidFn dict' && isDict fnComposeFlipped fn
267−
268− fnCompose :: forall a b. (IsString a, IsString b) => (a, b)
269− fnCompose = (C.controlSemigroupoid, C.compose)
270−
271− fnComposeFlipped :: forall a b. (IsString a, IsString b) => (a, b)
272− fnComposeFlipped = (C.controlSemigroupoid, C.composeFlipped)
273−
274−inlineUnsafeCoerce :: AST -> AST
275−inlineUnsafeCoerce = everywhereTopDown convert where
276− convert (App _ (Indexer _ (Var _ unsafeCoerceFn) (Var _ unsafeCoerce)) [ comp ])
277− | unsafeCoerceFn == C.unsafeCoerceFn && unsafeCoerce == C.unsafeCoerce
278− = comp
279− convert other = other
280−
281−inlineUnsafePartial :: AST -> AST
282−inlineUnsafePartial = everywhereTopDown convert where
283− convert (App ss fn [ comp ])
284− | isDict fnUnsafePartial fn
285− = App ss comp []
286− where
287− fnUnsafePartial :: forall a b. (IsString a, IsString b) => (a, b)
288− fnUnsafePartial = (C.partialUnsafe, C.unsafePartial)
289− convert other = other
290−
291−semiringNumber :: forall a b. (IsString a, IsString b) => (a, b)
292−semiringNumber = (C.dataSemiring, C.semiringNumber)
293−
294−semiringInt :: forall a b. (IsString a, IsString b) => (a, b)
295−semiringInt = (C.dataSemiring, C.semiringInt)
296−
297−ringNumber :: forall a b. (IsString a, IsString b) => (a, b)
298−ringNumber = (C.dataRing, C.ringNumber)
299−
300−ringInt :: forall a b. (IsString a, IsString b) => (a, b)
301−ringInt = (C.dataRing, C.ringInt)
302−
303−euclideanRingNumber :: forall a b. (IsString a, IsString b) => (a, b)
304−euclideanRingNumber = (C.dataEuclideanRing, C.euclideanRingNumber)
305−
306−-- eqNumber :: forall a b. (IsString a, IsString b) => (a, b)
307−-- eqNumber = (C.dataEq, C.eqNumber)
308−
309−eqInt :: forall a b. (IsString a, IsString b) => (a, b)
310−eqInt = (C.dataEq, C.eqInt)
311−
312−eqString :: forall a b. (IsString a, IsString b) => (a, b)
313−eqString = (C.dataEq, C.eqString)
314−
315−eqChar :: forall a b. (IsString a, IsString b) => (a, b)
316−eqChar = (C.dataEq, C.eqChar)
317−
318−eqBoolean :: forall a b. (IsString a, IsString b) => (a, b)
319−eqBoolean = (C.dataEq, C.eqBoolean)
320−
321−ordBoolean :: forall a b. (IsString a, IsString b) => (a, b)
322−ordBoolean = (C.dataOrd, C.ordBoolean)
323−
324−ordNumber :: forall a b. (IsString a, IsString b) => (a, b)
325−ordNumber = (C.dataOrd, C.ordNumber)
326−
327−ordInt :: forall a b. (IsString a, IsString b) => (a, b)
328−ordInt = (C.dataOrd, C.ordInt)
329−
330−ordString :: forall a b. (IsString a, IsString b) => (a, b)
331−ordString = (C.dataOrd, C.ordString)
332−
333−ordChar :: forall a b. (IsString a, IsString b) => (a, b)
334−ordChar = (C.dataOrd, C.ordChar)
335−
336−semigroupString :: forall a b. (IsString a, IsString b) => (a, b)
337−semigroupString = (C.dataSemigroup, C.semigroupString)
338−
339−boundedBoolean :: forall a b. (IsString a, IsString b) => (a, b)
340−boundedBoolean = (C.dataBounded, C.boundedBoolean)
341−
342−heytingAlgebraBoolean :: forall a b. (IsString a, IsString b) => (a, b)
343−heytingAlgebraBoolean = (C.dataHeytingAlgebra, C.heytingAlgebraBoolean)
344−
345−semigroupoidFn :: forall a b. (IsString a, IsString b) => (a, b)
346−semigroupoidFn = (C.controlSemigroupoid, C.semigroupoidFn)
347−
348−opAdd :: forall a b. (IsString a, IsString b) => (a, b)
349−opAdd = (C.dataSemiring, C.add)
350−
351−opMul :: forall a b. (IsString a, IsString b) => (a, b)
352−opMul = (C.dataSemiring, C.mul)
353−
354−opEq :: forall a b. (IsString a, IsString b) => (a, b)
355−opEq = (C.dataEq, C.eq)
356−
357−opNotEq :: forall a b. (IsString a, IsString b) => (a, b)
358−opNotEq = (C.dataEq, C.notEq)
359−
360−opLessThan :: forall a b. (IsString a, IsString b) => (a, b)
361−opLessThan = (C.dataOrd, C.lessThan)
362−
363−opLessThanOrEq :: forall a b. (IsString a, IsString b) => (a, b)
364−opLessThanOrEq = (C.dataOrd, C.lessThanOrEq)
365−
366−opGreaterThan :: forall a b. (IsString a, IsString b) => (a, b)
367−opGreaterThan = (C.dataOrd, C.greaterThan)
368−
369−opGreaterThanOrEq :: forall a b. (IsString a, IsString b) => (a, b)
370−opGreaterThanOrEq = (C.dataOrd, C.greaterThanOrEq)
371−
372−opAppend :: forall a b. (IsString a, IsString b) => (a, b)
373−opAppend = (C.dataSemigroup, C.append)
374−
375−opSub :: forall a b. (IsString a, IsString b) => (a, b)
376−opSub = (C.dataRing, C.sub)
377−
378−opNegate :: forall a b. (IsString a, IsString b) => (a, b)
379−opNegate = (C.dataRing, C.negate)
380−
381−opDiv :: forall a b. (IsString a, IsString b) => (a, b)
382−opDiv = (C.dataEuclideanRing, C.div)
383−
384−opConj :: forall a b. (IsString a, IsString b) => (a, b)
385−opConj = (C.dataHeytingAlgebra, C.conj)
386−
387−opDisj :: forall a b. (IsString a, IsString b) => (a, b)
388−opDisj = (C.dataHeytingAlgebra, C.disj)
389−
390−opNot :: forall a b. (IsString a, IsString b) => (a, b)
391−opNot = (C.dataHeytingAlgebra, C.not)
392−
393−unbox :: AST -> PSString -> AST
394−unbox e d = select . inlineCommonValues $ inlineCommonOperators e
395− where
396− select :: AST -> AST
397− select e' =
398− case e' of
399− Var{} -> unbox' e'
400− App{} -> unbox' e'
401− Indexer{} -> unbox' e'
402− _ -> e'
403− unbox' :: AST -> AST
404− unbox' e' = maybe e' (\t -> App Nothing (StringLiteral Nothing t) [e']) $ unboxType d
405−
406−unboxType :: PSString -> Maybe PSString
407−unboxType s = do
408− t <- decodeString s
409− t' <- unboxType' t
410− return $ mkString t'
411− where
412− unboxType' :: Text -> Maybe Text
413− unboxType' t
414− | t == C.eqInt ||
415− t == C.semiringInt ||
416− t == C.ringInt ||
417− t == C.ordInt ||
418− t == C.dataIntBits
419− = Just int
420− | t == C.semiringNumber ||
421− t == C.ringNumber ||
422− t == C.ordNumber ||
423− t == C.euclideanRingNumber
424− = Just float
425− | t == C.eqBoolean ||
426− t == C.ordBoolean ||
427− t == C.heytingAlgebraBoolean
428− = Just bool
429− | t == C.eqChar ||
430− t == C.eqString ||
431− t == C.ordChar ||
432− t == C.ordString ||
433− t == C.semigroupString
434− = Just string
435− | otherwise = Nothing
src/CodeGen/IL/Optimizer/MagicDo.hsdeleted−146
@@ -1,146 +0,0 @@
1−-- | This module implements the "Magic Do" optimization, which inlines calls to return
2−-- and bind for the Eff monad, as well as some of its actions.
3−module CodeGen.IL.Optimizer.MagicDo (magicDoEffect, magicDoEff, magicDoST, inlineST) where
4−
5−import Prelude.Compat
6−import Protolude (ordNub)
7−
8−import Data.Maybe (fromJust, isJust)
9−import Data.Text (Text)
10−
11−import Language.PureScript.CoreImp.AST
12−import Language.PureScript.CoreImp.Optimizer.Common hiding (isDict)
13−import Language.PureScript.PSString (PSString, decodeString, mkString)
14−import qualified Language.PureScript.Constants as C
15−
16−import CodeGen.IL.Common (undefinedName, unusedName)
17−import CodeGen.IL.Optimizer.Common
18−
19−-- | Inline type class dictionaries for >>= and return for the Eff monad
20−--
21−-- E.g.
22−--
23−-- Prelude[">>="](dict)(m1)(function(x) {
24−-- return ...;
25−-- })
26−--
27−-- becomes
28−--
29−-- function __do {
30−-- var x = m1();
31−-- ...
32−-- }
33−magicDoEff :: AST -> AST
34−magicDoEff = magicDo C.eff C.effDictionaries
35−
36−magicDoEffect :: AST -> AST
37−magicDoEffect = magicDo C.effect C.effectDictionaries
38−
39−magicDoST :: AST -> AST
40−magicDoST = magicDo C.st C.stDictionaries
41−
42−magicDo :: Text -> C.EffectDictionaries -> AST -> AST
43−magicDo effectModule C.EffectDictionaries{..} = everywhereTopDown convert
44− where
45− -- Desugar monomorphic calls to >>= and return for the Eff monad
46− convert :: AST -> AST
47− -- Desugar pure
48− convert (App _ (App _ pure' [val]) []) | isPure pure' = val
49− -- Desugar discard
50− convert (App _ (App _ bind [m]) [Function s1 Nothing [unused] (Block s2 il)]) | isDiscard bind && unused == unusedName =
51− Function s1 Nothing [] $ Block s2 (App s2 m [] : map applyReturns il )
52− -- Desugar bind
53− convert (App _ (App _ bind [m]) [Function s1 Nothing [arg] (Block s2 il)]) | isBind bind =
54− Function s1 Nothing [] $ Block s2 (VariableIntroduction s2 arg (Just (App s2 m [])) : map applyReturns il)
55− -- Desugar untilE
56− convert (App s1 (App _ f [arg]) []) | isEffFunc edUntil f =
57− App s1 (Function s1 Nothing [] (Block s1 [ While s1 (Unary s1 Not (App s1 arg [])) (Block s1 []), Return s1 $ ObjectLiteral s1 []])) []
58− -- Desugar whileE
59− convert (App _ (App _ (App s1 f [arg1]) [arg2]) []) | isEffFunc edWhile f =
60− App s1 (Function s1 Nothing [] (Block s1 [ While s1 (App s1 arg1 []) (Block s1 [ App s1 arg2 [] ]), Return s1 $ ObjectLiteral s1 []])) []
61− -- -- Inline __do returns
62− -- convert (Return _ (App _ (Function _ (Just ident) [] body) [])) | ident == fnName = body
63− -- Inline double applications
64− convert (App _ (App s1 (Function s2 Nothing [] (Block ss body)) []) []) =
65− App s1 (Function s2 Nothing [] (Block ss (applyReturns `fmap` body))) []
66− convert other = other
67− -- Check if an expression represents a monomorphic call to >>= for the Eff monad
68− isBind (App _ fn [dict]) | isDict (effectModule, edBindDict) dict && isBindPoly fn = True
69− isBind _ = False
70− -- Check if an expression represents a call to @discard@
71− isDiscard (App _ (App _ fn [dict1]) [dict2])
72− | isDict (C.controlBind, C.discardUnitDictionary) dict1 &&
73− isDict (effectModule, edBindDict) dict2 &&
74− isDiscardPoly fn = True
75− isDiscard _ = False
76−
77− -- Check if an expression represents a monomorphic call to pure or return for the Eff applicative
78− isPure (App _ fn [dict]) | isDict (effectModule, edApplicativeDict) dict && isPurePoly fn = True
79− isPure _ = False
80− -- Check if an expression represents the polymorphic >>= function
81− isBindPoly = isDict (C.controlBind, C.bind)
82− -- Check if an expression represents the polymorphic pure function
83− isPurePoly = isDict (C.controlApplicative, C.pure')
84− -- Check if an expression represents the polymorphic discard function
85− isDiscardPoly = isDict (C.controlBind, C.discard)
86− -- Check if an expression represents a function in the Effect module
87− isEffFunc name (Indexer _ (StringLiteral _ name') (Var _ eff)) = eff == effectModule && name == name'
88− isEffFunc _ _ = False
89−
90− applyReturns :: AST -> AST
91− applyReturns (Return ss ret) = Return ss (App ss ret [])
92− applyReturns (Block ss ils) = Block ss (map applyReturns ils)
93− applyReturns (While ss cond il) = While ss cond (applyReturns il)
94− applyReturns (For ss v lo hi il) = For ss v lo hi (applyReturns il)
95− applyReturns (ForIn ss v xs il) = ForIn ss v xs (applyReturns il)
96− applyReturns (IfElse ss cond t f) = IfElse ss cond (applyReturns t) (applyReturns `fmap` f)
97− applyReturns other = other
98−
99−-- | Inline functions in the ST module
100−inlineST :: AST -> AST
101−inlineST = everywhere convertBlock
102− where
103− -- Look for runST blocks and inline the STRefs there.
104− -- If all STRefs are used in the scope of the same runST, only using { read, write, modify }STRef then
105− -- we can be more aggressive about inlining, and actually turn STRefs into local variables.
106− convertBlock (App s1 f [arg]) | isSTFunc C.runST f =
107− let refs = ordNub . findSTRefsIn $ arg
108− usages = findAllSTUsagesIn arg
109− allUsagesAreLocalVars = all (\u -> let v = toVar u in isJust v && fromJust v `elem` refs) usages
110− localVarsDoNotEscape = all (\r -> length (r `appearingIn` arg) == length (filter (\u -> let v = toVar u in v == Just r) usages)) refs
111− in App s1 (everywhere (convert (allUsagesAreLocalVars && localVarsDoNotEscape)) arg) []
112− convertBlock other = other
113− -- Convert a block in a safe way, preserving object wrappers of references,
114− -- or in a more aggressive way, turning wrappers into local variables depending on the
115− -- agg(ressive) parameter.
116− convert agg (App s1 f [arg]) | isSTFunc C.newSTRef f =
117− Function s1 Nothing [] (Block s1 [Return s1 $ if agg then arg else ObjectLiteral s1 [(mkString C.stRefValue, arg)]])
118− convert agg (App _ (App s1 f [ref]) []) | isSTFunc C.readSTRef f =
119− if agg then ref else Indexer s1 (StringLiteral s1 C.stRefValue) ref
120− convert agg (App _ (App _ (App s1 f [arg]) [ref]) []) | isSTFunc C.writeSTRef f =
121− if agg then Assignment s1 ref arg else Assignment s1 (Indexer s1 (StringLiteral s1 C.stRefValue) ref) arg
122− convert agg (App _ (App _ (App s1 f [func]) [ref]) []) | isSTFunc C.modifySTRef f =
123− 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])
124− convert _ other = other
125− -- Check if an expression represents a function in the ST module
126− isSTFunc name (Indexer _ (StringLiteral _ name') (Var _ st)) = st == C.st && name == name'
127− isSTFunc _ _ = False
128− -- Find all ST Refs initialized in this block
129− findSTRefsIn = everything (++) isSTRef
130− where
131− isSTRef (VariableIntroduction _ ident (Just (App _ (App _ f [_]) []))) | isSTFunc C.newSTRef f = [ident]
132− isSTRef _ = []
133− -- Find all STRefs used as arguments to readSTRef, writeSTRef, modifySTRef
134− findAllSTUsagesIn = everything (++) isSTUsage
135− where
136− isSTUsage (App _ (App _ f [ref]) []) | isSTFunc C.readSTRef f = [ref]
137− isSTUsage (App _ (App _ (App _ f [_]) [ref]) []) | isSTFunc C.writeSTRef f || isSTFunc C.modifySTRef f = [ref]
138− isSTUsage _ = []
139− -- Find all uses of a variable
140− appearingIn ref = everything (++) isVar
141− where
142− isVar e@(Var _ v) | v == ref = [e]
143− isVar _ = []
144− -- Convert a AST value to a String if it is a Var
145− toVar (Var _ v) = Just v
146− toVar _ = Nothing
src/CodeGen/IL/Optimizer/TCO.hsdeleted−141
@@ -1,141 +0,0 @@
1−module CodeGen.IL.Optimizer.TCO (tco, tcoLoop) where
2−
3−import Prelude.Compat
4−
5−import Data.Text (Text)
6−import Data.Monoid ((<>))
7−import Language.PureScript.CoreImp.AST
8−import Language.PureScript.AST.SourcePos (SourceSpan)
9−import Safe (headDef, tailSafe)
10−import CodeGen.IL.Common
11−
12−import qualified Language.PureScript.Constants as C
13−
14−tcoLoop :: Text
15−tcoLoop = "ṩtco_loop"
16−
17−tco :: AST -> AST -> AST
18−tco mn = everywhere convert where
19− tcoVar :: Text -> Text
20− tcoVar arg = "ṩtco_var_" <> arg
21−
22− copyVar :: Text -> Text
23− copyVar arg = "ṩcopy_" <> arg
24−
25− tcoDone :: Text
26− tcoDone = "ṩtco_done"
27−
28− tcoResult :: Text
29− tcoResult = "ṩtco_result"
30−
31− convert :: AST -> AST
32− convert fn@(Function ss (Just name) args _)
33− | isTailRecursive name body'
34− = replace (toLoop name outerArgs innerArgs body')
35− where
36− innerArgs = headDef [] argss
37− outerArgs = concat . reverse $ tailSafe argss
38− (argss, body', replace) = collectAllFunctionArgs [] id fn
39− convert (Assignment ss (Var _ name) fn@(Function _ Nothing _ _))
40− | isTailRecursive name body'
41− = Assignment ss (Var ss name) (replace (toLoop name outerArgs innerArgs body'))
42− where
43− innerArgs = headDef [] argss
44− outerArgs = concat . reverse $ tailSafe argss
45− (argss, body', replace) = collectAllFunctionArgs [] id fn
46− convert js = js
47−
48− collectAllFunctionArgs :: [[Text]] -> (AST -> AST) -> AST -> ([[Text]], AST, AST -> AST)
49− collectAllFunctionArgs allArgs f (Function s1 ident args (Block s2 (body@(Return _ _):_))) =
50− collectAllFunctionArgs (args : allArgs) (\b -> f (Function s1 ident (map copyVar args) (Block s2 [b]))) body
51− collectAllFunctionArgs allArgs f (Function ss ident args body@(Block _ _)) =
52− (args : allArgs, body, f . Function ss ident (map copyVar args))
53− collectAllFunctionArgs allArgs f (Return s1 (Function s2 ident args (Block s3 [body]))) =
54− collectAllFunctionArgs (args : allArgs) (\b -> f (Return s1 (Function s2 ident (map copyVar args) (Block s3 [b])))) body
55− collectAllFunctionArgs allArgs f (Return s1 (Function s2 ident args body@(Block _ _))) =
56− (args : allArgs, body, f . Return s1 . Function s2 ident (map copyVar args))
57− collectAllFunctionArgs allArgs f body = (allArgs, body, f)
58−
59− isTailRecursive :: Text -> AST -> Bool
60− isTailRecursive ident js = countSelfReferences js > 0 && allInTailPosition js where
61− countSelfReferences = everything (+) match where
62− match :: AST -> Int
63− match (Var _ ident') | ident == ident' = 1
64− match _ = 0
65−
66− allInTailPosition (Return _ expr)
67− | isSelfCall ident expr = countSelfReferences expr == 1
68− | otherwise = countSelfReferences expr == 0
69− allInTailPosition (While _ js1 body)
70− = countSelfReferences js1 == 0 && allInTailPosition body
71− allInTailPosition (For _ _ js1 js2 body)
72− = countSelfReferences js1 == 0 && countSelfReferences js2 == 0 && allInTailPosition body
73− allInTailPosition (ForIn _ _ js1 body)
74− = countSelfReferences js1 == 0 && allInTailPosition body
75− allInTailPosition (IfElse _ js1 body el)
76− = countSelfReferences js1 == 0 && allInTailPosition body && all allInTailPosition el
77− allInTailPosition (Block _ body)
78− = all allInTailPosition body
79− allInTailPosition (Throw _ js1)
80− = countSelfReferences js1 == 0
81− allInTailPosition (ReturnNoResult _)
82− = True
83− allInTailPosition (VariableIntroduction _ _ js1)
84− = all ((== 0) . countSelfReferences) js1
85− allInTailPosition (Assignment _ _ js1)
86− = countSelfReferences js1 == 0
87− allInTailPosition (Comment _ _ js1)
88− = allInTailPosition js1
89− allInTailPosition _
90− = False
91−
92− toLoop :: Text -> [Text] -> [Text] -> AST -> AST
93− toLoop ident outerArgs innerArgs js =
94− Block rootSS $
95− concatMap (\arg -> [ VariableIntroduction rootSS (tcoVar arg) . Just $
96− Var rootSS (copyVar arg) ]) (outerArgs ++ innerArgs) ++
97− [ Assignment rootSS (Var rootSS $ "var " <> tcoDone) $ BooleanLiteral Nothing False
98− , VariableIntroduction rootSS tcoResult Nothing
99− , Assignment rootSS (Var rootSS $ "var " <> tcoLoop) (Function rootSS (Just tcoLoop) (outerArgs ++ innerArgs) (Block rootSS [loopify js]))
100− , While rootSS (Unary Nothing Not (Var rootSS tcoDone))
101− (Block rootSS
102− [(Assignment rootSS (Var rootSS tcoResult) (App rootSS (Var rootSS tcoLoop) ((map (Var rootSS . tcoVar) outerArgs) ++ (map (Var rootSS . copyVar) innerArgs))))])
103− , Return rootSS (Var rootSS tcoResult)
104− ]
105− where
106− rootSS = Nothing
107−
108− loopify :: AST -> AST
109− loopify (Return ss ret)
110− | isSelfCall ident ret =
111− let
112− allArgumentValues = concat $ collectArgs [] ret
113− in
114− Block ss $
115− zipWith (\val arg ->
116− Assignment ss (Var ss (tcoVar arg)) val) allArgumentValues outerArgs
117− ++ zipWith (\val arg ->
118− Assignment ss (Var ss (copyVar arg)) val) (drop (length outerArgs) allArgumentValues) innerArgs
119− ++ [ ReturnNoResult ss ]
120− | otherwise = Block ss [ markDone ss, Return ss ret ]
121− loopify (ReturnNoResult ss) = Block ss [ markDone ss, ReturnNoResult ss ]
122− loopify (While ss cond body) = While ss cond (loopify body)
123− loopify (For ss i js1 js2 body) = For ss i js1 js2 (loopify body)
124− loopify (ForIn ss i js1 body) = ForIn ss i js1 (loopify body)
125− loopify (IfElse ss cond body el) = IfElse ss cond (loopify body) (fmap loopify el)
126− loopify (Block ss body) = Block ss (map loopify body)
127− loopify other = other
128−
129− markDone :: Maybe SourceSpan -> AST
130− markDone ss = Assignment ss (Var ss tcoDone) (BooleanLiteral ss True)
131−
132− collectArgs :: [[AST]] -> AST -> [[AST]]
133− collectArgs acc (App _ fn args') = collectArgs (args' : acc) fn
134− collectArgs acc _ = acc
135−
136− isSelfCall :: Text -> AST -> Bool
137− isSelfCall ident (App _ (Var _ ident') _) = ident == ident'
138− isSelfCall ident (App _ (Indexer _ (Var _ ident') (Var _ mn')) _) = mn' == "" && ident == ident'
139− isSelfCall ident (App _ (Indexer _ (Var _ ident') mn') _) = mn' == mn && ident == ident'
140− isSelfCall ident (App _ fn _) = isSelfCall ident fn
141− isSelfCall _ _ = False
src/CodeGen/IL/Printer.hsdeleted−527
@@ -1,527 +0,0 @@
1−-- | Pretty printer for the AST
2−module CodeGen.IL.Printer
3− ( prettyPrintIL
4− , prettyPrintIL1
5− , prettyPrintILWithSourceMaps
6− , interfaceSource
7− , implHeaderSource
8− , implFooterSource
9− , isLiteral
10− , modLabel
11− , modPrefix
12− , ffiLoader
13− ) where
14−
15−import Prelude.Compat
16−
17−import Control.Arrow ((<+>))
18−import Control.Monad (forM, mzero)
19−import Control.Monad.State (StateT, evalStateT)
20−import Control.PatternArrows
21−import Data.List (filter, (\\))
22−import qualified Control.Arrow as A
23−
24−import Data.Maybe (fromMaybe)
25−import Data.Monoid ((<>))
26−import Data.Text (Text)
27−import qualified Data.Text as T
28−
29−import Language.PureScript.AST (SourceSpan(..))
30−import Language.PureScript.CoreImp.AST
31−import Language.PureScript.Comments
32−import Language.PureScript.Crash
33−import Language.PureScript.Names (Ident, runIdent)
34−import Language.PureScript.Pretty.Common
35−import Language.PureScript.PSString (PSString, decodeString, mkString)
36−
37−import CodeGen.IL.Common
38−import CodeGen.IL.Optimizer.TCO (tcoLoop)
39−
40−import qualified Language.PureScript.Constants as C
41−
42−-- TODO (Christoph): Get rid of T.unpack / pack
43−
44−literals :: (Emit gen) => Pattern PrinterState AST gen
45−literals = mkPattern' match'
46− where
47− match' :: (Emit gen) => AST -> StateT PrinterState Maybe gen
48− match' il = (addMapping' (getSourceSpan il) <>) <$> match il
49−
50− match :: (Emit gen) => AST -> StateT PrinterState Maybe gen
51− match (NumericLiteral _ n) = return $ emit $ T.pack $ either show show n
52− match (StringLiteral _ s) = return $ emit $ stringLiteral s
53− match (BooleanLiteral _ True) = return $ emit "true"
54− match (BooleanLiteral _ False) = return $ emit "false"
55− match (ArrayLiteral _ xs) = mconcat <$> sequence
56− [ return . emit $ arrayType <> "{"
57− , intercalate (emit ", ") <$> forM xs prettyPrintIL'
58− , return $ emit "}"
59− ]
60− -- match (ObjectLiteral _ []) = return $ emit "std::initializer_list<std::pair<const string, boxed>>{}"
61− match (ObjectLiteral _ ps) = mconcat <$> sequence
62− [ return . emit $ dictType <> "{"
63− , withIndent $ do
64− ils <- forM ps $ \(key, value) -> do
65− value' <- prettyPrintIL' value
66− return $ objectPropertyToString key <> value'
67− return $ intercalate (emit " ") $ map (<> emit ",") ils
68− , return $ emit "}"
69− ]
70− where
71− objectPropertyToString :: (Emit gen) => PSString -> gen
72− objectPropertyToString s = emit $ stringLiteral s <> ": "
73− match (Block _ sts) = mconcat <$> sequence
74− [ return $ emit "{\n"
75− , withIndent $ prettyStatements sts
76− , return $ emit "\n"
77− , currentIndent
78− , return $ emit "}"
79− ]
80− match (Var _ ident) | ident == C.undefined = return $ emit undefinedName
81− match (Var _ ident) = return $ emit ident
82− match (VariableIntroduction _ ident value) = mconcat <$> sequence
83− [ return . emit $ varDecl <> " " <> ident <> " " <> anyType
84− , maybe (return mempty) (fmap (emit " = " <>) . prettyPrintIL') value
85− ]
86− match (Assignment _ target value) = mconcat <$> sequence
87− [ prettyPrintIL' target
88− , return $ emit " = "
89− , prettyPrintIL' value
90− ]
91− match (App _ val []) = mconcat <$> sequence
92− [ return $ emit "Run("
93− , prettyPrintIL' val
94− , return $ emit ")"
95− ]
96− match (App _ (StringLiteral _ u) [arg])
97− | Just ty <- decodeString u = mconcat <$> sequence
98− [ prettyPrintIL' arg
99− , return $ emit ".("
100− , return $ emit ty
101− , return $ emit ")"
102− ]
103− match (App _ (Var _ fn) [arg]) | fn == arrayLengthFn = mconcat <$> sequence
104− [ return $ emit fn
105− , return $ emit "("
106− , prettyPrintIL' arg
107− , return $ emit ")"
108− ]
109− match (App _ (Var _ fn) args) | fn == indexFn = mconcat <$> sequence
110− [ return $ emit fn
111− , return $ emit "("
112− , intercalate (emit ", ") <$> forM args prettyPrintIL'
113− , return $ emit ")"
114− ]
115− match (App _ (Var _ fn) args) | fn == tcoLoop = mconcat <$> sequence
116− [ return $ emit fn
117− , return $ emit "("
118− , intercalate (emit ", ") <$> forM args prettyPrintIL'
119− , return $ emit ")"
120− ]
121− match (App _ (App Nothing (StringLiteral Nothing fnx) [fn@Function{}]) args)
122− | Just ftype <- decodeString fnx
123− , "Fn" `T.isPrefixOf` ftype = mconcat <$> sequence
124− [ prettyPrintIL' fn
125− , return $ emit "("
126− , intercalate (emit ", ") <$> forM args prettyPrintIL'
127− , return $ emit ")"
128− ]
129− match (App _ (App Nothing (StringLiteral Nothing fnx) [fn]) args)
130− | Just ftype <- decodeString fnx
131− , "Fn" `T.isPrefixOf` ftype = mconcat <$> sequence
132− [ prettyPrintIL' fn
133− , return $ emit ".("
134− , return $ emit ftype
135− , return $ emit ")("
136− , intercalate (emit ", ") <$> forM args prettyPrintIL'
137− , return $ emit ")"
138− ]
139− match app@(App{})
140− | (val, args) <- unApp app []
141− , length args > 1
142− = mconcat <$> sequence
143− [ return $ emit "Apply("
144− , prettyPrintIL' val
145− , return $ emit ", "
146− , intercalate (emit ", ") <$> forM args prettyPrintIL'
147− , return $ emit ")"
148− ]
149− match (App _ val args) = mconcat <$> sequence
150− [ return $ emit "Apply("
151− , prettyPrintIL' val
152− , return $ emit ", "
153− , intercalate (emit ", ") <$> forM args prettyPrintIL'
154− , return $ emit ")"
155− ]
156− match (Function _ (Just name) [] (Block _ [Return _ ret]))
157− | isComplexLiteral ret = mconcat <$> sequence
158− [ return $ emit "\n"
159− , return . emit $ varDecl <> " " <> initName name <> " Once\n"
160− , prettyPrintIL' $ VariableIntroduction Nothing (valueName name) Nothing
161− , return $ emit "\n\n"
162− , return $ emit "func "
163− , return . emit $ withPrefix name
164− , return . emit $ "() " <> anyType <> " "
165− , return $ emit "{\n"
166− , withIndent $ do
167− indentString <- currentIndent
168− return $ indentString <> (emit $ initName name <> ".Do(func() {\n") <>
169− indentString <> indentString <> (emit $ valueName name <> " = ")
170− , withIndent $ do
171− case ret of
172− Function _ Nothing args body -> mconcat <$> sequence
173− [ return $ emit "func("
174− , return . emit $ intercalate ", " (renderArg anyType <$> args)
175− , return . emit $ ") " <> anyType <> " "
176− , prettyPrintIL' body
177− ]
178− _ -> do
179− prettyPrintIL' ret
180− , return $ emit "\n"
181− , withIndent $ do
182− indentString <- currentIndent
183− return $ indentString <> (emit $ "})\n" <> "return " <> valueName name <>"\n")
184− , return $ emit "}\n\n"
185− ]
186− match (Function _ (Just name) [] ret) = mconcat <$> sequence
187− [ return $ emit "func "
188− , return . emit $ withPrefix name
189− , return . emit $ "() " <> anyType <> " "
190− , prettyPrintIL' ret
191− ]
192− match (Function _ _ args ret) = mconcat <$> sequence
193− [ return $ emit "func("
194− , return . emit $ intercalate ", " (renderArg anyType <$> args)
195− , return . emit $ ") " <> anyType <> " "
196− , prettyPrintIL' ret
197− ]
198− match (Indexer _ (Var _ name) (Var _ "")) = mconcat <$> sequence
199− [ prettyPrintIL' (Var Nothing $ withPrefix name)
200− , return $ emit "()"
201− ]
202− match (Indexer _ (Var _ name) val) = mconcat <$> sequence
203− [ prettyPrintIL' val
204− , return $ emit "."
205− , prettyPrintIL' (Var Nothing $ withPrefix name)
206− , return $ emit "()"
207− ]
208− match (Indexer _ prop@StringLiteral{} val@ObjectLiteral{}) = mconcat <$> sequence
209− [ prettyPrintIL' val
210− , return $ emit "["
211− , prettyPrintIL' prop
212− , return $ emit "]"
213− ]
214− match (Indexer _ prop@StringLiteral{} val) = mconcat <$> sequence
215− [ prettyPrintIL' val
216− , return $ emit ".("
217− , return $ emit dictType
218− , return $ emit ")["
219− , prettyPrintIL' prop
220− , return $ emit "]"
221− ]
222− match (Indexer _ index val@ArrayLiteral{}) = mconcat <$> sequence
223− [ prettyPrintIL' val
224− , return $ emit "["
225− , prettyPrintIL' index
226− , return $ emit "]"
227− ]
228− match (Indexer _ index val) = mconcat <$> sequence
229− [ prettyPrintIL' val
230− , return $ emit ".("
231− , return $ emit arrayType
232− , return $ emit ")["
233− , prettyPrintIL' index
234− , return $ emit "]"
235− ]
236− match (InstanceOf _ val ty) = mconcat <$> sequence
237− [ return $ emit "Is("
238− , prettyPrintIL' val
239− , return $ emit ", "
240− , prettyPrintIL' ty
241− , return $ emit ")"
242− ]
243− match (While _ cond sts) = mconcat <$> sequence
244− [ return $ emit "for "
245− , prettyPrintIL' cond
246− , return $ emit " "
247− , prettyPrintIL' sts
248− ]
249− match (For _ ident start end sts) = mconcat <$> sequence
250− [ return $ emit $ "for var " <> ident <> " = "
251− , prettyPrintIL' start
252− , return $ emit $ "; " <> ident <> " < "
253− , prettyPrintIL' end
254− , return $ emit $ "; " <> ident <> "++ "
255− , prettyPrintIL' sts
256− ]
257− match (ForIn _ ident obj sts) = mconcat <$> sequence
258− [ return $ emit $ "for var " <> ident <> " in "
259− , prettyPrintIL' obj
260− , return $ emit " "
261− , prettyPrintIL' sts
262− ]
263− match (IfElse _ (Binary _ EqualTo cond@Binary{} (BooleanLiteral Nothing True)) thens elses) = mconcat <$> sequence
264− [ return $ emit "if "
265− , prettyPrintIL' cond
266− , return $ emit " "
267− , prettyPrintIL' thens
268− , maybe (return mempty) (fmap (emit " else " <>) . prettyPrintIL') elses
269− ]
270− match (IfElse _ (Binary _ EqualTo cond@Binary{} (BooleanLiteral Nothing False)) thens elses) = mconcat <$> sequence
271− [ return $ emit "if !("
272− , prettyPrintIL' cond
273− , return $ emit ") "
274− , prettyPrintIL' thens
275− , maybe (return mempty) (fmap (emit " else " <>) . prettyPrintIL') elses
276− ]
277− match (IfElse _ cond thens elses) = mconcat <$> sequence
278− [ return $ emit "if "
279− , prettyPrintIL' cond
280− , return $ emit " "
281− , prettyPrintIL' thens
282− , maybe (return mempty) (fmap (emit " else " <>) . prettyPrintIL') elses
283− ]
284− match (Return _ value) = mconcat <$> sequence
285− [ return $ emit "return "
286− , prettyPrintIL' value
287− ]
288− match (ReturnNoResult _) = return . emit $ "return " <> undefinedName
289− -- match (Throw _ _) = return mempty
290− match (Throw _ value) = mconcat <$> sequence
291− [ return $ emit "panic("
292− , prettyPrintIL' value
293− , return $ emit ")"
294− ]
295− match (Comment _ com il) = mconcat <$> sequence
296− [ return $ emit "\n"
297− , mconcat <$> forM com comment
298− , prettyPrintIL' il
299− ]
300− match _ = mzero
301−
302− comment :: (Emit gen) => Comment -> StateT PrinterState Maybe gen
303− comment (LineComment com) = fmap mconcat $ sequence $
304− [ currentIndent
305− , return $ emit "//" <> emit com <> emit "\n"
306− ]
307− comment (BlockComment com) = fmap mconcat $ sequence $
308− [ currentIndent
309− , return $ emit "/**\n"
310− ] ++
311− map asLine (T.lines com) ++
312− [ currentIndent
313− , return $ emit " */\n"
314− , currentIndent
315− ]
316− where
317− asLine :: (Emit gen) => Text -> StateT PrinterState Maybe gen
318− asLine s = do
319− i <- currentIndent
320− return $ i <> emit " * " <> (emit . removeComments) s <> emit "\n"
321−
322− removeComments :: Text -> Text
323− removeComments t =
324− case T.stripPrefix "*/" t of
325− Just rest -> removeComments rest
326− Nothing -> case T.uncons t of
327− Just (x, xs) -> x `T.cons` removeComments xs
328− Nothing -> ""
329−
330−unary' :: (Emit gen) => UnaryOperator -> (AST -> Text) -> Operator PrinterState AST gen
331−unary' op mkStr = Wrap match (<>)
332− where
333− match :: (Emit gen) => Pattern PrinterState AST (gen, AST)
334− match = mkPattern match'
335− where
336− match' (Unary _ op' val) | op' == op = Just (emit $ mkStr val, val)
337− match' _ = Nothing
338−
339−unary :: (Emit gen) => UnaryOperator -> Text -> Operator PrinterState AST gen
340−unary op str = unary' op (const str)
341−
342−negateOperator :: (Emit gen) => Operator PrinterState AST gen
343−negateOperator = unary' Negate (\v -> if isNegate v then "- " else "-")
344− where
345− isNegate (Unary _ Negate _) = True
346− isNegate _ = False
347−
348−binary :: (Emit gen) => BinaryOperator -> Text -> Operator PrinterState AST gen
349−binary op str = AssocL match (\v1 v2 -> v1 <> emit (" " <> str <> " ") <> v2)
350− where
351− match :: Pattern PrinterState AST (AST, AST)
352− match = mkPattern match'
353− where
354− match' (Binary _ op' v1 v2) | op' == op = Just (v1, v2)
355− match' _ = Nothing
356−
357−isLiteral :: AST -> Bool
358−isLiteral Function{} = True
359−isLiteral NumericLiteral{} = True
360−isLiteral StringLiteral{} = True
361−isLiteral BooleanLiteral{} = True
362−isLiteral ObjectLiteral{} = True
363−isLiteral ArrayLiteral{} = True
364−isLiteral _ = False
365−
366−isComplexLiteral :: AST -> Bool
367−-- isComplexLiteral Function{} = True
368−isComplexLiteral ObjectLiteral{} = True
369−isComplexLiteral ArrayLiteral{} = True
370−isComplexLiteral _ = False
371−
372−unApp :: AST -> [AST] -> (AST, [AST])
373−unApp (App _ val [arg]) args = unApp val (arg : args)
374−unApp other args = (other, args)
375−
376−prettyStatements :: (Emit gen) => [AST] -> StateT PrinterState Maybe gen
377−prettyStatements sts = do
378− ils <- forM sts prettyPrintIL'
379− indentString <- currentIndent
380− return $ intercalate (emit "\n") $ map (indentString <>) ils
381−
382−-- | Generate a pretty-printed string representing a collection of C++ expressions at the same indentation level
383−prettyPrintILWithSourceMaps :: [AST] -> (Text, [SMap])
384−prettyPrintILWithSourceMaps il =
385− let StrPos (_, s, mp) = (fromMaybe (internalError "Incomplete pattern") . flip evalStateT (PrinterState 0) . prettyStatements) il
386− in (s, mp)
387−
388−prettyPrintIL :: [AST] -> Text
389−prettyPrintIL = maybe (internalError "Incomplete pattern") runPlainString . flip evalStateT (PrinterState 0) . prettyStatements
390−
391−-- | Generate an indented, pretty-printed string representing a C++ expression
392−prettyPrintIL' :: (Emit gen) => AST -> StateT PrinterState Maybe gen
393−prettyPrintIL' = A.runKleisli $ runPattern matchValue
394− where
395− matchValue :: (Emit gen) => Pattern PrinterState AST gen
396− matchValue = buildPrettyPrinter operators (literals <+> fmap parensPos matchValue)
397− operators :: (Emit gen) => OperatorTable PrinterState AST gen
398− operators =
399− OperatorTable [ [ unary New "?" ]
400− , [ unary Not "!"
401− , unary BitwiseNot "~"
402− , unary Positive "+"
403− , negateOperator ]
404− , [ binary Multiply "*"
405− , binary Divide "/"
406− , binary Modulus "%" ]
407− , [ binary Add "+"
408− , binary Subtract "-" ]
409− , [ binary ShiftLeft "<<"
410− , binary ShiftRight ">>" ]
411− , [ binary LessThan "<"
412− , binary LessThanOrEqualTo "<="
413− , binary GreaterThan ">"
414− , binary GreaterThanOrEqualTo ">=" ]
415− , [ binary EqualTo "=="
416− , binary NotEqualTo "!=" ]
417− , [ binary BitwiseAnd "&" ]
418− , [ binary BitwiseXor "^" ]
419− , [ binary BitwiseOr "|" ]
420− , [ binary And "&&" ]
421− , [ binary Or "||" ]
422− ]
423−
424−prettyPrintIL1 :: AST -> Text
425−prettyPrintIL1 = maybe (internalError "Incomplete pattern") runPlainString . flip evalStateT (PrinterState 0) . prettyPrintIL'
426−
427−stringLiteral :: PSString -> Text
428−stringLiteral pss | Just s <- decodeString pss = stringLiteral' s
429− where
430− stringLiteral' :: Text -> Text
431− stringLiteral' s = "\"" <> T.concatMap encodeChar s <> "\""
432− encodeChar :: Char -> Text
433− encodeChar '\0' = "\\x00"
434− encodeChar '\b' = "\\b"
435− encodeChar '\t' = "\\t"
436− encodeChar '\n' = "\\n"
437− encodeChar '\v' = "\\v"
438− encodeChar '\f' = "\\f"
439− encodeChar '\r' = "\\r"
440− encodeChar '"' = "\\\""
441− encodeChar '\\' = "\\\\"
442− encodeChar c = T.singleton $ c
443−stringLiteral _ = "\"\\uFFFD\""
444−
445−interfaceSource :: Text -> [(Text,Bool)] -> [Ident] -> Text
446−interfaceSource _ _ _ = ""
447−
448−implHeaderSource :: Text -> [Text] -> Text -> Text
449−implHeaderSource mn imports otherPrefix =
450− "// Code generated by psgo. DO NOT EDIT.\n\n" <>
451− "package " <> (if mn == "Main" || mn == "Test_Main" then "main" else mn) <> "\n\n" <>
452− "import . \"" <> runtime <> "\"\n" <>
453− (if mn == "Main" || mn == "Test_Main"
454− then "import _ \"" <> otherPrefix <> "/" <> ffiLoader <> "\"\n"
455− else "\n") <>
456− "import (\n" <>
457− (T.concat $ formatImport <$> imports) <> ")\n\n" <>
458− "type _ = Any\n\n"
459− where
460− formatImport :: Text -> Text
461− formatImport s =
462− "\t\"" <> otherPrefix <> "/" <> modPrefix <> "/" <> moduleRenamer s <> "\"\n"
463− moduleRenamer :: Text -> Text
464− moduleRenamer s
465− | (s', sfx) <- T.breakOn moduleRenamerMarker s,
466− not $ T.null sfx = s'
467− moduleRenamer s = s
468−
469−implFooterSource :: Text -> [Ident] -> Text
470−implFooterSource mn foreigns =
471− "\n\n\n" <>
472− (if null foreigns
473− then ""
474− else ("// Foreign values\n\n" <>
475− "var " <> foreignDict <> " = "<> foreignMod <> "(\"" <> mn <> "\")\n\n" <>
476− (T.concat $ (\foreign' ->
477− let name = moduleIdentToIL foreign' in
478− varDecl <> " " <> initName name <> " Once\n" <>
479− varDecl <> " " <> valueName name <> " " <> anyType <> "\n\n" <>
480− "func " <>
481− withPrefix name <>
482− "() Any { \n" <>
483− " " <> initName name <> ".Do(func() {\n" <>
484− " " <> valueName name <> " = " <>
485− "Get(" <> foreignDict <> ", " <>
486− (stringLiteral . mkString $ runIdent foreign') <> ")\n" <>
487− " })\n" <>
488− " return " <> valueName name <> "\n" <>
489− "}\n\n") <$> foreigns))) <>
490− if mn == "Main" || mn == "Test.Main" then mainSource else "\n"
491− where
492− mainSource :: Text
493− mainSource = "\
494− \func main() {\n\
495− \ Run(Ꞌmain())\n\
496− \}\n\n\
497− \"
498−
499−varDecl :: Text
500−varDecl = "var"
501−
502−renderArg :: Text -> Text -> Text
503−renderArg decl arg = arg <> " " <> decl
504−
505−foreignMod :: Text
506−foreignMod = "Foreign"
507−
508−foreignDict :: Text
509−foreignDict = "foreign"
510−
511−modLabel :: Text
512−modLabel = "purescript-native"
513−
514−modPrefix :: Text
515−modPrefix = modLabel <> "/output"
516−
517−runtime :: Text
518−runtime = "github.com/" <> modLabel <> "/go-runtime"
519−
520−ffiLoader :: Text
521−ffiLoader = modLabel <> "/ffi-loader"
522−
523−initName :: Text -> Text
524−initName s = "ᛌ" <> s <> "_once"
525−
526−valueName :: Text -> Text
527−valueName s = "ᛧ" <> s
src/Control/Monad/Logger.hsnew file+59
@@ -0,0 +1,59 @@
1+{-# LANGUAGE FlexibleInstances #-}
2+{-# LANGUAGE TypeFamilies #-}
3+
4+-- |
5+-- A replacement for WriterT IO which uses mutable references.
6+--
7+module Control.Monad.Logger where
8+
9+import Prelude.Compat
10+
11+import Control.Monad (ap)
12+import Control.Monad.Base (MonadBase(..))
13+import Control.Monad.IO.Class
14+import Control.Monad.Trans.Control (MonadBaseControl(..))
15+import Control.Monad.Writer.Class
16+
17+import Data.IORef
18+
19+-- | A replacement for WriterT IO which uses mutable references.
20+newtype Logger w a = Logger { runLogger :: IORef w -> IO a }
21+
22+-- | Run a Logger computation, starting with an empty log.
23+runLogger' :: (Monoid w) => Logger w a -> IO (a, w)
24+runLogger' l = do
25+ r <- newIORef mempty
26+ a <- runLogger l r
27+ w <- readIORef r
28+ return (a, w)
29+
30+instance Functor (Logger w) where
31+ fmap f (Logger l) = Logger $ \r -> fmap f (l r)
32+
33+instance (Monoid w) => Applicative (Logger w) where
34+ pure = Logger . const . pure
35+ (<*>) = ap
36+
37+instance (Monoid w) => Monad (Logger w) where
38+ return = pure
39+ Logger l >>= f = Logger $ \r -> l r >>= \a -> runLogger (f a) r
40+
41+instance (Monoid w) => MonadIO (Logger w) where
42+ liftIO = Logger . const
43+
44+instance (Monoid w) => MonadWriter w (Logger w) where
45+ tell w = Logger $ \r -> atomicModifyIORef' r $ \w' -> (mappend w' w, ())
46+ listen l = Logger $ \r -> do
47+ (a, w) <- liftIO (runLogger' l)
48+ atomicModifyIORef' r $ \w' -> (mappend w' w, (a, w))
49+ pass l = Logger $ \r -> do
50+ ((a, f), w) <- liftIO (runLogger' l)
51+ atomicModifyIORef' r $ \w' -> (mappend w' (f w), a)
52+
53+instance (Monoid w) => MonadBase IO (Logger w) where
54+ liftBase = liftIO
55+
56+instance (Monoid w) => MonadBaseControl IO (Logger w) where
57+ type StM (Logger w) a = a
58+ liftBaseWith f = Logger $ \r -> liftBaseWith $ \q -> f (q . flip runLogger r)
59+ restoreM = return
src/Control/Monad/Supply.hsnew file+32
@@ -0,0 +1,32 @@
1+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
2+
3+-- |
4+-- Fresh variable supply
5+--
6+module Control.Monad.Supply where
7+
8+import Prelude.Compat
9+
10+import Control.Monad.Error.Class (MonadError(..))
11+import Control.Monad.Reader
12+import Control.Monad.State
13+import Control.Monad.Writer
14+
15+import Data.Functor.Identity
16+
17+newtype SupplyT m a = SupplyT { unSupplyT :: StateT Integer m a }
18+ deriving (Functor, Applicative, Monad, MonadTrans, MonadError e, MonadWriter w, MonadReader r)
19+
20+runSupplyT :: Integer -> SupplyT m a -> m (a, Integer)
21+runSupplyT n = flip runStateT n . unSupplyT
22+
23+evalSupplyT :: (Functor m) => Integer -> SupplyT m a -> m a
24+evalSupplyT n = fmap fst . runSupplyT n
25+
26+type Supply = SupplyT Identity
27+
28+runSupply :: Integer -> Supply a -> (a, Integer)
29+runSupply n = runIdentity . runSupplyT n
30+
31+evalSupply :: Integer -> Supply a -> a
32+evalSupply n = runIdentity . evalSupplyT n
src/Control/Monad/Supply/Class.hsnew file+24
@@ -0,0 +1,24 @@
1+-- |
2+-- A class for monads supporting a supply of fresh names
3+--
4+module Control.Monad.Supply.Class where
5+
6+import Prelude.Compat
7+
8+import Control.Monad.Supply
9+import Control.Monad.State
10+
11+class Monad m => MonadSupply m where
12+ fresh :: m Integer
13+
14+instance Monad m => MonadSupply (SupplyT m) where
15+ fresh = SupplyT $ do
16+ n <- get
17+ put (n + 1)
18+ return n
19+
20+instance MonadSupply m => MonadSupply (StateT s m) where
21+ fresh = lift fresh
22+
23+freshName :: MonadSupply m => m String
24+freshName = fmap (('$' :) . show) fresh
src/Language/PureScript.hsnew file+36
@@ -0,0 +1,36 @@
1+-- |
2+-- The main compiler module
3+--
4+module Language.PureScript
5+ ( module P
6+ , version
7+ ) where
8+
9+
10+import Control.Monad.Supply as P
11+
12+import Data.Version (Version)
13+
14+import Language.PureScript.AST as P
15+import Language.PureScript.Comments as P
16+import Language.PureScript.Crash as P
17+import Language.PureScript.Environment as P
18+import Language.PureScript.Errors as P hiding (indent)
19+import Language.PureScript.Externs as P
20+import Language.PureScript.Kinds as P
21+import Language.PureScript.Linter as P
22+import Language.PureScript.Make as P
23+import Language.PureScript.ModuleDependencies as P
24+import Language.PureScript.Names as P
25+import Language.PureScript.Options as P
26+import Language.PureScript.Parser as P
27+import Language.PureScript.Pretty as P
28+import Language.PureScript.Renamer as P
29+import Language.PureScript.Sugar as P
30+import Language.PureScript.TypeChecker as P
31+import Language.PureScript.Types as P
32+
33+import qualified Paths_purescript as Paths
34+
35+version :: Version
36+version = Paths.version
src/Language/PureScript/AST.hsnew file+14
@@ -0,0 +1,14 @@
1+-- |
2+-- The initial PureScript AST
3+--
4+module Language.PureScript.AST (
5+ module AST
6+) where
7+
8+import Language.PureScript.AST.Binders as AST
9+import Language.PureScript.AST.Declarations as AST
10+import Language.PureScript.AST.Exported as AST
11+import Language.PureScript.AST.Literals as AST
12+import Language.PureScript.AST.Operators as AST
13+import Language.PureScript.AST.SourcePos as AST
14+import Language.PureScript.AST.Traversals as AST
src/Language/PureScript/AST/Binders.hsnew file+83
@@ -0,0 +1,83 @@
1+-- |
2+-- Case binders
3+--
4+module Language.PureScript.AST.Binders where
5+
6+import Prelude.Compat
7+
8+import Language.PureScript.AST.SourcePos
9+import Language.PureScript.AST.Literals
10+import Language.PureScript.Names
11+import Language.PureScript.Comments
12+import Language.PureScript.Types
13+
14+-- |
15+-- Data type for binders
16+--
17+data Binder
18+ -- |
19+ -- Wildcard binder
20+ --
21+ = NullBinder
22+ -- |
23+ -- A binder which matches a literal
24+ --
25+ | LiteralBinder (Literal Binder)
26+ -- |
27+ -- A binder which binds an identifier
28+ --
29+ | VarBinder Ident
30+ -- |
31+ -- A binder which matches a data constructor
32+ --
33+ | ConstructorBinder (Qualified (ProperName 'ConstructorName)) [Binder]
34+ -- |
35+ -- A operator alias binder. During the rebracketing phase of desugaring,
36+ -- this data constructor will be removed.
37+ --
38+ | OpBinder (Qualified (OpName 'ValueOpName))
39+ -- |
40+ -- Binary operator application. During the rebracketing phase of desugaring,
41+ -- this data constructor will be removed.
42+ --
43+ | BinaryNoParensBinder Binder Binder Binder
44+ -- |
45+ -- Explicit parentheses. During the rebracketing phase of desugaring, this
46+ -- data constructor will be removed.
47+ --
48+ -- Note: although it seems this constructor is not used, it _is_ useful,
49+ -- since it prevents certain traversals from matching.
50+ --
51+ | ParensInBinder Binder
52+ -- |
53+ -- A binder which binds its input to an identifier
54+ --
55+ | NamedBinder Ident Binder
56+ -- |
57+ -- A binder with source position information
58+ --
59+ | PositionedBinder SourceSpan [Comment] Binder
60+ -- |
61+ -- A binder with a type annotation
62+ --
63+ | TypedBinder Type Binder
64+ deriving (Show, Eq)
65+
66+-- |
67+-- Collect all names introduced in binders in an expression
68+--
69+binderNames :: Binder -> [Ident]
70+binderNames = go []
71+ where
72+ go ns (LiteralBinder b) = lit ns b
73+ go ns (VarBinder name) = name : ns
74+ go ns (ConstructorBinder _ bs) = foldl go ns bs
75+ go ns (BinaryNoParensBinder b1 b2 b3) = foldl go ns [b1, b2, b3]
76+ go ns (ParensInBinder b) = go ns b
77+ go ns (NamedBinder name b) = go (name : ns) b
78+ go ns (PositionedBinder _ _ b) = go ns b
79+ go ns (TypedBinder _ b) = go ns b
80+ go ns _ = ns
81+ lit ns (ObjectLiteral bs) = foldl go ns (map snd bs)
82+ lit ns (ArrayLiteral bs) = foldl go ns bs
83+ lit ns _ = ns
src/Language/PureScript/AST/Declarations.hsnew file+625
@@ -0,0 +1,625 @@
1+{-# LANGUAGE TemplateHaskell #-}
2+
3+-- |
4+-- Data types for modules and declarations
5+--
6+module Language.PureScript.AST.Declarations where
7+
8+import Prelude.Compat
9+
10+import Control.Monad.Identity
11+
12+import Data.Aeson.TH
13+import qualified Data.Map as M
14+
15+import Language.PureScript.AST.Binders
16+import Language.PureScript.AST.Literals
17+import Language.PureScript.AST.Operators
18+import Language.PureScript.AST.SourcePos
19+import Language.PureScript.Types
20+import Language.PureScript.Names
21+import Language.PureScript.Kinds
22+import Language.PureScript.TypeClassDictionaries
23+import Language.PureScript.Comments
24+import Language.PureScript.Environment
25+import qualified Language.PureScript.Bundle as Bundle
26+
27+import qualified Text.Parsec as P
28+
29+-- | A map of locally-bound names in scope.
30+type Context = [(Ident, Type)]
31+
32+-- | A type of error messages
33+data SimpleErrorMessage
34+ = ErrorParsingFFIModule FilePath (Maybe Bundle.ErrorMessage)
35+ | ErrorParsingModule P.ParseError
36+ | MissingFFIModule ModuleName
37+ | MultipleFFIModules ModuleName [FilePath]
38+ | UnnecessaryFFIModule ModuleName FilePath
39+ | MissingFFIImplementations ModuleName [Ident]
40+ | UnusedFFIImplementations ModuleName [Ident]
41+ | InvalidFFIIdentifier ModuleName String
42+ | CannotGetFileInfo FilePath
43+ | CannotReadFile FilePath
44+ | CannotWriteFile FilePath
45+ | InfiniteType Type
46+ | InfiniteKind Kind
47+ | MultipleValueOpFixities (OpName 'ValueOpName)
48+ | MultipleTypeOpFixities (OpName 'TypeOpName)
49+ | OrphanTypeDeclaration Ident
50+ | RedefinedModule ModuleName [SourceSpan]
51+ | RedefinedIdent Ident
52+ | OverlappingNamesInLet
53+ | UnknownName (Qualified Name)
54+ | UnknownImport ModuleName Name
55+ | UnknownImportDataConstructor ModuleName (ProperName 'TypeName) (ProperName 'ConstructorName)
56+ | UnknownExport Name
57+ | UnknownExportDataConstructor (ProperName 'TypeName) (ProperName 'ConstructorName)
58+ | ScopeConflict Name [ModuleName]
59+ | ScopeShadowing Name (Maybe ModuleName) [ModuleName]
60+ | DeclConflict Name Name
61+ | ExportConflict (Qualified Name) (Qualified Name)
62+ | DuplicateModuleName ModuleName
63+ | DuplicateTypeArgument String
64+ | InvalidDoBind
65+ | InvalidDoLet
66+ | CycleInDeclaration Ident
67+ | CycleInTypeSynonym (Maybe (ProperName 'TypeName))
68+ | CycleInModules [ModuleName]
69+ | NameIsUndefined Ident
70+ | UndefinedTypeVariable (ProperName 'TypeName)
71+ | PartiallyAppliedSynonym (Qualified (ProperName 'TypeName))
72+ | EscapedSkolem (Maybe Expr)
73+ | TypesDoNotUnify Type Type
74+ | KindsDoNotUnify Kind Kind
75+ | ConstrainedTypeUnified Type Type
76+ | OverlappingInstances (Qualified (ProperName 'ClassName)) [Type] [Qualified Ident]
77+ | NoInstanceFound Constraint
78+ | PossiblyInfiniteInstance (Qualified (ProperName 'ClassName)) [Type]
79+ | CannotDerive (Qualified (ProperName 'ClassName)) [Type]
80+ | CannotFindDerivingType (ProperName 'TypeName)
81+ | DuplicateLabel String (Maybe Expr)
82+ | DuplicateValueDeclaration Ident
83+ | ArgListLengthsDiffer Ident
84+ | OverlappingArgNames (Maybe Ident)
85+ | MissingClassMember Ident
86+ | ExtraneousClassMember Ident (Qualified (ProperName 'ClassName))
87+ | ExpectedType Type Kind
88+ | IncorrectConstructorArity (Qualified (ProperName 'ConstructorName))
89+ | ExprDoesNotHaveType Expr Type
90+ | PropertyIsMissing String
91+ | AdditionalProperty String
92+ | CannotApplyFunction Type Expr
93+ | TypeSynonymInstance
94+ | OrphanInstance Ident (Qualified (ProperName 'ClassName)) [Type]
95+ | InvalidNewtype (ProperName 'TypeName)
96+ | InvalidInstanceHead Type
97+ | TransitiveExportError DeclarationRef [DeclarationRef]
98+ | TransitiveDctorExportError DeclarationRef (ProperName 'ConstructorName)
99+ | ShadowedName Ident
100+ | ShadowedTypeVar String
101+ | UnusedTypeVar String
102+ | WildcardInferredType Type Context
103+ | HoleInferredType String Type Context
104+ | MissingTypeDeclaration Ident Type
105+ | OverlappingPattern [[Binder]] Bool
106+ | IncompleteExhaustivityCheck
107+ | MisleadingEmptyTypeImport ModuleName (ProperName 'TypeName)
108+ | ImportHidingModule ModuleName
109+ | UnusedImport ModuleName
110+ | UnusedExplicitImport ModuleName [String] (Maybe ModuleName) [DeclarationRef]
111+ | UnusedDctorImport (ProperName 'TypeName)
112+ | UnusedDctorExplicitImport (ProperName 'TypeName) [ProperName 'ConstructorName]
113+ | DuplicateSelectiveImport ModuleName
114+ | DuplicateImport ModuleName ImportDeclarationType (Maybe ModuleName)
115+ | DuplicateImportRef Name
116+ | DuplicateExportRef Name
117+ | IntOutOfRange Integer String Integer Integer
118+ | ImplicitQualifiedImport ModuleName ModuleName [DeclarationRef]
119+ | ImplicitImport ModuleName [DeclarationRef]
120+ | HidingImport ModuleName [DeclarationRef]
121+ | CaseBinderLengthDiffers Int [Binder]
122+ | IncorrectAnonymousArgument
123+ | InvalidOperatorInBinder (Qualified (OpName 'ValueOpName)) (Qualified Ident)
124+ | DeprecatedRequirePath
125+ | CannotGeneralizeRecursiveFunction Ident Type
126+ deriving (Show)
127+
128+-- | Error message hints, providing more detailed information about failure.
129+data ErrorMessageHint
130+ = ErrorUnifyingTypes Type Type
131+ | ErrorInExpression Expr
132+ | ErrorInModule ModuleName
133+ | ErrorInInstance (Qualified (ProperName 'ClassName)) [Type]
134+ | ErrorInSubsumption Type Type
135+ | ErrorCheckingAccessor Expr String
136+ | ErrorCheckingType Expr Type
137+ | ErrorCheckingKind Type
138+ | ErrorCheckingGuard
139+ | ErrorInferringType Expr
140+ | ErrorInApplication Expr Type Expr
141+ | ErrorInDataConstructor (ProperName 'ConstructorName)
142+ | ErrorInTypeConstructor (ProperName 'TypeName)
143+ | ErrorInBindingGroup [Ident]
144+ | ErrorInDataBindingGroup
145+ | ErrorInTypeSynonym (ProperName 'TypeName)
146+ | ErrorInValueDeclaration Ident
147+ | ErrorInTypeDeclaration Ident
148+ | ErrorInForeignImport Ident
149+ | ErrorSolvingConstraint Constraint
150+ | PositionedError SourceSpan
151+ deriving (Show)
152+
153+-- | Categories of hints
154+data HintCategory
155+ = ExprHint
156+ | KindHint
157+ | CheckHint
158+ | PositionHint
159+ | SolverHint
160+ | OtherHint
161+ deriving (Show, Eq)
162+
163+data ErrorMessage = ErrorMessage
164+ [ErrorMessageHint]
165+ SimpleErrorMessage
166+ deriving (Show)
167+
168+-- |
169+-- A module declaration, consisting of comments about the module, a module name,
170+-- a list of declarations, and a list of the declarations that are
171+-- explicitly exported. If the export list is Nothing, everything is exported.
172+--
173+data Module = Module SourceSpan [Comment] ModuleName [Declaration] (Maybe [DeclarationRef])
174+ deriving (Show)
175+
176+-- | Return a module's name.
177+getModuleName :: Module -> ModuleName
178+getModuleName (Module _ _ name _ _) = name
179+
180+-- |
181+-- Add an import declaration for a module if it does not already explicitly import it.
182+--
183+addDefaultImport :: ModuleName -> Module -> Module
184+addDefaultImport toImport m@(Module ss coms mn decls exps) =
185+ if isExistingImport `any` decls || mn == toImport then m
186+ else Module ss coms mn (ImportDeclaration toImport Implicit Nothing : decls) exps
187+ where
188+ isExistingImport (ImportDeclaration mn' _ _) | mn' == toImport = True
189+ isExistingImport (PositionedDeclaration _ _ d) = isExistingImport d
190+ isExistingImport _ = False
191+
192+-- |
193+-- An item in a list of explicit imports or exports
194+--
195+data DeclarationRef
196+ -- |
197+ -- A type constructor with data constructors
198+ --
199+ = TypeRef (ProperName 'TypeName) (Maybe [ProperName 'ConstructorName])
200+ -- |
201+ -- A type operator
202+ --
203+ | TypeOpRef (OpName 'TypeOpName)
204+ -- |
205+ -- A value
206+ --
207+ | ValueRef Ident
208+ -- |
209+ -- A value-level operator
210+ --
211+ | ValueOpRef (OpName 'ValueOpName)
212+ -- |
213+ -- A type class
214+ --
215+ | TypeClassRef (ProperName 'ClassName)
216+ -- |
217+ -- A type class instance, created during typeclass desugaring (name, class name, instance types)
218+ --
219+ | TypeInstanceRef Ident
220+ -- |
221+ -- A module, in its entirety
222+ --
223+ | ModuleRef ModuleName
224+ -- |
225+ -- A value re-exported from another module. These will be inserted during
226+ -- elaboration in name desugaring.
227+ --
228+ | ReExportRef ModuleName DeclarationRef
229+ -- |
230+ -- A declaration reference with source position information
231+ --
232+ | PositionedDeclarationRef SourceSpan [Comment] DeclarationRef
233+ deriving (Show)
234+
235+instance Eq DeclarationRef where
236+ (TypeRef name dctors) == (TypeRef name' dctors') = name == name' && dctors == dctors'
237+ (TypeOpRef name) == (TypeOpRef name') = name == name'
238+ (ValueRef name) == (ValueRef name') = name == name'
239+ (ValueOpRef name) == (ValueOpRef name') = name == name'
240+ (TypeClassRef name) == (TypeClassRef name') = name == name'
241+ (TypeInstanceRef name) == (TypeInstanceRef name') = name == name'
242+ (ModuleRef name) == (ModuleRef name') = name == name'
243+ (ReExportRef mn ref) == (ReExportRef mn' ref') = mn == mn' && ref == ref'
244+ (PositionedDeclarationRef _ _ r) == r' = r == r'
245+ r == (PositionedDeclarationRef _ _ r') = r == r'
246+ _ == _ = False
247+
248+getTypeRef :: DeclarationRef -> Maybe (ProperName 'TypeName, Maybe [ProperName 'ConstructorName])
249+getTypeRef (TypeRef name dctors) = Just (name, dctors)
250+getTypeRef (PositionedDeclarationRef _ _ r) = getTypeRef r
251+getTypeRef _ = Nothing
252+
253+getTypeOpRef :: DeclarationRef -> Maybe (OpName 'TypeOpName)
254+getTypeOpRef (TypeOpRef op) = Just op
255+getTypeOpRef (PositionedDeclarationRef _ _ r) = getTypeOpRef r
256+getTypeOpRef _ = Nothing
257+
258+getValueRef :: DeclarationRef -> Maybe Ident
259+getValueRef (ValueRef name) = Just name
260+getValueRef (PositionedDeclarationRef _ _ r) = getValueRef r
261+getValueRef _ = Nothing
262+
263+getValueOpRef :: DeclarationRef -> Maybe (OpName 'ValueOpName)
264+getValueOpRef (ValueOpRef op) = Just op
265+getValueOpRef (PositionedDeclarationRef _ _ r) = getValueOpRef r
266+getValueOpRef _ = Nothing
267+
268+getTypeClassRef :: DeclarationRef -> Maybe (ProperName 'ClassName)
269+getTypeClassRef (TypeClassRef name) = Just name
270+getTypeClassRef (PositionedDeclarationRef _ _ r) = getTypeClassRef r
271+getTypeClassRef _ = Nothing
272+
273+isModuleRef :: DeclarationRef -> Bool
274+isModuleRef (PositionedDeclarationRef _ _ r) = isModuleRef r
275+isModuleRef (ModuleRef _) = True
276+isModuleRef _ = False
277+
278+-- |
279+-- The data type which specifies type of import declaration
280+--
281+data ImportDeclarationType
282+ -- |
283+ -- An import with no explicit list: `import M`.
284+ --
285+ = Implicit
286+ -- |
287+ -- An import with an explicit list of references to import: `import M (foo)`
288+ --
289+ | Explicit [DeclarationRef]
290+ -- |
291+ -- An import with a list of references to hide: `import M hiding (foo)`
292+ --
293+ | Hiding [DeclarationRef]
294+ deriving (Eq, Show)
295+
296+isImplicit :: ImportDeclarationType -> Bool
297+isImplicit Implicit = True
298+isImplicit _ = False
299+
300+isExplicit :: ImportDeclarationType -> Bool
301+isExplicit (Explicit _) = True
302+isExplicit _ = False
303+
304+-- |
305+-- The data type of declarations
306+--
307+data Declaration
308+ -- |
309+ -- A data type declaration (data or newtype, name, arguments, data constructors)
310+ --
311+ = DataDeclaration DataDeclType (ProperName 'TypeName) [(String, Maybe Kind)] [(ProperName 'ConstructorName, [Type])]
312+ -- |
313+ -- A minimal mutually recursive set of data type declarations
314+ --
315+ | DataBindingGroupDeclaration [Declaration]
316+ -- |
317+ -- A type synonym declaration (name, arguments, type)
318+ --
319+ | TypeSynonymDeclaration (ProperName 'TypeName) [(String, Maybe Kind)] Type
320+ -- |
321+ -- A type declaration for a value (name, ty)
322+ --
323+ | TypeDeclaration Ident Type
324+ -- |
325+ -- A value declaration (name, top-level binders, optional guard, value)
326+ --
327+ | ValueDeclaration Ident NameKind [Binder] (Either [(Guard, Expr)] Expr)
328+ -- |
329+ -- A minimal mutually recursive set of value declarations
330+ --
331+ | BindingGroupDeclaration [(Ident, NameKind, Expr)]
332+ -- |
333+ -- A foreign import declaration (name, type)
334+ --
335+ | ExternDeclaration Ident Type
336+ -- |
337+ -- A data type foreign import (name, kind)
338+ --
339+ | ExternDataDeclaration (ProperName 'TypeName) Kind
340+ -- |
341+ -- A fixity declaration
342+ --
343+ | FixityDeclaration (Either ValueFixity TypeFixity)
344+ -- |
345+ -- A module import (module name, qualified/unqualified/hiding, optional "qualified as" name)
346+ --
347+ | ImportDeclaration ModuleName ImportDeclarationType (Maybe ModuleName)
348+ -- |
349+ -- A type class declaration (name, argument, implies, member declarations)
350+ --
351+ | TypeClassDeclaration (ProperName 'ClassName) [(String, Maybe Kind)] [Constraint] [Declaration]
352+ -- |
353+ -- A type instance declaration (name, dependencies, class name, instance types, member
354+ -- declarations)
355+ --
356+ | TypeInstanceDeclaration Ident [Constraint] (Qualified (ProperName 'ClassName)) [Type] TypeInstanceBody
357+ -- |
358+ -- A declaration with source position information
359+ --
360+ | PositionedDeclaration SourceSpan [Comment] Declaration
361+ deriving (Show)
362+
363+data ValueFixity = ValueFixity Fixity (Qualified (Either Ident (ProperName 'ConstructorName))) (OpName 'ValueOpName)
364+ deriving (Eq, Ord, Show)
365+
366+data TypeFixity = TypeFixity Fixity (Qualified (ProperName 'TypeName)) (OpName 'TypeOpName)
367+ deriving (Eq, Ord, Show)
368+
369+pattern ValueFixityDeclaration :: Fixity -> Qualified (Either Ident (ProperName 'ConstructorName)) -> OpName 'ValueOpName -> Declaration
370+pattern ValueFixityDeclaration fixity name op = FixityDeclaration (Left (ValueFixity fixity name op))
371+
372+pattern TypeFixityDeclaration :: Fixity -> Qualified (ProperName 'TypeName) -> OpName 'TypeOpName -> Declaration
373+pattern TypeFixityDeclaration fixity name op = FixityDeclaration (Right (TypeFixity fixity name op))
374+
375+-- | The members of a type class instance declaration
376+data TypeInstanceBody
377+ -- | This is a derived instance
378+ = DerivedInstance
379+ -- | This is a regular (explicit) instance
380+ | ExplicitInstance [Declaration]
381+ deriving (Show)
382+
383+mapTypeInstanceBody :: ([Declaration] -> [Declaration]) -> TypeInstanceBody -> TypeInstanceBody
384+mapTypeInstanceBody f = runIdentity . traverseTypeInstanceBody (Identity . f)
385+
386+-- | A traversal for TypeInstanceBody
387+traverseTypeInstanceBody :: (Applicative f) => ([Declaration] -> f [Declaration]) -> TypeInstanceBody -> f TypeInstanceBody
388+traverseTypeInstanceBody _ DerivedInstance = pure DerivedInstance
389+traverseTypeInstanceBody f (ExplicitInstance ds) = ExplicitInstance <$> f ds
390+
391+-- |
392+-- Test if a declaration is a value declaration
393+--
394+isValueDecl :: Declaration -> Bool
395+isValueDecl ValueDeclaration{} = True
396+isValueDecl (PositionedDeclaration _ _ d) = isValueDecl d
397+isValueDecl _ = False
398+
399+-- |
400+-- Test if a declaration is a data type or type synonym declaration
401+--
402+isDataDecl :: Declaration -> Bool
403+isDataDecl DataDeclaration{} = True
404+isDataDecl TypeSynonymDeclaration{} = True
405+isDataDecl (PositionedDeclaration _ _ d) = isDataDecl d
406+isDataDecl _ = False
407+
408+-- |
409+-- Test if a declaration is a module import
410+--
411+isImportDecl :: Declaration -> Bool
412+isImportDecl ImportDeclaration{} = True
413+isImportDecl (PositionedDeclaration _ _ d) = isImportDecl d
414+isImportDecl _ = False
415+
416+-- |
417+-- Test if a declaration is a data type foreign import
418+--
419+isExternDataDecl :: Declaration -> Bool
420+isExternDataDecl ExternDataDeclaration{} = True
421+isExternDataDecl (PositionedDeclaration _ _ d) = isExternDataDecl d
422+isExternDataDecl _ = False
423+
424+-- |
425+-- Test if a declaration is a fixity declaration
426+--
427+isFixityDecl :: Declaration -> Bool
428+isFixityDecl FixityDeclaration{} = True
429+isFixityDecl (PositionedDeclaration _ _ d) = isFixityDecl d
430+isFixityDecl _ = False
431+
432+getFixityDecl :: Declaration -> Maybe (Either ValueFixity TypeFixity)
433+getFixityDecl (FixityDeclaration fixity) = Just fixity
434+getFixityDecl (PositionedDeclaration _ _ d) = getFixityDecl d
435+getFixityDecl _ = Nothing
436+
437+-- |
438+-- Test if a declaration is a foreign import
439+--
440+isExternDecl :: Declaration -> Bool
441+isExternDecl ExternDeclaration{} = True
442+isExternDecl (PositionedDeclaration _ _ d) = isExternDecl d
443+isExternDecl _ = False
444+
445+-- |
446+-- Test if a declaration is a type class instance declaration
447+--
448+isTypeClassInstanceDeclaration :: Declaration -> Bool
449+isTypeClassInstanceDeclaration TypeInstanceDeclaration{} = True
450+isTypeClassInstanceDeclaration (PositionedDeclaration _ _ d) = isTypeClassInstanceDeclaration d
451+isTypeClassInstanceDeclaration _ = False
452+
453+-- |
454+-- Test if a declaration is a type class declaration
455+--
456+isTypeClassDeclaration :: Declaration -> Bool
457+isTypeClassDeclaration TypeClassDeclaration{} = True
458+isTypeClassDeclaration (PositionedDeclaration _ _ d) = isTypeClassDeclaration d
459+isTypeClassDeclaration _ = False
460+
461+-- |
462+-- Recursively flatten data binding groups in the list of declarations
463+flattenDecls :: [Declaration] -> [Declaration]
464+flattenDecls = concatMap flattenOne
465+ where flattenOne :: Declaration -> [Declaration]
466+ flattenOne (DataBindingGroupDeclaration decls) = concatMap flattenOne decls
467+ flattenOne d = [d]
468+
469+-- |
470+-- A guard is just a boolean-valued expression that appears alongside a set of binders
471+--
472+type Guard = Expr
473+
474+-- |
475+-- Data type for expressions and terms
476+--
477+data Expr
478+ -- |
479+ -- A literal value
480+ --
481+ = Literal (Literal Expr)
482+ -- |
483+ -- A prefix -, will be desugared
484+ --
485+ | UnaryMinus Expr
486+ -- |
487+ -- Binary operator application. During the rebracketing phase of desugaring, this data constructor
488+ -- will be removed.
489+ --
490+ | BinaryNoParens Expr Expr Expr
491+ -- |
492+ -- Explicit parentheses. During the rebracketing phase of desugaring, this data constructor
493+ -- will be removed.
494+ --
495+ -- Note: although it seems this constructor is not used, it _is_ useful, since it prevents
496+ -- certain traversals from matching.
497+ --
498+ | Parens Expr
499+ -- |
500+ -- An record property accessor expression (e.g. `obj.x` or `_.x`).
501+ -- Anonymous arguments will be removed during desugaring and expanded
502+ -- into a lambda that reads a property from a record.
503+ --
504+ | Accessor String Expr
505+ -- |
506+ -- Partial record update
507+ --
508+ | ObjectUpdate Expr [(String, Expr)]
509+ -- |
510+ -- Function introduction
511+ --
512+ | Abs (Either Ident Binder) Expr
513+ -- |
514+ -- Function application
515+ --
516+ | App Expr Expr
517+ -- |
518+ -- Variable
519+ --
520+ | Var (Qualified Ident)
521+ -- |
522+ -- An operator. This will be desugared into a function during the "operators"
523+ -- phase of desugaring.
524+ --
525+ | Op (Qualified (OpName 'ValueOpName))
526+ -- |
527+ -- Conditional (if-then-else expression)
528+ --
529+ | IfThenElse Expr Expr Expr
530+ -- |
531+ -- A data constructor
532+ --
533+ | Constructor (Qualified (ProperName 'ConstructorName))
534+ -- |
535+ -- A case expression. During the case expansion phase of desugaring, top-level binders will get
536+ -- desugared into case expressions, hence the need for guards and multiple binders per branch here.
537+ --
538+ | Case [Expr] [CaseAlternative]
539+ -- |
540+ -- A value with a type annotation
541+ --
542+ | TypedValue Bool Expr Type
543+ -- |
544+ -- A let binding
545+ --
546+ | Let [Declaration] Expr
547+ -- |
548+ -- A do-notation block
549+ --
550+ | Do [DoNotationElement]
551+ -- |
552+ -- An application of a typeclass dictionary constructor. The value should be
553+ -- an ObjectLiteral.
554+ --
555+ | TypeClassDictionaryConstructorApp (Qualified (ProperName 'ClassName)) Expr
556+ -- |
557+ -- A placeholder for a type class dictionary to be inserted later. At the end of type checking, these
558+ -- placeholders will be replaced with actual expressions representing type classes dictionaries which
559+ -- can be evaluated at runtime. The constructor arguments represent (in order): whether or not to look
560+ -- at superclass implementations when searching for a dictionary, the type class name and
561+ -- instance type, and the type class dictionaries in scope.
562+ --
563+ | TypeClassDictionary Constraint
564+ (M.Map (Maybe ModuleName) (M.Map (Qualified (ProperName 'ClassName)) (M.Map (Qualified Ident) TypeClassDictionaryInScope)))
565+ [ErrorMessageHint]
566+ -- |
567+ -- A typeclass dictionary accessor, the implementation is left unspecified until CoreFn desugaring.
568+ --
569+ | TypeClassDictionaryAccessor (Qualified (ProperName 'ClassName)) Ident
570+ -- |
571+ -- A placeholder for a superclass dictionary to be turned into a TypeClassDictionary during typechecking
572+ --
573+ | SuperClassDictionary (Qualified (ProperName 'ClassName)) [Type]
574+ -- |
575+ -- A placeholder for an anonymous function argument
576+ --
577+ | AnonymousArgument
578+ -- |
579+ -- A typed hole that will be turned into a hint/error duing typechecking
580+ --
581+ | Hole String
582+ -- |
583+ -- A value with source position information
584+ --
585+ | PositionedValue SourceSpan [Comment] Expr
586+ deriving (Show)
587+
588+-- |
589+-- An alternative in a case statement
590+--
591+data CaseAlternative = CaseAlternative
592+ { -- |
593+ -- A collection of binders with which to match the inputs
594+ --
595+ caseAlternativeBinders :: [Binder]
596+ -- |
597+ -- The result expression or a collect of guarded expressions
598+ --
599+ , caseAlternativeResult :: Either [(Guard, Expr)] Expr
600+ } deriving (Show)
601+
602+-- |
603+-- A statement in a do-notation block
604+--
605+data DoNotationElement
606+ -- |
607+ -- A monadic value without a binder
608+ --
609+ = DoNotationValue Expr
610+ -- |
611+ -- A monadic value with a binder
612+ --
613+ | DoNotationBind Binder Expr
614+ -- |
615+ -- A let statement, i.e. a pure value with a binder
616+ --
617+ | DoNotationLet [Declaration]
618+ -- |
619+ -- A do notation element with source position information
620+ --
621+ | PositionedDoNotationElement SourceSpan [Comment] DoNotationElement
622+ deriving (Show)
623+
624+$(deriveJSON (defaultOptions { sumEncoding = ObjectWithSingleField }) ''DeclarationRef)
625+$(deriveJSON (defaultOptions { sumEncoding = ObjectWithSingleField }) ''ImportDeclarationType)
src/Language/PureScript/AST/Exported.hsnew file+154
@@ -0,0 +1,154 @@
1+module Language.PureScript.AST.Exported
2+ ( exportedDeclarations
3+ , isExported
4+ ) where
5+
6+import Prelude.Compat
7+
8+import Control.Category ((>>>))
9+
10+import Data.Maybe (mapMaybe)
11+
12+import Language.PureScript.AST.Declarations
13+import Language.PureScript.Types
14+import Language.PureScript.Names
15+
16+-- |
17+-- Return a list of all declarations which are exported from a module.
18+-- This function descends into data declarations to filter out unexported
19+-- data constructors, and also filters out type instance declarations if
20+-- they refer to classes or types which are not themselves exported.
21+--
22+-- Note that this function assumes that the module has already had its imports
23+-- desugared using 'Language.PureScript.Sugar.Names.desugarImports'. It will
24+-- produce incorrect results if this is not the case - for example, type class
25+-- instances will be incorrectly removed in some cases.
26+--
27+exportedDeclarations :: Module -> [Declaration]
28+exportedDeclarations (Module _ _ mn decls exps) = go decls
29+ where
30+ go = flattenDecls
31+ >>> filter (isExported exps)
32+ >>> map (filterDataConstructors exps)
33+ >>> filterInstances mn exps
34+
35+-- |
36+-- Filter out all data constructors from a declaration which are not exported.
37+-- If the supplied declaration is not a data declaration, this function returns
38+-- it unchanged.
39+--
40+filterDataConstructors :: Maybe [DeclarationRef] -> Declaration -> Declaration
41+filterDataConstructors exps (DataDeclaration dType tyName tyArgs dctors) =
42+ DataDeclaration dType tyName tyArgs $
43+ filter (isDctorExported tyName exps . fst) dctors
44+filterDataConstructors exps (PositionedDeclaration srcSpan coms d) =
45+ PositionedDeclaration srcSpan coms (filterDataConstructors exps d)
46+filterDataConstructors _ other = other
47+
48+-- |
49+-- Filter out all the type instances from a list of declarations which
50+-- reference a type or type class which is both local and not exported.
51+--
52+-- Note that this function assumes that the module has already had its imports
53+-- desugared using "Language.PureScript.Sugar.Names.desugarImports". It will
54+-- produce incorrect results if this is not the case - for example, type class
55+-- instances will be incorrectly removed in some cases.
56+--
57+filterInstances
58+ :: ModuleName
59+ -> Maybe [DeclarationRef]
60+ -> [Declaration]
61+ -> [Declaration]
62+filterInstances _ Nothing = id
63+filterInstances mn (Just exps) =
64+ let refs = Left `map` mapMaybe typeClassName exps
65+ ++ Right `map` mapMaybe typeName exps
66+ in filter (all (visibleOutside refs) . typeInstanceConstituents)
67+ where
68+ -- Given a Qualified ProperName, and a list of all exported types and type
69+ -- classes, returns whether the supplied Qualified ProperName is visible
70+ -- outside this module. This is true if one of the following hold:
71+ --
72+ -- * the name is defined in the same module and is exported,
73+ -- * the name is defined in a different module (and must be exported from
74+ -- that module; the code would fail to compile otherwise).
75+ visibleOutside
76+ :: [Either (ProperName 'ClassName) (ProperName 'TypeName)]
77+ -> Either (Qualified (ProperName 'ClassName)) (Qualified (ProperName 'TypeName))
78+ -> Bool
79+ visibleOutside refs q
80+ | either checkQual checkQual q = True
81+ | otherwise = either (Left . disqualify) (Right . disqualify) q `elem` refs
82+
83+ -- Check that a qualified name is qualified for a different module
84+ checkQual :: Qualified a -> Bool
85+ checkQual q = isQualified q && not (isQualifiedWith mn q)
86+
87+ typeName :: DeclarationRef -> Maybe (ProperName 'TypeName)
88+ typeName (TypeRef n _) = Just n
89+ typeName (PositionedDeclarationRef _ _ r) = typeName r
90+ typeName _ = Nothing
91+
92+ typeClassName :: DeclarationRef -> Maybe (ProperName 'ClassName)
93+ typeClassName (TypeClassRef n) = Just n
94+ typeClassName (PositionedDeclarationRef _ _ r) = typeClassName r
95+ typeClassName _ = Nothing
96+
97+-- |
98+-- Get all type and type class names referenced by a type instance declaration.
99+--
100+typeInstanceConstituents :: Declaration -> [Either (Qualified (ProperName 'ClassName)) (Qualified (ProperName 'TypeName))]
101+typeInstanceConstituents (TypeInstanceDeclaration _ constraints className tys _) =
102+ Left className : (concatMap fromConstraint constraints ++ concatMap fromType tys)
103+ where
104+
105+ fromConstraint c = Left (constraintClass c) : concatMap fromType (constraintArgs c)
106+ fromType = everythingOnTypes (++) go
107+
108+ -- Note that type synonyms are disallowed in instance declarations, so
109+ -- we don't need to handle them here.
110+ go (TypeConstructor n) = [Right n]
111+ go (ConstrainedType cs _) = concatMap fromConstraint cs
112+ go _ = []
113+
114+typeInstanceConstituents (PositionedDeclaration _ _ d) = typeInstanceConstituents d
115+typeInstanceConstituents _ = []
116+
117+
118+-- |
119+-- Test if a declaration is exported, given a module's export list. Note that
120+-- this function does not account for type instance declarations of
121+-- non-exported types, or non-exported data constructors. Therefore, you should
122+-- prefer 'exportedDeclarations' to this function, where possible.
123+--
124+isExported :: Maybe [DeclarationRef] -> Declaration -> Bool
125+isExported Nothing _ = True
126+isExported _ TypeInstanceDeclaration{} = True
127+isExported exps (PositionedDeclaration _ _ d) = isExported exps d
128+isExported (Just exps) decl = any (matches decl) exps
129+ where
130+ matches (TypeDeclaration ident _) (ValueRef ident') = ident == ident'
131+ matches (ValueDeclaration ident _ _ _) (ValueRef ident') = ident == ident'
132+ matches (ExternDeclaration ident _) (ValueRef ident') = ident == ident'
133+ matches (DataDeclaration _ ident _ _) (TypeRef ident' _) = ident == ident'
134+ matches (ExternDataDeclaration ident _) (TypeRef ident' _) = ident == ident'
135+ matches (TypeSynonymDeclaration ident _ _) (TypeRef ident' _) = ident == ident'
136+ matches (TypeClassDeclaration ident _ _ _) (TypeClassRef ident') = ident == ident'
137+ matches (ValueFixityDeclaration _ _ op) (ValueOpRef op') = op == op'
138+ matches (TypeFixityDeclaration _ _ op) (TypeOpRef op') = op == op'
139+ matches (PositionedDeclaration _ _ d) r = d `matches` r
140+ matches d (PositionedDeclarationRef _ _ r) = d `matches` r
141+ matches _ _ = False
142+
143+-- |
144+-- Test if a data constructor for a given type is exported, given a module's
145+-- export list. Prefer 'exportedDeclarations' to this function, where possible.
146+--
147+isDctorExported :: ProperName 'TypeName -> Maybe [DeclarationRef] -> ProperName 'ConstructorName -> Bool
148+isDctorExported _ Nothing _ = True
149+isDctorExported ident (Just exps) ctor = test `any` exps
150+ where
151+ test (PositionedDeclarationRef _ _ d) = test d
152+ test (TypeRef ident' Nothing) = ident == ident'
153+ test (TypeRef ident' (Just ctors)) = ident == ident' && ctor `elem` ctors
154+ test _ = False
src/Language/PureScript/AST/Literals.hsnew file+37
@@ -0,0 +1,37 @@
1+-- |
2+-- The core functional representation for literal values.
3+--
4+module Language.PureScript.AST.Literals where
5+
6+import Prelude.Compat
7+
8+-- |
9+-- Data type for literal values. Parameterised so it can be used for Exprs and
10+-- Binders.
11+--
12+data Literal a
13+ -- |
14+ -- A numeric literal
15+ --
16+ = NumericLiteral (Either Integer Double)
17+ -- |
18+ -- A string literal
19+ --
20+ | StringLiteral String
21+ -- |
22+ -- A character literal
23+ --
24+ | CharLiteral Char
25+ -- |
26+ -- A boolean literal
27+ --
28+ | BooleanLiteral Bool
29+ -- |
30+ -- An array literal
31+ --
32+ | ArrayLiteral [a]
33+ -- |
34+ -- An object literal
35+ --
36+ | ObjectLiteral [(String, a)]
37+ deriving (Eq, Ord, Show, Functor)
src/Language/PureScript/AST/Operators.hsnew file+53
@@ -0,0 +1,53 @@
1+{-# LANGUAGE OverloadedStrings #-}
2+
3+-- |
4+-- Operators fixity and associativity
5+--
6+module Language.PureScript.AST.Operators where
7+
8+import Prelude.Compat
9+
10+import Data.Aeson ((.=))
11+import qualified Data.Aeson as A
12+
13+import Language.PureScript.Crash
14+
15+-- |
16+-- A precedence level for an infix operator
17+--
18+type Precedence = Integer
19+
20+-- |
21+-- Associativity for infix operators
22+--
23+data Associativity = Infixl | Infixr | Infix
24+ deriving (Show, Eq, Ord)
25+
26+showAssoc :: Associativity -> String
27+showAssoc Infixl = "infixl"
28+showAssoc Infixr = "infixr"
29+showAssoc Infix = "infix"
30+
31+readAssoc :: String -> Associativity
32+readAssoc "infixl" = Infixl
33+readAssoc "infixr" = Infixr
34+readAssoc "infix" = Infix
35+readAssoc _ = internalError "readAssoc: no parse"
36+
37+instance A.ToJSON Associativity where
38+ toJSON = A.toJSON . showAssoc
39+
40+instance A.FromJSON Associativity where
41+ parseJSON = fmap readAssoc . A.parseJSON
42+
43+-- |
44+-- Fixity data for infix operators
45+--
46+data Fixity = Fixity Associativity Precedence
47+ deriving (Show, Eq, Ord)
48+
49+instance A.ToJSON Fixity where
50+ toJSON (Fixity associativity precedence) =
51+ A.object [ "associativity" .= associativity
52+ , "precedence" .= precedence
53+ ]
src/Language/PureScript/AST/SourcePos.hsnew file+80
@@ -0,0 +1,80 @@
1+{-# LANGUAGE OverloadedStrings #-}
2+
3+-- |
4+-- Source position information
5+--
6+module Language.PureScript.AST.SourcePos where
7+
8+import Prelude.Compat
9+
10+import Data.Aeson ((.=), (.:))
11+import qualified Data.Aeson as A
12+
13+-- |
14+-- Source position information
15+--
16+data SourcePos = SourcePos
17+ { -- |
18+ -- Line number
19+ --
20+ sourcePosLine :: Int
21+ -- |
22+ -- Column number
23+ --
24+ , sourcePosColumn :: Int
25+ } deriving (Show, Eq, Ord)
26+
27+displaySourcePos :: SourcePos -> String
28+displaySourcePos sp =
29+ "line " ++ show (sourcePosLine sp) ++
30+ ", column " ++ show (sourcePosColumn sp)
31+
32+instance A.ToJSON SourcePos where
33+ toJSON SourcePos{..} =
34+ A.toJSON [sourcePosLine, sourcePosColumn]
35+
36+instance A.FromJSON SourcePos where
37+ parseJSON arr = do
38+ [line, col] <- A.parseJSON arr
39+ return $ SourcePos line col
40+
41+data SourceSpan = SourceSpan
42+ { -- |
43+ -- Source name
44+ --
45+ spanName :: String
46+ -- |
47+ -- Start of the span
48+ --
49+ , spanStart :: SourcePos
50+ -- End of the span
51+ --
52+ , spanEnd :: SourcePos
53+ } deriving (Show, Eq, Ord)
54+
55+displayStartEndPos :: SourceSpan -> String
56+displayStartEndPos sp =
57+ displaySourcePos (spanStart sp) ++ " - " ++
58+ displaySourcePos (spanEnd sp)
59+
60+displaySourceSpan :: SourceSpan -> String
61+displaySourceSpan sp =
62+ spanName sp ++ " " ++
63+ displayStartEndPos sp
64+
65+instance A.ToJSON SourceSpan where
66+ toJSON SourceSpan{..} =
67+ A.object [ "name" .= spanName
68+ , "start" .= spanStart
69+ , "end" .= spanEnd
70+ ]
71+
72+instance A.FromJSON SourceSpan where
73+ parseJSON = A.withObject "SourceSpan" $ \o ->
74+ SourceSpan <$>
75+ o .: "name" <*>
76+ o .: "start" <*>
77+ o .: "end"
78+
79+internalModuleSourceSpan :: String -> SourceSpan
80+internalModuleSourceSpan name = SourceSpan name (SourcePos 0 0) (SourcePos 0 0)
src/Language/PureScript/AST/Traversals.hsnew file+588
@@ -0,0 +1,588 @@
1+-- |
2+-- AST traversal helpers
3+--
4+module Language.PureScript.AST.Traversals where
5+
6+import Prelude.Compat
7+
8+import Control.Monad
9+import Control.Arrow ((***), (+++))
10+
11+import Data.Foldable (fold)
12+import Data.List (mapAccumL)
13+import Data.Maybe (mapMaybe)
14+import qualified Data.Set as S
15+
16+import Language.PureScript.AST.Binders
17+import Language.PureScript.AST.Literals
18+import Language.PureScript.AST.Declarations
19+import Language.PureScript.Types
20+import Language.PureScript.Traversals
21+import Language.PureScript.Names
22+
23+everywhereOnValues
24+ :: (Declaration -> Declaration)
25+ -> (Expr -> Expr)
26+ -> (Binder -> Binder)
27+ -> ( Declaration -> Declaration
28+ , Expr -> Expr
29+ , Binder -> Binder
30+ )
31+everywhereOnValues f g h = (f', g', h')
32+ where
33+ f' :: Declaration -> Declaration
34+ f' (DataBindingGroupDeclaration ds) = f (DataBindingGroupDeclaration (map f' ds))
35+ f' (ValueDeclaration name nameKind bs val) = f (ValueDeclaration name nameKind (map h' bs) ((map (g' *** g') +++ g') val))
36+ f' (BindingGroupDeclaration ds) = f (BindingGroupDeclaration (map (\(name, nameKind, val) -> (name, nameKind, g' val)) ds))
37+ f' (TypeClassDeclaration name args implies ds) = f (TypeClassDeclaration name args implies (map f' ds))
38+ f' (TypeInstanceDeclaration name cs className args ds) = f (TypeInstanceDeclaration name cs className args (mapTypeInstanceBody (map f') ds))
39+ f' (PositionedDeclaration pos com d) = f (PositionedDeclaration pos com (f' d))
40+ f' other = f other
41+
42+ g' :: Expr -> Expr
43+ g' (Literal l) = g (Literal (lit g' l))
44+ g' (UnaryMinus v) = g (UnaryMinus (g' v))
45+ g' (BinaryNoParens op v1 v2) = g (BinaryNoParens (g' op) (g' v1) (g' v2))
46+ g' (Parens v) = g (Parens (g' v))
47+ g' (TypeClassDictionaryConstructorApp name v) = g (TypeClassDictionaryConstructorApp name (g' v))
48+ g' (Accessor prop v) = g (Accessor prop (g' v))
49+ g' (ObjectUpdate obj vs) = g (ObjectUpdate (g' obj) (map (fmap g') vs))
50+ g' (Abs name v) = g (Abs name (g' v))
51+ g' (App v1 v2) = g (App (g' v1) (g' v2))
52+ g' (IfThenElse v1 v2 v3) = g (IfThenElse (g' v1) (g' v2) (g' v3))
53+ g' (Case vs alts) = g (Case (map g' vs) (map handleCaseAlternative alts))
54+ g' (TypedValue check v ty) = g (TypedValue check (g' v) ty)
55+ g' (Let ds v) = g (Let (map f' ds) (g' v))
56+ g' (Do es) = g (Do (map handleDoNotationElement es))
57+ g' (PositionedValue pos com v) = g (PositionedValue pos com (g' v))
58+ g' other = g other
59+
60+ h' :: Binder -> Binder
61+ h' (ConstructorBinder ctor bs) = h (ConstructorBinder ctor (map h' bs))
62+ h' (BinaryNoParensBinder b1 b2 b3) = h (BinaryNoParensBinder (h' b1) (h' b2) (h' b3))
63+ h' (ParensInBinder b) = h (ParensInBinder (h' b))
64+ h' (LiteralBinder l) = h (LiteralBinder (lit h' l))
65+ h' (NamedBinder name b) = h (NamedBinder name (h' b))
66+ h' (PositionedBinder pos com b) = h (PositionedBinder pos com (h' b))
67+ h' (TypedBinder t b) = h (TypedBinder t (h' b))
68+ h' other = h other
69+
70+ lit :: (a -> a) -> Literal a -> Literal a
71+ lit go (ArrayLiteral as) = ArrayLiteral (map go as)
72+ lit go (ObjectLiteral as) = ObjectLiteral (map (fmap go) as)
73+ lit _ other = other
74+
75+ handleCaseAlternative :: CaseAlternative -> CaseAlternative
76+ handleCaseAlternative ca =
77+ ca { caseAlternativeBinders = map h' (caseAlternativeBinders ca)
78+ , caseAlternativeResult = (map (g' *** g') +++ g') (caseAlternativeResult ca)
79+ }
80+
81+ handleDoNotationElement :: DoNotationElement -> DoNotationElement
82+ handleDoNotationElement (DoNotationValue v) = DoNotationValue (g' v)
83+ handleDoNotationElement (DoNotationBind b v) = DoNotationBind (h' b) (g' v)
84+ handleDoNotationElement (DoNotationLet ds) = DoNotationLet (map f' ds)
85+ handleDoNotationElement (PositionedDoNotationElement pos com e) = PositionedDoNotationElement pos com (handleDoNotationElement e)
86+
87+everywhereOnValuesTopDownM
88+ :: forall m
89+ . (Monad m)
90+ => (Declaration -> m Declaration)
91+ -> (Expr -> m Expr)
92+ -> (Binder -> m Binder)
93+ -> ( Declaration -> m Declaration
94+ , Expr -> m Expr
95+ , Binder -> m Binder
96+ )
97+everywhereOnValuesTopDownM f g h = (f' <=< f, g' <=< g, h' <=< h)
98+ where
99+
100+ f' :: Declaration -> m Declaration
101+ f' (DataBindingGroupDeclaration ds) = DataBindingGroupDeclaration <$> traverse (f' <=< f) ds
102+ f' (ValueDeclaration name nameKind bs val) = ValueDeclaration name nameKind <$> traverse (h' <=< h) bs <*> eitherM (traverse (pairM (g' <=< g) (g' <=< g))) (g' <=< g) val
103+ f' (BindingGroupDeclaration ds) = BindingGroupDeclaration <$> traverse (\(name, nameKind, val) -> (,,) name nameKind <$> (g val >>= g')) ds
104+ f' (TypeClassDeclaration name args implies ds) = TypeClassDeclaration name args implies <$> traverse (f' <=< f) ds
105+ f' (TypeInstanceDeclaration name cs className args ds) = TypeInstanceDeclaration name cs className args <$> traverseTypeInstanceBody (traverse (f' <=< f)) ds
106+ f' (PositionedDeclaration pos com d) = PositionedDeclaration pos com <$> (f d >>= f')
107+ f' other = f other
108+
109+ g' :: Expr -> m Expr
110+ g' (Literal l) = Literal <$> lit (g >=> g') l
111+ g' (UnaryMinus v) = UnaryMinus <$> (g v >>= g')
112+ g' (BinaryNoParens op v1 v2) = BinaryNoParens <$> (g op >>= g') <*> (g v1 >>= g') <*> (g v2 >>= g')
113+ g' (Parens v) = Parens <$> (g v >>= g')
114+ g' (TypeClassDictionaryConstructorApp name v) = TypeClassDictionaryConstructorApp name <$> (g v >>= g')
115+ g' (Accessor prop v) = Accessor prop <$> (g v >>= g')
116+ g' (ObjectUpdate obj vs) = ObjectUpdate <$> (g obj >>= g') <*> traverse (sndM (g' <=< g)) vs
117+ g' (Abs name v) = Abs name <$> (g v >>= g')
118+ g' (App v1 v2) = App <$> (g v1 >>= g') <*> (g v2 >>= g')
119+ g' (IfThenElse v1 v2 v3) = IfThenElse <$> (g v1 >>= g') <*> (g v2 >>= g') <*> (g v3 >>= g')
120+ g' (Case vs alts) = Case <$> traverse (g' <=< g) vs <*> traverse handleCaseAlternative alts
121+ g' (TypedValue check v ty) = TypedValue check <$> (g v >>= g') <*> pure ty
122+ g' (Let ds v) = Let <$> traverse (f' <=< f) ds <*> (g v >>= g')
123+ g' (Do es) = Do <$> traverse handleDoNotationElement es
124+ g' (PositionedValue pos com v) = PositionedValue pos com <$> (g v >>= g')
125+ g' other = g other
126+
127+ h' :: Binder -> m Binder
128+ h' (LiteralBinder l) = LiteralBinder <$> lit (h >=> h') l
129+ h' (ConstructorBinder ctor bs) = ConstructorBinder ctor <$> traverse (h' <=< h) bs
130+ h' (BinaryNoParensBinder b1 b2 b3) = BinaryNoParensBinder <$> (h b1 >>= h') <*> (h b2 >>= h') <*> (h b3 >>= h')
131+ h' (ParensInBinder b) = ParensInBinder <$> (h b >>= h')
132+ h' (NamedBinder name b) = NamedBinder name <$> (h b >>= h')
133+ h' (PositionedBinder pos com b) = PositionedBinder pos com <$> (h b >>= h')
134+ h' (TypedBinder t b) = TypedBinder t <$> (h b >>= h')
135+ h' other = h other
136+
137+ lit :: (a -> m a) -> Literal a -> m (Literal a)
138+ lit go (ObjectLiteral as) = ObjectLiteral <$> traverse (sndM go) as
139+ lit go (ArrayLiteral as) = ArrayLiteral <$> traverse go as
140+ lit _ other = pure other
141+
142+ handleCaseAlternative :: CaseAlternative -> m CaseAlternative
143+ handleCaseAlternative (CaseAlternative bs val) =
144+ CaseAlternative
145+ <$> traverse (h' <=< h) bs
146+ <*> eitherM (traverse (pairM (g' <=< g) (g' <=< g))) (g' <=< g) val
147+
148+ handleDoNotationElement :: DoNotationElement -> m DoNotationElement
149+ handleDoNotationElement (DoNotationValue v) = DoNotationValue <$> (g' <=< g) v
150+ handleDoNotationElement (DoNotationBind b v) = DoNotationBind <$> (h' <=< h) b <*> (g' <=< g) v
151+ handleDoNotationElement (DoNotationLet ds) = DoNotationLet <$> traverse (f' <=< f) ds
152+ handleDoNotationElement (PositionedDoNotationElement pos com e) = PositionedDoNotationElement pos com <$> handleDoNotationElement e
153+
154+everywhereOnValuesM
155+ :: forall m
156+ . (Monad m)
157+ => (Declaration -> m Declaration)
158+ -> (Expr -> m Expr)
159+ -> (Binder -> m Binder)
160+ -> ( Declaration -> m Declaration
161+ , Expr -> m Expr
162+ , Binder -> m Binder
163+ )
164+everywhereOnValuesM f g h = (f', g', h')
165+ where
166+
167+ f' :: Declaration -> m Declaration
168+ f' (DataBindingGroupDeclaration ds) = (DataBindingGroupDeclaration <$> traverse f' ds) >>= f
169+ f' (ValueDeclaration name nameKind bs val) = (ValueDeclaration name nameKind <$> traverse h' bs <*> eitherM (traverse (pairM g' g')) g' val) >>= f
170+ f' (BindingGroupDeclaration ds) = (BindingGroupDeclaration <$> traverse (\(name, nameKind, val) -> (,,) name nameKind <$> g' val) ds) >>= f
171+ f' (TypeClassDeclaration name args implies ds) = (TypeClassDeclaration name args implies <$> traverse f' ds) >>= f
172+ f' (TypeInstanceDeclaration name cs className args ds) = (TypeInstanceDeclaration name cs className args <$> traverseTypeInstanceBody (traverse f') ds) >>= f
173+ f' (PositionedDeclaration pos com d) = (PositionedDeclaration pos com <$> f' d) >>= f
174+ f' other = f other
175+
176+ g' :: Expr -> m Expr
177+ g' (Literal l) = (Literal <$> lit g' l) >>= g
178+ g' (UnaryMinus v) = (UnaryMinus <$> g' v) >>= g
179+ g' (BinaryNoParens op v1 v2) = (BinaryNoParens <$> g' op <*> g' v1 <*> g' v2) >>= g
180+ g' (Parens v) = (Parens <$> g' v) >>= g
181+ g' (TypeClassDictionaryConstructorApp name v) = (TypeClassDictionaryConstructorApp name <$> g' v) >>= g
182+ g' (Accessor prop v) = (Accessor prop <$> g' v) >>= g
183+ g' (ObjectUpdate obj vs) = (ObjectUpdate <$> g' obj <*> traverse (sndM g') vs) >>= g
184+ g' (Abs name v) = (Abs name <$> g' v) >>= g
185+ g' (App v1 v2) = (App <$> g' v1 <*> g' v2) >>= g
186+ g' (IfThenElse v1 v2 v3) = (IfThenElse <$> g' v1 <*> g' v2 <*> g' v3) >>= g
187+ g' (Case vs alts) = (Case <$> traverse g' vs <*> traverse handleCaseAlternative alts) >>= g
188+ g' (TypedValue check v ty) = (TypedValue check <$> g' v <*> pure ty) >>= g
189+ g' (Let ds v) = (Let <$> traverse f' ds <*> g' v) >>= g
190+ g' (Do es) = (Do <$> traverse handleDoNotationElement es) >>= g
191+ g' (PositionedValue pos com v) = (PositionedValue pos com <$> g' v) >>= g
192+ g' other = g other
193+
194+ h' :: Binder -> m Binder
195+ h' (LiteralBinder l) = (LiteralBinder <$> lit h' l) >>= h
196+ h' (ConstructorBinder ctor bs) = (ConstructorBinder ctor <$> traverse h' bs) >>= h
197+ h' (BinaryNoParensBinder b1 b2 b3) = (BinaryNoParensBinder <$> h' b1 <*> h' b2 <*> h' b3) >>= h
198+ h' (ParensInBinder b) = (ParensInBinder <$> h' b) >>= h
199+ h' (NamedBinder name b) = (NamedBinder name <$> h' b) >>= h
200+ h' (PositionedBinder pos com b) = (PositionedBinder pos com <$> h' b) >>= h
201+ h' (TypedBinder t b) = (TypedBinder t <$> h' b) >>= h
202+ h' other = h other
203+
204+ lit :: (a -> m a) -> Literal a -> m (Literal a)
205+ lit go (ObjectLiteral as) = ObjectLiteral <$> traverse (sndM go) as
206+ lit go (ArrayLiteral as) = ArrayLiteral <$> traverse go as
207+ lit _ other = pure other
208+
209+ handleCaseAlternative :: CaseAlternative -> m CaseAlternative
210+ handleCaseAlternative (CaseAlternative bs val) =
211+ CaseAlternative
212+ <$> traverse h' bs
213+ <*> eitherM (traverse (pairM g' g')) g' val
214+
215+ handleDoNotationElement :: DoNotationElement -> m DoNotationElement
216+ handleDoNotationElement (DoNotationValue v) = DoNotationValue <$> g' v
217+ handleDoNotationElement (DoNotationBind b v) = DoNotationBind <$> h' b <*> g' v
218+ handleDoNotationElement (DoNotationLet ds) = DoNotationLet <$> traverse f' ds
219+ handleDoNotationElement (PositionedDoNotationElement pos com e) = PositionedDoNotationElement pos com <$> handleDoNotationElement e
220+
221+everythingOnValues
222+ :: forall r
223+ . (r -> r -> r)
224+ -> (Declaration -> r)
225+ -> (Expr -> r)
226+ -> (Binder -> r)
227+ -> (CaseAlternative -> r)
228+ -> (DoNotationElement -> r)
229+ -> ( Declaration -> r
230+ , Expr -> r
231+ , Binder -> r
232+ , CaseAlternative -> r
233+ , DoNotationElement -> r
234+ )
235+everythingOnValues (<>) f g h i j = (f', g', h', i', j')
236+ where
237+
238+ f' :: Declaration -> r
239+ f' d@(DataBindingGroupDeclaration ds) = foldl (<>) (f d) (map f' ds)
240+ f' d@(ValueDeclaration _ _ bs (Right val)) = foldl (<>) (f d) (map h' bs) <> g' val
241+ f' d@(ValueDeclaration _ _ bs (Left gs)) = foldl (<>) (f d) (map h' bs ++ concatMap (\(grd, val) -> [g' grd, g' val]) gs)
242+ f' d@(BindingGroupDeclaration ds) = foldl (<>) (f d) (map (\(_, _, val) -> g' val) ds)
243+ f' d@(TypeClassDeclaration _ _ _ ds) = foldl (<>) (f d) (map f' ds)
244+ f' d@(TypeInstanceDeclaration _ _ _ _ (ExplicitInstance ds)) = foldl (<>) (f d) (map f' ds)
245+ f' d@(PositionedDeclaration _ _ d1) = f d <> f' d1
246+ f' d = f d
247+
248+ g' :: Expr -> r
249+ g' v@(Literal l) = lit (g v) g' l
250+ g' v@(UnaryMinus v1) = g v <> g' v1
251+ g' v@(BinaryNoParens op v1 v2) = g v <> g' op <> g' v1 <> g' v2
252+ g' v@(Parens v1) = g v <> g' v1
253+ g' v@(TypeClassDictionaryConstructorApp _ v1) = g v <> g' v1
254+ g' v@(Accessor _ v1) = g v <> g' v1
255+ g' v@(ObjectUpdate obj vs) = foldl (<>) (g v <> g' obj) (map (g' . snd) vs)
256+ g' v@(Abs _ v1) = g v <> g' v1
257+ g' v@(App v1 v2) = g v <> g' v1 <> g' v2
258+ g' v@(IfThenElse v1 v2 v3) = g v <> g' v1 <> g' v2 <> g' v3
259+ g' v@(Case vs alts) = foldl (<>) (foldl (<>) (g v) (map g' vs)) (map i' alts)
260+ g' v@(TypedValue _ v1 _) = g v <> g' v1
261+ g' v@(Let ds v1) = foldl (<>) (g v) (map f' ds) <> g' v1
262+ g' v@(Do es) = foldl (<>) (g v) (map j' es)
263+ g' v@(PositionedValue _ _ v1) = g v <> g' v1
264+ g' v = g v
265+
266+ h' :: Binder -> r
267+ h' b@(LiteralBinder l) = lit (h b) h' l
268+ h' b@(ConstructorBinder _ bs) = foldl (<>) (h b) (map h' bs)
269+ h' b@(BinaryNoParensBinder b1 b2 b3) = h b <> h' b1 <> h' b2 <> h' b3
270+ h' b@(ParensInBinder b1) = h b <> h' b1
271+ h' b@(NamedBinder _ b1) = h b <> h' b1
272+ h' b@(PositionedBinder _ _ b1) = h b <> h' b1
273+ h' b@(TypedBinder _ b1) = h b <> h' b1
274+ h' b = h b
275+
276+ lit :: r -> (a -> r) -> Literal a -> r
277+ lit r go (ArrayLiteral as) = foldl (<>) r (map go as)
278+ lit r go (ObjectLiteral as) = foldl (<>) r (map (go . snd) as)
279+ lit r _ _ = r
280+
281+ i' :: CaseAlternative -> r
282+ i' ca@(CaseAlternative bs (Right val)) = foldl (<>) (i ca) (map h' bs) <> g' val
283+ i' ca@(CaseAlternative bs (Left gs)) = foldl (<>) (i ca) (map h' bs ++ concatMap (\(grd, val) -> [g' grd, g' val]) gs)
284+
285+ j' :: DoNotationElement -> r
286+ j' e@(DoNotationValue v) = j e <> g' v
287+ j' e@(DoNotationBind b v) = j e <> h' b <> g' v
288+ j' e@(DoNotationLet ds) = foldl (<>) (j e) (map f' ds)
289+ j' e@(PositionedDoNotationElement _ _ e1) = j e <> j' e1
290+
291+everythingWithContextOnValues
292+ :: forall s r
293+ . s
294+ -> r
295+ -> (r -> r -> r)
296+ -> (s -> Declaration -> (s, r))
297+ -> (s -> Expr -> (s, r))
298+ -> (s -> Binder -> (s, r))
299+ -> (s -> CaseAlternative -> (s, r))
300+ -> (s -> DoNotationElement -> (s, r))
301+ -> ( Declaration -> r
302+ , Expr -> r
303+ , Binder -> r
304+ , CaseAlternative -> r
305+ , DoNotationElement -> r)
306+everythingWithContextOnValues s0 r0 (<>) f g h i j = (f'' s0, g'' s0, h'' s0, i'' s0, j'' s0)
307+ where
308+
309+ f'' :: s -> Declaration -> r
310+ f'' s d = let (s', r) = f s d in r <> f' s' d
311+
312+ f' :: s -> Declaration -> r
313+ f' s (DataBindingGroupDeclaration ds) = foldl (<>) r0 (map (f'' s) ds)
314+ f' s (ValueDeclaration _ _ bs (Right val)) = foldl (<>) r0 (map (h'' s) bs) <> g'' s val
315+ f' s (ValueDeclaration _ _ bs (Left gs)) = foldl (<>) r0 (map (h'' s) bs ++ concatMap (\(grd, val) -> [g'' s grd, g'' s val]) gs)
316+ f' s (BindingGroupDeclaration ds) = foldl (<>) r0 (map (\(_, _, val) -> g'' s val) ds)
317+ f' s (TypeClassDeclaration _ _ _ ds) = foldl (<>) r0 (map (f'' s) ds)
318+ f' s (TypeInstanceDeclaration _ _ _ _ (ExplicitInstance ds)) = foldl (<>) r0 (map (f'' s) ds)
319+ f' s (PositionedDeclaration _ _ d1) = f'' s d1
320+ f' _ _ = r0
321+
322+ g'' :: s -> Expr -> r
323+ g'' s v = let (s', r) = g s v in r <> g' s' v
324+
325+ g' :: s -> Expr -> r
326+ g' s (Literal l) = lit g'' s l
327+ g' s (UnaryMinus v1) = g'' s v1
328+ g' s (BinaryNoParens op v1 v2) = g'' s op <> g'' s v1 <> g'' s v2
329+ g' s (Parens v1) = g'' s v1
330+ g' s (TypeClassDictionaryConstructorApp _ v1) = g'' s v1
331+ g' s (Accessor _ v1) = g'' s v1
332+ g' s (ObjectUpdate obj vs) = foldl (<>) (g'' s obj) (map (g'' s . snd) vs)
333+ g' s (Abs _ v1) = g'' s v1
334+ g' s (App v1 v2) = g'' s v1 <> g'' s v2
335+ g' s (IfThenElse v1 v2 v3) = g'' s v1 <> g'' s v2 <> g'' s v3
336+ g' s (Case vs alts) = foldl (<>) (foldl (<>) r0 (map (g'' s) vs)) (map (i'' s) alts)
337+ g' s (TypedValue _ v1 _) = g'' s v1
338+ g' s (Let ds v1) = foldl (<>) r0 (map (f'' s) ds) <> g'' s v1
339+ g' s (Do es) = foldl (<>) r0 (map (j'' s) es)
340+ g' s (PositionedValue _ _ v1) = g'' s v1
341+ g' _ _ = r0
342+
343+ h'' :: s -> Binder -> r
344+ h'' s b = let (s', r) = h s b in r <> h' s' b
345+
346+ h' :: s -> Binder -> r
347+ h' s (LiteralBinder l) = lit h'' s l
348+ h' s (ConstructorBinder _ bs) = foldl (<>) r0 (map (h'' s) bs)
349+ h' s (BinaryNoParensBinder b1 b2 b3) = h'' s b1 <> h'' s b2 <> h'' s b3
350+ h' s (ParensInBinder b) = h'' s b
351+ h' s (NamedBinder _ b1) = h'' s b1
352+ h' s (PositionedBinder _ _ b1) = h'' s b1
353+ h' s (TypedBinder _ b1) = h'' s b1
354+ h' _ _ = r0
355+
356+ lit :: (s -> a -> r) -> s -> Literal a -> r
357+ lit go s (ArrayLiteral as) = foldl (<>) r0 (map (go s) as)
358+ lit go s (ObjectLiteral as) = foldl (<>) r0 (map (go s . snd) as)
359+ lit _ _ _ = r0
360+
361+ i'' :: s -> CaseAlternative -> r
362+ i'' s ca = let (s', r) = i s ca in r <> i' s' ca
363+
364+ i' :: s -> CaseAlternative -> r
365+ i' s (CaseAlternative bs (Right val)) = foldl (<>) r0 (map (h'' s) bs) <> g'' s val
366+ i' s (CaseAlternative bs (Left gs)) = foldl (<>) r0 (map (h'' s) bs ++ concatMap (\(grd, val) -> [g'' s grd, g'' s val]) gs)
367+
368+ j'' :: s -> DoNotationElement -> r
369+ j'' s e = let (s', r) = j s e in r <> j' s' e
370+
371+ j' :: s -> DoNotationElement -> r
372+ j' s (DoNotationValue v) = g'' s v
373+ j' s (DoNotationBind b v) = h'' s b <> g'' s v
374+ j' s (DoNotationLet ds) = foldl (<>) r0 (map (f'' s) ds)
375+ j' s (PositionedDoNotationElement _ _ e1) = j'' s e1
376+
377+everywhereWithContextOnValuesM
378+ :: forall m s
379+ . (Monad m)
380+ => s
381+ -> (s -> Declaration -> m (s, Declaration))
382+ -> (s -> Expr -> m (s, Expr))
383+ -> (s -> Binder -> m (s, Binder))
384+ -> (s -> CaseAlternative -> m (s, CaseAlternative))
385+ -> (s -> DoNotationElement -> m (s, DoNotationElement))
386+ -> ( Declaration -> m Declaration
387+ , Expr -> m Expr
388+ , Binder -> m Binder
389+ , CaseAlternative -> m CaseAlternative
390+ , DoNotationElement -> m DoNotationElement)
391+everywhereWithContextOnValuesM s0 f g h i j = (f'' s0, g'' s0, h'' s0, i'' s0, j'' s0)
392+ where
393+ f'' s = uncurry f' <=< f s
394+
395+ f' s (DataBindingGroupDeclaration ds) = DataBindingGroupDeclaration <$> traverse (f'' s) ds
396+ f' s (ValueDeclaration name nameKind bs val) = ValueDeclaration name nameKind <$> traverse (h'' s) bs <*> eitherM (traverse (pairM (g'' s) (g'' s))) (g'' s) val
397+ f' s (BindingGroupDeclaration ds) = BindingGroupDeclaration <$> traverse (thirdM (g'' s)) ds
398+ f' s (TypeClassDeclaration name args implies ds) = TypeClassDeclaration name args implies <$> traverse (f'' s) ds
399+ f' s (TypeInstanceDeclaration name cs className args ds) = TypeInstanceDeclaration name cs className args <$> traverseTypeInstanceBody (traverse (f'' s)) ds
400+ f' s (PositionedDeclaration pos com d1) = PositionedDeclaration pos com <$> f'' s d1
401+ f' _ other = return other
402+
403+ g'' s = uncurry g' <=< g s
404+
405+ g' s (Literal l) = Literal <$> lit g'' s l
406+ g' s (UnaryMinus v) = UnaryMinus <$> g'' s v
407+ g' s (BinaryNoParens op v1 v2) = BinaryNoParens <$> g'' s op <*> g'' s v1 <*> g'' s v2
408+ g' s (Parens v) = Parens <$> g'' s v
409+ g' s (TypeClassDictionaryConstructorApp name v) = TypeClassDictionaryConstructorApp name <$> g'' s v
410+ g' s (Accessor prop v) = Accessor prop <$> g'' s v
411+ g' s (ObjectUpdate obj vs) = ObjectUpdate <$> g'' s obj <*> traverse (sndM (g'' s)) vs
412+ g' s (Abs name v) = Abs name <$> g'' s v
413+ g' s (App v1 v2) = App <$> g'' s v1 <*> g'' s v2
414+ g' s (IfThenElse v1 v2 v3) = IfThenElse <$> g'' s v1 <*> g'' s v2 <*> g'' s v3
415+ g' s (Case vs alts) = Case <$> traverse (g'' s) vs <*> traverse (i'' s) alts
416+ g' s (TypedValue check v ty) = TypedValue check <$> g'' s v <*> pure ty
417+ g' s (Let ds v) = Let <$> traverse (f'' s) ds <*> g'' s v
418+ g' s (Do es) = Do <$> traverse (j'' s) es
419+ g' s (PositionedValue pos com v) = PositionedValue pos com <$> g'' s v
420+ g' _ other = return other
421+
422+ h'' s = uncurry h' <=< h s
423+
424+ h' s (LiteralBinder l) = LiteralBinder <$> lit h'' s l
425+ h' s (ConstructorBinder ctor bs) = ConstructorBinder ctor <$> traverse (h'' s) bs
426+ h' s (BinaryNoParensBinder b1 b2 b3) = BinaryNoParensBinder <$> h'' s b1 <*> h'' s b2 <*> h'' s b3
427+ h' s (ParensInBinder b) = ParensInBinder <$> h'' s b
428+ h' s (NamedBinder name b) = NamedBinder name <$> h'' s b
429+ h' s (PositionedBinder pos com b) = PositionedBinder pos com <$> h'' s b
430+ h' s (TypedBinder t b) = TypedBinder t <$> h'' s b
431+ h' _ other = return other
432+
433+ lit :: (s -> a -> m a) -> s -> Literal a -> m (Literal a)
434+ lit go s (ArrayLiteral as) = ArrayLiteral <$> traverse (go s) as
435+ lit go s (ObjectLiteral as) = ObjectLiteral <$> traverse (sndM (go s)) as
436+ lit _ _ other = return other
437+
438+ i'' s = uncurry i' <=< i s
439+
440+ i' s (CaseAlternative bs val) = CaseAlternative <$> traverse (h'' s) bs <*> eitherM (traverse (pairM (g'' s) (g'' s))) (g'' s) val
441+
442+ j'' s = uncurry j' <=< j s
443+
444+ j' s (DoNotationValue v) = DoNotationValue <$> g'' s v
445+ j' s (DoNotationBind b v) = DoNotationBind <$> h'' s b <*> g'' s v
446+ j' s (DoNotationLet ds) = DoNotationLet <$> traverse (f'' s) ds
447+ j' s (PositionedDoNotationElement pos com e1) = PositionedDoNotationElement pos com <$> j'' s e1
448+
449+everythingWithScope
450+ :: forall r
451+ . (Monoid r)
452+ => (S.Set Ident -> Declaration -> r)
453+ -> (S.Set Ident -> Expr -> r)
454+ -> (S.Set Ident -> Binder -> r)
455+ -> (S.Set Ident -> CaseAlternative -> r)
456+ -> (S.Set Ident -> DoNotationElement -> r)
457+ -> ( S.Set Ident -> Declaration -> r
458+ , S.Set Ident -> Expr -> r
459+ , S.Set Ident -> Binder -> r
460+ , S.Set Ident -> CaseAlternative -> r
461+ , S.Set Ident -> DoNotationElement -> r
462+ )
463+everythingWithScope f g h i j = (f'', g'', h'', i'', \s -> snd . j'' s)
464+ where
465+ -- Avoid importing Data.Monoid and getting shadowed names above
466+ (<>) = mappend
467+
468+ f'' :: S.Set Ident -> Declaration -> r
469+ f'' s a = f s a <> f' s a
470+
471+ f' :: S.Set Ident -> Declaration -> r
472+ f' s (DataBindingGroupDeclaration ds) =
473+ let s' = S.union s (S.fromList (mapMaybe getDeclIdent ds))
474+ in foldMap (f'' s') ds
475+ f' s (ValueDeclaration name _ bs (Right val)) =
476+ let s' = S.insert name s
477+ in foldMap (h'' s') bs <> g'' s' val
478+ f' s (ValueDeclaration name _ bs (Left gs)) =
479+ let s' = S.insert name s
480+ s'' = S.union s' (S.fromList (concatMap binderNames bs))
481+ in foldMap (h'' s') bs <> foldMap (\(grd, val) -> g'' s'' grd <> g'' s'' val) gs
482+ f' s (BindingGroupDeclaration ds) =
483+ let s' = S.union s (S.fromList (map (\(name, _, _) -> name) ds))
484+ in foldMap (\(_, _, val) -> g'' s' val) ds
485+ f' s (TypeClassDeclaration _ _ _ ds) = foldMap (f'' s) ds
486+ f' s (TypeInstanceDeclaration _ _ _ _ (ExplicitInstance ds)) = foldMap (f'' s) ds
487+ f' s (PositionedDeclaration _ _ d) = f'' s d
488+ f' _ _ = mempty
489+
490+ g'' :: S.Set Ident -> Expr -> r
491+ g'' s a = g s a <> g' s a
492+
493+ g' :: S.Set Ident -> Expr -> r
494+ g' s (Literal l) = lit g'' s l
495+ g' s (UnaryMinus v1) = g'' s v1
496+ g' s (BinaryNoParens op v1 v2) = g'' s op <> g'' s v1 <> g'' s v2
497+ g' s (Parens v1) = g'' s v1
498+ g' s (TypeClassDictionaryConstructorApp _ v1) = g'' s v1
499+ g' s (Accessor _ v1) = g'' s v1
500+ g' s (ObjectUpdate obj vs) = g'' s obj <> foldMap (g'' s . snd) vs
501+ g' s (Abs (Left name) v1) =
502+ let s' = S.insert name s
503+ in g'' s' v1
504+ g' s (Abs (Right b) v1) =
505+ let s' = S.union (S.fromList (binderNames b)) s
506+ in g'' s' v1
507+ g' s (App v1 v2) = g'' s v1 <> g'' s v2
508+ g' s (IfThenElse v1 v2 v3) = g'' s v1 <> g'' s v2 <> g'' s v3
509+ g' s (Case vs alts) = foldMap (g'' s) vs <> foldMap (i'' s) alts
510+ g' s (TypedValue _ v1 _) = g'' s v1
511+ g' s (Let ds v1) =
512+ let s' = S.union s (S.fromList (mapMaybe getDeclIdent ds))
513+ in foldMap (f'' s') ds <> g'' s' v1
514+ g' s (Do es) = fold . snd . mapAccumL j'' s $ es
515+ g' s (PositionedValue _ _ v1) = g'' s v1
516+ g' _ _ = mempty
517+
518+ h'' :: S.Set Ident -> Binder -> r
519+ h'' s a = h s a <> h' s a
520+
521+ h' :: S.Set Ident -> Binder -> r
522+ h' s (LiteralBinder l) = lit h'' s l
523+ h' s (ConstructorBinder _ bs) = foldMap (h'' s) bs
524+ h' s (BinaryNoParensBinder b1 b2 b3) = foldMap (h'' s) [b1, b2, b3]
525+ h' s (ParensInBinder b) = h'' s b
526+ h' s (NamedBinder name b1) = h'' (S.insert name s) b1
527+ h' s (PositionedBinder _ _ b1) = h'' s b1
528+ h' s (TypedBinder _ b1) = h'' s b1
529+ h' _ _ = mempty
530+
531+ lit :: (S.Set Ident -> a -> r) -> S.Set Ident -> Literal a -> r
532+ lit go s (ArrayLiteral as) = foldMap (go s) as
533+ lit go s (ObjectLiteral as) = foldMap (go s . snd) as
534+ lit _ _ _ = mempty
535+
536+ i'' :: S.Set Ident -> CaseAlternative -> r
537+ i'' s a = i s a <> i' s a
538+
539+ i' :: S.Set Ident -> CaseAlternative -> r
540+ i' s (CaseAlternative bs (Right val)) =
541+ let s' = S.union s (S.fromList (concatMap binderNames bs))
542+ in foldMap (h'' s) bs <> g'' s' val
543+ i' s (CaseAlternative bs (Left gs)) =
544+ let s' = S.union s (S.fromList (concatMap binderNames bs))
545+ in foldMap (h'' s) bs <> foldMap (\(grd, val) -> g'' s' grd <> g'' s' val) gs
546+
547+ j'' :: S.Set Ident -> DoNotationElement -> (S.Set Ident, r)
548+ j'' s a = let (s', r) = j' s a in (s', j s a <> r)
549+
550+ j' :: S.Set Ident -> DoNotationElement -> (S.Set Ident, r)
551+ j' s (DoNotationValue v) = (s, g'' s v)
552+ j' s (DoNotationBind b v) =
553+ let s' = S.union (S.fromList (binderNames b)) s
554+ in (s', h'' s b <> g'' s' v)
555+ j' s (DoNotationLet ds) =
556+ let s' = S.union s (S.fromList (mapMaybe getDeclIdent ds))
557+ in (s', foldMap (f'' s') ds)
558+ j' s (PositionedDoNotationElement _ _ e1) = j'' s e1
559+
560+ getDeclIdent :: Declaration -> Maybe Ident
561+ getDeclIdent (PositionedDeclaration _ _ d) = getDeclIdent d
562+ getDeclIdent (ValueDeclaration ident _ _ _) = Just ident
563+ getDeclIdent (TypeDeclaration ident _) = Just ident
564+ getDeclIdent _ = Nothing
565+
566+accumTypes
567+ :: (Monoid r)
568+ => (Type -> r)
569+ -> ( Declaration -> r
570+ , Expr -> r
571+ , Binder -> r
572+ , CaseAlternative -> r
573+ , DoNotationElement -> r
574+ )
575+accumTypes f = everythingOnValues mappend forDecls forValues (const mempty) (const mempty) (const mempty)
576+ where
577+ forDecls (DataDeclaration _ _ _ dctors) = mconcat (concatMap (map f . snd) dctors)
578+ forDecls (ExternDeclaration _ ty) = f ty
579+ forDecls (TypeClassDeclaration _ _ implies _) = mconcat (concatMap (map f . constraintArgs) implies)
580+ forDecls (TypeInstanceDeclaration _ cs _ tys _) = mconcat (concatMap (map f . constraintArgs) cs) `mappend` mconcat (map f tys)
581+ forDecls (TypeSynonymDeclaration _ _ ty) = f ty
582+ forDecls (TypeDeclaration _ ty) = f ty
583+ forDecls _ = mempty
584+
585+ forValues (TypeClassDictionary c _ _) = mconcat (map f (constraintArgs c))
586+ forValues (SuperClassDictionary _ tys) = mconcat (map f tys)
587+ forValues (TypedValue _ _ ty) = f ty
588+ forValues _ = mempty
src/Language/PureScript/Bundle.hsnew file+623
@@ -0,0 +1,623 @@
1+-- |
2+-- Bundles compiled PureScript modules for the browser.
3+--
4+-- This module takes as input the individual generated modules from 'Language.PureScript.Make' and
5+-- performs dead code elimination, filters empty modules,
6+-- and generates the final Javascript bundle.
7+module Language.PureScript.Bundle
8+ ( bundle
9+ , guessModuleIdentifier
10+ , ModuleIdentifier(..)
11+ , moduleName
12+ , ModuleType(..)
13+ , ErrorMessage(..)
14+ , printErrorMessage
15+ , getExportedIdentifiers
16+ ) where
17+
18+import Prelude.Compat
19+
20+import Control.Monad
21+import Control.Monad.Error.Class
22+
23+import Data.Char (chr, digitToInt)
24+import Data.Generics (everything, everywhere, mkQ, mkT)
25+import Data.Graph
26+import Data.List (nub, stripPrefix)
27+import Data.Maybe (mapMaybe, catMaybes)
28+import Data.Version (showVersion)
29+import qualified Data.Set as S
30+
31+import Language.JavaScript.Parser
32+import Language.JavaScript.Parser.AST
33+
34+import qualified Paths_purescript as Paths
35+
36+import System.FilePath (takeFileName, takeDirectory)
37+
38+-- | The type of error messages. We separate generation and rendering of errors using a data
39+-- type, in case we need to match on error types later.
40+data ErrorMessage
41+ = UnsupportedModulePath String
42+ | InvalidTopLevel
43+ | UnableToParseModule String
44+ | UnsupportedExport
45+ | ErrorInModule ModuleIdentifier ErrorMessage
46+ deriving (Show)
47+
48+-- | Modules are either "regular modules" (i.e. those generated by psc) or foreign modules.
49+data ModuleType
50+ = Regular
51+ | Foreign
52+ deriving (Show, Eq, Ord)
53+
54+showModuleType :: ModuleType -> String
55+showModuleType Regular = "Regular"
56+showModuleType Foreign = "Foreign"
57+
58+-- | A module is identified by its module name and its type.
59+data ModuleIdentifier = ModuleIdentifier String ModuleType deriving (Show, Eq, Ord)
60+
61+moduleName :: ModuleIdentifier -> String
62+moduleName (ModuleIdentifier name _) = name
63+
64+-- | Given a filename, assuming it is in the correct place on disk, infer a ModuleIdentifier.
65+guessModuleIdentifier :: MonadError ErrorMessage m => FilePath -> m ModuleIdentifier
66+guessModuleIdentifier filename = ModuleIdentifier (takeFileName (takeDirectory filename)) <$> guessModuleType (takeFileName filename)
67+ where
68+ guessModuleType "index.js" = pure Regular
69+ guessModuleType "foreign.js" = pure Foreign
70+ guessModuleType name = throwError $ UnsupportedModulePath name
71+
72+-- | A piece of code is identified by its module and its name. These keys are used to label vertices
73+-- in the dependency graph.
74+type Key = (ModuleIdentifier, String)
75+
76+-- | An export is either a "regular export", which exports a name from the regular module we are in,
77+-- or a reexport of a declaration in the corresponding foreign module.
78+--
79+-- Regular exports are labelled, since they might re-export an operator with another name.
80+data ExportType
81+ = RegularExport String
82+ | ForeignReexport
83+ deriving (Show, Eq, Ord)
84+
85+-- | There are four types of module element we are interested in:
86+--
87+-- 1) Require statements
88+-- 2) Member declarations
89+-- 3) Export lists
90+-- 4) Everything else
91+--
92+-- Each is labelled with the original AST node which generated it, so that we can dump it back
93+-- into the output during codegen.
94+data ModuleElement
95+ = Require JSStatement String (Either String ModuleIdentifier)
96+ | Member JSStatement Bool String JSExpression [Key]
97+ | ExportsList [(ExportType, String, JSExpression, [Key])]
98+ | Other JSStatement
99+ deriving (Show)
100+
101+-- | A module is just a list of elements of the types listed above.
102+data Module = Module ModuleIdentifier [ModuleElement] deriving (Show)
103+
104+-- | Prepare an error message for consumption by humans.
105+printErrorMessage :: ErrorMessage -> [String]
106+printErrorMessage (UnsupportedModulePath s) =
107+ [ "A CommonJS module has an unsupported name (" ++ show s ++ ")."
108+ , "The following file names are supported:"
109+ , " 1) index.js (psc native modules)"
110+ , " 2) foreign.js (psc foreign modules)"
111+ ]
112+printErrorMessage InvalidTopLevel =
113+ [ "Expected a list of source elements at the top level." ]
114+printErrorMessage (UnableToParseModule err) =
115+ [ "The module could not be parsed:"
116+ , err
117+ ]
118+printErrorMessage UnsupportedExport =
119+ [ "An export was unsupported. Exports can be defined in one of two ways: "
120+ , " 1) exports.name = ..."
121+ , " 2) exports = { ... }"
122+ ]
123+printErrorMessage (ErrorInModule mid e) =
124+ ("Error in module " ++ displayIdentifier mid ++ ":")
125+ : ""
126+ : map (" " ++) (printErrorMessage e)
127+ where
128+ displayIdentifier (ModuleIdentifier name ty) =
129+ name ++ " (" ++ showModuleType ty ++ ")"
130+
131+-- | Calculate the ModuleIdentifier which a require(...) statement imports.
132+checkImportPath :: String -> ModuleIdentifier -> S.Set String -> Either String ModuleIdentifier
133+checkImportPath "./foreign" m _ =
134+ Right (ModuleIdentifier (moduleName m) Foreign)
135+checkImportPath name _ names
136+ | Just name' <- stripPrefix "../" name
137+ , name' `S.member` names = Right (ModuleIdentifier name' Regular)
138+checkImportPath name _ _ = Left name
139+
140+-- | Compute the dependencies of all elements in a module, and add them to the tree.
141+--
142+-- Members and exports can have dependencies. A dependency is of one of the following forms:
143+--
144+-- 1) module.name or member["name"]
145+--
146+-- where module was imported using
147+--
148+-- var module = require("Module.Name");
149+--
150+-- 2) name
151+--
152+-- where name is the name of a member defined in the current module.
153+withDeps :: Module -> Module
154+withDeps (Module modulePath es) = Module modulePath (map expandDeps es)
155+ where
156+ -- | Collects all modules which are imported, so that we can identify dependencies of the first type.
157+ imports :: [(String, ModuleIdentifier)]
158+ imports = mapMaybe toImport es
159+ where
160+ toImport :: ModuleElement -> Maybe (String, ModuleIdentifier)
161+ toImport (Require _ nm (Right mid)) = Just (nm, mid)
162+ toImport _ = Nothing
163+
164+ -- | Collects all member names in scope, so that we can identify dependencies of the second type.
165+ boundNames :: [String]
166+ boundNames = mapMaybe toBoundName es
167+ where
168+ toBoundName :: ModuleElement -> Maybe String
169+ toBoundName (Member _ _ nm _ _) = Just nm
170+ toBoundName _ = Nothing
171+
172+ -- | Calculate dependencies and add them to the current element.
173+ expandDeps :: ModuleElement -> ModuleElement
174+ expandDeps (Member n f nm decl _) = Member n f nm decl (nub $ dependencies modulePath decl)
175+ expandDeps (ExportsList exps) = ExportsList (map expand exps)
176+ where
177+ expand (ty, nm, n1, _) = (ty, nm, n1, nub (dependencies modulePath n1))
178+ expandDeps other = other
179+
180+ dependencies :: ModuleIdentifier -> JSExpression -> [(ModuleIdentifier, String)]
181+ dependencies m = everything (++) (mkQ [] toReference)
182+ where
183+ toReference :: JSExpression -> [(ModuleIdentifier, String)]
184+ toReference (JSMemberDot mn _ nm)
185+ | JSIdentifier _ mn' <- mn
186+ , JSIdentifier _ nm' <- nm
187+ , Just mid <- lookup mn' imports
188+ = [(mid, nm')]
189+ toReference (JSMemberSquare mn _ nm _)
190+ | JSIdentifier _ mn' <- mn
191+ , Just nm' <- fromStringLiteral nm
192+ , Just mid <- lookup mn' imports
193+ = [(mid, nm')]
194+ toReference (JSIdentifier _ nm)
195+ | nm `elem` boundNames
196+ = [(m, nm)]
197+ toReference _ = []
198+
199+-- String literals include the quote chars
200+fromStringLiteral :: JSExpression -> Maybe String
201+fromStringLiteral (JSStringLiteral _ str) = Just $ strValue str
202+fromStringLiteral _ = Nothing
203+
204+strValue :: String -> String
205+strValue str = go $ drop 1 str
206+ where
207+ go ('\\' : 'b' : xs) = '\b' : go xs
208+ go ('\\' : 'f' : xs) = '\f' : go xs
209+ go ('\\' : 'n' : xs) = '\n' : go xs
210+ go ('\\' : 'r' : xs) = '\r' : go xs
211+ go ('\\' : 't' : xs) = '\t' : go xs
212+ go ('\\' : 'v' : xs) = '\v' : go xs
213+ go ('\\' : '0' : xs) = '\0' : go xs
214+ go ('\\' : 'x' : a : b : xs) = chr (a' + b') : go xs
215+ where
216+ a' = 16 * digitToInt a
217+ b' = digitToInt b
218+ go ('\\' : 'u' : a : b : c : d : xs) = chr (a' + b' + c' + d') : go xs
219+ where
220+ a' = 16 * 16 * 16 * digitToInt a
221+ b' = 16 * 16 * digitToInt b
222+ c' = 16 * digitToInt c
223+ d' = digitToInt d
224+ go ('\\' : x : xs) = x : go xs
225+ go "\"" = ""
226+ go "'" = ""
227+ go (x : xs) = x : go xs
228+ go "" = ""
229+
230+commaList :: JSCommaList a -> [a]
231+commaList JSLNil = []
232+commaList (JSLOne x) = [x]
233+commaList (JSLCons l _ x) = commaList l ++ [x]
234+
235+trailingCommaList :: JSCommaTrailingList a -> [a]
236+trailingCommaList (JSCTLComma l _) = commaList l
237+trailingCommaList (JSCTLNone l) = commaList l
238+
239+-- | Attempt to create a Module from a Javascript AST.
240+--
241+-- Each type of module element is matched using pattern guards, and everything else is bundled into the
242+-- Other constructor.
243+toModule :: forall m. (MonadError ErrorMessage m) => S.Set String -> ModuleIdentifier -> JSAST -> m Module
244+toModule mids mid top
245+ | JSAstProgram smts _ <- top = Module mid <$> traverse toModuleElement smts
246+ | otherwise = err InvalidTopLevel
247+ where
248+ err = throwError . ErrorInModule mid
249+
250+ toModuleElement :: JSStatement -> m ModuleElement
251+ toModuleElement stmt
252+ | Just (importName, importPath) <- matchRequire mids mid stmt
253+ = pure (Require stmt importName importPath)
254+ toModuleElement stmt
255+ | Just (exported, name, decl) <- matchMember stmt
256+ = pure (Member stmt exported name decl [])
257+ toModuleElement stmt
258+ | Just props <- matchExportsAssignment stmt
259+ = ExportsList <$> traverse toExport (trailingCommaList props)
260+ where
261+ toExport :: JSObjectProperty -> m (ExportType, String, JSExpression, [Key])
262+ toExport (JSPropertyNameandValue name _ [val]) =
263+ (,,val,[]) <$> exportType val
264+ <*> extractLabel' name
265+ toExport _ = err UnsupportedExport
266+
267+ exportType :: JSExpression -> m ExportType
268+ exportType (JSMemberDot f _ _)
269+ | JSIdentifier _ "$foreign" <- f
270+ = pure ForeignReexport
271+ exportType (JSMemberSquare f _ _ _)
272+ | JSIdentifier _ "$foreign" <- f
273+ = pure ForeignReexport
274+ exportType (JSIdentifier _ s) = pure (RegularExport s)
275+ exportType _ = err UnsupportedExport
276+
277+ extractLabel' = maybe (err UnsupportedExport) pure . extractLabel
278+
279+ toModuleElement other = pure (Other other)
280+
281+-- Get a list of all the exported identifiers from a foreign module.
282+--
283+-- TODO: what if we assign to exports.foo and then later assign to
284+-- module.exports (presumably overwriting exports.foo)?
285+getExportedIdentifiers :: (MonadError ErrorMessage m)
286+ => String
287+ -> JSAST
288+ -> m [String]
289+getExportedIdentifiers mname top
290+ | JSAstProgram stmts _ <- top = concat <$> traverse go stmts
291+ | otherwise = err InvalidTopLevel
292+ where
293+ err = throwError . ErrorInModule (ModuleIdentifier mname Foreign)
294+
295+ go stmt
296+ | Just props <- matchExportsAssignment stmt
297+ = traverse toIdent (trailingCommaList props)
298+ | Just (True, name, _) <- matchMember stmt
299+ = pure [name]
300+ | otherwise
301+ = pure []
302+
303+ toIdent (JSPropertyNameandValue name _ [_]) =
304+ extractLabel' name
305+ toIdent _ =
306+ err UnsupportedExport
307+
308+ extractLabel' = maybe (err UnsupportedExport) pure . extractLabel
309+
310+-- Matches JS statements like this:
311+-- var ModuleName = require("file");
312+matchRequire :: S.Set String
313+ -> ModuleIdentifier
314+ -> JSStatement
315+ -> Maybe (String, Either String ModuleIdentifier)
316+matchRequire mids mid stmt
317+ | JSVariable _ jsInit _ <- stmt
318+ , [JSVarInitExpression var varInit] <- commaList jsInit
319+ , JSIdentifier _ importName <- var
320+ , JSVarInit _ jsInitEx <- varInit
321+ , JSMemberExpression req _ argsE _ <- jsInitEx
322+ , JSIdentifier _ "require" <- req
323+ , [ Just importPath ] <- map fromStringLiteral (commaList argsE)
324+ , importPath' <- checkImportPath importPath mid mids
325+ = Just (importName, importPath')
326+ | otherwise
327+ = Nothing
328+
329+-- Matches JS member declarations.
330+matchMember :: JSStatement -> Maybe (Bool, String, JSExpression)
331+matchMember stmt
332+ -- var foo = expr;
333+ | JSVariable _ jsInit _ <- stmt
334+ , [JSVarInitExpression var varInit] <- commaList jsInit
335+ , JSIdentifier _ name <- var
336+ , JSVarInit _ decl <- varInit
337+ = Just (False, name, decl)
338+ -- exports.foo = expr; exports["foo"] = expr;
339+ | JSAssignStatement e (JSAssign _) decl _ <- stmt
340+ , Just name <- accessor e
341+ = Just (True, name, decl)
342+ | otherwise
343+ = Nothing
344+ where
345+ accessor :: JSExpression -> Maybe String
346+ accessor (JSMemberDot exports _ nm)
347+ | JSIdentifier _ "exports" <- exports
348+ , JSIdentifier _ name <- nm
349+ = Just name
350+ accessor (JSMemberSquare exports _ nm _)
351+ | JSIdentifier _ "exports" <- exports
352+ , Just name <- fromStringLiteral nm
353+ = Just name
354+ accessor _ = Nothing
355+
356+-- Matches assignments to module.exports, like this:
357+-- module.exports = { ... }
358+matchExportsAssignment :: JSStatement -> Maybe JSObjectPropertyList
359+matchExportsAssignment stmt
360+ | JSAssignStatement e (JSAssign _) decl _ <- stmt
361+ , JSMemberDot module' _ exports <- e
362+ , JSIdentifier _ "module" <- module'
363+ , JSIdentifier _ "exports" <- exports
364+ , JSObjectLiteral _ props _ <- decl
365+ = Just props
366+ | otherwise
367+ = Nothing
368+
369+extractLabel :: JSPropertyName -> Maybe String
370+extractLabel (JSPropertyString _ nm) = Just $ strValue nm
371+extractLabel (JSPropertyIdent _ nm) = Just nm
372+extractLabel _ = Nothing
373+
374+-- | Eliminate unused code based on the specified entry point set.
375+compile :: [Module] -> [ModuleIdentifier] -> [Module]
376+compile modules [] = modules
377+compile modules entryPoints = filteredModules
378+ where
379+ (graph, _, vertexFor) = graphFromEdges verts
380+
381+ -- | The vertex set
382+ verts :: [(ModuleElement, Key, [Key])]
383+ verts = do
384+ Module mid els <- modules
385+ concatMap (toVertices mid) els
386+ where
387+ -- | Create a set of vertices for a module element.
388+ --
389+ -- Some special cases worth commenting on:
390+ --
391+ -- 1) Regular exports which simply export their own name do not count as dependencies.
392+ -- Regular exports which rename and reexport an operator do count, however.
393+ --
394+ -- 2) Require statements don't contribute towards dependencies, since they effectively get
395+ -- inlined wherever they are used inside other module elements.
396+ toVertices :: ModuleIdentifier -> ModuleElement -> [(ModuleElement, Key, [Key])]
397+ toVertices p m@(Member _ _ nm _ deps) = [(m, (p, nm), deps)]
398+ toVertices p m@(ExportsList exps) = mapMaybe toVertex exps
399+ where
400+ toVertex (ForeignReexport, nm, _, ks) = Just (m, (p, nm), ks)
401+ toVertex (RegularExport nm, nm1, _, ks) | nm /= nm1 = Just (m, (p, nm1), ks)
402+ toVertex _ = Nothing
403+ toVertices _ _ = []
404+
405+ -- | The set of vertices whose connected components we are interested in keeping.
406+ entryPointVertices :: [Vertex]
407+ entryPointVertices = catMaybes $ do
408+ (_, k@(mid, _), _) <- verts
409+ guard $ mid `elem` entryPoints
410+ return (vertexFor k)
411+
412+ -- | The set of vertices reachable from an entry point
413+ reachableSet :: S.Set Vertex
414+ reachableSet = S.fromList (concatMap (reachable graph) entryPointVertices)
415+
416+ filteredModules :: [Module]
417+ filteredModules = map filterUsed modules
418+ where
419+ filterUsed :: Module -> Module
420+ filterUsed (Module mid ds) = Module mid (map filterExports (go ds))
421+ where
422+ go :: [ModuleElement] -> [ModuleElement]
423+ go [] = []
424+ go (d : rest)
425+ | not (isDeclUsed d) = go rest
426+ | otherwise = d : go rest
427+
428+ -- | Filter out the exports for members which aren't used.
429+ filterExports :: ModuleElement -> ModuleElement
430+ filterExports (ExportsList exps) = ExportsList (filter (\(_, nm, _, _) -> isKeyUsed (mid, nm)) exps)
431+ filterExports me = me
432+
433+ isDeclUsed :: ModuleElement -> Bool
434+ isDeclUsed (Member _ _ nm _ _) = isKeyUsed (mid, nm)
435+ isDeclUsed _ = True
436+
437+ isKeyUsed :: Key -> Bool
438+ isKeyUsed k
439+ | Just me <- vertexFor k = me `S.member` reachableSet
440+ | otherwise = False
441+
442+-- | Topologically sort the module dependency graph, so that when we generate code, modules can be
443+-- defined in the right order.
444+sortModules :: [Module] -> [Module]
445+sortModules modules = map (\v -> case nodeFor v of (n, _, _) -> n) (reverse (topSort graph))
446+ where
447+ (graph, nodeFor, _) = graphFromEdges $ do
448+ m@(Module mid els) <- modules
449+ return (m, mid, mapMaybe getKey els)
450+
451+ getKey :: ModuleElement -> Maybe ModuleIdentifier
452+ getKey (Require _ _ (Right mi)) = Just mi
453+ getKey _ = Nothing
454+
455+-- | A module is empty if it contains no exported members (in other words,
456+-- if the only things left after dead code elimination are module imports and
457+-- "other" foreign code).
458+--
459+-- If a module is empty, we don't want to generate code for it.
460+isModuleEmpty :: Module -> Bool
461+isModuleEmpty (Module _ els) = all isElementEmpty els
462+ where
463+ isElementEmpty :: ModuleElement -> Bool
464+ isElementEmpty (ExportsList exps) = null exps
465+ isElementEmpty Require{} = True
466+ isElementEmpty (Other _) = True
467+ isElementEmpty _ = False
468+
469+-- | Generate code for a set of modules, including a call to main().
470+--
471+-- Modules get defined on the global PS object, as follows:
472+--
473+-- var PS = { };
474+-- (function(exports) {
475+-- ...
476+-- })(PS["Module.Name"] = PS["Module.Name"] || {});
477+--
478+-- In particular, a module and its foreign imports share the same namespace inside PS.
479+-- This saves us from having to generate unique names for a module and its foreign imports,
480+-- and is safe since a module shares a namespace with its foreign imports in PureScript as well
481+-- (so there is no way to have overlaps in code generated by psc).
482+codeGen :: Maybe String -- ^ main module
483+ -> String -- ^ namespace
484+ -> [Module] -- ^ input modules
485+ -> String
486+codeGen optionsMainModule optionsNamespace ms = renderToString (JSAstProgram (prelude : concatMap moduleToJS ms ++ maybe [] runMain optionsMainModule) JSNoAnnot)
487+ where
488+ moduleToJS :: Module -> [JSStatement]
489+ moduleToJS (Module mn ds) = wrap (moduleName mn) (indent (concatMap declToJS ds))
490+ where
491+ declToJS :: ModuleElement -> [JSStatement]
492+ declToJS (Member n _ _ _ _) = [n]
493+ declToJS (Other n) = [n]
494+ declToJS (Require _ nm req) =
495+ [
496+ JSVariable lfsp
497+ (cList [
498+ JSVarInitExpression (JSIdentifier sp nm)
499+ (JSVarInit sp $ either require (moduleReference sp . moduleName) req )
500+ ]) (JSSemi JSNoAnnot)
501+ ]
502+ declToJS (ExportsList exps) = map toExport exps
503+
504+ where
505+ toExport :: (ExportType, String, JSExpression, [Key]) -> JSStatement
506+ toExport (_, nm, val, _) =
507+ JSAssignStatement
508+ (JSMemberSquare (JSIdentifier lfsp "exports") JSNoAnnot
509+ (str nm) JSNoAnnot)
510+ (JSAssign sp)
511+ val
512+ (JSSemi JSNoAnnot)
513+
514+ -- comma lists are reverse-consed
515+ cList :: [a] -> JSCommaList a
516+ cList [] = JSLNil
517+ cList [x] = JSLOne x
518+ cList l = go $ reverse l
519+ where
520+ go [x] = JSLOne x
521+ go (h:t)= JSLCons (go t) JSNoAnnot h
522+ go [] = error "Invalid case in comma-list"
523+
524+ indent :: [JSStatement] -> [JSStatement]
525+ indent = everywhere (mkT squash)
526+ where
527+ squash JSNoAnnot = JSAnnot (TokenPn 0 0 2) []
528+ squash (JSAnnot pos ann) = JSAnnot (keepCol pos) (map splat ann)
529+
530+ splat (CommentA pos s) = CommentA (keepCol pos) s
531+ splat (WhiteSpace pos w) = WhiteSpace (keepCol pos) w
532+ splat ann = ann
533+
534+ keepCol (TokenPn _ _ c) = TokenPn 0 0 (if c >= 0 then c + 2 else 2)
535+
536+ prelude :: JSStatement
537+ prelude = JSVariable (JSAnnot tokenPosnEmpty [ CommentA tokenPosnEmpty $ "// Generated by psc-bundle " ++ showVersion Paths.version
538+ , WhiteSpace tokenPosnEmpty "\n" ])
539+ (cList [
540+ JSVarInitExpression (JSIdentifier sp optionsNamespace)
541+ (JSVarInit sp (emptyObj sp))
542+ ]) (JSSemi JSNoAnnot)
543+
544+ require :: String -> JSExpression
545+ require mn =
546+ JSMemberExpression (JSIdentifier JSNoAnnot "require") JSNoAnnot (cList [ str mn ]) JSNoAnnot
547+
548+ moduleReference :: JSAnnot -> String -> JSExpression
549+ moduleReference a mn =
550+ JSMemberSquare (JSIdentifier a optionsNamespace) JSNoAnnot
551+ (str mn) JSNoAnnot
552+
553+ str :: String -> JSExpression
554+ str s = JSStringLiteral JSNoAnnot $ "\"" ++ s ++ "\""
555+
556+
557+ emptyObj :: JSAnnot -> JSExpression
558+ emptyObj a = JSObjectLiteral a (JSCTLNone JSLNil) JSNoAnnot
559+
560+ wrap :: String -> [JSStatement] -> [JSStatement]
561+ wrap mn ds =
562+ [
563+ JSMethodCall (JSExpressionParen lf (JSFunctionExpression JSNoAnnot JSIdentNone JSNoAnnot
564+ (JSLOne (JSIdentName JSNoAnnot "exports")) JSNoAnnot
565+ (JSBlock sp (lfHead ds) lf)) -- \n not quite in right place
566+ JSNoAnnot)
567+ JSNoAnnot
568+ (JSLOne (JSAssignExpression (moduleReference JSNoAnnot mn) (JSAssign sp)
569+ (JSExpressionBinary (moduleReference sp mn) (JSBinOpOr sp) (emptyObj sp))))
570+ JSNoAnnot
571+ (JSSemi JSNoAnnot)
572+ ]
573+ where
574+ lfHead (h:t) = addAnn (WhiteSpace tokenPosnEmpty "\n ") h : t
575+ lfHead x = x
576+
577+ addAnn :: CommentAnnotation -> JSStatement -> JSStatement
578+ addAnn a (JSExpressionStatement (JSStringLiteral ann s) _) =
579+ JSExpressionStatement (JSStringLiteral (appendAnn a ann) s) (JSSemi JSNoAnnot)
580+ addAnn _ x = x
581+
582+ appendAnn a JSNoAnnot = JSAnnot tokenPosnEmpty [a]
583+ appendAnn a (JSAnnot _ anns) = JSAnnot tokenPosnEmpty (a:anns ++ [WhiteSpace tokenPosnEmpty " "])
584+
585+ runMain :: String -> [JSStatement]
586+ runMain mn =
587+ [JSMethodCall
588+ (JSMemberDot (moduleReference lf mn) JSNoAnnot
589+ (JSIdentifier JSNoAnnot "main"))
590+ JSNoAnnot (cList []) JSNoAnnot (JSSemi JSNoAnnot)]
591+
592+ lf :: JSAnnot
593+ lf = JSAnnot tokenPosnEmpty [ WhiteSpace tokenPosnEmpty "\n" ]
594+
595+
596+ lfsp :: JSAnnot
597+ lfsp = JSAnnot tokenPosnEmpty [ WhiteSpace tokenPosnEmpty "\n " ]
598+
599+ sp :: JSAnnot
600+ sp = JSAnnot tokenPosnEmpty [ WhiteSpace tokenPosnEmpty " " ]
601+
602+-- | The bundling function.
603+-- This function performs dead code elimination, filters empty modules
604+-- and generates and prints the final Javascript bundle.
605+bundle :: (MonadError ErrorMessage m)
606+ => [(ModuleIdentifier, String)] -- ^ The input modules. Each module should be javascript rendered from 'Language.PureScript.Make' or @psc@.
607+ -> [ModuleIdentifier] -- ^ Entry points. These module identifiers are used as the roots for dead-code elimination
608+ -> Maybe String -- ^ An optional main module.
609+ -> String -- ^ The namespace (e.g. PS).
610+ -> m String
611+bundle inputStrs entryPoints mainModule namespace = do
612+ input <- forM inputStrs $ \(ident, js) -> do
613+ ast <- either (throwError . ErrorInModule ident . UnableToParseModule) pure $ parse js (moduleName ident)
614+ return (ident, ast)
615+
616+ let mids = S.fromList (map (moduleName . fst) input)
617+
618+ modules <- traverse (fmap withDeps . uncurry (toModule mids)) input
619+
620+ let compiled = compile modules entryPoints
621+ sorted = sortModules (filter (not . isModuleEmpty) compiled)
622+
623+ return (codeGen mainModule namespace sorted)
src/Language/PureScript/CodeGen.hsnew file+8
@@ -0,0 +1,8 @@
1+-- |
2+-- A collection of modules related to code generation:
3+--
4+-- [@Language.PureScript.CodeGen.JS@] Code generator for Javascript
5+--
6+module Language.PureScript.CodeGen (module C) where
7+
8+import Language.PureScript.CodeGen.JS as C
src/Language/PureScript/CodeGen/JS.hsnew file+449
@@ -0,0 +1,449 @@
1+-- |
2+-- This module generates code in the simplified Javascript intermediate representation from Purescript code
3+--
4+module Language.PureScript.CodeGen.JS
5+ ( module AST
6+ , module Common
7+ , moduleToJs
8+ ) where
9+
10+import Prelude.Compat
11+
12+import Control.Arrow ((&&&))
13+import Control.Monad (replicateM, forM, void)
14+import Control.Monad.Error.Class (MonadError(..))
15+import Control.Monad.Reader (MonadReader, asks)
16+import Control.Monad.Supply.Class
17+
18+import Data.List ((\\), delete, intersect)
19+import Data.Maybe (isNothing, fromMaybe)
20+import qualified Data.Foldable as F
21+import qualified Data.Map as M
22+import qualified Data.Traversable as T
23+
24+import Language.PureScript.AST.SourcePos
25+import Language.PureScript.CodeGen.JS.AST as AST
26+import Language.PureScript.CodeGen.JS.Common as Common
27+import Language.PureScript.CodeGen.JS.Optimizer
28+import Language.PureScript.CoreFn
29+import Language.PureScript.Crash
30+import Language.PureScript.Errors (ErrorMessageHint(..), SimpleErrorMessage(..),
31+ MultipleErrors(..), rethrow,
32+ errorMessage, rethrowWithPosition, addHint)
33+import Language.PureScript.Names
34+import Language.PureScript.Options
35+import Language.PureScript.Traversals (sndM)
36+import qualified Language.PureScript.Constants as C
37+
38+import System.FilePath.Posix ((</>))
39+
40+-- |
41+-- Generate code in the simplified Javascript intermediate representation for all declarations in a
42+-- module.
43+--
44+moduleToJs
45+ :: forall m
46+ . (Monad m, MonadReader Options m, MonadSupply m, MonadError MultipleErrors m)
47+ => Module Ann
48+ -> Maybe JS
49+ -> m [JS]
50+moduleToJs (Module coms mn imps exps foreigns decls) foreign_ =
51+ rethrow (addHint (ErrorInModule mn)) $ do
52+ let usedNames = concatMap getNames decls
53+ let mnLookup = renameImports usedNames imps
54+ jsImports <- T.traverse (importToJs mnLookup) . delete (ModuleName [ProperName C.prim]) . (\\ [mn]) $ map snd imps
55+ let decls' = renameModules mnLookup decls
56+ jsDecls <- mapM bindToJs decls'
57+ optimized <- T.traverse (T.traverse optimize) jsDecls
58+ F.traverse_ (F.traverse_ checkIntegers) optimized
59+ comments <- not <$> asks optionsNoComments
60+ let strict = JSStringLiteral Nothing "use strict"
61+ let header = if comments && not (null coms) then JSComment Nothing coms strict else strict
62+ let foreign' = [JSVariableIntroduction Nothing "$foreign" foreign_ | not $ null foreigns || isNothing foreign_]
63+ let moduleBody = header : foreign' ++ jsImports ++ concat optimized
64+ let foreignExps = exps `intersect` (fst `map` foreigns)
65+ let standardExps = exps \\ foreignExps
66+ let exps' = JSObjectLiteral Nothing $ map (runIdent &&& JSVar Nothing . identToJs) standardExps
67+ ++ map (runIdent &&& foreignIdent) foreignExps
68+ return $ moduleBody ++ [JSAssignment Nothing (JSAccessor Nothing "exports" (JSVar Nothing "module")) exps']
69+
70+ where
71+
72+ -- |
73+ -- Extracts all declaration names from a binding group.
74+ --
75+ getNames :: Bind Ann -> [Ident]
76+ getNames (NonRec _ ident _) = [ident]
77+ getNames (Rec vals) = map (snd . fst) vals
78+
79+ -- |
80+ -- Creates alternative names for each module to ensure they don't collide
81+ -- with declaration names.
82+ --
83+ renameImports :: [Ident] -> [(Ann, ModuleName)] -> M.Map ModuleName (Ann, ModuleName)
84+ renameImports = go M.empty
85+ where
86+ go :: M.Map ModuleName (Ann, ModuleName) -> [Ident] -> [(Ann, ModuleName)] -> M.Map ModuleName (Ann, ModuleName)
87+ go acc used ((ann, mn') : mns') =
88+ let mni = Ident $ runModuleName mn'
89+ in if mn' /= mn && mni `elem` used
90+ then let newName = freshModuleName 1 mn' used
91+ in go (M.insert mn' (ann, newName) acc) (Ident (runModuleName newName) : used) mns'
92+ else go (M.insert mn' (ann, mn') acc) (mni : used) mns'
93+ go acc _ [] = acc
94+
95+ freshModuleName :: Integer -> ModuleName -> [Ident] -> ModuleName
96+ freshModuleName i mn'@(ModuleName pns) used =
97+ let newName = ModuleName $ init pns ++ [ProperName $ runProperName (last pns) ++ "_" ++ show i]
98+ in if Ident (runModuleName newName) `elem` used
99+ then freshModuleName (i + 1) mn' used
100+ else newName
101+
102+ -- |
103+ -- Generates Javascript code for a module import, binding the required module
104+ -- to the alternative
105+ --
106+ importToJs :: M.Map ModuleName (Ann, ModuleName) -> ModuleName -> m JS
107+ importToJs mnLookup mn' = do
108+ let ((ss, _, _, _), mnSafe) = fromMaybe (internalError "Missing value in mnLookup") $ M.lookup mn' mnLookup
109+ let moduleBody = JSApp Nothing (JSVar Nothing "require") [JSStringLiteral Nothing (".." </> runModuleName mn')]
110+ withPos ss $ JSVariableIntroduction Nothing (moduleNameToJs mnSafe) (Just moduleBody)
111+
112+ -- |
113+ -- Replaces the `ModuleName`s in the AST so that the generated code refers to
114+ -- the collision-avoiding renamed module imports.
115+ --
116+ renameModules :: M.Map ModuleName (Ann, ModuleName) -> [Bind Ann] -> [Bind Ann]
117+ renameModules mnLookup binds =
118+ let (f, _, _) = everywhereOnValues id goExpr goBinder
119+ in map f binds
120+ where
121+ goExpr :: Expr a -> Expr a
122+ goExpr (Var ann q) = Var ann (renameQual q)
123+ goExpr e = e
124+ goBinder :: Binder a -> Binder a
125+ goBinder (ConstructorBinder ann q1 q2 bs) = ConstructorBinder ann (renameQual q1) (renameQual q2) bs
126+ goBinder b = b
127+ renameQual :: Qualified a -> Qualified a
128+ renameQual (Qualified (Just mn') a) =
129+ let (_,mnSafe) = fromMaybe (internalError "Missing value in mnLookup") $ M.lookup mn' mnLookup
130+ in Qualified (Just mnSafe) a
131+ renameQual q = q
132+
133+ -- |
134+ -- Generate code in the simplified Javascript intermediate representation for a declaration
135+ --
136+ bindToJs :: Bind Ann -> m [JS]
137+ bindToJs (NonRec ann ident val) = return <$> nonRecToJS ann ident val
138+ bindToJs (Rec vals) = forM vals (uncurry . uncurry $ nonRecToJS)
139+
140+ -- |
141+ -- Generate code in the simplified Javascript intermediate representation for a single non-recursive
142+ -- declaration.
143+ --
144+ -- The main purpose of this function is to handle code generation for comments.
145+ --
146+ nonRecToJS :: Ann -> Ident -> Expr Ann -> m JS
147+ nonRecToJS a i e@(extractAnn -> (_, com, _, _)) | not (null com) = do
148+ withoutComment <- asks optionsNoComments
149+ if withoutComment
150+ then nonRecToJS a i (modifyAnn removeComments e)
151+ else JSComment Nothing com <$> nonRecToJS a i (modifyAnn removeComments e)
152+ nonRecToJS (ss, _, _, _) ident val = do
153+ js <- valueToJs val
154+ withPos ss $ JSVariableIntroduction Nothing (identToJs ident) (Just js)
155+
156+ withPos :: Maybe SourceSpan -> JS -> m JS
157+ withPos (Just ss) js = do
158+ withSM <- asks optionsSourceMaps
159+ return $ if withSM
160+ then withSourceSpan ss js
161+ else js
162+ withPos Nothing js = return js
163+
164+ -- |
165+ -- Generate code in the simplified Javascript intermediate representation for a variable based on a
166+ -- PureScript identifier.
167+ --
168+ var :: Ident -> JS
169+ var = JSVar Nothing . identToJs
170+
171+ -- |
172+ -- Generate code in the simplified Javascript intermediate representation for an accessor based on
173+ -- a PureScript identifier. If the name is not valid in Javascript (symbol based, reserved name) an
174+ -- indexer is returned.
175+ --
176+ accessor :: Ident -> JS -> JS
177+ accessor (Ident prop) = accessorString prop
178+ accessor (GenIdent _ _) = internalError "GenIdent in accessor"
179+
180+ accessorString :: String -> JS -> JS
181+ accessorString prop | identNeedsEscaping prop = JSIndexer Nothing (JSStringLiteral Nothing prop)
182+ | otherwise = JSAccessor Nothing prop
183+
184+ -- |
185+ -- Generate code in the simplified Javascript intermediate representation for a value or expression.
186+ --
187+ valueToJs :: Expr Ann -> m JS
188+ valueToJs e =
189+ let (ss, _, _, _) = extractAnn e in
190+ withPos ss =<< valueToJs' e
191+
192+ valueToJs' :: Expr Ann -> m JS
193+ valueToJs' (Literal (pos, _, _, _) l) =
194+ maybe id rethrowWithPosition pos $ literalToValueJS l
195+ valueToJs' (Var (_, _, _, Just (IsConstructor _ [])) name) =
196+ return $ JSAccessor Nothing "value" $ qualifiedToJS id name
197+ valueToJs' (Var (_, _, _, Just (IsConstructor _ _)) name) =
198+ return $ JSAccessor Nothing "create" $ qualifiedToJS id name
199+ valueToJs' (Accessor _ prop val) =
200+ accessorString prop <$> valueToJs val
201+ valueToJs' (ObjectUpdate _ o ps) = do
202+ obj <- valueToJs o
203+ sts <- mapM (sndM valueToJs) ps
204+ extendObj obj sts
205+ valueToJs' e@(Abs (_, _, _, Just IsTypeClassConstructor) _ _) =
206+ let args = unAbs e
207+ in return $ JSFunction Nothing Nothing (map identToJs args) (JSBlock Nothing $ map assign args)
208+ where
209+ unAbs :: Expr Ann -> [Ident]
210+ unAbs (Abs _ arg val) = arg : unAbs val
211+ unAbs _ = []
212+ assign :: Ident -> JS
213+ assign name = JSAssignment Nothing (accessorString (runIdent name) (JSVar Nothing "this"))
214+ (var name)
215+ valueToJs' (Abs _ arg val) = do
216+ ret <- valueToJs val
217+ return $ JSFunction Nothing Nothing [identToJs arg] (JSBlock Nothing [JSReturn Nothing ret])
218+ valueToJs' e@App{} = do
219+ let (f, args) = unApp e []
220+ args' <- mapM valueToJs args
221+ case f of
222+ Var (_, _, _, Just IsNewtype) _ -> return (head args')
223+ Var (_, _, _, Just (IsConstructor _ fields)) name | length args == length fields ->
224+ return $ JSUnary Nothing JSNew $ JSApp Nothing (qualifiedToJS id name) args'
225+ Var (_, _, _, Just IsTypeClassConstructor) name ->
226+ return $ JSUnary Nothing JSNew $ JSApp Nothing (qualifiedToJS id name) args'
227+ _ -> flip (foldl (\fn a -> JSApp Nothing fn [a])) args' <$> valueToJs f
228+ where
229+ unApp :: Expr Ann -> [Expr Ann] -> (Expr Ann, [Expr Ann])
230+ unApp (App _ val arg) args = unApp val (arg : args)
231+ unApp other args = (other, args)
232+ valueToJs' (Var (_, _, _, Just IsForeign) qi@(Qualified (Just mn') ident)) =
233+ return $ if mn' == mn
234+ then foreignIdent ident
235+ else varToJs qi
236+ valueToJs' (Var (_, _, _, Just IsForeign) ident) =
237+ error $ "Encountered an unqualified reference to a foreign ident " ++ showQualified showIdent ident
238+ valueToJs' (Var _ ident) = return $ varToJs ident
239+ valueToJs' (Case (maybeSpan, _, _, _) values binders) = do
240+ vals <- mapM valueToJs values
241+ bindersToJs maybeSpan binders vals
242+ valueToJs' (Let _ ds val) = do
243+ ds' <- concat <$> mapM bindToJs ds
244+ ret <- valueToJs val
245+ return $ JSApp Nothing (JSFunction Nothing Nothing [] (JSBlock Nothing (ds' ++ [JSReturn Nothing ret]))) []
246+ valueToJs' (Constructor (_, _, _, Just IsNewtype) _ (ProperName ctor) _) =
247+ return $ JSVariableIntroduction Nothing ctor (Just $
248+ JSObjectLiteral Nothing [("create",
249+ JSFunction Nothing Nothing ["value"]
250+ (JSBlock Nothing [JSReturn Nothing $ JSVar Nothing "value"]))])
251+ valueToJs' (Constructor _ _ (ProperName ctor) []) =
252+ return $ iife ctor [ JSFunction Nothing (Just ctor) [] (JSBlock Nothing [])
253+ , JSAssignment Nothing (JSAccessor Nothing "value" (JSVar Nothing ctor))
254+ (JSUnary Nothing JSNew $ JSApp Nothing (JSVar Nothing ctor) []) ]
255+ valueToJs' (Constructor _ _ (ProperName ctor) fields) =
256+ let constructor =
257+ let body = [ JSAssignment Nothing (JSAccessor Nothing (identToJs f) (JSVar Nothing "this")) (var f) | f <- fields ]
258+ in JSFunction Nothing (Just ctor) (identToJs `map` fields) (JSBlock Nothing body)
259+ createFn =
260+ let body = JSUnary Nothing JSNew $ JSApp Nothing (JSVar Nothing ctor) (var `map` fields)
261+ in foldr (\f inner -> JSFunction Nothing Nothing [identToJs f] (JSBlock Nothing [JSReturn Nothing inner])) body fields
262+ in return $ iife ctor [ constructor
263+ , JSAssignment Nothing (JSAccessor Nothing "create" (JSVar Nothing ctor)) createFn
264+ ]
265+
266+ iife :: String -> [JS] -> JS
267+ iife v exprs = JSApp Nothing (JSFunction Nothing Nothing [] (JSBlock Nothing $ exprs ++ [JSReturn Nothing $ JSVar Nothing v])) []
268+
269+ literalToValueJS :: Literal (Expr Ann) -> m JS
270+ literalToValueJS (NumericLiteral (Left i)) = return $ JSNumericLiteral Nothing (Left i)
271+ literalToValueJS (NumericLiteral (Right n)) = return $ JSNumericLiteral Nothing (Right n)
272+ literalToValueJS (StringLiteral s) = return $ JSStringLiteral Nothing s
273+ literalToValueJS (CharLiteral c) = return $ JSStringLiteral Nothing [c]
274+ literalToValueJS (BooleanLiteral b) = return $ JSBooleanLiteral Nothing b
275+ literalToValueJS (ArrayLiteral xs) = JSArrayLiteral Nothing <$> mapM valueToJs xs
276+ literalToValueJS (ObjectLiteral ps) = JSObjectLiteral Nothing <$> mapM (sndM valueToJs) ps
277+
278+ -- |
279+ -- Shallow copy an object.
280+ --
281+ extendObj :: JS -> [(String, JS)] -> m JS
282+ extendObj obj sts = do
283+ newObj <- freshName
284+ key <- freshName
285+ evaluatedObj <- freshName
286+ let
287+ jsKey = JSVar Nothing key
288+ jsNewObj = JSVar Nothing newObj
289+ jsEvaluatedObj = JSVar Nothing evaluatedObj
290+ block = JSBlock Nothing (evaluate:objAssign:copy:extend ++ [JSReturn Nothing jsNewObj])
291+ evaluate = JSVariableIntroduction Nothing evaluatedObj (Just obj)
292+ objAssign = JSVariableIntroduction Nothing newObj (Just $ JSObjectLiteral Nothing [])
293+ copy = JSForIn Nothing key jsEvaluatedObj $ JSBlock Nothing [JSIfElse Nothing cond assign Nothing]
294+ cond = JSApp Nothing (JSAccessor Nothing "hasOwnProperty" jsEvaluatedObj) [jsKey]
295+ assign = JSBlock Nothing [JSAssignment Nothing (JSIndexer Nothing jsKey jsNewObj) (JSIndexer Nothing jsKey jsEvaluatedObj)]
296+ stToAssign (s, js) = JSAssignment Nothing (accessorString s jsNewObj) js
297+ extend = map stToAssign sts
298+ return $ JSApp Nothing (JSFunction Nothing Nothing [] block) []
299+
300+ -- |
301+ -- Generate code in the simplified Javascript intermediate representation for a reference to a
302+ -- variable.
303+ --
304+ varToJs :: Qualified Ident -> JS
305+ varToJs (Qualified Nothing ident) = var ident
306+ varToJs qual = qualifiedToJS id qual
307+
308+ -- |
309+ -- Generate code in the simplified Javascript intermediate representation for a reference to a
310+ -- variable that may have a qualified name.
311+ --
312+ qualifiedToJS :: (a -> Ident) -> Qualified a -> JS
313+ qualifiedToJS f (Qualified (Just (ModuleName [ProperName mn'])) a) | mn' == C.prim = JSVar Nothing . runIdent $ f a
314+ qualifiedToJS f (Qualified (Just mn') a) | mn /= mn' = accessor (f a) (JSVar Nothing (moduleNameToJs mn'))
315+ qualifiedToJS f (Qualified _ a) = JSVar Nothing $ identToJs (f a)
316+
317+ foreignIdent :: Ident -> JS
318+ foreignIdent ident = accessorString (runIdent ident) (JSVar Nothing "$foreign")
319+
320+ -- |
321+ -- Generate code in the simplified Javascript intermediate representation for pattern match binders
322+ -- and guards.
323+ --
324+ bindersToJs :: Maybe SourceSpan -> [CaseAlternative Ann] -> [JS] -> m JS
325+ bindersToJs maybeSpan binders vals = do
326+ valNames <- replicateM (length vals) freshName
327+ let assignments = zipWith (JSVariableIntroduction Nothing) valNames (map Just vals)
328+ jss <- forM binders $ \(CaseAlternative bs result) -> do
329+ ret <- guardsToJs result
330+ go valNames ret bs
331+ return $ JSApp Nothing (JSFunction Nothing Nothing [] (JSBlock Nothing (assignments ++ concat jss ++ [JSThrow Nothing $ failedPatternError valNames])))
332+ []
333+ where
334+ go :: [String] -> [JS] -> [Binder Ann] -> m [JS]
335+ go _ done [] = return done
336+ go (v:vs) done' (b:bs) = do
337+ done'' <- go vs done' bs
338+ binderToJs v done'' b
339+ go _ _ _ = internalError "Invalid arguments to bindersToJs"
340+
341+ failedPatternError :: [String] -> JS
342+ failedPatternError names = JSUnary Nothing JSNew $ JSApp Nothing (JSVar Nothing "Error") [JSBinary Nothing Add (JSStringLiteral Nothing failedPatternMessage) (JSArrayLiteral Nothing $ zipWith valueError names vals)]
343+
344+ failedPatternMessage :: String
345+ failedPatternMessage = "Failed pattern match" ++ maybe "" (((" at " ++ runModuleName mn ++ " ") ++) . displayStartEndPos) maybeSpan ++ ": "
346+
347+ valueError :: String -> JS -> JS
348+ valueError _ l@(JSNumericLiteral _ _) = l
349+ valueError _ l@(JSStringLiteral _ _) = l
350+ valueError _ l@(JSBooleanLiteral _ _) = l
351+ valueError s _ = JSAccessor Nothing "name" . JSAccessor Nothing "constructor" $ JSVar Nothing s
352+
353+ guardsToJs :: Either [(Guard Ann, Expr Ann)] (Expr Ann) -> m [JS]
354+ guardsToJs (Left gs) = forM gs $ \(cond, val) -> do
355+ cond' <- valueToJs cond
356+ done <- valueToJs val
357+ return $ JSIfElse Nothing cond' (JSBlock Nothing [JSReturn Nothing done]) Nothing
358+ guardsToJs (Right v) = return . JSReturn Nothing <$> valueToJs v
359+
360+ binderToJs :: String -> [JS] -> Binder Ann -> m [JS]
361+ binderToJs s done binder =
362+ let (ss, _, _, _) = extractBinderAnn binder in
363+ traverse (withPos ss) =<< binderToJs' s done binder
364+
365+ -- |
366+ -- Generate code in the simplified Javascript intermediate representation for a pattern match
367+ -- binder.
368+ --
369+ binderToJs' :: String -> [JS] -> Binder Ann -> m [JS]
370+ binderToJs' _ done NullBinder{} = return done
371+ binderToJs' varName done (LiteralBinder _ l) =
372+ literalToBinderJS varName done l
373+ binderToJs' varName done (VarBinder _ ident) =
374+ return (JSVariableIntroduction Nothing (identToJs ident) (Just (JSVar Nothing varName)) : done)
375+ binderToJs' varName done (ConstructorBinder (_, _, _, Just IsNewtype) _ _ [b]) =
376+ binderToJs varName done b
377+ binderToJs' varName done (ConstructorBinder (_, _, _, Just (IsConstructor ctorType fields)) _ ctor bs) = do
378+ js <- go (zip fields bs) done
379+ return $ case ctorType of
380+ ProductType -> js
381+ SumType ->
382+ [JSIfElse Nothing (JSInstanceOf Nothing (JSVar Nothing varName) (qualifiedToJS (Ident . runProperName) ctor))
383+ (JSBlock Nothing js)
384+ Nothing]
385+ where
386+ go :: [(Ident, Binder Ann)] -> [JS] -> m [JS]
387+ go [] done' = return done'
388+ go ((field, binder) : remain) done' = do
389+ argVar <- freshName
390+ done'' <- go remain done'
391+ js <- binderToJs argVar done'' binder
392+ return (JSVariableIntroduction Nothing argVar (Just (JSAccessor Nothing (identToJs field) (JSVar Nothing varName))) : js)
393+ binderToJs' _ _ ConstructorBinder{} =
394+ internalError "binderToJs: Invalid ConstructorBinder in binderToJs"
395+ binderToJs' varName done (NamedBinder _ ident binder) = do
396+ js <- binderToJs varName done binder
397+ return (JSVariableIntroduction Nothing (identToJs ident) (Just (JSVar Nothing varName)) : js)
398+
399+ literalToBinderJS :: String -> [JS] -> Literal (Binder Ann) -> m [JS]
400+ literalToBinderJS varName done (NumericLiteral num) =
401+ return [JSIfElse Nothing (JSBinary Nothing EqualTo (JSVar Nothing varName) (JSNumericLiteral Nothing num)) (JSBlock Nothing done) Nothing]
402+ literalToBinderJS varName done (CharLiteral c) =
403+ return [JSIfElse Nothing (JSBinary Nothing EqualTo (JSVar Nothing varName) (JSStringLiteral Nothing [c])) (JSBlock Nothing done) Nothing]
404+ literalToBinderJS varName done (StringLiteral str) =
405+ return [JSIfElse Nothing (JSBinary Nothing EqualTo (JSVar Nothing varName) (JSStringLiteral Nothing str)) (JSBlock Nothing done) Nothing]
406+ literalToBinderJS varName done (BooleanLiteral True) =
407+ return [JSIfElse Nothing (JSVar Nothing varName) (JSBlock Nothing done) Nothing]
408+ literalToBinderJS varName done (BooleanLiteral False) =
409+ return [JSIfElse Nothing (JSUnary Nothing Not (JSVar Nothing varName)) (JSBlock Nothing done) Nothing]
410+ literalToBinderJS varName done (ObjectLiteral bs) = go done bs
411+ where
412+ go :: [JS] -> [(String, Binder Ann)] -> m [JS]
413+ go done' [] = return done'
414+ go done' ((prop, binder):bs') = do
415+ propVar <- freshName
416+ done'' <- go done' bs'
417+ js <- binderToJs propVar done'' binder
418+ return (JSVariableIntroduction Nothing propVar (Just (accessorString prop (JSVar Nothing varName))) : js)
419+ literalToBinderJS varName done (ArrayLiteral bs) = do
420+ js <- go done 0 bs
421+ return [JSIfElse Nothing (JSBinary Nothing EqualTo (JSAccessor Nothing "length" (JSVar Nothing varName)) (JSNumericLiteral Nothing (Left (fromIntegral $ length bs)))) (JSBlock Nothing js) Nothing]
422+ where
423+ go :: [JS] -> Integer -> [Binder Ann] -> m [JS]
424+ go done' _ [] = return done'
425+ go done' index (binder:bs') = do
426+ elVar <- freshName
427+ done'' <- go done' (index + 1) bs'
428+ js <- binderToJs elVar done'' binder
429+ return (JSVariableIntroduction Nothing elVar (Just (JSIndexer Nothing (JSNumericLiteral Nothing (Left index)) (JSVar Nothing varName))) : js)
430+
431+ -- Check that all integers fall within the valid int range for JavaScript.
432+ checkIntegers :: JS -> m ()
433+ checkIntegers = void . everywhereOnJSTopDownM go
434+ where
435+ go :: JS -> m JS
436+ go (JSUnary _ Negate (JSNumericLiteral ss (Left i))) =
437+ -- Move the negation inside the literal; since this is a top-down
438+ -- traversal doing this replacement will stop the next case from raising
439+ -- the error when attempting to use -2147483648, as if left unrewritten
440+ -- the value is `JSUnary Negate (JSNumericLiteral (Left 2147483648))`, and
441+ -- 2147483648 is larger than the maximum allowed int.
442+ return $ JSNumericLiteral ss (Left (-i))
443+ go js@(JSNumericLiteral _ (Left i)) =
444+ let minInt = -2147483648
445+ maxInt = 2147483647
446+ in if i < minInt || i > maxInt
447+ then throwError . errorMessage $ IntOutOfRange i "JavaScript" minInt maxInt
448+ else return js
449+ go other = return other
src/Language/PureScript/CodeGen/JS/AST.hsnew file+403
@@ -0,0 +1,403 @@
1+-- |
2+-- Data types for the intermediate simplified-Javascript AST
3+--
4+module Language.PureScript.CodeGen.JS.AST where
5+
6+import Prelude.Compat
7+
8+import Control.Monad.Identity
9+
10+import Language.PureScript.AST (SourceSpan(..))
11+import Language.PureScript.Comments
12+import Language.PureScript.Traversals
13+
14+-- |
15+-- Built-in unary operators
16+--
17+data UnaryOperator
18+ -- |
19+ -- Numeric negation
20+ --
21+ = Negate
22+ -- |
23+ -- Boolean negation
24+ --
25+ | Not
26+ -- |
27+ -- Bitwise negation
28+ --
29+ | BitwiseNot
30+ -- |
31+ -- Numeric unary \'plus\'
32+ --
33+ | Positive
34+ -- |
35+ -- Constructor
36+ --
37+ | JSNew
38+ deriving (Show, Eq)
39+
40+-- |
41+-- Built-in binary operators
42+--
43+data BinaryOperator
44+ -- |
45+ -- Numeric addition
46+ --
47+ = Add
48+ -- |
49+ -- Numeric subtraction
50+ --
51+ | Subtract
52+ -- |
53+ -- Numeric multiplication
54+ --
55+ | Multiply
56+ -- |
57+ -- Numeric division
58+ --
59+ | Divide
60+ -- |
61+ -- Remainder
62+ --
63+ | Modulus
64+ -- |
65+ -- Generic equality test
66+ --
67+ | EqualTo
68+ -- |
69+ -- Generic inequality test
70+ --
71+ | NotEqualTo
72+ -- |
73+ -- Numeric less-than
74+ --
75+ | LessThan
76+ -- |
77+ -- Numeric less-than-or-equal
78+ --
79+ | LessThanOrEqualTo
80+ -- |
81+ -- Numeric greater-than
82+ --
83+ | GreaterThan
84+ -- |
85+ -- Numeric greater-than-or-equal
86+ --
87+ | GreaterThanOrEqualTo
88+ -- |
89+ -- Boolean and
90+ --
91+ | And
92+ -- |
93+ -- Boolean or
94+ --
95+ | Or
96+ -- |
97+ -- Bitwise and
98+ --
99+ | BitwiseAnd
100+ -- |
101+ -- Bitwise or
102+ --
103+ | BitwiseOr
104+ -- |
105+ -- Bitwise xor
106+ --
107+ | BitwiseXor
108+ -- |
109+ -- Bitwise left shift
110+ --
111+ | ShiftLeft
112+ -- |
113+ -- Bitwise right shift
114+ --
115+ | ShiftRight
116+ -- |
117+ -- Bitwise right shift with zero-fill
118+ --
119+ | ZeroFillShiftRight
120+ deriving (Show, Eq)
121+
122+-- |
123+-- Data type for simplified Javascript expressions
124+--
125+data JS
126+ -- |
127+ -- A numeric literal
128+ --
129+ = JSNumericLiteral (Maybe SourceSpan) (Either Integer Double)
130+ -- |
131+ -- A string literal
132+ --
133+ | JSStringLiteral (Maybe SourceSpan) String
134+ -- |
135+ -- A boolean literal
136+ --
137+ | JSBooleanLiteral (Maybe SourceSpan) Bool
138+ -- |
139+ -- A unary operator application
140+ --
141+ | JSUnary (Maybe SourceSpan) UnaryOperator JS
142+ -- |
143+ -- A binary operator application
144+ --
145+ | JSBinary (Maybe SourceSpan) BinaryOperator JS JS
146+ -- |
147+ -- An array literal
148+ --
149+ | JSArrayLiteral (Maybe SourceSpan) [JS]
150+ -- |
151+ -- An array indexer expression
152+ --
153+ | JSIndexer (Maybe SourceSpan) JS JS
154+ -- |
155+ -- An object literal
156+ --
157+ | JSObjectLiteral (Maybe SourceSpan) [(String, JS)]
158+ -- |
159+ -- An object property accessor expression
160+ --
161+ | JSAccessor (Maybe SourceSpan) String JS
162+ -- |
163+ -- A function introduction (optional name, arguments, body)
164+ --
165+ | JSFunction (Maybe SourceSpan) (Maybe String) [String] JS
166+ -- |
167+ -- Function application
168+ --
169+ | JSApp (Maybe SourceSpan) JS [JS]
170+ -- |
171+ -- Variable
172+ --
173+ | JSVar (Maybe SourceSpan) String
174+ -- |
175+ -- Conditional expression
176+ --
177+ | JSConditional (Maybe SourceSpan) JS JS JS
178+ -- |
179+ -- A block of expressions in braces
180+ --
181+ | JSBlock (Maybe SourceSpan) [JS]
182+ -- |
183+ -- A variable introduction and optional initialization
184+ --
185+ | JSVariableIntroduction (Maybe SourceSpan) String (Maybe JS)
186+ -- |
187+ -- A variable assignment
188+ --
189+ | JSAssignment (Maybe SourceSpan) JS JS
190+ -- |
191+ -- While loop
192+ --
193+ | JSWhile (Maybe SourceSpan) JS JS
194+ -- |
195+ -- For loop
196+ --
197+ | JSFor (Maybe SourceSpan) String JS JS JS
198+ -- |
199+ -- ForIn loop
200+ --
201+ | JSForIn (Maybe SourceSpan) String JS JS
202+ -- |
203+ -- If-then-else statement
204+ --
205+ | JSIfElse (Maybe SourceSpan) JS JS (Maybe JS)
206+ -- |
207+ -- Return statement
208+ --
209+ | JSReturn (Maybe SourceSpan) JS
210+ -- |
211+ -- Throw statement
212+ --
213+ | JSThrow (Maybe SourceSpan) JS
214+ -- |
215+ -- Type-Of operator
216+ --
217+ | JSTypeOf (Maybe SourceSpan) JS
218+ -- |
219+ -- InstanceOf test
220+ --
221+ | JSInstanceOf (Maybe SourceSpan) JS JS
222+ -- |
223+ -- Labelled statement
224+ --
225+ | JSLabel (Maybe SourceSpan) String JS
226+ -- |
227+ -- Break statement
228+ --
229+ | JSBreak (Maybe SourceSpan) String
230+ -- |
231+ -- Continue statement
232+ --
233+ | JSContinue (Maybe SourceSpan) String
234+ -- |
235+ -- Raw Javascript (generated when parsing fails for an inline foreign import declaration)
236+ --
237+ | JSRaw (Maybe SourceSpan) String
238+ -- |
239+ -- Commented Javascript
240+ --
241+ | JSComment (Maybe SourceSpan) [Comment] JS deriving (Show, Eq)
242+
243+withSourceSpan :: SourceSpan -> JS -> JS
244+withSourceSpan withSpan = go
245+ where
246+ ss :: Maybe SourceSpan
247+ ss = Just withSpan
248+
249+ go :: JS -> JS
250+ go (JSNumericLiteral _ n) = JSNumericLiteral ss n
251+ go (JSStringLiteral _ s) = JSStringLiteral ss s
252+ go (JSBooleanLiteral _ b) = JSBooleanLiteral ss b
253+ go (JSUnary _ op j) = JSUnary ss op j
254+ go (JSBinary _ op j1 j2) = JSBinary ss op j1 j2
255+ go (JSArrayLiteral _ js) = JSArrayLiteral ss js
256+ go (JSIndexer _ j1 j2) = JSIndexer ss j1 j2
257+ go (JSObjectLiteral _ js) = JSObjectLiteral ss js
258+ go (JSAccessor _ prop j) = JSAccessor ss prop j
259+ go (JSFunction _ name args j) = JSFunction ss name args j
260+ go (JSApp _ j js) = JSApp ss j js
261+ go (JSVar _ s) = JSVar ss s
262+ go (JSConditional _ j1 j2 j3) = JSConditional ss j1 j2 j3
263+ go (JSBlock _ js) = JSBlock ss js
264+ go (JSVariableIntroduction _ name j) = JSVariableIntroduction ss name j
265+ go (JSAssignment _ j1 j2) = JSAssignment ss j1 j2
266+ go (JSWhile _ j1 j2) = JSWhile ss j1 j2
267+ go (JSFor _ name j1 j2 j3) = JSFor ss name j1 j2 j3
268+ go (JSForIn _ name j1 j2) = JSForIn ss name j1 j2
269+ go (JSIfElse _ j1 j2 j3) = JSIfElse ss j1 j2 j3
270+ go (JSReturn _ js) = JSReturn ss js
271+ go (JSThrow _ js) = JSThrow ss js
272+ go (JSTypeOf _ js) = JSTypeOf ss js
273+ go (JSInstanceOf _ j1 j2) = JSInstanceOf ss j1 j2
274+ go (JSLabel _ name js) = JSLabel ss name js
275+ go (JSBreak _ s) = JSBreak ss s
276+ go (JSContinue _ s) = JSContinue ss s
277+ go (JSRaw _ s) = JSRaw ss s
278+ go (JSComment _ com j) = JSComment ss com j
279+
280+getSourceSpan :: JS -> Maybe SourceSpan
281+getSourceSpan = go
282+ where
283+ go :: JS -> Maybe SourceSpan
284+ go (JSNumericLiteral ss _) = ss
285+ go (JSStringLiteral ss _) = ss
286+ go (JSBooleanLiteral ss _) = ss
287+ go (JSUnary ss _ _) = ss
288+ go (JSBinary ss _ _ _) = ss
289+ go (JSArrayLiteral ss _) = ss
290+ go (JSIndexer ss _ _) = ss
291+ go (JSObjectLiteral ss _) = ss
292+ go (JSAccessor ss _ _) = ss
293+ go (JSFunction ss _ _ _) = ss
294+ go (JSApp ss _ _) = ss
295+ go (JSVar ss _) = ss
296+ go (JSConditional ss _ _ _) = ss
297+ go (JSBlock ss _) = ss
298+ go (JSVariableIntroduction ss _ _) = ss
299+ go (JSAssignment ss _ _) = ss
300+ go (JSWhile ss _ _) = ss
301+ go (JSFor ss _ _ _ _) = ss
302+ go (JSForIn ss _ _ _) = ss
303+ go (JSIfElse ss _ _ _) = ss
304+ go (JSReturn ss _) = ss
305+ go (JSThrow ss _) = ss
306+ go (JSTypeOf ss _) = ss
307+ go (JSInstanceOf ss _ _) = ss
308+ go (JSLabel ss _ _) = ss
309+ go (JSBreak ss _) = ss
310+ go (JSContinue ss _) = ss
311+ go (JSRaw ss _) = ss
312+ go (JSComment ss _ _) = ss
313+
314+--
315+-- Traversals
316+--
317+
318+everywhereOnJS :: (JS -> JS) -> JS -> JS
319+everywhereOnJS f = go
320+ where
321+ go :: JS -> JS
322+ go (JSUnary ss op j) = f (JSUnary ss op (go j))
323+ go (JSBinary ss op j1 j2) = f (JSBinary ss op (go j1) (go j2))
324+ go (JSArrayLiteral ss js) = f (JSArrayLiteral ss (map go js))
325+ go (JSIndexer ss j1 j2) = f (JSIndexer ss (go j1) (go j2))
326+ go (JSObjectLiteral ss js) = f (JSObjectLiteral ss (map (fmap go) js))
327+ go (JSAccessor ss prop j) = f (JSAccessor ss prop (go j))
328+ go (JSFunction ss name args j) = f (JSFunction ss name args (go j))
329+ go (JSApp ss j js) = f (JSApp ss (go j) (map go js))
330+ go (JSConditional ss j1 j2 j3) = f (JSConditional ss (go j1) (go j2) (go j3))
331+ go (JSBlock ss js) = f (JSBlock ss (map go js))
332+ go (JSVariableIntroduction ss name j) = f (JSVariableIntroduction ss name (fmap go j))
333+ go (JSAssignment ss j1 j2) = f (JSAssignment ss (go j1) (go j2))
334+ go (JSWhile ss j1 j2) = f (JSWhile ss (go j1) (go j2))
335+ go (JSFor ss name j1 j2 j3) = f (JSFor ss name (go j1) (go j2) (go j3))
336+ go (JSForIn ss name j1 j2) = f (JSForIn ss name (go j1) (go j2))
337+ go (JSIfElse ss j1 j2 j3) = f (JSIfElse ss (go j1) (go j2) (fmap go j3))
338+ go (JSReturn ss js) = f (JSReturn ss (go js))
339+ go (JSThrow ss js) = f (JSThrow ss (go js))
340+ go (JSTypeOf ss js) = f (JSTypeOf ss (go js))
341+ go (JSLabel ss name js) = f (JSLabel ss name (go js))
342+ go (JSInstanceOf ss j1 j2) = f (JSInstanceOf ss (go j1) (go j2))
343+ go (JSComment ss com j) = f (JSComment ss com (go j))
344+ go other = f other
345+
346+everywhereOnJSTopDown :: (JS -> JS) -> JS -> JS
347+everywhereOnJSTopDown f = runIdentity . everywhereOnJSTopDownM (Identity . f)
348+
349+everywhereOnJSTopDownM :: (Monad m) => (JS -> m JS) -> JS -> m JS
350+everywhereOnJSTopDownM f = f >=> go
351+ where
352+ f' = f >=> go
353+ go (JSUnary ss op j) = JSUnary ss op <$> f' j
354+ go (JSBinary ss op j1 j2) = JSBinary ss op <$> f' j1 <*> f' j2
355+ go (JSArrayLiteral ss js) = JSArrayLiteral ss <$> traverse f' js
356+ go (JSIndexer ss j1 j2) = JSIndexer ss <$> f' j1 <*> f' j2
357+ go (JSObjectLiteral ss js) = JSObjectLiteral ss <$> traverse (sndM f') js
358+ go (JSAccessor ss prop j) = JSAccessor ss prop <$> f' j
359+ go (JSFunction ss name args j) = JSFunction ss name args <$> f' j
360+ go (JSApp ss j js) = JSApp ss <$> f' j <*> traverse f' js
361+ go (JSConditional ss j1 j2 j3) = JSConditional ss <$> f' j1 <*> f' j2 <*> f' j3
362+ go (JSBlock ss js) = JSBlock ss <$> traverse f' js
363+ go (JSVariableIntroduction ss name j) = JSVariableIntroduction ss name <$> traverse f' j
364+ go (JSAssignment ss j1 j2) = JSAssignment ss <$> f' j1 <*> f' j2
365+ go (JSWhile ss j1 j2) = JSWhile ss <$> f' j1 <*> f' j2
366+ go (JSFor ss name j1 j2 j3) = JSFor ss name <$> f' j1 <*> f' j2 <*> f' j3
367+ go (JSForIn ss name j1 j2) = JSForIn ss name <$> f' j1 <*> f' j2
368+ go (JSIfElse ss j1 j2 j3) = JSIfElse ss <$> f' j1 <*> f' j2 <*> traverse f' j3
369+ go (JSReturn ss j) = JSReturn ss <$> f' j
370+ go (JSThrow ss j) = JSThrow ss <$> f' j
371+ go (JSTypeOf ss j) = JSTypeOf ss <$> f' j
372+ go (JSLabel ss name j) = JSLabel ss name <$> f' j
373+ go (JSInstanceOf ss j1 j2) = JSInstanceOf ss <$> f' j1 <*> f' j2
374+ go (JSComment ss com j) = JSComment ss com <$> f' j
375+ go other = f other
376+
377+everythingOnJS :: (r -> r -> r) -> (JS -> r) -> JS -> r
378+everythingOnJS (<>) f = go
379+ where
380+ go j@(JSUnary _ _ j1) = f j <> go j1
381+ go j@(JSBinary _ _ j1 j2) = f j <> go j1 <> go j2
382+ go j@(JSArrayLiteral _ js) = foldl (<>) (f j) (map go js)
383+ go j@(JSIndexer _ j1 j2) = f j <> go j1 <> go j2
384+ go j@(JSObjectLiteral _ js) = foldl (<>) (f j) (map (go . snd) js)
385+ go j@(JSAccessor _ _ j1) = f j <> go j1
386+ go j@(JSFunction _ _ _ j1) = f j <> go j1
387+ go j@(JSApp _ j1 js) = foldl (<>) (f j <> go j1) (map go js)
388+ go j@(JSConditional _ j1 j2 j3) = f j <> go j1 <> go j2 <> go j3
389+ go j@(JSBlock _ js) = foldl (<>) (f j) (map go js)
390+ go j@(JSVariableIntroduction _ _ (Just j1)) = f j <> go j1
391+ go j@(JSAssignment _ j1 j2) = f j <> go j1 <> go j2
392+ go j@(JSWhile _ j1 j2) = f j <> go j1 <> go j2
393+ go j@(JSFor _ _ j1 j2 j3) = f j <> go j1 <> go j2 <> go j3
394+ go j@(JSForIn _ _ j1 j2) = f j <> go j1 <> go j2
395+ go j@(JSIfElse _ j1 j2 Nothing) = f j <> go j1 <> go j2
396+ go j@(JSIfElse _ j1 j2 (Just j3)) = f j <> go j1 <> go j2 <> go j3
397+ go j@(JSReturn _ j1) = f j <> go j1
398+ go j@(JSThrow _ j1) = f j <> go j1
399+ go j@(JSTypeOf _ j1) = f j <> go j1
400+ go j@(JSLabel _ _ j1) = f j <> go j1
401+ go j@(JSInstanceOf _ j1 j2) = f j <> go j1 <> go j2
402+ go j@(JSComment _ _ j1) = f j <> go j1
403+ go other = f other
src/Language/PureScript/CodeGen/JS/Common.hsnew file+232
@@ -0,0 +1,232 @@
1+-- |
2+-- Common code generation utility functions
3+--
4+module Language.PureScript.CodeGen.JS.Common where
5+
6+import Prelude.Compat
7+
8+import Data.Char
9+import Data.List (intercalate)
10+
11+import Language.PureScript.Crash
12+import Language.PureScript.Names
13+
14+moduleNameToJs :: ModuleName -> String
15+moduleNameToJs (ModuleName pns) =
16+ let name = intercalate "_" (runProperName `map` pns)
17+ in if nameIsJsBuiltIn name then "$$" ++ name else name
18+
19+-- |
20+-- Convert an Ident into a valid Javascript identifier:
21+--
22+-- * Alphanumeric characters are kept unmodified.
23+--
24+-- * Reserved javascript identifiers are prefixed with '$$'.
25+--
26+-- * Symbols are prefixed with '$' followed by a symbol name or their ordinal value.
27+--
28+identToJs :: Ident -> String
29+identToJs (Ident name)
30+ | nameIsJsReserved name || nameIsJsBuiltIn name = "$$" ++ name
31+ | otherwise = concatMap identCharToString name
32+identToJs (GenIdent _ _) = internalError "GenIdent in identToJs"
33+
34+-- |
35+-- Test if a string is a valid JS identifier without escaping.
36+--
37+identNeedsEscaping :: String -> Bool
38+identNeedsEscaping s = s /= identToJs (Ident s) || null s
39+
40+-- |
41+-- Attempts to find a human-readable name for a symbol, if none has been specified returns the
42+-- ordinal value.
43+--
44+identCharToString :: Char -> String
45+identCharToString c | isAlphaNum c = [c]
46+identCharToString '_' = "_"
47+identCharToString '.' = "$dot"
48+identCharToString '$' = "$dollar"
49+identCharToString '~' = "$tilde"
50+identCharToString '=' = "$eq"
51+identCharToString '<' = "$less"
52+identCharToString '>' = "$greater"
53+identCharToString '!' = "$bang"
54+identCharToString '#' = "$hash"
55+identCharToString '%' = "$percent"
56+identCharToString '^' = "$up"
57+identCharToString '&' = "$amp"
58+identCharToString '|' = "$bar"
59+identCharToString '*' = "$times"
60+identCharToString '/' = "$div"
61+identCharToString '+' = "$plus"
62+identCharToString '-' = "$minus"
63+identCharToString ':' = "$colon"
64+identCharToString '\\' = "$bslash"
65+identCharToString '?' = "$qmark"
66+identCharToString '@' = "$at"
67+identCharToString '\'' = "$prime"
68+identCharToString c = '$' : show (ord c)
69+
70+-- |
71+-- Checks whether an identifier name is reserved in Javascript.
72+--
73+nameIsJsReserved :: String -> Bool
74+nameIsJsReserved name =
75+ name `elem` jsAnyReserved
76+
77+-- |
78+-- Checks whether a name matches a built-in value in Javascript.
79+--
80+nameIsJsBuiltIn :: String -> Bool
81+nameIsJsBuiltIn name =
82+ name `elem`
83+ [ "arguments"
84+ , "Array"
85+ , "ArrayBuffer"
86+ , "Boolean"
87+ , "DataView"
88+ , "Date"
89+ , "decodeURI"
90+ , "decodeURIComponent"
91+ , "encodeURI"
92+ , "encodeURIComponent"
93+ , "Error"
94+ , "escape"
95+ , "eval"
96+ , "EvalError"
97+ , "Float32Array"
98+ , "Float64Array"
99+ , "Function"
100+ , "Infinity"
101+ , "Int16Array"
102+ , "Int32Array"
103+ , "Int8Array"
104+ , "Intl"
105+ , "isFinite"
106+ , "isNaN"
107+ , "JSON"
108+ , "Map"
109+ , "Math"
110+ , "NaN"
111+ , "Number"
112+ , "Object"
113+ , "parseFloat"
114+ , "parseInt"
115+ , "Promise"
116+ , "Proxy"
117+ , "RangeError"
118+ , "ReferenceError"
119+ , "Reflect"
120+ , "RegExp"
121+ , "Set"
122+ , "SIMD"
123+ , "String"
124+ , "Symbol"
125+ , "SyntaxError"
126+ , "TypeError"
127+ , "Uint16Array"
128+ , "Uint32Array"
129+ , "Uint8Array"
130+ , "Uint8ClampedArray"
131+ , "undefined"
132+ , "unescape"
133+ , "URIError"
134+ , "WeakMap"
135+ , "WeakSet"
136+ ]
137+
138+jsAnyReserved :: [String]
139+jsAnyReserved =
140+ concat
141+ [ jsKeywords
142+ , jsSometimesReserved
143+ , jsFutureReserved
144+ , jsFutureReservedStrict
145+ , jsOldReserved
146+ , jsLiterals
147+ ]
148+
149+jsKeywords :: [String]
150+jsKeywords =
151+ [ "break"
152+ , "case"
153+ , "catch"
154+ , "class"
155+ , "const"
156+ , "continue"
157+ , "debugger"
158+ , "default"
159+ , "delete"
160+ , "do"
161+ , "else"
162+ , "export"
163+ , "extends"
164+ , "finally"
165+ , "for"
166+ , "function"
167+ , "if"
168+ , "import"
169+ , "in"
170+ , "instanceof"
171+ , "new"
172+ , "return"
173+ , "super"
174+ , "switch"
175+ , "this"
176+ , "throw"
177+ , "try"
178+ , "typeof"
179+ , "var"
180+ , "void"
181+ , "while"
182+ , "with"
183+ ]
184+
185+jsSometimesReserved :: [String]
186+jsSometimesReserved =
187+ [ "await"
188+ , "let"
189+ , "static"
190+ , "yield"
191+ ]
192+
193+jsFutureReserved :: [String]
194+jsFutureReserved =
195+ [ "enum" ]
196+
197+jsFutureReservedStrict :: [String]
198+jsFutureReservedStrict =
199+ [ "implements"
200+ , "interface"
201+ , "package"
202+ , "private"
203+ , "protected"
204+ , "public"
205+ ]
206+
207+jsOldReserved :: [String]
208+jsOldReserved =
209+ [ "abstract"
210+ , "boolean"
211+ , "byte"
212+ , "char"
213+ , "double"
214+ , "final"
215+ , "float"
216+ , "goto"
217+ , "int"
218+ , "long"
219+ , "native"
220+ , "short"
221+ , "synchronized"
222+ , "throws"
223+ , "transient"
224+ , "volatile"
225+ ]
226+
227+jsLiterals :: [String]
228+jsLiterals =
229+ [ "null"
230+ , "true"
231+ , "false"
232+ ]
src/Language/PureScript/CodeGen/JS/Optimizer.hsnew file+79
@@ -0,0 +1,79 @@
1+-- |
2+-- This module optimizes code in the simplified-Javascript intermediate representation.
3+--
4+-- The following optimizations are supported:
5+--
6+-- * Collapsing nested blocks
7+--
8+-- * Tail call elimination
9+--
10+-- * Inlining of (>>=) and ret for the Eff monad
11+--
12+-- * Removal of unnecessary thunks
13+--
14+-- * Eta conversion
15+--
16+-- * Inlining variables
17+--
18+-- * Inline Prelude.($), Prelude.(#), Prelude.(++), Prelude.(!!)
19+--
20+-- * Inlining primitive Javascript operators
21+--
22+module Language.PureScript.CodeGen.JS.Optimizer (optimize) where
23+
24+import Prelude.Compat
25+
26+import Control.Monad.Reader (MonadReader, ask, asks)
27+import Control.Monad.Supply.Class (MonadSupply)
28+
29+import Language.PureScript.CodeGen.JS.AST
30+import Language.PureScript.CodeGen.JS.Optimizer.Blocks
31+import Language.PureScript.CodeGen.JS.Optimizer.Common
32+import Language.PureScript.CodeGen.JS.Optimizer.Inliner
33+import Language.PureScript.CodeGen.JS.Optimizer.MagicDo
34+import Language.PureScript.CodeGen.JS.Optimizer.TCO
35+import Language.PureScript.CodeGen.JS.Optimizer.Unused
36+import Language.PureScript.Options
37+import qualified Language.PureScript.Constants as C
38+
39+-- |
40+-- Apply a series of optimizer passes to simplified Javascript code
41+--
42+optimize :: (MonadReader Options m, MonadSupply m) => JS -> m JS
43+optimize js = do
44+ noOpt <- asks optionsNoOptimizations
45+ if noOpt then return js else optimize' js
46+
47+optimize' :: (MonadReader Options m, MonadSupply m) => JS -> m JS
48+optimize' js = do
49+ opts <- ask
50+ js' <- untilFixedPoint (inlineFnComposition . tidyUp . applyAll
51+ [ inlineCommonValues
52+ , inlineOperator (C.prelude, (C.$)) $ \f x -> JSApp Nothing f [x]
53+ , inlineOperator (C.dataFunction, C.apply) $ \f x -> JSApp Nothing f [x]
54+ , inlineOperator (C.prelude, (C.#)) $ \x f -> JSApp Nothing f [x]
55+ , inlineOperator (C.dataFunction, C.applyFlipped) $ \x f -> JSApp Nothing f [x]
56+ , inlineOperator (C.dataArrayUnsafe, C.unsafeIndex) $ flip (JSIndexer Nothing)
57+ , inlineCommonOperators
58+ ]) js
59+ untilFixedPoint (return . tidyUp) . tco opts . magicDo opts $ js'
60+ where
61+ tidyUp :: JS -> JS
62+ tidyUp = applyAll
63+ [ collapseNestedBlocks
64+ , collapseNestedIfs
65+ , removeCodeAfterReturnStatements
66+ , removeUnusedArg
67+ , removeUndefinedApp
68+ , unThunk
69+ , etaConvert
70+ , evaluateIifes
71+ , inlineVariables
72+ ]
73+
74+untilFixedPoint :: (Monad m, Eq a) => (a -> m a) -> a -> m a
75+untilFixedPoint f = go
76+ where
77+ go a = do
78+ a' <- f a
79+ if a' == a then return a' else go a'
src/Language/PureScript/CodeGen/JS/Optimizer/Blocks.hsnew file+32
@@ -0,0 +1,32 @@
1+-- |
2+-- Optimizer steps for simplifying Javascript blocks
3+--
4+module Language.PureScript.CodeGen.JS.Optimizer.Blocks
5+ ( collapseNestedBlocks
6+ , collapseNestedIfs
7+ ) where
8+
9+import Prelude.Compat
10+
11+import Language.PureScript.CodeGen.JS.AST
12+
13+-- |
14+-- Collapse blocks which appear nested directly below another block
15+--
16+collapseNestedBlocks :: JS -> JS
17+collapseNestedBlocks = everywhereOnJS collapse
18+ where
19+ collapse :: JS -> JS
20+ collapse (JSBlock ss sts) = JSBlock ss (concatMap go sts)
21+ collapse js = js
22+ go :: JS -> [JS]
23+ go (JSBlock _ sts) = sts
24+ go s = [s]
25+
26+collapseNestedIfs :: JS -> JS
27+collapseNestedIfs = everywhereOnJS collapse
28+ where
29+ collapse :: JS -> JS
30+ collapse (JSIfElse s1 cond1 (JSBlock _ [JSIfElse s2 cond2 body Nothing]) Nothing) =
31+ JSIfElse s1 (JSBinary s2 And cond1 cond2) body Nothing
32+ collapse js = js
src/Language/PureScript/CodeGen/JS/Optimizer/Common.hsnew file+82
@@ -0,0 +1,82 @@
1+-- |
2+-- Common functions used by the various optimizer phases
3+--
4+module Language.PureScript.CodeGen.JS.Optimizer.Common where
5+
6+import Prelude.Compat
7+
8+import Data.Maybe (fromMaybe)
9+
10+import Language.PureScript.Crash
11+import Language.PureScript.CodeGen.JS.AST
12+
13+applyAll :: [a -> a] -> a -> a
14+applyAll = foldl1 (.)
15+
16+replaceIdent :: String -> JS -> JS -> JS
17+replaceIdent var1 js = everywhereOnJS replace
18+ where
19+ replace (JSVar _ var2) | var1 == var2 = js
20+ replace other = other
21+
22+replaceIdents :: [(String, JS)] -> JS -> JS
23+replaceIdents vars = everywhereOnJS replace
24+ where
25+ replace v@(JSVar _ var) = fromMaybe v $ lookup var vars
26+ replace other = other
27+
28+isReassigned :: String -> JS -> Bool
29+isReassigned var1 = everythingOnJS (||) check
30+ where
31+ check :: JS -> Bool
32+ check (JSFunction _ _ args _) | var1 `elem` args = True
33+ check (JSVariableIntroduction _ arg _) | var1 == arg = True
34+ check (JSAssignment _ (JSVar _ arg) _) | var1 == arg = True
35+ check (JSFor _ arg _ _ _) | var1 == arg = True
36+ check (JSForIn _ arg _ _) | var1 == arg = True
37+ check _ = False
38+
39+isRebound :: JS -> JS -> Bool
40+isRebound js d = any (\v -> isReassigned v d || isUpdated v d) (everythingOnJS (++) variablesOf js)
41+ where
42+ variablesOf (JSVar _ var) = [var]
43+ variablesOf _ = []
44+
45+isUsed :: String -> JS -> Bool
46+isUsed var1 = everythingOnJS (||) check
47+ where
48+ check :: JS -> Bool
49+ check (JSVar _ var2) | var1 == var2 = True
50+ check (JSAssignment _ target _) | var1 == targetVariable target = True
51+ check _ = False
52+
53+targetVariable :: JS -> String
54+targetVariable (JSVar _ var) = var
55+targetVariable (JSAccessor _ _ tgt) = targetVariable tgt
56+targetVariable (JSIndexer _ _ tgt) = targetVariable tgt
57+targetVariable _ = internalError "Invalid argument to targetVariable"
58+
59+isUpdated :: String -> JS -> Bool
60+isUpdated var1 = everythingOnJS (||) check
61+ where
62+ check :: JS -> Bool
63+ check (JSAssignment _ target _) | var1 == targetVariable target = True
64+ check _ = False
65+
66+removeFromBlock :: ([JS] -> [JS]) -> JS -> JS
67+removeFromBlock go (JSBlock ss sts) = JSBlock ss (go sts)
68+removeFromBlock _ js = js
69+
70+isFn :: (String, String) -> JS -> Bool
71+isFn (moduleName, fnName) (JSAccessor _ x (JSVar _ y)) =
72+ x == fnName && y == moduleName
73+isFn (moduleName, fnName) (JSIndexer _ (JSStringLiteral _ x) (JSVar _ y)) =
74+ x == fnName && y == moduleName
75+isFn _ _ = False
76+
77+isDict :: (String, String) -> JS -> Bool
78+isDict (moduleName, dictName) (JSAccessor _ x (JSVar _ y)) = x == dictName && y == moduleName
79+isDict _ _ = False
80+
81+isDict' :: [(String, String)] -> JS -> Bool
82+isDict' xs js = any (`isDict` js) xs
src/Language/PureScript/CodeGen/JS/Optimizer/Inliner.hsnew file+365
@@ -0,0 +1,365 @@
1+-- |
2+-- This module provides basic inlining capabilities
3+--
4+module Language.PureScript.CodeGen.JS.Optimizer.Inliner
5+ ( inlineVariables
6+ , inlineCommonValues
7+ , inlineOperator
8+ , inlineCommonOperators
9+ , inlineFnComposition
10+ , etaConvert
11+ , unThunk
12+ , evaluateIifes
13+ ) where
14+
15+import Prelude.Compat
16+
17+import Control.Monad.Supply.Class (MonadSupply, freshName)
18+
19+import Data.Maybe (fromMaybe)
20+
21+import Language.PureScript.CodeGen.JS.AST
22+import Language.PureScript.CodeGen.JS.Optimizer.Common
23+import qualified Language.PureScript.Constants as C
24+
25+-- TODO: Potential bug:
26+-- Shouldn't just inline this case: { var x = 0; x.toFixed(10); }
27+-- Needs to be: { 0..toFixed(10); }
28+-- Probably needs to be fixed in pretty-printer instead.
29+shouldInline :: JS -> Bool
30+shouldInline (JSVar _ _) = True
31+shouldInline (JSNumericLiteral _ _) = True
32+shouldInline (JSStringLiteral _ _) = True
33+shouldInline (JSBooleanLiteral _ _) = True
34+shouldInline (JSAccessor _ _ val) = shouldInline val
35+shouldInline (JSIndexer _ index val) = shouldInline index && shouldInline val
36+shouldInline _ = False
37+
38+etaConvert :: JS -> JS
39+etaConvert = everywhereOnJS convert
40+ where
41+ convert :: JS -> JS
42+ convert (JSBlock ss [JSReturn _ (JSApp _ (JSFunction _ Nothing idents block@(JSBlock _ body)) args)])
43+ | all shouldInline args &&
44+ not (any (`isRebound` block) (map (JSVar Nothing) idents)) &&
45+ not (any (`isRebound` block) args)
46+ = JSBlock ss (map (replaceIdents (zip idents args)) body)
47+ convert (JSFunction _ Nothing [] (JSBlock _ [JSReturn _ (JSApp _ fn [])])) = fn
48+ convert js = js
49+
50+unThunk :: JS -> JS
51+unThunk = everywhereOnJS convert
52+ where
53+ convert :: JS -> JS
54+ convert (JSBlock ss []) = JSBlock ss []
55+ convert (JSBlock ss jss) =
56+ case last jss of
57+ JSReturn _ (JSApp _ (JSFunction _ Nothing [] (JSBlock _ body)) []) -> JSBlock ss $ init jss ++ body
58+ _ -> JSBlock ss jss
59+ convert js = js
60+
61+evaluateIifes :: JS -> JS
62+evaluateIifes = everywhereOnJS convert
63+ where
64+ convert :: JS -> JS
65+ convert (JSApp _ (JSFunction _ Nothing [] (JSBlock _ [JSReturn _ ret])) []) = ret
66+ convert js = js
67+
68+inlineVariables :: JS -> JS
69+inlineVariables = everywhereOnJS $ removeFromBlock go
70+ where
71+ go :: [JS] -> [JS]
72+ go [] = []
73+ go (JSVariableIntroduction _ var (Just js) : sts)
74+ | shouldInline js && not (any (isReassigned var) sts) && not (any (isRebound js) sts) && not (any (isUpdated var) sts) =
75+ go (map (replaceIdent var js) sts)
76+ go (s:sts) = s : go sts
77+
78+inlineCommonValues :: JS -> JS
79+inlineCommonValues = everywhereOnJS convert
80+ where
81+ convert :: JS -> JS
82+ convert (JSApp ss fn [dict])
83+ | isDict' [semiringNumber, semiringInt] dict && isFn fnZero fn = JSNumericLiteral ss (Left 0)
84+ | isDict' [semiringNumber, semiringInt] dict && isFn fnOne fn = JSNumericLiteral ss (Left 1)
85+ | isDict boundedBoolean dict && isFn fnBottom fn = JSBooleanLiteral ss False
86+ | isDict boundedBoolean dict && isFn fnTop fn = JSBooleanLiteral ss True
87+ convert (JSApp ss (JSApp _ (JSApp _ fn [dict]) [x]) [y])
88+ | isDict semiringInt dict && isFn fnAdd fn = intOp ss Add x y
89+ | isDict semiringInt dict && isFn fnMultiply fn = intOp ss Multiply x y
90+ | isDict euclideanRingInt dict && isFn fnDivide fn = intOp ss Divide x y
91+ | isDict ringInt dict && isFn fnSubtract fn = intOp ss Subtract x y
92+ convert other = other
93+ fnZero = (C.dataSemiring, C.zero)
94+ fnOne = (C.dataSemiring, C.one)
95+ fnBottom = (C.dataBounded, C.bottom)
96+ fnTop = (C.dataBounded, C.top)
97+ fnAdd = (C.dataSemiring, C.add)
98+ fnDivide = (C.dataEuclideanRing, C.div)
99+ fnMultiply = (C.dataSemiring, C.mul)
100+ fnSubtract = (C.dataRing, C.sub)
101+ intOp ss op x y = JSBinary ss BitwiseOr (JSBinary ss op x y) (JSNumericLiteral ss (Left 0))
102+
103+inlineOperator :: (String, String) -> (JS -> JS -> JS) -> JS -> JS
104+inlineOperator (m, op) f = everywhereOnJS convert
105+ where
106+ convert :: JS -> JS
107+ convert (JSApp _ (JSApp _ op' [x]) [y]) | isOp op' = f x y
108+ convert other = other
109+ isOp (JSIndexer _ (JSStringLiteral _ op') (JSVar _ m')) = m == m' && op == op'
110+ isOp _ = False
111+
112+inlineCommonOperators :: JS -> JS
113+inlineCommonOperators = applyAll $
114+ [ binary semiringNumber opAdd Add
115+ , binary semiringNumber opMul Multiply
116+
117+ , binary ringNumber opSub Subtract
118+ , unary ringNumber opNegate Negate
119+ , binary ringInt opSub Subtract
120+ , unary ringInt opNegate Negate
121+
122+ , binary euclideanRingNumber opDiv Divide
123+ , binary euclideanRingInt opMod Modulus
124+
125+ , binary eqNumber opEq EqualTo
126+ , binary eqNumber opNotEq NotEqualTo
127+ , binary eqInt opEq EqualTo
128+ , binary eqInt opNotEq NotEqualTo
129+ , binary eqString opEq EqualTo
130+ , binary eqString opNotEq NotEqualTo
131+ , binary eqChar opEq EqualTo
132+ , binary eqChar opNotEq NotEqualTo
133+ , binary eqBoolean opEq EqualTo
134+ , binary eqBoolean opNotEq NotEqualTo
135+
136+ , binary ordBoolean opLessThan LessThan
137+ , binary ordBoolean opLessThanOrEq LessThanOrEqualTo
138+ , binary ordBoolean opGreaterThan GreaterThan
139+ , binary ordBoolean opGreaterThanOrEq GreaterThanOrEqualTo
140+ , binary ordChar opLessThan LessThan
141+ , binary ordChar opLessThanOrEq LessThanOrEqualTo
142+ , binary ordChar opGreaterThan GreaterThan
143+ , binary ordChar opGreaterThanOrEq GreaterThanOrEqualTo
144+ , binary ordInt opLessThan LessThan
145+ , binary ordInt opLessThanOrEq LessThanOrEqualTo
146+ , binary ordInt opGreaterThan GreaterThan
147+ , binary ordInt opGreaterThanOrEq GreaterThanOrEqualTo
148+ , binary ordNumber opLessThan LessThan
149+ , binary ordNumber opLessThanOrEq LessThanOrEqualTo
150+ , binary ordNumber opGreaterThan GreaterThan
151+ , binary ordNumber opGreaterThanOrEq GreaterThanOrEqualTo
152+ , binary ordString opLessThan LessThan
153+ , binary ordString opLessThanOrEq LessThanOrEqualTo
154+ , binary ordString opGreaterThan GreaterThan
155+ , binary ordString opGreaterThanOrEq GreaterThanOrEqualTo
156+
157+ , binary semigroupString opAppend Add
158+
159+ , binary heytingAlgebraBoolean opConj And
160+ , binary heytingAlgebraBoolean opDisj Or
161+ , unary heytingAlgebraBoolean opNot Not
162+
163+ , binary' C.dataIntBits (C..|.) BitwiseOr
164+ , binary' C.dataIntBits (C..&.) BitwiseAnd
165+ , binary' C.dataIntBits (C..^.) BitwiseXor
166+ , binary' C.dataIntBits C.shl ShiftLeft
167+ , binary' C.dataIntBits C.shr ShiftRight
168+ , binary' C.dataIntBits C.zshr ZeroFillShiftRight
169+ , unary' C.dataIntBits C.complement BitwiseNot
170+ ] ++
171+ [ fn | i <- [0..10], fn <- [ mkFn i, runFn i ] ]
172+ where
173+ binary :: (String, String) -> (String, String) -> BinaryOperator -> JS -> JS
174+ binary dict fns op = everywhereOnJS convert
175+ where
176+ convert :: JS -> JS
177+ convert (JSApp ss (JSApp _ (JSApp _ fn [dict']) [x]) [y]) | isDict dict dict' && isFn fns fn = JSBinary ss op x y
178+ convert other = other
179+ binary' :: String -> String -> BinaryOperator -> JS -> JS
180+ binary' moduleName opString op = everywhereOnJS convert
181+ where
182+ convert :: JS -> JS
183+ convert (JSApp ss (JSApp _ fn [x]) [y]) | isFn (moduleName, opString) fn = JSBinary ss op x y
184+ convert other = other
185+ unary :: (String, String) -> (String, String) -> UnaryOperator -> JS -> JS
186+ unary dicts fns op = everywhereOnJS convert
187+ where
188+ convert :: JS -> JS
189+ convert (JSApp ss (JSApp _ fn [dict']) [x]) | isDict dicts dict' && isFn fns fn = JSUnary ss op x
190+ convert other = other
191+ unary' :: String -> String -> UnaryOperator -> JS -> JS
192+ unary' moduleName fnName op = everywhereOnJS convert
193+ where
194+ convert :: JS -> JS
195+ convert (JSApp ss fn [x]) | isFn (moduleName, fnName) fn = JSUnary ss op x
196+ convert other = other
197+ mkFn :: Int -> JS -> JS
198+ mkFn 0 = everywhereOnJS convert
199+ where
200+ convert :: JS -> JS
201+ convert (JSApp _ mkFnN [JSFunction s1 Nothing [_] (JSBlock s2 js)]) | isNFn C.mkFn 0 mkFnN =
202+ JSFunction s1 Nothing [] (JSBlock s2 js)
203+ convert other = other
204+ mkFn n = everywhereOnJS convert
205+ where
206+ convert :: JS -> JS
207+ convert orig@(JSApp ss mkFnN [fn]) | isNFn C.mkFn n mkFnN =
208+ case collectArgs n [] fn of
209+ Just (args, js) -> JSFunction ss Nothing args (JSBlock ss js)
210+ Nothing -> orig
211+ convert other = other
212+ collectArgs :: Int -> [String] -> JS -> Maybe ([String], [JS])
213+ collectArgs 1 acc (JSFunction _ Nothing [oneArg] (JSBlock _ js)) | length acc == n - 1 = Just (reverse (oneArg : acc), js)
214+ collectArgs m acc (JSFunction _ Nothing [oneArg] (JSBlock _ [JSReturn _ ret])) = collectArgs (m - 1) (oneArg : acc) ret
215+ collectArgs _ _ _ = Nothing
216+
217+ isNFn :: String -> Int -> JS -> Bool
218+ isNFn prefix n (JSVar _ name) = name == (prefix ++ show n)
219+ isNFn prefix n (JSAccessor _ name (JSVar _ dataFunctionUncurried)) | dataFunctionUncurried == C.dataFunctionUncurried = name == (prefix ++ show n)
220+ isNFn _ _ _ = False
221+
222+ runFn :: Int -> JS -> JS
223+ runFn n = everywhereOnJS convert
224+ where
225+ convert :: JS -> JS
226+ convert js = fromMaybe js $ go n [] js
227+
228+ go :: Int -> [JS] -> JS -> Maybe JS
229+ go 0 acc (JSApp ss runFnN [fn]) | isNFn C.runFn n runFnN && length acc == n = Just (JSApp ss fn acc)
230+ go m acc (JSApp _ lhs [arg]) = go (m - 1) (arg : acc) lhs
231+ go _ _ _ = Nothing
232+
233+-- (f <<< g $ x) = f (g x)
234+-- (f <<< g) = \x -> f (g x)
235+inlineFnComposition :: (MonadSupply m) => JS -> m JS
236+inlineFnComposition = everywhereOnJSTopDownM convert
237+ where
238+ convert :: (MonadSupply m) => JS -> m JS
239+ convert (JSApp s1 (JSApp s2 (JSApp _ (JSApp _ fn [dict']) [x]) [y]) [z])
240+ | isFnCompose dict' fn = return $ JSApp s1 x [JSApp s2 y [z]]
241+ | isFnComposeFlipped dict' fn = return $ JSApp s2 y [JSApp s1 x [z]]
242+ convert (JSApp ss (JSApp _ (JSApp _ fn [dict']) [x]) [y])
243+ | isFnCompose dict' fn = do
244+ arg <- freshName
245+ return $ JSFunction ss Nothing [arg] (JSBlock ss [JSReturn Nothing $ JSApp Nothing x [JSApp Nothing y [JSVar Nothing arg]]])
246+ | isFnComposeFlipped dict' fn = do
247+ arg <- freshName
248+ return $ JSFunction ss Nothing [arg] (JSBlock ss [JSReturn Nothing $ JSApp Nothing y [JSApp Nothing x [JSVar Nothing arg]]])
249+ convert other = return other
250+ isFnCompose :: JS -> JS -> Bool
251+ isFnCompose dict' fn = isDict semigroupoidFn dict' && isFn fnCompose fn
252+ isFnComposeFlipped :: JS -> JS -> Bool
253+ isFnComposeFlipped dict' fn = isDict semigroupoidFn dict' && isFn fnComposeFlipped fn
254+ fnCompose :: (String, String)
255+ fnCompose = (C.controlSemigroupoid, C.compose)
256+ fnComposeFlipped :: (String, String)
257+ fnComposeFlipped = (C.controlSemigroupoid, C.composeFlipped)
258+
259+semiringNumber :: (String, String)
260+semiringNumber = (C.dataSemiring, C.semiringNumber)
261+
262+semiringInt :: (String, String)
263+semiringInt = (C.dataSemiring, C.semiringInt)
264+
265+ringNumber :: (String, String)
266+ringNumber = (C.dataRing, C.ringNumber)
267+
268+ringInt :: (String, String)
269+ringInt = (C.dataRing, C.ringInt)
270+
271+euclideanRingNumber :: (String, String)
272+euclideanRingNumber = (C.dataEuclideanRing, C.euclideanRingNumber)
273+
274+euclideanRingInt :: (String, String)
275+euclideanRingInt = (C.dataEuclideanRing, C.euclideanRingInt)
276+
277+eqNumber :: (String, String)
278+eqNumber = (C.dataEq, C.eqNumber)
279+
280+eqInt :: (String, String)
281+eqInt = (C.dataEq, C.eqInt)
282+
283+eqString :: (String, String)
284+eqString = (C.dataEq, C.eqString)
285+
286+eqChar :: (String, String)
287+eqChar = (C.dataEq, C.eqChar)
288+
289+eqBoolean :: (String, String)
290+eqBoolean = (C.dataEq, C.eqBoolean)
291+
292+ordBoolean :: (String, String)
293+ordBoolean = (C.dataOrd, C.ordBoolean)
294+
295+ordNumber :: (String, String)
296+ordNumber = (C.dataOrd, C.ordNumber)
297+
298+ordInt :: (String, String)
299+ordInt = (C.dataOrd, C.ordInt)
300+
301+ordString :: (String, String)
302+ordString = (C.dataOrd, C.ordString)
303+
304+ordChar :: (String, String)
305+ordChar = (C.dataOrd, C.ordChar)
306+
307+semigroupString :: (String, String)
308+semigroupString = (C.dataSemigroup, C.semigroupString)
309+
310+boundedBoolean :: (String, String)
311+boundedBoolean = (C.dataBounded, C.boundedBoolean)
312+
313+heytingAlgebraBoolean :: (String, String)
314+heytingAlgebraBoolean = (C.dataHeytingAlgebra, C.heytingAlgebraBoolean)
315+
316+semigroupoidFn :: (String, String)
317+semigroupoidFn = (C.controlSemigroupoid, C.semigroupoidFn)
318+
319+opAdd :: (String, String)
320+opAdd = (C.dataSemiring, C.add)
321+
322+opMul :: (String, String)
323+opMul = (C.dataSemiring, C.mul)
324+
325+opEq :: (String, String)
326+opEq = (C.dataEq, C.eq)
327+
328+opNotEq :: (String, String)
329+opNotEq = (C.dataEq, C.notEq)
330+
331+opLessThan :: (String, String)
332+opLessThan = (C.dataOrd, C.lessThan)
333+
334+opLessThanOrEq :: (String, String)
335+opLessThanOrEq = (C.dataOrd, C.lessThanOrEq)
336+
337+opGreaterThan :: (String, String)
338+opGreaterThan = (C.dataOrd, C.greaterThan)
339+
340+opGreaterThanOrEq :: (String, String)
341+opGreaterThanOrEq = (C.dataOrd, C.greaterThanOrEq)
342+
343+opAppend :: (String, String)
344+opAppend = (C.dataSemigroup, C.append)
345+
346+opSub :: (String, String)
347+opSub = (C.dataRing, C.sub)
348+
349+opNegate :: (String, String)
350+opNegate = (C.dataRing, C.negate)
351+
352+opDiv :: (String, String)
353+opDiv = (C.dataEuclideanRing, C.div)
354+
355+opMod :: (String, String)
356+opMod = (C.dataEuclideanRing, C.mod)
357+
358+opConj :: (String, String)
359+opConj = (C.dataHeytingAlgebra, C.conj)
360+
361+opDisj :: (String, String)
362+opDisj = (C.dataHeytingAlgebra, C.disj)
363+
364+opNot :: (String, String)
365+opNot = (C.dataHeytingAlgebra, C.not)
src/Language/PureScript/CodeGen/JS/Optimizer/MagicDo.hsnew file+136

This diff is too big to show here.

src/Language/PureScript/CodeGen/JS/Optimizer/TCO.hsnew file+120

This diff is too big to show here.

src/Language/PureScript/CodeGen/JS/Optimizer/Unused.hsnew file+35

This diff is too big to show here.

src/Language/PureScript/Comments.hsnew file+17

This diff is too big to show here.

src/Language/PureScript/Constants.hsnew file+398

This diff is too big to show here.

src/Language/PureScript/CoreFn.hsnew file+15

This diff is too big to show here.

src/Language/PureScript/CoreFn/Ann.hsnew file+25

This diff is too big to show here.

src/Language/PureScript/CoreFn/Binders.hsnew file+42

This diff is too big to show here.

src/Language/PureScript/CoreFn/Desugar.hsnew file+270

This diff is too big to show here.

src/Language/PureScript/CoreFn/Expr.hsnew file+121

This diff is too big to show here.

src/Language/PureScript/CoreFn/Meta.hsnew file+42

This diff is too big to show here.

src/Language/PureScript/CoreFn/Module.hsnew file+22

This diff is too big to show here.

src/Language/PureScript/CoreFn/Traversals.hsnew file+77

This diff is too big to show here.

src/Language/PureScript/Crash.hsnew file+11

This diff is too big to show here.

src/Language/PureScript/Docs.hsnew file+14

This diff is too big to show here.

src/Language/PureScript/Docs/AsMarkdown.hsnew file+136

This diff is too big to show here.

src/Language/PureScript/Docs/Convert.hsnew file+192

This diff is too big to show here.

src/Language/PureScript/Docs/Convert/ReExports.hsnew file+510

This diff is too big to show here.

src/Language/PureScript/Docs/Convert/Single.hsnew file+200

This diff is too big to show here.

src/Language/PureScript/Docs/ParseAndBookmark.hsnew file+98

This diff is too big to show here.

src/Language/PureScript/Docs/Render.hsnew file+146

This diff is too big to show here.

src/Language/PureScript/Docs/RenderedCode.hsnew file+8

This diff is too big to show here.

src/Language/PureScript/Docs/RenderedCode/Render.hsnew file+212

This diff is too big to show here.

src/Language/PureScript/Docs/RenderedCode/Types.hsnew file+202

This diff is too big to show here.

src/Language/PureScript/Docs/Types.hsnew file+595

This diff is too big to show here.

src/Language/PureScript/Docs/Utils/MonoidExtras.hsnew file+9

This diff is too big to show here.

src/Language/PureScript/Environment.hsnew file+278

This diff is too big to show here.

src/Language/PureScript/Errors.hsnew file+1256

This diff is too big to show here.

src/Language/PureScript/Errors/JSON.hsnew file+73

This diff is too big to show here.

src/Language/PureScript/Externs.hsnew file+226

This diff is too big to show here.

src/Language/PureScript/Ide.hsnew file+196

This diff is too big to show here.

src/Language/PureScript/Ide/CaseSplit.hsnew file+150

This diff is too big to show here.

src/Language/PureScript/Ide/Command.hsnew file+147

This diff is too big to show here.

src/Language/PureScript/Ide/Completion.hsnew file+32

This diff is too big to show here.

src/Language/PureScript/Ide/Conversions.hsnew file+35

This diff is too big to show here.

src/Language/PureScript/Ide/Error.hsnew file+54

This diff is too big to show here.

src/Language/PureScript/Ide/Externs.hsnew file+124

This diff is too big to show here.

src/Language/PureScript/Ide/Filter.hsnew file+93

This diff is too big to show here.

src/Language/PureScript/Ide/Imports.hsnew file+332

This diff is too big to show here.

src/Language/PureScript/Ide/Matcher.hsnew file+124

This diff is too big to show here.

src/Language/PureScript/Ide/Pursuit.hsnew file+75

This diff is too big to show here.

src/Language/PureScript/Ide/Rebuild.hsnew file+164

This diff is too big to show here.

src/Language/PureScript/Ide/Reexports.hsnew file+116

This diff is too big to show here.

src/Language/PureScript/Ide/SourceFile.hsnew file+104

This diff is too big to show here.

src/Language/PureScript/Ide/State.hsnew file+213

This diff is too big to show here.

src/Language/PureScript/Ide/Types.hsnew file+260

This diff is too big to show here.

src/Language/PureScript/Ide/Util.hsnew file+95

This diff is too big to show here.

src/Language/PureScript/Ide/Watcher.hsnew file+49

This diff is too big to show here.

src/Language/PureScript/Interactive.hsnew file+289

This diff is too big to show here.

src/Language/PureScript/Interactive/Completion.hsnew file+222

This diff is too big to show here.

src/Language/PureScript/Interactive/Directive.hsnew file+100

This diff is too big to show here.

src/Language/PureScript/Interactive/IO.hsnew file+41

This diff is too big to show here.

src/Language/PureScript/Interactive/Message.hsnew file+52

This diff is too big to show here.

src/Language/PureScript/Interactive/Module.hsnew file+99

This diff is too big to show here.

src/Language/PureScript/Interactive/Parser.hsnew file+122

This diff is too big to show here.

src/Language/PureScript/Interactive/Printer.hsnew file+127

This diff is too big to show here.

src/Language/PureScript/Interactive/Types.hsnew file+145

This diff is too big to show here.

src/Language/PureScript/Kinds.hsnew file+46

This diff is too big to show here.

src/Language/PureScript/Linter.hsnew file+97

This diff is too big to show here.

src/Language/PureScript/Linter/Exhaustive.hsnew file+345

This diff is too big to show here.

src/Language/PureScript/Linter/Imports.hsnew file+364

This diff is too big to show here.

src/Language/PureScript/Make.hsnew file+470

This diff is too big to show here.

src/Language/PureScript/ModuleDependencies.hsnew file+100

This diff is too big to show here.

src/Language/PureScript/Names.hsnew file+205

This diff is too big to show here.

src/Language/PureScript/Options.hsnew file+39

This diff is too big to show here.

src/Language/PureScript/Parser.hsnew file+23

This diff is too big to show here.

src/Language/PureScript/Parser/Common.hsnew file+144

This diff is too big to show here.

src/Language/PureScript/Parser/Declarations.hsnew file+579

This diff is too big to show here.

src/Language/PureScript/Parser/Kinds.hsnew file+38

This diff is too big to show here.

src/Language/PureScript/Parser/Lexer.hsnew file+564

This diff is too big to show here.

src/Language/PureScript/Parser/State.hsnew file+18

This diff is too big to show here.

src/Language/PureScript/Parser/Types.hsnew file+128

This diff is too big to show here.

src/Language/PureScript/Pretty.hsnew file+17

This diff is too big to show here.

src/Language/PureScript/Pretty/Common.hsnew file+159

This diff is too big to show here.

src/Language/PureScript/Pretty/JS.hsnew file+308

This diff is too big to show here.

src/Language/PureScript/Pretty/Kinds.hsnew file+52

This diff is too big to show here.

src/Language/PureScript/Pretty/Types.hsnew file+170

This diff is too big to show here.

src/Language/PureScript/Pretty/Values.hsnew file+187

This diff is too big to show here.

src/Language/PureScript/Publish.hsnew file+411

This diff is too big to show here.

src/Language/PureScript/Publish/BoxesHelpers.hsnew file+44

This diff is too big to show here.

src/Language/PureScript/Publish/ErrorsWarnings.hsnew file+429

This diff is too big to show here.

src/Language/PureScript/Publish/Utils.hsnew file+41

This diff is too big to show here.

src/Language/PureScript/Renamer.hsnew file+191

This diff is too big to show here.

src/Language/PureScript/Sugar.hsnew file+67

This diff is too big to show here.

src/Language/PureScript/Sugar/BindingGroups.hsnew file+221

This diff is too big to show here.

src/Language/PureScript/Sugar/CaseDeclarations.hsnew file+188

This diff is too big to show here.

src/Language/PureScript/Sugar/DoNotation.hsnew file+63

This diff is too big to show here.

src/Language/PureScript/Sugar/Names.hsnew file+338

This diff is too big to show here.

src/Language/PureScript/Sugar/Names/Common.hsnew file+68

This diff is too big to show here.

src/Language/PureScript/Sugar/Names/Env.hsnew file+400

This diff is too big to show here.

src/Language/PureScript/Sugar/Names/Exports.hsnew file+305

This diff is too big to show here.

src/Language/PureScript/Sugar/Names/Imports.hsnew file+237

This diff is too big to show here.

src/Language/PureScript/Sugar/ObjectWildcards.hsnew file+92

This diff is too big to show here.

src/Language/PureScript/Sugar/Operators.hsnew file+415

This diff is too big to show here.

src/Language/PureScript/Sugar/Operators/Binders.hsnew file+26

This diff is too big to show here.

src/Language/PureScript/Sugar/Operators/Common.hsnew file+79

This diff is too big to show here.

src/Language/PureScript/Sugar/Operators/Expr.hsnew file+44

This diff is too big to show here.

src/Language/PureScript/Sugar/Operators/Types.hsnew file+27

This diff is too big to show here.

src/Language/PureScript/Sugar/TypeClasses.hsnew file+329

This diff is too big to show here.

src/Language/PureScript/Sugar/TypeClasses/Deriving.hsnew file+419

This diff is too big to show here.

src/Language/PureScript/Sugar/TypeDeclarations.hsnew file+63

This diff is too big to show here.

src/Language/PureScript/Traversals.hsnew file+27

This diff is too big to show here.

src/Language/PureScript/TypeChecker.hsnew file+424

This diff is too big to show here.

src/Language/PureScript/TypeChecker/Entailment.hsnew file+218

This diff is too big to show here.

src/Language/PureScript/TypeChecker/Kinds.hsnew file+267

This diff is too big to show here.

src/Language/PureScript/TypeChecker/Monad.hsnew file+291

This diff is too big to show here.

src/Language/PureScript/TypeChecker/Rows.hsnew file+53

This diff is too big to show here.

src/Language/PureScript/TypeChecker/Skolems.hsnew file+127

This diff is too big to show here.

src/Language/PureScript/TypeChecker/Subsumption.hsnew file+96

This diff is too big to show here.

src/Language/PureScript/TypeChecker/Synonyms.hsnew file+47

This diff is too big to show here.

src/Language/PureScript/TypeChecker/Types.hsnew file+759

This diff is too big to show here.

src/Language/PureScript/TypeChecker/Unify.hsnew file+217

This diff is too big to show here.

src/Language/PureScript/TypeClassDictionaries.hsnew file+47

This diff is too big to show here.

src/Language/PureScript/Types.hsnew file+323

This diff is too big to show here.

src/System/IO/UTF8.hsnew file+25

This diff is too big to show here.

src/Tests.hsdeleted−141

This diff is too big to show here.

stack-ghc-8.0.yamlnew file+7

This diff is too big to show here.

stack.nixdeleted−23

This diff is too big to show here.

stack.yaml+6−21

This diff is too big to show here.

support/ffi-loader.godeleted−30

This diff is too big to show here.

support/go.mod.ffi-loaderdeleted−2

This diff is too big to show here.

support/go.mod.outputdeleted−2

This diff is too big to show here.

support/go.mod.workingdeleted−1

This diff is too big to show here.

test/Spec.hsdeleted−2

This diff is too big to show here.

tests/Language/PureScript/Ide/FilterSpec.hsnew file+52

This diff is too big to show here.

tests/Language/PureScript/Ide/Imports/IntegrationSpec.hsnew file+83

This diff is too big to show here.

tests/Language/PureScript/Ide/ImportsSpec.hsnew file+130

This diff is too big to show here.

tests/Language/PureScript/Ide/Integration.hsnew file+285

This diff is too big to show here.

tests/Language/PureScript/Ide/MatcherSpec.hsnew file+47

This diff is too big to show here.

tests/Language/PureScript/Ide/RebuildSpec.hsnew file+57

This diff is too big to show here.

tests/Language/PureScript/Ide/ReexportsSpec.hsnew file+64

This diff is too big to show here.

tests/Language/PureScript/Ide/SourceFile/IntegrationSpec.hsnew file+36

This diff is too big to show here.

tests/Language/PureScript/Ide/SourceFileSpec.hsnew file+46

This diff is too big to show here.

tests/Main.hsnew file+44

This diff is too big to show here.

tests/PscIdeSpec.hsnew file+1

This diff is too big to show here.

tests/TestCompiler.hsnew file+286

This diff is too big to show here.

tests/TestDocs.hsnew file+310

This diff is too big to show here.

tests/TestPscIde.hsnew file+14

This diff is too big to show here.

tests/TestPscPublish.hsnew file+78

This diff is too big to show here.

tests/TestPsci.hsnew file+137

This diff is too big to show here.

tests/TestUtils.hsnew file+99

This diff is too big to show here.

tests/support/.gitignorenew file+2

This diff is too big to show here.

tests/support/bower.jsonnew file+12

This diff is too big to show here.

tests/support/package.jsonnew file+8

This diff is too big to show here.

tests/support/psci/Sample.pursnew file

No changes to the content.

tests/support/pscide/.gitignorenew file+7

This diff is too big to show here.

tests/support/pscide/src/ImportsSpec.pursnew file+3

This diff is too big to show here.

tests/support/pscide/src/ImportsSpec1.pursnew file+32

This diff is too big to show here.

tests/support/pscide/src/MatcherSpec.pursnew file+7

This diff is too big to show here.

tests/support/pscide/src/RebuildSpecDep.pursnew file+3

This diff is too big to show here.

tests/support/pscide/src/RebuildSpecSingleModule.failnew file+3

This diff is too big to show here.

tests/support/pscide/src/RebuildSpecSingleModule.pursnew file+4

This diff is too big to show here.

tests/support/pscide/src/RebuildSpecWithDeps.pursnew file+5

This diff is too big to show here.

tests/support/pscide/src/RebuildSpecWithForeign.jsnew file+1

This diff is too big to show here.

tests/support/pscide/src/RebuildSpecWithForeign.pursnew file+3

This diff is too big to show here.

tests/support/pscide/src/RebuildSpecWithHiddenIdent.pursnew file+6

This diff is too big to show here.

tests/support/pscide/src/RebuildSpecWithMissingForeign.failnew file+3

This diff is too big to show here.

tests/support/pscide/src/SourceFileSpec.pursnew file+10

This diff is too big to show here.

tests/support/setup-win.cmdnew file+3

This diff is too big to show here.

travis/build.shnew file+59

This diff is too big to show here.

travis/convert-os-name.shnew file+14

This diff is too big to show here.