git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
657 files changed+2699−42163
since splitsnapshots
unifiedsplit
.gitignore+4 .travis.yml−80 CONTRIBUTING.md−39 CONTRIBUTORS.md−77 ChangeLog.md+3 INSTALL.md−53 LICENSE+20−3554 README-go.md+48 README.md+32−20 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−2 core-tests/test-everything.sh−79 core-tests/tests/generic-deriving/Main.purs−27 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−16 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/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/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/ExportExplicit.purs−8 examples/failing/ExportExplicit1.purs−11 examples/failing/ExportExplicit1/M1.purs−3 examples/failing/ExportExplicit2.purs−8 examples/failing/ExportExplicit3.purs−9 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/OverlappingReExport.purs−5 examples/failing/OverlappingReExport/A.purs−2 examples/failing/OverlappingReExport/B.purs−2 examples/failing/OverlappingVars.purs−15 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−12 examples/failing/TypedHole.purs−9 examples/failing/UnderscoreModuleName.purs−6 examples/failing/UnifyInTypeInstanceLookup.purs−22 examples/failing/UnknownType.purs−7 examples/passing/1185.purs−13 examples/passing/1335.purs−14 examples/passing/1570.purs−6 examples/passing/1664.purs−16 examples/passing/1697.purs−24 examples/passing/1881.purs−17 examples/passing/1991.purs−21 examples/passing/2018.purs−12 examples/passing/2018/A.purs−7 examples/passing/2018/B.purs−3 examples/passing/2049.purs−14 examples/passing/652.purs−17 examples/passing/810.purs−13 examples/passing/862.purs−8 examples/passing/922.purs−20 examples/passing/Applicative.purs−16 examples/passing/ArrayType.purs−11 examples/passing/Auto.purs−15 examples/passing/AutoPrelude.purs−11 examples/passing/AutoPrelude2.purs−10 examples/passing/BindersInFunctions.purs−15 examples/passing/BindingGroups.purs−10 examples/passing/BlockString.purs−8 examples/passing/CaseInDo.purs−21 examples/passing/CaseInputWildcard.purs−18 examples/passing/CaseMultipleExpressions.purs−21 examples/passing/CaseStatement.purs−21 examples/passing/CheckFunction.purs−7 examples/passing/CheckSynonymBug.purs−12 examples/passing/CheckTypeClass.purs−18 examples/passing/Church.purs−18 examples/passing/ClassRefSyntax.purs−8 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−9 examples/passing/DctorOperatorAlias.purs−34 examples/passing/DctorOperatorAlias/List.purs−5 examples/passing/DeepArrayBinder.purs−16 examples/passing/DeepCase.purs−15 examples/passing/Deriving.purs−34 examples/passing/Do.purs−67 examples/passing/Dollar.purs−16 examples/passing/Eff.purs−26 examples/passing/EmptyDataDecls.purs−19 examples/passing/EmptyRow.purs−10 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−14 examples/passing/ExportExplicit.purs−9 examples/passing/ExportExplicit/M1.purs−10 examples/passing/ExportExplicit2.purs−7 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−12 examples/passing/Functions.purs−12 examples/passing/Functions2.purs−12 examples/passing/Generalization1.purs−11 examples/passing/Guards.purs−29 examples/passing/HoistError.purs−12 examples/passing/IfThenElseMaybe.purs−11 examples/passing/IfWildcard.purs−19 examples/passing/ImplicitEmptyImport.purs−8 examples/passing/Import.purs−5 examples/passing/Import/M1.purs−8 examples/passing/Import/M2.purs−6 examples/passing/ImportExplicit.purs−9 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−11 examples/passing/IntAndChar.purs−18 examples/passing/JSReserved.purs−12 examples/passing/KindedType.purs−33 examples/passing/LargeSumType.purs−33 examples/passing/Let.purs−58 examples/passing/Let2.purs−20 examples/passing/LetInInstance.purs−14 examples/passing/LiberalTypeSynonyms.purs−21 examples/passing/MPTCs.purs−20 examples/passing/Match.purs−9 examples/passing/Module.purs−6 examples/passing/Module/M1.purs−14 examples/passing/Module/M2.purs−9 examples/passing/ModuleDeps.purs−5 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−19 examples/passing/MutRec2.purs−19 examples/passing/MutRec3.purs−19 examples/passing/NakedConstraint.purs−10 examples/passing/NamedPatterns.purs−9 examples/passing/NegativeBinder.purs−9 examples/passing/NegativeIntInRange.purs−8 examples/passing/Nested.purs−9 examples/passing/NestedTypeSynonyms.purs−12 examples/passing/NestedWhere.purs−12 examples/passing/Newtype.purs−23 examples/passing/NewtypeEff.purs−29 examples/passing/NewtypeWithRecordUpdate.purs−16 examples/passing/NonConflictingExports.purs−9 examples/passing/NonConflictingExports/A.purs−4 examples/passing/NumberLiterals.purs−39 examples/passing/ObjectGetter.purs−14 examples/passing/ObjectSynonym.purs−15 examples/passing/ObjectUpdate.purs−23 examples/passing/ObjectUpdate2.purs−17 examples/passing/ObjectUpdater.purs−26 examples/passing/ObjectWildcards.purs−20 examples/passing/Objects.purs−35 examples/passing/OneConstructor.purs−9 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−95 examples/passing/OptimizerBug.purs−9 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−22 examples/passing/PendingConflictingImports.purs−7 examples/passing/PendingConflictingImports/A.purs−4 examples/passing/PendingConflictingImports/B.purs−4 examples/passing/PendingConflictingImports2.purs−9 examples/passing/PendingConflictingImports2/A.purs−4 examples/passing/Person.purs−12 examples/passing/QualifiedNames.purs−9 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−11 examples/passing/ReExportQualified.purs−6 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−10 examples/passing/RedefinedFixity.purs−5 examples/passing/RedefinedFixity/M1.purs−6 examples/passing/RedefinedFixity/M2.purs−5 examples/passing/RedefinedFixity/M3.purs−6 examples/passing/ReservedWords.purs−18 examples/passing/ResolvableScopeConflict.purs−12 examples/passing/ResolvableScopeConflict/A.purs−4 examples/passing/ResolvableScopeConflict/B.purs−7 examples/passing/ResolvableScopeConflict2.purs−14 examples/passing/ResolvableScopeConflict2/A.purs−7 examples/passing/ResolvableScopeConflict3.purs−8 examples/passing/ResolvableScopeConflict3/A.purs−4 examples/passing/RowConstructors.purs−42 examples/passing/RowPolyInstanceContext.purs−22 examples/passing/RuntimeScopeIssue.purs−22 examples/passing/ScopedTypeVariables.purs−36 examples/passing/Sequence.purs−15 examples/passing/SequenceDesugared.purs−37 examples/passing/ShadowedModuleName.purs−8 examples/passing/ShadowedModuleName/Test.purs−6 examples/passing/ShadowedName.purs−10 examples/passing/ShadowedRename.purs−14 examples/passing/ShadowedTCO.purs−21 examples/passing/ShadowedTCOLet.purs−15 examples/passing/SignedNumericLiterals.purs−17 examples/passing/StringEscapes.purs−17 examples/passing/Superclasses1.purs−23 examples/passing/Superclasses3.purs−41 examples/passing/TCO.purs−20 examples/passing/TCOCase.purs−12 examples/passing/TailCall.purs−20 examples/passing/Tick.purs−7 examples/passing/TopLevelCase.purs−18 examples/passing/TransitiveImport.purs−9 examples/passing/TransitiveImport/Middle.purs−3 examples/passing/TransitiveImport/Test.purs−9 examples/passing/TypeClassMemberOrderChange.purs−16 examples/passing/TypeClasses.purs−71 examples/passing/TypeClassesInOrder.purs−11 examples/passing/TypeClassesWithOverlappingTypeVariables.purs−11 examples/passing/TypeDecl.purs−12 examples/passing/TypeOperators.purs−19 examples/passing/TypeOperators/A.purs−22 examples/passing/TypeSynonymInData.purs−11 examples/passing/TypeSynonyms.purs−27 examples/passing/TypeWildcards.purs−15 examples/passing/TypeWildcardsRecordExtension.purs−8 examples/passing/TypeWithoutParens.purs−11 examples/passing/TypeWithoutParens/Lib.purs−4 examples/passing/TypedBinders.purs−67 examples/passing/TypedWhere.purs−17 examples/passing/UTF8Sourcefile.purs−8 examples/passing/UnderscoreIdent.purs−12 examples/passing/UnicodeIdentifier.purs−5 examples/passing/UnicodeOperators.purs−20 examples/passing/UnicodeType.purs−22 examples/passing/Unit.purs−8 examples/passing/UnknownInTypeClassLookup.purs−14 examples/passing/UntupledConstraints.purs−17 examples/passing/Where.purs−49 examples/passing/WildcardType.purs−13 examples/passing/iota.purs−9 examples/passing/s.purs−7 hierarchy/Main.hs−115 license-generator/generate.hs−46 license-generator/header.txt−23 logo.png make_release_notes−2 package.yaml+86 pcc/Main.hs−185 pcc/Make.hs−174 pcc/Makefile−68 pcc/Makefile.hs−50 pcc/TestMain.hs−120 pcc/include/purescript.cc−310 pcc/include/purescript.hh−441 pcc/include/purescript_memory.hh−59 psc-bundle/Main.hs−127 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−56 psc-ide-server/Main.hs−167 psc-ide-server/PROTOCOL.md−527 psc-ide-server/README.md−41 psc-publish/Main.hs−50 psc/Main.hs−171 psci/Main.hs−132 psgo.cabal+145 purescript.cabal−540 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−475 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−588 src/Language/PureScript/CodeGen.hs−8 src/Language/PureScript/CodeGen/Cpp.hs−891 src/Language/PureScript/CodeGen/Cpp/AST.hs−376 src/Language/PureScript/CodeGen/Cpp/Common.hs−207 src/Language/PureScript/CodeGen/Cpp/File.hs−184 src/Language/PureScript/CodeGen/Cpp/Optimizer.hs−95 src/Language/PureScript/CodeGen/Cpp/Optimizer/Blocks.hs−85 src/Language/PureScript/CodeGen/Cpp/Optimizer/Common.hs−91 src/Language/PureScript/CodeGen/Cpp/Optimizer/Inliner.hs−389 src/Language/PureScript/CodeGen/Cpp/Optimizer/MagicDo.hs−146 src/Language/PureScript/CodeGen/Cpp/Optimizer/TCO.hs−151 src/Language/PureScript/CodeGen/Cpp/Optimizer/Unused.hs−47 src/Language/PureScript/CodeGen/Cpp/Types.hs−130 src/Language/PureScript/CodeGen/JS.hs−444 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−392 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−276 src/Language/PureScript/Errors.hs−1295 src/Language/PureScript/Errors/JSON.hs−73 src/Language/PureScript/Externs.hs−226 src/Language/PureScript/Ide.hs−242 src/Language/PureScript/Ide/CaseSplit.hs−156 src/Language/PureScript/Ide/Command.hs−157 src/Language/PureScript/Ide/Completion.hs−32 src/Language/PureScript/Ide/Error.hs−58 src/Language/PureScript/Ide/Externs.hs−118 src/Language/PureScript/Ide/Filter.hs−126 src/Language/PureScript/Ide/Imports.hs−347 src/Language/PureScript/Ide/Matcher.hs−130 src/Language/PureScript/Ide/Pursuit.hs−78 src/Language/PureScript/Ide/Rebuild.hs−82 src/Language/PureScript/Ide/Reexports.hs−89 src/Language/PureScript/Ide/SourceFile.hs−120 src/Language/PureScript/Ide/State.hs−99 src/Language/PureScript/Ide/Types.hs−235 src/Language/PureScript/Ide/Util.hs−71 src/Language/PureScript/Ide/Watcher.hs−48 src/Language/PureScript/Interactive.hs−283 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−85 src/Language/PureScript/Interactive/Parser.hs−122 src/Language/PureScript/Interactive/Printer.hs−124 src/Language/PureScript/Interactive/Types.hs−146 src/Language/PureScript/Kinds.hs−56 src/Language/PureScript/Linter.hs−97 src/Language/PureScript/Linter/Exhaustive.hs−336 src/Language/PureScript/Linter/Imports.hs−368 src/Language/PureScript/Make.hs−469 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−135 src/Language/PureScript/Parser/Declarations.hs−564 src/Language/PureScript/Parser/Kinds.hs−34 src/Language/PureScript/Parser/Lexer.hs−556 src/Language/PureScript/Parser/State.hs−18 src/Language/PureScript/Parser/Types.hs−124 src/Language/PureScript/Pretty.hs−17 src/Language/PureScript/Pretty/Common.hs−155 src/Language/PureScript/Pretty/Cpp.hs−542 src/Language/PureScript/Pretty/JS.hs−308 src/Language/PureScript/Pretty/Kinds.hs−51 src/Language/PureScript/Pretty/Types.hs−169 src/Language/PureScript/Pretty/Values.hs−189 src/Language/PureScript/Publish.hs−410 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−371 src/Language/PureScript/Sugar/Names/Common.hs−66 src/Language/PureScript/Sugar/Names/Env.hs−346 src/Language/PureScript/Sugar/Names/Exports.hs−285 src/Language/PureScript/Sugar/Names/Imports.hs−235 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−330 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−423 src/Language/PureScript/TypeChecker/Entailment.hs−215 src/Language/PureScript/TypeChecker/Kinds.hs−265 src/Language/PureScript/TypeChecker/Monad.hs−250 src/Language/PureScript/TypeChecker/Rows.hs−55 src/Language/PureScript/TypeChecker/Skolems.hs−127 src/Language/PureScript/TypeChecker/Subsumption.hs−86 src/Language/PureScript/TypeChecker/Synonyms.hs−47 src/Language/PureScript/TypeChecker/Types.hs−760 src/Language/PureScript/TypeChecker/Unify.hs−212 src/Language/PureScript/TypeClassDictionaries.hs−47 src/Language/PureScript/Types.hs−355 src/System/IO/UTF8.hs−25 src/Tests.hs+141 stack.nix+23 stack.yaml+22−6 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−63 tests/Language/PureScript/Ide/Imports/IntegrationSpec.hs−94 tests/Language/PureScript/Ide/ImportsSpec.hs−130 tests/Language/PureScript/Ide/Integration.hs−281 tests/Language/PureScript/Ide/MatcherSpec.hs−48 tests/Language/PureScript/Ide/RebuildSpec.hs−47 tests/Language/PureScript/Ide/ReexportsSpec.hs−81 tests/Language/PureScript/IdeSpec.hs−35 tests/Main.hs−44 tests/PscIdeSpec.hs−1 tests/TestCompiler.hs−251 tests/TestDocs.hs−309 tests/TestPscIde.hs−14 tests/TestPscPublish.hs−78 tests/TestPsci.hs−138 tests/TestUtils.hs−90 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−5 tests/support/pscide/src/ImportsSpec1.purs−32 tests/support/pscide/src/Main.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−3 tests/support/pscide/src/RebuildSpecWithForeign.purs−3 tests/support/pscide/src/RebuildSpecWithMissingForeign.fail−3 tests/support/setup-win.cmd−3 travis/build.sh−59 travis/convert-os-name.sh−14
.gitignore+4
@@ -14,6 +14,10 @@ bower_components/
1414node_modules
1515tmp/
1616.stack-work/
17+stack.yaml.lock
1718output
1819examples/docs/docs/
1920core-tests/full-core-docs.md
21+.psc-ide-port
22+.vscode/
23+result
.travis.ymldeleted−80
@@ -1,80 +0,0 @@
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 COVERAGE=true 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-lts-sdist
25− os: linux
26− dist: trusty
27− sudo: required
28− env: BUILD_TYPE=sdist
29−
30− - compiler: cc-linux-lts-haddock
31− os: linux
32− dist: trusty
33− sudo: required
34− env: BUILD_TYPE=haddock
35−
36− - compiler: cc-osx-lts-normal
37− os: osx
38− env: BUILD_TYPE=normal DEPLOY=true
39−
40− - compiler: cc-osx-lts-sdist
41− os: osx
42− env: BUILD_TYPE=sdist
43−addons:
44− apt:
45− packages:
46− - libgmp-dev
47−cache:
48− directories:
49− - $HOME/.local/bin
50− - $HOME/.stack
51−install:
52−- | # Install stack.
53− if test ! -f "$HOME/.local/bin/stack"
54− then
55− URL="https://www.stackage.org/stack/$TRAVIS_OS_NAME-x86_64"
56− curl --location "$URL" > stack.tar.gz
57− gunzip stack.tar.gz
58− tar -x -f stack.tar --strip-components 1
59− mkdir -p "$HOME/.local/bin"
60− mv stack "$HOME/.local/bin/"
61− fi
62−- npm install -g bower # for psc-docs / psc-publish tests
63−# Fix the CC environment variable, because Travis changes it
64−- export CC=gcc
65−- export OS_NAME=$(./travis/convert-os-name.sh)
66−script:
67−- travis/build.sh
68−before_deploy:
69−- ./bundle/build.sh $OS_NAME
70−deploy:
71− provider: releases
72− api_key: $RELEASE_KEY
73− file:
74− - bundle/$OS_NAME.tar.gz
75− - bundle/$OS_NAME.sha
76− skip_cleanup: true
77− on:
78− all_branches: true
79− tags: true
80− condition: "$DEPLOY = true"
CONTRIBUTING.mddeleted−39
@@ -1,39 +0,0 @@
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.mddeleted−77
@@ -1,77 +0,0 @@
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−- [@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).
16−- [@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).
17−- [@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).
18−- [@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).
19−- [@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).
20−- [@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).
21−- [@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).
22−- [@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).
23−- [@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.
24−- [@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
25−- [@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).
26−- [@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).
27−- [@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).
28−- [@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).
29−- [@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).
30−- [@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).
31−- [@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).
32−- [@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).
33−- [@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.
34−- [@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.
35−- [@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.
36−- [@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).
37−- [@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).
38−- [@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).
39−- [@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).
40−- [@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).
41−- [@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.
42−- [@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).
43−- [@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).
44−- [@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).
45−- [@nagisa](https://github.com/nagisa) I hereby release my [only contribution](https://github.com/purescript/purescript/commit/80287a5d0de619862d3b4cda9c1ee276d18fdcd8) into public domain.
46−- [@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).
47−- [@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).
48−- [@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).
49−- [@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).
50−- [@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.
51−- [@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).
52−- [@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).
53−- [@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).
54−- [@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).
55−- [@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).
56−- [@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).
57−- [@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).
58−- [@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.
59−- [@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).
60−- [@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).
61−- [@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.
62−- [@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).
63−- [@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).
64−- [@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).
65−- [@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).
66−- [@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).
67−- [@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).
68−- [@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).
69−- [@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).
70−- [@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.
71−- [@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).
72−- [@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).
73−- [@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).
74−
75−### Companies
76−
77−- [@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.mdnew file+3
@@ -0,0 +1,3 @@
1+# Changelog for pscpp
2+
3+## Unreleased changes
INSTALL.mddeleted−53
@@ -1,53 +0,0 @@
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+20−3554
@@ -1,3564 +1,30 @@
1−The MIT License (MIT)
1+Copyright Andy Arvanitis (c) 2018
22
3−Copyright (c) 2013-15 Phil Freeman, (c) 2014-2015 Gary Burgess, and other
4−contributors
3+All rights reserved.
54
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− aeson
27− aeson-better-errors
28− ansi-terminal
29− ansi-wl-pprint
30− array
31− asn1-encoding
32− asn1-parse
33− asn1-types
34− async
35− attoparsec
36− auto-update
37− base
38− base-compat
39− base64-bytestring
40− binary
41− blaze-builder
42− bower-json
43− boxes
44− byteable
45− bytestring
46− bytestring-builder
47− case-insensitive
48− cereal
49− conduit
50− conduit-extra
51− connection
52− containers
53− cookie
54− cryptonite
55− data-default-class
56− deepseq
57− directory
58− dlist
59− edit-distance
60− exceptions
61− fast-logger
62− filepath
63− fsnotify
64− ghc-prim
65− hashable
66− haskeline
67− hinotify
68− hourglass
69− http-client
70− http-client-tls
71− http-types
72− integer-gmp
73− language-javascript
74− lifted-base
75− memory
76− mime-types
77− mmorph
78− monad-control
79− monad-logger
80− monad-loops
81− mtl
82− network
83− network-uri
84− old-locale
85− optparse-applicative
86− parallel
87− parsec
88− pattern-arrows
89− pem
90− pipes
91− pipes-http
92− primitive
93− process
94− random
95− regex-base
96− regex-tdfa
97− resourcet
98− safe
99− scientific
100− semigroups
101− socks
102− sourcemap
103− spdx
104− split
105− stm
106− stm-chans
107− streaming-commons
108− syb
109− tagged
110− template-haskell
111− terminfo
112− text
113− time
114− tls
115− transformers
116− transformers-base
117− transformers-compat
118− unix
119− unix-compat
120− unordered-containers
121− utf8-string
122− vector
123− void
124− x509
125− x509-store
126− x509-system
127− x509-validation
128− zlib
129−
130−Glob LICENSE file:
131−
132− The code in Glob is released under the license below. Copyrights to parts of
133− the code are held by whoever wrote the code in question: see CREDITS.txt for a
134− list of authors.
135−
136− Copyright (c) 2008-2012 <authors>
137− All rights reserved.
138−
139− Redistribution and use in source and binary forms, with or without
140− modification, are permitted provided that the following conditions are met:
141− * Redistributions of source code must retain the above copyright
142− notice, this list of conditions and the following disclaimer.
143− * Redistributions in binary form must reproduce the above copyright
144− notice, this list of conditions and the following disclaimer in the
145− documentation and/or other materials provided with the distribution.
146− * Neither the name of the project nor the names of its contributors may be
147− used to endorse or promote products derived from this software without
148− specific prior written permission.
149−
150− THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
151− WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
152− MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
153− EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
154− INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
155− LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
156− PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
157− LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
158− OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
159− ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
160−
161−aeson LICENSE file:
162−
163− Copyright (c) 2011, MailRank, Inc.
164−
165− All rights reserved.
166−
167− Redistribution and use in source and binary forms, with or without
168− modification, are permitted provided that the following conditions
169− are met:
170−
171− 1. Redistributions of source code must retain the above copyright
172− notice, this list of conditions and the following disclaimer.
173−
174− 2. Redistributions in binary form must reproduce the above copyright
175− notice, this list of conditions and the following disclaimer in the
176− documentation and/or other materials provided with the distribution.
177−
178− 3. Neither the name of the author nor the names of his contributors
179− may be used to endorse or promote products derived from this software
180− without specific prior written permission.
181−
182− THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
183− OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
184− WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
185− DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
186− ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
187− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
188− OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
189− HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
190− STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
191− ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
192− POSSIBILITY OF SUCH DAMAGE.
193−
194−aeson-better-errors LICENSE file:
195−
196− Copyright (c) 2015 Harry Garrood
197−
198− Permission is hereby granted, free of charge, to any person obtaining
199− a copy of this software and associated documentation files (the
200− "Software"), to deal in the Software without restriction, including
201− without limitation the rights to use, copy, modify, merge, publish,
202− distribute, sublicense, and/or sell copies of the Software, and to
203− permit persons to whom the Software is furnished to do so, subject to
204− the following conditions:
205−
206− The above copyright notice and this permission notice shall be included
207− in all copies or substantial portions of the Software.
208−
209− THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
210− EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
211− MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
212− IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
213− CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
214− TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
215− SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
216−
217−ansi-terminal LICENSE file:
218−
219− Copyright (c) 2008, Maximilian Bolingbroke
220− All rights reserved.
221−
222− Redistribution and use in source and binary forms, with or without modification, are permitted
223− provided that the following conditions are met:
224−
225− * Redistributions of source code must retain the above copyright notice, this list of
226− conditions and the following disclaimer.
227− * Redistributions in binary form must reproduce the above copyright notice, this list of
228− conditions and the following disclaimer in the documentation and/or other materials
229− provided with the distribution.
230− * Neither the name of Maximilian Bolingbroke nor the names of other contributors may be used to
231− endorse or promote products derived from this software without specific prior written permission.
232−
233− THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
234− IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
235− FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
236− CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
237− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
238− DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
239− IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
240− OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
241−
242−ansi-wl-pprint LICENSE file:
243−
244− Copyright 2008, Daan Leijen and Max Bolingbroke. All rights reserved.
245−
246− Redistribution and use in source and binary forms, with or without
247− modification, are permitted provided that the following conditions are
248− met:
5+Redistribution and use in source and binary forms, with or without
6+modification, are permitted provided that the following conditions are met:
2497
2508 * Redistributions of source code must retain the above copyright
2519 notice, this list of conditions and the following disclaimer.
25210
253− * Redistributions in binary form must reproduce the above copyright
254− notice, this list of conditions and the following disclaimer in
255− the documentation and/or other materials provided with the
256− distribution.
257−
258− This software is provided by the copyright holders "as is" and any
259− express or implied warranties, including, but not limited to, the
260− implied warranties of merchantability and fitness for a particular
261− purpose are disclaimed. In no event shall the copyright holders be
262− liable for any direct, indirect, incidental, special, exemplary, or
263− consequential damages (including, but not limited to, procurement of
264− substitute goods or services; loss of use, data, or profits; or
265− business interruption) however caused and on any theory of liability,
266− whether in contract, strict liability, or tort (including negligence
267− or otherwise) arising in any way out of the use of this software, even
268− if advised of the possibility of such damage.
269−
270−array LICENSE file:
271−
272− This library (libraries/base) is derived from code from several
273− sources:
274−
275− * Code from the GHC project which is largely (c) The University of
276− Glasgow, and distributable under a BSD-style license (see below),
277−
278− * Code from the Haskell 98 Report which is (c) Simon Peyton Jones
279− and freely redistributable (but see the full license for
280− restrictions).
281−
282− * Code from the Haskell Foreign Function Interface specification,
283− which is (c) Manuel M. T. Chakravarty and freely redistributable
284− (but see the full license for restrictions).
285−
286− The full text of these licenses is reproduced below. All of the
287− licenses are BSD-style or compatible.
288−
289− -----------------------------------------------------------------------------
290−
291− The Glasgow Haskell Compiler License
292−
293− Copyright 2004, The University Court of the University of Glasgow.
294− All rights reserved.
295−
296− Redistribution and use in source and binary forms, with or without
297− modification, are permitted provided that the following conditions are met:
298−
299− - Redistributions of source code must retain the above copyright notice,
300− this list of conditions and the following disclaimer.
301−
302− - Redistributions in binary form must reproduce the above copyright notice,
303− this list of conditions and the following disclaimer in the documentation
304− and/or other materials provided with the distribution.
305−
306− - Neither name of the University nor the names of its contributors may be
307− used to endorse or promote products derived from this software without
308− specific prior written permission.
309−
310− THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
311− GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
312− INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
313− FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
314− UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
315− FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
316− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
317− SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
318− CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
319− LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
320− OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
321− DAMAGE.
322−
323− -----------------------------------------------------------------------------
324−
325− Code derived from the document "Report on the Programming Language
326− Haskell 98", is distributed under the following license:
327−
328− Copyright (c) 2002 Simon Peyton Jones
329−
330− The authors intend this Report to belong to the entire Haskell
331− community, and so we grant permission to copy and distribute it for
332− any purpose, provided that it is reproduced in its entirety,
333− including this Notice. Modified versions of this Report may also be
334− copied and distributed for any purpose, provided that the modified
335− version is clearly presented as such, and that it does not claim to
336− be a definition of the Haskell 98 Language.
337−
338− -----------------------------------------------------------------------------
339−
340− Code derived from the document "The Haskell 98 Foreign Function
341− Interface, An Addendum to the Haskell 98 Report" is distributed under
342− the following license:
343−
344− Copyright (c) 2002 Manuel M. T. Chakravarty
345−
346− The authors intend this Report to belong to the entire Haskell
347− community, and so we grant permission to copy and distribute it for
348− any purpose, provided that it is reproduced in its entirety,
349− including this Notice. Modified versions of this Report may also be
350− copied and distributed for any purpose, provided that the modified
351− version is clearly presented as such, and that it does not claim to
352− be a definition of the Haskell 98 Foreign Function Interface.
353−
354− -----------------------------------------------------------------------------
355−
356−asn1-encoding LICENSE file:
357−
358− Copyright (c) 2010-2013 Vincent Hanquez <vincent@snarc.org>
359−
360− All rights reserved.
361−
362− Redistribution and use in source and binary forms, with or without
363− modification, are permitted provided that the following conditions
364− are met:
365− 1. Redistributions of source code must retain the above copyright
366− notice, this list of conditions and the following disclaimer.
367− 2. Redistributions in binary form must reproduce the above copyright
368− notice, this list of conditions and the following disclaimer in the
369− documentation and/or other materials provided with the distribution.
370− 3. Neither the name of the author nor the names of his contributors
371− may be used to endorse or promote products derived from this software
372− without specific prior written permission.
373−
374− THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
375− ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
376− IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
377− ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
378− FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
379− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
380− OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
381− HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
382− LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
383− OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
384− SUCH DAMAGE.
385−
386−asn1-parse LICENSE file:
387−
388− Copyright (c) 2010-2013 Vincent Hanquez <vincent@snarc.org>
389−
390− All rights reserved.
391−
392− Redistribution and use in source and binary forms, with or without
393− modification, are permitted provided that the following conditions
394− are met:
395− 1. Redistributions of source code must retain the above copyright
396− notice, this list of conditions and the following disclaimer.
397− 2. Redistributions in binary form must reproduce the above copyright
398− notice, this list of conditions and the following disclaimer in the
399− documentation and/or other materials provided with the distribution.
400− 3. Neither the name of the author nor the names of his contributors
401− may be used to endorse or promote products derived from this software
402− without specific prior written permission.
403−
404− THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
405− ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
406− IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
407− ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
408− FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
409− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
410− OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
411− HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
412− LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
413− OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
414− SUCH DAMAGE.
415−
416−asn1-types LICENSE file:
417−
418− Copyright (c) 2010-2013 Vincent Hanquez <vincent@snarc.org>
419−
420− All rights reserved.
421−
422− Redistribution and use in source and binary forms, with or without
423− modification, are permitted provided that the following conditions
424− are met:
425− 1. Redistributions of source code must retain the above copyright
426− notice, this list of conditions and the following disclaimer.
427− 2. Redistributions in binary form must reproduce the above copyright
428− notice, this list of conditions and the following disclaimer in the
429− documentation and/or other materials provided with the distribution.
430− 3. Neither the name of the author nor the names of his contributors
431− may be used to endorse or promote products derived from this software
432− without specific prior written permission.
433−
434− THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
435− ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
436− IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
437− ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
438− FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
439− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
440− OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
441− HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
442− LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
443− OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
444− SUCH DAMAGE.
445−
446−async LICENSE file:
447−
448− Copyright (c) 2012, Simon Marlow
449−
450− All rights reserved.
451−
452− Redistribution and use in source and binary forms, with or without
453− modification, are permitted provided that the following conditions are met:
454−
455− * Redistributions of source code must retain the above copyright
456− notice, this list of conditions and the following disclaimer.
457−
458− * Redistributions in binary form must reproduce the above
459− copyright notice, this list of conditions and the following
460− disclaimer in the documentation and/or other materials provided
461− with the distribution.
462−
463− * Neither the name of Simon Marlow nor the names of other
464− contributors may be used to endorse or promote products derived
465− from this software without specific prior written permission.
466−
467− THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
468− "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
469− LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
470− A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
471− OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
472− SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
473− LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
474− DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
475− THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
476− (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
477− OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
478−
479−attoparsec LICENSE file:
480−
481− Copyright (c) Lennart Kolmodin
482−
483− All rights reserved.
484−
485− Redistribution and use in source and binary forms, with or without
486− modification, are permitted provided that the following conditions
487− are met:
488−
489− 1. Redistributions of source code must retain the above copyright
490− notice, this list of conditions and the following disclaimer.
491−
492− 2. Redistributions in binary form must reproduce the above copyright
493− notice, this list of conditions and the following disclaimer in the
494− documentation and/or other materials provided with the distribution.
495−
496− 3. Neither the name of the author nor the names of his contributors
497− may be used to endorse or promote products derived from this software
498− without specific prior written permission.
499−
500− THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
501− OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
502− WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
503− DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
504− ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
505− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
506− OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
507− HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
508− STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
509− ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
510− POSSIBILITY OF SUCH DAMAGE.
511−
512−auto-update LICENSE file:
513−
514− Copyright (c) 2014 Michael Snoyman
515−
516− Permission is hereby granted, free of charge, to any person obtaining
517− a copy of this software and associated documentation files (the
518− "Software"), to deal in the Software without restriction, including
519− without limitation the rights to use, copy, modify, merge, publish,
520− distribute, sublicense, and/or sell copies of the Software, and to
521− permit persons to whom the Software is furnished to do so, subject to
522− the following conditions:
523−
524− The above copyright notice and this permission notice shall be included
525− in all copies or substantial portions of the Software.
526−
527− THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
528− EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
529− MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
530− IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
531− CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
532− TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
533− SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
534−
535−base LICENSE file:
536−
537− This library (libraries/base) is derived from code from several
538− sources:
539−
540− * Code from the GHC project which is largely (c) The University of
541− Glasgow, and distributable under a BSD-style license (see below),
542−
543− * Code from the Haskell 98 Report which is (c) Simon Peyton Jones
544− and freely redistributable (but see the full license for
545− restrictions).
546−
547− * Code from the Haskell Foreign Function Interface specification,
548− which is (c) Manuel M. T. Chakravarty and freely redistributable
549− (but see the full license for restrictions).
550−
551− The full text of these licenses is reproduced below. All of the
552− licenses are BSD-style or compatible.
553−
554− -----------------------------------------------------------------------------
555−
556− The Glasgow Haskell Compiler License
557−
558− Copyright 2004, The University Court of the University of Glasgow.
559− All rights reserved.
560−
561− Redistribution and use in source and binary forms, with or without
562− modification, are permitted provided that the following conditions are met:
563−
564− - Redistributions of source code must retain the above copyright notice,
565− this list of conditions and the following disclaimer.
566−
567− - Redistributions in binary form must reproduce the above copyright notice,
568− this list of conditions and the following disclaimer in the documentation
569− and/or other materials provided with the distribution.
570−
571− - Neither name of the University nor the names of its contributors may be
572− used to endorse or promote products derived from this software without
573− specific prior written permission.
574−
575− THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
576− GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
577− INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
578− FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
579− UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
580− FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
581− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
582− SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
583− CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
584− LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
585− OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
586− DAMAGE.
587−
588− -----------------------------------------------------------------------------
589−
590− Code derived from the document "Report on the Programming Language
591− Haskell 98", is distributed under the following license:
592−
593− Copyright (c) 2002 Simon Peyton Jones
594−
595− The authors intend this Report to belong to the entire Haskell
596− community, and so we grant permission to copy and distribute it for
597− any purpose, provided that it is reproduced in its entirety,
598− including this Notice. Modified versions of this Report may also be
599− copied and distributed for any purpose, provided that the modified
600− version is clearly presented as such, and that it does not claim to
601− be a definition of the Haskell 98 Language.
602−
603− -----------------------------------------------------------------------------
604−
605− Code derived from the document "The Haskell 98 Foreign Function
606− Interface, An Addendum to the Haskell 98 Report" is distributed under
607− the following license:
608−
609− Copyright (c) 2002 Manuel M. T. Chakravarty
610−
611− The authors intend this Report to belong to the entire Haskell
612− community, and so we grant permission to copy and distribute it for
613− any purpose, provided that it is reproduced in its entirety,
614− including this Notice. Modified versions of this Report may also be
615− copied and distributed for any purpose, provided that the modified
616− version is clearly presented as such, and that it does not claim to
617− be a definition of the Haskell 98 Foreign Function Interface.
618−
619− -----------------------------------------------------------------------------
620−
621−base-compat LICENSE file:
622−
623− Copyright (c) 2012-2016 Simon Hengel <sol@typeful.net> and Ryan Scott <ryan.gl.scott@gmail.com>
624−
625− Permission is hereby granted, free of charge, to any person obtaining a copy
626− of this software and associated documentation files (the "Software"), to deal
627− in the Software without restriction, including without limitation the rights
628− to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
629− copies of the Software, and to permit persons to whom the Software is
630− furnished to do so, subject to the following conditions:
631−
632− The above copyright notice and this permission notice shall be included in
633− all copies or substantial portions of the Software.
634−
635− THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
636− IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
637− FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
638− AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
639− LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
640− OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
641− THE SOFTWARE.
642−
643−base64-bytestring LICENSE file:
644−
645− Copyright (c) 2010 Bryan O'Sullivan <bos@serpentine.com>
646−
647− All rights reserved.
648−
649− Redistribution and use in source and binary forms, with or without
650− modification, are permitted provided that the following conditions
651− are met:
652−
653− 1. Redistributions of source code must retain the above copyright
654− notice, this list of conditions and the following disclaimer.
655−
656− 2. Redistributions in binary form must reproduce the above copyright
657− notice, this list of conditions and the following disclaimer in the
658− documentation and/or other materials provided with the distribution.
659−
660− 3. Neither the name of the author nor the names of his contributors
661− may be used to endorse or promote products derived from this software
662− without specific prior written permission.
663−
664− THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
665− OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
666− WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
667− DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
668− ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
669− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
670− OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
671− HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
672− STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
673− ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
674− POSSIBILITY OF SUCH DAMAGE.
675−
676−binary LICENSE file:
677−
678− Copyright (c) Lennart Kolmodin
679−
680− All rights reserved.
681−
682− Redistribution and use in source and binary forms, with or without
683− modification, are permitted provided that the following conditions
684− are met:
685−
686− 1. Redistributions of source code must retain the above copyright
687− notice, this list of conditions and the following disclaimer.
688−
689− 2. Redistributions in binary form must reproduce the above copyright
690− notice, this list of conditions and the following disclaimer in the
691− documentation and/or other materials provided with the distribution.
692−
693− 3. Neither the name of the author nor the names of his contributors
694− may be used to endorse or promote products derived from this software
695− without specific prior written permission.
696−
697− THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
698− OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
699− WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
700− DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
701− ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
702− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
703− OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
704− HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
705− STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
706− ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
707− POSSIBILITY OF SUCH DAMAGE.
708−
709−blaze-builder LICENSE file:
710−
711− Copyright Jasper Van der Jeugt 2010, Simon Meier 2010 & 2011
712−
713− All rights reserved.
714−
715− Redistribution and use in source and binary forms, with or without
716− modification, are permitted provided that the following conditions are met:
717−
718− * Redistributions of source code must retain the above copyright
719− notice, this list of conditions and the following disclaimer.
720−
721− * Redistributions in binary form must reproduce the above
722− copyright notice, this list of conditions and the following
723− disclaimer in the documentation and/or other materials provided
724− with the distribution.
725−
726− * Neither the name of Jasper Van der Jeugt nor the names of other
727− contributors may be used to endorse or promote products derived
728− from this software without specific prior written permission.
729−
730− THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
731− "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
732− LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
733− A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
734− OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
735− SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
736− LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
737− DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
738− THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
739− (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
740− OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
741−
742−bower-json LICENSE file:
743−
744− Copyright (c) 2015 Harry Garrood
745−
746− Permission is hereby granted, free of charge, to any person obtaining
747− a copy of this software and associated documentation files (the
748− "Software"), to deal in the Software without restriction, including
749− without limitation the rights to use, copy, modify, merge, publish,
750− distribute, sublicense, and/or sell copies of the Software, and to
751− permit persons to whom the Software is furnished to do so, subject to
752− the following conditions:
753−
754− The above copyright notice and this permission notice shall be included
755− in all copies or substantial portions of the Software.
756−
757− THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
758− EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
759− MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
760− IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
761− CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
762− TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
763− SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
764−
765−boxes LICENSE file:
766−
767− Copyright (c) Brent Yorgey 2008
768−
769− Redistribution and use in source and binary forms, with or without
770− modification, are permitted provided that the following conditions
771− are met:
772− 1. Redistributions of source code must retain the above copyright
773− notice, this list of conditions and the following disclaimer.
774− 2. Redistributions in binary form must reproduce the above copyright
775− notice, this list of conditions and the following disclaimer in the
776− documentation and/or other materials provided with the distribution.
777− 3. Neither the name of the author nor the names of other contributors
778− may be used to endorse or promote products derived from this software
779− without specific prior written permission.
780−
781− All other rights are reserved.
782−
783− THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND
784− ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
785− IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
786− ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
787− FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
788− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
789− OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
790− HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
791− LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
792− OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
793− SUCH DAMAGE.
794−
795−byteable LICENSE file:
796−
797− Copyright (c) 2013 Vincent Hanquez <vincent@snarc.org>
798−
799− All rights reserved.
800−
801− Redistribution and use in source and binary forms, with or without
802− modification, are permitted provided that the following conditions
803− are met:
804− 1. Redistributions of source code must retain the above copyright
805− notice, this list of conditions and the following disclaimer.
806− 2. Redistributions in binary form must reproduce the above copyright
807− notice, this list of conditions and the following disclaimer in the
808− documentation and/or other materials provided with the distribution.
809− 3. Neither the name of the author nor the names of his contributors
810− may be used to endorse or promote products derived from this software
811− without specific prior written permission.
812−
813− THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS AS IS'' AND
814− ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
815− IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
816− ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
817− FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
818− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
819− OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
820− HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
821− LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
822− OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
823− SUCH DAMAGE.
824−
825−bytestring LICENSE file:
826−
827− Copyright (c) Don Stewart 2005-2009
828− (c) Duncan Coutts 2006-2015
829− (c) David Roundy 2003-2005
830− (c) Simon Meier 2010-2011
831−
832− All rights reserved.
833−
834− Redistribution and use in source and binary forms, with or without
835− modification, are permitted provided that the following conditions
836− are met:
837− 1. Redistributions of source code must retain the above copyright
838− notice, this list of conditions and the following disclaimer.
839− 2. Redistributions in binary form must reproduce the above copyright
840− notice, this list of conditions and the following disclaimer in the
841− documentation and/or other materials provided with the distribution.
842− 3. Neither the name of the author nor the names of his contributors
843− may be used to endorse or promote products derived from this software
844− without specific prior written permission.
845−
846− THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
847− ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
848− IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
849− ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
850− FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
851− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
852− OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
853− HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
854− LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
855− OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
856− SUCH DAMAGE.
857−
858−bytestring-builder LICENSE file:
859−
860− Copyright Jasper Van der Jeugt 2010, Simon Meier 2010-2013
861−
862− All rights reserved.
863−
864− Redistribution and use in source and binary forms, with or without
865− modification, are permitted provided that the following conditions are met:
866−
867− * Redistributions of source code must retain the above copyright
868− notice, this list of conditions and the following disclaimer.
869−
870− * Redistributions in binary form must reproduce the above
871− copyright notice, this list of conditions and the following
872− disclaimer in the documentation and/or other materials provided
873− with the distribution.
874−
875− * Neither the name of Jasper Van der Jeugt nor the names of other
876− contributors may be used to endorse or promote products derived
877− from this software without specific prior written permission.
878−
879− THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
880− "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
881− LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
882− A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
883− OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
884− SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
885− LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
886− DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
887− THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
888− (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
889− OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
890−
891−case-insensitive LICENSE file:
892−
893− Copyright (c) 2011-2013 Bas van Dijk
894−
895− All rights reserved.
896−
897− Redistribution and use in source and binary forms, with or without
898− modification, are permitted provided that the following conditions are
899− met:
900−
901− * Redistributions of source code must retain the above copyright
902− notice, this list of conditions and the following disclaimer.
903−
904− * Redistributions in binary form must reproduce the above
905− copyright notice, this list of conditions and the following
906− disclaimer in the documentation and/or other materials provided
907− with the distribution.
908−
909− * The name of Bas van Dijk and the names of contributors may NOT
910− be used to endorse or promote products derived from this
911− software without specific prior written permission.
912−
913− THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
914− "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
915− LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
916− A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
917− OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
918− SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
919− LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
920− DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
921− THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
922− (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
923− OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
924−
925−cereal LICENSE file:
926−
927− Copyright (c) Lennart Kolmodin, Galois, Inc.
928−
929− All rights reserved.
930−
931− Redistribution and use in source and binary forms, with or without
932− modification, are permitted provided that the following conditions
933− are met:
934−
935− 1. Redistributions of source code must retain the above copyright
936− notice, this list of conditions and the following disclaimer.
937−
938− 2. Redistributions in binary form must reproduce the above copyright
939− notice, this list of conditions and the following disclaimer in the
940− documentation and/or other materials provided with the distribution.
941−
942− 3. Neither the name of the author nor the names of his contributors
943− may be used to endorse or promote products derived from this software
944− without specific prior written permission.
945−
946− THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
947− OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
948− WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
949− DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
950− ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
951− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
952− OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
953− HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
954− STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
955− ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
956− POSSIBILITY OF SUCH DAMAGE.
957−
958−conduit LICENSE file:
959−
960− Copyright (c) 2012 Michael Snoyman, http://www.yesodweb.com/
961−
962− Permission is hereby granted, free of charge, to any person obtaining
963− a copy of this software and associated documentation files (the
964− "Software"), to deal in the Software without restriction, including
965− without limitation the rights to use, copy, modify, merge, publish,
966− distribute, sublicense, and/or sell copies of the Software, and to
967− permit persons to whom the Software is furnished to do so, subject to
968− the following conditions:
969−
970− The above copyright notice and this permission notice shall be
971− included in all copies or substantial portions of the Software.
972−
973− THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
974− EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
975− MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
976− NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
977− LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
978− OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
979− WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
980−
981−conduit-extra LICENSE file:
982−
983− Copyright (c) 2012 Michael Snoyman, http://www.yesodweb.com/
984−
985− Permission is hereby granted, free of charge, to any person obtaining
986− a copy of this software and associated documentation files (the
987− "Software"), to deal in the Software without restriction, including
988− without limitation the rights to use, copy, modify, merge, publish,
989− distribute, sublicense, and/or sell copies of the Software, and to
990− permit persons to whom the Software is furnished to do so, subject to
991− the following conditions:
992−
993− The above copyright notice and this permission notice shall be
994− included in all copies or substantial portions of the Software.
995−
996− THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
997− EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
998− MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
999− NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
1000− LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
1001− OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
1002− WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1003−
1004−connection LICENSE file:
1005−
1006− Copyright (c) 2012 Vincent Hanquez <vincent@snarc.org>
1007−
1008− All rights reserved.
1009−
1010− Redistribution and use in source and binary forms, with or without
1011− modification, are permitted provided that the following conditions
1012− are met:
1013− 1. Redistributions of source code must retain the above copyright
1014− notice, this list of conditions and the following disclaimer.
1015− 2. Redistributions in binary form must reproduce the above copyright
1016− notice, this list of conditions and the following disclaimer in the
1017− documentation and/or other materials provided with the distribution.
1018− 3. Neither the name of the author nor the names of his contributors
1019− may be used to endorse or promote products derived from this software
1020− without specific prior written permission.
1021−
1022− THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1023− ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1024− IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1025− ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
1026− FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1027− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1028− OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1029− HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1030− LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1031− OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1032− SUCH DAMAGE.
1033−
1034−containers LICENSE file:
1035−
1036− The Glasgow Haskell Compiler License
1037−
1038− Copyright 2004, The University Court of the University of Glasgow.
1039− All rights reserved.
1040−
1041− Redistribution and use in source and binary forms, with or without
1042− modification, are permitted provided that the following conditions are met:
1043−
1044− - Redistributions of source code must retain the above copyright notice,
1045− this list of conditions and the following disclaimer.
1046−
1047− - Redistributions in binary form must reproduce the above copyright notice,
1048− this list of conditions and the following disclaimer in the documentation
1049− and/or other materials provided with the distribution.
1050−
1051− - Neither name of the University nor the names of its contributors may be
1052− used to endorse or promote products derived from this software without
1053− specific prior written permission.
1054−
1055− THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
1056− GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
1057− INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
1058− FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
1059− UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
1060− FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1061− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
1062− SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
1063− CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1064− LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1065− OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
1066− DAMAGE.
1067−
1068−cookie LICENSE file:
1069−
1070− The following license covers this documentation, and the source code, except
1071− where otherwise indicated.
1072−
1073− Copyright 2010, Michael Snoyman. All rights reserved.
1074−
1075− Redistribution and use in source and binary forms, with or without
1076− modification, are permitted provided that the following conditions are met:
1077−
1078− * Redistributions of source code must retain the above copyright notice, this
1079− list of conditions and the following disclaimer.
1080−
1081− * Redistributions in binary form must reproduce the above copyright notice,
1082− this list of conditions and the following disclaimer in the documentation
1083− and/or other materials provided with the distribution.
1084−
1085− THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY EXPRESS OR
1086− IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
1087− MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
1088− EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,
1089− INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
1090− NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
1091− OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
1092− LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
1093− OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
1094− ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1095−
1096−cryptonite LICENSE file:
1097−
1098− Copyright (c) 2006-2015 Vincent Hanquez <vincent@snarc.org>
1099−
1100− All rights reserved.
1101−
1102− Redistribution and use in source and binary forms, with or without
1103− modification, are permitted provided that the following conditions
1104− are met:
1105−
1106− 1. Redistributions of source code must retain the above copyright
1107− notice, this list of conditions and the following disclaimer.
1108− 2. Redistributions in binary form must reproduce the above copyright
1109− notice, this list of conditions and the following disclaimer in the
1110− documentation and/or other materials provided with the distribution.
1111− 3. Neither the name of the author nor the names of his contributors
1112− may be used to endorse or promote products derived from this software
1113− without specific prior written permission.
1114−
1115− THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS AS IS'' AND
1116− ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1117− IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1118− ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
1119− FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1120− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1121− OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1122− HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1123− LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1124− OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1125− SUCH DAMAGE.
1126−
1127−data-default-class LICENSE file:
1128−
1129− Copyright (c) 2013 Lukas Mai
1130−
1131− All rights reserved.
1132−
1133− Redistribution and use in source and binary forms, with or without modification,
1134− are permitted provided that the following conditions are met:
1135−
1136− * Redistributions of source code must retain the above copyright notice, this
1137− list of conditions and the following disclaimer.
1138− * Redistributions in binary form must reproduce the above copyright notice,
1139− this list of conditions and the following disclaimer in the documentation
1140− and/or other materials provided with the distribution.
1141− * Neither the name of the author nor the names of his contributors
1142− may be used to endorse or promote products derived from this software
1143− without specific prior written permission.
1144−
1145− THIS SOFTWARE IS PROVIDED BY LUKAS MAI AND CONTRIBUTORS "AS IS" AND ANY
1146− EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
1147− WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
1148− DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
1149− DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
1150− (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
1151− LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
1152− ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1153− (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
1154− SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1155−
1156−deepseq LICENSE file:
1157−
1158− This library (deepseq) is derived from code from the GHC project which
1159− is largely (c) The University of Glasgow, and distributable under a
1160− BSD-style license (see below).
1161−
1162− -----------------------------------------------------------------------------
1163−
1164− The Glasgow Haskell Compiler License
1165−
1166− Copyright 2001-2009, The University Court of the University of Glasgow.
1167− All rights reserved.
1168−
1169− Redistribution and use in source and binary forms, with or without
1170− modification, are permitted provided that the following conditions are met:
1171−
1172− - Redistributions of source code must retain the above copyright notice,
1173− this list of conditions and the following disclaimer.
1174−
1175− - Redistributions in binary form must reproduce the above copyright notice,
1176− this list of conditions and the following disclaimer in the documentation
1177− and/or other materials provided with the distribution.
1178−
1179− - Neither name of the University nor the names of its contributors may be
1180− used to endorse or promote products derived from this software without
1181− specific prior written permission.
1182−
1183− THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
1184− GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
1185− INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
1186− FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
1187− UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
1188− FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1189− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
1190− SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
1191− CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1192− LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1193− OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
1194− DAMAGE.
1195−
1196− -----------------------------------------------------------------------------
1197−
1198−directory LICENSE file:
1199−
1200− This library (libraries/base) is derived from code from two
1201− sources:
1202−
1203− * Code from the GHC project which is largely (c) The University of
1204− Glasgow, and distributable under a BSD-style license (see below),
1205−
1206− * Code from the Haskell 98 Report which is (c) Simon Peyton Jones
1207− and freely redistributable (but see the full license for
1208− restrictions).
1209−
1210− The full text of these licenses is reproduced below. Both of the
1211− licenses are BSD-style or compatible.
1212−
1213− -----------------------------------------------------------------------------
1214−
1215− The Glasgow Haskell Compiler License
1216−
1217− Copyright 2004, The University Court of the University of Glasgow.
1218− All rights reserved.
1219−
1220− Redistribution and use in source and binary forms, with or without
1221− modification, are permitted provided that the following conditions are met:
1222−
1223− - Redistributions of source code must retain the above copyright notice,
1224− this list of conditions and the following disclaimer.
1225−
1226− - Redistributions in binary form must reproduce the above copyright notice,
1227− this list of conditions and the following disclaimer in the documentation
1228− and/or other materials provided with the distribution.
1229−
1230− - Neither name of the University nor the names of its contributors may be
1231− used to endorse or promote products derived from this software without
1232− specific prior written permission.
1233−
1234− THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
1235− GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
1236− INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
1237− FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
1238− UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
1239− FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1240− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
1241− SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
1242− CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1243− LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1244− OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
1245− DAMAGE.
1246−
1247− -----------------------------------------------------------------------------
1248−
1249− Code derived from the document "Report on the Programming Language
1250− Haskell 98", is distributed under the following license:
1251−
1252− Copyright (c) 2002 Simon Peyton Jones
1253−
1254− The authors intend this Report to belong to the entire Haskell
1255− community, and so we grant permission to copy and distribute it for
1256− any purpose, provided that it is reproduced in its entirety,
1257− including this Notice. Modified versions of this Report may also be
1258− copied and distributed for any purpose, provided that the modified
1259− version is clearly presented as such, and that it does not claim to
1260− be a definition of the Haskell 98 Language.
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.
126115
1262− -----------------------------------------------------------------------------
1263−
1264−dlist LICENSE file:
1265−
1266− Copyright (c) 2006-2009 Don Stewart, 2013-2014 Sean Leather
1267−
1268− All rights reserved.
1269−
1270− Redistribution and use in source and binary forms, with or without
1271− modification, are permitted provided that the following conditions are
1272− met:
1273−
1274− * Redistributions of source code must retain the above copyright
1275− notice, this list of conditions and the following disclaimer.
1276−
1277− * Redistributions in binary form must reproduce the above
1278− copyright notice, this list of conditions and the following
1279− disclaimer in the documentation and/or other materials provided
1280− with the distribution.
1281−
1282− * Neither the name of Don Stewart nor the names of other
1283− contributors may be used to endorse or promote products derived
1284− from this software without specific prior written permission.
1285−
1286− THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1287− "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1288− LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1289− A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1290− OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1291− SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1292− LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1293− DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1294− THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1295− (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1296− OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1297−
1298−edit-distance LICENSE file:
1299−
1300− Copyright (c) 2008-2013 Maximilian Bolingbroke
1301− All rights reserved.
1302−
1303− Redistribution and use in source and binary forms, with or without modification, are permitted
1304− provided that the following conditions are met:
1305−
1306− * Redistributions of source code must retain the above copyright notice, this list of
1307− conditions and the following disclaimer.
1308− * Redistributions in binary form must reproduce the above copyright notice, this list of
1309− conditions and the following disclaimer in the documentation and/or other materials
1310− provided with the distribution.
1311− * Neither the name of Maximilian Bolingbroke nor the names of other contributors may be used to
1312− endorse or promote products derived from this software without specific prior written permission.
1313−
1314− THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
1315− IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
1316− FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
1317− CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1318− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1319− DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
1320− IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
1321− OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1322−
1323−exceptions LICENSE file:
1324−
1325− Copyright 2013-2015 Edward Kmett
1326− Copyright 2012 Google Inc.
1327−
1328− All rights reserved.
1329−
1330− Redistribution and use in source and binary forms, with or without
1331− modification, are permitted provided that the following conditions
1332− are met:
1333−
1334− 1. Redistributions of source code must retain the above copyright
1335− notice, this list of conditions and the following disclaimer.
1336−
1337− 2. Redistributions in binary form must reproduce the above copyright
1338− notice, this list of conditions and the following disclaimer in the
1339− documentation and/or other materials provided with the distribution.
1340−
1341− 3. Neither the name of the author nor the names of his contributors
1342− may be used to endorse or promote products derived from this software
1343− without specific prior written permission.
1344−
1345− THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
1346− IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
1347− WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
1348− DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
1349− ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1350− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1351− OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1352− HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
1353− STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
1354− ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
1355− POSSIBILITY OF SUCH DAMAGE.
1356−
1357−fast-logger LICENSE file:
1358−
1359− Copyright (c) 2009, IIJ Innovation Institute Inc.
1360− All rights reserved.
1361−
1362− Redistribution and use in source and binary forms, with or without
1363− modification, are permitted provided that the following conditions
1364− are met:
1365−
1366− * Redistributions of source code must retain the above copyright
1367− notice, this list of conditions and the following disclaimer.
1368− * Redistributions in binary form must reproduce the above copyright
1369− notice, this list of conditions and the following disclaimer in
1370− the documentation and/or other materials provided with the
1371− distribution.
1372− * Neither the name of the copyright holders nor the names of its
16+ * Neither the name of Author name here nor the names of other
137317 contributors may be used to endorse or promote products derived
137418 from this software without specific prior written permission.
137519
1376− THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1377− "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1378− LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
1379− FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
1380− COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
1381− INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
1382− BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
1383− LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
1384− CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1385− LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
1386− ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
1387− POSSIBILITY OF SUCH DAMAGE.
1388−
1389−filepath LICENSE file:
1390−
1391− Copyright Neil Mitchell 2005-2015.
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 are
1396− met:
1397−
1398− * Redistributions of source code must retain the above copyright
1399− notice, this list of conditions and the following disclaimer.
1400−
1401− * Redistributions in binary form must reproduce the above
1402− copyright notice, this list of conditions and the following
1403− disclaimer in the documentation and/or other materials provided
1404− with the distribution.
1405−
1406− * Neither the name of Neil Mitchell nor the names of other
1407− contributors may be used to endorse or promote products derived
1408− from this software without specific prior written permission.
1409−
1410− THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1411− "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1412− LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1413− A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1414− OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1415− SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1416− LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1417− DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1418− THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1419− (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1420− OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1421−
1422−fsnotify LICENSE file:
1423−
1424− Copyright (c) 2012, Mark Dittmer
1425−
1426− All rights reserved.
1427−
1428− Redistribution and use in source and binary forms, with or without
1429− modification, are permitted provided that the following conditions are met:
1430−
1431− * Redistributions of source code must retain the above copyright
1432− notice, this list of conditions and the following disclaimer.
1433−
1434− * Redistributions in binary form must reproduce the above
1435− copyright notice, this list of conditions and the following
1436− disclaimer in the documentation and/or other materials provided
1437− with the distribution.
1438−
1439− * Neither the name of Mark Dittmer nor the names of other
1440− contributors may be used to endorse or promote products derived
1441− from this software without specific prior written permission.
1442−
1443− THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1444− "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1445− LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1446− A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1447− OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1448− SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1449− LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1450− DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1451− THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1452− (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1453− OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1454−
1455−ghc-prim LICENSE file:
1456−
1457− This library (libraries/ghc-prim) is derived from code from several
1458− sources:
1459−
1460− * Code from the GHC project which is largely (c) The University of
1461− Glasgow, and distributable under a BSD-style license (see below),
1462−
1463− * Code from the Haskell 98 Report which is (c) Simon Peyton Jones
1464− and freely redistributable (but see the full license for
1465− restrictions).
1466−
1467− The full text of these licenses is reproduced below. All of the
1468− licenses are BSD-style or compatible.
1469−
1470− -----------------------------------------------------------------------------
1471−
1472− The Glasgow Haskell Compiler License
1473−
1474− Copyright 2004, The University Court of the University of Glasgow.
1475− All rights reserved.
1476−
1477− Redistribution and use in source and binary forms, with or without
1478− modification, are permitted provided that the following conditions are met:
1479−
1480− - Redistributions of source code must retain the above copyright notice,
1481− this list of conditions and the following disclaimer.
1482−
1483− - Redistributions in binary form must reproduce the above copyright notice,
1484− this list of conditions and the following disclaimer in the documentation
1485− and/or other materials provided with the distribution.
1486−
1487− - Neither name of the University nor the names of its contributors may be
1488− used to endorse or promote products derived from this software without
1489− specific prior written permission.
1490−
1491− THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
1492− GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
1493− INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
1494− FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
1495− UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
1496− FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1497− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
1498− SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
1499− CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1500− LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1501− OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
1502− DAMAGE.
1503−
1504− -----------------------------------------------------------------------------
1505−
1506− Code derived from the document "Report on the Programming Language
1507− Haskell 98", is distributed under the following license:
1508−
1509− Copyright (c) 2002 Simon Peyton Jones
1510−
1511− The authors intend this Report to belong to the entire Haskell
1512− community, and so we grant permission to copy and distribute it for
1513− any purpose, provided that it is reproduced in its entirety,
1514− including this Notice. Modified versions of this Report may also be
1515− copied and distributed for any purpose, provided that the modified
1516− version is clearly presented as such, and that it does not claim to
1517− be a definition of the Haskell 98 Language.
1518−
1519−
1520−hashable LICENSE file:
1521−
1522− Copyright Milan Straka 2010
1523−
1524− All rights reserved.
1525−
1526− Redistribution and use in source and binary forms, with or without
1527− modification, are permitted provided that the following conditions are met:
1528−
1529− * Redistributions of source code must retain the above copyright
1530− notice, this list of conditions and the following disclaimer.
1531−
1532− * Redistributions in binary form must reproduce the above
1533− copyright notice, this list of conditions and the following
1534− disclaimer in the documentation and/or other materials provided
1535− with the distribution.
1536−
1537− * Neither the name of Milan Straka nor the names of other
1538− contributors may be used to endorse or promote products derived
1539− from this software without specific prior written permission.
1540−
1541− THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1542− "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1543− LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1544− A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1545− OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1546− SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1547− LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1548− DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1549− THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1550− (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1551− OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1552−
1553−haskeline LICENSE file:
1554−
1555− Copyright 2007-2009, Judah Jacobson.
1556− All Rights Reserved.
1557−
1558− Redistribution and use in source and binary forms, with or without
1559− modification, are permitted provided that the following conditions are met:
1560−
1561− - Redistribution of source code must retain the above copyright notice,
1562− this list of conditions and the following disclaimer.
1563−
1564− - Redistribution in binary form must reproduce the above copyright notice,
1565− this list of conditions and the following disclaimer in the documentation
1566− and/or other materials provided with the distribution.
1567−
1568− THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY
1569− EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
1570− WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
1571− DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE CONTRIBUTORS BE LIABLE
1572− FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1573− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
1574− SERVICES; LOSS OF USE, DATA OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
1575− CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
1576− OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
1577− USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1578−
1579−hinotify LICENSE file:
1580−
1581− Copyright (c) Lennart Kolmodin
1582−
1583− All rights reserved.
1584−
1585− Redistribution and use in source and binary forms, with or without
1586− modification, are permitted provided that the following conditions
1587− are met:
1588−
1589− 1. Redistributions of source code must retain the above copyright
1590− notice, this list of conditions and the following disclaimer.
1591−
1592− 2. Redistributions in binary form must reproduce the above copyright
1593− notice, this list of conditions and the following disclaimer in the
1594− documentation and/or other materials provided with the distribution.
1595−
1596− 3. Neither the name of the author nor the names of his contributors
1597− may be used to endorse or promote products derived from this software
1598− without specific prior written permission.
1599−
1600− THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
1601− OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
1602− WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
1603− DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
1604− ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1605− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1606− OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1607− HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
1608− STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
1609− ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
1610− POSSIBILITY OF SUCH DAMAGE.
1611−
1612−hourglass LICENSE file:
1613−
1614− Copyright (c) 2014 Vincent Hanquez <vincent@snarc.org>
1615−
1616− All rights reserved.
1617−
1618− Redistribution and use in source and binary forms, with or without
1619− modification, are permitted provided that the following conditions
1620− are met:
1621− 1. Redistributions of source code must retain the above copyright
1622− notice, this list of conditions and the following disclaimer.
1623− 2. Redistributions in binary form must reproduce the above copyright
1624− notice, this list of conditions and the following disclaimer in the
1625− documentation and/or other materials provided with the distribution.
1626− 3. Neither the name of the author nor the names of his contributors
1627− may be used to endorse or promote products derived from this software
1628− without specific prior written permission.
1629−
1630− THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS AS IS'' AND
1631− ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1632− IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1633− ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
1634− FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1635− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1636− OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1637− HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1638− LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1639− OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1640− SUCH DAMAGE.
1641−
1642−http-client LICENSE file:
1643−
1644− The MIT License (MIT)
1645−
1646− Copyright (c) 2013 Michael Snoyman
1647−
1648− Permission is hereby granted, free of charge, to any person obtaining a copy of
1649− this software and associated documentation files (the "Software"), to deal in
1650− the Software without restriction, including without limitation the rights to
1651− use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
1652− the Software, and to permit persons to whom the Software is furnished to do so,
1653− subject to the following conditions:
1654−
1655− The above copyright notice and this permission notice shall be included in all
1656− copies or substantial portions of the Software.
1657−
1658− THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1659− IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
1660− FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
1661− COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
1662− IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
1663− CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1664−
1665−http-client-tls LICENSE file:
1666−
1667− The MIT License (MIT)
1668−
1669− Copyright (c) 2013 Michael Snoyman
1670−
1671− Permission is hereby granted, free of charge, to any person obtaining a copy of
1672− this software and associated documentation files (the "Software"), to deal in
1673− the Software without restriction, including without limitation the rights to
1674− use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
1675− the Software, and to permit persons to whom the Software is furnished to do so,
1676− subject to the following conditions:
1677−
1678− The above copyright notice and this permission notice shall be included in all
1679− copies or substantial portions of the Software.
1680−
1681− THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1682− IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
1683− FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
1684− COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
1685− IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
1686− CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1687−
1688−http-types LICENSE file:
1689−
1690− Copyright (c) 2011, Aristid Breitkreuz
1691− Copyright (c) 2011, Michael Snoyman
1692−
1693− All rights reserved.
1694−
1695− Redistribution and use in source and binary forms, with or without
1696− modification, are permitted provided that the following conditions are met:
1697−
1698− * Redistributions of source code must retain the above copyright
1699− notice, this list of conditions and the following disclaimer.
1700−
1701− * Redistributions in binary form must reproduce the above
1702− copyright notice, this list of conditions and the following
1703− disclaimer in the documentation and/or other materials provided
1704− with the distribution.
1705−
1706− * Neither the name of Aristid Breitkreuz nor the names of other
1707− contributors may be used to endorse or promote products derived
1708− from this software without specific prior written permission.
1709−
1710− THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1711− "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1712− LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1713− A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1714− OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1715− SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1716− LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1717− DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1718− THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1719− (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1720− OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1721−
1722−integer-gmp LICENSE file:
1723−
1724− Copyright (c) 2014, Herbert Valerio Riedel
1725−
1726− All rights reserved.
1727−
1728− Redistribution and use in source and binary forms, with or without
1729− modification, are permitted provided that the following conditions are met:
1730−
1731− * Redistributions of source code must retain the above copyright
1732− notice, this list of conditions and the following disclaimer.
1733−
1734− * Redistributions in binary form must reproduce the above
1735− copyright notice, this list of conditions and the following
1736− disclaimer in the documentation and/or other materials provided
1737− with the distribution.
1738−
1739− * Neither the name of Herbert Valerio Riedel nor the names of other
1740− contributors may be used to endorse or promote products derived
1741− from this software without specific prior written permission.
1742−
1743− THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1744− "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1745− LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1746− A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1747− OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1748− SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1749− LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1750− DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1751− THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1752− (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1753− OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1754−
1755−language-javascript LICENSE file:
1756−
1757− Copyright (c)2010, Alan Zimmerman
1758−
1759− All rights reserved.
1760−
1761− Redistribution and use in source and binary forms, with or without
1762− modification, are permitted provided that the following conditions are met:
1763−
1764− * Redistributions of source code must retain the above copyright
1765− notice, this list of conditions and the following disclaimer.
1766−
1767− * Redistributions in binary form must reproduce the above
1768− copyright notice, this list of conditions and the following
1769− disclaimer in the documentation and/or other materials provided
1770− with the distribution.
1771−
1772− * Neither the name of Alan Zimmerman nor the names of other
1773− contributors may be used to endorse or promote products derived
1774− from this software without specific prior written permission.
1775−
1776− THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1777− "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1778− LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1779− A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1780− OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1781− SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1782− LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1783− DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1784− THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1785− (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1786− OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1787−
1788−lifted-base LICENSE file:
1789−
1790− Copyright © 2010-2012, Bas van Dijk, Anders Kaseorg
1791− All rights reserved.
1792−
1793− Redistribution and use in source and binary forms, with or without
1794− modification, are permitted provided that the following conditions are
1795− met:
1796−
1797− • Redistributions of source code must retain the above copyright
1798− notice, this list of conditions and the following disclaimer.
1799−
1800− • Redistributions in binary form must reproduce the above copyright
1801− notice, this list of conditions and the following disclaimer in the
1802− documentation and/or other materials provided with the distribution.
1803−
1804− • Neither the name of the author nor the names of other contributors
1805− may be used to endorse or promote products derived from this
1806− software without specific prior written permission.
1807−
1808− THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1809− “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1810− LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1811− A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1812− HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1813− SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1814− LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1815− DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1816− THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1817− (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1818− OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1819−
1820−memory LICENSE file:
1821−
1822− Copyright (c) 2015 Vincent Hanquez <vincent@snarc.org>
1823−
1824− All rights reserved.
1825−
1826− Redistribution and use in source and binary forms, with or without
1827− modification, are permitted provided that the following conditions
1828− are met:
1829−
1830− 1. Redistributions of source code must retain the above copyright
1831− notice, this list of conditions and the following disclaimer.
1832− 2. Redistributions in binary form must reproduce the above copyright
1833− notice, this list of conditions and the following disclaimer in the
1834− documentation and/or other materials provided with the distribution.
1835− 3. Neither the name of the author nor the names of his contributors
1836− may be used to endorse or promote products derived from this software
1837− without specific prior written permission.
1838−
1839− THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS AS IS'' AND
1840− ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1841− IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1842− ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
1843− FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1844− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1845− OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1846− HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1847− LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1848− OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1849− SUCH DAMAGE.
1850−
1851−mime-types LICENSE file:
1852−
1853− Copyright (c) 2012 Michael Snoyman, http://www.yesodweb.com/
1854−
1855− Permission is hereby granted, free of charge, to any person obtaining
1856− a copy of this software and associated documentation files (the
1857− "Software"), to deal in the Software without restriction, including
1858− without limitation the rights to use, copy, modify, merge, publish,
1859− distribute, sublicense, and/or sell copies of the Software, and to
1860− permit persons to whom the Software is furnished to do so, subject to
1861− the following conditions:
1862−
1863− The above copyright notice and this permission notice shall be
1864− included in all copies or substantial portions of the Software.
1865−
1866− THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
1867− EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1868− MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
1869− NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
1870− LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
1871− OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
1872− WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1873−
1874−mmorph LICENSE file:
1875−
1876− Copyright (c) 2013, Gabriel Gonzalez
1877− All rights reserved.
1878−
1879− Redistribution and use in source and binary forms, with or without modification,
1880− are permitted provided that the following conditions are met:
1881−
1882− * Redistributions of source code must retain the above copyright notice, this
1883− list of conditions and the following disclaimer.
1884− * Redistributions in binary form must reproduce the above copyright notice, this
1885− list of conditions and the following disclaimer in the documentation and/or
1886− other materials provided with the distribution.
1887− * Neither the name of Gabriel Gonzalez nor the names of other contributors may
1888− be used to endorse or promote products derived from this software without
1889− specific prior written permission.
1890−
1891− THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
1892− ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
1893− WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
1894− DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
1895− ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
1896− (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
1897− LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
1898− ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1899− (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
1900− SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1901−
1902−monad-control LICENSE file:
1903−
1904− Copyright © 2010, Bas van Dijk, Anders Kaseorg
1905− All rights reserved.
1906−
1907− Redistribution and use in source and binary forms, with or without
1908− modification, are permitted provided that the following conditions are
1909− met:
1910−
1911− • Redistributions of source code must retain the above copyright
1912− notice, this list of conditions and the following disclaimer.
1913−
1914− • Redistributions in binary form must reproduce the above copyright
1915− notice, this list of conditions and the following disclaimer in the
1916− documentation and/or other materials provided with the distribution.
1917−
1918− • Neither the name of the author nor the names of other contributors
1919− may be used to endorse or promote products derived from this
1920− software without specific prior written permission.
1921−
1922− THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1923− “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1924− LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1925− A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1926− HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1927− SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1928− LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1929− DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1930− THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1931− (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1932− OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1933−
1934−monad-logger LICENSE file:
1935−
1936− Copyright (c) 2012 Michael Snoyman, http://www.yesodweb.com/
1937−
1938− Permission is hereby granted, free of charge, to any person obtaining
1939− a copy of this software and associated documentation files (the
1940− "Software"), to deal in the Software without restriction, including
1941− without limitation the rights to use, copy, modify, merge, publish,
1942− distribute, sublicense, and/or sell copies of the Software, and to
1943− permit persons to whom the Software is furnished to do so, subject to
1944− the following conditions:
1945−
1946− The above copyright notice and this permission notice shall be
1947− included in all copies or substantial portions of the Software.
1948−
1949− THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
1950− EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1951− MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
1952− NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
1953− LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
1954− OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
1955− WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1956−
1957−monad-loops LICENSE file:
1958−
1959− Page not found: Sorry, it's just not here.
1960−
1961−mtl LICENSE file:
1962−
1963− The Glasgow Haskell Compiler License
1964−
1965− Copyright 2004, The University Court of the University of Glasgow.
1966− All rights reserved.
1967−
1968− Redistribution and use in source and binary forms, with or without
1969− modification, are permitted provided that the following conditions are met:
1970−
1971− - Redistributions of source code must retain the above copyright notice,
1972− this list of conditions and the following disclaimer.
1973−
1974− - Redistributions in binary form must reproduce the above copyright notice,
1975− this list of conditions and the following disclaimer in the documentation
1976− and/or other materials provided with the distribution.
1977−
1978− - Neither name of the University nor the names of its contributors may be
1979− used to endorse or promote products derived from this software without
1980− specific prior written permission.
1981−
1982− THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
1983− GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
1984− INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
1985− FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
1986− UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
1987− FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1988− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
1989− SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
1990− CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1991− LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1992− OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
1993− DAMAGE.
1994−
1995−network LICENSE file:
1996−
1997− Copyright (c) 2002-2010, The University Court of the University of Glasgow.
1998− Copyright (c) 2007-2010, Johan Tibell
1999−
2000− Redistribution and use in source and binary forms, with or without
2001− modification, are permitted provided that the following conditions are met:
2002−
2003− - Redistributions of source code must retain the above copyright notice,
2004− this list of conditions and the following disclaimer.
2005−
2006− - Redistributions in binary form must reproduce the above copyright notice,
2007− this list of conditions and the following disclaimer in the documentation
2008− and/or other materials provided with the distribution.
2009−
2010− - Neither name of the University nor the names of its contributors may be
2011− used to endorse or promote products derived from this software without
2012− specific prior written permission.
2013−
2014− THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
2015− GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
2016− INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
2017− FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
2018− UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
2019− FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2020− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
2021− SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
2022− CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2023− LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2024− OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
2025− DAMAGE.
2026−
2027−network-uri LICENSE file:
2028−
2029− Copyright (c) 2002-2010, The University Court of the University of Glasgow.
2030− Copyright (c) 2007-2010, Johan Tibell
2031−
2032− Redistribution and use in source and binary forms, with or without
2033− modification, are permitted provided that the following conditions are met:
2034−
2035− - Redistributions of source code must retain the above copyright notice,
2036− this list of conditions and the following disclaimer.
2037−
2038− - Redistributions in binary form must reproduce the above copyright notice,
2039− this list of conditions and the following disclaimer in the documentation
2040− and/or other materials provided with the distribution.
2041−
2042− - Neither name of the University nor the names of its contributors may be
2043− used to endorse or promote products derived from this software without
2044− specific prior written permission.
2045−
2046− THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
2047− GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
2048− INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
2049− FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
2050− UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
2051− FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2052− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
2053− SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
2054− CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2055− LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2056− OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
2057− DAMAGE.
2058−
2059−old-locale LICENSE file:
2060−
2061− This library (libraries/base) is derived from code from two
2062− sources:
2063−
2064− * Code from the GHC project which is largely (c) The University of
2065− Glasgow, and distributable under a BSD-style license (see below),
2066−
2067− * Code from the Haskell 98 Report which is (c) Simon Peyton Jones
2068− and freely redistributable (but see the full license for
2069− restrictions).
2070−
2071− The full text of these licenses is reproduced below. Both of the
2072− licenses are BSD-style or compatible.
2073−
2074− -----------------------------------------------------------------------------
2075−
2076− The Glasgow Haskell Compiler License
2077−
2078− Copyright 2004, The University Court of the University of Glasgow.
2079− All rights reserved.
2080−
2081− Redistribution and use in source and binary forms, with or without
2082− modification, are permitted provided that the following conditions are met:
2083−
2084− - Redistributions of source code must retain the above copyright notice,
2085− this list of conditions and the following disclaimer.
2086−
2087− - Redistributions in binary form must reproduce the above copyright notice,
2088− this list of conditions and the following disclaimer in the documentation
2089− and/or other materials provided with the distribution.
2090−
2091− - Neither name of the University nor the names of its contributors may be
2092− used to endorse or promote products derived from this software without
2093− specific prior written permission.
2094−
2095− THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
2096− GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
2097− INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
2098− FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
2099− UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
2100− FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2101− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
2102− SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
2103− CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2104− LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2105− OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
2106− DAMAGE.
2107−
2108− -----------------------------------------------------------------------------
2109−
2110− Code derived from the document "Report on the Programming Language
2111− Haskell 98", is distributed under the following license:
2112−
2113− Copyright (c) 2002 Simon Peyton Jones
2114−
2115− The authors intend this Report to belong to the entire Haskell
2116− community, and so we grant permission to copy and distribute it for
2117− any purpose, provided that it is reproduced in its entirety,
2118− including this Notice. Modified versions of this Report may also be
2119− copied and distributed for any purpose, provided that the modified
2120− version is clearly presented as such, and that it does not claim to
2121− be a definition of the Haskell 98 Language.
2122−
2123− -----------------------------------------------------------------------------
2124−
2125−optparse-applicative LICENSE file:
2126−
2127− Copyright (c) 2012, Paolo Capriotti
2128−
2129− All rights reserved.
2130−
2131− Redistribution and use in source and binary forms, with or without
2132− modification, are permitted provided that the following conditions are met:
2133−
2134− * Redistributions of source code must retain the above copyright
2135− notice, this list of conditions and the following disclaimer.
2136−
2137− * Redistributions in binary form must reproduce the above
2138− copyright notice, this list of conditions and the following
2139− disclaimer in the documentation and/or other materials provided
2140− with the distribution.
2141−
2142− * Neither the name of Paolo Capriotti nor the names of other
2143− contributors may be used to endorse or promote products derived
2144− from this software without specific prior written permission.
2145−
2146− THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2147− "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2148− LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2149− A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2150− OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2151− SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2152− LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2153− DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2154− THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2155− (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2156− OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2157−
2158−parallel LICENSE file:
2159−
2160− This library (libraries/parallel) is derived from code from
2161− the GHC project which is largely (c) The University of
2162− Glasgow, and distributable under a BSD-style license (see below).
2163−
2164− -----------------------------------------------------------------------------
2165−
2166− The Glasgow Haskell Compiler License
2167−
2168− Copyright 2004, The University Court of the University of Glasgow.
2169− All rights reserved.
2170−
2171− Redistribution and use in source and binary forms, with or without
2172− modification, are permitted provided that the following conditions are met:
2173−
2174− - Redistributions of source code must retain the above copyright notice,
2175− this list of conditions and the following disclaimer.
2176−
2177− - Redistributions in binary form must reproduce the above copyright notice,
2178− this list of conditions and the following disclaimer in the documentation
2179− and/or other materials provided with the distribution.
2180−
2181− - Neither name of the University nor the names of its contributors may be
2182− used to endorse or promote products derived from this software without
2183− specific prior written permission.
2184−
2185− THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
2186− GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
2187− INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
2188− FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
2189− UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
2190− FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2191− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
2192− SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
2193− CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2194− LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2195− OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
2196− DAMAGE.
2197−
2198− -----------------------------------------------------------------------------
2199−
2200−parsec LICENSE file:
2201−
2202− Copyright 1999-2000, Daan Leijen; 2007, Paolo Martini. All rights reserved.
2203−
2204− Redistribution and use in source and binary forms, with or without
2205− modification, are permitted provided that the following conditions are met:
2206−
2207− * Redistributions of source code must retain the above copyright notice,
2208− this list of conditions and the following disclaimer.
2209− * Redistributions in binary form must reproduce the above copyright
2210− notice, this list of conditions and the following disclaimer in the
2211− documentation and/or other materials provided with the distribution.
2212−
2213− This software is provided by the copyright holders "as is" and any express or
2214− implied warranties, including, but not limited to, the implied warranties of
2215− merchantability and fitness for a particular purpose are disclaimed. In no
2216− event shall the copyright holders be liable for any direct, indirect,
2217− incidental, special, exemplary, or consequential damages (including, but not
2218− limited to, procurement of substitute goods or services; loss of use, data,
2219− or profits; or business interruption) however caused and on any theory of
2220− liability, whether in contract, strict liability, or tort (including
2221− negligence or otherwise) arising in any way out of the use of this software,
2222− even if advised of the possibility of such damage.
2223−
2224−pattern-arrows LICENSE file:
2225−
2226− The MIT License (MIT)
2227−
2228− Copyright (c) 2013 Phil Freeman
2229−
2230− Permission is hereby granted, free of charge, to any person obtaining a copy of
2231− this software and associated documentation files (the "Software"), to deal in
2232− the Software without restriction, including without limitation the rights to
2233− use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
2234− the Software, and to permit persons to whom the Software is furnished to do so,
2235− subject to the following conditions:
2236−
2237− The above copyright notice and this permission notice shall be included in all
2238− copies or substantial portions of the Software.
2239−
2240− THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2241− IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
2242− FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
2243− COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
2244− IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
2245− CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2246−
2247−pem LICENSE file:
2248−
2249− Copyright (c) 2010-2012 Vincent Hanquez <vincent@snarc.org>
2250−
2251− All rights reserved.
2252−
2253− Redistribution and use in source and binary forms, with or without
2254− modification, are permitted provided that the following conditions
2255− are met:
2256− 1. Redistributions of source code must retain the above copyright
2257− notice, this list of conditions and the following disclaimer.
2258− 2. Redistributions in binary form must reproduce the above copyright
2259− notice, this list of conditions and the following disclaimer in the
2260− documentation and/or other materials provided with the distribution.
2261− 3. Neither the name of the author nor the names of his contributors
2262− may be used to endorse or promote products derived from this software
2263− without specific prior written permission.
2264−
2265− THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2266− ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2267− IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2268− ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
2269− FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2270− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2271− OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2272− HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2273− LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2274− OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2275− SUCH DAMAGE.
2276−
2277−pipes LICENSE file:
2278−
2279− Copyright (c) 2012-2014 Gabriel Gonzalez
2280− All rights reserved.
2281−
2282− Redistribution and use in source and binary forms, with or without modification,
2283− are permitted provided that the following conditions are met:
2284− * Redistributions of source code must retain the above copyright notice,
2285− this list of conditions and the following disclaimer.
2286− * Redistributions in binary form must reproduce the above copyright notice,
2287− this list of conditions and the following disclaimer in the documentation
2288− and/or other materials provided with the distribution.
2289− * Neither the name of Gabriel Gonzalez nor the names of other contributors
2290− may be used to endorse or promote products derived from this software
2291− without specific prior written permission.
2292−
2293− THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
2294− ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
2295− WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
2296− DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
2297− ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
2298− (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
2299− LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
2300− ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2301− (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
2302− SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2303−
2304−pipes-http LICENSE file:
2305−
2306− Copyright (c) 2014 Gabriel Gonzalez
2307− All rights reserved.
2308−
2309− Redistribution and use in source and binary forms, with or without modification,
2310− are permitted provided that the following conditions are met:
2311− * Redistributions of source code must retain the above copyright notice,
2312− this list of conditions and the following disclaimer.
2313− * Redistributions in binary form must reproduce the above copyright notice,
2314− this list of conditions and the following disclaimer in the documentation
2315− and/or other materials provided with the distribution.
2316− * Neither the name of Gabriel Gonzalez nor the names of other contributors
2317− may be used to endorse or promote products derived from this software
2318− without specific prior written permission.
2319−
2320− THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
2321− ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
2322− WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
2323− DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
2324− ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
2325− (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
2326− LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
2327− ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2328− (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
2329− SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2330−
2331−primitive LICENSE file:
2332−
2333− Copyright (c) 2008-2009, Roman Leshchinskiy
2334− All rights reserved.
2335−
2336− Redistribution and use in source and binary forms, with or without
2337− modification, are permitted provided that the following conditions are met:
2338−
2339− - Redistributions of source code must retain the above copyright notice,
2340− this list of conditions and the following disclaimer.
2341−
2342− - Redistributions in binary form must reproduce the above copyright notice,
2343− this list of conditions and the following disclaimer in the documentation
2344− and/or other materials provided with the distribution.
2345−
2346− - Neither name of the University nor the names of its contributors may be
2347− used to endorse or promote products derived from this software without
2348− specific prior written permission.
2349−
2350− THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
2351− GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
2352− INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
2353− FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
2354− UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
2355− FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2356− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
2357− SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
2358− CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2359− LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2360− OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
2361− DAMAGE.
2362−
2363−
2364−process LICENSE file:
2365−
2366− This library (libraries/process) is derived from code from two
2367− sources:
2368−
2369− * Code from the GHC project which is largely (c) The University of
2370− Glasgow, and distributable under a BSD-style license (see below),
2371−
2372− * Code from the Haskell 98 Report which is (c) Simon Peyton Jones
2373− and freely redistributable (but see the full license for
2374− restrictions).
2375−
2376− The full text of these licenses is reproduced below. Both of the
2377− licenses are BSD-style or compatible.
2378−
2379− -----------------------------------------------------------------------------
2380−
2381− The Glasgow Haskell Compiler License
2382−
2383− Copyright 2004, The University Court of the University of Glasgow.
2384− All rights reserved.
2385−
2386− Redistribution and use in source and binary forms, with or without
2387− modification, are permitted provided that the following conditions are met:
2388−
2389− - Redistributions of source code must retain the above copyright notice,
2390− this list of conditions and the following disclaimer.
2391−
2392− - Redistributions in binary form must reproduce the above copyright notice,
2393− this list of conditions and the following disclaimer in the documentation
2394− and/or other materials provided with the distribution.
2395−
2396− - Neither name of the University nor the names of its contributors may be
2397− used to endorse or promote products derived from this software without
2398− specific prior written permission.
2399−
2400− THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
2401− GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
2402− INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
2403− FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
2404− UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
2405− FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2406− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
2407− SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
2408− CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2409− LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2410− OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
2411− DAMAGE.
2412−
2413− -----------------------------------------------------------------------------
2414−
2415− Code derived from the document "Report on the Programming Language
2416− Haskell 98", is distributed under the following license:
2417−
2418− Copyright (c) 2002 Simon Peyton Jones
2419−
2420− The authors intend this Report to belong to the entire Haskell
2421− community, and so we grant permission to copy and distribute it for
2422− any purpose, provided that it is reproduced in its entirety,
2423− including this Notice. Modified versions of this Report may also be
2424− copied and distributed for any purpose, provided that the modified
2425− version is clearly presented as such, and that it does not claim to
2426− be a definition of the Haskell 98 Language.
2427−
2428− -----------------------------------------------------------------------------
2429−
2430−random LICENSE file:
2431−
2432− This library (libraries/base) is derived from code from two
2433− sources:
2434−
2435− * Code from the GHC project which is largely (c) The University of
2436− Glasgow, and distributable under a BSD-style license (see below),
2437−
2438− * Code from the Haskell 98 Report which is (c) Simon Peyton Jones
2439− and freely redistributable (but see the full license for
2440− restrictions).
2441−
2442− The full text of these licenses is reproduced below. Both of the
2443− licenses are BSD-style or compatible.
2444−
2445− -----------------------------------------------------------------------------
2446−
2447− The Glasgow Haskell Compiler License
2448−
2449− Copyright 2004, The University Court of the University of Glasgow.
2450− All rights reserved.
2451−
2452− Redistribution and use in source and binary forms, with or without
2453− modification, are permitted provided that the following conditions are met:
2454−
2455− - Redistributions of source code must retain the above copyright notice,
2456− this list of conditions and the following disclaimer.
2457−
2458− - Redistributions in binary form must reproduce the above copyright notice,
2459− this list of conditions and the following disclaimer in the documentation
2460− and/or other materials provided with the distribution.
2461−
2462− - Neither name of the University nor the names of its contributors may be
2463− used to endorse or promote products derived from this software without
2464− specific prior written permission.
2465−
2466− THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
2467− GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
2468− INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
2469− FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
2470− UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
2471− FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2472− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
2473− SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
2474− CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2475− LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2476− OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
2477− DAMAGE.
2478−
2479− -----------------------------------------------------------------------------
2480−
2481− Code derived from the document "Report on the Programming Language
2482− Haskell 98", is distributed under the following license:
2483−
2484− Copyright (c) 2002 Simon Peyton Jones
2485−
2486− The authors intend this Report to belong to the entire Haskell
2487− community, and so we grant permission to copy and distribute it for
2488− any purpose, provided that it is reproduced in its entirety,
2489− including this Notice. Modified versions of this Report may also be
2490− copied and distributed for any purpose, provided that the modified
2491− version is clearly presented as such, and that it does not claim to
2492− be a definition of the Haskell 98 Language.
2493−
2494− -----------------------------------------------------------------------------
2495−
2496−regex-base LICENSE file:
2497−
2498− This modile is under this "3 clause" BSD license:
2499−
2500− Copyright (c) 2007, Christopher Kuklewicz
2501− All rights reserved.
2502−
2503− Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
2504−
2505− * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2506− * 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.
2507− * The names of the contributors may not be used to endorse or promote products derived from this software without specific prior written permission.
2508−
2509− 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.
2510−
2511−regex-tdfa LICENSE file:
2512−
2513− This modile is under this "3 clause" BSD license:
2514−
2515− Copyright (c) 2007-2009, Christopher Kuklewicz
2516− All rights reserved.
2517−
2518− Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
2519−
2520− * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2521− * 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.
2522− * The names of the contributors may not be used to endorse or promote products derived from this software without specific prior written permission.
2523−
2524− 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.
2525−
2526−resourcet LICENSE file:
2527−
2528− Copyright (c)2011, Michael Snoyman
2529−
2530− All rights reserved.
2531−
2532− Redistribution and use in source and binary forms, with or without
2533− modification, are permitted provided that the following conditions are met:
2534−
2535− * Redistributions of source code must retain the above copyright
2536− notice, this list of conditions and the following disclaimer.
2537−
2538− * Redistributions in binary form must reproduce the above
2539− copyright notice, this list of conditions and the following
2540− disclaimer in the documentation and/or other materials provided
2541− with the distribution.
2542−
2543− * Neither the name of Michael Snoyman nor the names of other
2544− contributors may be used to endorse or promote products derived
2545− from this software without specific prior written permission.
2546−
2547− THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2548− "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2549− LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2550− A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2551− OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2552− SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2553− LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2554− DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2555− THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2556− (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2557− OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2558−
2559−safe LICENSE file:
2560−
2561− Copyright Neil Mitchell 2007-2015.
2562− All rights reserved.
2563−
2564− Redistribution and use in source and binary forms, with or without
2565− modification, are permitted provided that the following conditions are
2566− met:
2567−
2568− * Redistributions of source code must retain the above copyright
2569− notice, this list of conditions and the following disclaimer.
2570−
2571− * Redistributions in binary form must reproduce the above
2572− copyright notice, this list of conditions and the following
2573− disclaimer in the documentation and/or other materials provided
2574− with the distribution.
2575−
2576− * Neither the name of Neil Mitchell nor the names of other
2577− contributors may be used to endorse or promote products derived
2578− from this software without specific prior written permission.
2579−
2580− THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2581− "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2582− LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2583− A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2584− OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2585− SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2586− LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2587− DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2588− THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2589− (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2590− OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2591−
2592−scientific LICENSE file:
2593−
2594− Copyright (c) 2013, Bas van Dijk
2595−
2596− All rights reserved.
2597−
2598− Redistribution and use in source and binary forms, with or without
2599− modification, are permitted provided that the following conditions are met:
2600−
2601− * Redistributions of source code must retain the above copyright
2602− notice, this list of conditions and the following disclaimer.
2603−
2604− * Redistributions in binary form must reproduce the above
2605− copyright notice, this list of conditions and the following
2606− disclaimer in the documentation and/or other materials provided
2607− with the distribution.
2608−
2609− * Neither the name of Bas van Dijk nor the names of other
2610− contributors may be used to endorse or promote products derived
2611− from this software without specific prior written permission.
2612−
2613− THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2614− "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2615− LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2616− A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2617− OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2618− SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2619− LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2620− DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2621− THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2622− (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2623− OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2624−
2625−semigroups LICENSE file:
2626−
2627− Copyright 2011-2015 Edward Kmett
2628−
2629− All rights reserved.
2630−
2631− Redistribution and use in source and binary forms, with or without
2632− modification, are permitted provided that the following conditions
2633− are met:
2634−
2635− 1. Redistributions of source code must retain the above copyright
2636− notice, this list of conditions and the following disclaimer.
2637−
2638− 2. Redistributions in binary form must reproduce the above copyright
2639− notice, this list of conditions and the following disclaimer in the
2640− documentation and/or other materials provided with the distribution.
2641−
2642− THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
2643− IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
2644− WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
2645− DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
2646− ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2647− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2648− OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2649− HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
2650− STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
2651− ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2652− POSSIBILITY OF SUCH DAMAGE.
2653−
2654−socks LICENSE file:
2655−
2656− Copyright (c) 2010-2011 Vincent Hanquez <vincent@snarc.org>
2657−
2658− All rights reserved.
2659−
2660− Redistribution and use in source and binary forms, with or without
2661− modification, are permitted provided that the following conditions
2662− are met:
2663− 1. Redistributions of source code must retain the above copyright
2664− notice, this list of conditions and the following disclaimer.
2665− 2. Redistributions in binary form must reproduce the above copyright
2666− notice, this list of conditions and the following disclaimer in the
2667− documentation and/or other materials provided with the distribution.
2668− 3. Neither the name of the author nor the names of his contributors
2669− may be used to endorse or promote products derived from this software
2670− without specific prior written permission.
2671−
2672− THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2673− ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2674− IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2675− ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
2676− FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2677− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2678− OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2679− HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2680− LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2681− OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2682− SUCH DAMAGE.
2683−
2684−sourcemap LICENSE file:
2685−
2686− Copyright (c) 2012, Chris Done
2687−
2688− All rights reserved.
2689−
2690− Redistribution and use in source and binary forms, with or without
2691− modification, are permitted provided that the following conditions are met:
2692−
2693− * Redistributions of source code must retain the above copyright
2694− notice, this list of conditions and the following disclaimer.
2695−
2696− * Redistributions in binary form must reproduce the above
2697− copyright notice, this list of conditions and the following
2698− disclaimer in the documentation and/or other materials provided
2699− with the distribution.
2700−
2701− * Neither the name of Chris Done nor the names of other
2702− contributors may be used to endorse or promote products derived
2703− from this software without specific prior written permission.
2704−
2705− THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2706− "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2707− LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2708− A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2709− OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2710− SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2711− LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2712− DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2713− THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2714− (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2715− OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2716−
2717−spdx LICENSE file:
2718−
2719− Copyright (c) 2015, Oleg Grenrus
2720−
2721− All rights reserved.
2722−
2723− Redistribution and use in source and binary forms, with or without
2724− modification, are permitted provided that the following conditions are met:
2725−
2726− * Redistributions of source code must retain the above copyright
2727− notice, this list of conditions and the following disclaimer.
2728−
2729− * Redistributions in binary form must reproduce the above
2730− copyright notice, this list of conditions and the following
2731− disclaimer in the documentation and/or other materials provided
2732− with the distribution.
2733−
2734− * Neither the name of Oleg Grenrus nor the names of other
2735− contributors may be used to endorse or promote products derived
2736− from this software without specific prior written permission.
2737−
2738− THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2739− "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2740− LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2741− A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2742− OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2743− SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2744− LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2745− DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2746− THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2747− (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2748− OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2749−
2750−split LICENSE file:
2751−
2752− Copyright (c) 2008 Brent Yorgey, Louis Wasserman
2753−
2754− All rights reserved.
2755−
2756− Redistribution and use in source and binary forms, with or without
2757− modification, are permitted provided that the following conditions
2758− are met:
2759− 1. Redistributions of source code must retain the above copyright
2760− notice, this list of conditions and the following disclaimer.
2761− 2. Redistributions in binary form must reproduce the above copyright
2762− notice, this list of conditions and the following disclaimer in the
2763− documentation and/or other materials provided with the distribution.
2764− 3. Neither the name of the author nor the names of other contributors
2765− may be used to endorse or promote products derived from this software
2766− without specific prior written permission.
2767−
2768− THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND
2769− ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2770− IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2771− ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
2772− FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2773− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2774− OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2775− HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2776− LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2777− OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2778− SUCH DAMAGE.
2779−
2780−stm LICENSE file:
2781−
2782− The Glasgow Haskell Compiler License
2783−
2784− Copyright 2004, The University Court of the University of Glasgow.
2785− All rights reserved.
2786−
2787− Redistribution and use in source and binary forms, with or without
2788− modification, are permitted provided that the following conditions are met:
2789−
2790− - Redistributions of source code must retain the above copyright notice,
2791− this list of conditions and the following disclaimer.
2792−
2793− - Redistributions in binary form must reproduce the above copyright notice,
2794− this list of conditions and the following disclaimer in the documentation
2795− and/or other materials provided with the distribution.
2796−
2797− - Neither name of the University nor the names of its contributors may be
2798− used to endorse or promote products derived from this software without
2799− specific prior written permission.
2800−
2801− THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
2802− GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
2803− INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
2804− FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
2805− UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
2806− FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2807− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
2808− SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
2809− CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2810− LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2811− OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
2812− DAMAGE.
2813−
2814−stm-chans LICENSE file:
2815−
2816− === stm-chans license ===
2817−
2818− Copyright (c) 2011--2013, wren gayle romano.
2819− ALL RIGHTS RESERVED.
2820−
2821− Redistribution and use in source and binary forms, with or without
2822− modification, are permitted provided that the following conditions
2823− are met:
2824−
2825− * Redistributions of source code must retain the above copyright
2826− notice, this list of conditions and the following disclaimer.
2827−
2828− * Redistributions in binary form must reproduce the above
2829− copyright notice, this list of conditions and the following
2830− disclaimer in the documentation and/or other materials provided
2831− with the distribution.
2832−
2833− * Neither the name of the copyright holders nor the names of
2834− other contributors may be used to endorse or promote products
2835− derived from this software without specific prior written
2836− permission.
2837−
2838− THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2839− "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2840− LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
2841− FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
2842− COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
2843− INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
2844− BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
2845− LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
2846− CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2847− LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
2848− ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2849− POSSIBILITY OF SUCH DAMAGE.
2850−
2851−
2852−streaming-commons LICENSE file:
2853−
2854− The MIT License (MIT)
2855−
2856− Copyright (c) 2014 FP Complete
2857−
2858− Permission is hereby granted, free of charge, to any person obtaining a copy
2859− of this software and associated documentation files (the "Software"), to deal
2860− in the Software without restriction, including without limitation the rights
2861− to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2862− copies of the Software, and to permit persons to whom the Software is
2863− furnished to do so, subject to the following conditions:
2864−
2865− The above copyright notice and this permission notice shall be included in all
2866− copies or substantial portions of the Software.
2867−
2868− THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2869− IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2870− FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2871− AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2872− LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2873− OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2874− SOFTWARE.
2875−
2876−syb LICENSE file:
2877−
2878− This library (libraries/syb) is derived from code from several
2879− sources:
2880−
2881− * Code from the GHC project which is largely (c) The University of
2882− Glasgow, and distributable under a BSD-style license (see below),
2883−
2884− * Code from the Haskell 98 Report which is (c) Simon Peyton Jones
2885− and freely redistributable (but see the full license for
2886− restrictions).
2887−
2888− * Code from the Haskell Foreign Function Interface specification,
2889− which is (c) Manuel M. T. Chakravarty and freely redistributable
2890− (but see the full license for restrictions).
2891−
2892− The full text of these licenses is reproduced below. All of the
2893− licenses are BSD-style or compatible.
2894−
2895− -----------------------------------------------------------------------------
2896−
2897− The Glasgow Haskell Compiler License
2898−
2899− Copyright 2004, The University Court of the University of Glasgow.
2900− All rights reserved.
2901−
2902− Redistribution and use in source and binary forms, with or without
2903− modification, are permitted provided that the following conditions are met:
2904−
2905− - Redistributions of source code must retain the above copyright notice,
2906− this list of conditions and the following disclaimer.
2907−
2908− - Redistributions in binary form must reproduce the above copyright notice,
2909− this list of conditions and the following disclaimer in the documentation
2910− and/or other materials provided with the distribution.
2911−
2912− - Neither name of the University nor the names of its contributors may be
2913− used to endorse or promote products derived from this software without
2914− specific prior written permission.
2915−
2916− THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
2917− GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
2918− INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
2919− FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
2920− UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
2921− FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2922− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
2923− SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
2924− CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2925− LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2926− OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
2927− DAMAGE.
2928−
2929− -----------------------------------------------------------------------------
2930−
2931− Code derived from the document "Report on the Programming Language
2932− Haskell 98", is distributed under the following license:
2933−
2934− Copyright (c) 2002 Simon Peyton Jones
2935−
2936− The authors intend this Report to belong to the entire Haskell
2937− community, and so we grant permission to copy and distribute it for
2938− any purpose, provided that it is reproduced in its entirety,
2939− including this Notice. Modified versions of this Report may also be
2940− copied and distributed for any purpose, provided that the modified
2941− version is clearly presented as such, and that it does not claim to
2942− be a definition of the Haskell 98 Language.
2943−
2944− -----------------------------------------------------------------------------
2945−
2946− Code derived from the document "The Haskell 98 Foreign Function
2947− Interface, An Addendum to the Haskell 98 Report" is distributed under
2948− the following license:
2949−
2950− Copyright (c) 2002 Manuel M. T. Chakravarty
2951−
2952− The authors intend this Report to belong to the entire Haskell
2953− community, and so we grant permission to copy and distribute it for
2954− any purpose, provided that it is reproduced in its entirety,
2955− including this Notice. Modified versions of this Report may also be
2956− copied and distributed for any purpose, provided that the modified
2957− version is clearly presented as such, and that it does not claim to
2958− be a definition of the Haskell 98 Foreign Function Interface.
2959−
2960− -----------------------------------------------------------------------------
2961−
2962−tagged LICENSE file:
2963−
2964− Copyright (c) 2009-2015 Edward Kmett
2965− All rights reserved.
2966−
2967− Redistribution and use in source and binary forms, with or without
2968− modification, are permitted provided that the following conditions are
2969− met:
2970−
2971− * Redistributions of source code must retain the above copyright
2972− notice, this list of conditions and the following disclaimer.
2973−
2974− * Redistributions in binary form must reproduce the above
2975− copyright notice, this list of conditions and the following
2976− disclaimer in the documentation and/or other materials provided
2977− with the distribution.
2978−
2979− * Neither the name of Edward Kmett nor the names of other
2980− contributors may be used to endorse or promote products derived
2981− from this software without specific prior written permission.
2982−
2983− THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2984− "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2985− LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2986− A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2987− OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2988− SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2989− LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2990− DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2991− THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2992− (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2993− OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2994−
2995−template-haskell LICENSE file:
2996−
2997−
2998− The Glasgow Haskell Compiler License
2999−
3000− Copyright 2002-2007, The University Court of the University of Glasgow.
3001− All rights reserved.
3002−
3003− Redistribution and use in source and binary forms, with or without
3004− modification, are permitted provided that the following conditions are met:
3005−
3006− - Redistributions of source code must retain the above copyright notice,
3007− this list of conditions and the following disclaimer.
3008−
3009− - Redistributions in binary form must reproduce the above copyright notice,
3010− this list of conditions and the following disclaimer in the documentation
3011− and/or other materials provided with the distribution.
3012−
3013− - Neither name of the University nor the names of its contributors may be
3014− used to endorse or promote products derived from this software without
3015− specific prior written permission.
3016−
3017− THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
3018− GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
3019− INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
3020− FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
3021− UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
3022− FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3023− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
3024− SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
3025− CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3026− LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3027− OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
3028− DAMAGE.
3029−
3030−
3031−terminfo LICENSE file:
3032−
3033− Copyright 2007, Judah Jacobson.
3034− All Rights Reserved.
3035−
3036− Redistribution and use in source and binary forms, with or without
3037− modification, are permitted provided that the following conditions are met:
3038−
3039− - Redistribution of source code must retain the above copyright notice,
3040− this list of conditions and the following disclamer.
3041−
3042− - Redistribution in binary form must reproduce the above copyright notice,
3043− this list of conditions and the following disclamer in the documentation
3044− and/or other materials provided with the distribution.
3045−
3046− THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY
3047− EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
3048− WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
3049− DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE CONTRIBUTORS BE LIABLE
3050− FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3051− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
3052− SERVICES; LOSS OF USE, DATA OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
3053− CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
3054− OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
3055− USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3056−
3057−text LICENSE file:
3058−
3059− Copyright (c) 2008-2009, Tom Harper
3060− All rights reserved.
3061−
3062− Redistribution and use in source and binary forms, with or without
3063− modification, are permitted provided that the following conditions
3064− are met:
3065−
3066− * Redistributions of source code must retain the above copyright
3067− notice, this list of conditions and the following disclaimer.
3068−
3069− * Redistributions in binary form must reproduce the above
3070− copyright notice, this list of conditions and the following
3071− disclaimer in the documentation and/or other materials provided
3072− with the distribution.
3073−
3074− THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
3075− "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3076− LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
3077− A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3078− OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
3079− SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3080− LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3081− DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3082− THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3083− (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3084− OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3085−
3086−time LICENSE file:
3087−
3088− TimeLib is Copyright (c) Ashley Yakeley, 2004-2014. All rights reserved.
3089− Certain sections are Copyright 2004, The University Court of the University of Glasgow. All rights reserved.
3090−
3091− Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
3092−
3093− - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
3094−
3095− - 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.
3096−
3097− 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.
3098−
3099−tls LICENSE file:
3100−
3101− Copyright (c) 2010-2015 Vincent Hanquez <vincent@snarc.org>
3102−
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
3107− are met:
3108− 1. Redistributions of source code must retain the above copyright
3109− notice, this list of conditions and the following disclaimer.
3110− 2. Redistributions in binary form must reproduce the above copyright
3111− notice, this list of conditions and the following disclaimer in the
3112− documentation and/or other materials provided with the distribution.
3113− 3. Neither the name of the author nor the names of his contributors
3114− may be used to endorse or promote products derived from this software
3115− without specific prior written permission.
3116−
3117− THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
3118− ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
3119− IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
3120− ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
3121− FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3122− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3123− OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3124− HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3125− LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3126− OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3127− SUCH DAMAGE.
3128−
3129−transformers LICENSE file:
3130−
3131− The Glasgow Haskell Compiler License
3132−
3133− Copyright 2004, The University Court of the University of Glasgow.
3134− All rights reserved.
3135−
3136− Redistribution and use in source and binary forms, with or without
3137− modification, are permitted provided that the following conditions are met:
3138−
3139− - Redistributions of source code must retain the above copyright notice,
3140− this list of conditions and the following disclaimer.
3141−
3142− - Redistributions in binary form must reproduce the above copyright notice,
3143− this list of conditions and the following disclaimer in the documentation
3144− and/or other materials provided with the distribution.
3145−
3146− - Neither name of the University nor the names of its contributors may be
3147− used to endorse or promote products derived from this software without
3148− specific prior written permission.
3149−
3150− THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
3151− GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
3152− INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
3153− FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
3154− UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
3155− FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3156− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
3157− SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
3158− CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3159− LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3160− OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
3161− DAMAGE.
3162−
3163−transformers-base LICENSE file:
3164−
3165− Copyright (c) 2011, Mikhail Vorozhtsov, Bas van Dijk
3166− All rights reserved.
3167−
3168− Redistribution and use in source and binary forms, with or without
3169− modification, are permitted provided that the following conditions are met:
3170−
3171− - Redistributions of source code must retain the above copyright notice,
3172− this list of conditions and the following disclaimer.
3173− - Redistributions in binary form must reproduce the above copyright
3174− notice, this list of conditions and the following disclaimer in the
3175− documentation and/or other materials provided with the distribution.
3176− - Neither the names of the copyright owners nor the names of the
3177− contributors may be used to endorse or promote products derived
3178− from this software without specific prior written permission.
3179−
3180− THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
3181− "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3182− LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
3183− A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3184− OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
3185− SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3186− LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3187− DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3188− THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3189− (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3190− OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3191−
3192−
3193−transformers-compat LICENSE file:
3194−
3195− Copyright 2012-2015 Edward Kmett
3196−
3197− All rights reserved.
3198−
3199− Redistribution and use in source and binary forms, with or without
3200− modification, are permitted provided that the following conditions
3201− are met:
3202−
3203− 1. Redistributions of source code must retain the above copyright
3204− notice, this list of conditions and the following disclaimer.
3205−
3206− 2. Redistributions in binary form must reproduce the above copyright
3207− notice, this list of conditions and the following disclaimer in the
3208− documentation and/or other materials provided with the distribution.
3209−
3210− 3. Neither the name of the author nor the names of his contributors
3211− may be used to endorse or promote products derived from this software
3212− without specific prior written permission.
3213−
3214− THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
3215− IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
3216− WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
3217− DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
3218− ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3219− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3220− OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3221− HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
3222− STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
3223− ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3224− POSSIBILITY OF SUCH DAMAGE.
3225−
3226−unix LICENSE file:
3227−
3228− The Glasgow Haskell Compiler License
3229−
3230− Copyright 2004, The University Court of the University of Glasgow.
3231− All rights reserved.
3232−
3233− Redistribution and use in source and binary forms, with or without
3234− modification, are permitted provided that the following conditions are met:
3235−
3236− - Redistributions of source code must retain the above copyright notice,
3237− this list of conditions and the following disclaimer.
3238−
3239− - Redistributions in binary form must reproduce the above copyright notice,
3240− this list of conditions and the following disclaimer in the documentation
3241− and/or other materials provided with the distribution.
3242−
3243− - Neither name of the University nor the names of its contributors may be
3244− used to endorse or promote products derived from this software without
3245− specific prior written permission.
3246−
3247− THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
3248− GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
3249− INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
3250− FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
3251− UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
3252− FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3253− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
3254− SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
3255− CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3256− LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3257− OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
3258− DAMAGE.
3259−
3260−unix-compat LICENSE file:
3261−
3262− Copyright (c) 2007-2008, Björn Bringert
3263− Copyright (c) 2007-2009, Duncan Coutts
3264− Copyright (c) 2010-2011, Jacob Stanley
3265− Copyright (c) 2011, Bryan O'Sullivan
3266− All rights reserved.
3267−
3268− Redistribution and use in source and binary forms, with or without
3269− modification, are permitted provided that the following conditions are met:
3270−
3271− - Redistributions of source code must retain the above copyright notice,
3272− this list of conditions and the following disclaimer.
3273− - Redistributions in binary form must reproduce the above copyright
3274− notice, this list of conditions and the following disclaimer in the
3275− documentation and/or other materials provided with the distribution.
3276− - Neither the names of the copyright owners nor the names of the
3277− contributors may be used to endorse or promote products derived
3278− from this software without specific prior written permission.
3279−
3280− THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
3281− "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3282− LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
3283− A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3284− OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
3285− SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3286− LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3287− DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3288− THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3289− (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3290− OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3291−
3292−unordered-containers LICENSE file:
3293−
3294− Copyright (c) 2010, Johan Tibell
3295−
3296− All rights reserved.
3297−
3298− Redistribution and use in source and binary forms, with or without
3299− modification, are permitted provided that the following conditions are met:
3300−
3301− * Redistributions of source code must retain the above copyright
3302− notice, this list of conditions and the following disclaimer.
3303−
3304− * Redistributions in binary form must reproduce the above
3305− copyright notice, this list of conditions and the following
3306− disclaimer in the documentation and/or other materials provided
3307− with the distribution.
3308−
3309− * Neither the name of Johan Tibell nor the names of other
3310− contributors may be used to endorse or promote products derived
3311− from this software without specific prior written permission.
3312−
3313− THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
3314− "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3315− LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
3316− A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3317− OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
3318− SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3319− LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3320− DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3321− THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3322− (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3323− OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3324−
3325−utf8-string LICENSE file:
3326−
3327− * Copyright (c) 2007, Galois Inc.
3328− * All rights reserved.
3329− *
3330− * Redistribution and use in source and binary forms, with or without
3331− * modification, are permitted provided that the following conditions are met:
3332− * * Redistributions of source code must retain the above copyright
3333− * notice, this list of conditions and the following disclaimer.
3334− * * Redistributions in binary form must reproduce the above copyright
3335− * notice, this list of conditions and the following disclaimer in the
3336− * documentation and/or other materials provided with the distribution.
3337− * * Neither the name of Galois Inc. nor the
3338− * names of its contributors may be used to endorse or promote products
3339− * derived from this software without specific prior written permission.
3340− *
3341− * THIS SOFTWARE IS PROVIDED BY Galois Inc. ``AS IS'' AND ANY
3342− * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
3343− * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
3344− * DISCLAIMED. IN NO EVENT SHALL Galois Inc. BE LIABLE FOR ANY
3345− * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
3346− * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
3347− * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
3348− * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3349− * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
3350− * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3351−
3352−vector LICENSE file:
3353−
3354− Copyright (c) 2008-2012, Roman Leshchinskiy
3355− All rights reserved.
3356−
3357− Redistribution and use in source and binary forms, with or without
3358− modification, are permitted provided that the following conditions are met:
3359−
3360− - Redistributions of source code must retain the above copyright notice,
3361− this list of conditions and the following disclaimer.
3362−
3363− - Redistributions in binary form must reproduce the above copyright notice,
3364− this list of conditions and the following disclaimer in the documentation
3365− and/or other materials provided with the distribution.
3366−
3367− - Neither name of the University nor the names of its contributors may be
3368− used to endorse or promote products derived from this software without
3369− specific prior written permission.
3370−
3371− THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF
3372− GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
3373− INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
3374− FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
3375− UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE
3376− FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3377− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
3378− SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
3379− CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3380− LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3381− OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
3382− DAMAGE.
3383−
3384−
3385−void LICENSE file:
3386−
3387− Copyright 2015 Edward Kmett
3388−
3389− All rights reserved.
3390−
3391− Redistribution and use in source and binary forms, with or without
3392− modification, are permitted provided that the following conditions
3393− are met:
3394−
3395− 1. Redistributions of source code must retain the above copyright
3396− notice, this list of conditions and the following disclaimer.
3397−
3398− 2. Redistributions in binary form must reproduce the above copyright
3399− notice, this list of conditions and the following disclaimer in the
3400− documentation and/or other materials provided with the distribution.
3401−
3402− 3. Neither the name of the author nor the names of his contributors
3403− may be used to endorse or promote products derived from this software
3404− without specific prior written permission.
3405−
3406− THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
3407− IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
3408− WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
3409− DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
3410− ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3411− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3412− OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3413− HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
3414− STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
3415− ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3416− POSSIBILITY OF SUCH DAMAGE.
3417−
3418−x509 LICENSE file:
3419−
3420− Copyright (c) 2010-2013 Vincent Hanquez <vincent@snarc.org>
3421−
3422− All rights reserved.
3423−
3424− Redistribution and use in source and binary forms, with or without
3425− modification, are permitted provided that the following conditions
3426− are met:
3427− 1. Redistributions of source code must retain the above copyright
3428− notice, this list of conditions and the following disclaimer.
3429− 2. Redistributions in binary form must reproduce the above copyright
3430− notice, this list of conditions and the following disclaimer in the
3431− documentation and/or other materials provided with the distribution.
3432− 3. Neither the name of the author nor the names of his contributors
3433− may be used to endorse or promote products derived from this software
3434− without specific prior written permission.
3435−
3436− THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
3437− ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
3438− IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
3439− ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
3440− FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3441− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3442− OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3443− HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3444− LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3445− OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3446− SUCH DAMAGE.
3447−
3448−x509-store LICENSE file:
3449−
3450− Copyright (c) 2010-2013 Vincent Hanquez <vincent@snarc.org>
3451−
3452− All rights reserved.
3453−
3454− Redistribution and use in source and binary forms, with or without
3455− modification, are permitted provided that the following conditions
3456− are met:
3457− 1. Redistributions of source code must retain the above copyright
3458− notice, this list of conditions and the following disclaimer.
3459− 2. Redistributions in binary form must reproduce the above copyright
3460− notice, this list of conditions and the following disclaimer in the
3461− documentation and/or other materials provided with the distribution.
3462− 3. Neither the name of the author nor the names of his contributors
3463− may be used to endorse or promote products derived from this software
3464− without specific prior written permission.
3465−
3466− THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
3467− ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
3468− IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
3469− ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
3470− FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3471− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3472− OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3473− HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3474− LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3475− OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3476− SUCH DAMAGE.
3477−
3478−x509-system LICENSE file:
3479−
3480− Copyright (c) 2010-2013 Vincent Hanquez <vincent@snarc.org>
3481−
3482− All rights reserved.
3483−
3484− Redistribution and use in source and binary forms, with or without
3485− modification, are permitted provided that the following conditions
3486− are met:
3487− 1. Redistributions of source code must retain the above copyright
3488− notice, this list of conditions and the following disclaimer.
3489− 2. Redistributions in binary form must reproduce the above copyright
3490− notice, this list of conditions and the following disclaimer in the
3491− documentation and/or other materials provided with the distribution.
3492− 3. Neither the name of the author nor the names of his contributors
3493− may be used to endorse or promote products derived from this software
3494− without specific prior written permission.
3495−
3496− THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
3497− ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
3498− IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
3499− ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
3500− FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3501− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3502− OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3503− HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3504− LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3505− OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3506− SUCH DAMAGE.
3507−
3508−x509-validation LICENSE file:
3509−
3510− Copyright (c) 2010-2013 Vincent Hanquez <vincent@snarc.org>
3511−
3512− All rights reserved.
3513−
3514− Redistribution and use in source and binary forms, with or without
3515− modification, are permitted provided that the following conditions
3516− are met:
3517− 1. Redistributions of source code must retain the above copyright
3518− notice, this list of conditions and the following disclaimer.
3519− 2. Redistributions in binary form must reproduce the above copyright
3520− notice, this list of conditions and the following disclaimer in the
3521− documentation and/or other materials provided with the distribution.
3522− 3. Neither the name of the author nor the names of his contributors
3523− may be used to endorse or promote products derived from this software
3524− without specific prior written permission.
3525−
3526− THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
3527− ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
3528− IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
3529− ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
3530− FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3531− DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3532− OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3533− HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3534− LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3535− OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3536− SUCH DAMAGE.
3537−
3538−zlib LICENSE file:
3539−
3540− Copyright (c) 2006-2015, Duncan Coutts
3541− All rights reserved.
3542−
3543− Redistribution and use in source and binary forms, with or without
3544− modification, are permitted provided that the following conditions are met:
3545−
3546− 1. Redistributions of source code must retain the above copyright notice,
3547− this list of conditions and the following disclaimer.
3548− 2. Redistributions in binary form must reproduce the above copyright
3549− notice, this list of conditions and the following disclaimer in the
3550− documentation and/or other materials provided with the distribution.
3551− 3. This clause is intentionally left blank.
3552−
3553− THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
3554− AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
3555− IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
3556− ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
3557− LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
3558− CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
3559− SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
3560− INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
3561− CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
3562− ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3563− POSSIBILITY OF SUCH DAMAGE.
3564−
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.
README-go.mdnew file+48
@@ -0,0 +1,48 @@
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+32−20
@@ -1,29 +1,41 @@
1−[![PureScript](logo.png)](http://purescript.org)
1+[![PureScript](https://raw.githubusercontent.com/purescript/purescript/master/logo.png)](http://purescript.org)
22
3−A small strongly typed programming language with expressive types that compiles to Javascript, written in and inspired by Haskell.
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.
44
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)
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).
66
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)
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`
1020
11−## Language info
1221
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)
22+#### Requirements for building `pscpp` and `psgo`
1623
17−## Resources
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/))
1825
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/)
26+#### Requirements for using PureScript + purescript-native
2327
24−## Help!
28+* A recent version (0.13+) of [purescript](https://github.com/purescript/purescript/releases).
2529
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)
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+---
Setup.hs−4
@@ -1,6 +1,2 @@
1−module Main where
2−
31import Distribution.Simple
4−
5−main :: IO ()
62main = defaultMain
app/Main.hsnew file+250
@@ -0,0 +1,250 @@
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.ymldeleted−51
@@ -1,51 +0,0 @@
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.txtdeleted−8
@@ -1,8 +0,0 @@
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/.gitignoredeleted−4
@@ -1,4 +0,0 @@
1−build/
2−*.tar.gz
3−*.sha
4−*.md5
bundle/READMEdeleted−24
@@ -1,24 +0,0 @@
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.shdeleted−65
@@ -1,65 +0,0 @@
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/.gitignoredeleted−2
@@ -1,2 +0,0 @@
1−bower_components/
2−output/
core-tests/test-everything.shdeleted−79
@@ -1,79 +0,0 @@
1−#!/bin/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−bower i \
22− purescript-prelude \
23− purescript-eff \
24− purescript-st \
25− purescript-integers \
26− purescript-functions \
27− purescript-console \
28− purescript-profunctor \
29− purescript-contravariant \
30− purescript-parallel \
31− purescript-control \
32− purescript-tailrec \
33− purescript-maps \
34− purescript-free \
35− purescript-transformers \
36− purescript-exists \
37− purescript-monoid \
38− purescript-either \
39− purescript-maybe \
40− purescript-inject \
41− purescript-graphs \
42− purescript-enums \
43− purescript-unfoldable \
44− purescript-coproducts \
45− purescript-lazy \
46− purescript-distributive \
47− purescript-identity \
48− purescript-bifunctors \
49− purescript-const \
50− purescript-sets \
51− purescript-quickcheck \
52− purescript-foreign \
53− purescript-foldable-traversable \
54− purescript-tuples \
55− purescript-strings \
56− purescript-arrays \
57− purescript-random \
58− purescript-refs \
59− purescript-globals \
60− purescript-exceptions \
61− purescript-validation \
62− purescript-parallel \
63− purescript-proxy \
64− purescript-semirings \
65− purescript-math \
66− purescript-generics
67−
68−if [ "$force_recompile" = "true" ] && [ -d "output" ]; then
69− echo "Recompiling..."
70− rm -r output
71−fi
72−
73−../dist/build/psc/psc tests/*/*.purs \
74− 'bower_components/purescript-*/src/**/*.purs' \
75− --ffi 'bower_components/purescript-*/src/**/*.js'
76−
77−../dist/build/psc-docs/psc-docs tests/*/*.purs \
78− 'bower_components/purescript-*/src/**/*.purs' \
79− > full-core-docs.md
core-tests/tests/generic-deriving/Main.pursdeleted−27
@@ -1,27 +0,0 @@
1−module GenericDeriving where
2−
3−import Prelude
4−
5−import Control.Monad.Eff (Eff())
6−import Control.Monad.Eff.Console (CONSOLE())
7−import Data.Generic
8−
9−data Void
10−
11−derive instance genericVoid :: Generic Void
12−
13−data A a
14− = A Number String
15− | B Int
16− | C (Array (A a))
17− | D { "asgård" :: a }
18− | E Void
19−
20−derive instance genericA :: (Generic b) => Generic (A b)
21−
22−newtype X b = X b
23−
24−derive instance genericX :: Generic (X String)
25−
26−main :: forall eff. Eff (console :: CONSOLE | eff) Unit
27−main = Control.Monad.Eff.Console.log (gShow (D { "asgård": C [ A 1.0 "test", B 42, D { "asgård": true } ] }))
default.nixnew file+23
@@ -0,0 +1,23 @@
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/.gitignoredeleted−1
@@ -1 +0,0 @@
1−shelltest/tests
examples/docs/bower.jsondeleted−20
@@ -1,20 +0,0 @@
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.pursdeleted−8
@@ -1,8 +0,0 @@
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.pursdeleted−4
@@ -1,4 +0,0 @@
1−module Clash (module Clash1) where
2−
3−import Clash1 as Clash1
4−import Clash2 as Clash2
examples/docs/src/Clash1.pursdeleted−3
@@ -1,3 +0,0 @@
1−module Clash1 (module Clash1a) where
2−
3−import Clash1a
examples/docs/src/Clash1a.pursdeleted−9
@@ -1,9 +0,0 @@
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.pursdeleted−3
@@ -1,3 +0,0 @@
1−module Clash2 (module Clash2a) where
2−
3−import Clash2a
examples/docs/src/Clash2a.pursdeleted−9
@@ -1,9 +0,0 @@
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.pursdeleted−9
@@ -1,9 +0,0 @@
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.pursdeleted−9
@@ -1,9 +0,0 @@
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.pursdeleted−7
@@ -1,7 +0,0 @@
1−module Example
2− ( module Prelude
3− , module Example2
4− ) where
5−
6−import Prelude (Unit())
7−import Example2 (one)
examples/docs/src/Example2.pursdeleted−7
@@ -1,7 +0,0 @@
1−module Example2 where
2−
3−one :: Int
4−one = 1
5−
6−two :: Int
7−two = 2
examples/docs/src/ExplicitTypeSignatures.pursdeleted−16
@@ -1,16 +0,0 @@
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
examples/docs/src/ImportedTwice.pursdeleted−13
@@ -1,13 +0,0 @@
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.pursdeleted−8
@@ -1,8 +0,0 @@
1−module ImportedTwiceA
2− ( module ImportedTwiceB )
3− where
4−
5−import ImportedTwiceB
6−
7−bar :: Int
8−bar = 1
examples/docs/src/ImportedTwiceB.pursdeleted−4
@@ -1,4 +0,0 @@
1−module ImportedTwiceB where
2−
3−foo :: Int
4−foo = 0
examples/docs/src/MultiVirtual.pursdeleted−6
@@ -1,6 +0,0 @@
1−module MultiVirtual
2− ( module X )
3− where
4−
5−import MultiVirtual1 as X
6−import MultiVirtual2 as X
examples/docs/src/MultiVirtual1.pursdeleted−4
@@ -1,4 +0,0 @@
1−module MultiVirtual1 where
2−
3−foo :: Int
4−foo = 1
examples/docs/src/MultiVirtual2.pursdeleted−9
@@ -1,9 +0,0 @@
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.pursdeleted−4
@@ -1,4 +0,0 @@
1−module MultiVirtual3 where
2−
3−baz :: Int
4−baz = 3
examples/docs/src/NewOperators.pursdeleted−5
@@ -1,5 +0,0 @@
1−module NewOperators
2− ( module NewOperators2 )
3− where
4−
5−import NewOperators2
examples/docs/src/NewOperators2.pursdeleted−6
@@ -1,6 +0,0 @@
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.pursdeleted−5
@@ -1,5 +0,0 @@
1−module NotAllCtors
2− ( module Prelude )
3− where
4−
5−import Prelude (Boolean2(True))
examples/docs/src/ReExportedTypeClass.pursdeleted−5
@@ -1,5 +0,0 @@
1−module ReExportedTypeClass
2− ( module SomeTypeClass )
3− where
4−
5−import SomeTypeClass
examples/docs/src/SolitaryTypeClassMember.pursdeleted−6
@@ -1,6 +0,0 @@
1−module SolitaryTypeClassMember
2− ( module SomeTypeClass )
3− where
4−
5−import SomeTypeClass (member)
6−
examples/docs/src/SomeTypeClass.pursdeleted−5
@@ -1,5 +0,0 @@
1−
2−module SomeTypeClass where
3−
4−class SomeClass a where
5− member :: a
examples/docs/src/Transitive1.pursdeleted−5
@@ -1,5 +0,0 @@
1−module Transitive1
2− ( module Transitive2 )
3− where
4−
5−import Transitive2
examples/docs/src/Transitive2.pursdeleted−5
@@ -1,5 +0,0 @@
1−module Transitive2
2− ( module Transitive3 )
3− where
4−
5−import Transitive3
examples/docs/src/Transitive3.pursdeleted−4
@@ -1,4 +0,0 @@
1−module Transitive3 where
2−
3−transitive3 :: Int
4−transitive3 = 0
examples/docs/src/TypeClassWithoutMembers.pursdeleted−5
@@ -1,5 +0,0 @@
1−module TypeClassWithoutMembers
2− ( module TypeClassWithoutMembersIntermediate )
3− where
4−
5−import TypeClassWithoutMembersIntermediate
examples/docs/src/TypeClassWithoutMembersIntermediate.pursdeleted−5
@@ -1,5 +0,0 @@
1−module TypeClassWithoutMembersIntermediate
2− ( module SomeTypeClass )
3− where
4−
5−import SomeTypeClass (class SomeClass)
examples/docs/src/TypeOpAliases.pursdeleted−18
@@ -1,18 +0,0 @@
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.pursdeleted−7
@@ -1,7 +0,0 @@
1−module UTF8 where
2−
3−import Prelude (Unit, unit)
4−
5−-- | üÜäÄ 😰
6−thing :: Unit
7−thing = unit
examples/docs/src/Virtual.pursdeleted−5
@@ -1,5 +0,0 @@
1−module Virtual
2− ( module VirtualPrelude )
3− where
4−
5−import Prelude as VirtualPrelude
examples/failing/1071.pursdeleted−8
@@ -1,8 +0,0 @@
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.pursdeleted−12
@@ -1,12 +0,0 @@
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.pursdeleted−11
@@ -1,11 +0,0 @@
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.pursdeleted−18
@@ -1,18 +0,0 @@
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.pursdeleted−6
@@ -1,6 +0,0 @@
1−-- @shouldFailWith ExpectedType
2−module M where
3−
4−data F a = F a
5−
6−test = \(x :: F) -> x
examples/failing/1733.pursdeleted−6
@@ -1,6 +0,0 @@
1−-- @shouldFailWith UnknownName
2−module Main where
3−
4−import Thingy as Thing
5−
6−main = Thing.doesntExist "hi"
examples/failing/1733/Thingy.pursdeleted−4
@@ -1,4 +0,0 @@
1−module Thingy where
2−
3−foo :: Int
4−foo = 1
examples/failing/1825.pursdeleted−9
@@ -1,9 +0,0 @@
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.pursdeleted−6
@@ -1,6 +0,0 @@
1−-- @shouldFailWith ErrorParsingModule
2−module Main where
3−
4−foo =
5−bar :: Int
6−bar = 3
examples/failing/365.pursdeleted−14
@@ -1,14 +0,0 @@
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.pursdeleted−15
@@ -1,15 +0,0 @@
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.pursdeleted−13
@@ -1,13 +0,0 @@
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.pursdeleted−5
@@ -1,5 +0,0 @@
1−-- @shouldFailWith IncorrectAnonymousArgument
2−module Main where
3−
4−test :: Int -> Int
5−test = _
examples/failing/AnonArgument2.pursdeleted−7
@@ -1,7 +0,0 @@
1−-- @shouldFailWith IncorrectAnonymousArgument
2−module Main where
3−
4−import Prelude
5−
6−test :: Int -> Int
7−test = 1 + 2 * _
examples/failing/AnonArgument3.pursdeleted−5
@@ -1,5 +0,0 @@
1−-- @shouldFailWith IncorrectAnonymousArgument
2−module Main where
3−
4−test :: Int -> Int
5−test = 1 + _
examples/failing/ArgLengthMismatch.pursdeleted−7
@@ -1,7 +0,0 @@
1−-- @shouldFailWith ArgListLengthsDiffer
2−module ArgLengthMismatch where
3−
4−import Prelude
5−
6−f x y = true
7−f = false
examples/failing/ArrayType.pursdeleted−14
@@ -1,14 +0,0 @@
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.pursdeleted−6
@@ -1,6 +0,0 @@
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.pursdeleted−6
@@ -1,6 +0,0 @@
1−-- @shouldFailWith CaseBinderLengthDiffers
2−module Main where
3−
4−test = case 1, 2 of
5− 1, 2, 3 -> 42
6− _, _ -> 43
examples/failing/CaseDoesNotMatchAllConstructorArgs.pursdeleted−15
@@ -1,15 +0,0 @@
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.pursdeleted−6
@@ -1,6 +0,0 @@
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.pursdeleted−4
@@ -1,4 +0,0 @@
1−module A where
2−
3−thing :: Int
4−thing = 1
examples/failing/ConflictingExports/B.pursdeleted−4
@@ -1,4 +0,0 @@
1−module B where
2−
3−thing :: Int
4−thing = 2
examples/failing/ConflictingImports.pursdeleted−9
@@ -1,9 +0,0 @@
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.pursdeleted−4
@@ -1,4 +0,0 @@
1−module A where
2−
3−thing :: Int
4−thing = 1
examples/failing/ConflictingImports/B.pursdeleted−4
@@ -1,4 +0,0 @@
1−module B where
2−
3−thing :: Int
4−thing = 2
examples/failing/ConflictingImports2.pursdeleted−10
@@ -1,10 +0,0 @@
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.pursdeleted−4
@@ -1,4 +0,0 @@
1−module A where
2−
3−thing :: Int
4−thing = 1
examples/failing/ConflictingImports2/B.pursdeleted−4
@@ -1,4 +0,0 @@
1−module B where
2−
3−thing :: Int
4−thing = 2
examples/failing/ConflictingQualifiedImports.pursdeleted−7
@@ -1,7 +0,0 @@
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.pursdeleted−4
@@ -1,4 +0,0 @@
1−module A where
2−
3−thing :: Int
4−thing = 1
examples/failing/ConflictingQualifiedImports/B.pursdeleted−4
@@ -1,4 +0,0 @@
1−module B where
2−
3−thing :: Int
4−thing = 2
examples/failing/ConflictingQualifiedImports2.pursdeleted−5
@@ -1,5 +0,0 @@
1−-- @shouldFailWith ScopeConflict
2−module Main (module X) where
3−
4−import A as X
5−import B as X
examples/failing/ConflictingQualifiedImports2/A.pursdeleted−4
@@ -1,4 +0,0 @@
1−module A where
2−
3−thing :: Int
4−thing = 1
examples/failing/ConflictingQualifiedImports2/B.pursdeleted−4
@@ -1,4 +0,0 @@
1−module B where
2−
3−thing :: Int
4−thing = 2
examples/failing/ConstraintInference.pursdeleted−10
@@ -1,10 +0,0 @@
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.pursdeleted−6
@@ -1,6 +0,0 @@
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/Do.pursdeleted−12
@@ -1,12 +0,0 @@
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.pursdeleted−13
@@ -1,13 +0,0 @@
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.pursdeleted−7
@@ -1,7 +0,0 @@
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.pursdeleted−12
@@ -1,12 +0,0 @@
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.pursdeleted−12
@@ -1,12 +0,0 @@
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.pursdeleted−12
@@ -1,12 +0,0 @@
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.pursdeleted−6
@@ -1,6 +0,0 @@
1−-- @shouldFailWith DuplicateTypeArgument
2−module Main where
3−
4−import Prelude
5−
6−type Foo a a = a
examples/failing/Eff.pursdeleted−13
@@ -1,13 +0,0 @@
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.pursdeleted−4
@@ -1,4 +0,0 @@
1−-- @shouldFailWith ErrorParsingModule
2−module Main where
3−
4−error err = case err of \_ -> 1
examples/failing/EmptyClass.pursdeleted−7
@@ -1,7 +0,0 @@
1−-- @shouldFailWith ErrorParsingModule
2−module Main where
3−
4−class Foo x where
5−
6−bar :: String
7−bar = "hello"
examples/failing/EmptyDo.pursdeleted−6
@@ -1,6 +0,0 @@
1−-- @shouldFailWith ErrorParsingModule
2−
3−module Main where
4−
5−main = do
6−
examples/failing/ExportExplicit.pursdeleted−8
@@ -1,8 +0,0 @@
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.pursdeleted−11
@@ -1,11 +0,0 @@
1−-- @shouldFailWith UnknownName
2−module Main where
3−
4−import M1
5−
6−testX = X
7−
8−-- should fail as Y constructor is not exported from M1
9−testY = Y
10−
11−main = Control.Monad.Eff.Console.log "Done"
examples/failing/ExportExplicit1/M1.pursdeleted−3
@@ -1,3 +0,0 @@
1−module M1 (X(X)) where
2−
3−data X = X | Y
examples/failing/ExportExplicit2.pursdeleted−8
@@ -1,8 +0,0 @@
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.pursdeleted−9
@@ -1,9 +0,0 @@
1−-- @shouldFailWith UnknownName
2−module Main where
3−
4−import M1
5−
6−-- should fail as Z is not exported from M1
7−testZ = M1.Z
8−
9−main = Control.Monad.Eff.Console.log "Done"
examples/failing/ExportExplicit3/M1.pursdeleted−4
@@ -1,4 +0,0 @@
1−module M1 (X(..)) where
2−
3−data X = X | Y
4−data Z = Z
examples/failing/ExtraRecordField.pursdeleted−9
@@ -1,9 +0,0 @@
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.pursdeleted−17
@@ -1,17 +0,0 @@
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.pursdeleted−11
@@ -1,11 +0,0 @@
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.pursdeleted−8
@@ -1,8 +0,0 @@
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.pursdeleted−4
@@ -1,4 +0,0 @@
1−-- @shouldFailWith UnknownImport
2−module Main where
3−
4−import M1 (X(..))
examples/failing/ImportExplicit/M1.pursdeleted−3
@@ -1,3 +0,0 @@
1−module M1 where
2−
3−foo = "foo"
examples/failing/ImportExplicit2.pursdeleted−4
@@ -1,4 +0,0 @@
1−-- @shouldFailWith UnknownImportDataConstructor
2−module Main where
3−
4−import M1 (X(Z, Q))
examples/failing/ImportExplicit2/M1.pursdeleted−3
@@ -1,3 +0,0 @@
1−module M1 where
2−
3−data X = Y
examples/failing/ImportHidingModule.pursdeleted−4
@@ -1,4 +0,0 @@
1−-- @shouldFailWith ImportHidingModule
2−module Main where
3−
4−import B hiding (module A)
examples/failing/ImportHidingModule/A.pursdeleted−2
@@ -1,2 +0,0 @@
1−module A where
2−x = 1
examples/failing/ImportHidingModule/B.pursdeleted−3
@@ -1,3 +0,0 @@
1−module B (module B, module A) where
2−import A
3−y = 1
examples/failing/ImportModule.pursdeleted−4
@@ -1,4 +0,0 @@
1−-- @shouldFailWith UnknownName
2−module Main where
3−
4−import M1
examples/failing/ImportModule/M2.pursdeleted−3
@@ -1,3 +0,0 @@
1−module M2 where
2−
3−data X = X
examples/failing/InfiniteKind.pursdeleted−5
@@ -1,5 +0,0 @@
1−-- @shouldFailWith InfiniteKind
2−
3−module Main where
4−
5−data F a = F (a a)
examples/failing/InfiniteType.pursdeleted−5
@@ -1,5 +0,0 @@
1−-- @shouldFailWith InfiniteType
2−
3−module Main where
4−
5−f a = a a
examples/failing/InstanceExport.pursdeleted−7
@@ -1,7 +0,0 @@
1−-- @shouldFailWith TransitiveExportError
2−module Test where
3−
4−import InstanceExport
5−import Prelude
6−
7−test = f $ S "Test"
examples/failing/InstanceExport/InstanceExport.pursdeleted−11
@@ -1,11 +0,0 @@
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.pursdeleted−6
@@ -1,6 +0,0 @@
1−-- @shouldFailWith IntOutOfRange
2−
3−module Main where
4−
5−n :: Int
6−n = 2147483648
examples/failing/InvalidOperatorInBinder.pursdeleted−12
@@ -1,12 +0,0 @@
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.pursdeleted−6
@@ -1,6 +0,0 @@
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.pursdeleted−8
@@ -1,8 +0,0 @@
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.pursdeleted−6
@@ -1,6 +0,0 @@
1−-- @shouldFailWith ErrorParsingModule
2−module Main where
3−
4−import Prelude
5−
6−x = 01
examples/failing/LeadingZeros2.pursdeleted−6
@@ -1,6 +0,0 @@
1−-- @shouldFailWith ErrorParsingModule
2−module Main where
3−
4−import Prelude
5−
6−x = 00.1
examples/failing/Let.pursdeleted−6
@@ -1,6 +0,0 @@
1−-- @shouldFailWith CycleInDeclaration
2−module Main where
3−
4−import Prelude
5−
6−test = let x = x in x
examples/failing/MPTCs.pursdeleted−10
@@ -1,10 +0,0 @@
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.pursdeleted−7
@@ -1,7 +0,0 @@
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.pursdeleted−7
@@ -1,7 +0,0 @@
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.pursdeleted−10
@@ -1,10 +0,0 @@
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.pursdeleted−13
@@ -1,13 +0,0 @@
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.pursdeleted−9
@@ -1,9 +0,0 @@
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.pursdeleted−9
@@ -1,9 +0,0 @@
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.pursdeleted−9
@@ -1,9 +0,0 @@
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.pursdeleted−9
@@ -1,9 +0,0 @@
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.pursdeleted−6
@@ -1,6 +0,0 @@
1−-- @shouldFailWith CycleInDeclaration
2−module Main where
3−
4−import Prelude
5−
6−x = x
examples/failing/NewtypeMultiArgs.pursdeleted−6
@@ -1,6 +0,0 @@
1−-- @shouldFailWith InvalidNewtype
2−module Main where
3−
4−import Prelude
5−
6−newtype Thing = Thing String Boolean
examples/failing/NewtypeMultiCtor.pursdeleted−6
@@ -1,6 +0,0 @@
1−-- @shouldFailWith InvalidNewtype
2−module Main where
3−
4−import Prelude
5−
6−newtype Thing = Thing String | Other
examples/failing/NullaryAbs.pursdeleted−6
@@ -1,6 +0,0 @@
1−-- @shouldFailWith ErrorParsingModule
2−module Main where
3−
4−import Prelude
5−
6−func = \ -> "no"
examples/failing/Object.pursdeleted−8
@@ -1,8 +0,0 @@
1−-- @shouldFailWith PropertyIsMissing
2−module Main where
3−
4−import Prelude
5−
6−test o = o.foo
7−
8−test1 = test {}
examples/failing/OperatorAliasNoExport.pursdeleted−7
@@ -1,7 +0,0 @@
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.pursdeleted−8
@@ -1,8 +0,0 @@
1−-- @shouldFailWith CannotApplyFunction
2−module Main where
3−
4−import Prelude
5−
6−main = do
7− (true `not` _)
8−
examples/failing/OrphanInstance.pursdeleted−7
@@ -1,7 +0,0 @@
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.pursdeleted−4
@@ -1,4 +0,0 @@
1−module Class where
2−
3−class C a where
4− op :: a -> a
examples/failing/OrphanTypeDecl.pursdeleted−4
@@ -1,4 +0,0 @@
1−-- @shouldFailWith OrphanTypeDeclaration
2−module OrphanTypeDecl where
3−
4−fn :: Number -> Boolean
examples/failing/OverlappingArguments.pursdeleted−6
@@ -1,6 +0,0 @@
1−-- @shouldFailWith OverlappingArgNames
2−module OverlappingArguments where
3−
4−import Prelude
5−
6−f x x = x
examples/failing/OverlappingBinders.pursdeleted−9
@@ -1,9 +0,0 @@
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/OverlappingReExport.pursdeleted−5
@@ -1,5 +0,0 @@
1−-- @shouldFailWith DuplicateValueExport
2−module C (module A, module M2) where
3−
4−import A
5−import B as M2
examples/failing/OverlappingReExport/A.pursdeleted−2
@@ -1,2 +0,0 @@
1−module A where
2−x = true
examples/failing/OverlappingReExport/B.pursdeleted−2
@@ -1,2 +0,0 @@
1−module B where
2−x = false
examples/failing/OverlappingVars.pursdeleted−15
@@ -1,15 +0,0 @@
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/Rank2Types.pursdeleted−8
@@ -1,8 +0,0 @@
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.pursdeleted−9
@@ -1,9 +0,0 @@
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.pursdeleted−7
@@ -1,7 +0,0 @@
1−-- @shouldFailWith ErrorParsingModule
2−module Main where
3−
4−import Prelude
5−
6−(<) :: Number -> Number -> Number
7−(<) a b = !(a >= b)
examples/failing/RowConstructors1.pursdeleted−9
@@ -1,9 +0,0 @@
1−-- @shouldFailWith KindsDoNotUnify
2−module Main where
3−
4−import Prelude
5−
6−data Foo = Bar
7−type Baz = { | Foo }
8−
9−main = Control.Monad.Eff.Console.log "Done"
examples/failing/RowConstructors2.pursdeleted−9
@@ -1,9 +0,0 @@
1−-- @shouldFailWith KindsDoNotUnify
2−module Main where
3−
4−import Prelude
5−
6−type Foo r = (x :: Number | r)
7−type Bar = { | Foo }
8−
9−main = Control.Monad.Eff.Console.log "Done"
examples/failing/RowConstructors3.pursdeleted−9
@@ -1,9 +0,0 @@
1−-- @shouldFailWith KindsDoNotUnify
2−module Main where
3−
4−import Prelude
5−
6−type Foo = { x :: Number }
7−type Bar = { | Foo }
8−
9−main = Control.Monad.Eff.Console.log "Done"
examples/failing/SkolemEscape.pursdeleted−8
@@ -1,8 +0,0 @@
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.pursdeleted−10
@@ -1,10 +0,0 @@
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.pursdeleted−7
@@ -1,7 +0,0 @@
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.pursdeleted−14
@@ -1,14 +0,0 @@
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.pursdeleted−13
@@ -1,13 +0,0 @@
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.pursdeleted−8
@@ -1,8 +0,0 @@
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.pursdeleted−26
@@ -1,26 +0,0 @@
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.pursdeleted−8
@@ -1,8 +0,0 @@
1−-- @shouldFailWith DuplicateValueDeclaration
2−module Main where
3−
4−import Prelude
5−
6−foo :: Number
7−foo = 1
8−foo = 2
examples/failing/TransitiveDctorExport.pursdeleted−5
@@ -1,5 +0,0 @@
1−-- @shouldFailWith TransitiveExportError
2−module Main (Y(..)) where
3−
4−type X = Int
5−data Y = Y X
examples/failing/TransitiveSynonymExport.pursdeleted−5
@@ -1,5 +0,0 @@
1−-- @shouldFailWith TransitiveExportError
2−module Main (Y()) where
3−
4−type X = Int
5−type Y = X
examples/failing/TypeClassInstances.pursdeleted−11
@@ -1,11 +0,0 @@
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.pursdeleted−9
@@ -1,9 +0,0 @@
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.pursdeleted−6
@@ -1,6 +0,0 @@
1−-- @shouldFailWith TypesDoNotUnify
2−module Main where
3−
4−import Prelude
5−
6−test = 1 <> "A"
examples/failing/TypeOperatorAliasNoExport.pursdeleted−6
@@ -1,6 +0,0 @@
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.pursdeleted−8
@@ -1,8 +0,0 @@
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.pursdeleted−12
@@ -1,12 +0,0 @@
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.pursdeleted−12
@@ -1,12 +0,0 @@
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.pursdeleted−11
@@ -1,11 +0,0 @@
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.pursdeleted−6
@@ -1,6 +0,0 @@
1−-- @shouldFailWith CycleInTypeSynonym
2−module Main where
3−
4−import Prelude
5−
6−type T = T
examples/failing/TypeWildcards1.pursdeleted−7
@@ -1,7 +0,0 @@
1−-- @shouldFailWith ErrorParsingModule
2−module TypeWildcards where
3−
4−import Prelude
5−
6−type Test = _
7−
examples/failing/TypeWildcards2.pursdeleted−7
@@ -1,7 +0,0 @@
1−-- @shouldFailWith ErrorParsingModule
2−module TypeWildcards where
3−
4−import Prelude
5−
6−data Test = Test _
7−
examples/failing/TypeWildcards3.pursdeleted−10
@@ -1,10 +0,0 @@
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.pursdeleted−10
@@ -1,10 +0,0 @@
1−-- @shouldFailWith ErrorParsingModule
2−module Main where
3−
4−import Prelude
5−
6−test = (\f :: Int -> Int -> f 10) id
7−
8−main = do
9− let t1 = test
10− Control.Monad.Eff.Console.log "Done"
examples/failing/TypedBinders2.pursdeleted−9
@@ -1,9 +0,0 @@
1−-- @shouldFailWith TypesDoNotUnify
2−module Main where
3−
4−import Prelude
5−
6−main = do
7− s :: String <- Control.Monad.Eff.Console.log "Foo"
8− Control.Monad.Eff.Console.log "Done"
9−
examples/failing/TypedBinders3.pursdeleted−12
@@ -1,12 +0,0 @@
1−-- @shouldFailWith TypesDoNotUnify
2−module Main where
3−
4−import Prelude
5−
6−test = case 1 of
7− (0 :: String) -> true
8− _ -> false
9−
10−main = do
11− let t = test
12− Control.Monad.Eff.Console.log "Done"
examples/failing/TypedHole.pursdeleted−9
@@ -1,9 +0,0 @@
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.pursdeleted−6
@@ -1,6 +0,0 @@
1−-- @shouldFailWith ErrorParsingModule
2−module Bad_Module where
3−
4−import Prelude
5−
6−main = Control.Monad.Eff.Console.log "Done"
examples/failing/UnifyInTypeInstanceLookup.pursdeleted−22
@@ -1,22 +0,0 @@
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.pursdeleted−7
@@ -1,7 +0,0 @@
1−-- @shouldFailWith UnknownName
2−module Main where
3−
4−import Prelude
5−
6−test :: Number -> Something
7−test = {}
examples/passing/1185.pursdeleted−13
@@ -1,13 +0,0 @@
1−module Main where
2−
3−data Person = Person String Boolean
4−
5−getName :: Person -> String
6−getName p = case p of
7− Person name true -> name
8− _ -> "Unknown"
9−
10−name :: String
11−name = getName (Person "John Smith" true)
12−
13−main = Control.Monad.Eff.Console.log "Done"
examples/passing/1335.pursdeleted−14
@@ -1,14 +0,0 @@
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.pursdeleted−6
@@ -1,6 +0,0 @@
1−module Main where
2−
3−test :: forall a. a -> a
4−test = \(x :: a) -> x
5−
6−main = Control.Monad.Eff.Console.log "Done"
examples/passing/1664.pursdeleted−16
@@ -1,16 +0,0 @@
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.pursdeleted−24
@@ -1,24 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−_2 :: forall a. a -> a
6−_2 a = a
7−
8−x :: forall m. (Monad m) => m Unit
9−x = do
10− _ <- pure unit
11− pure unit
12−
13−y :: forall m. (Monad m) => m Unit
14−y = do
15− _ <- pure unit
16− pure unit
17−
18−wtf :: forall m. (Monad m) => m Unit
19−wtf = do
20− _ <- pure unit
21− let tmp = _2 1
22− pure unit
23−
24−main = Control.Monad.Eff.Console.log "Done"
examples/passing/1881.pursdeleted−17
@@ -1,17 +0,0 @@
1−module Main where
2−
3−foo =
4− 1
5−
6−bar
7− = 2
8−
9−baz
10− =
11− 3
12−
13−qux
14− =
15− 3
16−
17−main = Control.Monad.Eff.Console.log "Done"
examples/passing/1991.pursdeleted−21
@@ -1,21 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−singleton :: forall a. a -> Array a
6−singleton x = [x]
7−
8−empty :: forall a. Array a
9−empty = []
10−
11−foldMap :: forall a m. (Semigroup m) => (a -> m) -> Array a -> m
12−foldMap f [a, b, c, d, e] = f a <> f b <> f c <> f d <> f e
13−foldMap f xs = foldMap f xs -- spin, not used
14−
15−regression :: Array Int
16−regression =
17− let as = [1,2,3,4,5]
18− as' = foldMap (\x -> if 1 < x && x < 4 then singleton x else empty) as
19− in as'
20−
21−main = Control.Monad.Eff.Console.log "Done"
examples/passing/2018.pursdeleted−12
@@ -1,12 +0,0 @@
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.pursdeleted−7
@@ -1,7 +0,0 @@
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.pursdeleted−3
@@ -1,3 +0,0 @@
1−module B where
2−
3−data Foo = X | Y
examples/passing/2049.pursdeleted−14
@@ -1,14 +0,0 @@
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/652.pursdeleted−17
@@ -1,17 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−class Foo a b
6−
7−class Bar a c
8−
9−class (Foo a b, Bar a c) <= Baz a b c
10−
11−instance foo :: Foo (a -> b) a
12−
13−instance bar :: Bar (a -> b) b
14−
15−instance baz :: (Eq a) => Baz (a -> b) a b
16−
17−main = Control.Monad.Eff.Console.log "Done"
examples/passing/810.pursdeleted−13
@@ -1,13 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−data Maybe a = Nothing | Just a
6−
7−test :: forall a. Maybe a -> Maybe a
8−test m = o.x
9− where
10− o = case m of Nothing -> { x : Nothing }
11− Just a -> { x : Just a }
12−
13−main = Control.Monad.Eff.Console.log "Done"
examples/passing/862.pursdeleted−8
@@ -1,8 +0,0 @@
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.pursdeleted−20
@@ -1,20 +0,0 @@
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.pursdeleted−16
@@ -1,16 +0,0 @@
1−module Main where
2−
3−import Prelude ()
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 = Control.Monad.Eff.Console.log "Done"
examples/passing/ArrayType.pursdeleted−11
@@ -1,11 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−class Pointed p where
6− point :: forall a. a -> p a
7−
8−instance pointedArray :: Pointed Array where
9− point a = [a]
10−
11−main = Control.Monad.Eff.Console.log "Done"
examples/passing/Auto.pursdeleted−15
@@ -1,15 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−data Auto s i o = Auto { state :: s, step :: s -> i -> o }
6−
7−type SomeAuto i o = forall r. (forall s. Auto s i o -> r) -> r
8−
9−exists :: forall s i o. s -> (s -> i -> o) -> SomeAuto i o
10−exists = \state step f -> f (Auto { state: state, step: step })
11−
12−run :: forall i o. SomeAuto i o -> i -> o
13−run = \s i -> s (\a -> case a of Auto a -> a.step a.state i)
14−
15−main = Control.Monad.Eff.Console.log "Done"
examples/passing/AutoPrelude.pursdeleted−11
@@ -1,11 +0,0 @@
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.pursdeleted−10
@@ -1,10 +0,0 @@
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.pursdeleted−15
@@ -1,15 +0,0 @@
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−
8−snd :: forall a. Partial => Array a -> a
9−snd = \[_, y] -> y
10−
11−main :: Eff _ _
12−main = do
13− let ts = unsafePartial (snd [1.0, 2.0])
14− assert' "Incorrect result from 'snd'." (ts == 2.0)
15− Control.Monad.Eff.Console.log "Done"
examples/passing/BindingGroups.pursdeleted−10
@@ -1,10 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−foo = bar
6− where bar r = r + 1.0
7−
8−r = foo 2.0
9−
10−main = Control.Monad.Eff.Console.log "Done"
examples/passing/BlockString.pursdeleted−8
@@ -1,8 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−foo :: String
6−foo = """foo"""
7−
8−main = Control.Monad.Eff.Console.log "Done"
examples/passing/CaseInDo.pursdeleted−21
@@ -1,21 +0,0 @@
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.pursdeleted−18
@@ -1,18 +0,0 @@
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.pursdeleted−21
@@ -1,21 +0,0 @@
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.pursdeleted−21
@@ -1,21 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−data A = A | B | C
6−
7−f a _ A = a
8−f _ a B = a
9−f _ _ C = "Done"
10−
11−g a _ A = a
12−g _ b B = b
13−g _ _ C = C
14−
15−data M a = N | J a
16−
17−h f N a = a
18−h f a N = a
19−h f (J a) (J b) = J (f a b)
20−
21−main = Control.Monad.Eff.Console.log $ f "Done" "Failed" A
examples/passing/CheckFunction.pursdeleted−7
@@ -1,7 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−test = ((\x -> x+1.0) >>> (\x -> x*2.0)) 4.0
6−
7−main = Control.Monad.Eff.Console.log "Done"
examples/passing/CheckSynonymBug.pursdeleted−12
@@ -1,12 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−length :: forall a. Array a -> Int
6−length _ = 0
7−
8−type Foo a = Array a
9−
10−foo _ = length ([] :: Foo Number)
11−
12−main = Control.Monad.Eff.Console.log "Done"
examples/passing/CheckTypeClass.pursdeleted−18
@@ -1,18 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−data Bar a = Bar
6−data Baz
7−
8−class Foo a where
9− foo :: Bar a -> Baz
10−
11−foo_ :: forall a. (Foo a) => a -> Baz
12−foo_ x = foo ((mkBar :: forall a. (Foo a) => a -> Bar a) x)
13−
14−mkBar :: forall a. a -> Bar a
15−mkBar _ = Bar
16−
17−main = Control.Monad.Eff.Console.log "Done"
18−
examples/passing/Church.pursdeleted−18
@@ -1,18 +0,0 @@
1−module Main where
2−
3−import Prelude ()
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 = Control.Monad.Eff.Console.log "Done"
examples/passing/ClassRefSyntax.pursdeleted−8
@@ -1,8 +0,0 @@
1−module Main where
2−
3− import Lib (class X, go)
4−
5− go' :: forall a. (X a) => a -> a
6− go' = go
7−
8− main = Control.Monad.Eff.Console.log "Done"
examples/passing/ClassRefSyntax/Lib.pursdeleted−4
@@ -1,4 +0,0 @@
1−module Lib (class X, go) where
2−
3−class X a where
4− go :: a -> a
examples/passing/Collatz.pursdeleted−21
@@ -1,21 +0,0 @@
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.pursdeleted−15
@@ -1,15 +0,0 @@
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.pursdeleted−9
@@ -1,9 +0,0 @@
1−module Main where
2−
3−import Prelude ()
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 = Control.Monad.Eff.Console.log "Done"
examples/passing/Console.pursdeleted−15
@@ -1,15 +0,0 @@
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.pursdeleted−10
@@ -1,10 +0,0 @@
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.pursdeleted−15
@@ -1,15 +0,0 @@
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.pursdeleted−9
@@ -1,9 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−data A = A B
6−
7−type B = A
8−
9−main = Control.Monad.Eff.Console.log "Done"
examples/passing/DctorOperatorAlias.pursdeleted−34
@@ -1,34 +0,0 @@
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.pursdeleted−5
@@ -1,5 +0,0 @@
1−module List where
2−
3−data List a = Cons a (List a) | Nil
4−
5−infixr 6 Cons as :
examples/passing/DeepArrayBinder.pursdeleted−16
@@ -1,16 +0,0 @@
1−module Main where
2−
3−import Prelude
4−import Control.Monad.Eff
5−import Test.Assert
6−
7−data List a = Cons a (List a) | Nil
8−
9−match2 :: List Number -> Number
10−match2 (Cons x (Cons y xs)) = x * y + match2 xs
11−match2 _ = 0.0
12−
13−main = do
14− 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)))))))))
15− assert' "Incorrect result!" (result == 100.0)
16− Control.Monad.Eff.Console.log "Done"
examples/passing/DeepCase.pursdeleted−15
@@ -1,15 +0,0 @@
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.pursdeleted−34
@@ -1,34 +0,0 @@
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.pursdeleted−67
@@ -1,67 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−data Maybe a = Nothing | Just a
6−
7−instance functorMaybe :: Functor Maybe where
8− map f Nothing = Nothing
9− map f (Just x) = Just (f x)
10−
11−instance applyMaybe :: Apply Maybe where
12− apply (Just f) (Just x) = Just (f x)
13− apply _ _ = Nothing
14−
15−instance applicativeMaybe :: Applicative Maybe where
16− pure = Just
17−
18−instance bindMaybe :: Bind Maybe where
19− bind Nothing _ = Nothing
20− bind (Just a) f = f a
21−
22−instance monadMaybe :: Prelude.Monad Maybe
23−
24−test1 = \_ -> do
25− Just "abc"
26−
27−test2 = \_ -> do
28− x <- Just 1.0
29− y <- Just 2.0
30− Just (x + y)
31−
32−test3 = \_ -> do
33− Just 1.0
34− Nothing :: Maybe Number
35− Just 2.0
36−
37−test4 mx my = do
38− x <- mx
39− y <- my
40− Just (x + y + 1.0)
41−
42−test5 mx my mz = do
43− x <- mx
44− y <- my
45− let sum = x + y
46− z <- mz
47− Just (z + sum + 1.0)
48−
49−test6 mx = \_ -> do
50− let
51− f :: forall a. Maybe a -> a
52− f (Just x) = x
53− Just (f mx)
54−
55−test8 = \_ -> do
56− Just (do
57− Just 1.0)
58−
59−test9 = \_ -> (+) <$> Just 1.0 <*> Just 2.0
60−
61−test10 _ = do
62− let
63− f x = g x * 3.0
64− g x = f x / 2.0
65− Just (f 10.0)
66−
67−main = Control.Monad.Eff.Console.log "Done"
examples/passing/Dollar.pursdeleted−16
@@ -1,16 +0,0 @@
1−module Main where
2−
3−import Prelude ()
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 = Control.Monad.Eff.Console.log "Done"
examples/passing/Eff.pursdeleted−26
@@ -1,26 +0,0 @@
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.pursdeleted−19
@@ -1,19 +0,0 @@
1−module Main where
2−
3−import Prelude
4−import Test.Assert
5−
6−data Z
7−data S n
8−
9−data ArrayBox n a = ArrayBox (Array a)
10−
11−nil :: forall a. ArrayBox Z a
12−nil = ArrayBox []
13−
14−cons' :: forall a n. a -> ArrayBox n a -> ArrayBox (S n) a
15−cons' x (ArrayBox xs) = ArrayBox $ append [x] xs
16−
17−main = case cons' 1 $ cons' 2 $ cons' 3 nil of
18− ArrayBox [1, 2, 3] -> Control.Monad.Eff.Console.log "Done"
19− _ -> assert' "Failed" false
examples/passing/EmptyRow.pursdeleted−10
@@ -1,10 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−data Foo r = Foo { | r }
6−
7−test :: Foo ()
8−test = Foo {}
9−
10−main = Control.Monad.Eff.Console.log "Done"
examples/passing/EmptyTypeClass.pursdeleted−11
@@ -1,11 +0,0 @@
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.pursdeleted−18
@@ -1,18 +0,0 @@
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.pursdeleted−11
@@ -1,11 +0,0 @@
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.pursdeleted−3
@@ -1,3 +0,0 @@
1−module Bar (module Foo) where
2−
3−import Foo
examples/passing/ExplicitImportReExport/Foo.pursdeleted−4
@@ -1,4 +0,0 @@
1−module Foo where
2−
3−foo :: Int
4−foo = 3
examples/passing/ExplicitOperatorSections.pursdeleted−14
@@ -1,14 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−subtractOne :: Int -> Int
6−subtractOne = (_ - 1)
7−
8−addOne :: Int -> Int
9−addOne = (1 + _)
10−
11−named :: Int -> Int
12−named = (_ `sub` 1)
13−
14−main = Control.Monad.Eff.Console.log "Done"
examples/passing/ExportExplicit.pursdeleted−9
@@ -1,9 +0,0 @@
1−module Main where
2−
3−import M1
4−
5−testX = X
6−testZ = Z
7−testFoo = foo
8−
9−main = Control.Monad.Eff.Console.log "Done"
examples/passing/ExportExplicit/M1.pursdeleted−10
@@ -1,10 +0,0 @@
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.pursdeleted−7
@@ -1,7 +0,0 @@
1−module Main where
2−
3−import M1
4−
5−testBar = bar
6−
7−main = Control.Monad.Eff.Console.log "Done"
examples/passing/ExportExplicit2/M1.pursdeleted−7
@@ -1,7 +0,0 @@
1−module M1 (bar) where
2−
3−foo :: Int
4−foo = 0
5−
6−bar :: Int
7−bar = foo
examples/passing/ExportedInstanceDeclarations.pursdeleted−45
@@ -1,45 +0,0 @@
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.pursdeleted−17
@@ -1,17 +0,0 @@
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.pursdeleted−18
@@ -1,18 +0,0 @@
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.pursdeleted−13
@@ -1,13 +0,0 @@
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.pursdeleted−10
@@ -1,10 +0,0 @@
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.pursdeleted−25
@@ -1,25 +0,0 @@
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.pursdeleted−12
@@ -1,12 +0,0 @@
1−module Main where
2−
3−import Prelude
4−import Test.Assert
5−
6−mkValue :: Number -> Number
7−mkValue id = id
8−
9−main = do
10− let value = mkValue 1.0
11− assert $ value == 1.0
12− Control.Monad.Eff.Console.log "Done"
examples/passing/Functions.pursdeleted−12
@@ -1,12 +0,0 @@
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.pursdeleted−12
@@ -1,12 +0,0 @@
1−module Main where
2−
3−import Prelude
4−import Test.Assert
5−
6−test :: forall a b. a -> b -> a
7−test = \const _ -> const
8−
9−main = do
10− let value = test "Done" {}
11− assert' "Not done" $ value == "Done"
12− Control.Monad.Eff.Console.log "Done"
examples/passing/Generalization1.pursdeleted−11
@@ -1,11 +0,0 @@
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.pursdeleted−29
@@ -1,29 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−collatz = \x -> case x of
6− y | y `mod` 2.0 == 0.0 -> y / 2.0
7− y -> y * 3.0 + 1.0
8−
9−-- Guards have access to current scope
10−collatz2 = \x y -> case x of
11− z | y > 0.0 -> z / 2.0
12− z -> z * 3.0 + 1.0
13−
14−min :: forall a. (Ord a) => a -> a -> a
15−min n m | n < m = n
16− | otherwise = m
17−
18−max :: forall a. (Ord a) => a -> a -> a
19−max n m = case unit of
20− _ | m < n -> n
21− | otherwise -> m
22−
23−testIndentation :: Number -> Number -> Number
24−testIndentation x y | x > 0.0
25− = x + y
26− | otherwise
27− = y - x
28−
29−main = Control.Monad.Eff.Console.log $ min "Done" "ZZZZ"
examples/passing/HoistError.pursdeleted−12
@@ -1,12 +0,0 @@
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.pursdeleted−11
@@ -1,11 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−data Maybe a = Nothing | Just a
6−
7−test1 = if true then Just 10 else Nothing
8−
9−test2 = if true then Nothing else Just 10
10−
11−main = Control.Monad.Eff.Console.log "Done"
examples/passing/IfWildcard.pursdeleted−19
@@ -1,19 +0,0 @@
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.pursdeleted−8
@@ -1,8 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−main = do
6− Control.Monad.Eff.Console.log "Hello"
7− Control.Monad.Eff.Console.log "Goodbye"
8− Control.Monad.Eff.Console.log "Done"
examples/passing/Import.pursdeleted−5
@@ -1,5 +0,0 @@
1−module Main where
2−
3−import M2
4−
5−main = Control.Monad.Eff.Console.log "Done"
examples/passing/Import/M1.pursdeleted−8
@@ -1,8 +0,0 @@
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.pursdeleted−6
@@ -1,6 +0,0 @@
1−module M2 where
2−
3−import Prelude ()
4−import M1
5−
6−main = \_ -> foo 42
examples/passing/ImportExplicit.pursdeleted−9
@@ -1,9 +0,0 @@
1−module Main where
2−
3−import M1 (X(..))
4−
5−testX :: X
6−testX = X
7−testY = Y
8−
9−main = Control.Monad.Eff.Console.log "Done"
examples/passing/ImportExplicit/M1.pursdeleted−4
@@ -1,4 +0,0 @@
1−module M1 where
2−
3−data X = X | Y
4−data Z = Z
examples/passing/ImportHiding.pursdeleted−19
@@ -1,19 +0,0 @@
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.pursdeleted−8
@@ -1,8 +0,0 @@
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.pursdeleted−3
@@ -1,3 +0,0 @@
1−module M1 where
2−
3−log x = x
examples/passing/InferRecFunWithConstrainedArgument.pursdeleted−11
@@ -1,11 +0,0 @@
1−module Main where
2−
3−import Prelude
4−import Control.Monad.Eff.Console (log, logShow)
5−
6−test 100.0 = 100.0
7−test n = test(1.0 + n)
8−
9−main = do
10− logShow (test 0)
11− log "Done"
examples/passing/InstanceBeforeClass.pursdeleted−11
@@ -1,11 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−instance fooNumber :: Foo Number where
6− foo = 0.0
7−
8−class Foo a where
9− foo :: a
10−
11−main = Control.Monad.Eff.Console.log "Done"
examples/passing/IntAndChar.pursdeleted−18
@@ -1,18 +0,0 @@
1−module Main where
2−
3−import Prelude
4−import Control.Monad.Eff
5−import Test.Assert
6−
7−f 1 = 1
8−f _ = 0
9−
10−g 'a' = 'a'
11−g _ = 'b'
12−
13−main = do
14− assert $ f 1 == 1
15− assert $ f 0 == 0
16− assert $ g 'a' == 'a'
17− assert $ g 'b' == 'b'
18− Control.Monad.Eff.Console.log "Done"
examples/passing/JSReserved.pursdeleted−12
@@ -1,12 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−yield = 0
6−member = 1
7−
8−public = \return -> return
9−
10−this catch = catch
11−
12−main = Control.Monad.Eff.Console.log "Done"
examples/passing/KindedType.pursdeleted−33
@@ -1,33 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−type Star2Star f = f :: * -> *
6−
7−type Star t = t :: *
8−
9−test1 :: Star2Star Array String
10−test1 = ["test"]
11−
12−f :: Star (String -> String)
13−f s = s
14−
15−test2 = f "test"
16−
17−data Proxy (f :: * -> *) = Proxy
18−
19−test3 :: Proxy Array
20−test3 = Proxy
21−
22−type Test (f :: * -> *) = f String
23−
24−test4 :: Test Array
25−test4 = ["test"]
26−
27−class Clazz (a :: *) where
28− def :: a
29−
30−instance clazzString :: Clazz String where
31− def = "test"
32−
33−main = Control.Monad.Eff.Console.log "Done"
examples/passing/LargeSumType.pursdeleted−33
@@ -1,33 +0,0 @@
1−module Main where
2−
3−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
4−
5−explode A A = "A"
6−explode B B = "B"
7−explode C C = "C"
8−explode D D = "D"
9−explode E E = "E"
10−explode F F = "F"
11−explode G G = "G"
12−explode H H = "H"
13−explode I I = "I"
14−explode J J = "J"
15−explode K K = "K"
16−explode L L = "L"
17−explode M M = "M"
18−explode N N = "N"
19−explode O O = "O"
20−explode P P = "P"
21−explode Q Q = "Q"
22−explode R R = "R"
23−explode S S = "S"
24−explode T T = "T"
25−explode U U = "U"
26−explode V V = "V"
27−explode W W = "W"
28−explode X X = "X"
29−explode Y Y = "Y"
30−explode Z Z = "Z"
31−explode _ _ = ""
32−
33−main = Control.Monad.Eff.Console.log "Done"
examples/passing/Let.pursdeleted−58
@@ -1,58 +0,0 @@
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.pursdeleted−20
@@ -1,20 +0,0 @@
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.pursdeleted−14
@@ -1,14 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−class Foo a where
6− foo :: a -> String
7−
8−instance fooString :: Foo String where
9− foo = go
10− where
11− go :: String -> String
12− go s = s
13−
14−main = Control.Monad.Eff.Console.log "Done"
examples/passing/LiberalTypeSynonyms.pursdeleted−21
@@ -1,21 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−type Reader = (->) String
6−
7−foo :: Reader String
8−foo s = s
9−
10−type AndFoo r = (foo :: String | r)
11−
12−getFoo :: forall r. Prim.Record (AndFoo r) -> String
13−getFoo o = o.foo
14−
15−type F r = { | r } -> { | r }
16−
17−f :: (forall r. F r) -> String
18−f g = case g { x: "Hello" } of
19− { x = x } -> x
20−
21−main = Control.Monad.Eff.Console.log "Done"
examples/passing/MPTCs.pursdeleted−20
@@ -1,20 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−class NullaryTypeClass where
6− greeting :: String
7−
8−instance nullaryTypeClass :: NullaryTypeClass where
9− greeting = "Hello, World!"
10−
11−class Coerce a b where
12− coerce :: a -> b
13−
14−instance coerceRefl :: Coerce a a where
15− coerce a = a
16−
17−instance coerceShow :: (Prelude.Show a) => Coerce a String where
18− coerce = show
19−
20−main = Control.Monad.Eff.Console.log "Done"
examples/passing/Match.pursdeleted−9
@@ -1,9 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−data Foo a = Foo
6−
7−foo = \f -> case f of Foo -> "foo"
8−
9−main = Control.Monad.Eff.Console.log "Done"
examples/passing/Module.pursdeleted−6
@@ -1,6 +0,0 @@
1−module Main where
2−
3−import M1
4−import M2
5−
6−main = Control.Monad.Eff.Console.log "Done"
examples/passing/Module/M1.pursdeleted−14
@@ -1,14 +0,0 @@
1−module M1 where
2−
3−import Prelude
4−
5−data Foo = Foo String
6−
7−foo :: M1.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.pursdeleted−9
@@ -1,9 +0,0 @@
1−module M2 where
2−
3−import Prelude
4−
5−baz :: M1.Foo -> String
6−baz = M1.foo
7−
8−match :: M1.Foo -> String
9−match = \f -> case f of M1.Foo s -> s <> "foo"
examples/passing/ModuleDeps.pursdeleted−5
@@ -1,5 +0,0 @@
1−module Main where
2−
3−import M1
4−
5−main = Control.Monad.Eff.Console.log "Done"
examples/passing/ModuleDeps/M1.pursdeleted−5
@@ -1,5 +0,0 @@
1−module M1 where
2−
3−import M2
4−
5−foo = M2.bar
examples/passing/ModuleDeps/M2.pursdeleted−5
@@ -1,5 +0,0 @@
1−module M2 where
2−
3−import M3
4−
5−bar = M3.baz
examples/passing/ModuleDeps/M3.pursdeleted−3
@@ -1,3 +0,0 @@
1−module M3 where
2−
3−baz = 1
examples/passing/ModuleExport.pursdeleted−8
@@ -1,8 +0,0 @@
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.pursdeleted−3
@@ -1,3 +0,0 @@
1−module A (module Prelude) where
2−
3−import Prelude
examples/passing/ModuleExportDupes.pursdeleted−11
@@ -1,11 +0,0 @@
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.pursdeleted−3
@@ -1,3 +0,0 @@
1−module A (module Prelude) where
2−
3−import Prelude
examples/passing/ModuleExportDupes/B.pursdeleted−3
@@ -1,3 +0,0 @@
1−module B (module Prelude) where
2−
3−import Prelude
examples/passing/ModuleExportDupes/C.pursdeleted−4
@@ -1,4 +0,0 @@
1−module C (module Prelude, module A) where
2−
3−import Prelude
4−import A
examples/passing/ModuleExportExcluded.pursdeleted−11
@@ -1,11 +0,0 @@
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.pursdeleted−6
@@ -1,6 +0,0 @@
1−module A (module Prelude, foo) where
2−
3−import Prelude
4−
5−foo :: Number -> Number
6−foo _ = 0.0
examples/passing/ModuleExportQualified.pursdeleted−9
@@ -1,9 +0,0 @@
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.pursdeleted−3
@@ -1,3 +0,0 @@
1−module A (module Prelude) where
2−
3−import Prelude
examples/passing/ModuleExportSelf.pursdeleted−11
@@ -1,11 +0,0 @@
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.pursdeleted−5
@@ -1,5 +0,0 @@
1−module A (module A, module Prelude) where
2−
3−import Prelude
4−
5−type Foo = Boolean
examples/passing/Monad.pursdeleted−32
@@ -1,32 +0,0 @@
1−module Main where
2−
3−import Prelude ()
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 = Control.Monad.Eff.Console.log "Done"
examples/passing/MonadState.pursdeleted−63
@@ -1,63 +0,0 @@
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.pursdeleted−27
@@ -1,27 +0,0 @@
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.pursdeleted−19
@@ -1,19 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−f 0.0 = 0.0
6−f x = g x + 0.0
7−
8−g x = f (x / 0.0)
9−
10−data Even = Zero | Even Odd
11−
12−data Odd = Odd Even
13−
14−evenToNumber Zero = 0.0
15−evenToNumber (Even n) = oddToNumber n + 0.0
16−
17−oddToNumber (Odd n) = evenToNumber n + 0.0
18−
19−main = Control.Monad.Eff.Console.log "Done"
examples/passing/MutRec2.pursdeleted−19
@@ -1,19 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−data A = A B
6−
7−data B = B A
8−
9−foreign import data S :: *
10−
11−f :: A -> S
12−f a = case a of A b -> g b
13−
14−g b = case b of B a -> f a
15−
16−showN :: A -> S
17−showN a = f a
18−
19−main = Control.Monad.Eff.Console.log "Done"
examples/passing/MutRec3.pursdeleted−19
@@ -1,19 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−data A = A B
6−
7−data B = B A
8−
9−foreign import data S :: *
10−
11−f a = case a of A b -> g b
12−
13−g :: B -> S
14−g b = case b of B a -> f a
15−
16−showN :: A -> S
17−showN a = f a
18−
19−main = Control.Monad.Eff.Console.log "Done"
examples/passing/NakedConstraint.pursdeleted−10
@@ -1,10 +0,0 @@
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.pursdeleted−9
@@ -1,9 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−foo = \x -> case x of
6− y@{ foo = "Foo" } -> y
7− y -> y
8−
9−main = Control.Monad.Eff.Console.log "Done"
examples/passing/NegativeBinder.pursdeleted−9
@@ -1,9 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−test :: Number -> Boolean
6−test -1.0 = false
7−test _ = true
8−
9−main = Control.Monad.Eff.Console.log "Done"
examples/passing/NegativeIntInRange.pursdeleted−8
@@ -1,8 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−n :: Int
6−n = -2147483648
7−
8−main = Control.Monad.Eff.Console.log "Done"
examples/passing/Nested.pursdeleted−9
@@ -1,9 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−data Extend r a = Extend { prev :: r a, next :: a }
6−
7−data Matrix r a = Square (r (r a)) | Bigger (Matrix (Extend r) a)
8−
9−main = Control.Monad.Eff.Console.log "Done"
examples/passing/NestedTypeSynonyms.pursdeleted−12
@@ -1,12 +0,0 @@
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.pursdeleted−12
@@ -1,12 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−f x = g x
6− where
7− g x = go x
8− where
9− go x = go1 (x - 1.0)
10− go1 x = go x
11−
12−main = Control.Monad.Eff.Console.log "Done"
examples/passing/Newtype.pursdeleted−23
@@ -1,23 +0,0 @@
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.pursdeleted−29
@@ -1,29 +0,0 @@
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.pursdeleted−16
@@ -1,16 +0,0 @@
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.pursdeleted−9
@@ -1,9 +0,0 @@
1−-- No failure here as the export `thing` only refers to Main.thing
2−module Main (thing, main) where
3−
4− import A
5−
6− thing :: Int
7− thing = 2
8−
9− main = Control.Monad.Eff.Console.log "Done"
examples/passing/NonConflictingExports/A.pursdeleted−4
@@ -1,4 +0,0 @@
1−module A where
2−
3−thing :: Int
4−thing = 1
examples/passing/NumberLiterals.pursdeleted−39
@@ -1,39 +0,0 @@
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.pursdeleted−14
@@ -1,14 +0,0 @@
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.pursdeleted−15
@@ -1,15 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−type Inner = Number
6−
7−inner :: Inner
8−inner = 0.0
9−
10−type Outer = { inner :: Inner }
11−
12−outer :: Outer
13−outer = { inner: inner }
14−
15−main = Control.Monad.Eff.Console.log "Done"
examples/passing/ObjectUpdate.pursdeleted−23
@@ -1,23 +0,0 @@
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.pursdeleted−17
@@ -1,17 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−type X r = { | r }
6−
7−x :: X (baz :: String)
8−x = { baz: "baz" }
9−
10−blah :: forall r. X r -> X r
11−blah x = x
12−
13−test = blah x
14− { baz = "blah"
15− }
16−
17−main = Control.Monad.Eff.Console.log "Done"
examples/passing/ObjectUpdater.pursdeleted−26
@@ -1,26 +0,0 @@
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.pursdeleted−20
@@ -1,20 +0,0 @@
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.pursdeleted−35
@@ -1,35 +0,0 @@
1−module Main where
2−
3−import Prelude hiding (append)
4−
5−test = \x -> x.foo + x.bar + 1.0
6−
7−append = \o -> { foo: o.foo, bar: 1.0 }
8−
9−apTest = append({foo : "Foo", baz: "Baz"})
10−
11−f = (\a -> a.b.c) { b: { c: 1.0, d: "Hello" }, e: "World" }
12−
13−g = (\a -> a.f { x: 1.0, y: "y" }) { f: \o -> o.x + 1.0 }
14−
15−typed :: { foo :: Number }
16−typed = { foo: 0.0 }
17−
18−test2 = \x -> x."!@#"
19−
20−test3 = typed."foo"
21−
22−test4 = test2 weirdObj
23− where
24− weirdObj :: { "!@#" :: Number }
25− weirdObj = { "!@#": 1.0 }
26−
27−test5 = case { "***": 1.0 } of
28− { "***" = n } -> n
29−
30−test6 = case { "***": 1.0 } of
31− { "***": n } -> n
32−
33−test7 {a: snoog , b : blah } = blah
34−
35−main = Control.Monad.Eff.Console.log "Done"
examples/passing/OneConstructor.pursdeleted−9
@@ -1,9 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−data One a = One a
6−
7−one' (One a) = a
8−
9−main = Control.Monad.Eff.Console.log "Done"
examples/passing/OperatorAlias.pursdeleted−11
@@ -1,11 +0,0 @@
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.pursdeleted−9
@@ -1,9 +0,0 @@
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.pursdeleted−4
@@ -1,4 +0,0 @@
1−module Def where
2−
3−what :: forall a b. a -> b -> a
4−what a _ = a
examples/passing/OperatorAssociativity.pursdeleted−25
@@ -1,25 +0,0 @@
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.pursdeleted−48
@@ -1,48 +0,0 @@
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.pursdeleted−18
@@ -1,18 +0,0 @@
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.pursdeleted−95
@@ -1,95 +0,0 @@
1−module Main where
2−
3−import Prelude
4−import Control.Monad.Eff
5−import Control.Monad.Eff.Console
6−
7−op1 :: forall a. a -> a -> a
8−op1 x _ = x
9−
10−infix 4 op1 as ?!
11−
12−bar :: String -> String -> String
13−bar = \s1 s2 -> s1 <> s2
14−
15−test1 :: forall n. (Semiring n) => n -> n -> (n -> n -> n) -> n
16−test1 x y z = x * y + z x y
17−
18−test2 = (\x -> x.foo false) { foo : \_ -> 1.0 }
19−
20−test3 = (\x y -> x)(1.0 + 2.0 * (1.0 + 2.0)) (true && (false || false))
21−
22−k = \x -> \y -> x
23−
24−test4 = 1 `k` 2
25−
26−op2 :: Number -> Number -> Number
27−op2 x y = x * y + y
28−
29−infixl 5 op2 as %%
30−
31−test5 = 1.0 %% 2.0 %% 3.0
32−
33−test6 = ((\x -> x) `k` 2.0) 3.0
34−
35−op3 :: String -> String -> String
36−op3 = \s1 s2 -> s1 <> s2
37−
38−infix 4 op3 as <+>
39−
40−test7 = "Hello" <+> "World!"
41−
42−op4 :: forall a b. (a -> b) -> a -> b
43−op4 = \f x -> f x
44−
45−infix 4 op4 as @@
46−
47−foo :: String -> String
48−foo = \s -> s
49−
50−test8 = foo @@ "Hello World"
51−
52−test9 = Main.foo @@ "Hello World"
53−
54−test10 = "Hello" `Main.bar` "World"
55−
56−op5 :: forall a. Array a -> Array a -> Array a
57−op5 = \as -> \bs -> as
58−
59−infix 4 op5 as ...
60−
61−test11 = [1.0, 2.0, 0.0] ... [4.0, 5.0, 6.0]
62−
63−test14 :: Number -> Number -> Boolean
64−test14 a b = a < b
65−
66−test15 :: Number -> Number -> Boolean
67−test15 a b = const false $ a `test14` b
68−
69−test17 :: Number
70−test17 = negate (-1.0)
71−
72−test18 :: Number
73−test18 = negate $ negate 1.0
74−
75−test19 :: Number
76−test19 = negate $ negate (-1.0)
77−
78−main = do
79− let t1 = test1 1.0 2.0 (\x y -> x + y)
80− let t2 = test2
81− let t3 = test3
82− let t4 = test4
83− let t5 = test5
84− let t6 = test6
85− let t7 = test7
86− let t8 = test8
87− let t9 = test9
88− let t10 = test10
89− let t11 = test11
90− let t14 = test14 1.0 2.0
91− let t15 = test15 1.0 2.0
92− let t17 = test17
93− let t18 = test18
94− let t19 = test19
95− log "Done"
examples/passing/OptimizerBug.pursdeleted−9
@@ -1,9 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−x a = 1.0 + y a
6−
7−y a = x a
8−
9−main = Control.Monad.Eff.Console.log "Done"
examples/passing/OptionalQualified.pursdeleted−12
@@ -1,12 +0,0 @@
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.pursdeleted−17
@@ -1,17 +0,0 @@
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.pursdeleted−27
@@ -1,27 +0,0 @@
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.pursdeleted−20
@@ -1,20 +0,0 @@
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.pursdeleted−20
@@ -1,20 +0,0 @@
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.pursdeleted−11
@@ -1,11 +0,0 @@
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.pursdeleted−22
@@ -1,22 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−test = \x -> case x of
6− { str = "Foo", bool = true } -> true
7− { str = "Bar", bool = b } -> b
8− _ -> false
9−
10−f = \o -> case o of
11− { foo = "Foo" } -> o.bar
12− _ -> 0
13−
14−h = \o -> case o of
15− a@[_,_,_] -> a
16− _ -> []
17−
18−isDesc :: Array Number -> Boolean
19−isDesc [x, y] | x > y = true
20−isDesc _ = false
21−
22−main = Control.Monad.Eff.Console.log "Done"
examples/passing/PendingConflictingImports.pursdeleted−7
@@ -1,7 +0,0 @@
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−
7−main = Control.Monad.Eff.Console.log "Done"
examples/passing/PendingConflictingImports/A.pursdeleted−4
@@ -1,4 +0,0 @@
1−module A where
2−
3−thing :: Int
4−thing = 1
examples/passing/PendingConflictingImports/B.pursdeleted−4
@@ -1,4 +0,0 @@
1−module B where
2−
3−thing :: Int
4−thing = 2
examples/passing/PendingConflictingImports2.pursdeleted−9
@@ -1,9 +0,0 @@
1−module Main where
2−
3− import A
4−
5− -- No error as we never force `thing` to be resolved in `Main`
6− thing :: Int
7− thing = 2
8−
9− main = Control.Monad.Eff.Console.log "Done"
examples/passing/PendingConflictingImports2/A.pursdeleted−4
@@ -1,4 +0,0 @@
1−module A where
2−
3−thing :: Int
4−thing = 1
examples/passing/Person.pursdeleted−12
@@ -1,12 +0,0 @@
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/QualifiedNames.pursdeleted−9
@@ -1,9 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−either :: forall a b c. (a -> c) -> (b -> c) -> Either.Either a b -> c
6−either f _ (Either.Left x) = f x
7−either _ g (Either.Right y) = g y
8−
9−main = Control.Monad.Eff.Console.log (either id id (Either.Left "Done"))
examples/passing/QualifiedNames/Either.pursdeleted−5
@@ -1,5 +0,0 @@
1−module Either where
2−
3−import Prelude
4−
5−data Either a b = Left a | Right b
examples/passing/QualifiedQualifiedImports.pursdeleted−6
@@ -1,6 +0,0 @@
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.pursdeleted−30
@@ -1,30 +0,0 @@
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.pursdeleted−11
@@ -1,11 +0,0 @@
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.pursdeleted−17
@@ -1,17 +0,0 @@
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.pursdeleted−11
@@ -1,11 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−test1 :: (forall a. (a -> a)) -> Number
6−test1 = \f -> f 0.0
7−
8−forever :: forall m a b. (forall a b. m a -> (a -> m b) -> m b) -> m a -> m b
9−forever = \bind action -> bind action $ \_ -> forever bind action
10−
11−main = Control.Monad.Eff.Console.log "Done"
examples/passing/ReExportQualified.pursdeleted−6
@@ -1,6 +0,0 @@
1−module Main where
2−
3−import Prelude
4−import C
5−
6−main = Control.Monad.Eff.Console.log (x <> y)
examples/passing/ReExportQualified/A.pursdeleted−3
@@ -1,3 +0,0 @@
1−module A where
2−
3−x = "Do"
examples/passing/ReExportQualified/B.pursdeleted−3
@@ -1,3 +0,0 @@
1−module B where
2−
3−y = "ne"
examples/passing/ReExportQualified/C.pursdeleted−4
@@ -1,4 +0,0 @@
1−module C (module A, module M2) where
2−
3−import A
4−import B as M2
examples/passing/RebindableSyntax.pursdeleted−43
@@ -1,43 +0,0 @@
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.pursdeleted−10
@@ -1,10 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−fib = \n -> case n of
6− 0.0 -> 1.0
7− 1.0 -> 1.0
8− n -> fib (n - 1.0) + fib (n - 2.0)
9−
10−main = Control.Monad.Eff.Console.log "Done"
examples/passing/RedefinedFixity.pursdeleted−5
@@ -1,5 +0,0 @@
1−module Main where
2−
3−import M3
4−
5−main = Control.Monad.Eff.Console.log "Done"
examples/passing/RedefinedFixity/M1.pursdeleted−6
@@ -1,6 +0,0 @@
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.pursdeleted−5
@@ -1,5 +0,0 @@
1−module M2 where
2−
3−import Prelude ()
4−
5−import M1
examples/passing/RedefinedFixity/M3.pursdeleted−6
@@ -1,6 +0,0 @@
1−module M3 where
2−
3−import Prelude ()
4−
5−import M1
6−import M2
examples/passing/ReservedWords.pursdeleted−18
@@ -1,18 +0,0 @@
1−-- See https://github.com/purescript/purescript/issues/606
2−module Main where
3−
4−import Prelude
5−import Control.Monad.Eff
6−
7−o :: { type :: String }
8−o = { type: "o" }
9−
10−p :: { type :: String }
11−p = o { type = "p" }
12−
13−f :: forall r. { type :: String | r } -> String
14−f { type = "p" } = "Done"
15−f _ = "Fail"
16−
17−main :: Eff _ _
18−main = Control.Monad.Eff.Console.log $ f { type: p.type, foo: "bar" }
examples/passing/ResolvableScopeConflict.pursdeleted−12
@@ -1,12 +0,0 @@
1−module Main where
2−
3−import A (thing)
4−import B
5−
6−-- Not an error as although we have `thing` in scope from both A and B, it is
7−-- imported explicitly from A, giving it a resolvable solution.
8−what :: Boolean -> Int
9−what true = thing
10−what false = zing
11−
12−main = Control.Monad.Eff.Console.log "Done"
examples/passing/ResolvableScopeConflict/A.pursdeleted−4
@@ -1,4 +0,0 @@
1−module A where
2−
3−thing :: Int
4−thing = 1
examples/passing/ResolvableScopeConflict/B.pursdeleted−7
@@ -1,7 +0,0 @@
1−module B where
2−
3−thing :: Int
4−thing = 2
5−
6−zing :: Int
7−zing = 3
examples/passing/ResolvableScopeConflict2.pursdeleted−14
@@ -1,14 +0,0 @@
1−module Main where
2−
3−import A
4−
5−thing :: Int
6−thing = 1
7−
8−-- Not an error as although we have `thing` in scope from both Main and A,
9−-- as the local declaration takes precedence over the implicit import
10−what :: Boolean -> Int
11−what true = thing
12−what false = zing
13−
14−main = Control.Monad.Eff.Console.log "Done"
examples/passing/ResolvableScopeConflict2/A.pursdeleted−7
@@ -1,7 +0,0 @@
1−module A where
2−
3−thing :: Int
4−thing = 2
5−
6−zing :: Int
7−zing = 3
examples/passing/ResolvableScopeConflict3.pursdeleted−8
@@ -1,8 +0,0 @@
1−module Main (thing, main, module A) where
2−
3−import A
4−
5−thing :: Int
6−thing = 2
7−
8−main = Control.Monad.Eff.Console.log "Done"
examples/passing/ResolvableScopeConflict3/A.pursdeleted−4
@@ -1,4 +0,0 @@
1−module A where
2−
3−thing :: Int
4−thing = 1
examples/passing/RowConstructors.pursdeleted−42
@@ -1,42 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−type Foo = (x :: Number | (y :: Number | (z :: Number)))
6−type Bar = (x :: Number, y :: Number, z :: Number)
7−type Baz = { w :: Number | Bar }
8−
9−foo :: { | Foo }
10−foo = { x: 0.0, y: 0.0, z: 0.0 }
11−
12−bar :: { | Bar }
13−bar = { x: 0.0, y: 0.0, z: 0.0 }
14−
15−id' :: Record Foo -> Record Bar
16−id' = id
17−
18−foo' :: { | Foo }
19−foo' = id' foo
20−
21−bar' :: { | Bar }
22−bar' = id' bar
23−
24−baz :: Baz
25−baz = { x: 0.0, y: 0.0, z: 0.0, w: 0.0 }
26−
27−type Quux r = (q :: Number | r)
28−type Norf r = (q' :: Number | Quux r)
29−
30−quux :: { f :: { | Foo } | Quux Bar }
31−quux = { f: foo', x: 0.0, y: 0.0, z: 0.0, q: 0.0 }
32−
33−quux' :: { | Norf Bar }
34−quux' = { x: 0.0, y: 0.0, z: 0.0, q: 0.0, q': 0.0 }
35−
36−wildcard :: { w :: Number | _ } -> Baz
37−wildcard { w: w } = { x: w, y: w, z: w, w: w }
38−
39−wildcard' :: { | Quux _ } -> Number
40−wildcard' { q: q } = q
41−
42−main = Control.Monad.Eff.Console.log "Done"
examples/passing/RowPolyInstanceContext.pursdeleted−22
@@ -1,22 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−class T s m where
6− state :: (s -> s) -> m Unit
7−
8−data S s a = S (s -> { new :: s, ret :: a })
9−
10−instance st :: T s (S s) where
11− state f = S $ \s -> { new: f s, ret: unit }
12−
13−test1 :: forall r . S { foo :: String | r } Unit
14−test1 = state $ \o -> o { foo = o.foo <> "!" }
15−
16−test2 :: forall m r . (T { foo :: String | r } m) => m Unit
17−test2 = state $ \o -> o { foo = o.foo <> "!" }
18−
19−main = do
20− let t1 = test1
21− let t2 = test2
22− Control.Monad.Eff.Console.log "Done"
examples/passing/RuntimeScopeIssue.pursdeleted−22
@@ -1,22 +0,0 @@
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.pursdeleted−36
@@ -1,36 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−test1 :: forall a. (a -> a) -> a -> a
6−test1 f x = g (g x)
7− where
8− g :: a -> a
9− g y = f (f y)
10−
11−test2 :: forall a. (a -> a) -> a -> a
12−test2 = h
13− where
14− h :: forall b. (b -> b) -> b -> b
15− h f x = g (g x)
16− where
17− g :: b -> b
18− g y = f (f y)
19−
20−test3 :: Number
21−test3 = ((\b -> b :: b) :: forall b. b -> b) 0.0
22−
23−test4 :: forall a. (a -> a) -> a -> a
24−test4 = h
25− where
26− h :: forall b. (b -> b) -> b -> b
27− h f x = g (g x)
28− where
29− g :: b -> b
30− g y = j (f (f y))
31− where
32− j :: forall b. b -> b
33− j x = x
34−
35−
36−main = Control.Monad.Eff.Console.log "Done"
examples/passing/Sequence.pursdeleted−15
@@ -1,15 +0,0 @@
1−module Main where
2−
3−import Prelude
4−import Control.Monad.Eff
5−
6−data List a = Cons a (List a) | Nil
7−
8−class Sequence t where
9− sequence :: forall m a. (Monad m) => t (m a) -> m (t a)
10−
11−instance sequenceList :: Sequence List where
12− sequence Nil = pure Nil
13− sequence (Cons x xs) = Cons <$> x <*> sequence xs
14−
15−main = sequence $ Cons (Control.Monad.Eff.Console.log "Done") Nil
examples/passing/SequenceDesugared.pursdeleted−37
@@ -1,37 +0,0 @@
1−module Main where
2−
3−import Prelude
4−import Control.Monad.Eff
5−
6−data List a = Cons a (List a) | Nil
7−
8−data Sequence t = Sequence (forall m a. (Monad m) => t (m a) -> m (t a))
9−
10−sequence :: forall t. Sequence t -> (forall m a. (Monad m) => t (m a) -> m (t a))
11−sequence (Sequence s) = s
12−
13−sequenceListSeq :: forall m a. (Monad m) => List (m a) -> m (List a)
14−sequenceListSeq Nil = pure Nil
15−sequenceListSeq (Cons x xs) = Cons <$> x <*> sequenceListSeq xs
16−
17−sequenceList :: Sequence List
18−sequenceList = Sequence (sequenceListSeq)
19−
20−sequenceList' :: Sequence List
21−sequenceList' = Sequence ((\val -> case val of
22− Nil -> pure Nil
23− Cons x xs -> Cons <$> x <*> sequence sequenceList' xs))
24−
25−sequenceList'' :: Sequence List
26−sequenceList'' = Sequence (sequenceListSeq :: forall m a. (Monad m) => List (m a) -> m (List a))
27−
28−sequenceList''' :: Sequence List
29−sequenceList''' = Sequence ((\val -> case val of
30− Nil -> pure Nil
31− Cons x xs -> Cons <$> x <*> sequence sequenceList''' xs) :: forall m a. (Monad m) => List (m a) -> m (List a))
32−
33−main = do
34− sequence sequenceList $ Cons (Control.Monad.Eff.Console.log "Done") Nil
35− sequence sequenceList' $ Cons (Control.Monad.Eff.Console.log "Done") Nil
36− sequence sequenceList'' $ Cons (Control.Monad.Eff.Console.log "Done") Nil
37− sequence sequenceList''' $ Cons (Control.Monad.Eff.Console.log "Done") Nil
examples/passing/ShadowedModuleName.pursdeleted−8
@@ -1,8 +0,0 @@
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.pursdeleted−6
@@ -1,6 +0,0 @@
1−module Test where
2−
3−data Z = Z String
4−
5−runZ :: Z -> String
6−runZ (Z s) = s
examples/passing/ShadowedName.pursdeleted−10
@@ -1,10 +0,0 @@
1−module Main where
2−
3−import Prelude
4−import Control.Monad.Eff.Console
5−
6−done :: String
7−done = let str = "Not yet done" in
8− let str = "Done" in str
9−
10−main = Control.Monad.Eff.Console.log done
examples/passing/ShadowedRename.pursdeleted−14
@@ -1,14 +0,0 @@
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.pursdeleted−21
@@ -1,21 +0,0 @@
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.pursdeleted−15
@@ -1,15 +0,0 @@
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.pursdeleted−17
@@ -1,17 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−p = 0.5
6−q = 1.0
7−x = -1.0
8−y = -0.5
9−z = 0.5
10−w = 1.0
11−
12−f :: Number -> Number
13−f x = -x
14−
15−test1 = 2.0 - 1.0
16−
17−main = Control.Monad.Eff.Console.log "Done"
examples/passing/StringEscapes.pursdeleted−17
@@ -1,17 +0,0 @@
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.pursdeleted−23
@@ -1,23 +0,0 @@
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.pursdeleted−41
@@ -1,41 +0,0 @@
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.pursdeleted−20
@@ -1,20 +0,0 @@
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.pursdeleted−12
@@ -1,12 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−data Data = One | More Data
6−
7−main = Control.Monad.Eff.Console.log (from (to 10000.0 One))
8− where
9− to 0.0 a = a
10− to n a = to (n - 1.0) (More a)
11− from One = "Done"
12− from (More d) = from d
examples/passing/TailCall.pursdeleted−20
@@ -1,20 +0,0 @@
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.pursdeleted−7
@@ -1,7 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−test' x = x
6−
7−main = Control.Monad.Eff.Console.log "Done"
examples/passing/TopLevelCase.pursdeleted−18
@@ -1,18 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−gcd :: Number -> Number -> Number
6−gcd 0.0 x = x
7−gcd x 0.0 = x
8−gcd x y | x > y = gcd (x `mod` y) y
9−gcd x y = gcd (y `mod` x) x
10−
11−guardsTest [x] | x > 0.0 = []
12−guardsTest xs = xs
13−
14−data A = A
15−
16−parseTest A 0.0 = 0.0
17−
18−main = Control.Monad.Eff.Console.log "Done"
examples/passing/TransitiveImport.pursdeleted−9
@@ -1,9 +0,0 @@
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.pursdeleted−3
@@ -1,3 +0,0 @@
1−module Middle where
2−
3−middle = Test.test
examples/passing/TransitiveImport/Test.pursdeleted−9
@@ -1,9 +0,0 @@
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.pursdeleted−16
@@ -1,16 +0,0 @@
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.pursdeleted−71
@@ -1,71 +0,0 @@
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. (Prelude.Show a) => a -> String
9−f x = show x
10−
11−test2 = \_ -> f "testing"
12−
13−test7 :: forall a. (Prelude.Show a) => a -> String
14−test7 = show
15−
16−test8 = \_ -> show $ "testing"
17−
18−data Data a = Data a
19−
20−instance showData :: (Prelude.Show a) => Prelude.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.pursdeleted−11
@@ -1,11 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−class Foo a where
6− foo :: a -> String
7−
8−instance fooString :: Foo String where
9− foo s = s
10−
11−main = Control.Monad.Eff.Console.log $ foo "Done"
examples/passing/TypeClassesWithOverlappingTypeVariables.pursdeleted−11
@@ -1,11 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−data Either a b = Left a | Right b
6−
7−instance functorEither :: Prelude.Functor (Either a) where
8− map _ (Left x) = Left x
9− map f (Right y) = Right (f y)
10−
11−main = Control.Monad.Eff.Console.log "Done"
examples/passing/TypeDecl.pursdeleted−12
@@ -1,12 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−k :: String -> Number -> String
6−k x y = x
7−
8−iterate :: forall a. Number -> (a -> a) -> a -> a
9−iterate 0.0 f a = a
10−iterate n f a = iterate (n - 1.0) f (f a)
11−
12−main = Control.Monad.Eff.Console.log "Done"
examples/passing/TypeOperators.pursdeleted−19
@@ -1,19 +0,0 @@
1−module Main where
2−
3−import A (type (~>), type (/\), (/\))
4−
5−natty ∷ ∀ f. f ~> f
6−natty x = x
7−
8−data Compose f g a = Compose (f (g a))
9−
10−testPrecedence1 ∷ ∀ f g. Compose f g ~> Compose f g
11−testPrecedence1 x = x
12−
13−testPrecedence2 ∷ ∀ f g. f ~> g → f ~> g
14−testPrecedence2 nat fx = nat fx
15−
16−swap ∷ ∀ a b. a /\ b → b /\ a
17−swap (a /\ b) = b /\ a
18−
19−main = Control.Monad.Eff.Console.log "Done"
examples/passing/TypeOperators/A.pursdeleted−22
@@ -1,22 +0,0 @@
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.pursdeleted−11
@@ -1,11 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−type A a = Array a
6−
7−data Foo a = Foo (A a) | Bar
8−
9−foo (Foo []) = Bar
10−
11−main = Control.Monad.Eff.Console.log "Done"
examples/passing/TypeSynonyms.pursdeleted−27
@@ -1,27 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−type Lens a b =
6− { get :: a -> b
7− , set :: a -> b -> a
8− }
9−
10−composeLenses :: forall a b c. Lens a b -> Lens b c -> Lens a c
11−composeLenses = \l1 -> \l2 ->
12− { get: \a -> l2.get (l1.get a)
13− , set: \a c -> l1.set a (l2.set (l1.get a) c)
14− }
15−
16−type Pair a b = { fst :: a, snd :: b }
17−
18−fst :: forall a b. Lens (Pair a b) a
19−fst =
20− { get: \p -> p.fst
21− , set: \p a -> { fst: a, snd: p.snd }
22− }
23−
24−test1 :: forall a b c. Lens (Pair (Pair a b) c) a
25−test1 = composeLenses fst fst
26−
27−main = Control.Monad.Eff.Console.log "Done"
examples/passing/TypeWildcards.pursdeleted−15
@@ -1,15 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−testTopLevel :: _ -> _
6−testTopLevel n = n + 1.0
7−
8−test :: forall a. (Eq a) => (a -> a) -> a -> a
9−test f a = go (f a) a
10− where
11− go :: _ -> _ -> _
12− go a1 a2 | a1 == a2 = a1
13− go a1 _ = go (f a1) a1
14−
15−main = Control.Monad.Eff.Console.log "Done"
examples/passing/TypeWildcardsRecordExtension.pursdeleted−8
@@ -1,8 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−foo :: forall a. {b :: Number | a} -> {b :: Number | _}
6−foo f = f
7−
8−main = Control.Monad.Eff.Console.log "Done"
examples/passing/TypeWithoutParens.pursdeleted−11
@@ -1,11 +0,0 @@
1−module Main where
2−
3−import Lib (X, Y)
4−
5−idX :: X -> X
6−idX x = x
7−
8−idY :: Y -> Y
9−idY y = y
10−
11−main = Control.Monad.Eff.Console.log "Done"
examples/passing/TypeWithoutParens/Lib.pursdeleted−4
@@ -1,4 +0,0 @@
1−module Lib (X, Y) where
2−
3−data X = X
4−type Y = X
examples/passing/TypedBinders.pursdeleted−67
@@ -1,67 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−data Tuple a b = Tuple a b
6−
7−class MonadState s m where
8− get :: m s
9− put :: s -> m {}
10−
11−data State s a = State (s -> Tuple s a)
12−
13−runState s (State f) = f s
14−
15−instance functorState :: Functor (State s) where
16− map = liftM1
17−
18−instance applyState :: Apply (State s) where
19− apply = ap
20−
21−instance applicativeState :: Applicative (State s) where
22− pure a = State $ \s -> Tuple s a
23−
24−instance bindState :: Bind (State s) where
25− bind f g = State $ \s -> case runState s f of
26− Tuple s1 a -> runState s1 (g a)
27−
28−instance monadState :: Monad (State s)
29−
30−instance monadStateState :: MonadState s (State s) where
31− get = State (\s -> Tuple s s)
32− put s = State (\_ -> Tuple s {})
33−
34−modify :: forall m s. (Prelude.Monad m, MonadState s m) => (s -> s) -> m {}
35−modify f = do
36− s <- get
37− put (f s)
38−
39−test :: Tuple String String
40−test = runState "" $ do
41− modify $ (<>) "World!"
42− modify $ (<>) "Hello, "
43− str :: String <- get
44− pure str
45−
46−test2 :: (Int -> Int) -> Int
47−test2 = (\(f :: Int -> Int) -> f 10)
48−
49−test3 :: Int -> Boolean
50−test3 n = case n of
51− (0 :: Int) -> true
52− _ -> false
53−
54−test4 :: Tuple Int Int -> Tuple Int Int
55−test4 = (\(Tuple a b :: Tuple Int Int) -> Tuple b a)
56−
57−type Int1 = Int
58−
59−test5 :: Int1 -> Int1
60−test5 = \(x :: Int1) -> x
61−
62−main = do
63− let t1 = test
64− t2 = test2 id
65− t3 = test3 1
66− t4 = test4 (Tuple 1 0)
67− Control.Monad.Eff.Console.log "Done"
examples/passing/TypedWhere.pursdeleted−17
@@ -1,17 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−data E a b = L a | R b
6−
7−data L a = C a (L a) | N
8−
9−lefts :: forall a b. L (E a b) -> L a
10−lefts = go N
11− where
12− go :: forall a b. L a -> L (E a b) -> L a
13− go ls N = ls
14− go ls (C (L a) rest) = go (C a ls) rest
15− go ls (C _ rest) = go ls rest
16−
17−main = Control.Monad.Eff.Console.log "Done"
examples/passing/UTF8Sourcefile.pursdeleted−8
@@ -1,8 +0,0 @@
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.pursdeleted−12
@@ -1,12 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−data Data_type = Con_Structor | Con_2 String
6−
7−type Type_name = Data_type
8−
9−done (Con_2 s) = s
10−done _ = "Failed"
11−
12−main = Control.Monad.Eff.Console.log (done (Con_2 "Done"))
examples/passing/UnicodeIdentifier.pursdeleted−5
@@ -1,5 +0,0 @@
1−module Main where
2−
3−f asgård = asgård
4−
5−main = Control.Monad.Eff.Console.log (f "Done")
examples/passing/UnicodeOperators.pursdeleted−20
@@ -1,20 +0,0 @@
1−module Main where
2−
3−compose :: forall a b c. (b -> c) -> (a -> b) -> a -> c
4−compose f g a = f (g a)
5−
6−infixr 9 compose as ∘
7−
8−test1 = (\x -> x) ∘ \y -> y
9−
10−elem :: forall a b. a -> (a -> Boolean) -> Boolean
11−elem x f = f x
12−
13−infixl 1 elem as ∈
14−
15−emptySet :: forall a. a -> Boolean
16−emptySet _ = true
17−
18−test2 = 1 ∈ emptySet
19−
20−main = Control.Monad.Eff.Console.log "Done"
examples/passing/UnicodeType.pursdeleted−22
@@ -1,22 +0,0 @@
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.pursdeleted−8
@@ -1,8 +0,0 @@
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.pursdeleted−14
@@ -1,14 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−class EQ a b
6−
7−instance eqAA :: EQ a a
8−
9−test :: forall a b. (EQ a b) => a -> b -> String
10−test _ _ = "Done"
11−
12−runTest a = test a a
13−
14−main = Control.Monad.Eff.Console.log $ runTest 0.0
examples/passing/UntupledConstraints.pursdeleted−17
@@ -1,17 +0,0 @@
1−module Main where
2−
3−import Prelude
4−import Control.Monad.Eff.Console
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.pursdeleted−49
@@ -1,49 +0,0 @@
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.pursdeleted−13
@@ -1,13 +0,0 @@
1−module Main where
2−
3−import Prelude
4−import Control.Monad.Eff.Console
5−
6−f1 :: (_ -> _) -> _
7−f1 g = g 1
8−
9−f2 :: _ -> _
10−f2 _ = "Done"
11−
12−main = Control.Monad.Eff.Console.log $ f1 f2
13−
examples/passing/iota.pursdeleted−9
@@ -1,9 +0,0 @@
1−module Main where
2−
3−s = \x -> \y -> \z -> x z (y z)
4−
5−k = \x -> \y -> x
6−
7−iota = \x -> x s k
8−
9−main = Control.Monad.Eff.Console.log "Done"
examples/passing/s.pursdeleted−7
@@ -1,7 +0,0 @@
1−module Main where
2−
3−import Prelude
4−
5−s = \x y z -> x z (y z)
6−
7−main = Control.Monad.Eff.Console.log "Done"
hierarchy/Main.hsdeleted−115
@@ -1,115 +0,0 @@
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 False 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.hsdeleted−46
@@ -1,46 +0,0 @@
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.txtdeleted−23
@@ -1,23 +0,0 @@
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.pngdeleted

Binary file not shown.

make_release_notesdeleted−2
@@ -1,2 +0,0 @@
1−curl https://api.github.com/repos/purescript/purescript/pulls?state=closed\&per_page=100 \
2− | jq -r '.[] | ("- " + .title + " (@" + .user.login + ")")'
package.yamlnew file+86
@@ -0,0 +1,86 @@
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
pcc/Main.hsdeleted−185
@@ -1,185 +0,0 @@
1−-----------------------------------------------------------------------------
2−--
3−-- Module : Main
4−-- Copyright : (c) 2013-15 Phil Freeman, Andy Arvanitis, and other contributors
5−-- License : MIT
6−--
7−-- Maintainer : Andy Arvanitis
8−-- Stability : experimental
9−-- Portability :
10−--
11−-- |
12−--
13−-----------------------------------------------------------------------------
14−
15−{-# LANGUAGE DataKinds #-}
16−{-# LANGUAGE FlexibleContexts #-}
17−{-# LANGUAGE RecordWildCards #-}
18−{-# LANGUAGE ScopedTypeVariables #-}
19−{-# LANGUAGE TupleSections #-}
20−
21−module Main where
22−
23−import Control.Applicative
24−import Control.Monad
25−import Control.Monad.Writer.Strict
26−
27−import qualified Data.Aeson as A
28−import qualified Data.ByteString.Lazy as B
29−import qualified Data.ByteString.UTF8 as BU8
30−import qualified Data.Map as M
31−import Data.Version (showVersion)
32−
33−import qualified Language.PureScript as P
34−import Language.PureScript.Errors.JSON
35−import Language.PureScript.Make
36−
37−import Options.Applicative as Opts
38−
39−import qualified Paths_purescript as Paths
40−
41−import System.Exit (exitSuccess, exitFailure)
42−import System.FilePath.Glob (glob)
43−import System.IO (hSetEncoding, hPutStrLn, stdout, stderr, utf8)
44−import System.IO.UTF8
45−
46−data PCCMakeOptions = PCCMakeOptions
47− { pccmInput :: [FilePath]
48− , pccmOutputDir :: FilePath
49− , pccmOpts :: P.Options
50− , pccmUsePrefix :: Bool
51− , pccmJSONErrors :: Bool
52− }
53−
54−-- | Argumnets: verbose, use JSON, warnings, errors
55−printWarningsAndErrors :: Bool -> Bool -> P.MultipleErrors -> Either P.MultipleErrors a -> IO ()
56−printWarningsAndErrors verbose False warnings errors = do
57− when (P.nonEmpty warnings) $
58− hPutStrLn stderr (P.prettyPrintMultipleWarnings verbose warnings)
59− case errors of
60− Left errs -> do
61− hPutStrLn stderr (P.prettyPrintMultipleErrors verbose errs)
62− exitFailure
63− Right _ -> return ()
64−printWarningsAndErrors verbose True warnings errors = do
65− hPutStrLn stderr . BU8.toString . B.toStrict . A.encode $
66− JSONResult (toJSONErrors verbose P.Warning warnings)
67− (either (toJSONErrors verbose P.Error) (const []) errors)
68− either (const exitFailure) (const (return ())) errors
69−
70−compile :: PCCMakeOptions -> IO ()
71−compile PCCMakeOptions{..} = do
72− input <- globWarningOnMisses (unless pccmJSONErrors . warnFileTypeNotFound) pccmInput
73− when (null input && not pccmJSONErrors) $ do
74− hPutStrLn stderr "pcc: No input files."
75− exitFailure
76− moduleFiles <- readInput input
77− (makeErrors, makeWarnings) <- runMake pccmOpts $ do
78− ms <- P.parseModulesFromFiles id moduleFiles
79− let filePathMap = M.fromList $ map (\(fp, P.Module _ _ mn _ _) -> (mn, Right fp)) ms
80− foreigns <- inferForeignModules filePathMap
81− let makeActions = buildMakeActions pccmOutputDir filePathMap foreigns pccmUsePrefix
82− P.make makeActions (map snd ms)
83− printWarningsAndErrors (P.optionsVerboseErrors pccmOpts) pccmJSONErrors makeWarnings makeErrors
84− exitSuccess
85−
86−warnFileTypeNotFound :: String -> IO ()
87−warnFileTypeNotFound = hPutStrLn stderr . ("pcc: No files found using pattern: " ++)
88−
89−globWarningOnMisses :: (String -> IO ()) -> [FilePath] -> IO [FilePath]
90−globWarningOnMisses warn = concatMapM globWithWarning
91− where
92− globWithWarning pattern = do
93− paths <- glob pattern
94− when (null paths) $ warn pattern
95− return paths
96− concatMapM f = liftM concat . mapM f
97−
98−readInput :: [FilePath] -> IO [(FilePath, String)]
99−readInput inputFiles = forM inputFiles $ \inFile -> (inFile, ) <$> readUTF8File inFile
100−
101−inputFile :: Parser FilePath
102−inputFile = strArgument $
103− metavar "FILE"
104− <> help "The input .purs file(s)"
105−
106−outputDirectory :: Parser FilePath
107−outputDirectory = strOption $
108− short 'o'
109− <> long "output"
110− <> Opts.value "output"
111− <> showDefault
112− <> help "The output directory"
113−
114−noTco :: Parser Bool
115−noTco = switch $
116− long "no-tco"
117− <> help "Disable tail call optimizations"
118−
119−noMagicDo :: Parser Bool
120−noMagicDo = switch $
121− long "no-magic-do"
122− <> help "Disable the optimization that overloads the do keyword to generate efficient code specifically for the Eff monad"
123−
124−noOpts :: Parser Bool
125−noOpts = switch $
126− long "no-opts"
127− <> help "Skip the optimization phase"
128−
129−comments :: Parser Bool
130−comments = switch $
131− short 'c'
132− <> long "comments"
133− <> help "Include comments in the generated code"
134−
135−verboseErrors :: Parser Bool
136−verboseErrors = switch $
137− short 'v'
138− <> long "verbose-errors"
139− <> help "Display verbose error messages"
140−
141−noPrefix :: Parser Bool
142−noPrefix = switch $
143− short 'p'
144− <> long "no-prefix"
145− <> help "Do not include comment header"
146−
147−jsonErrors :: Parser Bool
148−jsonErrors = switch $
149− long "json-errors"
150− <> help "Print errors to stderr as JSON"
151−sourceMaps :: Parser Bool
152−sourceMaps = switch $
153− long "source-maps"
154− <> help "Generate source maps"
155−
156−
157−options :: Parser P.Options
158−options = P.Options <$> noTco
159− <*> noMagicDo
160− <*> pure Nothing
161− <*> noOpts
162− <*> verboseErrors
163− <*> (not <$> comments)
164− <*> sourceMaps
165−
166−pccMakeOptions :: Parser PCCMakeOptions
167−pccMakeOptions = PCCMakeOptions <$> many inputFile
168− <*> outputDirectory
169− <*> options
170− <*> (not <$> noPrefix)
171− <*> jsonErrors
172−
173−main :: IO ()
174−main = do
175− hSetEncoding stdout utf8
176− hSetEncoding stderr utf8
177− execParser opts >>= compile
178− where
179− opts = info (version <*> helper <*> pccMakeOptions) infoModList
180− infoModList = fullDesc <> headerInfo <> footerInfo
181− headerInfo = header "pcc - Compiles PureScript to C++11"
182− footerInfo = footer $ "pcc " ++ showVersion Paths.version
183−
184− version :: Parser (a -> a)
185− version = abortOption (InfoMsg (showVersion Paths.version)) $ long "version" <> help "Show the version number" <> hidden
pcc/Make.hsdeleted−174
@@ -1,174 +0,0 @@
1−-----------------------------------------------------------------------------
2−--
3−-- Module : Make
4−-- Copyright : (c) 2013-14 Phil Freeman, (c) 2014 Gary Burgess, and other contributors
5−-- License : MIT
6−--
7−-- Maintainer : Andy Arvanitis
8−-- Stability : experimental
9−-- Portability :
10−--
11−-- |
12−--
13−-----------------------------------------------------------------------------
14−
15−{-# LANGUAGE DataKinds #-}
16−{-# LANGUAGE FlexibleContexts #-}
17−{-# LANGUAGE GeneralizedNewtypeDeriving #-}
18−{-# LANGUAGE PatternGuards #-}
19−{-# LANGUAGE TupleSections #-}
20−{-# LANGUAGE TemplateHaskell #-}
21−
22−module Make
23− ( Make(..)
24− , runMake
25− , buildMakeActions
26− ) where
27−
28−import Control.Monad
29−import Control.Monad.Error.Class (MonadError(..))
30−import Control.Monad.Reader
31−
32−import Data.FileEmbed (embedFile)
33−import Data.Maybe (fromMaybe)
34−import Data.Time.Clock
35−import Data.Version (showVersion)
36−import qualified Data.Map as M
37−import qualified Data.ByteString.Char8 as B
38−
39−import System.Directory (doesDirectoryExist, doesFileExist, getModificationTime, createDirectoryIfMissing)
40−import System.FilePath ((</>), takeDirectory, addExtension, dropExtension)
41−import System.IO.Error (tryIOError)
42−import System.IO.UTF8
43−
44−import Language.PureScript.Errors
45−import Language.PureScript (Make, runMake)
46−
47−import qualified Language.PureScript as P
48−import qualified Language.PureScript.CodeGen.Cpp as CPP
49−import qualified Language.PureScript.CoreFn as CF
50−import qualified Paths_purescript as Paths
51−
52−makeIO :: (IOError -> P.ErrorMessage) -> IO a -> Make a
53−makeIO f io = do
54− e <- liftIO $ tryIOError io
55− either (throwError . P.singleError . f) return e
56−
57−-- Traverse (Either e) instance (base 4.7)
58−traverseEither :: Applicative f => (a -> f b) -> Either e a -> f (Either e b)
59−traverseEither _ (Left x) = pure (Left x)
60−traverseEither f (Right y) = Right <$> f y
61−
62−buildMakeActions :: FilePath
63− -> M.Map P.ModuleName (Either P.RebuildPolicy FilePath)
64− -> Bool
65− -> P.MakeActions Make
66−buildMakeActions outputDir filePathMap usePrefix =
67− P.MakeActions getInputTimestamp getOutputTimestamp readExterns codegen progress
68− where
69−
70− getInputFile :: P.ModuleName -> FilePath
71− getInputFile mn =
72− let path = fromMaybe (error "Module has no filename in 'make'") $ M.lookup mn filePathMap in
73− case path of
74− Right path' -> path'
75− Left _ -> error "Module has no filename in 'make'"
76−
77− getInputTimestamp :: P.ModuleName -> Make (Either P.RebuildPolicy (Maybe UTCTime))
78− getInputTimestamp mn = do
79− let path = fromMaybe (error "Module has no filename in 'make'") $ M.lookup mn filePathMap
80− traverseEither getTimestamp path
81−
82− getOutputTimestamp :: P.ModuleName -> Make (Maybe UTCTime)
83− getOutputTimestamp mn = do
84−
85− let filePath = dotsTo '/' $ P.runModuleName mn
86− fileBase = outputDir </> filePath </> (last . words . dotsTo ' ' $ P.runModuleName mn)
87− srcFile = addExtension fileBase "cc"
88−-- headerFile = addExtension fileBase "hh"
89− externsFile = outputDir </> filePath </> "externs.purs"
90− min <$> getTimestamp srcFile <*> getTimestamp externsFile
91−
92− readExterns :: P.ModuleName -> Make (FilePath, P.Externs)
93− readExterns mn = do
94− let path = outputDir </> (dotsTo '/' $ P.runModuleName mn) </> "externs.purs"
95− (path, ) <$> readTextFile path
96−
97− codegen :: CF.Module CF.Ann -> P.Environment -> P.Externs -> P.SupplyT Make ()
98− codegen m env exts = do
99− let mn = CF.moduleName m
100− let filePath = dotsTo '/' $ P.runModuleName mn
101− fileBase = outputDir </> filePath </> (last . words . dotsTo ' ' $ P.runModuleName mn)
102− srcFile = addExtension fileBase "cc"
103− headerFile = addExtension fileBase "hh"
104− externsFile = outputDir </> filePath </> "externs.purs"
105− prefix = ["Generated by pcc version " ++ showVersion Paths.version | usePrefix]
106− cpps <- CPP.moduleToCpp env m
107− let (hdrs,srcs) = span (/= CPP.CppEndOfHeader) cpps
108− psrcs <- CPP.prettyPrintCpp <$> pure srcs
109− phdrs <- CPP.prettyPrintCpp <$> pure hdrs
110− let src = unlines $ map ("// " ++) prefix ++ [psrcs]
111− hdr = unlines $ map ("// " ++) prefix ++ [phdrs]
112−
113− lift $ do
114− writeTextFile srcFile src
115− writeTextFile headerFile hdr
116− writeTextFile externsFile exts
117−
118− let supportDir = outputDir </> "PureScript"
119− supportFilesExist <- dirExists supportDir
120− when (not supportFilesExist) $ do
121− writeTextFile (supportDir </> "PureScript.hh") $ B.unpack $(embedFile "pcc/include/purescript.hh")
122− writeTextFile (supportDir </> "PureScript.cc") $ B.unpack $(embedFile "pcc/include/purescript.cc")
123− writeTextFile (supportDir </> "purescript_memory.hh") $ B.unpack $(embedFile "pcc/include/purescript_memory.hh")
124−
125− let inputPath = dropExtension $ getInputFile mn
126− hfile = addExtension inputPath "hh"
127− sfile = addExtension inputPath "cc"
128− hfileExists <- textFileExists hfile
129− when (hfileExists || requiresForeign m) $ do
130− text <- if hfileExists
131− then readTextFile hfile
132− else pure []
133− writeTextFile (addExtension (fileBase ++ "_ffi") "hh") text
134− sfileExists <- textFileExists sfile
135− when (sfileExists) $ do
136− text' <- readTextFile sfile
137− writeTextFile (addExtension (fileBase ++ "_ffi") "cc") text'
138−
139− requiresForeign :: CF.Module a -> Bool
140− requiresForeign = not . null . CF.moduleForeign
141−
142− dirExists :: FilePath -> Make Bool
143− dirExists path = makeIO (const (ErrorMessage [] $ CannotReadFile path)) $ do
144− doesDirectoryExist path
145−
146− textFileExists :: FilePath -> Make Bool
147− textFileExists path = makeIO (const (ErrorMessage [] $ CannotReadFile path)) $ do
148− doesFileExist path
149−
150− getTimestamp :: FilePath -> Make (Maybe UTCTime)
151− getTimestamp path = makeIO (const (ErrorMessage [] $ CannotGetFileInfo path)) $ do
152− exists <- doesFileExist path
153− traverse (const $ getModificationTime path) $ guard exists
154−
155− readTextFile :: FilePath -> Make String
156− readTextFile path = makeIO (const (ErrorMessage [] $ CannotReadFile path)) $ readUTF8File path
157−
158− writeTextFile :: FilePath -> String -> Make ()
159− writeTextFile path text = makeIO (const (ErrorMessage [] $ CannotWriteFile path)) $ do
160− mkdirp path
161− writeFile path text
162− where
163− mkdirp :: FilePath -> IO ()
164− mkdirp = createDirectoryIfMissing True . takeDirectory
165−
166− -- | Render a progress message
167− renderProgressMessage :: P.ProgressMessage -> String
168− renderProgressMessage (P.CompilingModule mn) = "Compiling " ++ P.runModuleName mn
169−
170− progress :: P.ProgressMessage -> Make ()
171− progress = liftIO . putStrLn . renderProgressMessage
172−
173−dotsTo :: Char -> String -> String
174−dotsTo chr = map (\c -> if c == '.' then chr else c)
pcc/Makefiledeleted−68
@@ -1,68 +0,0 @@
1−# PureScript to native binary (via C++) Makefile
2−#
3−# Run 'make' or 'make release' to build an optimized release build
4−# Run 'make debug' to build a non-optimized build suitable for debugging
5−#
6−# You can also perform a parallel build with 'make -jN', where N is the
7−# number of cores to use.
8−#
9−# PCC, PURESCRIPT_PKGS, OUTPUT, and BIN can all be overridden with the
10−# command itself. For example: 'make PURESCRIPT_PKGS=../gitpackages BIN=myexe'
11−#
12−# Flags can be added to either the codegen or native build phases.
13−# For example: 'make PCCFLAGS=--no-tco CXXFLAGS=-DDEBUG LDFLAGS=lobjc'
14−#
15−# You can also edit the generated version of this file directly.
16−#
17−PCC := {bin/pcc} # example: /usr/local/bin/pcc
18−PURESCRIPT_PKGS := packages # example: bower_components
19−PURESCRIPT_SRC := src
20−OUTPUT := output
21−BIN := main
22−
23−override PCCFLAGS += --comments
24−override CXXFLAGS += -std=c++11
25−override LDFLAGS +=
26−
27−ifneq ($(GC),no)
28− override CXXFLAGS += -DUSE_GC
29− override LDFLAGS += -lgc
30−endif
31−
32−DEBUG := "-DDEBUG -g"
33−RELEASE := "-O3 -flto"
34−
35−PURESCRIPT_PKG_SRCS := $(shell find $(PURESCRIPT_PKGS) -name '*.purs' | grep -v \/test\/ | grep -v \/example\/ | grep -v \/examples\/)
36−PURESCRIPT_SRCS := $(shell find $(PURESCRIPT_SRC) -name '*.purs')
37−
38−INCLUDES := -I $(OUTPUT)
39−BIN_DIR := $(OUTPUT)/bin
40−
41−release: codegen
42− @$(MAKE) $(BIN) CXXFLAGS+=$(RELEASE)
43−
44−debug: codegen
45− @$(MAKE) $(BIN) CXXFLAGS+=$(DEBUG)
46−
47−codegen:
48− @$(PCC) $(PCCFLAGS) --output $(OUTPUT) $(PURESCRIPT_PKG_SRCS) $(PURESCRIPT_SRCS)
49−
50−SRCS := $(shell find $(OUTPUT) 2>/dev/null -name '*.cc')
51−
52−OBJS = $(SRCS:.cc=.o)
53−DEPS = $(SRCS:.cc=.d)
54−
55−$(BIN): $(OBJS)
56− @echo "Linking" $(BIN_DIR)/$(BIN)
57− @mkdir -p $(BIN_DIR)
58− @$(CXX) $(LDFLAGS) $^ -o $(BIN_DIR)/$@
59−
60−-include $(DEPS)
61−
62−%.o: %.cc
63− @echo "Creating" $@
64− @$(CXX) $(CXXFLAGS) $(INCLUDES) -MMD -MP -c $< -o $@
65−
66−.PHONY: clean
67−clean:
68− @-rm -rf $(OUTPUT)
pcc/Makefile.hsdeleted−50
@@ -1,50 +0,0 @@
1−-------------------------------------------------------------------------------
2−--
3−-- Module : Main
4−-- Copyright : (c) 2016 Andy Arvanitis and other contributors
5−-- License : MIT
6−--
7−-- Maintainer : Andy Arvanitis
8−-- Stability : experimental
9−-- Portability :
10−--
11−-------------------------------------------------------------------------------
12−{-# LANGUAGE OverloadedStrings #-}
13−{-# LANGUAGE PatternGuards #-}
14−{-# LANGUAGE TemplateHaskell #-}
15−
16−module Makefile where
17−
18−import Control.Monad (when)
19−import Data.FileEmbed (embedFile)
20−import System.Environment (getExecutablePath)
21−import System.Directory (doesFileExist)
22−
23−import qualified Data.ByteString.Char8 as B
24−
25−generateMakefile :: IO ()
26−generateMakefile = do
27− makefileExists <- doesFileExist "Makefile"
28− when (not makefileExists) $ do
29− let makefile = $(embedFile "pcc/Makefile")
30− exePath <- getExecutablePath
31− putStrLn ""
32− putStrLn "Generating Makefile..."
33− putStrLn $ "pcc executable location: " ++ exePath
34− writeFile "Makefile" $ replace makefile pccPath exePath
35− putStrLn "Done"
36− putStrLn "Run 'make' or 'make release' to build an optimized release build."
37− putStrLn "The resulting binary executable will be located in output/bin (by default)."
38− putStrLn ""
39−
40−replace :: B.ByteString -> B.ByteString -> String -> String
41−replace s orig repl = replace'
42− where
43− replace'
44− | (p1, p2) <- B.breakSubstring orig s,
45− not (B.null p2) = B.unpack p1 ++ repl ++ trim (B.unpack p2)
46− | otherwise = B.unpack s
47− trim = drop (B.length orig)
48−
49−pccPath :: B.ByteString
50−pccPath = "{bin/pcc}"
pcc/TestMain.hsdeleted−120
@@ -1,120 +0,0 @@
1−-------------------------------------------------------------------------------
2−--
3−-- Module : Main
4−-- Copyright : (c) 2015 Andy Arvanitis and other contributors
5−-- License : MIT
6−--
7−-- Maintainer : Andy Arvanitis
8−-- Stability : experimental
9−-- Portability :
10−--
11−--
12−--
13−-------------------------------------------------------------------------------
14−module Main where
15−
16−import Data.List
17−import Control.Applicative
18−import Control.Monad
19−
20−import System.Process
21−import System.FilePath
22−import System.Directory
23−
24−-------------------------------------------------------------------------------
25−testsDir :: IO (FilePath, FilePath)
26−-------------------------------------------------------------------------------
27−testsDir = do
28− baseDir <- getCurrentDirectory
29− return (baseDir </> "pcc-tests", baseDir)
30−
31−-------------------------------------------------------------------------------
32−main :: IO ()
33−-------------------------------------------------------------------------------
34−main = do
35−
36− (outputDir, baseDir) <- testsDir
37−
38− outputDirExists <- doesDirectoryExist outputDir
39− when outputDirExists $ removeDirectoryRecursive outputDir
40− createDirectory outputDir
41−
42− fetchPackages
43−
44− let srcDir = outputDir </> "src"
45− createDirectory srcDir
46−
47− let passingDir = baseDir </> "examples" </> "passing"
48− passingTestCases <- sort . filter (".purs" `isSuffixOf`) <$> getDirectoryContents passingDir
49−
50− -- Auto-generate Makefile
51− setCurrentDirectory outputDir
52− callProcess "../.cabal-sandbox/bin/pcc" []
53−
54− let tests = filter (`notElem` skipped) passingTestCases
55−
56− -- Run the tests
57− --
58− forM_ tests $ \inputFile -> do
59− --
60− -- Compile/build
61− --
62− putStrLn $ "Compiling test " ++ inputFile ++ " ..."
63− setCurrentDirectory outputDir
64− copyFile (passingDir </> inputFile) (srcDir </> inputFile)
65− callProcess "make" ["clean"]
66− callProcess "make" ["debug"]
67− --
68− -- Run C++ files
69− --
70− callProcess ("output" </> "bin" </> "main") []
71−
72− removeFile (srcDir </> inputFile)
73−
74− -- TODO: support failing test cases
75− --
76− -- let failing = baseDir </> "examples" </> "failing"
77− -- failingTestCases <- sort . filter (".purs" `isSuffixOf`) <$> getDirectoryContents failing
78− --
79−
80− setCurrentDirectory baseDir
81− putStrLn "pcc-tests finished"
82− putStrLn $ "Total tests available: " ++ show (length passingTestCases)
83− putStrLn $ "Tests run: " ++ show (length tests)
84− putStrLn $ "Tests skipped: " ++ show (length skipped)
85−
86−-------------------------------------------------------------------------------
87−repo :: String
88−-------------------------------------------------------------------------------
89−repo = "git://github.com/pure11/"
90−
91−-------------------------------------------------------------------------------
92−packages :: [(String, String)]
93−-------------------------------------------------------------------------------
94−packages =
95− [ ("purescript-eff", "")
96− , ("purescript-prelude", "")
97− , ("purescript-assert", "")
98− , ("purescript-st", "")
99− , ("purescript-console", "")
100− , ("purescript-functions", "")
101− ]
102−
103−-------------------------------------------------------------------------------
104−fetchPackages :: IO ()
105−-------------------------------------------------------------------------------
106−fetchPackages = do
107− (outputDir, baseDir) <- testsDir
108− let packageDir = outputDir </> "packages"
109− createDirectory packageDir
110− setCurrentDirectory packageDir
111− forM_ packages $ \package -> let branch = snd package in
112− callProcess "git" $ ["clone"] ++ (if null branch then [] else ["--branch", branch]) ++ [repo ++ (fst package) ++ ".git"]
113− setCurrentDirectory baseDir
114−
115−-------------------------------------------------------------------------------
116−skipped :: [String]
117−-------------------------------------------------------------------------------
118−skipped =
119− [ "ExplicitImportReExport.purs" -- OK, test has no main (would pass otherwise)
120− ]
pcc/include/purescript.ccdeleted−310
@@ -1,310 +0,0 @@
1−///////////////////////////////////////////////////////////////////////////////
2−//
3−// Module : purescript.cc
4−// Copyright : (c) Andy Arvanitis 2015
5−// License : MIT
6−//
7−// Maintainer : Andy Arvanitis <andy.arvanitis@gmail.com>
8−// Stability : experimental
9−// Portability :
10−//
11−// Basic types and functions to support purescript-to-C++1x rendering
12−//
13−///////////////////////////////////////////////////////////////////////////////
14−//
15−#include <cstring>
16−#include "PureScript.hh"
17−
18−namespace PureScript {
19−
20−#define RETURN_VALUE(TYPE, ACCESSOR, INDIRECTION) \
21− const any& variant = unthunkVariant(*this); \
22− assert(variant.type == TYPE); \
23− return INDIRECTION(variant.ACCESSOR); \
24−
25−auto any::operator()(const any& arg) const -> any {
26− const any& variant = unthunkVariant(*this);
27− if (variant.type == Type::Closure) {
28− return (*variant.l)(arg);
29− }
30− assert(variant.type == Type::Function);
31− return (*variant.f)(arg);
32−}
33−
34−auto any::operator()(const as_thunk) const -> const any& {
35− assert(type == Type::Thunk);
36− return (*t)(unthunk);
37−}
38−
39−auto any::operator()() const -> any {
40− const any& variant = unthunkVariant(*this);
41− if (variant.type == Type::EffClosure) {
42− return (*variant.k)();
43− }
44− assert(variant.type == Type::EffFunction);
45− return (*variant.e)();
46−}
47−
48−any::operator integer() const {
49− RETURN_VALUE(Type::Integer, i,)
50−}
51−
52−any::operator double() const {
53− RETURN_VALUE(Type::Double, d,)
54−}
55−
56−any::operator bool() const {
57− RETURN_VALUE(Type::Boolean, b,)
58−}
59−
60−any::operator char() const {
61− RETURN_VALUE(Type::Character, c,)
62−}
63−
64−any::operator cstring() const {
65− const any& variant = unthunkVariant(*this);
66− if (variant.type == Type::StringLiteral) {
67− return variant.r;
68− }
69− assert(variant.type == Type::String);
70− return variant.s->c_str();
71−}
72−
73−any::operator const map&() const {
74− RETURN_VALUE(Type::Map, m, *)
75−}
76−
77−any::operator const data&() const {
78− RETURN_VALUE(Type::Data, v, *)
79−}
80−
81−any::operator const array&() const {
82− RETURN_VALUE(Type::Array, a, *)
83−}
84−
85−auto any::extractPointer() const -> void* {
86− RETURN_VALUE(Type::Pointer, POINTER_FROM_MEMBER(p),)
87−}
88−
89−auto any::unthunkVariant(const any& a) -> const any& {
90− const any * variant = &a;
91− while (variant->type == Type::Thunk) {
92− variant = &((*variant->t)(unthunk));
93− }
94− return *variant;
95−}
96−
97−auto any::operator[](const char rhs[]) const -> const any& {
98− const any& variant = unthunkVariant(*this);
99− assert(variant.type == Type::Map);
100− const auto begin = variant.m->cbegin();
101− const auto end = variant.m->cend();
102− for (auto it = begin; it != end; ++it) {
103− if (it->first == rhs) {
104− return it->second;
105− }
106− }
107− for (auto it = begin; it != end; ++it) {
108− if (strcmp(it->first, rhs) == 0) {
109− return it->second;
110− }
111− }
112− throw runtime_error("map key not found");
113−}
114−
115−auto any::operator[](const size_t rhs) const -> const any& {
116− const any& variant = unthunkVariant(*this);
117− assert(variant.type == Type::Array);
118− return (*variant.a)[rhs];
119−}
120−
121−auto any::operator[](const any& rhs) const -> const any& {
122− const any& variant = unthunkVariant(*this);
123− assert(variant.type == Type::Array);
124− return (*variant.a)[cast<integer>(rhs)];
125−}
126−
127−auto any::contains(const char key[]) const -> bool {
128− const any& variant = unthunkVariant(*this);
129− assert(variant.type == Type::Map);
130− const auto begin = variant.m->cbegin();
131− const auto end = variant.m->cend();
132− for (auto it = begin; it != end; ++it) {
133− if (it->first == key) {
134− return true;
135− }
136− }
137− for (auto it = begin; it != end; ++it) {
138− if (strcmp(it->first, key) == 0) {
139− return true;
140− }
141− }
142− return false;
143−}
144−
145−//-----------------------------------------------------------------------------
146−// Operator helper macros
147−//-----------------------------------------------------------------------------
148−
149−#define DEFINE_CSTR_EQUALS_OPERATOR() \
150− auto operator==(const any& lhs_, const char * rhs) -> bool { \
151− const any& lhs = any::unthunkVariant(lhs_); \
152− assert(lhs.type == any::Type::StringLiteral || lhs.type == any::Type::String); \
153− if (lhs.type == any::Type::StringLiteral) { \
154− return (lhs.r == rhs) || (strcmp(lhs.r, rhs) == 0); \
155− } \
156− return strcmp(lhs.s->c_str(), rhs) == 0; \
157− } \
158− auto operator==(const char * lhs, const any& rhs_) -> bool { \
159− const any& rhs = any::unthunkVariant(rhs_); \
160− assert(rhs.type == any::Type::StringLiteral || rhs.type == any::Type::String); \
161− if (rhs.type == any::Type::StringLiteral) { \
162− return (lhs == rhs.r) || (strcmp(lhs, rhs) == 0); \
163− } \
164− return strcmp(lhs, rhs.s->c_str()) == 0; \
165− }
166−
167−#define DEFINE_CSTR_COMPARISON_OPERATOR(op) \
168− auto operator op (const any& lhs, const char * rhs) -> bool { \
169− return strcmp(cast<cstring>(lhs), rhs) op 0; \
170− } \
171− auto operator op (const char * lhs, const any& rhs) -> bool { \
172− return strcmp(lhs, cast<cstring>(rhs)) op 0; \
173− }
174−
175−#define DEFINE_COMPARISON_OPERATOR(op) \
176− auto operator op (const any& lhs_, const any& rhs_) -> bool { \
177− const any& lhs = any::unthunkVariant(lhs_); \
178− const any& rhs = any::unthunkVariant(rhs_); \
179− switch (lhs.type) { \
180− case any::Type::Integer: assert(lhs.type == any::Type::Integer); return lhs.i op rhs.i; \
181− case any::Type::Double: assert(lhs.type == any::Type::Double); return lhs.d op rhs.d; \
182− case any::Type::Character: assert(lhs.type == any::Type::Character); return lhs.c op rhs.c; \
183− case any::Type::Boolean: assert(lhs.type == any::Type::Boolean); return lhs.b op rhs.b; \
184− case any::Type::StringLiteral: \
185− assert(lhs.type == any::Type::StringLiteral || lhs.type == any::Type::String); \
186− assert(rhs.type == any::Type::StringLiteral || rhs.type == any::Type::String); \
187− return strcmp(lhs.r, rhs.type == any::Type::StringLiteral ? rhs.r : rhs.s->c_str()) op 0; \
188− case any::Type::String: \
189− assert(lhs.type == any::Type::StringLiteral || lhs.type == any::Type::String); \
190− assert(rhs.type == any::Type::StringLiteral || rhs.type == any::Type::String); \
191− return strcmp(lhs.s->c_str(), rhs.type == any::Type::StringLiteral ? rhs.r : rhs.s->c_str()) op 0; \
192− case any::Type::Pointer: return lhs.p op rhs.p; \
193− default: assert(false && "Unsupported type for operator " #op); \
194− } \
195− return false; \
196− }
197−
198−//-----------------------------------------------------------------------------
199−// Operator definitions
200−//-----------------------------------------------------------------------------
201−
202−DEFINE_COMPARISON_OPERATOR(==)
203−DEFINE_COMPARISON_OPERATOR(!=)
204−DEFINE_COMPARISON_OPERATOR(<)
205−DEFINE_COMPARISON_OPERATOR(<=)
206−DEFINE_COMPARISON_OPERATOR(>)
207−DEFINE_COMPARISON_OPERATOR(>=)
208−
209−DEFINE_CSTR_EQUALS_OPERATOR()
210−DEFINE_CSTR_COMPARISON_OPERATOR(!=)
211−DEFINE_CSTR_COMPARISON_OPERATOR(<)
212−DEFINE_CSTR_COMPARISON_OPERATOR(<=)
213−DEFINE_CSTR_COMPARISON_OPERATOR(>)
214−DEFINE_CSTR_COMPARISON_OPERATOR(>=)
215−
216−auto operator+(const any& lhs_, const any& rhs_) -> any {
217− const any& lhs = any::unthunkVariant(lhs_);
218− const any& rhs = any::unthunkVariant(rhs_);
219− switch (lhs.type) {
220− case any::Type::Integer: assert(lhs.type == any::Type::Integer); return lhs.i + rhs.i;
221− case any::Type::Double: assert(lhs.type == any::Type::Double); return lhs.d + rhs.d;
222− case any::Type::Character: assert(lhs.type == any::Type::Character); return any(char(lhs.c + rhs.c));
223− case any::Type::StringLiteral:
224− assert(lhs.type == any::Type::StringLiteral || lhs.type == any::Type::String);
225− assert(rhs.type == any::Type::StringLiteral || rhs.type == any::Type::String);
226− return rhs.type == any::Type::StringLiteral ? std::string(lhs.r) + rhs.r : lhs.r + *rhs.s;
227− case any::Type::String:
228− assert(lhs.type == any::Type::StringLiteral || lhs.type == any::Type::String);
229− assert(rhs.type == any::Type::StringLiteral || rhs.type == any::Type::String);
230− return rhs.type == any::Type::StringLiteral ? *lhs.s + rhs.r : *lhs.s + *rhs.s;
231− default: assert(false && "Unsupported type for '+' operator");
232− }
233− return nullptr;
234−}
235−
236−auto operator+(const any& lhs_, const char * rhs) -> std::string {
237− const any& lhs = any::unthunkVariant(lhs_);
238− assert(lhs.type == any::Type::StringLiteral || lhs.type == any::Type::String);
239− return lhs.type == any::Type::StringLiteral ? std::string(lhs.r) + rhs : *lhs.s + rhs;
240−}
241−
242−auto operator+(const char * lhs, const any& rhs_) -> std::string {
243− const any& rhs = any::unthunkVariant(rhs_);
244− assert(rhs.type == any::Type::StringLiteral || rhs.type == any::Type::String);
245− return rhs.type == any::Type::StringLiteral ? lhs + std::string(rhs.r) : lhs + *rhs.s;
246−}
247−
248−auto operator-(const any& lhs_, const any& rhs_) -> any {
249− const any& lhs = any::unthunkVariant(lhs_);
250− const any& rhs = any::unthunkVariant(rhs_);
251− assert(lhs.type == rhs.type);
252− switch (lhs.type) {
253− case any::Type::Integer: return lhs.i - rhs.i;
254− case any::Type::Double: return lhs.d - rhs.d;
255− case any::Type::Character: return any(char(lhs.c - rhs.c));
256− default: assert(false && "Unsupported type for '-' operator");
257− }
258− return nullptr;
259−}
260−
261−auto operator*(const any& lhs_, const any& rhs_) -> any {
262− const any& lhs = any::unthunkVariant(lhs_);
263− const any& rhs = any::unthunkVariant(rhs_);
264− assert(lhs.type == rhs.type);
265− switch (lhs.type) {
266− case any::Type::Integer: return lhs.i * rhs.i;
267− case any::Type::Double: return lhs.d * rhs.d;
268− case any::Type::Character: return any(char(lhs.c * rhs.c));
269− default: assert(false && "Unsupported type for '*' operator");
270− }
271− return nullptr;
272−}
273−
274−auto operator/(const any& lhs_, const any& rhs_) -> any {
275− const any& lhs = any::unthunkVariant(lhs_);
276− const any& rhs = any::unthunkVariant(rhs_);
277− assert(lhs.type == rhs.type);
278− switch (lhs.type) {
279− case any::Type::Integer: return lhs.i / rhs.i;
280− case any::Type::Double: return lhs.d / rhs.d;
281− case any::Type::Character: return any(char(lhs.c / rhs.c));
282− default: assert(false && "Unsupported type for '/' operator");
283− }
284− return nullptr;
285−}
286−
287−auto operator%(const any& lhs_, const any& rhs_) -> any {
288− const any& lhs = any::unthunkVariant(lhs_);
289− const any& rhs = any::unthunkVariant(rhs_);
290− assert(lhs.type == rhs.type);
291− switch (lhs.type) {
292− case any::Type::Integer: return lhs.i % rhs.i;
293− case any::Type::Character: return any(char(lhs.c % rhs.c));
294− default: assert(false && "Unsupported type for '%' operator");
295− }
296− return nullptr;
297−}
298−
299−// unary negate
300−auto operator-(const any& rhs_) -> any {
301− const any& rhs = any::unthunkVariant(rhs_);
302− switch (rhs.type) {
303− case any::Type::Integer: return (- rhs.i);
304− case any::Type::Double: return (- rhs.d);
305− default: assert(false && "Unsupported type for unary '-' operator");
306− }
307− return nullptr;
308−}
309−
310−} // namespace PureScript
pcc/include/purescript.hhdeleted−441
@@ -1,441 +0,0 @@
1−///////////////////////////////////////////////////////////////////////////////
2−//
3−// Module : purescript.hh
4−// Copyright : (c) Andy Arvanitis 2015
5−// License : MIT
6−//
7−// Maintainer : Andy Arvanitis <andy.arvanitis@gmail.com>
8−// Stability : experimental
9−// Portability :
10−//
11−// Basic types and functions to support purescript-to-C++1x rendering
12−//
13−///////////////////////////////////////////////////////////////////////////////
14−//
15−#ifndef PureScript_HH
16−#define PureScript_HH
17−
18−// Standard includes
19−
20−#if defined(DEBUG)
21− #include <cassert>
22−#else
23− #define NDEBUG
24− #undef assert
25− #define assert(x)
26−#endif
27−
28−#include <functional>
29−#include <string>
30−#include <vector>
31−#include <deque>
32−#include <utility>
33−#include <stdexcept>
34−#include <iso646.h> // mostly for MS Visual Studio compiler
35−#include "purescript_memory.hh"
36−
37−namespace PureScript {
38−
39−using integer = std::intptr_t;
40−using cstring = const char *;
41−using nullptr_t = std::nullptr_t;
42−
43−// Workaround for missing C++11 version in gcc
44−class runtime_error : public std::runtime_error {
45−public:
46− runtime_error(const char message[]) : std::runtime_error(std::string(message)) {}
47−};
48−
49−const integer INTEGER_MIN = INTPTR_MIN;
50−const integer INTEGER_MAX = INTPTR_MAX;
51−
52−const bool undefined = false;
53−const size_t constructor = 0;
54−
55−// A variant data class designed to provide some features of dynamic typing.
56−//
57−class any {
58−
59− public:
60− enum class Type {
61− Thunk = 0x10,
62− Integer,
63− Double,
64− Character,
65− Boolean,
66− StringLiteral,
67− Function,
68− EffFunction,
69− RawPointer,
70− String,
71− Map,
72− Data,
73− Array,
74− Closure,
75− EffClosure,
76− Pointer
77− };
78−
79− private:
80− mutable Type type;
81−
82− public:
83− struct as_thunk {
84− };
85− static constexpr as_thunk unthunk = as_thunk{};
86−
87− using map_pair = std::pair<const char * const, const any>;
88− using map = std::vector<map_pair WITH_ALLOCATOR(map_pair)>;
89− using data = std::vector<any WITH_ALLOCATOR(any)>;
90− using array = std::deque<any WITH_ALLOCATOR(any)>;
91− using fn = auto (*)(const any&) -> any;
92− using eff_fn = auto (*)() -> any;
93− using thunk = auto (*)(const as_thunk) -> const any&;
94−
95− private:
96− class closure {
97− public:
98− virtual auto operator()(const any&) const -> any = 0;
99− virtual ~closure() {}
100− };
101−
102− template <typename T>
103− class _closure : public closure {
104− const T lambda;
105− public:
106− _closure(const T& l) noexcept : lambda(l) {}
107− auto operator()(const any& arg) const -> any override {
108− return lambda(arg);
109− }
110− };
111−
112− class eff_closure {
113− public:
114− virtual auto operator()() const -> any = 0;
115− virtual ~eff_closure() {}
116− };
117−
118− template <typename T>
119− class _eff_closure : public eff_closure {
120− const T lambda;
121− public:
122− _eff_closure(const T& l) noexcept : lambda(l) {}
123− auto operator()() const -> any override {
124− return lambda();
125− }
126− };
127−
128− private:
129− union {
130− mutable thunk t;
131− mutable integer i;
132− mutable double d;
133− mutable char c;
134− mutable bool b;
135− mutable cstring r;
136− mutable fn f;
137− mutable eff_fn e;
138− mutable void * u;
139− mutable managed<std::string> s;
140− mutable managed<map> m;
141− mutable managed<data> v;
142− mutable managed<array> a;
143− mutable managed<closure> l;
144− mutable managed<eff_closure> k;
145− mutable managed<void> p;
146− };
147−
148− public:
149−
150− any(const integer val) noexcept : type(Type::Integer), i(val) {}
151− any(const int val) noexcept : type(Type::Integer), i(val) {}
152− any(const unsigned int val) noexcept : type(Type::Integer), i(val) {}
153− any(const double val) noexcept : type(Type::Double), d(val) {}
154− any(const char val) noexcept : type(Type::Character), c(val) {}
155−
156− template <typename T, typename = typename std::enable_if<std::is_same<bool,T>::value>::type>
157− any(const T val) noexcept : type(Type::Boolean), b(val) {}
158−
159− template <size_t N>
160− any(const char (&val)[N]) noexcept : type(Type::StringLiteral), r(val) {}
161− any(char * val) : type(Type::String), s(make_managed<std::string>(val)) {}
162−
163− any(const std::string& val) : type(Type::String), s(make_managed<std::string>(val)) {}
164− any(std::string&& val) noexcept : type(Type::String), s(make_managed<std::string>(std::move(val))) {}
165−
166− any(const managed<std::string>& val) noexcept : type(Type::String), s(val) {}
167− any(managed<std::string>&& val) noexcept : type(Type::String), s(std::move(val)) {}
168−
169− any(const map& val) : type(Type::Map), m(make_managed<map>(val)) {}
170− any(map&& val) noexcept : type(Type::Map), m(make_managed<map>(std::move(val))) {}
171−
172− any(const data& val) : type(Type::Data), v(make_managed<data>(val)) {}
173− any(data&& val) noexcept : type(Type::Data), v(make_managed<data>(std::move(val))) {}
174−
175− any(const array& val) : type(Type::Array), a(make_managed<array>(val)) {}
176− any(array&& val) noexcept : type(Type::Array), a(make_managed<array>(std::move(val))) {}
177−
178− template <typename T>
179− any(const T& val, typename std::enable_if<std::is_convertible<T,fn>::value>::type* = 0) noexcept
180− : type(Type::Function), f(val) {}
181−
182− template <typename T, typename = typename std::enable_if<!std::is_same<any,T>::value &&
183− !std::is_convertible<T,fn>::value>::type>
184− any(const T& val, typename std::enable_if<std::is_assignable<std::function<any(const any&)>,T>::value>::type* = 0)
185− : type(Type::Closure), l(make_managed<_closure<T>>(val)) {}
186−
187− template <typename T>
188− any(const T& val, typename std::enable_if<std::is_convertible<T,eff_fn>::value>::type* = 0) noexcept
189− : type(Type::EffFunction), e(val) {}
190−
191− template <typename T,
192− typename = typename std::enable_if<!std::is_same<any,T>::value &&
193− !std::is_convertible<T,eff_fn>::value>::type>
194− any(const T& val, typename std::enable_if<std::is_assignable<std::function<any()>,T>::value>::type* = 0)
195− : type(Type::EffClosure), k(make_managed<_eff_closure<T>>(val)) {}
196−
197− template <typename T>
198− any(const T& val, typename std::enable_if<std::is_convertible<T,thunk>::value>::type* = 0) noexcept
199− : type(Type::Thunk), t(val) {}
200−
201− template <typename T,
202− typename = typename std::enable_if<std::is_class<typename std::remove_pointer<T>::type>::value>::type>
203− any(const T& val, typename std::enable_if<IS_POINTER_TYPE(T)::value>::type* = 0) noexcept
204− : type(Type::Pointer), p(val) {}
205−
206− template <typename T>
207− any(T&& val, typename std::enable_if<std::is_assignable<managed<void>,T>::value>::type* = 0) noexcept
208− : type(Type::Pointer), p(std::move(val)) {}
209−
210− // Explicit void* to raw pointer value
211− template <typename T>
212− any(const T& val, typename std::enable_if<std::is_same<T,void*>::value>::type* = 0) noexcept
213− : type(Type::RawPointer), u(val) {}
214−
215− any(std::nullptr_t) noexcept : type(Type::Pointer), p(nullptr) {}
216−
217−
218−#if !defined(USE_GC)
219− private:
220− template <typename T,
221− typename U,
222− typename = typename std::enable_if<!std::is_reference<T>::value>::type>
223− static constexpr auto move_if_rvalue(U&& u) noexcept -> U&& {
224− return static_cast<U&&>(u);
225− }
226−
227− template <typename T,
228− typename U,
229− typename = typename std::enable_if<std::is_reference<T>::value>::type>
230− static constexpr auto move_if_rvalue(U& u) noexcept -> U& {
231− return static_cast<U&>(u);
232− }
233−
234− template <typename T>
235− auto assign(T&& other) const noexcept -> void {
236− switch (other.type) {
237− case Type::Thunk: t = other.t; break;
238− case Type::Integer: i = other.i; break;
239− case Type::Double: d = other.d; break;
240− case Type::Character: c = other.c; break;
241− case Type::Boolean: b = other.b; break;
242− case Type::StringLiteral: r = other.r; break;
243− case Type::Function: f = other.f; break;
244− case Type::EffFunction: e = other.e; break;
245− case Type::RawPointer: u = other.u; break;
246−
247− case Type::String: new (&s) managed<std::string>(move_if_rvalue<T>(other.s)); break;
248− case Type::Map: new (&m) managed<map>(move_if_rvalue<T>(other.m)); break;
249− case Type::Data: new (&v) managed<data>(move_if_rvalue<T>(other.v)); break;
250− case Type::Array: new (&a) managed<array>(move_if_rvalue<T>(other.a)); break;
251− case Type::Closure: new (&l) managed<closure>(move_if_rvalue<T>(other.l)); break;
252− case Type::EffClosure: new (&k) managed<eff_closure>(move_if_rvalue<T>(other.k)); break;
253− case Type::Pointer: new (&p) managed<void>(move_if_rvalue<T>(other.p)); break;
254−
255− default: assert(false && "Bad 'any' type"); break;
256− }
257− }
258−
259− auto destruct() -> void {
260− switch (type) {
261− case Type::String: s.~managed<std::string>(); break;
262− case Type::Map: m.~managed<map>(); break;
263− case Type::Data: v.~managed<data>(); break;
264− case Type::Array: a.~managed<array>(); break;
265− case Type::Closure: l.~managed<closure>(); break;
266− case Type::EffClosure: k.~managed<eff_closure>(); break;
267− case Type::Pointer: p.~managed<void>(); break;
268−
269− default: break;
270− }
271− }
272−
273− public:
274− any(const any& other) noexcept : type(other.type) {
275− assign(other);
276− }
277−
278− any(any&& other) noexcept : type(other.type) {
279− assign(std::move(other));
280− }
281−
282− auto operator=(const any& rhs) noexcept -> any& {
283− destruct();
284− type = rhs.type;
285− assign(rhs);
286− return *this;
287− }
288−
289− auto operator=(any&& rhs) noexcept -> any& {
290− destruct();
291− type = rhs.type;
292− assign(std::move(rhs));
293− return *this;
294− }
295−
296− ~any() {
297− destruct();
298− }
299−#endif // !defined(USE_GC)
300−
301− public:
302− any() = delete;
303−
304− auto operator()(const any&) const -> any;
305− auto operator()(const as_thunk) const -> const any&;
306− auto operator()() const -> any;
307−
308− operator integer() const;
309− operator double() const;
310− operator bool() const;
311− operator char() const;
312− operator cstring() const;
313− operator const map&() const;
314− operator const data&() const;
315− operator const array&() const;
316−
317− auto operator[](const char[]) const -> const any&;
318− auto operator[](const size_t) const -> const any&;
319− auto operator[](const any&) const -> const any&;
320−
321− auto contains(const char[]) const -> bool;
322−
323− auto extractPointer() const -> void*;
324−
325− auto rawPointer() const -> void* {
326− const any& variant = unthunkVariant(*this);
327− assert(type == Type::RawPointer);
328− return variant.u;
329− }
330−
331− static auto unthunkVariant(const any&) -> const any&;
332−
333− #define DEFINE_OPERATOR(op, ty, rty) \
334− inline friend auto operator op (const any& lhs, ty rhs) -> rty { \
335− return (ty)lhs op rhs; \
336− } \
337− inline friend auto operator op (ty lhs, const any& rhs) -> rty { \
338− return lhs op (ty)rhs; \
339− } \
340−
341− #define DEFINE_INT_OPERATOR(op, rty) \
342− inline friend auto operator op (const any& lhs, int rhs) -> rty { \
343− return (integer)lhs op (integer)rhs; \
344− } \
345− inline friend auto operator op (int lhs, const any& rhs) -> rty { \
346− return (integer)lhs op (integer)rhs; \
347− }
348−
349− #define DECLARE_COMPARISON_OPERATOR(op) \
350− friend auto operator op (const any&, const any&) -> bool; \
351− DEFINE_OPERATOR(op, integer, bool) \
352− DEFINE_OPERATOR(op, double, bool) \
353− DEFINE_OPERATOR(op, char, bool) \
354− DEFINE_INT_OPERATOR(op, bool) \
355− friend auto operator op (const any&, const char * const) -> bool; \
356− friend auto operator op (const char * const, const any&) -> bool;
357−
358− DECLARE_COMPARISON_OPERATOR(==)
359− DECLARE_COMPARISON_OPERATOR(!=)
360− DECLARE_COMPARISON_OPERATOR(<)
361− DECLARE_COMPARISON_OPERATOR(<=)
362− DECLARE_COMPARISON_OPERATOR(>)
363− DECLARE_COMPARISON_OPERATOR(>=)
364−
365− friend auto operator+(const any&, const any&) -> any;
366−
367− DEFINE_OPERATOR(+, integer, integer)
368− DEFINE_OPERATOR(+, double, double)
369− DEFINE_OPERATOR(+, char, char)
370− DEFINE_INT_OPERATOR(+, integer)
371− friend auto operator+(const any& lhs, const char * const rhs) -> std::string;
372− friend auto operator+(const char * const lhs, const any& rhs) -> std::string;
373−
374− friend auto operator-(const any&, const any&) -> any;
375−
376− DEFINE_OPERATOR(-, integer, integer)
377− DEFINE_OPERATOR(-, double, double)
378− DEFINE_OPERATOR(-, char, char)
379− DEFINE_INT_OPERATOR(-, integer)
380−
381− friend auto operator*(const any&, const any&) -> any;
382−
383− DEFINE_OPERATOR(*, integer, integer)
384− DEFINE_OPERATOR(*, double, double)
385− DEFINE_OPERATOR(*, char, char)
386− DEFINE_INT_OPERATOR(*, integer)
387−
388− friend auto operator/(const any&, const any&) -> any;
389−
390− DEFINE_OPERATOR(/, integer, integer)
391− DEFINE_OPERATOR(/, double, double)
392− DEFINE_OPERATOR(/, char, char)
393− DEFINE_INT_OPERATOR(/, integer)
394−
395− friend auto operator%(const any&, const any&) -> any;
396−
397− DEFINE_OPERATOR(%, integer, integer)
398− DEFINE_OPERATOR(%, char, char)
399− DEFINE_INT_OPERATOR(%, integer)
400−
401− friend auto operator-(const any&) -> any; // unary negate
402−};
403−
404−template <typename T>
405−inline auto cast(const any& a) ->
406− typename std::enable_if<std::is_arithmetic<T>::value ||
407− std::is_same<T,cstring>::value, T>::type {
408− return a;
409−}
410−
411−template <typename T>
412−inline auto cast(const any& a) ->
413− typename std::enable_if<std::is_same<T, any::map>::value ||
414− std::is_same<T, any::data>::value ||
415− std::is_same<T, any::array>::value, const T&>::type {
416− return a;
417−}
418−
419−template <typename T, typename = typename std::enable_if<std::is_class<T>::value>::type>
420−inline auto cast(const any& a) ->
421− typename std::enable_if<!std::is_same<T, any::map>::value &&
422− !std::is_same<T, any::data>::value &&
423− !std::is_same<T, any::array>::value, T&>::type {
424− return *static_cast<T*>(a.extractPointer());
425−}
426−
427−template <typename T>
428−inline auto cast(const any& a) ->
429− typename std::enable_if<std::is_same<void*, T>::value, T>::type {
430− return a.rawPointer();
431−}
432−
433−} // namespace PureScript
434−
435−#undef WITH_ALLOCATOR
436−#undef IS_POINTER_TYPE
437−#undef DEFINE_OPERATOR
438−#undef DEFINE_INT_OPERATOR
439−#undef DECLARE_COMPARISON_OPERATOR
440−
441−#endif // PureScript_HH
pcc/include/purescript_memory.hhdeleted−59
@@ -1,59 +0,0 @@
1−///////////////////////////////////////////////////////////////////////////////
2−//
3−// Module : purescript_memory.hh
4−// Copyright : (c) Andy Arvanitis 2016
5−// License : MIT
6−//
7−// Maintainer : Andy Arvanitis <andy.arvanitis@gmail.com>
8−// Stability : experimental
9−// Portability :
10−//
11−// Includes and macros for garbage collection options
12−//
13−///////////////////////////////////////////////////////////////////////////////
14−//
15−#ifndef PureScript_MEMORY_HH
16−#define PureScript_MEMORY_HH
17−
18−#if defined(USE_GC)
19− #define GC_THREADS
20− #include <gc/gc_cpp.h>
21− #include <gc/gc_allocator.h>
22− #define WITH_ALLOCATOR(T) , traceable_allocator<T>
23− #define MANAGED_TYPE(T) T*
24− #define MAKE_MANAGED(T) new (GC) T
25− #define MAKE_MANAGED_FINALIZED(T) new (GC, [](void* p, void*){ static_cast<T*>(p)->~T(); }) T
26− #define IS_POINTER_TYPE(T) std::is_pointer<T>
27− #define POINTER_FROM_MEMBER(P) P
28− #define INITIALIZE_GC(_) GC_INIT()
29−#else
30− #include <memory>
31− #define WITH_ALLOCATOR(_)
32− #define MANAGED_TYPE(T) std::shared_ptr<T>
33− #define MAKE_MANAGED(T) std::make_shared<T>
34− #define MAKE_MANAGED_FINALIZED(T) MAKE_MANAGED(T)
35− #define IS_POINTER_TYPE(T) std::is_assignable<managed<void>,T>
36− #define POINTER_FROM_MEMBER(P) P.get()
37− #define INITIALIZE_GC(_)
38−#endif
39−
40−namespace PureScript {
41− template <typename T>
42− using managed = MANAGED_TYPE(T);
43−
44− template <typename T, typename... Args>
45− inline static auto make_managed(Args&&... args) -> MANAGED_TYPE(T) {
46− return MAKE_MANAGED(T)(std::forward<Args>(args)...);
47− }
48−
49− template <typename T, typename... Args>
50− inline static auto make_managed_and_finalized(Args&&... args) -> MANAGED_TYPE(T) {
51− return MAKE_MANAGED_FINALIZED(T)(std::forward<Args>(args)...);
52− }
53−}
54−
55−#undef MANAGED_TYPE
56−#undef MAKE_MANAGED
57−#undef MAKE_MANAGED_FINALIZED
58−
59−#endif // PureScript_MEMORY_HH
psc-bundle/Main.hsdeleted−127
@@ -1,127 +0,0 @@
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 (takeFileName, 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−-- | Given a filename, assuming it is in the correct place on disk, infer a ModuleIdentifier.
41−guessModuleIdentifier :: (MonadError ErrorMessage m) => FilePath -> m ModuleIdentifier
42−guessModuleIdentifier filename = ModuleIdentifier (takeFileName (takeDirectory filename)) <$> guessModuleType (takeFileName filename)
43− where
44− guessModuleType "index.js" = pure Regular
45− guessModuleType "foreign.js" = pure Foreign
46− guessModuleType name = throwError $ UnsupportedModulePath name
47−
48−-- | The main application function.
49−-- This function parses the input files, performs dead code elimination, filters empty modules
50−-- and generates and prints the final Javascript bundle.
51−app :: (MonadError ErrorMessage m, MonadIO m) => Options -> m String
52−app Options{..} = do
53− inputFiles <- concat <$> mapM (liftIO . glob) optionsInputFiles
54− when (null inputFiles) . liftIO $ do
55− hPutStrLn stderr "psc-bundle: No input files."
56− exitFailure
57− input <- for inputFiles $ \filename -> do
58− js <- liftIO (readUTF8File filename)
59− mid <- guessModuleIdentifier filename
60− length js `seq` return (mid, js) -- evaluate readFile till EOF before returning, not to exhaust file handles
61−
62− let entryIds = map (`ModuleIdentifier` Regular) optionsEntryPoints
63−
64− bundle input entryIds optionsMainModule optionsNamespace
65−
66−-- | Command line options parser.
67−options :: Parser Options
68−options = Options <$> some inputFile
69− <*> optional outputFile
70− <*> many entryPoint
71− <*> optional mainModule
72− <*> namespace
73− where
74− inputFile :: Parser FilePath
75− inputFile = strArgument $
76− metavar "FILE"
77− <> help "The input .js file(s)"
78−
79− outputFile :: Parser FilePath
80− outputFile = strOption $
81− short 'o'
82− <> long "output"
83− <> help "The output .js file"
84−
85− entryPoint :: Parser String
86− entryPoint = strOption $
87− short 'm'
88− <> long "module"
89− <> help "Entry point module name(s). All code which is not a transitive dependency of an entry point module will be removed."
90−
91− mainModule :: Parser String
92− mainModule = strOption $
93− long "main"
94− <> help "Generate code to run the main method in the specified module."
95−
96− namespace :: Parser String
97− namespace = strOption $
98− short 'n'
99− <> long "namespace"
100− <> Opts.value "PS"
101− <> showDefault
102− <> help "Specify the namespace that PureScript modules will be exported to when running in the browser."
103−
104−-- | Make it go.
105−main :: IO ()
106−main = do
107− hSetEncoding stdout utf8
108− hSetEncoding stderr utf8
109− opts <- execParser (info (version <*> helper <*> options) infoModList)
110− output <- runExceptT (app opts)
111− case output of
112− Left err -> do
113− hPutStrLn stderr (unlines (printErrorMessage err))
114− exitFailure
115− Right js ->
116− case optionsOutputFile opts of
117− Just outputFile -> do
118− createDirectoryIfMissing True (takeDirectory outputFile)
119− writeFile outputFile js
120− Nothing -> putStrLn js
121− where
122− infoModList = fullDesc <> headerInfo <> footerInfo
123− headerInfo = header "psc-bundle - Bundles compiled PureScript modules for the browser"
124− footerInfo = footer $ "psc-bundle " ++ showVersion Paths.version
125−
126− version :: Parser (a -> a)
127− version = abortOption (InfoMsg (showVersion Paths.version)) $ long "version" <> help "Show the version number" <> hidden
psc-bundle/README.mddeleted−18
@@ -1,18 +0,0 @@
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.hsdeleted−13
@@ -1,13 +0,0 @@
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.hsdeleted−13
@@ -1,13 +0,0 @@
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.hsdeleted−250
@@ -1,250 +0,0 @@
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 False 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.hsdeleted−18
@@ -1,18 +0,0 @@
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.hsdeleted−56
@@ -1,56 +0,0 @@
1−{-# LANGUAGE OverloadedStrings #-}
2−module Main where
3−
4−import Prelude ()
5−import Prelude.Compat
6−
7−import Control.Exception
8−import Data.Text (Text)
9−import qualified Data.Text as T
10−import qualified Data.Text.IO as T
11−import Data.Version (showVersion)
12−import Network
13−import Options.Applicative
14−import System.Exit
15−import System.IO
16−
17−import qualified Paths_purescript as Paths
18−
19−data Options = Options
20− { optionsPort :: PortID
21− }
22−
23−main :: IO ()
24−main = do
25− Options port <- execParser opts
26− client port
27− where
28− parser =
29− Options <$>
30− (PortNumber . fromIntegral <$>
31− option auto (long "port" <> short 'p' <> value (4242 :: Integer)))
32− opts = info (version <*> helper <*> parser) mempty
33− version = abortOption (InfoMsg (showVersion Paths.version)) $ long "version" <> help "Show the version number" <> hidden
34−
35−client :: PortID -> IO ()
36−client port = do
37− h <-
38− connectTo "127.0.0.1" port `catch`
39− (\(SomeException e) ->
40− putStrLn
41− ("Couldn't connect to psc-ide-server on port: " ++
42− show port ++ " Error: " ++ show e) >>
43− exitFailure)
44− cmd <- T.getLine
45− -- Temporary fix for emacs windows bug
46− let cleanedCmd = removeSurroundingTicks cmd
47− --
48− T.hPutStrLn h cleanedCmd
49− res <- T.hGetLine h
50− putStrLn (T.unpack res)
51− hFlush stdout
52− hClose h
53−
54−-- TODO: Fix this in the emacs plugin by using a real process over shellcommands
55−removeSurroundingTicks :: Text -> Text
56−removeSurroundingTicks = T.dropWhile (== '\'') . T.dropWhileEnd (== '\'')
psc-ide-server/Main.hsdeleted−167
@@ -1,167 +0,0 @@
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−
21−module Main where
22−
23−import Prelude ()
24−import Prelude.Compat
25−
26−import Control.Concurrent (forkFinally)
27−import Control.Concurrent.STM
28−import Control.Exception (bracketOnError, catchJust)
29−import Control.Monad
30−import Control.Monad.Error.Class
31−import "monad-logger" Control.Monad.Logger
32−import Control.Monad.Reader
33−import Control.Monad.Trans.Except
34−import qualified Data.Text as T
35−import qualified Data.Text.IO as T
36−import Data.Version (showVersion)
37−import Language.PureScript.Ide
38−import Language.PureScript.Ide.Util
39−import Language.PureScript.Ide.Error
40−import Language.PureScript.Ide.Types
41−import Language.PureScript.Ide.Watcher
42−import Network hiding (socketPort, accept)
43−import Network.BSD (getProtocolNumber)
44−import Network.Socket hiding (PortNumber, Type,
45− sClose)
46−import Options.Applicative
47−import System.Directory
48−import System.FilePath
49−import System.IO
50−import System.IO.Error (isEOFError)
51−
52−import qualified Paths_purescript as Paths
53−
54−-- "Borrowed" from the Idris Compiler
55−-- Copied from upstream impl of listenOn
56−-- bound to localhost interface instead of iNADDR_ANY
57−listenOnLocalhost :: PortID -> IO Socket
58−listenOnLocalhost (PortNumber port) = do
59− proto <- getProtocolNumber "tcp"
60− localhost <- inet_addr "127.0.0.1"
61− bracketOnError
62− (socket AF_INET Stream proto)
63− sClose
64− (\sock -> do
65− setSocketOption sock ReuseAddr 1
66− bindSocket sock (SockAddrInet port localhost)
67− listen sock maxListenQueue
68− pure sock)
69−listenOnLocalhost _ = error "Wrong Porttype"
70−
71−data Options = Options
72− { optionsDirectory :: Maybe FilePath
73− , optionsOutputPath :: FilePath
74− , optionsPort :: PortID
75− , optionsNoWatch :: Bool
76− , optionsDebug :: Bool
77− }
78−
79−main :: IO ()
80−main = do
81− Options dir outputPath port noWatch debug <- execParser opts
82− maybe (pure ()) setCurrentDirectory dir
83− serverState <- newTVarIO emptyPscIdeState
84− cwd <- getCurrentDirectory
85− let fullOutputPath = cwd </> outputPath
86−
87− doesDirectoryExist fullOutputPath
88− >>= flip unless
89− (do putStrLn ("Your output directory didn't exist. I'll create it at: " <> fullOutputPath)
90− createDirectory fullOutputPath
91− putStrLn "This usually means you didn't compile your project yet."
92− putStrLn "psc-ide needs you to compile your project (for example by running pulp build)")
93−
94− unless noWatch $
95− void (forkFinally (watcher serverState fullOutputPath) print)
96−
97− let conf = Configuration {confDebug = debug, confOutputPath = outputPath}
98− env = PscIdeEnvironment {envStateVar = serverState, envConfiguration = conf}
99− startServer port env
100− where
101− parser =
102− Options
103− <$> optional (strOption (long "directory" <> short 'd'))
104− <*> strOption (long "output-directory" <> value "output/")
105− <*> (PortNumber . fromIntegral <$>
106− option auto (long "port" <> short 'p' <> value (4242 :: Integer)))
107− <*> switch (long "no-watch")
108− <*> switch (long "debug")
109− opts = info (version <*> helper <*> parser) mempty
110− version = abortOption
111− (InfoMsg (showVersion Paths.version))
112− (long "version" <> help "Show the version number")
113−
114−startServer :: PortID -> PscIdeEnvironment -> IO ()
115−startServer port env = withSocketsDo $ do
116− sock <- listenOnLocalhost port
117− runLogger (runReaderT (forever (loop sock)) env)
118− where
119− runLogger = runStdoutLoggingT . filterLogger (\_ _ -> confDebug (envConfiguration env))
120−
121− loop :: (PscIde m, MonadLogger m) => Socket -> m ()
122− loop sock = do
123− accepted <- runExceptT $ acceptCommand sock
124− case accepted of
125− Left err -> $(logDebug) err
126− Right (cmd, h) -> do
127− case decodeT cmd of
128− Just cmd' -> do
129− result <- runExceptT (handleCommand cmd')
130− -- $(logDebug) ("Answer was: " <> T.pack (show result))
131− liftIO (hFlush stdout)
132− case result of
133− -- What function can I use to clean this up?
134− Right r -> liftIO $ T.hPutStrLn h (encodeT r)
135− Left err -> liftIO $ T.hPutStrLn h (encodeT err)
136− Nothing -> do
137− $(logDebug) ("Parsing the command failed. Command: " <> cmd)
138− liftIO $ do
139− T.hPutStrLn h (encodeT (GeneralError "Error parsing Command."))
140− hFlush stdout
141− liftIO (hClose h)
142−
143−
144−acceptCommand :: (MonadIO m, MonadLogger m, MonadError T.Text m)
145− => Socket -> m (T.Text, Handle)
146−acceptCommand sock = do
147− h <- acceptConnection
148− $(logDebug) "Accepted a connection"
149− cmd' <- liftIO (catchJust
150− -- this means that the connection was
151− -- terminated without receiving any input
152− (\e -> if isEOFError e then Just () else Nothing)
153− (Just <$> T.hGetLine h)
154− (const (pure Nothing)))
155− case cmd' of
156− Nothing -> throwError "Connection was closed before any input arrived"
157− Just cmd -> do
158− $(logDebug) cmd
159− pure (cmd, h)
160− where
161− acceptConnection = liftIO $ do
162− -- Use low level accept to prevent accidental reverse name resolution
163− (s,_) <- accept sock
164− h <- socketToHandle s ReadWriteMode
165− hSetEncoding h utf8
166− hSetBuffering h LineBuffering
167− pure h
psc-ide-server/PROTOCOL.mddeleted−527
@@ -1,527 +0,0 @@
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− - `dependencies :: (optional) [ModuleName]`: A list of modules to load
19− including their dependencies. In contrast to the `module` field, all the
20− imports in these Modules will also be loaded.
21−
22−```json
23−{
24− "command": "load",
25− "params": (optional) {
26− "modules": (optional)["Module.Name1", "Module.Name2"],
27− "dependencies": (optional)["Module.Name3"]
28− }
29−}
30−```
31−
32−**Result:**
33−
34−The Load Command returns a string.
35−
36−### Type
37−The `type` command looks up the type for a given identifier.
38−
39−**Params:**
40− - `search :: String`: The identifier to look for. Only matches on equality.
41− - `filters :: [Filter]`: These filters will be applied before looking for the
42− identifier. These filters get combined with *AND*, so a candidate must match *ALL*
43− of them to be eligible.
44−```json
45−{
46− "command": "type",
47− "params": {
48− "search": "filterM",
49− "filters": [Filter]
50− }
51−}
52−```
53−
54−**Result:**
55−The possible types are returned in the same format as completions
56−
57−### Complete
58−The `complete` command looks up possible completions/corrections.
59−
60−**Params**:
61− - `filters :: [Filter]`: The same as for the `type` command. A candidate must match
62− all filters.
63− - `matcher :: (optional) Matcher`: The strategy used for matching candidates after filtering.
64− Results are scored internally and will be returned in the descending order where
65− the nth element is better then the n+1-th.
66−
67− If no matcher is given every candidate, that passes the filters, is returned in no
68− particular order.
69−```json
70−{
71− "command": "complete",
72− "params": {
73− "filters": [Filter],
74− "matcher": (optional) Matcher
75− }
76−}
77−```
78−
79−**Result:**
80−
81−The following format is returned as the Result:
82−
83−```json
84−[
85− {
86− "module": "Data.Array",
87− "identifier": "filter",
88− "type": "forall a. (a -> Boolean) -> Array a -> Array a"
89− }
90−]
91−```
92−
93−
94−### CaseSplit
95−
96−The CaseSplit command takes a line of source code, an area in that line of code
97−and replaces it with all patterns for a given type. The parameter `annotations`
98−is used to turn type annotations on or off for the constructor fields.
99−
100−```json
101−{
102− "command": "caseSplit",
103− "params": {
104− "line": "elem a as",
105− "begin": 8,
106− "end": 10,
107− "annotations": true,
108− "type": "List"
109− }
110−}
111−```
112−
113−**Result:**
114−
115−The following format is returned as the Result:
116−
117−```json
118−[
119− "elem a Nil",
120− "elem a (Cons (_ :: a) (_ :: List a))"
121−]
122−```
123−You should then be able to replace the affected line of code in the editor with the new suggestions.
124−
125−### Add Clause
126−
127−The AddClause command takes a typedeclaration and generates a function template for the given type.
128−The `annotations` option turns type annotations on or off for the function arguments.
129−
130−```json
131−{
132− "command": "addClause",
133− "params": {
134− "line": "elem :: forall a. (Eq a) => a -> List a",
135− "annotations": true
136− }
137−}
138−```
139−
140−**Result:**
141−
142−The following format is returned as the Result:
143−
144−```json
145−[
146− "elem :: forall a. (Eq a) => a -> List a",
147− "elem ( _ :: a) = ?elem"
148−]
149−```
150−You should then be able to replace the affected line of code in the editor with the new suggestions.
151−
152−### Import
153−
154−For now all of the import related commands work with a file on the filesystem.
155−
156−You can specify it with the `file` parameter.
157−
158−If you supply the optional `outfile` parameter, the output will be written to
159−that file, and an info message will be returned from the client.
160−
161−If you don't supply `outfile`, the server responds with a list of strings which,
162−when inserted into a file linewise create the module with the applied changes.
163−
164−Arguments:
165−
166−- `file` :: String
167−- `outfile` :: Maybe String
168−- `filters` :: Maybe [Filter]
169−
170−Example:
171−
172−```json
173−{
174− "command": "import",
175− "params": {
176− "file": "/home/creek/Documents/chromacannon/src/Main.purs",
177− "outfile": "/home/creek/Documents/chromacannon/src/Main.purs",
178− "filters": [{
179− "filter": "modules",
180− "params": {
181− "modules": ["My.Module"]
182− }
183− }],
184− "importCommand": {
185− "yadda": "yadda"
186− }
187− }
188−}
189−```
190−
191−
192−#### Subcommand `addImplicitImport`
193−
194−This command just adds an unqualified import for the given modulename.
195−
196−Arguments:
197−- `moduleName :: String`
198−
199−Example:
200−```json
201−{
202− "command": "import",
203− "params": {
204− "file": "/home/creek/Documents/chromacannon/src/Main.purs",
205− "importCommand": {
206− "importCommand": "addImplicitImport",
207− "module": "Data.Array.LOL"
208− }
209− }
210−}
211−```
212−#### Subcommand `addImport`
213−
214−This command takes an identifier and searches the currently loaded modules for
215−it. If it finds no matches it responds with an Error. If it finds exactly one
216−match it adds the import and returns. If it finds more than one match it
217−responds with a list of the found matches as completions like the complete
218−command.
219−
220−You can also supply a list of filters like the ones for completion. This way you
221−can narrow down the search to a certain module and resolve the case in which
222−more then one match was found.
223−
224−Arguments:
225−- `moduleName :: String`
226−- `filters :: [Filter]`
227−
228−Example:
229−```json
230−{
231− "command": "import",
232− "params": {
233− "file": "/home/creek/Documents/chromacannon/src/Demo.purs",
234− "outfile": "/home/creek/Documents/chromacannon/src/Demo.purs",
235− "importCommand": {
236− "importCommand": "addImport",
237− "identifier": "bind"
238− }
239− }
240−}
241−```
242−
243−### Rebuild
244−
245−The `rebuild` command provides a fast rebuild for a single module. It doesn't
246−recompile the entire project though. All the modules dependencies need to be
247−loaded.
248−
249−Arguments:
250−- `file :: String` the path to the module to rebuild
251−
252−```json
253−{
254− "command": "rebuild",
255− "params": {
256− "file": "/path/to/file.purs"
257− }
258−}
259−```
260−
261−**Result**
262−
263−In the Success case you get a list of warnings in the compilers json format.
264−
265−In the Error case you get the errors in the compilers json format
266−
267−### Pursuit
268−The `pursuit` command looks up the packages/completions for a given identifier from Pursuit.
269−
270−**Params:**
271− - `query :: String`: With `type: "package"` this should be a module name. With
272− `type: "completion"` this can be any string to look up.
273− - `type :: String`: Takes the following values:
274− - `package`: Looks for packages that contain the given module name.
275− - `completion` Looks for declarations for the query from Pursuit.
276−
277−```json
278−{
279− "command": "pursuit",
280− "params": {
281− "query": "Data.Array",
282− "type": "package"
283− }
284−}
285−```
286−
287−**Result:**
288−
289−`package` returns:
290−
291−```json
292−[
293− {
294− "module": "Module1.Name",
295− "package": "purescript-packagename"
296− }
297−]
298−```
299−
300−`completion` returns:
301−
302−```json
303−[
304− {
305− "module": "Data.Array",
306− "identifier": "filter",
307− "type": "forall a. (a -> Boolean) -> Array a -> Array a",
308− "package": "purescript-arrays"
309− }
310−]
311−```
312−
313−### List
314−
315−#### Loaded Modules
316−
317−`list` of type `loadedModules` lists all loaded modules (This means they can be searched for completions etc)
318−
319−```json
320−{
321− "command": "list",
322− "params": {
323− "type": "loadedModules"
324− }
325−}
326−```
327−
328−#### Response:
329−
330−The list loadedModules command returns a list of strings.
331−
332−#### Available Modules
333−
334−`list` of type `availableModules` lists all available modules. (This basically
335−means the contents of the `output/` folder.))
336−
337−```json
338−{
339− "command": "list",
340− "params": {
341− "type": "availableModules"
342− }
343−}
344−```
345−
346−#### Response:
347−
348−The list availableModules command returns a list of strings.
349−
350−#### Imports
351−
352−The list commmand can also list the imports for a given file.
353−
354−```json
355−{
356− "command": "list",
357− "params": {
358− "type": "import",
359− "file": "/home/kritzcreek/Documents/psc-ide/examples/Main.purs"
360− }
361−}
362−```
363−
364−#### Response:
365−
366−The list import command returns a list of imports where imports are of the following form:
367−
368−Implicit Import(`import Data.Array`):
369−```json
370−[
371− {
372− "module": "Data.Array",
373− "importType": "implicit"
374− }
375−]
376−```
377−
378−Implicit qualified Import(`import qualified Data.Array as A`):
379−```json
380−[
381− {
382− "module": "Data.Array",
383− "importType": "implicit",
384− "qualifier": "A"
385− }
386−]
387−```
388−
389−Explicit Import(`import Data.Array (filter, filterM, join)`):
390−```json
391−[
392− {
393− "module": "Data.Array",
394− "importType": "explicit",
395− "identifiers": ["filter", "filterM", "join"]
396− }
397−]
398−```
399−
400−Hiding Import(`import Data.Array hiding (filter, filterM, join)`):
401−```json
402−[
403− {
404− "module": "Data.Array",
405− "importType": "hiding",
406− "identifiers": ["filter", "filterM", "join"]
407− }
408−]
409−```
410−### Cwd/Quit/Reset
411−`cwd` returns the working directory of the server(should be your project root).
412−
413−`quit` quits the server.
414−
415−`reset` resets all loaded modules.
416−
417−```json
418−{
419− "command": "cwd|quit|reset"
420−}
421−```
422−
423−**Result:**
424−These commands return strings.
425−
426−## Filter:
427−
428−### Exact filter
429−The Exact filter only keeps identifiers that are equal to the search term.
430−
431−```json
432−{
433− "filter": "exact",
434− "params": {
435− "search": "filterM"
436− }
437−}
438−```
439−### Prefix filter
440−The Prefix filter keeps identifiers/modules/data declarations that
441−are prefixed by the search term.
442−
443−```json
444−{
445− "filter": "prefix",
446− "params": {
447− "search": "filt"
448− }
449−}
450−```
451−
452−### Module filter
453−The Module filter only keeps identifiers that appear in the listed modules.
454−
455−```json
456−{
457− "filter": "modules",
458− "params": {
459− "modules": ["My.Module"]
460− }
461−}
462−```
463−
464−### Dependency filter
465−The Dependency filter only keeps identifiers that appear in the listed modules
466−and in any of their dependencies/imports.
467−
468−```json
469−{
470− "filter": "dependencies",
471− "params": {
472− "modules": ["My.Module"]
473− }
474−}
475−```
476−
477−## Matcher:
478−
479−### Flex matcher
480−Matches any occurence of the search string with intersections
481−
482−The scoring measures how far the matches span the string, where
483−closer is better. The matches then get sorted with highest score first.
484−
485−Examples:
486−- flMa matches **fl**ex**Ma**tcher. Score: 14.28
487−- sons matches **so**rtCompletio**ns**. Score: 6.25
488−```json
489−
490−{
491− "matcher": "flex",
492− "params": {
493− "search": "filt"
494− }
495−}
496−```
497−
498−### Distance Matcher
499−
500−The Distance matcher is meant to provide corrections for typos. It calculates
501−the edit distance in between the search and the loaded identifiers.
502−
503−```json
504−{
505− "matcher": "distance",
506− "params": {
507− "search": "dilterM",
508− "maximumDistance": 3
509− }
510−}
511−```
512−
513−## Responses
514−
515−All Responses are wrapped in the following format:
516−
517−```json
518−{
519− "resultType": "success|error",
520− "result": Result|Error
521−}
522−```
523−
524−### Error
525−
526−Errors at this point are merely Error strings. Newlines are escaped like `\n`
527−and should be taken care of by the editor-plugin.
psc-ide-server/README.mddeleted−41
@@ -1,41 +0,0 @@
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−Start the server by running the `psc-ide-server` executable.
14−It supports the following options:
15−
16−- `-p / --port` specify a port. Defaults to 4242
17−- `-d / --directory` specify the toplevel directory of your project. Defaults to
18− the current directory
19−- `--output-directory`: Specify where to look for compiled output inside your
20− project directory. Defaults to `output/`, relative to either the current
21− directory or the directory specified by `-d`.
22−- `--debug`: Enables some logging meant for debugging
23−- `--no-watch`: Disables the filewatcher
24−- `--version`: Output psc-ide version
25−
26−## Issuing queries
27−
28−After you started the server you can start issuing requests using
29−`psc-ide-client`. Make sure you start by loading the modules before you try to
30−query them.
31−
32−`psc-ide-server` expects the build externs.purs inside the `output/` folder of
33−your project after running `pulp build` or `psc-make` respectively.
34−
35−(If you changed the port of the server you can change the port for
36−`psc-ide-client` by using the -p option accordingly)
37−
38−## Protocol
39−
40−For documentation about the protocol have a look at:
41−[PROTOCOL.md](PROTOCOL.md)
psc-publish/Main.hsdeleted−50
@@ -1,50 +0,0 @@
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.hsdeleted−171
@@ -1,171 +0,0 @@
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 qualified Data.ByteString.Lazy as B
15−import qualified Data.ByteString.UTF8 as BU8
16−import qualified Data.Map as M
17−import Data.Version (showVersion)
18−
19−import qualified Language.PureScript as P
20−import Language.PureScript.Errors.JSON
21−import Language.PureScript.Make
22−
23−import Options.Applicative as Opts
24−
25−import qualified Paths_purescript as Paths
26−
27−import System.Exit (exitSuccess, exitFailure)
28−import System.FilePath.Glob (glob)
29−import System.IO (hSetEncoding, hPutStrLn, stdout, stderr, utf8)
30−import System.IO.UTF8
31−
32−data PSCMakeOptions = PSCMakeOptions
33− { pscmInput :: [FilePath]
34− , pscmOutputDir :: FilePath
35− , pscmOpts :: P.Options
36− , pscmUsePrefix :: Bool
37− , pscmJSONErrors :: Bool
38− }
39−
40−-- | Argumnets: verbose, use JSON, warnings, errors
41−printWarningsAndErrors :: Bool -> Bool -> P.MultipleErrors -> Either P.MultipleErrors a -> IO ()
42−printWarningsAndErrors verbose False warnings errors = do
43− when (P.nonEmpty warnings) $
44− hPutStrLn stderr (P.prettyPrintMultipleWarnings verbose warnings)
45− case errors of
46− Left errs -> do
47− hPutStrLn stderr (P.prettyPrintMultipleErrors verbose errs)
48− exitFailure
49− Right _ -> return ()
50−printWarningsAndErrors verbose True warnings errors = do
51− hPutStrLn stderr . BU8.toString . B.toStrict . A.encode $
52− JSONResult (toJSONErrors verbose P.Warning warnings)
53− (either (toJSONErrors verbose P.Error) (const []) errors)
54− either (const exitFailure) (const (return ())) errors
55−
56−compile :: PSCMakeOptions -> IO ()
57−compile PSCMakeOptions{..} = do
58− input <- globWarningOnMisses (unless pscmJSONErrors . warnFileTypeNotFound) pscmInput
59− when (null input && not pscmJSONErrors) $ do
60− hPutStrLn stderr "psc: No input files."
61− exitFailure
62− moduleFiles <- readInput input
63− (makeErrors, makeWarnings) <- runMake pscmOpts $ do
64− ms <- P.parseModulesFromFiles id moduleFiles
65− let filePathMap = M.fromList $ map (\(fp, P.Module _ _ mn _ _) -> (mn, Right fp)) ms
66− foreigns <- inferForeignModules filePathMap
67− let makeActions = buildMakeActions pscmOutputDir filePathMap foreigns pscmUsePrefix
68− P.make makeActions (map snd ms)
69− printWarningsAndErrors (P.optionsVerboseErrors pscmOpts) pscmJSONErrors makeWarnings makeErrors
70− exitSuccess
71−
72−warnFileTypeNotFound :: String -> IO ()
73−warnFileTypeNotFound = hPutStrLn stderr . ("psc: No files found using pattern: " ++)
74−
75−globWarningOnMisses :: (String -> IO ()) -> [FilePath] -> IO [FilePath]
76−globWarningOnMisses warn = concatMapM globWithWarning
77− where
78− globWithWarning pattern = do
79− paths <- glob pattern
80− when (null paths) $ warn pattern
81− return paths
82− concatMapM f = liftM concat . mapM f
83−
84−readInput :: [FilePath] -> IO [(FilePath, String)]
85−readInput inputFiles = forM inputFiles $ \inFile -> (inFile, ) <$> readUTF8File inFile
86−
87−inputFile :: Parser FilePath
88−inputFile = strArgument $
89− metavar "FILE"
90− <> help "The input .purs file(s)"
91−
92−outputDirectory :: Parser FilePath
93−outputDirectory = strOption $
94− short 'o'
95− <> long "output"
96− <> Opts.value "output"
97− <> showDefault
98− <> help "The output directory"
99−
100−noTco :: Parser Bool
101−noTco = switch $
102− long "no-tco"
103− <> help "Disable tail call optimizations"
104−
105−noMagicDo :: Parser Bool
106−noMagicDo = switch $
107− long "no-magic-do"
108− <> help "Disable the optimization that overloads the do keyword to generate efficient code specifically for the Eff monad"
109−
110−noOpts :: Parser Bool
111−noOpts = switch $
112− long "no-opts"
113− <> help "Skip the optimization phase"
114−
115−comments :: Parser Bool
116−comments = switch $
117− short 'c'
118− <> long "comments"
119− <> help "Include comments in the generated code"
120−
121−verboseErrors :: Parser Bool
122−verboseErrors = switch $
123− short 'v'
124− <> long "verbose-errors"
125− <> help "Display verbose error messages"
126−
127−noPrefix :: Parser Bool
128−noPrefix = switch $
129− short 'p'
130− <> long "no-prefix"
131− <> help "Do not include comment header"
132−
133−jsonErrors :: Parser Bool
134−jsonErrors = switch $
135− long "json-errors"
136− <> help "Print errors to stderr as JSON"
137−sourceMaps :: Parser Bool
138−sourceMaps = switch $
139− long "source-maps"
140− <> help "Generate source maps"
141−
142−
143−options :: Parser P.Options
144−options = P.Options <$> noTco
145− <*> noMagicDo
146− <*> pure Nothing
147− <*> noOpts
148− <*> verboseErrors
149− <*> (not <$> comments)
150− <*> sourceMaps
151−
152−pscMakeOptions :: Parser PSCMakeOptions
153−pscMakeOptions = PSCMakeOptions <$> many inputFile
154− <*> outputDirectory
155− <*> options
156− <*> (not <$> noPrefix)
157− <*> jsonErrors
158−
159−main :: IO ()
160−main = do
161− hSetEncoding stdout utf8
162− hSetEncoding stderr utf8
163− execParser opts >>= compile
164− where
165− opts = info (version <*> helper <*> pscMakeOptions) infoModList
166− infoModList = fullDesc <> headerInfo <> footerInfo
167− headerInfo = header "psc - Compiles PureScript to Javascript"
168− footerInfo = footer $ "psc " ++ showVersion Paths.version
169−
170− version :: Parser (a -> a)
171− version = abortOption (InfoMsg (showVersion Paths.version)) $ long "version" <> help "Show the version number" <> hidden
psci/Main.hsdeleted−132
@@ -1,132 +0,0 @@
1−{-# LANGUAGE DataKinds #-}
2−{-# LANGUAGE DoAndIfThenElse #-}
3−{-# LANGUAGE GeneralizedNewtypeDeriving #-}
4−{-# LANGUAGE MultiParamTypeClasses #-}
5−{-# LANGUAGE RecordWildCards #-}
6−{-# LANGUAGE ScopedTypeVariables #-}
7−{-# LANGUAGE TupleSections #-}
8−
9−module Main (main) where
10−
11−import Prelude ()
12−import Prelude.Compat
13−
14−import Data.Monoid ((<>))
15−import Data.Version (showVersion)
16−
17−import Control.Applicative (many)
18−import Control.Monad
19−import Control.Monad.IO.Class (liftIO)
20−import Control.Monad.Trans.Class
21−import Control.Monad.Trans.Except (ExceptT(..), runExceptT)
22−import Control.Monad.Trans.State.Strict (StateT, evalStateT)
23−import Control.Monad.Trans.Reader (ReaderT, runReaderT)
24−
25−import qualified Language.PureScript as P
26−import Language.PureScript.Interactive
27−
28−import qualified Options.Applicative as Opts
29−
30−import qualified Paths_purescript as Paths
31−
32−import System.Console.Haskeline
33−import System.Exit
34−import System.FilePath.Glob (glob)
35−
36−-- | Command line options
37−data PSCiOptions = PSCiOptions
38− { psciMultiLineMode :: Bool
39− , psciInputFile :: [FilePath]
40− , psciInputNodeFlags :: [String]
41− }
42−
43−multiLineMode :: Opts.Parser Bool
44−multiLineMode = Opts.switch $
45− Opts.long "multi-line-mode"
46− <> Opts.short 'm'
47− <> Opts.help "Run in multi-line mode (use ^D to terminate commands)"
48−
49−inputFile :: Opts.Parser FilePath
50−inputFile = Opts.strArgument $
51− Opts.metavar "FILE"
52− <> Opts.help "Optional .purs files to load on start"
53−
54−nodeFlagsFlag :: Opts.Parser [String]
55−nodeFlagsFlag = Opts.option parser $
56− Opts.long "node-opts"
57− <> Opts.metavar "NODE_OPTS"
58− <> Opts.value []
59− <> Opts.help "Flags to pass to node, separated by spaces"
60− where
61− parser = words <$> Opts.str
62−
63−psciOptions :: Opts.Parser PSCiOptions
64−psciOptions = PSCiOptions <$> multiLineMode
65− <*> many inputFile
66− <*> nodeFlagsFlag
67−
68−version :: Opts.Parser (a -> a)
69−version = Opts.abortOption (Opts.InfoMsg (showVersion Paths.version)) $
70− Opts.long "version" <>
71− Opts.help "Show the version number" <>
72− Opts.hidden
73−
74−getOpt :: IO PSCiOptions
75−getOpt = Opts.execParser opts
76− where
77− opts = Opts.info (version <*> Opts.helper <*> psciOptions) infoModList
78− infoModList = Opts.fullDesc <> headerInfo <> footerInfo
79− headerInfo = Opts.header "psci - Interactive mode for PureScript"
80− footerInfo = Opts.footer $ "psci " ++ showVersion Paths.version
81−
82−-- | Parses the input and returns either a command, or an error as a 'String'.
83−getCommand :: forall m. MonadException m => Bool -> InputT m (Either String (Maybe Command))
84−getCommand singleLineMode = handleInterrupt (return (Right Nothing)) $ do
85− firstLine <- withInterrupt $ getInputLine "> "
86− case firstLine of
87− Nothing -> return (Right (Just QuitPSCi)) -- Ctrl-D when input is empty
88− Just "" -> return (Right Nothing)
89− Just s | singleLineMode || head s == ':' -> return . fmap Just $ parseCommand s
90− Just s -> fmap Just . parseCommand <$> go [s]
91− where
92− go :: [String] -> InputT m String
93− go ls = maybe (return . unlines $ reverse ls) (go . (:ls)) =<< getInputLine " "
94−
95−-- | Get command line options and drop into the REPL
96−main :: IO ()
97−main = getOpt >>= loop
98− where
99− loop :: PSCiOptions -> IO ()
100− loop PSCiOptions{..} = do
101− inputFiles <- concat <$> traverse glob psciInputFile
102− e <- runExceptT $ do
103− modules <- ExceptT (loadAllModules inputFiles)
104− unless (supportModuleIsDefined (map snd modules)) . liftIO $ do
105− putStrLn supportModuleMessage
106− exitFailure
107− (externs, env) <- ExceptT . runMake . make $ modules
108− return (modules, externs, env)
109− case e of
110− Left errs -> putStrLn (P.prettyPrintMultipleErrors False errs) >> exitFailure
111− Right (modules, externs, env) -> do
112− historyFilename <- getHistoryFilename
113− let settings = defaultSettings { historyFile = Just historyFilename }
114− initialState = PSCiState [] [] (zip (map snd modules) externs)
115− config = PSCiConfig inputFiles psciInputNodeFlags env
116− runner = flip runReaderT config
117− . flip evalStateT initialState
118− . runInputT (setComplete completion settings)
119− putStrLn prologueMessage
120− runner go
121− where
122− go :: InputT (StateT PSCiState (ReaderT PSCiConfig IO)) ()
123− go = do
124− c <- getCommand (not psciMultiLineMode)
125− case c of
126− Left err -> outputStrLn err >> go
127− Right Nothing -> go
128− Right (Just QuitPSCi) -> outputStrLn quitMessage
129− Right (Just c') -> do
130− handleInterrupt (outputStrLn "Interrupted.")
131− (withInterrupt (lift (handleCommand c')))
132− go
psgo.cabalnew file+145
@@ -0,0 +1,145 @@
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.cabaldeleted−540
@@ -1,540 +0,0 @@
1−name: purescript
2−version: 0.9.0
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/2018/*.purs
24− , examples/passing/ClassRefSyntax/*.purs
25− , examples/passing/DctorOperatorAlias/*.purs
26− , examples/passing/ExplicitImportReExport/*.purs
27− , examples/passing/ExportExplicit/*.purs
28− , examples/passing/ExportExplicit2/*.purs
29− , examples/passing/Import/*.purs
30− , examples/passing/ImportExplicit/*.purs
31− , examples/passing/ImportQualified/*.purs
32− , examples/passing/Module/*.purs
33− , examples/passing/ModuleDeps/*.purs
34− , examples/passing/ModuleExport/*.purs
35− , examples/passing/ModuleExportDupes/*.purs
36− , examples/passing/ModuleExportExcluded/*.purs
37− , examples/passing/ModuleExportQualified/*.purs
38− , examples/passing/ModuleExportSelf/*.purs
39− , examples/passing/NonConflictingExports/*.purs
40− , examples/passing/OperatorAliasElsewhere/*.purs
41− , examples/passing/PendingConflictingImports/*.purs
42− , examples/passing/PendingConflictingImports2/*.purs
43− , examples/passing/QualifiedNames/*.purs
44− , examples/passing/RedefinedFixity/*.purs
45− , examples/passing/ReExportQualified/*.purs
46− , examples/passing/ResolvableScopeConflict/*.purs
47− , examples/passing/ResolvableScopeConflict2/*.purs
48− , examples/passing/ResolvableScopeConflict3/*.purs
49− , examples/passing/ShadowedModuleName/*.purs
50− , examples/passing/TransitiveImport/*.purs
51− , examples/passing/TypeOperators/*.purs
52− , examples/passing/TypeWithoutParens/*.purs
53− , examples/failing/*.purs
54− , examples/failing/1733/*.purs
55− , examples/failing/ConflictingExports/*.purs
56− , examples/failing/ConflictingImports/*.purs
57− , examples/failing/ConflictingImports2/*.purs
58− , examples/failing/ConflictingQualifiedImports/*.purs
59− , examples/failing/ConflictingQualifiedImports2/*.purs
60− , examples/failing/ExportExplicit1/*.purs
61− , examples/failing/ExportExplicit3/*.purs
62− , examples/failing/ImportExplicit/*.purs
63− , examples/failing/ImportExplicit2/*.purs
64− , examples/failing/ImportHidingModule/*.purs
65− , examples/failing/ImportModule/*.purs
66− , examples/failing/InstanceExport/*.purs
67− , examples/failing/OrphanInstance/*.purs
68− , examples/failing/OverlappingReExport/*.purs
69− , examples/docs/bower_components/purescript-prelude/src/*.purs
70− , examples/docs/bower.json
71− , examples/docs/src/*.purs
72− , tests/support/package.json
73− , tests/support/bower.json
74− , tests/support/setup-win.cmd
75− , tests/support/psci/*.purs
76− , tests/support/pscide/src/*.purs
77− , tests/support/pscide/src/*.js
78− , tests/support/pscide/src/*.fail
79− , stack.yaml
80− , README.md
81− , INSTALL.md
82− , CONTRIBUTORS.md
83− , CONTRIBUTING.md
84− , pcc/include/*.hh
85−
86−source-repository head
87− type: git
88− location: https://github.com/purescript/purescript.git
89−
90−library
91− build-depends: base >=4.8 && <5,
92− aeson >= 0.8 && < 0.12,
93− aeson-better-errors >= 0.8,
94− base-compat >=0.6.0,
95− bower-json >= 0.8,
96− boxes >= 0.1.4 && < 0.2.0,
97− bytestring -any,
98− containers -any,
99− directory >= 1.2,
100− dlist -any,
101− edit-distance -any,
102− filepath -any,
103− fsnotify >= 0.2.1,
104− Glob >= 0.7 && < 0.8,
105− haskeline >= 0.7.0.0,
106− http-types -any,
107− language-javascript == 0.6.*,
108− lifted-base >= 0.2.3 && < 0.2.4,
109− monad-control >= 1.0.0.0 && < 1.1,
110− monad-logger >= 0.3 && < 0.4,
111− mtl >= 2.1.0 && < 2.3.0,
112− parallel >= 3.2 && < 3.3,
113− parsec >=3.1.10,
114− pattern-arrows >= 0.0.2 && < 0.1,
115− pipes >= 4.0.0 && < 4.2.0,
116− pipes-http -any,
117− process >= 1.2.0 && < 1.5,
118− regex-tdfa -any,
119− safe >= 0.3.9 && < 0.4,
120− semigroups >= 0.16.2 && < 0.19,
121− sourcemap >= 0.1.6,
122− spdx == 0.2.*,
123− split -any,
124− stm >= 0.2.4.0,
125− syb -any,
126− text -any,
127− time -any,
128− transformers >= 0.3.0 && < 0.6,
129− transformers-base >= 0.4.0 && < 0.5,
130− transformers-compat >= 0.3.0,
131− unordered-containers -any,
132− utf8-string >= 1 && < 2,
133− vector -any
134−
135− exposed-modules: Language.PureScript
136− Language.PureScript.AST
137− Language.PureScript.AST.Binders
138− Language.PureScript.AST.Declarations
139− Language.PureScript.AST.Operators
140− Language.PureScript.AST.Literals
141− Language.PureScript.AST.SourcePos
142− Language.PureScript.AST.Traversals
143− Language.PureScript.AST.Exported
144− Language.PureScript.Bundle
145− Language.PureScript.Crash
146− Language.PureScript.Externs
147− Language.PureScript.CodeGen
148− Language.PureScript.CodeGen.JS
149− Language.PureScript.CodeGen.JS.AST
150− Language.PureScript.CodeGen.JS.Common
151− Language.PureScript.CodeGen.JS.Optimizer
152− Language.PureScript.CodeGen.JS.Optimizer.Blocks
153− Language.PureScript.CodeGen.JS.Optimizer.Common
154− Language.PureScript.CodeGen.JS.Optimizer.Inliner
155− Language.PureScript.CodeGen.JS.Optimizer.MagicDo
156− Language.PureScript.CodeGen.JS.Optimizer.TCO
157− Language.PureScript.CodeGen.JS.Optimizer.Unused
158−
159− Language.PureScript.CodeGen.Cpp
160− Language.PureScript.CodeGen.Cpp.AST
161− Language.PureScript.CodeGen.Cpp.Common
162− Language.PureScript.CodeGen.Cpp.File
163− Language.PureScript.CodeGen.Cpp.Optimizer
164− Language.PureScript.CodeGen.Cpp.Optimizer.Blocks
165− Language.PureScript.CodeGen.Cpp.Optimizer.Common
166− Language.PureScript.CodeGen.Cpp.Optimizer.Inliner
167− Language.PureScript.CodeGen.Cpp.Optimizer.MagicDo
168− Language.PureScript.CodeGen.Cpp.Optimizer.TCO
169− Language.PureScript.CodeGen.Cpp.Optimizer.Unused
170− Language.PureScript.CodeGen.Cpp.Types
171− Language.PureScript.Pretty.Cpp
172−
173− Language.PureScript.Constants
174− Language.PureScript.CoreFn
175− Language.PureScript.CoreFn.Ann
176− Language.PureScript.CoreFn.Binders
177− Language.PureScript.CoreFn.Desugar
178− Language.PureScript.CoreFn.Expr
179− Language.PureScript.CoreFn.Meta
180− Language.PureScript.CoreFn.Module
181− Language.PureScript.CoreFn.Traversals
182− Language.PureScript.Comments
183− Language.PureScript.Environment
184− Language.PureScript.Errors
185− Language.PureScript.Errors.JSON
186− Language.PureScript.Kinds
187− Language.PureScript.Linter
188− Language.PureScript.Linter.Exhaustive
189− Language.PureScript.Linter.Imports
190− Language.PureScript.Make
191− Language.PureScript.ModuleDependencies
192− Language.PureScript.Names
193− Language.PureScript.Options
194− Language.PureScript.Parser
195− Language.PureScript.Parser.Lexer
196− Language.PureScript.Parser.Common
197− Language.PureScript.Parser.Declarations
198− Language.PureScript.Parser.Kinds
199− Language.PureScript.Parser.State
200− Language.PureScript.Parser.Types
201− Language.PureScript.Pretty
202− Language.PureScript.Pretty.Common
203− Language.PureScript.Pretty.JS
204− Language.PureScript.Pretty.Kinds
205− Language.PureScript.Pretty.Types
206− Language.PureScript.Pretty.Values
207− Language.PureScript.Renamer
208− Language.PureScript.Sugar
209− Language.PureScript.Sugar.BindingGroups
210− Language.PureScript.Sugar.CaseDeclarations
211− Language.PureScript.Sugar.DoNotation
212− Language.PureScript.Sugar.Names
213− Language.PureScript.Sugar.Names.Common
214− Language.PureScript.Sugar.Names.Env
215− Language.PureScript.Sugar.Names.Exports
216− Language.PureScript.Sugar.Names.Imports
217− Language.PureScript.Sugar.ObjectWildcards
218− Language.PureScript.Sugar.Operators
219− Language.PureScript.Sugar.Operators.Common
220− Language.PureScript.Sugar.Operators.Expr
221− Language.PureScript.Sugar.Operators.Binders
222− Language.PureScript.Sugar.Operators.Types
223− Language.PureScript.Sugar.TypeClasses
224− Language.PureScript.Sugar.TypeClasses.Deriving
225− Language.PureScript.Sugar.TypeDeclarations
226− Language.PureScript.Traversals
227− Language.PureScript.TypeChecker
228− Language.PureScript.TypeChecker.Entailment
229− Language.PureScript.TypeChecker.Kinds
230− Language.PureScript.TypeChecker.Monad
231− Language.PureScript.TypeChecker.Rows
232− Language.PureScript.TypeChecker.Skolems
233− Language.PureScript.TypeChecker.Subsumption
234− Language.PureScript.TypeChecker.Synonyms
235− Language.PureScript.TypeChecker.Types
236− Language.PureScript.TypeChecker.Unify
237− Language.PureScript.TypeClassDictionaries
238− Language.PureScript.Types
239−
240− Language.PureScript.Docs
241− Language.PureScript.Docs.Convert
242− Language.PureScript.Docs.Convert.Single
243− Language.PureScript.Docs.Convert.ReExports
244− Language.PureScript.Docs.Render
245− Language.PureScript.Docs.Types
246− Language.PureScript.Docs.RenderedCode
247− Language.PureScript.Docs.RenderedCode.Types
248− Language.PureScript.Docs.RenderedCode.Render
249− Language.PureScript.Docs.AsMarkdown
250− Language.PureScript.Docs.ParseAndBookmark
251− Language.PureScript.Docs.Utils.MonoidExtras
252−
253− Language.PureScript.Publish
254− Language.PureScript.Publish.Utils
255− Language.PureScript.Publish.ErrorsWarnings
256− Language.PureScript.Publish.BoxesHelpers
257−
258− Language.PureScript.Ide
259− Language.PureScript.Ide.Command
260− Language.PureScript.Ide.Externs
261− Language.PureScript.Ide.Error
262− Language.PureScript.Ide.Pursuit
263− Language.PureScript.Ide.Completion
264− Language.PureScript.Ide.Matcher
265− Language.PureScript.Ide.Filter
266− Language.PureScript.Ide.Types
267− Language.PureScript.Ide.State
268− Language.PureScript.Ide.CaseSplit
269− Language.PureScript.Ide.SourceFile
270− Language.PureScript.Ide.Watcher
271− Language.PureScript.Ide.Reexports
272− Language.PureScript.Ide.Imports
273− Language.PureScript.Ide.Util
274− Language.PureScript.Ide.Rebuild
275−
276− Language.PureScript.Interactive
277− Language.PureScript.Interactive.Types
278− Language.PureScript.Interactive.Parser
279− Language.PureScript.Interactive.Directive
280− Language.PureScript.Interactive.Completion
281− Language.PureScript.Interactive.IO
282− Language.PureScript.Interactive.Message
283− Language.PureScript.Interactive.Module
284− Language.PureScript.Interactive.Printer
285−
286− Control.Monad.Logger
287− Control.Monad.Supply
288− Control.Monad.Supply.Class
289−
290− System.IO.UTF8
291−
292− extensions: ConstraintKinds
293− DataKinds
294− DeriveFunctor
295− EmptyDataDecls
296− FlexibleContexts
297− KindSignatures
298− LambdaCase
299− MultiParamTypeClasses
300− NoImplicitPrelude
301− PatternGuards
302− PatternSynonyms
303− RankNTypes
304− RecordWildCards
305− ScopedTypeVariables
306− TupleSections
307− ViewPatterns
308− exposed: True
309− buildable: True
310− hs-source-dirs: src
311− other-modules: Paths_purescript
312− ghc-options: -Wall -O2
313−
314−executable psc
315− build-depends: base >=4 && <5,
316− purescript -any,
317− aeson >= 0.8 && < 0.12,
318− base-compat >=0.6.0,
319− bytestring -any,
320− containers -any,
321− directory -any,
322− filepath -any,
323− Glob >= 0.7 && < 0.8,
324− mtl -any,
325− optparse-applicative >= 0.12.1,
326− parsec -any,
327− time -any,
328− transformers -any,
329− transformers-compat -any,
330− utf8-string >= 1 && < 2
331− main-is: Main.hs
332− buildable: True
333− hs-source-dirs: psc
334− other-modules: Paths_purescript
335− ghc-options: -Wall -O2 -fno-warn-unused-do-bind -threaded -rtsopts "-with-rtsopts=-N"
336−
337−executable psci
338− build-depends: base >=4 && <5,
339− purescript -any,
340− base-compat >=0.6.0,
341− boxes >= 0.1.4 && < 0.2.0,
342− containers -any,
343− directory -any,
344− filepath -any,
345− Glob -any,
346− haskeline >= 0.7.0.0,
347− mtl -any,
348− optparse-applicative >= 0.12.1,
349− parsec -any,
350− process -any,
351− time -any,
352− transformers -any,
353− transformers-compat -any
354− main-is: Main.hs
355− buildable: True
356− hs-source-dirs: psci
357− other-modules: Paths_purescript
358− ghc-options: -Wall -O2
359−
360−executable psc-docs
361− build-depends: base >=4 && <5,
362− purescript -any,
363− ansi-wl-pprint -any,
364− directory -any,
365− filepath -any,
366− Glob -any,
367− mtl -any,
368− optparse-applicative >= 0.12.1,
369− process -any,
370− split -any,
371− transformers -any,
372− transformers-compat -any
373− main-is: Main.hs
374− other-modules: Paths_purescript
375− buildable: True
376− hs-source-dirs: psc-docs
377− other-modules: Ctags
378− Etags
379− Tags
380− ghc-options: -Wall -O2
381−
382−executable psc-publish
383− build-depends: base >=4 && <5,
384− purescript -any,
385− aeson -any,
386− bytestring -any,
387− optparse-applicative -any
388− main-is: Main.hs
389− other-modules: Paths_purescript
390− buildable: True
391− hs-source-dirs: psc-publish
392− ghc-options: -Wall -O2
393−
394−executable psc-hierarchy
395− build-depends: base >=4 && <5,
396− purescript -any,
397− directory -any,
398− filepath -any,
399− Glob -any,
400− mtl -any,
401− optparse-applicative >= 0.12.1,
402− parsec -any,
403− process -any
404− main-is: Main.hs
405− other-modules: Paths_purescript
406− buildable: True
407− hs-source-dirs: hierarchy
408− other-modules:
409− ghc-options: -Wall -O2
410−
411−executable psc-bundle
412− main-is: Main.hs
413− other-modules: Paths_purescript
414− other-extensions:
415− build-depends: base >=4 && <5,
416− purescript -any,
417− directory -any,
418− filepath -any,
419− Glob -any,
420− mtl -any,
421− optparse-applicative >= 0.12.1,
422− transformers -any,
423− transformers-compat -any
424− ghc-options: -Wall -O2
425− hs-source-dirs: psc-bundle
426−
427−executable psc-ide-server
428− main-is: Main.hs
429− other-modules: Paths_purescript
430− other-extensions:
431− build-depends: base >=4 && <5,
432− purescript -any,
433− base-compat >=0.6.0,
434− directory -any,
435− filepath -any,
436− monad-logger -any,
437− mtl -any,
438− network -any,
439− optparse-applicative >= 0.12.1,
440− stm -any,
441− text -any,
442− transformers -any,
443− transformers-compat -any
444− ghc-options: -Wall -O2 -threaded
445− hs-source-dirs: psc-ide-server
446−
447−executable psc-ide-client
448− main-is: Main.hs
449− other-modules: Paths_purescript
450− other-extensions:
451− build-depends: base >=4 && <5,
452− base-compat >=0.6.0,
453− mtl -any,
454− network -any,
455− optparse-applicative >= 0.12.1,
456− text -any
457− ghc-options: -Wall -O2
458− hs-source-dirs: psc-ide-client
459−
460−executable pcc
461− build-depends: base >=4 && <5,
462− purescript -any,
463− aeson >= 0.8 && < 0.12,
464− base-compat >=0.6.0,
465− bytestring -any,
466− containers -any,
467− directory -any,
468− filepath -any,
469− file-embed -any,
470− Glob >= 0.7 && < 0.8,
471− mtl -any,
472− optparse-applicative >= 0.12.1,
473− parsec -any,
474− time -any,
475− transformers -any,
476− transformers-compat -any,
477− utf8-string >= 1 && < 2
478− main-is: Main.hs
479− buildable: True
480− hs-source-dirs: pcc
481− other-modules: Paths_purescript
482− ghc-options: -Wall -O2 -fno-warn-unused-do-bind -threaded -rtsopts "-with-rtsopts=-N"
483−
484−
485−test-suite tests
486− build-depends: base >=4 && <5,
487− purescript -any,
488− aeson -any,
489− aeson-better-errors -any,
490− base-compat -any,
491− boxes -any,
492− bytestring -any,
493− containers -any,
494− directory -any,
495− filepath -any,
496− Glob -any,
497− haskeline >= 0.7.0.0,
498− hspec -any,
499− hspec-discover -any,
500− HUnit -any,
501− mtl -any,
502− optparse-applicative -any,
503− parsec -any,
504− process -any,
505− silently -any,
506− stm -any,
507− text -any,
508− time -any,
509− transformers -any,
510− transformers-compat -any,
511− utf8-string -any,
512− vector -any
513− ghc-options: -Wall
514− type: exitcode-stdio-1.0
515− main-is: Main.hs
516− other-modules: TestUtils
517− TestCompiler
518− TestDocs
519− TestPscPublish
520− TestPsci
521− TestPscIde
522− PscIdeSpec
523− Language.PureScript.Ide.FilterSpec
524− Language.PureScript.Ide.ImportsSpec
525− Language.PureScript.Ide.Imports.IntegrationSpec
526− Language.PureScript.Ide.Integration
527− Language.PureScript.Ide.MatcherSpec
528− Language.PureScript.Ide.RebuildSpec
529− Language.PureScript.Ide.ReexportsSpec
530− Language.PureScript.IdeSpec
531− buildable: True
532− hs-source-dirs: tests
533−
534−test-suite pcc-tests
535− build-depends: base >=4 && <5, directory -any, filepath -any, process -any
536− type: exitcode-stdio-1.0
537− main-is: TestMain.hs
538− buildable: True
539− hs-source-dirs: pcc
540−
src/CodeGen/IL.hsnew file+321
@@ -0,0 +1,321 @@
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.hsnew file+196
@@ -0,0 +1,196 @@
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.hsnew file+81
@@ -0,0 +1,81 @@
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.hsnew file+18
@@ -0,0 +1,18 @@
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.hsnew file+435
@@ -0,0 +1,435 @@
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.hsnew file+146
@@ -0,0 +1,146 @@
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.hsnew file+141
@@ -0,0 +1,141 @@
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.hsnew file+527
@@ -0,0 +1,527 @@
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.hsdeleted−59
@@ -1,59 +0,0 @@
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.hsdeleted−32
@@ -1,32 +0,0 @@
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.hsdeleted−24
@@ -1,24 +0,0 @@
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.hsdeleted−36
@@ -1,36 +0,0 @@
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.hsdeleted−14
@@ -1,14 +0,0 @@
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.hsdeleted−83
@@ -1,83 +0,0 @@
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, Read, 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.hsdeleted−475
@@ -1,475 +0,0 @@
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−
26−-- |
27−-- A module declaration, consisting of comments about the module, a module name,
28−-- a list of declarations, and a list of the declarations that are
29−-- explicitly exported. If the export list is Nothing, everything is exported.
30−--
31−data Module = Module SourceSpan [Comment] ModuleName [Declaration] (Maybe [DeclarationRef])
32− deriving (Show, Read)
33−
34−-- | Return a module's name.
35−getModuleName :: Module -> ModuleName
36−getModuleName (Module _ _ name _ _) = name
37−
38−-- |
39−-- Add an import declaration for a module if it does not already explicitly import it.
40−--
41−addDefaultImport :: ModuleName -> Module -> Module
42−addDefaultImport toImport m@(Module ss coms mn decls exps) =
43− if isExistingImport `any` decls || mn == toImport then m
44− else Module ss coms mn (ImportDeclaration toImport Implicit Nothing : decls) exps
45− where
46− isExistingImport (ImportDeclaration mn' _ _) | mn' == toImport = True
47− isExistingImport (PositionedDeclaration _ _ d) = isExistingImport d
48− isExistingImport _ = False
49−
50−-- |
51−-- An item in a list of explicit imports or exports
52−--
53−data DeclarationRef
54− -- |
55− -- A type constructor with data constructors
56− --
57− = TypeRef (ProperName 'TypeName) (Maybe [ProperName 'ConstructorName])
58− -- |
59− -- A type operator
60− --
61− | TypeOpRef (OpName 'TypeOpName)
62− -- |
63− -- A value
64− --
65− | ValueRef Ident
66− -- |
67− -- A value-level operator
68− --
69− | ValueOpRef (OpName 'ValueOpName)
70− -- |
71− -- A type class
72− --
73− | TypeClassRef (ProperName 'ClassName)
74− -- |
75− -- A type class instance, created during typeclass desugaring (name, class name, instance types)
76− --
77− | TypeInstanceRef Ident
78− -- |
79− -- A module, in its entirety
80− --
81− | ModuleRef ModuleName
82− -- |
83− -- A declaration reference with source position information
84− --
85− | PositionedDeclarationRef SourceSpan [Comment] DeclarationRef
86− deriving (Show, Read)
87−
88−instance Eq DeclarationRef where
89− (TypeRef name dctors) == (TypeRef name' dctors') = name == name' && dctors == dctors'
90− (TypeOpRef name) == (TypeOpRef name') = name == name'
91− (ValueRef name) == (ValueRef name') = name == name'
92− (ValueOpRef name) == (ValueOpRef name') = name == name'
93− (TypeClassRef name) == (TypeClassRef name') = name == name'
94− (TypeInstanceRef name) == (TypeInstanceRef name') = name == name'
95− (ModuleRef name) == (ModuleRef name') = name == name'
96− (PositionedDeclarationRef _ _ r) == r' = r == r'
97− r == (PositionedDeclarationRef _ _ r') = r == r'
98− _ == _ = False
99−
100−getTypeRef :: DeclarationRef -> Maybe (ProperName 'TypeName, Maybe [ProperName 'ConstructorName])
101−getTypeRef (TypeRef name dctors) = Just (name, dctors)
102−getTypeRef (PositionedDeclarationRef _ _ r) = getTypeRef r
103−getTypeRef _ = Nothing
104−
105−getTypeOpRef :: DeclarationRef -> Maybe (OpName 'TypeOpName)
106−getTypeOpRef (TypeOpRef op) = Just op
107−getTypeOpRef (PositionedDeclarationRef _ _ r) = getTypeOpRef r
108−getTypeOpRef _ = Nothing
109−
110−getValueRef :: DeclarationRef -> Maybe Ident
111−getValueRef (ValueRef name) = Just name
112−getValueRef (PositionedDeclarationRef _ _ r) = getValueRef r
113−getValueRef _ = Nothing
114−
115−getValueOpRef :: DeclarationRef -> Maybe (OpName 'ValueOpName)
116−getValueOpRef (ValueOpRef op) = Just op
117−getValueOpRef (PositionedDeclarationRef _ _ r) = getValueOpRef r
118−getValueOpRef _ = Nothing
119−
120−getTypeClassRef :: DeclarationRef -> Maybe (ProperName 'ClassName)
121−getTypeClassRef (TypeClassRef name) = Just name
122−getTypeClassRef (PositionedDeclarationRef _ _ r) = getTypeClassRef r
123−getTypeClassRef _ = Nothing
124−
125−isModuleRef :: DeclarationRef -> Bool
126−isModuleRef (PositionedDeclarationRef _ _ r) = isModuleRef r
127−isModuleRef (ModuleRef _) = True
128−isModuleRef _ = False
129−
130−-- |
131−-- The data type which specifies type of import declaration
132−--
133−data ImportDeclarationType
134− -- |
135− -- An import with no explicit list: `import M`.
136− --
137− = Implicit
138− -- |
139− -- An import with an explicit list of references to import: `import M (foo)`
140− --
141− | Explicit [DeclarationRef]
142− -- |
143− -- An import with a list of references to hide: `import M hiding (foo)`
144− --
145− | Hiding [DeclarationRef]
146− deriving (Eq, Show, Read)
147−
148−isImplicit :: ImportDeclarationType -> Bool
149−isImplicit Implicit = True
150−isImplicit _ = False
151−
152−isExplicit :: ImportDeclarationType -> Bool
153−isExplicit (Explicit _) = True
154−isExplicit _ = False
155−
156−-- |
157−-- The data type of declarations
158−--
159−data Declaration
160− -- |
161− -- A data type declaration (data or newtype, name, arguments, data constructors)
162− --
163− = DataDeclaration DataDeclType (ProperName 'TypeName) [(String, Maybe Kind)] [(ProperName 'ConstructorName, [Type])]
164− -- |
165− -- A minimal mutually recursive set of data type declarations
166− --
167− | DataBindingGroupDeclaration [Declaration]
168− -- |
169− -- A type synonym declaration (name, arguments, type)
170− --
171− | TypeSynonymDeclaration (ProperName 'TypeName) [(String, Maybe Kind)] Type
172− -- |
173− -- A type declaration for a value (name, ty)
174− --
175− | TypeDeclaration Ident Type
176− -- |
177− -- A value declaration (name, top-level binders, optional guard, value)
178− --
179− | ValueDeclaration Ident NameKind [Binder] (Either [(Guard, Expr)] Expr)
180− -- |
181− -- A minimal mutually recursive set of value declarations
182− --
183− | BindingGroupDeclaration [(Ident, NameKind, Expr)]
184− -- |
185− -- A foreign import declaration (name, type)
186− --
187− | ExternDeclaration Ident Type
188− -- |
189− -- A data type foreign import (name, kind)
190− --
191− | ExternDataDeclaration (ProperName 'TypeName) Kind
192− -- |
193− -- A fixity declaration
194− --
195− | FixityDeclaration (Either ValueFixity TypeFixity)
196− -- |
197− -- A module import (module name, qualified/unqualified/hiding, optional "qualified as" name)
198− --
199− | ImportDeclaration ModuleName ImportDeclarationType (Maybe ModuleName)
200− -- |
201− -- A type class declaration (name, argument, implies, member declarations)
202− --
203− | TypeClassDeclaration (ProperName 'ClassName) [(String, Maybe Kind)] [Constraint] [Declaration]
204− -- |
205− -- A type instance declaration (name, dependencies, class name, instance types, member
206− -- declarations)
207− --
208− | TypeInstanceDeclaration Ident [Constraint] (Qualified (ProperName 'ClassName)) [Type] TypeInstanceBody
209− -- |
210− -- A declaration with source position information
211− --
212− | PositionedDeclaration SourceSpan [Comment] Declaration
213− deriving (Show, Read)
214−
215−data ValueFixity = ValueFixity Fixity (Qualified (Either Ident (ProperName 'ConstructorName))) (OpName 'ValueOpName)
216− deriving (Eq, Ord, Show, Read)
217−
218−data TypeFixity = TypeFixity Fixity (Qualified (ProperName 'TypeName)) (OpName 'TypeOpName)
219− deriving (Eq, Ord, Show, Read)
220−
221−pattern ValueFixityDeclaration fixity name op = FixityDeclaration (Left (ValueFixity fixity name op))
222−pattern TypeFixityDeclaration fixity name op = FixityDeclaration (Right (TypeFixity fixity name op))
223−
224−-- | The members of a type class instance declaration
225−data TypeInstanceBody
226− -- | This is a derived instance
227− = DerivedInstance
228− -- | This is a regular (explicit) instance
229− | ExplicitInstance [Declaration]
230− deriving (Show, Read)
231−
232−mapTypeInstanceBody :: ([Declaration] -> [Declaration]) -> TypeInstanceBody -> TypeInstanceBody
233−mapTypeInstanceBody f = runIdentity . traverseTypeInstanceBody (Identity . f)
234−
235−-- | A traversal for TypeInstanceBody
236−traverseTypeInstanceBody :: (Applicative f) => ([Declaration] -> f [Declaration]) -> TypeInstanceBody -> f TypeInstanceBody
237−traverseTypeInstanceBody _ DerivedInstance = pure DerivedInstance
238−traverseTypeInstanceBody f (ExplicitInstance ds) = ExplicitInstance <$> f ds
239−
240−-- |
241−-- Test if a declaration is a value declaration
242−--
243−isValueDecl :: Declaration -> Bool
244−isValueDecl ValueDeclaration{} = True
245−isValueDecl (PositionedDeclaration _ _ d) = isValueDecl d
246−isValueDecl _ = False
247−
248−-- |
249−-- Test if a declaration is a data type or type synonym declaration
250−--
251−isDataDecl :: Declaration -> Bool
252−isDataDecl DataDeclaration{} = True
253−isDataDecl TypeSynonymDeclaration{} = True
254−isDataDecl (PositionedDeclaration _ _ d) = isDataDecl d
255−isDataDecl _ = False
256−
257−-- |
258−-- Test if a declaration is a module import
259−--
260−isImportDecl :: Declaration -> Bool
261−isImportDecl ImportDeclaration{} = True
262−isImportDecl (PositionedDeclaration _ _ d) = isImportDecl d
263−isImportDecl _ = False
264−
265−-- |
266−-- Test if a declaration is a data type foreign import
267−--
268−isExternDataDecl :: Declaration -> Bool
269−isExternDataDecl ExternDataDeclaration{} = True
270−isExternDataDecl (PositionedDeclaration _ _ d) = isExternDataDecl d
271−isExternDataDecl _ = False
272−
273−-- |
274−-- Test if a declaration is a fixity declaration
275−--
276−isFixityDecl :: Declaration -> Bool
277−isFixityDecl FixityDeclaration{} = True
278−isFixityDecl (PositionedDeclaration _ _ d) = isFixityDecl d
279−isFixityDecl _ = False
280−
281−getFixityDecl :: Declaration -> Maybe (Either ValueFixity TypeFixity)
282−getFixityDecl (FixityDeclaration fixity) = Just fixity
283−getFixityDecl (PositionedDeclaration _ _ d) = getFixityDecl d
284−getFixityDecl _ = Nothing
285−
286−-- |
287−-- Test if a declaration is a foreign import
288−--
289−isExternDecl :: Declaration -> Bool
290−isExternDecl ExternDeclaration{} = True
291−isExternDecl (PositionedDeclaration _ _ d) = isExternDecl d
292−isExternDecl _ = False
293−
294−-- |
295−-- Test if a declaration is a type class instance declaration
296−--
297−isTypeClassInstanceDeclaration :: Declaration -> Bool
298−isTypeClassInstanceDeclaration TypeInstanceDeclaration{} = True
299−isTypeClassInstanceDeclaration (PositionedDeclaration _ _ d) = isTypeClassInstanceDeclaration d
300−isTypeClassInstanceDeclaration _ = False
301−
302−-- |
303−-- Test if a declaration is a type class declaration
304−--
305−isTypeClassDeclaration :: Declaration -> Bool
306−isTypeClassDeclaration TypeClassDeclaration{} = True
307−isTypeClassDeclaration (PositionedDeclaration _ _ d) = isTypeClassDeclaration d
308−isTypeClassDeclaration _ = False
309−
310−-- |
311−-- Recursively flatten data binding groups in the list of declarations
312−flattenDecls :: [Declaration] -> [Declaration]
313−flattenDecls = concatMap flattenOne
314− where flattenOne :: Declaration -> [Declaration]
315− flattenOne (DataBindingGroupDeclaration decls) = concatMap flattenOne decls
316− flattenOne d = [d]
317−
318−-- |
319−-- A guard is just a boolean-valued expression that appears alongside a set of binders
320−--
321−type Guard = Expr
322−
323−-- |
324−-- Data type for expressions and terms
325−--
326−data Expr
327− -- |
328− -- A literal value
329− --
330− = Literal (Literal Expr)
331− -- |
332− -- A prefix -, will be desugared
333− --
334− | UnaryMinus Expr
335− -- |
336− -- Binary operator application. During the rebracketing phase of desugaring, this data constructor
337− -- will be removed.
338− --
339− | BinaryNoParens Expr Expr Expr
340− -- |
341− -- Explicit parentheses. During the rebracketing phase of desugaring, this data constructor
342− -- will be removed.
343− --
344− -- Note: although it seems this constructor is not used, it _is_ useful, since it prevents
345− -- certain traversals from matching.
346− --
347− | Parens Expr
348− -- |
349− -- A record property getter (e.g. `_.x`). This will be removed during
350− -- desugaring and expanded into a lambda that reads a property from a record.
351− --
352− | ObjectGetter String
353− -- |
354− -- An record property accessor expression
355− --
356− | Accessor String Expr
357− -- |
358− -- Partial record update
359− --
360− | ObjectUpdate Expr [(String, Expr)]
361− -- |
362− -- Function introduction
363− --
364− | Abs (Either Ident Binder) Expr
365− -- |
366− -- Function application
367− --
368− | App Expr Expr
369− -- |
370− -- Variable
371− --
372− | Var (Qualified Ident)
373− -- |
374− -- An operator. This will be desugared into a function during the "operators"
375− -- phase of desugaring.
376− --
377− | Op (Qualified (OpName 'ValueOpName))
378− -- |
379− -- Conditional (if-then-else expression)
380− --
381− | IfThenElse Expr Expr Expr
382− -- |
383− -- A data constructor
384− --
385− | Constructor (Qualified (ProperName 'ConstructorName))
386− -- |
387− -- A case expression. During the case expansion phase of desugaring, top-level binders will get
388− -- desugared into case expressions, hence the need for guards and multiple binders per branch here.
389− --
390− | Case [Expr] [CaseAlternative]
391− -- |
392− -- A value with a type annotation
393− --
394− | TypedValue Bool Expr Type
395− -- |
396− -- A let binding
397− --
398− | Let [Declaration] Expr
399− -- |
400− -- A do-notation block
401− --
402− | Do [DoNotationElement]
403− -- |
404− -- An application of a typeclass dictionary constructor. The value should be
405− -- an ObjectLiteral.
406− --
407− | TypeClassDictionaryConstructorApp (Qualified (ProperName 'ClassName)) Expr
408− -- |
409− -- A placeholder for a type class dictionary to be inserted later. At the end of type checking, these
410− -- placeholders will be replaced with actual expressions representing type classes dictionaries which
411− -- can be evaluated at runtime. The constructor arguments represent (in order): whether or not to look
412− -- at superclass implementations when searching for a dictionary, the type class name and
413− -- instance type, and the type class dictionaries in scope.
414− --
415− | TypeClassDictionary Constraint (M.Map (Maybe ModuleName) (M.Map (Qualified (ProperName 'ClassName)) (M.Map (Qualified Ident) TypeClassDictionaryInScope)))
416− -- |
417− -- A typeclass dictionary accessor, the implementation is left unspecified until CoreFn desugaring.
418− --
419− | TypeClassDictionaryAccessor (Qualified (ProperName 'ClassName)) Ident
420− -- |
421− -- A placeholder for a superclass dictionary to be turned into a TypeClassDictionary during typechecking
422− --
423− | SuperClassDictionary (Qualified (ProperName 'ClassName)) [Type]
424− -- |
425− -- A placeholder for an anonymous function argument
426− --
427− | AnonymousArgument
428− -- |
429− -- A typed hole that will be turned into a hint/error duing typechecking
430− --
431− | Hole String
432− -- |
433− -- A value with source position information
434− --
435− | PositionedValue SourceSpan [Comment] Expr
436− deriving (Show, Read)
437−
438−-- |
439−-- An alternative in a case statement
440−--
441−data CaseAlternative = CaseAlternative
442− { -- |
443− -- A collection of binders with which to match the inputs
444− --
445− caseAlternativeBinders :: [Binder]
446− -- |
447− -- The result expression or a collect of guarded expressions
448− --
449− , caseAlternativeResult :: Either [(Guard, Expr)] Expr
450− } deriving (Show, Read)
451−
452−-- |
453−-- A statement in a do-notation block
454−--
455−data DoNotationElement
456− -- |
457− -- A monadic value without a binder
458− --
459− = DoNotationValue Expr
460− -- |
461− -- A monadic value with a binder
462− --
463− | DoNotationBind Binder Expr
464− -- |
465− -- A let statement, i.e. a pure value with a binder
466− --
467− | DoNotationLet [Declaration]
468− -- |
469− -- A do notation element with source position information
470− --
471− | PositionedDoNotationElement SourceSpan [Comment] DoNotationElement
472− deriving (Show, Read)
473−
474−$(deriveJSON (defaultOptions { sumEncoding = ObjectWithSingleField }) ''DeclarationRef)
475−$(deriveJSON (defaultOptions { sumEncoding = ObjectWithSingleField }) ''ImportDeclarationType)
src/Language/PureScript/AST/Exported.hsdeleted−154
@@ -1,154 +0,0 @@
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.hsdeleted−37
@@ -1,37 +0,0 @@
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, Read, Functor)
src/Language/PureScript/AST/Operators.hsdeleted−53
@@ -1,53 +0,0 @@
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, Read, 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, Read, 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.hsdeleted−80
@@ -1,80 +0,0 @@
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, Read, 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, Read, 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.hsdeleted−588
@@ -1,588 +0,0 @@
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.hsdeleted−588
@@ -1,588 +0,0 @@
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− , ModuleIdentifier(..)
10− , moduleName
11− , ModuleType(..)
12− , ErrorMessage(..)
13− , printErrorMessage
14− , getExportedIdentifiers
15− ) where
16−
17−import Prelude.Compat
18−
19−import Control.Monad
20−import Control.Monad.Error.Class
21−
22−import Data.Generics (everything, everywhere, mkQ, mkT)
23−import Data.Graph
24−import Data.List (nub, stripPrefix)
25−import Data.Maybe (mapMaybe, catMaybes)
26−import Data.Version (showVersion)
27−import qualified Data.Set as S
28−
29−import Language.JavaScript.Parser
30−import Language.JavaScript.Parser.AST
31−
32−import qualified Paths_purescript as Paths
33−
34−-- | The type of error messages. We separate generation and rendering of errors using a data
35−-- type, in case we need to match on error types later.
36−data ErrorMessage
37− = UnsupportedModulePath String
38− | InvalidTopLevel
39− | UnableToParseModule String
40− | UnsupportedExport
41− | ErrorInModule ModuleIdentifier ErrorMessage
42− deriving (Show, Read)
43−
44−-- | Modules are either "regular modules" (i.e. those generated by psc) or foreign modules.
45−data ModuleType
46− = Regular
47− | Foreign
48− deriving (Show, Read, Eq, Ord)
49−
50−showModuleType :: ModuleType -> String
51−showModuleType Regular = "Regular"
52−showModuleType Foreign = "Foreign"
53−
54−-- | A module is identified by its module name and its type.
55−data ModuleIdentifier = ModuleIdentifier String ModuleType deriving (Show, Read, Eq, Ord)
56−
57−moduleName :: ModuleIdentifier -> String
58−moduleName (ModuleIdentifier name _) = name
59−
60−-- | A piece of code is identified by its module and its name. These keys are used to label vertices
61−-- in the dependency graph.
62−type Key = (ModuleIdentifier, String)
63−
64−-- | An export is either a "regular export", which exports a name from the regular module we are in,
65−-- or a reexport of a declaration in the corresponding foreign module.
66−--
67−-- Regular exports are labelled, since they might re-export an operator with another name.
68−data ExportType
69− = RegularExport String
70− | ForeignReexport
71− deriving (Show, Eq, Ord)
72−
73−-- | There are four types of module element we are interested in:
74−--
75−-- 1) Require statements
76−-- 2) Member declarations
77−-- 3) Export lists
78−-- 4) Everything else
79−--
80−-- Each is labelled with the original AST node which generated it, so that we can dump it back
81−-- into the output during codegen.
82−data ModuleElement
83− = Require JSStatement String (Either String ModuleIdentifier)
84− | Member JSStatement Bool String JSExpression [Key]
85− | ExportsList [(ExportType, String, JSExpression, [Key])]
86− | Other JSStatement
87− deriving (Show)
88−
89−-- | A module is just a list of elements of the types listed above.
90−data Module = Module ModuleIdentifier [ModuleElement] deriving (Show)
91−
92−-- | Prepare an error message for consumption by humans.
93−printErrorMessage :: ErrorMessage -> [String]
94−printErrorMessage (UnsupportedModulePath s) =
95− [ "A CommonJS module has an unsupported name (" ++ show s ++ ")."
96− , "The following file names are supported:"
97− , " 1) index.js (psc native modules)"
98− , " 2) foreign.js (psc foreign modules)"
99− ]
100−printErrorMessage InvalidTopLevel =
101− [ "Expected a list of source elements at the top level." ]
102−printErrorMessage (UnableToParseModule err) =
103− [ "The module could not be parsed:"
104− , err
105− ]
106−printErrorMessage UnsupportedExport =
107− [ "An export was unsupported. Exports can be defined in one of two ways: "
108− , " 1) exports.name = ..."
109− , " 2) exports = { ... }"
110− ]
111−printErrorMessage (ErrorInModule mid e) =
112− ("Error in module " ++ displayIdentifier mid ++ ":")
113− : ""
114− : map (" " ++) (printErrorMessage e)
115− where
116− displayIdentifier (ModuleIdentifier name ty) =
117− name ++ " (" ++ showModuleType ty ++ ")"
118−
119−-- | Calculate the ModuleIdentifier which a require(...) statement imports.
120−checkImportPath :: String -> ModuleIdentifier -> S.Set String -> Either String ModuleIdentifier
121−checkImportPath "./foreign" m _ =
122− Right (ModuleIdentifier (moduleName m) Foreign)
123−checkImportPath name _ names
124− | Just name' <- stripPrefix "../" name
125− , name' `S.member` names = Right (ModuleIdentifier name' Regular)
126−checkImportPath name _ _ = Left name
127−
128−-- | Compute the dependencies of all elements in a module, and add them to the tree.
129−--
130−-- Members and exports can have dependencies. A dependency is of one of the following forms:
131−--
132−-- 1) module.name or member["name"]
133−--
134−-- where module was imported using
135−--
136−-- var module = require("Module.Name");
137−--
138−-- 2) name
139−--
140−-- where name is the name of a member defined in the current module.
141−withDeps :: Module -> Module
142−withDeps (Module modulePath es) = Module modulePath (map expandDeps es)
143− where
144− -- | Collects all modules which are imported, so that we can identify dependencies of the first type.
145− imports :: [(String, ModuleIdentifier)]
146− imports = mapMaybe toImport es
147− where
148− toImport :: ModuleElement -> Maybe (String, ModuleIdentifier)
149− toImport (Require _ nm (Right mid)) = Just (nm, mid)
150− toImport _ = Nothing
151−
152− -- | Collects all member names in scope, so that we can identify dependencies of the second type.
153− boundNames :: [String]
154− boundNames = mapMaybe toBoundName es
155− where
156− toBoundName :: ModuleElement -> Maybe String
157− toBoundName (Member _ _ nm _ _) = Just nm
158− toBoundName _ = Nothing
159−
160− -- | Calculate dependencies and add them to the current element.
161− expandDeps :: ModuleElement -> ModuleElement
162− expandDeps (Member n f nm decl _) = Member n f nm decl (nub $ dependencies modulePath decl)
163− expandDeps (ExportsList exps) = ExportsList (map expand exps)
164− where
165− expand (ty, nm, n1, _) = (ty, nm, n1, nub (dependencies modulePath n1))
166− expandDeps other = other
167−
168− dependencies :: ModuleIdentifier -> JSExpression -> [(ModuleIdentifier, String)]
169− dependencies m = everything (++) (mkQ [] toReference)
170− where
171− toReference :: JSExpression -> [(ModuleIdentifier, String)]
172− toReference (JSMemberDot mn _ nm)
173− | JSIdentifier _ mn' <- mn
174− , JSIdentifier _ nm' <- nm
175− , Just mid <- lookup mn' imports
176− = [(mid, nm')]
177− toReference (JSMemberSquare mn _ nm _)
178− | JSIdentifier _ mn' <- mn
179− , Just nm' <- fromStringLiteral nm
180− , Just mid <- lookup mn' imports
181− = [(mid, nm')]
182− toReference (JSIdentifier _ nm)
183− | nm `elem` boundNames
184− = [(m, nm)]
185− toReference _ = []
186−
187−-- String literals include the quote chars
188−fromStringLiteral :: JSExpression -> Maybe String
189−fromStringLiteral (JSStringLiteral _ str) = Just $ trimStringQuotes str
190−fromStringLiteral _ = Nothing
191−
192−trimStringQuotes :: String -> String
193−trimStringQuotes str = reverse $ drop 1 $ reverse $ drop 1 $ str
194−
195−commaList :: JSCommaList a -> [a]
196−commaList JSLNil = []
197−commaList (JSLOne x) = [x]
198−commaList (JSLCons l _ x) = commaList l ++ [x]
199−
200−trailingCommaList :: JSCommaTrailingList a -> [a]
201−trailingCommaList (JSCTLComma l _) = commaList l
202−trailingCommaList (JSCTLNone l) = commaList l
203−
204−-- | Attempt to create a Module from a Javascript AST.
205−--
206−-- Each type of module element is matched using pattern guards, and everything else is bundled into the
207−-- Other constructor.
208−toModule :: forall m. (MonadError ErrorMessage m) => S.Set String -> ModuleIdentifier -> JSAST -> m Module
209−toModule mids mid top
210− | JSAstProgram smts _ <- top = Module mid <$> traverse toModuleElement smts
211− | otherwise = err InvalidTopLevel
212− where
213− err = throwError . ErrorInModule mid
214−
215− toModuleElement :: JSStatement -> m ModuleElement
216− toModuleElement stmt
217− | Just (importName, importPath) <- matchRequire mids mid stmt
218− = pure (Require stmt importName importPath)
219− toModuleElement stmt
220− | Just (exported, name, decl) <- matchMember stmt
221− = pure (Member stmt exported name decl [])
222− toModuleElement stmt
223− | Just props <- matchExportsAssignment stmt
224− = (ExportsList <$> traverse toExport (trailingCommaList props))
225− where
226− toExport :: JSObjectProperty -> m (ExportType, String, JSExpression, [Key])
227− toExport (JSPropertyNameandValue name _ [val]) =
228− (,,val,[]) <$> exportType val
229− <*> extractLabel' name
230− toExport _ = err UnsupportedExport
231−
232− exportType :: JSExpression -> m ExportType
233− exportType (JSMemberDot f _ _)
234− | JSIdentifier _ "$foreign" <- f
235− = pure ForeignReexport
236− exportType (JSMemberSquare f _ _ _)
237− | JSIdentifier _ "$foreign" <- f
238− = pure ForeignReexport
239− exportType (JSIdentifier _ s) = pure (RegularExport s)
240− exportType _ = err UnsupportedExport
241−
242− extractLabel' = maybe (err UnsupportedExport) pure . extractLabel
243−
244− toModuleElement other = pure (Other other)
245−
246−-- Get a list of all the exported identifiers from a foreign module.
247−--
248−-- TODO: what if we assign to exports.foo and then later assign to
249−-- module.exports (presumably overwriting exports.foo)?
250−getExportedIdentifiers :: (MonadError ErrorMessage m)
251− => String
252− -> JSAST
253− -> m [String]
254−getExportedIdentifiers mname top
255− | JSAstProgram stmts _ <- top = concat <$> traverse go stmts
256− | otherwise = err InvalidTopLevel
257− where
258− err = throwError . ErrorInModule (ModuleIdentifier mname Foreign)
259−
260− go stmt
261− | Just props <- matchExportsAssignment stmt
262− = traverse toIdent (trailingCommaList props)
263− | Just (True, name, _) <- matchMember stmt
264− = pure [name]
265− | otherwise
266− = pure []
267−
268− toIdent (JSPropertyNameandValue name _ [_]) =
269− extractLabel' name
270− toIdent _ =
271− err UnsupportedExport
272−
273− extractLabel' = maybe (err UnsupportedExport) pure . extractLabel
274−
275−-- Matches JS statements like this:
276−-- var ModuleName = require("file");
277−matchRequire :: S.Set String
278− -> ModuleIdentifier
279− -> JSStatement
280− -> Maybe (String, Either String ModuleIdentifier)
281−matchRequire mids mid stmt
282− | JSVariable _ jsInit _ <- stmt
283− , [JSVarInitExpression var varInit] <- commaList jsInit
284− , JSIdentifier _ importName <- var
285− , JSVarInit _ jsInitEx <- varInit
286− , JSMemberExpression req _ argsE _ <- jsInitEx
287− , JSIdentifier _ "require" <- req
288− , [ Just importPath ] <- map fromStringLiteral (commaList argsE)
289− , importPath' <- checkImportPath importPath mid mids
290− = Just (importName, importPath')
291− | otherwise
292− = Nothing
293−
294−-- Matches JS member declarations.
295−matchMember :: JSStatement -> Maybe (Bool, String, JSExpression)
296−matchMember stmt
297− -- var foo = expr;
298− | JSVariable _ jsInit _ <- stmt
299− , [JSVarInitExpression var varInit] <- commaList jsInit
300− , JSIdentifier _ name <- var
301− , JSVarInit _ decl <- varInit
302− = Just (False, name, decl)
303− -- exports.foo = expr; exports["foo"] = expr;
304− | JSAssignStatement e (JSAssign _) decl _ <- stmt
305− , Just name <- accessor e
306− = Just (True, name, decl)
307− | otherwise
308− = Nothing
309− where
310− accessor :: JSExpression -> Maybe String
311− accessor (JSMemberDot exports _ nm)
312− | JSIdentifier _ "exports" <- exports
313− , JSIdentifier _ name <- nm
314− = Just name
315− accessor (JSMemberSquare exports _ nm _)
316− | JSIdentifier _ "exports" <- exports
317− , Just name <- fromStringLiteral nm
318− = Just name
319− accessor _ = Nothing
320−
321−-- Matches assignments to module.exports, like this:
322−-- module.exports = { ... }
323−matchExportsAssignment :: JSStatement -> Maybe JSObjectPropertyList
324−matchExportsAssignment stmt
325− | JSAssignStatement e (JSAssign _) decl _ <- stmt
326− , JSMemberDot module' _ exports <- e
327− , JSIdentifier _ "module" <- module'
328− , JSIdentifier _ "exports" <- exports
329− , JSObjectLiteral _ props _ <- decl
330− = Just props
331− | otherwise
332− = Nothing
333−
334−extractLabel :: JSPropertyName -> Maybe String
335−extractLabel (JSPropertyString _ nm) = Just (trimStringQuotes nm)
336−extractLabel (JSPropertyIdent _ nm) = Just nm
337−extractLabel _ = Nothing
338−
339−-- | Eliminate unused code based on the specified entry point set.
340−compile :: [Module] -> [ModuleIdentifier] -> [Module]
341−compile modules [] = modules
342−compile modules entryPoints = filteredModules
343− where
344− (graph, _, vertexFor) = graphFromEdges verts
345−
346− -- | The vertex set
347− verts :: [(ModuleElement, Key, [Key])]
348− verts = do
349− Module mid els <- modules
350− concatMap (toVertices mid) els
351− where
352− -- | Create a set of vertices for a module element.
353− --
354− -- Some special cases worth commenting on:
355− --
356− -- 1) Regular exports which simply export their own name do not count as dependencies.
357− -- Regular exports which rename and reexport an operator do count, however.
358− --
359− -- 2) Require statements don't contribute towards dependencies, since they effectively get
360− -- inlined wherever they are used inside other module elements.
361− toVertices :: ModuleIdentifier -> ModuleElement -> [(ModuleElement, Key, [Key])]
362− toVertices p m@(Member _ _ nm _ deps) = [(m, (p, nm), deps)]
363− toVertices p m@(ExportsList exps) = mapMaybe toVertex exps
364− where
365− toVertex (ForeignReexport, nm, _, ks) = Just (m, (p, nm), ks)
366− toVertex (RegularExport nm, nm1, _, ks) | nm /= nm1 = Just (m, (p, nm1), ks)
367− toVertex _ = Nothing
368− toVertices _ _ = []
369−
370− -- | The set of vertices whose connected components we are interested in keeping.
371− entryPointVertices :: [Vertex]
372− entryPointVertices = catMaybes $ do
373− (_, k@(mid, _), _) <- verts
374− guard $ mid `elem` entryPoints
375− return (vertexFor k)
376−
377− -- | The set of vertices reachable from an entry point
378− reachableSet :: S.Set Vertex
379− reachableSet = S.fromList (concatMap (reachable graph) entryPointVertices)
380−
381− filteredModules :: [Module]
382− filteredModules = map filterUsed modules
383− where
384− filterUsed :: Module -> Module
385− filterUsed (Module mid ds) = Module mid (map filterExports (go ds))
386− where
387− go :: [ModuleElement] -> [ModuleElement]
388− go [] = []
389− go (d : rest)
390− | not (isDeclUsed d) = go rest
391− | otherwise = d : go rest
392−
393− -- | Filter out the exports for members which aren't used.
394− filterExports :: ModuleElement -> ModuleElement
395− filterExports (ExportsList exps) = ExportsList (filter (\(_, nm, _, _) -> isKeyUsed (mid, nm)) exps)
396− filterExports me = me
397−
398− isDeclUsed :: ModuleElement -> Bool
399− isDeclUsed (Member _ _ nm _ _) = isKeyUsed (mid, nm)
400− isDeclUsed _ = True
401−
402− isKeyUsed :: Key -> Bool
403− isKeyUsed k
404− | Just me <- vertexFor k = me `S.member` reachableSet
405− | otherwise = False
406−
407−-- | Topologically sort the module dependency graph, so that when we generate code, modules can be
408−-- defined in the right order.
409−sortModules :: [Module] -> [Module]
410−sortModules modules = map (\v -> case nodeFor v of (n, _, _) -> n) (reverse (topSort graph))
411− where
412− (graph, nodeFor, _) = graphFromEdges $ do
413− m@(Module mid els) <- modules
414− return (m, mid, mapMaybe getKey els)
415−
416− getKey :: ModuleElement -> Maybe ModuleIdentifier
417− getKey (Require _ _ (Right mi)) = Just mi
418− getKey _ = Nothing
419−
420−-- | A module is empty if it contains no exported members (in other words,
421−-- if the only things left after dead code elimination are module imports and
422−-- "other" foreign code).
423−--
424−-- If a module is empty, we don't want to generate code for it.
425−isModuleEmpty :: Module -> Bool
426−isModuleEmpty (Module _ els) = all isElementEmpty els
427− where
428− isElementEmpty :: ModuleElement -> Bool
429− isElementEmpty (ExportsList exps) = null exps
430− isElementEmpty Require{} = True
431− isElementEmpty (Other _) = True
432− isElementEmpty _ = False
433−
434−-- | Generate code for a set of modules, including a call to main().
435−--
436−-- Modules get defined on the global PS object, as follows:
437−--
438−-- var PS = { };
439−-- (function(exports) {
440−-- ...
441−-- })(PS["Module.Name"] = PS["Module.Name"] || {});
442−--
443−-- In particular, a module and its foreign imports share the same namespace inside PS.
444−-- This saves us from having to generate unique names for a module and its foreign imports,
445−-- and is safe since a module shares a namespace with its foreign imports in PureScript as well
446−-- (so there is no way to have overlaps in code generated by psc).
447−codeGen :: Maybe String -- ^ main module
448− -> String -- ^ namespace
449− -> [Module] -- ^ input modules
450− -> String
451−codeGen optionsMainModule optionsNamespace ms = renderToString (JSAstProgram (prelude : concatMap moduleToJS ms ++ maybe [] runMain optionsMainModule) JSNoAnnot)
452− where
453− moduleToJS :: Module -> [JSStatement]
454− moduleToJS (Module mn ds) = wrap (moduleName mn) (indent (concatMap declToJS ds))
455− where
456− declToJS :: ModuleElement -> [JSStatement]
457− declToJS (Member n _ _ _ _) = [n]
458− declToJS (Other n) = [n]
459− declToJS (Require _ nm req) =
460− [
461− JSVariable lfsp
462− (cList [
463− JSVarInitExpression (JSIdentifier sp nm)
464− (JSVarInit sp $ either require (moduleReference sp . moduleName) req )
465− ]) (JSSemi JSNoAnnot)
466− ]
467− declToJS (ExportsList exps) = map toExport exps
468−
469− where
470− toExport :: (ExportType, String, JSExpression, [Key]) -> JSStatement
471− toExport (_, nm, val, _) =
472− JSAssignStatement
473− (JSMemberSquare (JSIdentifier lfsp "exports") JSNoAnnot
474− (str nm) JSNoAnnot)
475− (JSAssign sp)
476− val
477− (JSSemi JSNoAnnot)
478−
479− -- comma lists are reverse-consed
480− cList :: [a] -> JSCommaList a
481− cList [] = JSLNil
482− cList [x] = JSLOne x
483− cList l = go $ reverse l
484− where
485− go [x] = JSLOne x
486− go (h:t)= JSLCons (go t) JSNoAnnot h
487− go [] = error "Invalid case in comma-list"
488−
489− indent :: [JSStatement] -> [JSStatement]
490− indent = everywhere (mkT squash)
491− where
492− squash JSNoAnnot = (JSAnnot (TokenPn 0 0 2) [])
493− squash (JSAnnot pos ann) = JSAnnot (keepCol pos) (map splat ann)
494−
495− splat (CommentA pos s) = CommentA (keepCol pos) s
496− splat (WhiteSpace pos w) = WhiteSpace (keepCol pos) w
497− splat ann = ann
498−
499− keepCol (TokenPn _ _ c) = TokenPn 0 0 (if c >= 0 then c + 2 else 2)
500−
501− prelude :: JSStatement
502− prelude = JSVariable (JSAnnot tokenPosnEmpty [ CommentA tokenPosnEmpty $ "// Generated by psc-bundle " ++ showVersion Paths.version
503− , WhiteSpace tokenPosnEmpty "\n" ])
504− (cList [
505− JSVarInitExpression (JSIdentifier sp optionsNamespace)
506− (JSVarInit sp (emptyObj sp))
507− ]) (JSSemi JSNoAnnot)
508−
509− require :: String -> JSExpression
510− require mn =
511− JSMemberExpression (JSIdentifier JSNoAnnot "require") JSNoAnnot (cList [ str mn ]) JSNoAnnot
512−
513− moduleReference :: JSAnnot -> String -> JSExpression
514− moduleReference a mn =
515− JSMemberSquare (JSIdentifier a optionsNamespace) JSNoAnnot
516− (str mn) JSNoAnnot
517−
518− str :: String -> JSExpression
519− str s = JSStringLiteral JSNoAnnot $ "\"" ++ s ++ "\""
520−
521−
522− emptyObj :: JSAnnot -> JSExpression
523− emptyObj a = JSObjectLiteral a (JSCTLNone JSLNil) JSNoAnnot
524−
525− wrap :: String -> [JSStatement] -> [JSStatement]
526− wrap mn ds =
527− [
528− JSMethodCall (JSExpressionParen lf (JSFunctionExpression JSNoAnnot JSIdentNone JSNoAnnot
529− (JSLOne (JSIdentName JSNoAnnot "exports")) JSNoAnnot
530− (JSBlock sp (lfHead ds) lf)) -- \n not quite in right place
531− JSNoAnnot)
532− JSNoAnnot
533− (JSLOne (JSAssignExpression (moduleReference JSNoAnnot mn) (JSAssign sp)
534− (JSExpressionBinary (moduleReference sp mn) (JSBinOpOr sp) (emptyObj sp))))
535− JSNoAnnot
536− (JSSemi JSNoAnnot)
537− ]
538− where
539− lfHead (h:t) = (addAnn (WhiteSpace tokenPosnEmpty "\n ") h) : t
540− lfHead x = x
541−
542− addAnn :: CommentAnnotation -> JSStatement -> JSStatement
543− addAnn a (JSExpressionStatement (JSStringLiteral ann s) _) =
544− (JSExpressionStatement (JSStringLiteral (appendAnn a ann) s) (JSSemi JSNoAnnot))
545− addAnn _ x = x
546−
547− appendAnn a JSNoAnnot = (JSAnnot tokenPosnEmpty [a])
548− appendAnn a (JSAnnot _ anns) = JSAnnot tokenPosnEmpty (a:anns ++ [WhiteSpace tokenPosnEmpty " "])
549−
550− runMain :: String -> [JSStatement]
551− runMain mn =
552− [JSMethodCall
553− (JSMemberDot (moduleReference lf mn) JSNoAnnot
554− (JSIdentifier JSNoAnnot "main"))
555− JSNoAnnot (cList []) JSNoAnnot (JSSemi JSNoAnnot)]
556−
557− lf :: JSAnnot
558− lf = JSAnnot tokenPosnEmpty [ WhiteSpace tokenPosnEmpty "\n" ]
559−
560−
561− lfsp :: JSAnnot
562− lfsp = JSAnnot tokenPosnEmpty [ WhiteSpace tokenPosnEmpty "\n " ]
563−
564− sp :: JSAnnot
565− sp = JSAnnot tokenPosnEmpty [ WhiteSpace tokenPosnEmpty " " ]
566−
567−-- | The bundling function.
568−-- This function performs dead code elimination, filters empty modules
569−-- and generates and prints the final Javascript bundle.
570−bundle :: (MonadError ErrorMessage m)
571− => [(ModuleIdentifier, String)] -- ^ The input modules. Each module should be javascript rendered from 'Language.PureScript.Make' or @psc@.
572− -> [ModuleIdentifier] -- ^ Entry points. These module identifiers are used as the roots for dead-code elimination
573− -> Maybe String -- ^ An optional main module.
574− -> String -- ^ The namespace (e.g. PS).
575− -> m String
576−bundle inputStrs entryPoints mainModule namespace = do
577− input <- forM inputStrs $ \(ident, js) -> do
578− ast <- either (throwError . ErrorInModule ident . UnableToParseModule) pure $ parse js (moduleName ident)
579− return (ident, ast)
580−
581− let mids = S.fromList (map (moduleName . fst) input)
582−
583− modules <- traverse (fmap withDeps . uncurry (toModule mids)) input
584−
585− let compiled = compile modules entryPoints
586− sorted = sortModules (filter (not . isModuleEmpty) compiled)
587−
588− return (codeGen mainModule namespace sorted)
src/Language/PureScript/CodeGen.hsdeleted−8
@@ -1,8 +0,0 @@
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/Cpp.hsdeleted−891
@@ -1,891 +0,0 @@
1−---------------------------------------------------------------------------------------------------
2−--
3−-- Module : Language.PureScript.CodeGen.Cpp
4−-- Copyright : (c) 2013-15 Phil Freeman, Andy Arvanitis, and other contributors
5−-- License : MIT
6−--
7−-- Maintainer : Andy Arvanitis <andy.arvanitis@gmail.com>
8−-- Stability : experimental
9−-- Portability :
10−--
11−-- |
12−-- This module generates code in the simplified C++1x intermediate representation from
13−-- Purescript code.
14−--
15−---------------------------------------------------------------------------------------------------
16−{-# LANGUAGE GADTs #-}
17−{-# LANGUAGE ViewPatterns #-}
18−{-# LANGUAGE FlexibleContexts #-}
19−{-# LANGUAGE ScopedTypeVariables #-}
20−{-# LANGUAGE PatternGuards #-}
21−
22−module Language.PureScript.CodeGen.Cpp
23− ( module AST
24− , module Common
25− , moduleToCpp
26− , P.prettyPrintCpp
27− ) where
28−
29−import Prelude.Compat
30−
31−import Data.Char (isLetter)
32−import Data.List
33−import Data.Function (on)
34−import Data.Maybe (catMaybes, fromJust)
35−import qualified Data.Map as M
36−
37−import Control.Monad (forM, replicateM)
38−import Control.Monad.Reader (MonadReader, ask)
39−import Control.Monad.Supply.Class
40−import Language.PureScript.AST.SourcePos
41−import Language.PureScript.CodeGen.Cpp.AST as AST
42−import Language.PureScript.CodeGen.Cpp.Common as Common
43−import Language.PureScript.CodeGen.Cpp.File
44−import Language.PureScript.CodeGen.Cpp.Optimizer
45−import Language.PureScript.CodeGen.Cpp.Optimizer.TCO
46−import Language.PureScript.CodeGen.Cpp.Types
47−import Language.PureScript.Comments
48−import Language.PureScript.CoreFn
49−import Language.PureScript.Names
50−import Language.PureScript.Options
51−import Language.PureScript.Sugar.TypeClasses (superClassDictionaryNames)
52−import Language.PureScript.Traversals (sndM)
53−
54−import qualified Language.PureScript.Constants as C
55−import qualified Language.PureScript.Environment as E
56−import qualified Language.PureScript.Pretty.Cpp as P
57−import qualified Language.PureScript.Types as T
58−
59−-- |
60−-- Generate code in the simplified C++1x intermediate representation for all declarations in a
61−-- module.
62−--
63−---------------------------------------------------------------------------------------------------
64−moduleToCpp :: forall m. (Applicative m, Monad m, MonadReader Options m, MonadSupply m)
65− => E.Environment -> Module Ann -> m [Cpp]
66−---------------------------------------------------------------------------------------------------
67−moduleToCpp env (Module _ mn imps _ foreigns decls) = do
68− cppImports <-
69− traverse (pure . runModuleName) .
70− delete (ModuleName [ProperName C.prim]) . (\\ [mn]) $
71− (snd <$> imps)
72− let cppImports' = "PureScript" : cppImports
73− cppDecls <- concat <$> mapM (bindToCpp [CppTopLevel]) decls
74− cppDecls' <- traverse optimize cppDecls
75− foreignWrappers <- curriedForeigns
76− let optimized = cppDecls' ++ foreignWrappers
77− let moduleHeader =
78− fileBegin mn "HH" ++
79− P.linebreak ++
80− ((\i -> CppInclude i i) <$> cppImports') ++
81− (if not (null foreigns)
82− then [CppInclude [] (runModuleName mn ++ "_ffi")]
83− else []) ++
84− P.linebreak ++
85− [ CppNamespace (runModuleName mn) $
86− (CppUseNamespace <$> cppImports') ++
87− P.linebreak ++
88− dataCtors ++
89− toHeader optimized ++
90− toHeaderFns optimized
91− ] ++
92− P.linebreak ++
93− fileEnd mn "HH"
94− let bodyCpps = toBodyDecl optimized ++ toBody optimized
95− moduleBody =
96− CppInclude (runModuleName mn) (runModuleName mn) :
97− P.linebreak ++
98− (if null bodyCpps
99− then []
100− else [ CppNamespace (runModuleName mn) $
101− (CppUseNamespace <$> cppImports') ++
102− P.linebreak ++ bodyCpps ]) ++
103− P.linebreak ++
104− (if isMain mn
105− then [nativeMain] ++ P.linebreak
106− else [])
107− return $ moduleHeader ++ CppEndOfHeader : moduleBody
108− where
109− -- |
110− -- Generate code in the simplified C++1x intermediate representation for a declaration
111− --
112− -------------------------------------------------------------------------------------------------
113− bindToCpp :: [CppValueQual] -> Bind Ann -> m [Cpp]
114− -------------------------------------------------------------------------------------------------
115− bindToCpp qs (NonRec ann ident val) = return <$> declToCpp qs (ann, ident) val
116− bindToCpp qs (Rec vals) = forM vals (uncurry $ declToCpp (CppRecursive:qs))
117−
118− -- |
119− -- Desugar a declaration into a variable introduction or named function
120− -- declaration.
121− -------------------------------------------------------------------------------------------------
122− declToCpp :: [CppValueQual] -> (Ann, Ident) -> Expr Ann -> m Cpp
123− -------------------------------------------------------------------------------------------------
124− declToCpp _ (_, ident) e@(Abs (_, _, _, Just IsTypeClassConstructor) _ _) =
125− let className = identToCpp ident
126− (supers, members) = span (C.__superclass_ `isPrefixOf`) (identToCpp <$> (fst $ unAbs e []))
127− in return $ CppStruct className [CppEnum Nothing Nothing (sort supers ++ members)]
128−
129− declToCpp vqs (_, ident) (Abs (_, com, ty, _) arg body) = do
130− fn <- if argcnt > 1 && CppTopLevel `elem` vqs
131− then do
132− argNames <- replicateM (argcnt - length args' - 1) freshName
133− let args'' = zip argNames (repeat aty)
134− block <- asReturnBlock <$> valueToCpp
135− (if null argNames
136− then snd abs'
137− else curriedApp
138− (tail argNames)
139− (App
140− nullAnn
141− (snd abs')
142− (Var nullAnn . Qualified Nothing . Ident $ head argNames)))
143− return $ CppNamespace ""
144− [ CppFunction
145− name
146− (arg' : args' ++ args'')
147− rty
148− (vqs ++ if isAccessor (snd abs') then [CppInline] else [])
149− (convertNestedLambdas $ convertDictIndexers block)
150− , CppFunction
151− (curriedName name)
152− [arg']
153− rty
154− []
155− (asReturnBlock $
156− curriedLambda
157− (fst <$> args' ++ args'')
158− (CppApp (CppVar name)
159− (CppVar . fst <$> (arg' : args' ++ args''))))
160− ]
161− else do
162− block <- valueToCpp body
163− return $ CppFunction
164− name
165− [arg']
166− rty
167− (vqs ++ if isIndexer block then [CppInline] else [])
168− (convertNestedLambdas . asReturnBlock $ convertDictIndexers block)
169− return (CppComment com fn)
170− where
171− ty' | Just t <- ty = Just t
172− | Just (t, _, _) <- M.lookup (mn, ident) (E.names env) = Just t
173− | otherwise = Nothing
174− argcnt = maybe 0 countArgs ty'
175− name = identToCpp ident
176− aty = Just $ CppAny [CppConst, CppRef]
177− rty = Just $ CppAny []
178− arg' = (identToCpp arg, aty)
179− args' = (\i -> (identToCpp i, aty)) <$> fst abs'
180− abs' = unAbs body []
181− isAccessor :: Expr Ann -> Bool
182− isAccessor Accessor{} = True
183− isAccessor _ = False
184− isIndexer :: Cpp -> Bool
185− isIndexer (CppIndexer (CppStringLiteral _) (CppVar _)) = True
186− isIndexer _ = False
187− classes = qualifiedToCpp (Ident . runProperName) . T.constraintClass <$>
188− maybe [] extractConstraints ty'
189− dictClasses = zip (CppVar . fst <$> arg' : args') classes
190− convertDictIndexers = everywhereOnCpp (dictIndexerToEnum dictClasses)
191−
192− declToCpp _ (_, ident) (Constructor _ _ (ProperName _) []) =
193− return $
194− CppFunction
195− (identToCpp ident)
196− []
197− (Just $ CppAny [])
198− [CppInline]
199− (asReturnBlock $
200− CppDataLiteral [CppAccessor (CppVar $ identToCpp ident) (CppVar "data")])
201−
202− declToCpp _ (_, ident) (Constructor _ _ (ProperName _) fields) =
203− return . CppNamespace "" $
204− [ CppFunction
205− name
206− (farg <$> fields')
207− (Just $ CppAny [])
208− [CppInline]
209− (asReturnBlock $
210− CppDataLiteral $
211− CppAccessor (CppVar name) (CppVar "data") : (CppVar <$> fields'))
212− ] ++
213− if length fields > 1
214− then
215− [ CppFunction
216− (curriedName name)
217− (farg <$> f)
218− (Just $ CppAny [])
219− []
220− (CppBlock (fieldLambdas fs))
221− ]
222− else
223− []
224− where
225− name = identToCpp ident
226− fields' = identToCpp <$> fields
227− (f, fs) | (f' : fs') <- fields' = ([f'], fs')
228− | otherwise = ([], [])
229− farg = \x -> (x, Just $ CppAny [CppConst, CppRef])
230− fieldLambdas flds
231− | (f' : fs') <- flds = [ CppReturn . maybeRemCaps $
232− CppLambda
233− [CppCaptureAll]
234− (farg <$> [f'])
235− (Just $ CppAny [])
236− (CppBlock $ fieldLambdas fs') ]
237− | otherwise = [CppReturn $ CppApp (CppVar name) (CppVar <$> fields')]
238−
239− declToCpp qs (_, ident) e
240− | Just ty <- exprType e,
241− CppTopLevel `elem` qs,
242− argcnt <- countArgs ty,
243− argcnt > 0 = do
244− argNames <- replicateM argcnt freshName
245− block <- valueToCpp $
246− curriedApp
247− (tail argNames)
248− (App nullAnn e (Var nullAnn . Qualified Nothing . Ident $ head argNames))
249− let fn' = CppFunction
250− (curriedName name)
251− [(head argNames, Just $ CppAny [CppConst, CppRef])]
252− rty
253− []
254− (asReturnBlock $
255− curriedLambda
256− (tail argNames)
257− (CppApp (CppVar name)
258− (CppVar <$> argNames)))
259− return $ CppNamespace "" $
260− [ CppFunction
261− name
262− (zip argNames $ repeat aty)
263− rty
264− []
265− (asReturnBlock block)
266− ] ++ if argcnt > 1
267− then [fn']
268− else []
269− where
270− name = identToCpp ident
271− aty = Just $ CppAny [CppConst, CppRef]
272− rty = Just $ CppAny []
273−
274− declToCpp _ (_, ident) val = do
275− val' <- valueToCpp val
276− return $
277− CppVariableIntroduction
278− (identToCpp ident, Just $ CppAny [CppConst])
279− []
280− (Just val')
281−
282− -------------------------------------------------------------------------------------------------
283− exprType :: Expr Ann -> Maybe T.Type
284− -------------------------------------------------------------------------------------------------
285− exprType (Var (_, _, Just ty, _) _) = Just ty
286− exprType (App (_, _, Just ty, _) _ _) = Just ty
287− exprType (Case (_, _, Just ty, _) _ _) = Just ty
288− exprType (Let (_, _, Just ty, _) _ _) = Just ty
289− exprType _ = Nothing
290−
291− -------------------------------------------------------------------------------------------------
292− fnToLambda :: Cpp -> Cpp
293− -------------------------------------------------------------------------------------------------
294− fnToLambda (CppFunction name args _ qs body) =
295− CppVariableIntroduction
296− (name, Just $ CppAny [CppConst])
297− (filter (==CppStatic) qs)
298− (Just $ CppLambda cs args (Just $ CppAny []) body)
299− where
300− cs | (not . null) (qs `intersect` [CppInline, CppStatic]) = []
301− | otherwise = [CppCaptureAll]
302− fnToLambda (CppComment com cpp) = CppComment com (fnToLambda cpp)
303− fnToLambda _ = error "Not a function!"
304−
305− -------------------------------------------------------------------------------------------------
306− convertNestedLambdas :: Cpp -> Cpp
307− -------------------------------------------------------------------------------------------------
308− convertNestedLambdas = everywhereOnCpp go
309− where
310− go :: Cpp -> Cpp
311− go f@(CppFunction {}) = maybeRemCaps $ fnToLambda f
312− go (CppLambda _ args rtyp body) = maybeRemCaps $ CppLambda [CppCaptureAll] args rtyp body
313− go cpp = cpp
314−
315− -------------------------------------------------------------------------------------------------
316− convertRecursiveFns :: [Cpp] -> Cpp -> [Cpp]
317− -------------------------------------------------------------------------------------------------
318− convertRecursiveFns cpps otherCpp
319− | not $ null fns = dict : (accessor topdict <$> filteredFns allCpps) ++ cpps'
320− where
321− cpps' = everywhereOnCpp removeRec <$> cpps
322− allCpps = CppBlock $ otherCpp : cpps'
323−
324− fns :: [(String, Cpp)]
325− fns = toelem <$> concatMap (everythingOnCpp (++) recursive) cpps
326−
327− filteredFns :: Cpp -> [(String, Cpp)]
328− filteredFns cpp = filter (\(f,_) -> everythingOnCpp (||) (== CppVar f) cpp) fns
329−
330− recursive :: Cpp -> [Cpp]
331− recursive cpp'@(CppFunction _ _ _ qs _) | CppRecursive `elem` qs = [cpp']
332− recursive _ = []
333−
334− removeRec :: Cpp -> Cpp
335− removeRec(CppFunction _ _ _ qs _) | CppRecursive `elem` qs = CppNoOp
336− removeRec cpp' = cpp'
337−
338− dict :: Cpp
339− dict = CppVariableIntroduction
340− (topdict, Just $ CppAny [CppConst])
341− []
342− (Just $ CppDataLiteral ((\(f,cpp) -> CppComment [LineComment f] cpp) <$> fns))
343−
344− accessor :: String -> (String, Cpp) -> Cpp
345− accessor dictname (name, _) =
346− CppVariableIntroduction
347− (name, Just $ CppAny [CppConst])
348− []
349− (Just accessed)
350− where
351− dict' = CppVar dictname
352− dict'' = CppCast dataType dict'
353− accessed = CppApp
354− (CppIndexer
355− (CppNumericLiteral .
356− Left .
357− fromIntegral .
358− fromJust $ findIndex ((== name) . fst) fns)
359− dict'')
360− [dict']
361−
362− toelem :: Cpp -> (String, Cpp)
363− toelem (CppFunction name args rtyp _ body'@(CppBlock body)) =
364− (name, withdict . maybeRemCaps $ CppLambda
365− [CppCaptureAll]
366− args
367− rtyp
368− (CppBlock $ (accessor localdict <$> filteredFns body') ++ body))
369− toelem _ = error "not a function"
370−
371− withdict :: Cpp -> Cpp
372− withdict cpp' = maybeRemCaps $ CppLambda
373− [CppCaptureAll]
374− [(localdict, Just $ CppAny [CppConst, CppRef])]
375− (Just $ CppAny [])
376− (asReturnBlock cpp')
377− topdict :: String
378− topdict = "_$dict$_"
379− localdict :: String
380− localdict = "$dict$"
381−
382− convertRecursiveFns cpps _ = cpps
383−
384− -- |
385− -- Generate code in the simplified C++1x intermediate representation for a value or expression.
386− --
387− -------------------------------------------------------------------------------------------------
388− valueToCpp :: Expr Ann -> m Cpp
389− -------------------------------------------------------------------------------------------------
390− valueToCpp (Var (_, _, _, Just (IsConstructor _ [])) ident) =
391− return $ CppApp (varToCpp ident) []
392−
393− valueToCpp (Var (_, _, _, Just (IsConstructor _ [_])) ident) =
394− return $ varToCpp ident
395−
396− valueToCpp (Var (_, _, _, Just (IsConstructor _ _)) ident) =
397− return . curriedName' $ varToCpp ident
398−
399− valueToCpp (Var (_, _, Just ty, _) ident@(Qualified (Just _) _))
400− | countArgs ty > 1 =
401− return . curriedName' $ varToCpp ident
402−
403− valueToCpp (Var _ ident) =
404− return $ varToCpp ident
405−
406− valueToCpp (Literal _ (NumericLiteral n)) =
407− return (CppNumericLiteral n)
408−
409− valueToCpp (Literal _ (StringLiteral s)) =
410− return (CppStringLiteral s)
411−
412− valueToCpp (Literal _ (CharLiteral c)) =
413− return (CppCharLiteral c)
414−
415− valueToCpp (Literal _ (BooleanLiteral b)) =
416− return (CppBooleanLiteral b)
417−
418− valueToCpp (Literal _ (ArrayLiteral xs)) =
419− CppArrayLiteral <$> mapM valueToCpp xs
420−
421− valueToCpp (Literal _ (ObjectLiteral ps)) =
422− CppObjectLiteral <$> sortBy (compare `on` fst) <$> mapM (sndM valueToCpp) ps
423−
424− valueToCpp (Accessor _ prop val) =
425− CppIndexer <$> pure (CppStringLiteral prop) <*> valueToCpp val
426−
427− -- TODO: use a more efficient way of copying/updating the map?
428− valueToCpp (ObjectUpdate (_, _, Just ty, _) obj ps) = do
429− obj' <- valueToCpp obj
430− updatedFields <- mapM (sndM valueToCpp) ps
431− let origKeys = (allKeys ty) \\ (fst <$> updatedFields)
432− origFields = (\key -> (key, CppIndexer (CppStringLiteral key) obj')) <$> origKeys
433− return $ CppObjectLiteral . sortBy (compare `on` fst) $ origFields ++ updatedFields
434− where
435− allKeys :: T.Type -> [String]
436− allKeys (T.TypeApp (T.TypeConstructor _) r@(T.RCons {})) = fst <$> (fst $ T.rowToList r)
437− allKeys (T.ForAll _ t _) = allKeys t
438− allKeys _ = error $ show "Not a recognized row type"
439−
440− valueToCpp (ObjectUpdate _ _ _) = error $ "Bad Type in object update!"
441−
442− valueToCpp (Abs (_, _, ty, _) arg body) = do
443− cpp <- valueToCpp body
444− let cpp' = convertNestedLambdas cpp
445− return $
446− CppLambda
447− []
448− [(identToCpp arg, Just $ CppAny [CppConst, CppRef])]
449− (Just $ CppAny [])
450− (asReturnBlock $ convertDictIndexers cpp')
451− where
452− arg' = identToCpp arg
453− args' = identToCpp <$> (fst $ unAbs body [])
454− classes = qualifiedToCpp (Ident . runProperName) . T.constraintClass <$>
455− maybe [] extractConstraints ty
456− dictClasses = zip (CppVar <$> arg' : args') classes
457− convertDictIndexers = everywhereOnCpp (dictIndexerToEnum dictClasses)
458− valueToCpp e@App{} = do
459− let (f, args) = unApp e []
460− args' <- mapM valueToCpp args
461− case f of
462− Var (_, _, _, Just IsNewtype) _ -> return (head args')
463− Var (_, _, _, Just (IsConstructor _ fields)) ident
464− | length args == length fields ->
465− return $ CppApp (uncurried' $ qualifiedToCpp id ident) args'
466− Var (_, _, _, Just IsTypeClassConstructor) (Qualified mn' (Ident classname)) ->
467− let Just (_, constraints, fns) = findClass (Qualified mn' (ProperName classname)) in
468− return . CppObjectLiteral $
469− zip
470− ((sort $ superClassDictionaryNames constraints) ++ (fst <$> fns))
471− args'
472− Var ann (Qualified (Just mn') ident)
473− | argcnt <- maybe 0 countArgs ty,
474− argcnt > 1 -> do
475− f' <- valueToCpp f
476− let (uncurriedArgs, curriedArgs) =
477− if length args' >= argcnt
478− then splitAt argcnt args'
479− else ([], args')
480− fn' =
481− if null uncurriedArgs
482− then curriedName' f'
483− else CppApp (uncurried' f') uncurriedArgs
484− return $ foldl (\fn a -> CppApp fn [a]) fn' curriedArgs
485− where
486− ty | (_, _, Just t, _) <- ann = Just t
487− | Just (t, _, _) <- M.lookup (mn', ident) (E.names env) = Just t
488− | otherwise = Nothing
489− _ ->
490− flip (foldl (\fn a -> CppApp fn [a])) args' <$> valueToCpp f
491−
492− valueToCpp (Case (maybeSpan, _, ty, _) values binders) = do
493− vals <- mapM valueToCpp values
494− bindersToCpp maybeSpan ty binders vals
495−
496− valueToCpp (Let _ ds val) = do
497− ds' <- concat <$> mapM (bindToCpp []) ds
498− ret <- valueToCpp val
499− opts <- ask
500− let ds'' = tco opts <$> ds'
501− let rs = if hasRecursion ds''
502− then convertRecursiveFns ds'' ret
503− else ds''
504− let cpps = convertNestedLambdas <$> rs
505− return $ CppApp
506− (CppLambda [] [] Nothing (CppBlock (cpps ++ [CppReturn ret])))
507− []
508− where
509− hasRecursion :: [Cpp] -> Bool
510− hasRecursion cpps' = any (everythingOnCpp (||) hasRecursiveRef) cpps'
511− where
512− fnames :: [String]
513− fnames = concatMap (everythingOnCpp (++) fname) cpps'
514−
515− fname :: Cpp -> [String]
516− fname (CppFunction name _ _ _ _) = [name]
517− fname _ = []
518−
519− hasRecursiveRef :: Cpp -> Bool
520− hasRecursiveRef (CppFunction _ _ _ _ body) = everythingOnCpp (||) ref body
521− hasRecursiveRef _ = False
522−
523− ref :: Cpp -> Bool
524− ref (CppVar name) | name `elem` fnames = True
525− ref _ = False
526−
527− valueToCpp Constructor{} = return CppNoOp
528−
529− -- |
530− -- Generate code in the simplified C++1x intermediate representation for a reference to a
531− -- variable.
532− --
533− -------------------------------------------------------------------------------------------------
534− varToCpp :: Qualified Ident -> Cpp
535− -------------------------------------------------------------------------------------------------
536− varToCpp (Qualified Nothing ident) = CppVar (identToCpp ident)
537− varToCpp qual = qualifiedToCpp id qual
538−
539− -- |
540− -- Generate code in the simplified C++1x intermediate representation for pattern match binders
541− -- and guards.
542− --
543− -------------------------------------------------------------------------------------------------
544− bindersToCpp :: Maybe SourceSpan -> Maybe T.Type -> [CaseAlternative Ann] -> [Cpp] -> m Cpp
545− -------------------------------------------------------------------------------------------------
546− bindersToCpp maybeSpan _ binders vals = do
547− valNames <- replicateM (length vals) freshName
548− let assignments = zipWith mkVarDecl valNames (map Just vals)
549− cpps <- forM binders $ \(CaseAlternative bs result) -> do
550− ret <- guardsToCpp result
551− go valNames ret bs
552− return $
553− CppApp
554− (CppLambda
555− []
556− []
557− (Just $ CppAny [])
558− (CppBlock (assignments ++ concat cpps ++ [failedPatternError valNames])))
559− []
560− where
561− mkVarDecl :: String -> Maybe Cpp -> Cpp
562− mkVarDecl name = CppVariableIntroduction (name, Nothing) []
563− go :: [String] -> [Cpp] -> [Binder Ann] -> m [Cpp]
564− go _ done [] = return done
565− go (v:vs) done' (b:bs) = do
566− done'' <- go vs done' bs
567− binderToCpp v done'' b
568− go _ _ _ = error "Invalid arguments to bindersToCpp"
569−
570− failedPatternError :: [String] -> Cpp
571− failedPatternError _ =
572− CppThrow $ CppApp (CppVar "runtime_error") [CppStringLiteral errorMessage]
573−
574− errorMessage :: String
575− errorMessage = "Failed pattern match" ++
576− maybe "" (((" at " ++ runModuleName mn ++ " ") ++) . displayStartEndPos) maybeSpan ++
577− ": "
578−
579− guardsToCpp :: Either [(Guard Ann, Expr Ann)] (Expr Ann) -> m [Cpp]
580− guardsToCpp (Left gs) = forM gs $ \(cond, val) -> do
581− cond' <- valueToCpp cond
582− done <- valueToCpp val
583− return $ CppIfElse cond' (asReturnBlock done) Nothing
584− guardsToCpp (Right v) = return . CppReturn <$> valueToCpp v
585−
586− -- |
587− -- Generate code in the simplified C++1x intermediate representation for a pattern match
588− -- binder.
589− --
590− -------------------------------------------------------------------------------------------------
591− binderToCpp :: String -> [Cpp] -> Binder Ann -> m [Cpp]
592− -------------------------------------------------------------------------------------------------
593− binderToCpp _ done (NullBinder{}) = return done
594−
595− binderToCpp varName done (LiteralBinder _ l) =
596− literalToBinderCpp varName done l
597−
598− binderToCpp varName done (VarBinder _ ident) =
599− return $
600− CppVariableIntroduction
601− (identToCpp ident, Just $ CppAny [CppConst])
602− []
603− (Just $ CppVar varName)
604− : done
605−
606− binderToCpp varName done (ConstructorBinder (_, _, _, Just IsNewtype) _ _ [b]) =
607− binderToCpp varName done b
608−
609− binderToCpp varName done (ConstructorBinder (_, _, _, Just (IsConstructor ctorType fields))
610− _
611− (Qualified mn' (ProperName ctor))
612− bs) = do
613− cpps <- go (zip fields bs) done
614− return $
615− case ctorType of
616− ProductType -> cpps
617− SumType ->
618− [ CppIfElse
619− (CppBinary
620− EqualTo
621− (CppIndexer
622− (CppVar ctorKey)
623− (CppCast dataType $ CppVar varName))
624− ctorCpp)
625− (CppBlock cpps)
626− Nothing]
627− where
628− go :: [(Ident, Binder Ann)] -> [Cpp] -> m [Cpp]
629− go [] done' = return done'
630− go ((field, binder) : remain) done' = do
631− argVar <- freshName
632− done'' <- go remain done'
633− cpps <- binderToCpp argVar done'' binder
634− return $
635− CppVariableIntroduction
636− (argVar, Nothing)
637− []
638− (Just $ CppIndexer
639− (fieldToIndex field)
640− (CppCast dataType $ CppVar varName))
641− : cpps
642− fieldToIndex :: Ident -> Cpp
643− fieldToIndex = CppNumericLiteral . Left . (+1) . read . dropWhile isLetter . runIdent
644− ctor' :: Cpp
645− ctor' = CppAccessor (CppVar . identToCpp $ Ident ctor) (CppVar "data")
646− ctorCpp :: Cpp
647− ctorCpp | Just mn'' <- mn', mn'' /= mn = CppAccessor ctor' (CppVar $ moduleNameToCpp mn'')
648− | otherwise = ctor'
649−
650− binderToCpp _ _ b@(ConstructorBinder{}) =
651− error $ "Invalid ConstructorBinder in binderToCpp: " ++ show b
652−
653− binderToCpp varName done (NamedBinder _ ident binder) = do
654− cpp <- binderToCpp varName done binder
655− return $
656− CppVariableIntroduction
657− (identToCpp ident, Just $ CppAny [CppConst])
658− []
659− (Just $ CppVar varName)
660− : cpp
661−
662− -------------------------------------------------------------------------------------------------
663− literalToBinderCpp :: String -> [Cpp] -> Literal (Binder Ann) -> m [Cpp]
664− -------------------------------------------------------------------------------------------------
665− literalToBinderCpp varName done (NumericLiteral num) =
666− return [ CppIfElse
667− (CppBinary EqualTo (CppVar varName) (CppNumericLiteral num))
668− (CppBlock done)
669− Nothing ]
670−
671− literalToBinderCpp varName done (CharLiteral c) =
672− return [ CppIfElse
673− (CppBinary EqualTo (CppVar varName) (CppCharLiteral c))
674− (CppBlock done)
675− Nothing ]
676−
677− literalToBinderCpp varName done (StringLiteral str) =
678− return [ CppIfElse
679− (CppBinary EqualTo (CppVar varName) (CppStringLiteral str))
680− (CppBlock done)
681− Nothing ]
682−
683− literalToBinderCpp varName done (BooleanLiteral True) =
684− return [ CppIfElse
685− (CppVar varName)
686− (CppBlock done)
687− Nothing ]
688−
689− literalToBinderCpp varName done (BooleanLiteral False) =
690− return [ CppIfElse
691− (CppUnary
692− Not
693− (CppVar varName))
694− (CppBlock done)
695− Nothing ]
696−
697− literalToBinderCpp varName done (ObjectLiteral bs) = go done bs
698− where
699− go :: [Cpp] -> [(String, Binder Ann)] -> m [Cpp]
700− go done' [] = return done'
701− go done' ((prop, binder):bs') = do
702− propVar <- freshName
703− done'' <- go done' bs'
704− cpp <- binderToCpp propVar done'' binder
705− return $
706− CppVariableIntroduction
707− (propVar, Nothing)
708− []
709− (Just $ CppIndexer
710− (CppStringLiteral prop)
711− (CppVar varName))
712− : cpp
713−
714− literalToBinderCpp varName done (ArrayLiteral bs) = do
715− cpp <- go done 0 bs
716− let cond =
717− case length bs of
718− 0 -> CppBinary
719− Dot
720− (CppCast arrayType $ CppVar varName)
721− (CppApp (CppVar "empty") [])
722− n -> let var = CppCast arrayType $ CppVar varName
723− in CppBinary
724− EqualTo
725− (CppBinary Dot var (CppApp (CppVar "size") []))
726− (CppNumericLiteral (Left (fromIntegral n)))
727− return [ CppIfElse cond (CppBlock cpp) Nothing ]
728− where
729− go :: [Cpp] -> Integer -> [Binder Ann] -> m [Cpp]
730− go done' _ [] = return done'
731− go done' index (binder:bs') = do
732− elVar <- freshName
733− done'' <- go done' (index + 1) bs'
734− cpp <- binderToCpp elVar done'' binder
735− return $
736− CppVariableIntroduction
737− (elVar, Nothing)
738− []
739− (Just $ CppIndexer
740− (CppNumericLiteral (Left index))
741− (CppVar varName))
742− : cpp
743−
744− -------------------------------------------------------------------------------------------------
745− unApp :: Expr Ann -> [Expr Ann] -> (Expr Ann, [Expr Ann])
746− -------------------------------------------------------------------------------------------------
747− unApp (App _ val arg) args = unApp val (arg : args)
748− unApp other args = (other, args)
749−
750− -------------------------------------------------------------------------------------------------
751− unAbs :: Expr Ann -> [Ident] -> ([Ident], Expr Ann)
752− -------------------------------------------------------------------------------------------------
753− unAbs (Abs _ arg val) args = unAbs val (args ++ [arg])
754− unAbs other args = (args, other)
755−
756− -------------------------------------------------------------------------------------------------
757− qualifiedToCpp :: (a -> Ident) -> Qualified a -> Cpp
758− -------------------------------------------------------------------------------------------------
759− qualifiedToCpp f (Qualified (Just (ModuleName [ProperName mn'])) a)
760− | mn' == C.prim = CppVar . runIdent $ f a
761− qualifiedToCpp f (Qualified (Just mn') a)
762− | mn /= mn' = CppAccessor (CppVar . identToCpp $ f a) (CppVar (moduleNameToCpp mn'))
763− qualifiedToCpp f (Qualified _ a) = CppVar $ identToCpp (f a)
764−
765− -- |
766− -- Find a class in scope by name, retrieving its list of constraints, function names and types.
767− --
768− -------------------------------------------------------------------------------------------------
769− findClass :: Qualified (ProperName 'ClassName) -> Maybe ([String], [T.Constraint], [(String, T.Type)])
770− -------------------------------------------------------------------------------------------------
771− findClass name
772− | Just (params, fns, constraints) <- M.lookup name (E.typeClasses env),
773− fns' <- (\(i,t) -> (runIdent i, t)) <$> fns
774− = Just (fst <$> params, constraints, (sortBy (compare `on` normalizedName . fst) fns'))
775− findClass _ = Nothing
776−
777− -------------------------------------------------------------------------------------------------
778− dataCtors :: [Cpp]
779− -------------------------------------------------------------------------------------------------
780− dataCtors = [CppNamespace "data"
781− [CppEnum Nothing (Just intType) . ("_" :) .
782− catMaybes . map modCtor . M.keys $ E.dataConstructors env]]
783− where
784− modCtor :: Qualified (ProperName a) -> Maybe String
785− modCtor (Qualified (Just mn') (ProperName name)) | mn' == mn = Just name
786− modCtor _ = Nothing
787−
788− -------------------------------------------------------------------------------------------------
789− curriedForeigns :: m [Cpp]
790− -------------------------------------------------------------------------------------------------
791− curriedForeigns = concat <$> mapM go allForeigns
792− where
793− go (ident, ty)
794− | argcnt <- countArgs ty,
795− argcnt > 1 = do
796− let name = identToCpp ident
797− argNames <- replicateM argcnt freshName
798− return $
799− [ CppFunction
800− (curriedName name)
801− [(head argNames, Just $ CppAny [CppConst, CppRef])]
802− (Just $ CppAny [])
803− []
804− (asReturnBlock $
805− curriedLambda
806− (tail argNames)
807− (CppApp (CppVar name)
808− (CppVar <$> argNames)))
809− ]
810− go _ = return []
811−
812− allForeigns :: [(Ident, T.Type)]
813− allForeigns = map (\((_, ident), (ty, _, _)) -> (ident, ty)) .
814− filter (\((mn', _), (_, kind, _)) -> mn' == mn && kind == E.External) .
815− M.toList $ E.names env
816−
817−---------------------------------------------------------------------------------------------------
818−asReturnBlock :: Cpp -> Cpp
819−---------------------------------------------------------------------------------------------------
820−asReturnBlock cpp = CppBlock [CppReturn cpp]
821−
822−---------------------------------------------------------------------------------------------------
823−curriedLambda :: [String] -> Cpp -> Cpp
824−---------------------------------------------------------------------------------------------------
825−curriedLambda args ret = foldr (\arg ret' -> CppLambda
826− [CppCaptureAll]
827− [(arg, Just $ CppAny [CppConst, CppRef])]
828− (Just $ CppAny [])
829− (asReturnBlock ret')
830− ) ret args
831−
832−---------------------------------------------------------------------------------------------------
833−curriedApp :: [String] -> Expr Ann -> Expr Ann
834−---------------------------------------------------------------------------------------------------
835−curriedApp args vals = foldl (\val arg -> App
836− nullAnn
837− val
838− (Var nullAnn . Qualified Nothing $ Ident arg))
839− vals args
840−
841−---------------------------------------------------------------------------------------------------
842−countArgs :: T.Type -> Int
843−---------------------------------------------------------------------------------------------------
844−countArgs = go 0
845− where
846− go argcnt (T.ForAll _ t _) = go argcnt t
847− go argcnt (T.TypeApp (T.TypeApp fn _) t) | fn == E.tyFunction = go (argcnt + 1) t
848− go argcnt (T.ConstrainedType ts t) = go (argcnt + length ts) t
849− go argcnt _ = argcnt
850−
851−---------------------------------------------------------------------------------------------------
852−extractConstraints :: T.Type -> [T.Constraint]
853−---------------------------------------------------------------------------------------------------
854−extractConstraints = go []
855− where
856− go cs (T.ForAll _ t _) = go cs t
857− go cs (T.TypeApp (T.TypeApp fn _) t) | fn == E.tyFunction = go cs t
858− go cs (T.ConstrainedType ts t) = go (cs ++ ts) t
859− go cs _ = cs
860−
861−---------------------------------------------------------------------------------------------------
862−dictIndexerToEnum :: [(Cpp,Cpp)] -> Cpp -> Cpp
863−---------------------------------------------------------------------------------------------------
864−dictIndexerToEnum repls (CppIndexer (CppStringLiteral prop) dict)
865− | Just cls <- lookup dict repls =
866− CppBinary Dot
867− (CppIndexer
868− (CppAccessor (CppVar . identToCpp $ Ident prop) cls)
869− (CppCast mapType dict))
870− (CppVar "second")
871−dictIndexerToEnum _ cpp = cpp
872−
873−---------------------------------------------------------------------------------------------------
874−curriedName :: String -> String
875−---------------------------------------------------------------------------------------------------
876−curriedName name@('$' : _) = name
877−curriedName name = '$' : name
878−
879−---------------------------------------------------------------------------------------------------
880−uncurried' :: Cpp -> Cpp
881−---------------------------------------------------------------------------------------------------
882−uncurried' (CppVar ('$':name)) = CppVar name
883−uncurried' (CppAccessor a b) = CppAccessor (uncurried' a) b
884−uncurried' cpp = cpp
885−
886−---------------------------------------------------------------------------------------------------
887−curriedName' :: Cpp -> Cpp
888−---------------------------------------------------------------------------------------------------
889−curriedName' (CppVar name) = CppVar (curriedName name)
890−curriedName' (CppAccessor a b) = CppAccessor (curriedName' a) b
891−curriedName' cpp = cpp
src/Language/PureScript/CodeGen/Cpp/AST.hsdeleted−376
@@ -1,376 +0,0 @@
1−-----------------------------------------------------------------------------
2−--
3−-- Module : Language.PureScript.CodeGen.Cpp.AST
4−-- Copyright : (c) 2013-15 Phil Freeman, Andy Arvanitis, and other contributors
5−-- License : MIT
6−--
7−-- Maintainer : Andy Arvanitis
8−-- Stability : experimental
9−-- Portability :
10−--
11−-- |
12−-- Data types for the intermediate simplified-C++11 AST
13−--
14−-----------------------------------------------------------------------------
15−
16−{-# LANGUAGE DeriveDataTypeable #-}
17−{-# LANGUAGE CPP #-}
18−
19−module Language.PureScript.CodeGen.Cpp.AST where
20−
21−import Prelude.Compat
22−
23−#if __GLASGOW_HASKELL__ < 710
24−import Control.Applicative (Applicative, (<$>), (<*>))
25−import Data.Traversable (traverse)
26−#endif
27−import Control.Monad.Identity
28−import Language.PureScript.Comments
29−import Language.PureScript.CodeGen.Cpp.Types
30−import Language.PureScript.Traversals
31−
32−-- |
33−-- Built-in unary operators
34−--
35−data UnaryOperator
36− -- |
37− -- Numeric negation
38− --
39− = Negate
40− -- |
41− -- Boolean negation
42− --
43− | Not
44− -- |
45− -- Bitwise negation
46− --
47− | BitwiseNot
48− -- |
49− -- Numeric unary \'plus\'
50− --
51− | Positive
52− -- |
53− -- Constructor
54− --
55− | New
56− deriving (Show, Read, Eq)
57−
58−-- |
59−-- Built-in binary operators
60−--
61−data BinaryOperator
62− -- |
63− -- Numeric addition
64− --
65− = Add
66− -- |
67− -- Numeric subtraction
68− --
69− | Subtract
70− -- |
71− -- Numeric multiplication
72− --
73− | Multiply
74− -- |
75− -- Numeric division
76− --
77− | Divide
78− -- |
79− -- Remainder
80− --
81− | Modulus
82− -- |
83− -- TODO: revisit this
84− --
85− | Dot
86− -- |
87− -- Generic equality test
88− --
89− | EqualTo
90− -- |
91− -- Generic inequality test
92− --
93− | NotEqualTo
94− -- |
95− -- Numeric less-than
96− --
97− | LessThan
98− -- |
99− -- Numeric less-than-or-equal
100− --
101− | LessThanOrEqualTo
102− -- |
103− -- Numeric greater-than
104− --
105− | GreaterThan
106− -- |
107− -- Numeric greater-than-or-equal
108− --
109− | GreaterThanOrEqualTo
110− -- |
111− -- Boolean and
112− --
113− | And
114− -- |
115− -- Boolean or
116− --
117− | Or
118− -- |
119− -- Bitwise and
120− --
121− | BitwiseAnd
122− -- |
123− -- Bitwise or
124− --
125− | BitwiseOr
126− -- |
127− -- Bitwise xor
128− --
129− | BitwiseXor
130− -- |
131− -- Bitwise left shift
132− --
133− | ShiftLeft
134− -- |
135− -- Bitwise right shift
136− --
137− | ShiftRight
138− --
139− deriving (Show, Read, Eq)
140−
141−-- |
142−-- Data type for simplified C++11 expressions
143−--
144−data Cpp
145− -- |
146− -- A numeric literal
147− --
148− = CppNumericLiteral (Either Integer Double)
149− -- |
150− -- A string literal
151− --
152− | CppStringLiteral String
153− -- |
154− -- A character literal
155− --
156− | CppCharLiteral Char
157− -- |
158− -- A boolean literal
159− --
160− | CppBooleanLiteral Bool
161− -- |
162− -- A unary operator application
163− --
164− | CppUnary UnaryOperator Cpp
165− -- |
166− -- A binary operator application
167− --
168− | CppBinary BinaryOperator Cpp Cpp
169− -- |
170− -- An array literal
171− --
172− | CppArrayLiteral [Cpp]
173− -- |
174− -- A data literal
175− --
176− | CppDataLiteral [Cpp]
177− -- |
178− -- An enum definition (optional name, optional type)
179− --
180− | CppEnum (Maybe String) (Maybe CppType) [String]
181− -- |
182− -- An array indexer expression
183− --
184− | CppIndexer Cpp Cpp
185− -- |
186− -- An object literal
187− --
188− | CppObjectLiteral [(String, Cpp)]
189− -- |
190− -- An general property accessor expression (property, expr)
191− --
192− | CppAccessor Cpp Cpp
193− -- |
194− -- A function introduction (name, arguments, return type, qualifiers, body)
195− --
196− | CppFunction String [(String, Maybe CppType)] (Maybe CppType) [CppValueQual] Cpp
197− -- |
198− -- A lambda introduction (arguments, return type, body)
199− --
200− | CppLambda [CppCaptureType] [(String, Maybe CppType)] (Maybe CppType) Cpp
201− -- |
202− -- Value type cast
203− --
204− | CppCast CppType Cpp
205− -- |
206− -- Function application
207− --
208− | CppApp Cpp [Cpp]
209− -- |
210− -- Variable
211− --
212− | CppVar String
213− -- |
214− -- A block of expressions in braces
215− --
216− | CppBlock [Cpp]
217− -- |
218− -- A C++ namespace
219− --
220− | CppNamespace String [Cpp]
221− -- |
222− -- An C++ struct declaration (name, members)
223− --
224− | CppStruct String [Cpp]
225− -- |
226− -- A C++ #include
227− --
228− | CppInclude String String
229− -- |
230− -- A C++ using namespace declaration
231− --
232− | CppUseNamespace String
233− -- |
234− -- Type alias, e.g. "using T = U" (new name and template types, original type)
235− --
236− | CppTypeAlias (String,[(String, Int)]) CppType String
237− -- |
238− -- A variable introduction and optional initialization
239− --
240− | CppVariableIntroduction (String, Maybe CppType) [CppValueQual] (Maybe Cpp)
241− -- |
242− -- A variable assignment
243− --
244− | CppAssignment Cpp Cpp
245− -- |
246− -- While loop
247− --
248− | CppWhile Cpp Cpp
249− -- |
250− -- If-then-else statement
251− --
252− | CppIfElse Cpp Cpp (Maybe Cpp)
253− -- |
254− -- Switch statement
255− --
256− | CppSwitch Cpp [(Cpp, Cpp)]
257− -- |
258− -- Return statement
259− --
260− | CppReturn Cpp
261− -- |
262− -- Throw statement
263− --
264− | CppThrow Cpp
265− -- |
266− -- Continue statement
267− --
268− | CppContinue
269− -- |
270− -- Empty statement/expression
271− --
272− | CppNoOp
273− -- |
274− -- Marker for header/source split
275− --
276− | CppEndOfHeader
277− -- |
278− -- Raw C++11 (generated when parsing fails for an inline foreign import declaration)
279− --
280− | CppRaw String
281− -- |
282− -- Commented C++11
283− --
284− | CppComment [Comment] Cpp
285− deriving (Show, Read, Eq)
286−
287−--
288−-- Traversals
289−--
290−
291−everywhereOnCpp :: (Cpp -> Cpp) -> Cpp -> Cpp
292−everywhereOnCpp f = go
293− where
294− go :: Cpp -> Cpp
295− go (CppUnary op j) = f (CppUnary op (go j))
296− go (CppBinary op j1 j2) = f (CppBinary op (go j1) (go j2))
297− go (CppArrayLiteral cpp) = f (CppArrayLiteral (map go cpp))
298− go (CppDataLiteral cpp) = f (CppDataLiteral (map go cpp))
299− go (CppIndexer j1 j2) = f (CppIndexer (go j1) (go j2))
300− go (CppObjectLiteral cpp) = f (CppObjectLiteral (map (fmap go) cpp))
301− go (CppAccessor prop j) = f (CppAccessor (go prop) (go j))
302− go (CppFunction name args rty qs j) = f (CppFunction name args rty qs (go j))
303− go (CppLambda cps args rty j) = f (CppLambda cps args rty (go j))
304− go (CppCast t cpp) = f (CppCast t (go cpp))
305− go (CppApp j cpp) = f (CppApp (go j) (map go cpp))
306− go (CppBlock cpp) = f (CppBlock (map go cpp))
307− go (CppNamespace name cpp) = f (CppNamespace name (map go cpp))
308− go (CppStruct name cpp) = f (CppStruct name (map go cpp))
309− go (CppVariableIntroduction name qs j) = f (CppVariableIntroduction name qs (fmap go j))
310− go (CppAssignment j1 j2) = f (CppAssignment (go j1) (go j2))
311− go (CppWhile j1 j2) = f (CppWhile (go j1) (go j2))
312− go (CppIfElse j1 j2 j3) = f (CppIfElse (go j1) (go j2) (fmap go j3))
313− go (CppSwitch cpp cpps) = f (CppSwitch (go cpp) (map (fmap go) cpps))
314− go (CppReturn cpp) = f (CppReturn (go cpp))
315− go (CppThrow cpp) = f (CppThrow (go cpp))
316− go (CppComment com j) = f (CppComment com (go j))
317− go other = f other
318−
319−everywhereOnCppTopDown :: (Cpp -> Cpp) -> Cpp -> Cpp
320−everywhereOnCppTopDown f = runIdentity . everywhereOnCppTopDownM (Identity . f)
321−
322−everywhereOnCppTopDownM :: (Applicative m, Monad m) => (Cpp -> m Cpp) -> Cpp -> m Cpp
323−everywhereOnCppTopDownM f = f >=> go
324− where
325− f' = f >=> go
326− go (CppUnary op j) = CppUnary op <$> f' j
327− go (CppBinary op j1 j2) = CppBinary op <$> f' j1 <*> f' j2
328− go (CppArrayLiteral cpp) = CppArrayLiteral <$> traverse f' cpp
329− go (CppDataLiteral cpp) = CppDataLiteral <$> traverse f' cpp
330− go (CppIndexer j1 j2) = CppIndexer <$> f' j1 <*> f' j2
331− go (CppObjectLiteral cpp) = CppObjectLiteral <$> traverse (sndM f') cpp
332− go (CppAccessor prop j) = CppAccessor prop <$> f' j
333− go (CppFunction name args rty qs j) = CppFunction name args rty qs <$> f' j
334− go (CppLambda cps args rty j) = CppLambda cps args rty <$> f' j
335− go (CppCast t cpp) = CppCast t <$> f' cpp
336− go (CppApp j cpp) = CppApp <$> f' j <*> traverse f' cpp
337− go (CppBlock cpp) = CppBlock <$> traverse f' cpp
338− go (CppNamespace name cpp) = CppNamespace name <$> traverse f' cpp
339− go (CppStruct name cpp) = CppStruct name <$> traverse f' cpp
340− go (CppVariableIntroduction name qs j) = CppVariableIntroduction name qs <$> traverse f' j
341− go (CppAssignment j1 j2) = CppAssignment <$> f' j1 <*> f' j2
342− go (CppWhile j1 j2) = CppWhile <$> f' j1 <*> f' j2
343− go (CppIfElse j1 j2 j3) = CppIfElse <$> f' j1 <*> f' j2 <*> traverse f' j3
344− go (CppSwitch cpp cpps) = CppSwitch <$> f' cpp <*> traverse (sndM f') cpps
345− go (CppReturn j) = CppReturn <$> f' j
346− go (CppThrow j) = CppThrow <$> f' j
347− go (CppComment com j) = CppComment com <$> f' j
348− go other = f other
349−
350−everythingOnCpp :: (r -> r -> r) -> (Cpp -> r) -> Cpp -> r
351−everythingOnCpp (<>) f = go
352− where
353− go j@(CppUnary _ j1) = f j <> go j1
354− go j@(CppBinary _ j1 j2) = f j <> go j1 <> go j2
355− go j@(CppArrayLiteral cpp) = foldl (<>) (f j) (map go cpp)
356− go j@(CppDataLiteral cpp) = foldl (<>) (f j) (map go cpp)
357− go j@(CppIndexer j1 j2) = f j <> go j1 <> go j2
358− go j@(CppObjectLiteral cpp) = foldl (<>) (f j) (map (go . snd) cpp)
359− go j@(CppAccessor j1 j2) = f j <> go j1 <> go j2
360− go j@(CppFunction _ _ _ _ j1) = f j <> go j1
361− go j@(CppLambda _ _ _ j1) = f j <> go j1
362− go j@(CppCast _ cpp) = f j <> go cpp
363− go j@(CppApp j1 cpp) = foldl (<>) (f j <> go j1) (map go cpp)
364− go j@(CppBlock cpp) = foldl (<>) (f j) (map go cpp)
365− go j@(CppNamespace _ cpp) = foldl (<>) (f j) (map go cpp)
366− go j@(CppStruct _ cpp) = foldl (<>) (f j) (map go cpp)
367− go j@(CppVariableIntroduction _ _ (Just j1)) = f j <> go j1
368− go j@(CppAssignment j1 j2) = f j <> go j1 <> go j2
369− go j@(CppWhile j1 j2) = f j <> go j1 <> go j2
370− go j@(CppIfElse j1 j2 Nothing) = f j <> go j1 <> go j2
371− go j@(CppIfElse j1 j2 (Just j3)) = f j <> go j1 <> go j2 <> go j3
372− go j@(CppSwitch cpp cpps) = foldl (<>) (f j <> go cpp) (map (go . snd) cpps)
373− go j@(CppReturn j1) = f j <> go j1
374− go j@(CppThrow j1) = f j <> go j1
375− go j@(CppComment _ j1) = f j <> go j1
376− go other = f other
src/Language/PureScript/CodeGen/Cpp/Common.hsdeleted−207
@@ -1,207 +0,0 @@
1−-----------------------------------------------------------------------------
2−--
3−-- Module : Language.PureScript.CodeGen.Common
4−-- Copyright : (c) 2013-15 Phil Freeman, Andy Arvanitis, and other contributors
5−-- License : MIT
6−--
7−-- Maintainer : Andy Arvanitis
8−-- Stability : experimental
9−-- Portability :
10−--
11−-- |
12−-- Common code generation utility functions
13−--
14−-----------------------------------------------------------------------------
15−
16−{-# LANGUAGE PatternGuards #-}
17−
18−module Language.PureScript.CodeGen.Cpp.Common where
19−
20−import Prelude.Compat
21−
22−import Data.Char
23−import Data.List (intercalate)
24−
25−import Language.PureScript.Crash
26−import Language.PureScript.Names
27−
28−-- |
29−-- Convert an Ident into a valid C++11 identifier:
30−--
31−-- * Alphanumeric characters are kept unmodified.
32−--
33−-- * Reserved C++11 identifiers are wrapped with '_'
34−--
35−-- * Symbols are wrapped with '_' between a symbol name or their ordinal value.
36−--
37−identToCpp :: Ident -> String
38−identToCpp (Ident name) | nameIsCppReserved name = '_' : name ++ "_"
39−identToCpp (Ident name@('$' : s)) | all isDigit s = name
40−identToCpp (Ident name) = concatMap identCharToString name
41−identToCpp (GenIdent _ _) = internalError "GenIdent in identToJs"
42−
43−-- |
44−-- Test if a string is a valid Cpp identifier without escaping.
45−--
46−identNeedsEscaping :: String -> Bool
47−identNeedsEscaping s = s /= identToCpp (Ident s)
48−
49−-- |
50−-- Attempts to find a human-readable name for a symbol, if none has been specified returns the
51−-- ordinal value.
52−--
53−identCharToString :: Char -> String
54−identCharToString c | isAlphaNum c = [c]
55−identCharToString '_' = "_"
56−identCharToString '.' = "_dot_"
57−identCharToString '$' = "_dollar_"
58−identCharToString '~' = "_tilde_"
59−identCharToString '=' = "_eq_"
60−identCharToString '<' = "_less_"
61−identCharToString '>' = "_greater_"
62−identCharToString '!' = "_bang_"
63−identCharToString '#' = "_hash_"
64−identCharToString '%' = "_percent_"
65−identCharToString '^' = "_up_"
66−identCharToString '&' = "_amp_"
67−identCharToString '|' = "_bar_"
68−identCharToString '*' = "_times_"
69−identCharToString '/' = "_div_"
70−identCharToString '+' = "_plus_"
71−identCharToString '-' = "_minus_"
72−identCharToString ':' = "_colon_"
73−identCharToString '\\' = "_bslash_"
74−identCharToString '?' = "_qmark_"
75−identCharToString '@' = "_at_"
76−identCharToString '\'' = "_prime_"
77−identCharToString c = '_' : show (ord c) ++ "_"
78−
79−-- |
80−-- Checks whether an identifier name is reserved in C++11.
81−--
82−nameIsCppReserved :: String -> Bool
83−nameIsCppReserved name =
84− name `elem` [ "alignas"
85− , "alignof"
86− , "and"
87− , "and_eq"
88− , "any"
89− , "asm"
90− , "assert"
91− , "auto"
92− , "bitand"
93− , "bitor"
94− , "bool"
95− , "boost"
96− , "break"
97− , "case"
98− , "cast"
99− , "catch"
100− , "char"
101− , "char16_t"
102− , "char32_t"
103− , "class"
104− , "compl"
105− , "concept"
106− , "const"
107− , "constexpr"
108− , "const_cast"
109− , "continue"
110− , "constructor"
111− , "decltype"
112− , "default"
113− , "delete"
114− , "do"
115− , "double"
116− , "dynamic_cast"
117− , "else"
118− , "enum"
119− , "explicit"
120− , "export"
121− , "extern"
122− , "false"
123− , "final"
124− , "float"
125− , "for"
126− , "friend"
127− , "goto"
128− , "if"
129− , "import"
130− , "inline"
131− , "int"
132− , "integer"
133− , "list"
134− , "long"
135− , "mutable"
136− , "namespace"
137− , "new"
138− , "nil"
139− , "noexcept"
140− , "not"
141− , "not_eq"
142− , "NULL"
143− , "null"
144− , "nullptr"
145− , "nullptr_t"
146− , "operator"
147− , "or"
148− , "or_eq"
149− , "override"
150− , "param"
151− , "private"
152− , "protected"
153− , "public"
154− , "PureScript"
155− , "register"
156− , "reinterpret_cast"
157− , "requires"
158− , "return"
159− , "runtime_error"
160− , "shared_list"
161− , "short"
162− , "signed"
163− , "sizeof"
164− , "static"
165− , "static_assert"
166− , "static_cast"
167− , "std"
168− , "string"
169− , "struct"
170− , "switch"
171− , "template"
172− , "this"
173− , "thread_local"
174− , "throw"
175− , "true"
176− , "try"
177− , "typedef"
178− , "typeid"
179− , "typename"
180− , "typeof"
181− , "union"
182− , "unsigned"
183− , "using"
184− , "virtual"
185− , "void"
186− , "volatile"
187− , "wchar_t"
188− , "while"
189− , "xor"
190− , "xor_eq" ] || properNameIsCppReserved name
191−
192−normalizedName :: String -> String
193−normalizedName ('_' : s) | last s == '_', s' <- init s, nameIsCppReserved s' = s'
194−normalizedName s = s
195−
196−moduleNameToCpp :: ModuleName -> String
197−moduleNameToCpp (ModuleName pns) =
198− let name = intercalate "_" (runProperName `map` pns)
199− in if properNameIsCppReserved name then '_' : name ++ "_" else name
200−
201−-- |
202−-- Checks whether a proper name is reserved in C++11.
203−--
204−properNameIsCppReserved :: String -> Bool
205−properNameIsCppReserved name =
206− name `elem` [ "Private"
207− , "PureScript" ]
src/Language/PureScript/CodeGen/Cpp/File.hsdeleted−184
@@ -1,184 +0,0 @@
1−-----------------------------------------------------------------------------
2−--
3−-- Module : Language.PureScript.CodeGen.File
4−-- Copyright : (c) 2013-15 Phil Freeman, Andy Arvanitis, and other contributors
5−-- License : MIT
6−--
7−-- Maintainer : Andy Arvanitis <andy.arvanitis@gmail.com>
8−-- Stability : experimental
9−-- Portability :
10−--
11−-- |
12−-- File generation utility functions
13−--
14−-----------------------------------------------------------------------------
15−
16−{-# LANGUAGE PatternGuards #-}
17−
18−module Language.PureScript.CodeGen.Cpp.File where
19−
20−import Prelude.Compat
21−
22−import Data.Maybe
23−
24−import Language.PureScript.CodeGen.Cpp.AST
25−import Language.PureScript.CodeGen.Cpp.Types
26−import Language.PureScript.Names
27−
28−import qualified Language.PureScript.Pretty.Cpp as P
29−
30−---------------------------------------------------------------------------------------------------
31−toHeader :: [Cpp] -> [Cpp]
32−---------------------------------------------------------------------------------------------------
33−toHeader = catMaybes . map go
34− where
35− go :: Cpp -> Maybe Cpp
36− go (CppNamespace name cpps)
37− | cpps'@(_:_) <- toHeader cpps = Just (CppNamespace name cpps')
38− | otherwise = Nothing
39− go cpp@(CppUseNamespace{}) = Just cpp
40− go (CppFunction _ _ _ qs _)
41− | CppInline `elem` qs = Nothing
42− go (CppFunction _ [(_, atyp)] _ _ (CppBlock [CppReturn (CppApp _ [_])])) | atyp == Just CppAuto
43− = Nothing
44− go (CppFunction name args rtyp qs _) =
45− let args' = (\(_,t) -> ("", t)) <$> args in
46− Just (CppFunction name args' rtyp qs CppNoOp)
47− go (CppVariableIntroduction _ _ (Just CppNumericLiteral {})) =
48− Nothing
49− go (CppVariableIntroduction _ _ (Just CppStringLiteral {})) =
50− Nothing
51− go (CppVariableIntroduction _ _ (Just CppBooleanLiteral {})) =
52− Nothing
53− go (CppVariableIntroduction (name, _) _ (Just (CppLambda _ [] rty _))) =
54− Just $ CppFunction name [] rty [] CppNoOp
55− -- Generate thunks for top-level values
56− go (CppVariableIntroduction (name, _) _ (Just _)) =
57− Just $ CppVariableIntroduction (name, Just $ CppAny [CppConst]) [CppExtern] Nothing
58− go cpp@(CppStruct {}) =
59− Just cpp
60− go (CppComment comms cpp')
61− | Just cpp <- go cpp' = Just $ case cpp of CppFunction {} -> cpp
62− _ -> CppComment comms cpp
63− go _ = Nothing
64−
65−---------------------------------------------------------------------------------------------------
66−toHeaderFns :: [Cpp] -> [Cpp]
67−---------------------------------------------------------------------------------------------------
68−toHeaderFns = catMaybes . map go
69− where
70− go :: Cpp -> Maybe Cpp
71− go (CppNamespace name cpps)
72− | cpps'@(_:_) <- toHeaderFns cpps = Just (CppNamespace name cpps')
73− | otherwise = Nothing
74− go cpp@(CppFunction _ _ _ qs _)
75− | CppInline `elem` qs = Just cpp
76− go (CppFunction name [(_, atyp)] _ _ (CppBlock [CppReturn (CppApp cpp [_])]))
77− | atyp == Just CppAuto
78− = Just (CppVariableIntroduction (name, Nothing) [] (Just cpp))
79− go cpp@(CppVariableIntroduction _ _ (Just CppNumericLiteral {})) =
80− Just cpp
81− go cpp@(CppVariableIntroduction _ _ (Just CppStringLiteral {})) =
82− Just cpp
83− go cpp@(CppVariableIntroduction _ _ (Just CppBooleanLiteral {})) =
84− Just cpp
85− go (CppComment comms cpp') | Just cpp <- go cpp' = Just (CppComment comms cpp)
86− go _ = Nothing
87−
88−---------------------------------------------------------------------------------------------------
89−toBodyDecl :: [Cpp] -> [Cpp]
90−---------------------------------------------------------------------------------------------------
91−toBodyDecl = catMaybes . map go
92− where
93− go :: Cpp -> Maybe Cpp
94− go (CppComment comms cpp') | Just commented <- go cpp' = Just (CppComment comms commented)
95− go _ = Nothing
96−
97−---------------------------------------------------------------------------------------------------
98−toBody :: [Cpp] -> [Cpp]
99−---------------------------------------------------------------------------------------------------
100−toBody = catMaybes . map go
101− where
102− go :: Cpp -> Maybe Cpp
103− go (CppNamespace name cpps)
104− | cpps'@(_:_) <- toBody cpps = Just (CppNamespace name cpps')
105− | otherwise = Nothing
106− go cpp@(CppUseNamespace{}) = Just cpp
107− go (CppFunction _ _ _ qs _)
108− | CppInline `elem` qs = Nothing
109− go cpp@(CppFunction {}) = Just cpp
110− go (CppVariableIntroduction _ _ (Just CppNumericLiteral {})) =
111− Nothing
112− go (CppVariableIntroduction _ _ (Just CppStringLiteral {})) =
113− Nothing
114− go (CppVariableIntroduction _ _ (Just CppBooleanLiteral {})) =
115− Nothing
116− go (CppVariableIntroduction (name, _) _ (Just (CppLambda _ [] rty body))) =
117− Just $ CppFunction name [] rty [] body
118− -- Generate thunks for top-level values
119− go (CppVariableIntroduction (name, _) _ (Just cpp)) =
120− Just $ CppVariableIntroduction (name, Just $ CppAny [CppConst]) [] (Just lambda)
121− where
122− val = CppVariableIntroduction ("$value$", Just $ CppAny [CppConst]) [CppStatic] (Just $ addCaptures cpp)
123− block = CppBlock [val, CppReturn (CppVar "$value$")]
124− lambda = CppLambda [] [("", Just $ thunkMarkerType)] (Just $ CppAny [CppConst, CppRef]) block
125− addCaptures :: Cpp -> Cpp
126− addCaptures (CppObjectLiteral objs) = CppObjectLiteral (objlam <$> objs)
127− where
128− objlam :: (String, Cpp) -> (String, Cpp)
129− objlam (name', (CppLambda _ args rty body)) = (name' , CppLambda [] args rty $ addCaptures body)
130− objlam obj = obj
131− addCaptures (CppApp (CppLambda _ [] rty body) []) = CppApp (CppLambda [] [] rty (addCaptures body)) []
132− addCaptures cpps' = everywhereOnCpp addCapture cpps'
133− where
134− addCapture :: Cpp -> Cpp
135− addCapture (CppLambda _ args rty body) = maybeRemCaps $ CppLambda [CppCaptureAll] args rty body
136− addCapture cpp' = cpp'
137− go (CppComment comms cpp') | Just commented <- go cpp' = Just (CppComment comms commented)
138− go _ = Nothing
139−
140−-------------------------------------------------------------------------------------------------
141−maybeRemCaps :: Cpp -> Cpp
142−-------------------------------------------------------------------------------------------------
143−maybeRemCaps (CppLambda [CppCaptureAll] args rtyp body@(CppBlock [CppReturn CppNumericLiteral{}]))
144− = CppLambda [] args rtyp body
145−maybeRemCaps (CppLambda [CppCaptureAll] args rtyp body@(CppBlock [CppReturn CppStringLiteral{}]))
146− = CppLambda [] args rtyp body
147−maybeRemCaps (CppLambda [CppCaptureAll] args rtyp body@(CppBlock [CppReturn CppCharLiteral{}]))
148− = CppLambda [] args rtyp body
149−maybeRemCaps (CppLambda [CppCaptureAll] args rtyp body@(CppBlock [CppReturn CppBooleanLiteral{}]))
150− = CppLambda [] args rtyp body
151−maybeRemCaps (CppLambda [CppCaptureAll] args rtyp body@(CppBlock [CppReturn CppAccessor{}]))
152− = CppLambda [] args rtyp body
153−maybeRemCaps (CppLambda [CppCaptureAll] args rtyp body@(CppBlock [CppReturn (CppVar "unit")])) -- TODO: not really safe
154− = CppLambda [] args rtyp body
155−maybeRemCaps cpp = cpp
156−
157−---------------------------------------------------------------------------------------------------
158−
159−fileBegin :: ModuleName -> String -> [Cpp]
160−fileBegin mn suffix = [CppRaw ("#ifndef " ++ fileModName mn suffix),
161− CppRaw ("#define " ++ fileModName mn suffix)]
162−
163−fileEnd :: ModuleName -> String -> [Cpp]
164−fileEnd mn suffix = [CppRaw ("#endif // " ++ fileModName mn suffix)]
165−
166−fileModName :: ModuleName -> String -> String
167−fileModName mn suffix = P.dotsTo '_' (runModuleName mn ++ '_' : suffix)
168−
169−isMain :: ModuleName -> Bool
170−isMain (ModuleName [ProperName "Main"]) = True
171−isMain _ = False
172−
173−nativeMain :: Cpp
174−nativeMain = CppFunction "main"
175− [ ([], Just $ CppPrimitive "int")
176− , ([], Just $ CppPrimitive "char *[]")
177− ]
178− (Just $ CppPrimitive "int")
179− []
180− (CppBlock [ CppUseNamespace "Main"
181− , CppApp (CppVar "INITIALIZE_GC") []
182− , CppApp (CppAccessor (CppVar "main") (CppVar "Main")) []
183− , CppReturn (CppNumericLiteral (Left 0))
184− ])
src/Language/PureScript/CodeGen/Cpp/Optimizer.hsdeleted−95
@@ -1,95 +0,0 @@
1−-----------------------------------------------------------------------------
2−--
3−-- Module : Language.PureScript.CodeGen.Cpp.Optimizer
4−-- Copyright : (c) 2013-15 Phil Freeman, Andy Arvanitis, and other contributors
5−-- License : MIT
6−--
7−-- Maintainer : Andy Arvanitis
8−-- Stability : experimental
9−-- Portability :
10−--
11−-- |
12−-- This module optimizes code in the simplified-C++11 intermediate representation.
13−--
14−-- The following optimizations are supported:
15−--
16−-- * Collapsing nested blocks
17−--
18−-- * Tail call elimination
19−--
20−-- * Inlining of (>>=) and ret for the Eff monad
21−--
22−-- * Removal of unnecessary thunks
23−--
24−-- * Eta conversion
25−--
26−-- * Inlining variables
27−--
28−-- * Inline Prelude.($), Prelude.(#), Prelude.(++), Prelude.(!!)
29−--
30−-- * Inlining primitive C++11 operators
31−--
32−-----------------------------------------------------------------------------
33−
34−{-# LANGUAGE FlexibleContexts #-}
35−{-# LANGUAGE CPP #-}
36−
37−module Language.PureScript.CodeGen.Cpp.Optimizer (
38− optimize
39−) where
40−
41−import Prelude.Compat
42−
43−#if __GLASGOW_HASKELL__ < 710
44−import Control.Applicative (Applicative)
45−#endif
46−import Control.Monad.Reader (MonadReader, ask, asks)
47−import Control.Monad.Supply.Class (MonadSupply)
48−
49−import Language.PureScript.CodeGen.Cpp.AST
50−import Language.PureScript.Options
51−import qualified Language.PureScript.Constants as C
52−
53−import Language.PureScript.CodeGen.Cpp.Optimizer.Blocks
54−import Language.PureScript.CodeGen.Cpp.Optimizer.Common
55−import Language.PureScript.CodeGen.Cpp.Optimizer.Inliner
56−import Language.PureScript.CodeGen.Cpp.Optimizer.MagicDo
57−import Language.PureScript.CodeGen.Cpp.Optimizer.TCO
58−import Language.PureScript.CodeGen.Cpp.Optimizer.Unused
59−
60−-- |
61−-- Apply a series of optimizer passes to simplified C++11 code
62−--
63−optimize :: (Monad m, MonadReader Options m, Applicative m, MonadSupply m) => Cpp -> m Cpp
64−optimize cpp = do
65− noOpt <- asks optionsNoOptimizations
66− if noOpt then return cpp else optimize' cpp
67−
68−optimize' :: (Monad m, MonadReader Options m, Applicative m, MonadSupply m) => Cpp -> m Cpp
69−optimize' cpp = do
70− opts <- ask
71− untilFixedPoint (inlineFnComposition . applyAll
72− [ collapseNestedBlocks
73− , collapseNestedIfs
74− , collapseIfElses
75− , tco opts
76− , magicDo opts
77− , removeCodeAfterReturnStatements
78− , removeCodeAfterContinueStatements
79− , removeUnusedArg
80− , unThunk
81− , etaConvert
82− , evaluateIifes
83− , inlineVariables
84− , inlineCommonValues
85− , inlineOperator (C.prelude, (C.$)) $ \f x -> CppApp f [x]
86− , inlineOperator (C.prelude, (C.#)) $ \x f -> CppApp f [x]
87− , inlineOperator (C.dataArrayUnsafe, C.unsafeIndex) $ flip CppIndexer
88− , inlineCommonOperators ]) cpp
89−
90−untilFixedPoint :: (Monad m, Eq a) => (a -> m a) -> a -> m a
91−untilFixedPoint f = go
92− where
93− go a = do
94− a' <- f a
95− if a' == a then return a' else go a'
src/Language/PureScript/CodeGen/Cpp/Optimizer/Blocks.hsdeleted−85
@@ -1,85 +0,0 @@
1−-----------------------------------------------------------------------------
2−--
3−-- Module : Language.PureScript.CodeGen.Cpp.Optimizer.Blocks
4−-- Copyright : (c) Phil Freeman 2013-14
5−-- License : MIT
6−--
7−-- Maintainer : Andy Arvanitis <andy.arvanitis@gmail.com>
8−-- Stability : experimental
9−-- Portability :
10−--
11−-- |
12−-- Optimizer steps for simplifying C++ blocks
13−--
14−-----------------------------------------------------------------------------
15−
16−module Language.PureScript.CodeGen.Cpp.Optimizer.Blocks
17− ( collapseNestedBlocks
18− , collapseNestedIfs
19− , collapseIfElses
20− ) where
21−
22−import Prelude.Compat
23−
24−import Language.PureScript.CodeGen.Cpp.AST
25−import qualified Language.PureScript.Constants as C
26−
27−-- |
28−-- Collapse blocks which appear nested directly below another block
29−--
30−collapseNestedBlocks :: Cpp -> Cpp
31−collapseNestedBlocks = everywhereOnCpp collapse
32− where
33− collapse :: Cpp -> Cpp
34− collapse (CppBlock sts) = CppBlock (concatMap go sts)
35− collapse cpp = cpp
36− go :: Cpp -> [Cpp]
37− go (CppBlock sts) = sts
38− go s = [s]
39−
40−collapseNestedIfs :: Cpp -> Cpp
41−collapseNestedIfs = everywhereOnCpp collapse
42− where
43− collapse :: Cpp -> Cpp
44− collapse (CppIfElse cond1 (CppBlock [CppIfElse cond2 body Nothing]) Nothing) =
45− CppIfElse (CppBinary And cond1 cond2) body Nothing
46− collapse cpp = cpp
47−
48−collapseIfElses :: Cpp -> Cpp
49−collapseIfElses = everywhereOnCpp collapse
50− where
51− collapse :: Cpp -> Cpp
52− collapse (CppBlock cpps) = CppBlock (go cpps)
53− where
54− go (st'@(CppIfElse (CppBinary EqualTo lhs _) _ Nothing) : sts') =
55− if length (fst cpps') > 1
56− then CppSwitch lhs (mkCases <$> fst cpps') : snd cpps'
57− else st' : sts'
58− where
59− cpps' = span (isIntEq lhs) (st' : sts')
60− isIntEq :: Cpp -> Cpp -> Bool
61− isIntEq a (CppIfElse (CppBinary EqualTo a' (CppNumericLiteral (Left _))) (CppBlock [CppReturn _]) Nothing)
62− | a == a' = True
63− isIntEq a (CppIfElse (CppBinary EqualTo a' (CppCharLiteral _)) (CppBlock [CppReturn _]) Nothing)
64− | a == a' = True
65− isIntEq a (CppIfElse (CppBinary EqualTo a' (CppBooleanLiteral _)) (CppBlock [CppReturn _]) Nothing)
66− | a == a' = True
67− isIntEq _ _ = False
68− mkCases :: Cpp -> (Cpp, Cpp)
69− mkCases (CppIfElse (CppBinary EqualTo _ b') (CppBlock [body]) Nothing) = (b', body)
70− mkCases (CppIfElse (CppUnary Not _) (CppBlock [body]) Nothing) = (CppBooleanLiteral False, body)
71− mkCases (CppIfElse _ (CppBlock [body]) Nothing) = (CppBooleanLiteral True, body)
72− mkCases _ = error ""
73− go ((CppIfElse cond1 body1 Nothing) : (CppIfElse cond2 body2 Nothing) : _)
74− | returns body1 && returns body2 &&
75− (CppUnary Not cond1 == cond2 ||
76− CppUnary Not cond2 == cond1) = [CppIfElse cond1 body1 (Just body2)]
77− where
78− returns :: Cpp -> Bool
79− returns (CppBlock rets@(_:_)) | CppReturn{} <- last rets = True
80− returns CppReturn{} = True
81− returns _ = False
82− go (cpp' : cpps') = cpp' : go cpps'
83− go cpp' = cpp'
84− collapse (CppIfElse (CppAccessor (CppVar "otherwise") (CppVar mn')) body _) | mn' == C.prelude = body
85− collapse cpp = cpp
src/Language/PureScript/CodeGen/Cpp/Optimizer/Common.hsdeleted−91
@@ -1,91 +0,0 @@
1−-----------------------------------------------------------------------------
2−--
3−-- Module : Language.PureScript.CodeGen.Cpp.Optimizer.Common
4−-- Copyright : (c) 2013-15 Phil Freeman, Andy Arvanitis, and other contributors
5−-- License : MIT
6−--
7−-- Maintainer : Andy Arvanitis
8−-- Stability : experimental
9−-- Portability :
10−--
11−-- |
12−-- Common functions used by the various optimizer phases
13−--
14−-----------------------------------------------------------------------------
15−
16−module Language.PureScript.CodeGen.Cpp.Optimizer.Common where
17−
18−import Prelude.Compat
19−
20−import Data.Maybe (fromMaybe)
21−
22−import Language.PureScript.CodeGen.Cpp.AST
23−
24−applyAll :: [a -> a] -> a -> a
25−applyAll = foldl1 (.)
26−
27−replaceIdent :: String -> Cpp -> Cpp -> Cpp
28−replaceIdent var1 cpp = everywhereOnCpp replace
29− where
30− replace (CppVar var2) | var1 == var2 = cpp
31− replace other = other
32−
33−replaceIdents :: [(String, Cpp)] -> Cpp -> Cpp
34−replaceIdents vars = everywhereOnCpp replace
35− where
36− replace v@(CppVar var) = fromMaybe v $ lookup var vars
37− replace other = other
38−
39−isReassigned :: String -> Cpp -> Bool
40−isReassigned var1 = everythingOnCpp (||) check
41− where
42− check :: Cpp -> Bool
43− check (CppFunction _ args _ _ _) | var1 `elem` (map fst args) = True
44− check (CppVariableIntroduction arg _ _) | var1 == fst arg = True
45− check (CppAssignment (CppVar arg) _) | var1 == arg = True
46− check _ = False
47−
48−isRebound :: Cpp -> Cpp -> Bool
49−isRebound cpp d = any (\v -> isReassigned v d || isUpdated v d) (everythingOnCpp (++) variablesOf cpp)
50− where
51− variablesOf (CppVar var) = [var]
52− variablesOf _ = []
53−
54−isUsed :: String -> Cpp -> Bool
55−isUsed var1 = everythingOnCpp (||) check
56− where
57− check :: Cpp -> Bool
58− check (CppVar var2) | var1 == var2 = True
59− check (CppAssignment target _) | var1 == targetVariable target = True
60− check _ = False
61−
62−targetVariable :: Cpp -> String
63−targetVariable (CppVar var) = var
64−targetVariable (CppAccessor _ tgt) = targetVariable tgt
65−targetVariable (CppIndexer _ tgt) = targetVariable tgt
66−targetVariable _ = error "Invalid argument to targetVariable"
67−
68−isUpdated :: String -> Cpp -> Bool
69−isUpdated var1 = everythingOnCpp (||) check
70− where
71− check :: Cpp -> Bool
72− check (CppAssignment target _) | var1 == targetVariable target = True
73− check _ = False
74−
75−removeFromBlock :: ([Cpp] -> [Cpp]) -> Cpp -> Cpp
76−removeFromBlock go (CppBlock sts) = CppBlock (go sts)
77−removeFromBlock _ cpp = cpp
78−
79−isFn :: (String, String) -> Cpp -> Bool
80−isFn (moduleName, fnName) (CppAccessor (CppVar x) (CppVar y)) =
81− x == fnName && y == moduleName
82−isFn (moduleName, fnName) (CppIndexer (CppStringLiteral x) (CppVar y)) =
83− x == fnName && y == moduleName
84−isFn _ _ = False
85−
86−isDict :: (String, String) -> Cpp -> Bool
87−isDict (moduleName, dictName) (CppAccessor (CppVar x) (CppVar y)) = x == dictName && y == moduleName
88−isDict _ _ = False
89−
90−isDict' :: [(String, String)] -> Cpp -> Bool
91−isDict' xs cpp = any (`isDict` cpp) xs
src/Language/PureScript/CodeGen/Cpp/Optimizer/Inliner.hsdeleted−389
@@ -1,389 +0,0 @@
1−-----------------------------------------------------------------------------
2−--
3−-- Module : Language.PureScript.CodeGen.Cpp.Optimizer.Inliner
4−-- Copyright : (c) 2013-15 Phil Freeman, Andy Arvanitis, and other contributors
5−-- License : MIT
6−--
7−-- Maintainer : Andy Arvanitis
8−-- Stability : experimental
9−-- Portability :
10−--
11−-- |
12−-- This module provides basic inlining capabilities
13−--
14−-----------------------------------------------------------------------------
15−module Language.PureScript.CodeGen.Cpp.Optimizer.Inliner
16− ( inlineVariables
17− , inlineCommonValues
18− , inlineOperator
19− , inlineCommonOperators
20− , inlineFnComposition
21− , etaConvert
22− , unThunk
23− , evaluateIifes
24− ) where
25−
26−import Prelude.Compat
27−
28−import Control.Monad.Supply.Class (MonadSupply, freshName)
29−
30−import Language.PureScript.CodeGen.Cpp.AST
31−import Language.PureScript.CodeGen.Cpp.Common
32−import Language.PureScript.CodeGen.Cpp.Optimizer.Common
33−import Language.PureScript.CodeGen.Cpp.Types
34−import Language.PureScript.Names
35−import qualified Language.PureScript.Constants as C
36−
37−-- TODO: Potential bug:
38−-- Shouldn't just inline this case: { var x = 0; x.toFixed(10); }
39−-- Needs to be: { 0..toFixed(10); }
40−-- Probably needs to be fixed in pretty-printer instead.
41−shouldInline :: Cpp -> Bool
42−shouldInline (CppVar _) = True
43−shouldInline (CppNumericLiteral _) = True
44−shouldInline (CppStringLiteral _) = True
45−shouldInline (CppBooleanLiteral _) = True
46−shouldInline (CppAccessor _ val) = shouldInline val
47−shouldInline (CppIndexer index val) = shouldInline index && shouldInline val
48−shouldInline (CppCast _ val) = shouldInline val
49−shouldInline _ = False
50−
51−etaConvert :: Cpp -> Cpp
52−etaConvert = everywhereOnCpp convert
53− where
54− convert :: Cpp -> Cpp
55− convert (CppBlock [CppReturn (CppApp (CppLambda _ idents _ block@(CppBlock body)) args)])
56− | all shouldInline args &&
57− not (any (`isRebound` block) (map (CppVar . fst) idents)) &&
58− not (any (`isRebound` block) args)
59− = CppBlock (map (replaceIdents (zip (map fst idents) args)) body)
60− convert (CppLambda _ [] _ (CppBlock [CppReturn (CppApp fn [])])) = fn
61− convert cpp = cpp
62−
63−unThunk :: Cpp -> Cpp
64−unThunk = everywhereOnCpp convert
65− where
66− convert :: Cpp -> Cpp
67− convert (CppBlock []) = CppBlock []
68− convert (CppBlock cpps) =
69− case last cpps of
70− CppReturn (CppApp (CppLambda _ [] _ (CppBlock body)) []) -> CppBlock $ init cpps ++ body
71− _ -> CppBlock cpps
72− convert cpp = cpp
73−
74−evaluateIifes :: Cpp -> Cpp
75−evaluateIifes = everywhereOnCpp convert
76− where
77− convert :: Cpp -> Cpp
78− convert (CppApp (CppLambda _ [] _ (CppBlock [CppReturn ret])) []) = ret
79− convert (CppReturn cpp@(CppApp _ _))
80− | (f, args@(_:_)) <- unApp cpp [],
81− CppApp (CppLambda _ [] _ (CppBlock cpps)) [] <- f,
82− CppReturn ret <- last cpps = CppBlock $ init cpps ++ [CppReturn $foldl (\fn a -> CppApp fn [a]) ret args]
83− where
84− unApp :: Cpp -> [Cpp] -> (Cpp, [Cpp])
85− unApp (CppApp f [arg]) args = unApp f (arg : args)
86− unApp other args = (other, args)
87− convert cpp = cpp
88−
89−inlineVariables :: Cpp -> Cpp
90−inlineVariables = everywhereOnCpp $ removeFromBlock go
91− where
92− go :: [Cpp] -> [Cpp]
93− go [] = []
94− go (CppVariableIntroduction (var, _) _ (Just cpp) : sts)
95− | shouldInline cpp && not (any (isReassigned var) sts) && not (any (isRebound cpp) sts) && not (any (isUpdated var) sts) =
96− go (map (replaceIdent var cpp) sts)
97− go (s:sts) = s : go sts
98−
99−inlineCommonValues :: Cpp -> Cpp
100−inlineCommonValues = everywhereOnCpp convert
101− where
102− convert :: Cpp -> Cpp
103− convert (CppApp fn [dict])
104− | isDict' [semiringNumber, semiringInt] dict && isFn fnZero fn = CppNumericLiteral (Left 0)
105− | isDict' [semiringNumber, semiringInt] dict && isFn fnOne fn = CppNumericLiteral (Left 1)
106− | isDict boundedBoolean dict && isFn fnBottom fn = CppBooleanLiteral False
107− | isDict boundedBoolean dict && isFn fnTop fn = CppBooleanLiteral True
108− convert (CppApp (CppApp (CppApp fn [dict]) [x]) [y])
109− | isDict semiringInt dict && isFn fnAdd fn = intOp Add x y
110− | isDict semiringInt dict && isFn fnMultiply fn = intOp Multiply x y
111− | isDict euclideanRingInt dict && isFn fnDivide fn = intOp Divide x y
112− | isDict ringInt dict && isFn fnSubtract fn = intOp Subtract x y
113− convert other = other
114− fnZero = (C.dataSemiring, C.zero)
115− fnOne = (C.dataSemiring, C.one)
116− fnBottom = (C.dataBounded, C.bottom)
117− fnTop = (C.dataBounded, C.top)
118− fnAdd = (C.dataSemiring, C.add)
119− fnDivide = (C.dataEuclideanRing, C.div)
120− fnMultiply = (C.dataSemiring, C.mul)
121− fnSubtract = (C.dataRing, C.sub)
122− intOp op x y = CppBinary BitwiseOr (CppBinary op x y) (CppNumericLiteral (Left 0))
123−
124−inlineOperator :: (String, String) -> (Cpp -> Cpp -> Cpp) -> Cpp -> Cpp
125−inlineOperator (m, op) f = everywhereOnCpp convert
126− where
127− convert :: Cpp -> Cpp
128− convert (CppApp op' [x, y]) | isOp op' = f x y
129− convert (CppApp (CppApp op' [x]) [y]) | isOp op' = f x y
130− convert other = other
131− isOp (CppAccessor (CppVar longForm) (CppVar m')) = m == m' && longForm == identToCpp (Ident op)
132− isOp (CppIndexer (CppStringLiteral op') (CppVar m')) = m == m' && op == op'
133− isOp _ = False
134−
135−inlineCommonOperators :: Cpp -> Cpp
136−inlineCommonOperators = applyAll $
137− [ binary semiringNumber opAdd Add
138− , binary semiringNumber opMul Multiply
139−
140− , binary ringNumber opSub Subtract
141− , unary ringNumber opNegate Negate
142− , binary ringInt opSub Subtract
143− , unary ringInt opNegate Negate
144−
145− , binary euclideanRingNumber opDiv Divide
146− , binary euclideanRingInt opMod Modulus
147−
148− , binary eqNumber opEq EqualTo
149− , binary eqNumber opNotEq NotEqualTo
150− , binary eqInt opEq EqualTo
151− , binary eqInt opNotEq NotEqualTo
152− , binary eqString opEq EqualTo
153− , binary eqString opNotEq NotEqualTo
154− , binary eqChar opEq EqualTo
155− , binary eqChar opNotEq NotEqualTo
156− , binary eqBoolean opEq EqualTo
157− , binary eqBoolean opNotEq NotEqualTo
158−
159− , binary ordBoolean opLessThan LessThan
160− , binary ordBoolean opLessThanOrEq LessThanOrEqualTo
161− , binary ordBoolean opGreaterThan GreaterThan
162− , binary ordBoolean opGreaterThanOrEq GreaterThanOrEqualTo
163− , binary ordChar opLessThan LessThan
164− , binary ordChar opLessThanOrEq LessThanOrEqualTo
165− , binary ordChar opGreaterThan GreaterThan
166− , binary ordChar opGreaterThanOrEq GreaterThanOrEqualTo
167− , binary ordInt opLessThan LessThan
168− , binary ordInt opLessThanOrEq LessThanOrEqualTo
169− , binary ordInt opGreaterThan GreaterThan
170− , binary ordInt opGreaterThanOrEq GreaterThanOrEqualTo
171− , binary ordNumber opLessThan LessThan
172− , binary ordNumber opLessThanOrEq LessThanOrEqualTo
173− , binary ordNumber opGreaterThan GreaterThan
174− , binary ordNumber opGreaterThanOrEq GreaterThanOrEqualTo
175− , binary ordString opLessThan LessThan
176− , binary ordString opLessThanOrEq LessThanOrEqualTo
177− , binary ordString opGreaterThan GreaterThan
178− , binary ordString opGreaterThanOrEq GreaterThanOrEqualTo
179−
180− , binary semigroupString opAppend Add
181−
182− , binary heytingAlgebraBoolean opConj And
183− , binary heytingAlgebraBoolean opDisj Or
184− , unary heytingAlgebraBoolean opNot Not
185−
186− , binary' C.dataIntBits (C..|.) BitwiseOr
187− , binary' C.dataIntBits (C..&.) BitwiseAnd
188− , binary' C.dataIntBits (C..^.) BitwiseXor
189− , binary' C.dataIntBits C.shl ShiftLeft
190− , binary' C.dataIntBits C.shr ShiftRight
191− -- , binary' C.dataIntBits C.zshr ZeroFillShiftRight
192− , unary' C.dataIntBits C.complement BitwiseNot
193− ] ++
194− []
195− -- [ fn | i <- [0..10], fn <- [ mkFn i, runFn i ] ]
196− where
197− binary :: (String, String) -> (String, String) -> BinaryOperator -> Cpp -> Cpp
198− binary dict fns op = everywhereOnCpp convert
199− where
200− convert :: Cpp -> Cpp
201− convert (CppApp (CppApp (CppApp fn [dict']) [x]) [y]) | isDict dict dict' && isFn fns fn = CppBinary op x y
202− convert other = other
203− binary' :: String -> String -> BinaryOperator -> Cpp -> Cpp
204− binary' moduleName opString op = everywhereOnCpp convert
205− where
206− convert :: Cpp -> Cpp
207− convert (CppApp (CppApp fn [x]) [y]) | isFn (moduleName, opString) fn = CppBinary op x y
208− convert other = other
209− unary :: (String, String) -> (String, String) -> UnaryOperator -> Cpp -> Cpp
210− unary dicts fns op = everywhereOnCpp convert
211− where
212− convert :: Cpp -> Cpp
213− convert (CppApp (CppApp fn [dict']) [x]) | isDict dicts dict' && isFn fns fn = CppUnary op x
214− convert other = other
215− unary' :: String -> String -> UnaryOperator -> Cpp -> Cpp
216− unary' moduleName fnName op = everywhereOnCpp convert
217− where
218− convert :: Cpp -> Cpp
219− convert (CppApp fn [x]) | isFn (moduleName, fnName) fn = CppUnary op x
220− convert other = other
221− -- mkFn :: Int -> Cpp -> Cpp
222− -- mkFn 0 = everywhereOnCpp convert
223− -- where
224− -- convert :: Cpp -> Cpp
225− -- convert (CppApp mkFnN [CppLambda _ [_] _ (CppBlock cpp)]) | isNFn C.mkFn 0 mkFnN =
226− -- CppLambda [CppCaptureAll] [] Nothing (CppBlock cpp)
227− -- convert other = other
228− -- mkFn n = everywhereOnCpp convert
229− -- where
230− -- convert :: Cpp -> Cpp
231− -- convert orig@(CppApp mkFnN [fn]) | isNFn C.mkFn n mkFnN =
232− -- case collectArgs n [] fn of
233− -- Just (args, cpp) -> CppLambda [CppCaptureAll] args Nothing (CppBlock cpp)
234− -- Nothing -> orig
235− -- convert other = other
236− -- collectArgs :: Int -> [String] -> Cpp -> Maybe ([String], [Cpp])
237− -- collectArgs 1 acc (CppLambda _ [oneArg] _ (CppBlock cpp)) | length acc == n - 1 = Just (reverse (oneArg : acc), cpp)
238− -- collectArgs m acc (CppLambda _ [oneArg] _ (CppBlock [CppReturn ret])) = collectArgs (m - 1) (oneArg : acc) ret
239− -- collectArgs _ _ _ = Nothing
240− --
241− -- isNFn :: String -> Int -> Cpp -> Bool
242− -- isNFn prefix n (CppVar name) = name == (prefix ++ show n)
243− -- isNFn prefix n (CppAccessor _ name (CppVar dataFunction)) | dataFunction == C.dataFunction = name == (prefix ++ show n)
244− -- isNFn _ _ _ = False
245− --
246− -- runFn :: Int -> Cpp -> Cpp
247− -- runFn n = everywhereOnCpp convert
248− -- where
249− -- convert :: Cpp -> Cpp
250− -- convert cpp = fromMaybe cpp $ go n [] cpp
251− --
252− -- go :: Int -> [Cpp] -> Cpp -> Maybe Cpp
253− -- go 0 acc (CppApp runFnN [fn]) | isNFn C.runFn n runFnN && length acc == n = Just (CppApp fn acc)
254− -- go m acc (CppApp lhs [arg]) = go (m - 1) (arg : acc) lhs
255− -- go _ _ _ = Nothing
256−
257−-- (f <<< g $ x) = f (g x)
258−-- (f <<< g) = \x -> f (g x)
259−inlineFnComposition :: (MonadSupply m) => Cpp -> m Cpp
260−inlineFnComposition = everywhereOnCppTopDownM convert
261− where
262− convert :: (MonadSupply m) => Cpp -> m Cpp
263− convert (CppApp (CppApp (CppApp (CppApp fn [dict']) [x]) [y]) [z])
264− | isFnCompose dict' fn = return $ CppApp x [CppApp y [z]]
265− | isFnComposeFlipped dict' fn = return $ CppApp y [CppApp x [z]]
266− convert (CppApp (CppApp (CppApp fn [dict']) [x]) [y])
267− | isFnCompose dict' fn = do
268− arg <- freshName
269− return $ CppLambda [CppCaptureAll] [(arg, constAnyRef)] Nothing (CppBlock [CppReturn $ CppApp x [CppApp y [CppVar arg]]])
270− | isFnComposeFlipped dict' fn = do
271− arg <- freshName
272− return $ CppLambda [CppCaptureAll] [(arg, constAnyRef)] Nothing (CppBlock [CppReturn $ CppApp y [CppApp x [CppVar arg]]])
273− convert other = return other
274− isFnCompose :: Cpp -> Cpp -> Bool
275− isFnCompose dict' fn = isDict semigroupoidFn dict' && isFn fnCompose fn
276− isFnComposeFlipped :: Cpp -> Cpp -> Bool
277− isFnComposeFlipped dict' fn = isDict semigroupoidFn dict' && isFn fnComposeFlipped fn
278− fnCompose :: (String, String)
279− fnCompose = (C.controlSemigroupoid, C.compose)
280− fnComposeFlipped :: (String, String)
281− fnComposeFlipped = (C.controlSemigroupoid, C.composeFlipped)
282−
283−semiringNumber :: (String, String)
284−semiringNumber = (C.dataSemiring, C.semiringNumber)
285−
286−semiringInt :: (String, String)
287−semiringInt = (C.dataSemiring, C.semiringInt)
288−
289−ringNumber :: (String, String)
290−ringNumber = (C.dataRing, C.ringNumber)
291−
292−ringInt :: (String, String)
293−ringInt = (C.dataRing, C.ringInt)
294−
295−euclideanRingNumber :: (String, String)
296−euclideanRingNumber = (C.dataEuclideanRing, C.euclideanRingNumber)
297−
298−euclideanRingInt :: (String, String)
299−euclideanRingInt = (C.dataEuclideanRing, C.euclideanRingInt)
300−
301−eqNumber :: (String, String)
302−eqNumber = (C.dataEq, C.eqNumber)
303−
304−eqInt :: (String, String)
305−eqInt = (C.dataEq, C.eqInt)
306−
307−eqString :: (String, String)
308−eqString = (C.dataEq, C.eqString)
309−
310−eqChar :: (String, String)
311−eqChar = (C.dataEq, C.eqChar)
312−
313−eqBoolean :: (String, String)
314−eqBoolean = (C.dataEq, C.eqBoolean)
315−
316−ordBoolean :: (String, String)
317−ordBoolean = (C.dataOrd, C.ordBoolean)
318−
319−ordNumber :: (String, String)
320−ordNumber = (C.dataOrd, C.ordNumber)
321−
322−ordInt :: (String, String)
323−ordInt = (C.dataOrd, C.ordInt)
324−
325−ordString :: (String, String)
326−ordString = (C.dataOrd, C.ordString)
327−
328−ordChar :: (String, String)
329−ordChar = (C.dataOrd, C.ordChar)
330−
331−semigroupString :: (String, String)
332−semigroupString = (C.dataSemigroup, C.semigroupString)
333−
334−boundedBoolean :: (String, String)
335−boundedBoolean = (C.dataBounded, C.boundedBoolean)
336−
337−heytingAlgebraBoolean :: (String, String)
338−heytingAlgebraBoolean = (C.dataHeytingAlgebra, C.heytingAlgebraBoolean)
339−
340−semigroupoidFn :: (String, String)
341−semigroupoidFn = (C.controlSemigroupoid, C.semigroupoidFn)
342−
343−opAdd :: (String, String)
344−opAdd = (C.dataSemiring, C.add)
345−
346−opMul :: (String, String)
347−opMul = (C.dataSemiring, C.mul)
348−
349−opEq :: (String, String)
350−opEq = (C.dataEq, C.eq)
351−
352−opNotEq :: (String, String)
353−opNotEq = (C.dataEq, C.notEq)
354−
355−opLessThan :: (String, String)
356−opLessThan = (C.dataOrd, C.lessThan)
357−
358−opLessThanOrEq :: (String, String)
359−opLessThanOrEq = (C.dataOrd, C.lessThanOrEq)
360−
361−opGreaterThan :: (String, String)
362−opGreaterThan = (C.dataOrd, C.greaterThan)
363−
364−opGreaterThanOrEq :: (String, String)
365−opGreaterThanOrEq = (C.dataOrd, C.greaterThanOrEq)
366−
367−opAppend :: (String, String)
368−opAppend = (C.dataSemigroup, C.append)
369−
370−opSub :: (String, String)
371−opSub = (C.dataRing, C.sub)
372−
373−opNegate :: (String, String)
374−opNegate = (C.dataRing, C.negate)
375−
376−opDiv :: (String, String)
377−opDiv = (C.dataEuclideanRing, C.div)
378−
379−opMod :: (String, String)
380−opMod = (C.dataEuclideanRing, C.mod)
381−
382−opConj :: (String, String)
383−opConj = (C.dataHeytingAlgebra, C.conj)
384−
385−opDisj :: (String, String)
386−opDisj = (C.dataHeytingAlgebra, C.disj)
387−
388−opNot :: (String, String)
389−opNot = (C.dataHeytingAlgebra, C.not)
src/Language/PureScript/CodeGen/Cpp/Optimizer/MagicDo.hsdeleted−146

This diff is too big to show here.

src/Language/PureScript/CodeGen/Cpp/Optimizer/TCO.hsdeleted−151

This diff is too big to show here.

src/Language/PureScript/CodeGen/Cpp/Optimizer/Unused.hsdeleted−47

This diff is too big to show here.

src/Language/PureScript/CodeGen/Cpp/Types.hsdeleted−130

This diff is too big to show here.

src/Language/PureScript/CodeGen/JS.hsdeleted−444

This diff is too big to show here.

src/Language/PureScript/CodeGen/JS/AST.hsdeleted−403

This diff is too big to show here.

src/Language/PureScript/CodeGen/JS/Common.hsdeleted−232

This diff is too big to show here.

src/Language/PureScript/CodeGen/JS/Optimizer.hsdeleted−79

This diff is too big to show here.

src/Language/PureScript/CodeGen/JS/Optimizer/Blocks.hsdeleted−32

This diff is too big to show here.

src/Language/PureScript/CodeGen/JS/Optimizer/Common.hsdeleted−82

This diff is too big to show here.

src/Language/PureScript/CodeGen/JS/Optimizer/Inliner.hsdeleted−365

This diff is too big to show here.

src/Language/PureScript/CodeGen/JS/Optimizer/MagicDo.hsdeleted−136

This diff is too big to show here.

src/Language/PureScript/CodeGen/JS/Optimizer/TCO.hsdeleted−120

This diff is too big to show here.

src/Language/PureScript/CodeGen/JS/Optimizer/Unused.hsdeleted−35

This diff is too big to show here.

src/Language/PureScript/Comments.hsdeleted−17

This diff is too big to show here.

src/Language/PureScript/Constants.hsdeleted−392

This diff is too big to show here.

src/Language/PureScript/CoreFn.hsdeleted−15

This diff is too big to show here.

src/Language/PureScript/CoreFn/Ann.hsdeleted−25

This diff is too big to show here.

src/Language/PureScript/CoreFn/Binders.hsdeleted−42

This diff is too big to show here.

src/Language/PureScript/CoreFn/Desugar.hsdeleted−270

This diff is too big to show here.

src/Language/PureScript/CoreFn/Expr.hsdeleted−121

This diff is too big to show here.

src/Language/PureScript/CoreFn/Meta.hsdeleted−42

This diff is too big to show here.

src/Language/PureScript/CoreFn/Module.hsdeleted−22

This diff is too big to show here.

src/Language/PureScript/CoreFn/Traversals.hsdeleted−77

This diff is too big to show here.

src/Language/PureScript/Crash.hsdeleted−11

This diff is too big to show here.

src/Language/PureScript/Docs.hsdeleted−14

This diff is too big to show here.

src/Language/PureScript/Docs/AsMarkdown.hsdeleted−136

This diff is too big to show here.

src/Language/PureScript/Docs/Convert.hsdeleted−192

This diff is too big to show here.

src/Language/PureScript/Docs/Convert/ReExports.hsdeleted−510

This diff is too big to show here.

src/Language/PureScript/Docs/Convert/Single.hsdeleted−200

This diff is too big to show here.

src/Language/PureScript/Docs/ParseAndBookmark.hsdeleted−98

This diff is too big to show here.

src/Language/PureScript/Docs/Render.hsdeleted−146

This diff is too big to show here.

src/Language/PureScript/Docs/RenderedCode.hsdeleted−8

This diff is too big to show here.

src/Language/PureScript/Docs/RenderedCode/Render.hsdeleted−212

This diff is too big to show here.

src/Language/PureScript/Docs/RenderedCode/Types.hsdeleted−202

This diff is too big to show here.

src/Language/PureScript/Docs/Types.hsdeleted−595

This diff is too big to show here.

src/Language/PureScript/Docs/Utils/MonoidExtras.hsdeleted−9

This diff is too big to show here.

src/Language/PureScript/Environment.hsdeleted−276

This diff is too big to show here.

src/Language/PureScript/Errors.hsdeleted−1295

This diff is too big to show here.

src/Language/PureScript/Errors/JSON.hsdeleted−73

This diff is too big to show here.

src/Language/PureScript/Externs.hsdeleted−226

This diff is too big to show here.

src/Language/PureScript/Ide.hsdeleted−242

This diff is too big to show here.

src/Language/PureScript/Ide/CaseSplit.hsdeleted−156

This diff is too big to show here.

src/Language/PureScript/Ide/Command.hsdeleted−157

This diff is too big to show here.

src/Language/PureScript/Ide/Completion.hsdeleted−32

This diff is too big to show here.

src/Language/PureScript/Ide/Error.hsdeleted−58

This diff is too big to show here.

src/Language/PureScript/Ide/Externs.hsdeleted−118

This diff is too big to show here.

src/Language/PureScript/Ide/Filter.hsdeleted−126

This diff is too big to show here.

src/Language/PureScript/Ide/Imports.hsdeleted−347

This diff is too big to show here.

src/Language/PureScript/Ide/Matcher.hsdeleted−130

This diff is too big to show here.

src/Language/PureScript/Ide/Pursuit.hsdeleted−78

This diff is too big to show here.

src/Language/PureScript/Ide/Rebuild.hsdeleted−82

This diff is too big to show here.

src/Language/PureScript/Ide/Reexports.hsdeleted−89

This diff is too big to show here.

src/Language/PureScript/Ide/SourceFile.hsdeleted−120

This diff is too big to show here.

src/Language/PureScript/Ide/State.hsdeleted−99

This diff is too big to show here.

src/Language/PureScript/Ide/Types.hsdeleted−235

This diff is too big to show here.

src/Language/PureScript/Ide/Util.hsdeleted−71

This diff is too big to show here.

src/Language/PureScript/Ide/Watcher.hsdeleted−48

This diff is too big to show here.

src/Language/PureScript/Interactive.hsdeleted−283

This diff is too big to show here.

src/Language/PureScript/Interactive/Completion.hsdeleted−222

This diff is too big to show here.

src/Language/PureScript/Interactive/Directive.hsdeleted−100

This diff is too big to show here.

src/Language/PureScript/Interactive/IO.hsdeleted−41

This diff is too big to show here.

src/Language/PureScript/Interactive/Message.hsdeleted−52

This diff is too big to show here.

src/Language/PureScript/Interactive/Module.hsdeleted−85

This diff is too big to show here.

src/Language/PureScript/Interactive/Parser.hsdeleted−122

This diff is too big to show here.

src/Language/PureScript/Interactive/Printer.hsdeleted−124

This diff is too big to show here.

src/Language/PureScript/Interactive/Types.hsdeleted−146

This diff is too big to show here.

src/Language/PureScript/Kinds.hsdeleted−56

This diff is too big to show here.

src/Language/PureScript/Linter.hsdeleted−97

This diff is too big to show here.

src/Language/PureScript/Linter/Exhaustive.hsdeleted−336

This diff is too big to show here.

src/Language/PureScript/Linter/Imports.hsdeleted−368

This diff is too big to show here.

src/Language/PureScript/Make.hsdeleted−469

This diff is too big to show here.

src/Language/PureScript/ModuleDependencies.hsdeleted−100

This diff is too big to show here.

src/Language/PureScript/Names.hsdeleted−205

This diff is too big to show here.

src/Language/PureScript/Options.hsdeleted−39

This diff is too big to show here.

src/Language/PureScript/Parser.hsdeleted−23

This diff is too big to show here.

src/Language/PureScript/Parser/Common.hsdeleted−135

This diff is too big to show here.

src/Language/PureScript/Parser/Declarations.hsdeleted−564

This diff is too big to show here.

src/Language/PureScript/Parser/Kinds.hsdeleted−34

This diff is too big to show here.

src/Language/PureScript/Parser/Lexer.hsdeleted−556

This diff is too big to show here.

src/Language/PureScript/Parser/State.hsdeleted−18

This diff is too big to show here.

src/Language/PureScript/Parser/Types.hsdeleted−124

This diff is too big to show here.

src/Language/PureScript/Pretty.hsdeleted−17

This diff is too big to show here.

src/Language/PureScript/Pretty/Common.hsdeleted−155

This diff is too big to show here.

src/Language/PureScript/Pretty/Cpp.hsdeleted−542

This diff is too big to show here.

src/Language/PureScript/Pretty/JS.hsdeleted−308

This diff is too big to show here.

src/Language/PureScript/Pretty/Kinds.hsdeleted−51

This diff is too big to show here.

src/Language/PureScript/Pretty/Types.hsdeleted−169

This diff is too big to show here.

src/Language/PureScript/Pretty/Values.hsdeleted−189

This diff is too big to show here.

src/Language/PureScript/Publish.hsdeleted−410

This diff is too big to show here.

src/Language/PureScript/Publish/BoxesHelpers.hsdeleted−44

This diff is too big to show here.

src/Language/PureScript/Publish/ErrorsWarnings.hsdeleted−429

This diff is too big to show here.

src/Language/PureScript/Publish/Utils.hsdeleted−41

This diff is too big to show here.

src/Language/PureScript/Renamer.hsdeleted−191

This diff is too big to show here.

src/Language/PureScript/Sugar.hsdeleted−67

This diff is too big to show here.

src/Language/PureScript/Sugar/BindingGroups.hsdeleted−221

This diff is too big to show here.

src/Language/PureScript/Sugar/CaseDeclarations.hsdeleted−188

This diff is too big to show here.

src/Language/PureScript/Sugar/DoNotation.hsdeleted−63

This diff is too big to show here.

src/Language/PureScript/Sugar/Names.hsdeleted−371

This diff is too big to show here.

src/Language/PureScript/Sugar/Names/Common.hsdeleted−66

This diff is too big to show here.

src/Language/PureScript/Sugar/Names/Env.hsdeleted−346

This diff is too big to show here.

src/Language/PureScript/Sugar/Names/Exports.hsdeleted−285

This diff is too big to show here.

src/Language/PureScript/Sugar/Names/Imports.hsdeleted−235

This diff is too big to show here.

src/Language/PureScript/Sugar/ObjectWildcards.hsdeleted−92

This diff is too big to show here.

src/Language/PureScript/Sugar/Operators.hsdeleted−415

This diff is too big to show here.

src/Language/PureScript/Sugar/Operators/Binders.hsdeleted−26

This diff is too big to show here.

src/Language/PureScript/Sugar/Operators/Common.hsdeleted−79

This diff is too big to show here.

src/Language/PureScript/Sugar/Operators/Expr.hsdeleted−44

This diff is too big to show here.

src/Language/PureScript/Sugar/Operators/Types.hsdeleted−27

This diff is too big to show here.

src/Language/PureScript/Sugar/TypeClasses.hsdeleted−330

This diff is too big to show here.

src/Language/PureScript/Sugar/TypeClasses/Deriving.hsdeleted−419

This diff is too big to show here.

src/Language/PureScript/Sugar/TypeDeclarations.hsdeleted−63

This diff is too big to show here.

src/Language/PureScript/Traversals.hsdeleted−27

This diff is too big to show here.

src/Language/PureScript/TypeChecker.hsdeleted−423

This diff is too big to show here.

src/Language/PureScript/TypeChecker/Entailment.hsdeleted−215

This diff is too big to show here.

src/Language/PureScript/TypeChecker/Kinds.hsdeleted−265

This diff is too big to show here.

src/Language/PureScript/TypeChecker/Monad.hsdeleted−250

This diff is too big to show here.

src/Language/PureScript/TypeChecker/Rows.hsdeleted−55

This diff is too big to show here.

src/Language/PureScript/TypeChecker/Skolems.hsdeleted−127

This diff is too big to show here.

src/Language/PureScript/TypeChecker/Subsumption.hsdeleted−86

This diff is too big to show here.

src/Language/PureScript/TypeChecker/Synonyms.hsdeleted−47

This diff is too big to show here.

src/Language/PureScript/TypeChecker/Types.hsdeleted−760

This diff is too big to show here.

src/Language/PureScript/TypeChecker/Unify.hsdeleted−212

This diff is too big to show here.

src/Language/PureScript/TypeClassDictionaries.hsdeleted−47

This diff is too big to show here.

src/Language/PureScript/Types.hsdeleted−355

This diff is too big to show here.

src/System/IO/UTF8.hsdeleted−25

This diff is too big to show here.

src/Tests.hsnew file+141

This diff is too big to show here.

stack.nixnew file+23

This diff is too big to show here.

stack.yaml+22−6

This diff is too big to show here.

support/ffi-loader.gonew file+30

This diff is too big to show here.

support/go.mod.ffi-loadernew file+2

This diff is too big to show here.

support/go.mod.outputnew file+2

This diff is too big to show here.

support/go.mod.workingnew file+1

This diff is too big to show here.

test/Spec.hsnew file+2

This diff is too big to show here.

tests/Language/PureScript/Ide/FilterSpec.hsdeleted−63

This diff is too big to show here.

tests/Language/PureScript/Ide/Imports/IntegrationSpec.hsdeleted−94

This diff is too big to show here.

tests/Language/PureScript/Ide/ImportsSpec.hsdeleted−130

This diff is too big to show here.

tests/Language/PureScript/Ide/Integration.hsdeleted−281

This diff is too big to show here.

tests/Language/PureScript/Ide/MatcherSpec.hsdeleted−48

This diff is too big to show here.

tests/Language/PureScript/Ide/RebuildSpec.hsdeleted−47

This diff is too big to show here.

tests/Language/PureScript/Ide/ReexportsSpec.hsdeleted−81

This diff is too big to show here.

tests/Language/PureScript/IdeSpec.hsdeleted−35

This diff is too big to show here.

tests/Main.hsdeleted−44

This diff is too big to show here.

tests/PscIdeSpec.hsdeleted−1

This diff is too big to show here.

tests/TestCompiler.hsdeleted−251

This diff is too big to show here.

tests/TestDocs.hsdeleted−309

This diff is too big to show here.

tests/TestPscIde.hsdeleted−14

This diff is too big to show here.

tests/TestPscPublish.hsdeleted−78

This diff is too big to show here.

tests/TestPsci.hsdeleted−138

This diff is too big to show here.

tests/TestUtils.hsdeleted−90

This diff is too big to show here.

tests/support/.gitignoredeleted−2

This diff is too big to show here.

tests/support/bower.jsondeleted−12

This diff is too big to show here.

tests/support/package.jsondeleted−8

This diff is too big to show here.

tests/support/psci/Sample.pursdeleted

No changes to the content.

tests/support/pscide/.gitignoredeleted−7

This diff is too big to show here.

tests/support/pscide/src/ImportsSpec.pursdeleted−5

This diff is too big to show here.

tests/support/pscide/src/ImportsSpec1.pursdeleted−32

This diff is too big to show here.

tests/support/pscide/src/Main.pursdeleted−7

This diff is too big to show here.

tests/support/pscide/src/RebuildSpecDep.pursdeleted−3

This diff is too big to show here.

tests/support/pscide/src/RebuildSpecSingleModule.faildeleted−3

This diff is too big to show here.

tests/support/pscide/src/RebuildSpecSingleModule.pursdeleted−4

This diff is too big to show here.

tests/support/pscide/src/RebuildSpecWithDeps.pursdeleted−5

This diff is too big to show here.

tests/support/pscide/src/RebuildSpecWithForeign.jsdeleted−3

This diff is too big to show here.

tests/support/pscide/src/RebuildSpecWithForeign.pursdeleted−3

This diff is too big to show here.

tests/support/pscide/src/RebuildSpecWithMissingForeign.faildeleted−3

This diff is too big to show here.

tests/support/setup-win.cmddeleted−3

This diff is too big to show here.

travis/build.shdeleted−59

This diff is too big to show here.

travis/convert-os-name.shdeleted−14

This diff is too big to show here.