├── .envrc ├── cabal.config ├── package ├── nix │ └── .gitignore ├── elm-tooling │ ├── .gitignore │ ├── generate.sh │ └── build.sh ├── npm │ ├── .gitignore │ ├── README.md │ ├── default.nix │ ├── .eslintrc.json │ ├── index.js │ ├── bin │ │ └── elm-format │ ├── shell.nix │ ├── platform-info.nix │ ├── package.json │ └── elm-format-0.8.5-test.nix ├── win │ ├── .gitignore │ ├── links.txt │ ├── shell │ │ ├── main.cmd │ │ ├── InstallChocolatey.ps1 │ │ └── InstallPackages.bat │ ├── build-package.sh │ ├── Vagrantfile │ ├── wine.sh │ └── setup.md ├── linux │ ├── archlinux │ │ ├── Vagrantfile │ │ └── .gitignore │ ├── build-package.sh │ └── build-in-docker.sh └── mac │ └── build-package.sh ├── tests ├── test-files │ ├── validate2.json │ ├── transform │ │ ├── Elm-0.18 │ │ │ ├── Empty.elm │ │ │ ├── TrickyModule1.elm │ │ │ ├── TrickyModule3.elm │ │ │ ├── TrickyModule4.elm │ │ │ ├── TrickyModule2.elm │ │ │ ├── Empty.formatted.elm │ │ │ ├── TrickyModule1.formatted.elm │ │ │ ├── TrickyModule2.formatted.elm │ │ │ ├── TrickyModule4.formatted.elm │ │ │ ├── TrickyModule3.formatted.elm │ │ │ ├── LenientEqualsColon.elm │ │ │ ├── QuickCheck-94f37da84c1310f03dcfa1059ce870b73c94a825--6449652945938213463.elm │ │ │ ├── LenientEqualsColon.formatted.elm │ │ │ ├── QuickCheck-4562ebccb71ea9f622fb99cdf32b2923f6f9d34f-2529668492575674138.elm │ │ │ ├── AllSyntax │ │ │ │ ├── Types.formatted.elm │ │ │ │ ├── Types.elm │ │ │ │ ├── Patterns.formatted.elm │ │ │ │ └── Patterns.elm │ │ │ ├── Examples.elm │ │ │ ├── QuickCheck-94f37da84c1310f03dcfa1059ce870b73c94a825--6449652945938213463.formatted.elm │ │ │ ├── QuickCheck-4562ebccb71ea9f622fb99cdf32b2923f6f9d34f-2529668492575674138.formatted.elm │ │ │ ├── DocCommentCheapskateReferenceBug.elm │ │ │ ├── DocCommentCheapskateReferenceBug.formatted.elm │ │ │ ├── WindowsEol.elm │ │ │ ├── WindowsEol.formatted.elm │ │ │ ├── MissingImportParens.formatted.elm │ │ │ ├── DocCommentAtDocs.elm │ │ │ ├── MissingImportParens.elm │ │ │ ├── DocCommentCodeExample.elm │ │ │ ├── DocCommentAtDocs.formatted.elm │ │ │ ├── DocCommentCodeExample.formatted.elm │ │ │ ├── Examples.formatted.elm │ │ │ ├── DocCommentMarkdownSafety.elm │ │ │ ├── DocCommentMarkdownSafety.formatted.elm │ │ │ ├── Sorting.formatted.elm │ │ │ ├── Sorting.elm │ │ │ └── UnnecessaryParens.formatted.elm │ │ ├── Elm-0.19 │ │ │ ├── AddMissingExposingForImport.elm │ │ │ ├── TransformFatArrow.elm │ │ │ ├── ClarifyNegativeExponentiationPrecedence.elm │ │ │ ├── ParseTabsInLiterals.elm │ │ │ ├── AddMissingExposingForModule.elm │ │ │ ├── DistinguishCharStartFromRef.elm │ │ │ ├── AddMissingExposingForImport.formatted.elm │ │ │ ├── AddMissingExposingForModule.formatted.elm │ │ │ ├── ListAllExportsNoModuleLine.elm │ │ │ ├── ReplaceThenByOfInCase.elm │ │ │ ├── TransformFatArrow.formatted.elm │ │ │ ├── ListAllExportsNoExposing.elm │ │ │ ├── DistinguishCharStartFromRef.formatted.elm │ │ │ ├── ClarifyNegativeExponentiationPrecedence.formatted.elm │ │ │ ├── ExplicitlyListExposedValues.elm │ │ │ ├── ParseTabsInLiterals.formatted.elm │ │ │ ├── ExplicitlyListExposedValues.formatted.elm │ │ │ ├── ListDocumentedExportsNoExposing.elm │ │ │ ├── ReplaceThenByOfInCase.formatted.elm │ │ │ ├── ListAllExportsNoModuleLine.formatted.elm │ │ │ ├── ListAllExportsNoExposing.formatted.elm │ │ │ └── ListDocumentedExportsNoExposing.formatted.elm │ │ └── Elm-0.16 │ │ │ ├── github-avh4-elm-format-184.elm │ │ │ └── github-avh4-elm-format-184.formatted.elm │ ├── CommonMark │ │ ├── .gitignore │ │ ├── tools │ │ │ ├── template.commonmark │ │ │ └── spec2js.js │ │ ├── .editorconfig │ │ ├── package.json │ │ ├── RELEASE_CHECKLIST.md │ │ ├── Makefile │ │ └── index.js │ ├── directory │ │ ├── valid.elm │ │ └── invalid.elm │ ├── recursive-directory │ │ ├── nested │ │ │ └── invalid.elm │ │ └── valid.elm │ ├── from-json │ │ └── Elm-0.19 │ │ │ ├── Simple.elm │ │ │ ├── ModuleComments.elm │ │ │ ├── Simple.json │ │ │ ├── ModuleImports.elm │ │ │ ├── ModuleComments.json │ │ │ ├── Patterns.elm │ │ │ ├── Declarations.elm │ │ │ ├── Types.elm │ │ │ └── ModuleImports.json │ ├── bad │ │ └── Elm-0.19 │ │ │ ├── UnexpectedEndOfInput.elm │ │ │ ├── UnexpectedComma.elm │ │ │ ├── UnexpectedComma.output.txt │ │ │ └── UnexpectedEndOfInput.output.txt │ ├── good │ │ ├── Elm-0.18 │ │ │ ├── Simple.elm │ │ │ ├── Export.elm │ │ │ ├── ApiSketch.elm │ │ │ ├── AllSyntax │ │ │ │ ├── DocCommentsStartingWtihAtDocs.elm │ │ │ │ ├── ModuleMultiline.elm │ │ │ │ ├── Expressions │ │ │ │ │ ├── Unary.elm │ │ │ │ │ └── BinaryOperators.elm │ │ │ │ ├── OldKeywords.elm │ │ │ │ ├── GLShader.elm │ │ │ │ ├── Comments.elm │ │ │ │ ├── BlockComments │ │ │ │ │ ├── Types.elm │ │ │ │ │ ├── Module.elm │ │ │ │ │ └── Patterns.elm │ │ │ │ ├── DeclaraionSpacing.elm │ │ │ │ ├── Module.elm │ │ │ │ ├── LineComments │ │ │ │ │ └── Types.elm │ │ │ │ └── ModuleWithDocs.elm │ │ │ ├── TopLevelSpacing.elm │ │ │ ├── WorkaroundNegativeCasePatterns.elm │ │ │ └── TrueFalseInIdentifiers.elm │ │ ├── Elm-0.17 │ │ │ ├── AllSyntax │ │ │ │ ├── Module.elm │ │ │ │ ├── Range.elm │ │ │ │ ├── BlockComments │ │ │ │ │ ├── Module.elm │ │ │ │ │ └── ModuleEffect.elm │ │ │ │ ├── ModuleEffect.elm │ │ │ │ ├── InfixOperators.elm │ │ │ │ ├── LineComments │ │ │ │ │ ├── Module.elm │ │ │ │ │ └── ModuleEffect.elm │ │ │ │ └── OldKeywords.elm │ │ │ ├── Export.elm │ │ │ ├── TopLevelSpacing.elm │ │ │ └── WorkaroundNegativeCasePatterns.elm │ │ ├── Elm-0.19 │ │ │ ├── TopLevelSpacing.elm │ │ │ ├── GLShader.elm │ │ │ ├── WorkaroundNegativeCasePatterns.elm │ │ │ ├── InfixAsVariableName.elm │ │ │ ├── GLShader.json-roundtrip │ │ │ └── AllSyntax │ │ │ │ ├── InfixDeclaration.elm │ │ │ │ ├── Module.json-roundtrip │ │ │ │ └── Module.elm │ │ ├── json │ │ │ ├── ExternalReferences.elm │ │ │ └── ExternalReferences.json-roundtrip │ │ └── Elm-0.16 │ │ │ └── AllSyntax │ │ │ └── PatternsRequireParens.elm │ └── validate1.json ├── Integration │ └── data │ │ └── minimal.elm ├── stdin-error.stderr │ └── golden ├── json-format-schema.json ├── Test.hs └── usage.stdout │ └── golden ├── parser ├── tests │ └── test-files │ │ ├── bad │ │ ├── BBTArgs │ │ ├── InfiniteType.elm │ │ ├── NonElementMain.elm │ │ ├── Strings │ │ │ └── ExtraClose.elm │ │ └── IncompletePatternMatch.elm │ │ └── good │ │ ├── Lists │ │ ├── EmptyList.elm │ │ ├── ListRange.elm │ │ └── NonEmptyList.elm │ │ ├── Soundness │ │ ├── TrickyId.elm │ │ ├── Id.elm │ │ ├── Apply.elm │ │ ├── TrickyIdAnnotated.elm │ │ ├── IdAnnotated.elm │ │ └── ApplyAnnotated.elm │ │ ├── Strings │ │ ├── Multiline.elm │ │ └── MultilineNormal.elm │ │ ├── NoExpressions.elm │ │ ├── Otherwise.elm │ │ ├── Unify │ │ └── NonHomogeneousRecords.elm │ │ ├── TailRecursive.elm │ │ ├── PortsWithTypeAliases.elm │ │ ├── QuotesAndComments.elm │ │ ├── AliasSubstitution.elm │ │ ├── CaseExpression3.elm │ │ └── Ports.elm └── bench │ ├── elm-package.json │ └── src │ ├── SmallTupleBench.elm │ ├── LargeDictionary.elm │ ├── TupleBench.elm │ └── SmallRecordBench.elm ├── .hlint.yaml ├── Style Guide ├── .gitignore ├── styles │ └── website.css ├── book.json ├── Upgrading.md ├── SUMMARY.md ├── Declarations.md ├── Sections.md └── Lists.md ├── elm-format-markdown ├── tests │ ├── Emphasis │ │ ├── Escapes.markdown │ │ ├── Escapes.html │ │ ├── Punctuation.markdown │ │ ├── Punctuation.html │ │ ├── Pathological.markdown │ │ └── Pathological.html │ ├── Blockquotes │ │ ├── Indents.markdown~ │ │ ├── Indents.markdown │ │ ├── Indents.html │ │ ├── Nesting.markdown │ │ ├── Separation.markdown │ │ ├── Nesting.html │ │ └── Separation.html │ ├── Lists │ │ ├── TightLooseMore.markdown │ │ ├── ListsAndHRs.markdown │ │ ├── ListsAndSetextHeaders.markdown │ │ ├── EmptyListItem.markdown │ │ ├── ListsAndHRs.html │ │ ├── ListsAndSetextHeaders.html │ │ ├── TightLooseMore.html │ │ ├── Indents.markdown │ │ ├── ConsecutiveLists.markdown │ │ ├── InBlockquote.markdown │ │ ├── EmptyListItem.html │ │ ├── Start.markdown │ │ ├── TwoBlankLinesEndList.markdown │ │ ├── CodeBlocksInLists.markdown │ │ ├── Indents.html │ │ ├── Start.html │ │ ├── CodeBlocksInLists.html │ │ ├── ConsecutiveLists.html │ │ ├── Sublists.markdown │ │ ├── TwoBlankLinesEndList.html │ │ ├── TightLooseBlockquote.markdown │ │ ├── InBlockquote.html │ │ ├── MultipleBlankLines.markdown │ │ ├── TightAndLoose.markdown │ │ ├── TightLooseBlockquote.html │ │ ├── Sublists.html │ │ ├── TightAndLoose.html │ │ └── MultipleBlankLines.html │ ├── Links │ │ ├── BackticksInLinks.markdown │ │ ├── CaseInsensitiveReferences.html │ │ ├── CaseInsensitiveReferences.markdown │ │ ├── BackticksInLinks.html │ │ ├── Entities.markdown │ │ ├── Entities.html │ │ ├── AngleBrackets.markdown │ │ ├── AngleBrackets.html │ │ ├── AutoLinks.markdown │ │ ├── ReferenceLinks.markdown │ │ ├── ReferenceLinks.html │ │ ├── InlineLinks.markdown │ │ ├── InlineLinks.html │ │ ├── ParensInURLs.markdown │ │ ├── AutoLinks.html │ │ └── ParensInURLs.html │ ├── Original │ │ ├── Nested_blockquotes.markdown │ │ ├── Tidyness.markdown │ │ ├── Nested_blockquotes.html │ │ ├── Strong_and_em_together.markdown │ │ ├── Literal_quotes_in_titles.markdown │ │ ├── Tidyness.html │ │ ├── Code_Spans.markdown │ │ ├── Literal_quotes_in_titles.html │ │ ├── Blockquotes_with_code_blocks.markdown │ │ ├── Inline_HTML_comments.html │ │ ├── Strong_and_em_together.html │ │ ├── Code_Spans.html │ │ ├── Inline_HTML_comments.markdown │ │ ├── Code_Blocks.markdown │ │ ├── Blockquotes_with_code_blocks.html │ │ ├── Links_shortcut_references.html │ │ ├── Auto_links.markdown │ │ ├── Links_shortcut_references.markdown │ │ ├── Code_Blocks.html │ │ ├── Tabs.markdown │ │ ├── Inline_HTML_Advanced.html │ │ ├── Inline_HTML_Advanced.markdown │ │ ├── Amps_and_angle_encoding.markdown │ │ ├── Tabs.html │ │ ├── Images.markdown │ │ ├── Amps_and_angle_encoding.html │ │ ├── Horizontal_rules.html │ │ ├── Auto_links.html │ │ ├── Horizontal_rules.markdown │ │ ├── README │ │ ├── Links_inline_style.markdown │ │ ├── Images.html │ │ ├── Links_inline_style.html │ │ ├── Inline_HTML_Simple.markdown │ │ ├── Inline_HTML_Simple.html │ │ ├── Links_reference_style.markdown │ │ └── Links_reference_style.html │ ├── Tabs │ │ ├── TabConversionUnicode.markdown │ │ └── TabConversionUnicode.html │ ├── Code │ │ ├── WhiteLines.html │ │ ├── FenceMatching.markdown │ │ ├── WhiteLines.markdown │ │ ├── FenceMatching.html │ │ ├── BlankLinesAtEnd.markdown │ │ ├── Inline.markdown │ │ ├── BlankLinesAtEnd.html │ │ ├── IndentedInLists.markdown │ │ ├── IndentedFences.markdown │ │ ├── BlankLines.markdown │ │ ├── ListBreakAfter.markdown │ │ ├── IndentedFences.html │ │ ├── Inline.html │ │ ├── BlankLines.html │ │ ├── IndentedCodeBlocks.markdown │ │ ├── IndentedInLists.html │ │ ├── ListBreakAfter.html │ │ ├── IndentedCodeBlocks.html │ │ ├── FencedCodeBlocks.markdown │ │ └── FencedCodeBlocks.html │ ├── HTML │ │ ├── UppercaseTags.markdown │ │ ├── UppercaseTags.html │ │ ├── Inline.markdown │ │ ├── Inline.html │ │ ├── Blocks.html │ │ └── Blocks.markdown │ ├── Headers │ │ ├── Setext.html │ │ ├── Setext.markdown │ │ ├── ATX.markdown │ │ └── ATX.html │ └── Misc │ │ ├── Laziness.markdown │ │ ├── Transitions.markdown │ │ ├── BackslashEscapes.markdown │ │ ├── Laziness.html │ │ ├── LineBreaks.html │ │ ├── BackslashEscapes.html │ │ ├── Transitions.html │ │ └── LineBreaks.markdown └── package.yaml ├── avh4-lib ├── test │ ├── Tests.hs │ └── Data │ │ ├── Text │ │ └── ExtraTest.hs │ │ └── List │ │ └── ExtraTest.hs └── src │ └── Data │ ├── Coapplicative.hs │ ├── Either │ └── Extra.hs │ ├── ReversedList.hs │ ├── List │ └── Extra.hs │ └── Text │ └── Extra.hs ├── elm-format-lib ├── test │ ├── Tests.hs │ └── Parse │ │ └── TestHelpersTest.hs └── src │ ├── Parse │ ├── IParser.hs │ ├── Markdown.hs │ ├── Comments.hs │ └── State.hs │ ├── ElmFormat │ ├── AST │ │ ├── PublicAST │ │ │ ├── Config.hs │ │ │ └── MaybeF.hs │ │ └── PublicAST.hs │ ├── Render │ │ └── Text.hs │ └── KnownContents.hs │ ├── Reporting │ └── Error │ │ └── Docs.hs │ └── AST │ └── Helpers.hs ├── elm-format-test-lib ├── test │ └── Tests.hs └── src │ └── Expect.hs ├── keys └── github-actions.pub ├── cabal.project ├── .dockerignore ├── Release Notes ├── 0.5.1-alpha.md ├── 0.5.2-alpha.md ├── 0.3.1-alpha.md ├── 0.5.0-alpha.md ├── 0.8.3.md ├── 0.3.0-alpha-elm017rc1-rc1.md ├── 0.8.5.md ├── 0.6.1-alpha.md ├── 0.8.4.md ├── 0.8.1.md └── 0.8.7.md ├── src ├── Main.hs └── ElmFormat │ └── Version.hs ├── .github ├── actions │ ├── git-tags │ │ └── action.yml │ ├── cache-haskell-deps │ │ └── action.yml │ └── cache-build │ │ └── action.yml └── workflows │ ├── Touch cache.yml │ ├── Build release.yml │ ├── CI.yml │ ├── Check published packages (nixpkgs).yml │ └── Check published packages (npm).yml ├── dev ├── Documentation │ ├── README.md │ ├── Build Commands.md │ └── Signatures.md └── build.sh ├── .gitattributes ├── Shakefile ├── src │ └── Shakefiles │ │ ├── Prelude.hs │ │ ├── Extra.hs │ │ ├── Signature.hs │ │ ├── ListFiles.hs │ │ └── NestedCheckout.hs ├── package.yaml └── build-elm-format.cabal ├── .gitignore ├── nix ├── tools.nix └── sources.json ├── .gitpod.yml ├── shell.nix └── hie.yaml /.envrc: -------------------------------------------------------------------------------- 1 | use nix 2 | -------------------------------------------------------------------------------- /cabal.config: -------------------------------------------------------------------------------- 1 | split-objs: True 2 | -------------------------------------------------------------------------------- /package/nix/.gitignore: -------------------------------------------------------------------------------- 1 | /nixpkgs 2 | -------------------------------------------------------------------------------- /tests/test-files/validate2.json: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /parser/tests/test-files/bad/BBTArgs: -------------------------------------------------------------------------------- 1 | Fail -------------------------------------------------------------------------------- /.hlint.yaml: -------------------------------------------------------------------------------- 1 | - ignore: {name: "Eta reduce"} 2 | -------------------------------------------------------------------------------- /package/elm-tooling/.gitignore: -------------------------------------------------------------------------------- 1 | /elm-tooling/ 2 | -------------------------------------------------------------------------------- /tests/test-files/transform/Elm-0.18/Empty.elm: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Style Guide/.gitignore: -------------------------------------------------------------------------------- 1 | /_book/ 2 | /node_modules/ 3 | -------------------------------------------------------------------------------- /package/npm/.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules/ 2 | /result 3 | -------------------------------------------------------------------------------- /parser/tests/test-files/bad/InfiniteType.elm: -------------------------------------------------------------------------------- 1 | 2 | f = f 42 -------------------------------------------------------------------------------- /elm-format-markdown/tests/Emphasis/Escapes.markdown: -------------------------------------------------------------------------------- 1 | *hi\* there* -------------------------------------------------------------------------------- /parser/tests/test-files/bad/NonElementMain.elm: -------------------------------------------------------------------------------- 1 | 2 | main = 42 -------------------------------------------------------------------------------- /parser/tests/test-files/good/Lists/EmptyList.elm: -------------------------------------------------------------------------------- 1 | 2 | emptyList = [] -------------------------------------------------------------------------------- /tests/test-files/CommonMark/.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *.bak 3 | spec.html -------------------------------------------------------------------------------- /tests/test-files/transform/Elm-0.18/TrickyModule1.elm: -------------------------------------------------------------------------------- 1 | modu = () 2 | -------------------------------------------------------------------------------- /avh4-lib/test/Tests.hs: -------------------------------------------------------------------------------- 1 | {-# OPTIONS_GHC -F -pgmF tasty-discover #-} 2 | -------------------------------------------------------------------------------- /package/win/.gitignore: -------------------------------------------------------------------------------- 1 | /.vagrant 2 | /elm-format.exe 3 | /elm-format/ 4 | -------------------------------------------------------------------------------- /parser/tests/test-files/good/Lists/ListRange.elm: -------------------------------------------------------------------------------- 1 | 2 | listRange = [2..10] -------------------------------------------------------------------------------- /tests/test-files/transform/Elm-0.18/TrickyModule3.elm: -------------------------------------------------------------------------------- 1 | portModule = () 2 | -------------------------------------------------------------------------------- /tests/test-files/transform/Elm-0.18/TrickyModule4.elm: -------------------------------------------------------------------------------- 1 | effect mod = () 2 | -------------------------------------------------------------------------------- /elm-format-lib/test/Tests.hs: -------------------------------------------------------------------------------- 1 | {-# OPTIONS_GHC -F -pgmF tasty-discover #-} 2 | -------------------------------------------------------------------------------- /elm-format-markdown/tests/Blockquotes/Indents.markdown~: -------------------------------------------------------------------------------- 1 | > one 2 | > blockquote -------------------------------------------------------------------------------- /elm-format-markdown/tests/Emphasis/Escapes.html: -------------------------------------------------------------------------------- 1 |
hi* there
2 | -------------------------------------------------------------------------------- /parser/tests/test-files/good/Lists/NonEmptyList.elm: -------------------------------------------------------------------------------- 1 | 2 | nonEmptyList = [1,4,5] -------------------------------------------------------------------------------- /tests/test-files/transform/Elm-0.18/TrickyModule2.elm: -------------------------------------------------------------------------------- 1 | 2 | modulex = () 3 | -------------------------------------------------------------------------------- /elm-format-test-lib/test/Tests.hs: -------------------------------------------------------------------------------- 1 | {-# OPTIONS_GHC -F -pgmF tasty-discover #-} 2 | -------------------------------------------------------------------------------- /parser/tests/test-files/good/Soundness/TrickyId.elm: -------------------------------------------------------------------------------- 1 | 2 | myId x = let y = x in y -------------------------------------------------------------------------------- /Style Guide/styles/website.css: -------------------------------------------------------------------------------- 1 | .markdown-section pre { 2 | line-height: 1em; 3 | } 4 | -------------------------------------------------------------------------------- /elm-format-markdown/tests/Lists/TightLooseMore.markdown: -------------------------------------------------------------------------------- 1 | * foo 2 | * bar 3 | 4 | blah -------------------------------------------------------------------------------- /package/win/links.txt: -------------------------------------------------------------------------------- 1 | http://digitaldrummerj.me//vagrant-installing-your-software/ 2 | -------------------------------------------------------------------------------- /parser/tests/test-files/good/Soundness/Id.elm: -------------------------------------------------------------------------------- 1 | 2 | myId = 3 | let id x = x in id 4 | -------------------------------------------------------------------------------- /tests/test-files/transform/Elm-0.18/Empty.formatted.elm: -------------------------------------------------------------------------------- 1 | module Main exposing (..) 2 | -------------------------------------------------------------------------------- /tests/test-files/directory/valid.elm: -------------------------------------------------------------------------------- 1 | module X exposing (a) 2 | 3 | 4 | a = 5 | 123 6 | -------------------------------------------------------------------------------- /parser/tests/test-files/bad/Strings/ExtraClose.elm: -------------------------------------------------------------------------------- 1 | 2 | s = " " " 3 | 4 | main = plainText s 5 | -------------------------------------------------------------------------------- /parser/tests/test-files/good/Strings/Multiline.elm: -------------------------------------------------------------------------------- 1 | s = """ 2 | here's a quote: " 3 | 4 | """ 5 | -------------------------------------------------------------------------------- /tests/test-files/recursive-directory/nested/invalid.elm: -------------------------------------------------------------------------------- 1 | module X where 2 | 3 | ab,c = 123 + x 4 | -------------------------------------------------------------------------------- /Style Guide/book.json: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": [ "page-toc" ], 3 | "pluginsConfig": { 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /elm-format-markdown/tests/Links/BackticksInLinks.markdown: -------------------------------------------------------------------------------- 1 | [the right bracket character (`]`)](/url) 2 | -------------------------------------------------------------------------------- /parser/tests/test-files/good/Soundness/Apply.elm: -------------------------------------------------------------------------------- 1 | 2 | apply f = let g x = f x 3 | in g 4 | -------------------------------------------------------------------------------- /elm-format-markdown/tests/Lists/ListsAndHRs.markdown: -------------------------------------------------------------------------------- 1 | * item 1 2 | * item 2 3 | * * * * * 4 | -------------------------------------------------------------------------------- /elm-format-markdown/tests/Original/Nested_blockquotes.markdown: -------------------------------------------------------------------------------- 1 | > foo 2 | > 3 | > > bar 4 | > 5 | > foo 6 | -------------------------------------------------------------------------------- /package/npm/README.md: -------------------------------------------------------------------------------- 1 | 2 | See [https://github.com/avh4/elm-format](https://github.com/avh4/elm-format) 3 | -------------------------------------------------------------------------------- /parser/tests/test-files/good/NoExpressions.elm: -------------------------------------------------------------------------------- 1 | 2 | type alias Width = Float 3 | type alias Height = Float -------------------------------------------------------------------------------- /parser/tests/test-files/good/Strings/MultilineNormal.elm: -------------------------------------------------------------------------------- 1 | 2 | s = " 3 | here's a quote: \" 4 | 5 | " 6 | -------------------------------------------------------------------------------- /tests/Integration/data/minimal.elm: -------------------------------------------------------------------------------- 1 | module Main exposing (..) 2 | 3 | 4 | f : Float 5 | f = 6 | 1 7 | -------------------------------------------------------------------------------- /tests/test-files/from-json/Elm-0.19/Simple.elm: -------------------------------------------------------------------------------- 1 | module Simple exposing (f) 2 | 3 | 4 | f = 5 | () 6 | -------------------------------------------------------------------------------- /tests/test-files/transform/Elm-0.19/AddMissingExposingForImport.elm: -------------------------------------------------------------------------------- 1 | import {- A -} Bar {- B -} (Foo) 2 | -------------------------------------------------------------------------------- /elm-format-markdown/tests/Tabs/TabConversionUnicode.markdown: -------------------------------------------------------------------------------- 1 | `То лпой` is a Russian word with a tab inside. 2 | -------------------------------------------------------------------------------- /parser/tests/test-files/good/Soundness/TrickyIdAnnotated.elm: -------------------------------------------------------------------------------- 1 | 2 | myId : a -> a 3 | myId x = let y = x in y 4 | -------------------------------------------------------------------------------- /tests/test-files/recursive-directory/valid.elm: -------------------------------------------------------------------------------- 1 | module X exposing (abc) 2 | 3 | 4 | abc x = 5 | 123 + x 6 | -------------------------------------------------------------------------------- /elm-format-markdown/tests/Links/CaseInsensitiveReferences.html: -------------------------------------------------------------------------------- 1 |Толпой is a Russian word.
2 | -------------------------------------------------------------------------------- /elm-format-markdown/tests/Lists/ListsAndSetextHeaders.markdown: -------------------------------------------------------------------------------- 1 | 1. item 2 | 2. item 3 | Not header 4 | ---------- 5 | -------------------------------------------------------------------------------- /elm-format-markdown/tests/Links/CaseInsensitiveReferences.markdown: -------------------------------------------------------------------------------- 1 | [Толпой] is a Russian word. 2 | 3 | [ТОЛПОЙ]: /url 4 | -------------------------------------------------------------------------------- /elm-format-markdown/tests/Lists/EmptyListItem.markdown: -------------------------------------------------------------------------------- 1 | - one 2 | - 3 | - three 4 | 5 | 1. one 6 | 2. 7 | 3. three 8 | -------------------------------------------------------------------------------- /package/npm/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs ? importABC
2 |
3 |
4 |
5 | DEF
6 |
7 | GHI
8 | -------------------------------------------------------------------------------- /elm-format-markdown/tests/Links/BackticksInLinks.html: -------------------------------------------------------------------------------- 1 |the right bracket character (])
То лпой is a Russian word with a tab inside.
Here is some inline html.
5 | -------------------------------------------------------------------------------- /elm-format-markdown/tests/Lists/ListsAndHRs.html: -------------------------------------------------------------------------------- 1 |foo
3 |blah
~~~
2 | ```
3 |
4 |
5 | ~~~~
6 |
7 |
8 |
--------------------------------------------------------------------------------
/tests/test-files/bad/Elm-0.19/UnexpectedEndOfInput.output.txt:
--------------------------------------------------------------------------------
1 | Unable to parse file 2 |8 | -------------------------------------------------------------------------------- /elm-format-markdown/tests/Lists/ConsecutiveLists.markdown: -------------------------------------------------------------------------------- 1 | * one 2 | * one 3 | + two 4 | + two 5 | - three 6 | - three 7 | 1. four 8 | 1. four 9 | 1) five 10 | 1) five 11 | -------------------------------------------------------------------------------- /tests/test-files/good/Elm-0.18/ApiSketch.elm: -------------------------------------------------------------------------------- 1 | module ApiSketch exposing (..) 2 | 3 | 4 | encode : Stats -> Json.Encode.Value 5 | 6 | 7 | decoder : Json.Decode.Decoder Stats 8 | -------------------------------------------------------------------------------- /tests/test-files/transform/Elm-0.19/ReplaceThenByOfInCase.elm: -------------------------------------------------------------------------------- 1 | type Foo = A | B | C 2 | 3 | a = A 4 | 5 | b = case a then 6 | A -> 1 7 | B -> 2 8 | C -> 3 9 | -------------------------------------------------------------------------------- /tests/test-files/transform/Elm-0.19/TransformFatArrow.formatted.elm: -------------------------------------------------------------------------------- 1 | module Main exposing (foo) 2 | 3 | 4 | foo : Int -> Int -> Int -> Int 5 | foo = 6 | \a b c -> a + b + c 7 | -------------------------------------------------------------------------------- /tests/test-files/good/Elm-0.18/AllSyntax/DocCommentsStartingWtihAtDocs.elm: -------------------------------------------------------------------------------- 1 | module Main exposing (x) 2 | 3 | {-| 4 | 5 | @docs x 6 | 7 | -} 8 | 9 | 10 | x = 11 | () 12 | -------------------------------------------------------------------------------- /package/win/shell/main.cmd: -------------------------------------------------------------------------------- 1 | @powershell -NoProfile -ExecutionPolicy Bypass -File "%systemdrive%\vagrant\shell\InstallChocolatey.ps1" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin" 2 | -------------------------------------------------------------------------------- /cabal.project: -------------------------------------------------------------------------------- 1 | packages: 2 | ./avh4-lib, 3 | ./elm-format-markdown, 4 | ./elm-format-lib, 5 | ./elm-format-test-lib, 6 | ./ 7 | ./Shakefile 8 | with-compiler: ghc-9.6.7 9 | -------------------------------------------------------------------------------- /elm-format-markdown/tests/Code/BlankLinesAtEnd.markdown: -------------------------------------------------------------------------------- 1 | * List 2 | 3 | code 4 | 5 | 6 | * one 7 | * two 8 | 9 | 10 | 11 | * one 12 | not code 13 | 14 | * two 15 | -------------------------------------------------------------------------------- /elm-format-markdown/tests/Links/Entities.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /elm-format-markdown/tests/Lists/InBlockquote.markdown: -------------------------------------------------------------------------------- 1 | > - tight 2 | > - tight 3 | 4 | 5 | > - loose 6 | > 7 | > - loose 8 | 9 | 10 | > - one-item list 11 | 12 | > - one-item list 13 | -------------------------------------------------------------------------------- /tests/test-files/from-json/Elm-0.19/ModuleComments.elm: -------------------------------------------------------------------------------- 1 | module ModuleComments exposing (f) 2 | 3 | 4 | 5 | -- Default comment 6 | {- Block comment -} 7 | 8 | 9 | f = 10 | () 11 | -------------------------------------------------------------------------------- /tests/test-files/transform/Elm-0.18/LenientEqualsColon.elm: -------------------------------------------------------------------------------- 1 | 2 | 3 | type alias Foo = 4 | { x = Int 5 | , y = () 6 | } 7 | 8 | 9 | foo = 10 | { x : Int, y : Int } 11 | -------------------------------------------------------------------------------- /elm-format-markdown/tests/Lists/EmptyListItem.html: -------------------------------------------------------------------------------- 1 |foo
3 |4 |6 |bar
5 |foo
7 |
2 |9 | -------------------------------------------------------------------------------- /elm-format-test-lib/src/Expect.hs: -------------------------------------------------------------------------------- 1 | module Expect where 2 | 3 | import Test.Tasty.HUnit ((@=?)) 4 | 5 | 6 | equals :: (Eq a, Show a) => a -> a -> IO () 7 | equals expected actual = 8 | expected @=? actual 9 | -------------------------------------------------------------------------------- /tests/test-files/transform/Elm-0.18/QuickCheck-94f37da84c1310f03dcfa1059ce870b73c94a825--6449652945938213463.elm: -------------------------------------------------------------------------------- 1 | module{-A-}Main{-A-}(..) 2 | where 3 | 4 | foo{-A-}{-B-}=--A 5 | (a,--A 6 | b,c{-A-})--A 7 | -------------------------------------------------------------------------------- /elm-format-lib/src/ElmFormat/AST/PublicAST/Config.hs: -------------------------------------------------------------------------------- 1 | module ElmFormat.AST.PublicAST.Config (Config(..)) where 2 | 3 | 4 | newtype Config = 5 | Config 6 | { showSourceLocation :: Bool 7 | } 8 | -------------------------------------------------------------------------------- /tests/test-files/transform/Elm-0.19/DistinguishCharStartFromRef.formatted.elm: -------------------------------------------------------------------------------- 1 | module Main exposing (a, b) 2 | 3 | 4 | a = 5 | String.fromChar '!' 6 | 7 | 8 | b = 9 | identity (String.fromChar '!') 10 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | * 2 | !cabal.config 3 | !cabal.project 4 | !cabal.project.freeze 5 | !elm-format.cabal 6 | !elm-format-markdown 7 | !elm-format-lib 8 | !src 9 | !generated 10 | !elm-format-test-lib 11 | !avh4-lib 12 | -------------------------------------------------------------------------------- /elm-format-markdown/tests/Lists/Start.markdown: -------------------------------------------------------------------------------- 1 | 4. this list starts with 4. 2 | 5. and continues 3 | 1. the continuation number is irrelevant. 4 | 5 | 2001) a space odyssey 6 | 7 | 1. standard lists get no start attribute 8 | -------------------------------------------------------------------------------- /elm-format-markdown/tests/HTML/Inline.markdown: -------------------------------------------------------------------------------- 1 | hi 2 | `hi` 3 |A list within a blockquote:
3 |4 |
8 |- asterisk 1
5 |- asterisk 2
6 |- asterisk 3
7 |
2 |13 | -------------------------------------------------------------------------------- /elm-format-markdown/tests/Code/BlankLines.markdown: -------------------------------------------------------------------------------- 1 | foo 2 | 3 | 4 | 5 | bar 6 | > foo 7 | > 8 | > 9 | > 10 | > bar 11 | foo 12 | 13 | 14 | 15 | bar 16 | 17 | 1. One 18 | 19 | CodeA 20 | 21 | CodeB 22 | 23 | 2. Two 24 | 25 | CodeA 26 | 27 | 28 | 1. One 29 | -------------------------------------------------------------------------------- /elm-format-markdown/tests/Lists/Start.html: -------------------------------------------------------------------------------- 1 |Example:
3 |7 |sub status { 4 | print "working"; 5 | } 6 |Or:
8 |12 |sub status { 9 | return "working"; 10 | } 11 |
This is the simple case.
2 |This one has a line 3 | break.
4 |This one has a line 5 | break with a line-ending space.
6 | 7 | -------------------------------------------------------------------------------- /tests/test-files/transform/Elm-0.18/AllSyntax/Patterns.elm: -------------------------------------------------------------------------------- 1 | module Patterns exposing (consList) 2 | 3 | consList 4 | ( a::b::c 5 | , a{- 1 -}::{- 2 -}b{- 3 -}::{- 4 -}c 6 | , d 7 | :: 8 | e 9 | :: 10 | f 11 | ) 12 | = 13 | () 14 | 15 | 16 | complexCons (a::(x::[])::((b::_)as blah)) = 17 | () 18 | -------------------------------------------------------------------------------- /tests/test-files/transform/Elm-0.18/QuickCheck-94f37da84c1310f03dcfa1059ce870b73c94a825--6449652945938213463.formatted.elm: -------------------------------------------------------------------------------- 1 | module {- A -} Main {- A -} exposing (..) 2 | 3 | 4 | foo = 5 | {- A -} 6 | {- B -} 7 | --A 8 | ( a 9 | , --A 10 | b 11 | , c {- A -} 12 | ) 13 | 14 | 15 | 16 | --A 17 | -------------------------------------------------------------------------------- /tests/test-files/transform/Elm-0.19/ListDocumentedExportsNoExposing.elm: -------------------------------------------------------------------------------- 1 | module ListDocumentedExportsNoExposing 2 | 3 | {-| 4 | 5 | @docs a 6 | 7 | # Heading 8 | 9 | @docs X 10 | @docs Y 11 | @docs b, c 12 | 13 | -} 14 | 15 | type alias X = () 16 | type Y = Y1 | Y2 17 | q = 4 18 | a = 1 19 | b = 2 20 | c = 3 21 | p = 5 22 | -------------------------------------------------------------------------------- /elm-format-markdown/tests/Lists/CodeBlocksInLists.html: -------------------------------------------------------------------------------- 1 |list item 3 | code
list item
5 |code
6 | code
8 | code
10 | code
12 | code
13 | this is markdown
9 |####### Seven
8 |## Not a header
12 |#5 not a header
13 | 14 |(empty header)
15 | -------------------------------------------------------------------------------- /elm-format-markdown/tests/Original/Auto_links.markdown: -------------------------------------------------------------------------------- 1 | Link:a
2 |
3 | z
4 |
5 | a
6 | a
7 | a
8 | a
9 |
10 | foo
12 | Hello
13 |
14 | ```
15 |
16 | World
17 | 20 |23 | -------------------------------------------------------------------------------- /tests/test-files/CommonMark/.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | 3 | root = true 4 | 5 | [*] 6 | end_of_line = lf 7 | charset = utf-8 8 | insert_final_newline = true 9 | 10 | [*.{c,h}] 11 | trim_trailing_whitespace = true 12 | indent_style = tab 13 | indent_size = 8 14 | 15 | [Makefile] 16 | trim_trailing_whitespace = true 17 | indent_style = tab 18 | indent_size = 8 19 | -------------------------------------------------------------------------------- /tests/test-files/transform/Elm-0.18/QuickCheck-4562ebccb71ea9f622fb99cdf32b2923f6f9d34f-2529668492575674138.formatted.elm: -------------------------------------------------------------------------------- 1 | module 2 | --A 3 | Main 4 | {- A -} exposing 5 | ( a 6 | , b 7 | --A 8 | , --A 9 | c 10 | ) 11 | 12 | 13 | foo = 14 | {- A -} 15 | {- B -} 16 | "ABC" ({- A -} {- B -}) {- A -} {- B -} "ABC" () 1 17 | -------------------------------------------------------------------------------- /tests/test-files/transform/Elm-0.19/ListAllExportsNoModuleLine.formatted.elm: -------------------------------------------------------------------------------- 1 | module Main exposing (X, Y(..), a, b, c, p, q) 2 | 3 | 4 | type alias X = 5 | () 6 | 7 | 8 | type Y 9 | = Y1 10 | | Y2 11 | 12 | 13 | q = 14 | 4 15 | 16 | 17 | a = 18 | 1 19 | 20 | 21 | b = 22 | 2 23 | 24 | 25 | c = 26 | 3 27 | 28 | 29 | p = 30 | 5 31 | -------------------------------------------------------------------------------- /Shakefile/src/Shakefiles/Prelude.hs: -------------------------------------------------------------------------------- 1 | module Shakefiles.Prelude where 2 | 3 | import Development.Shake 4 | 5 | 6 | nTimes :: Int -> (a -> a) -> (a -> a) 7 | nTimes 0 _ = id 8 | nTimes 1 f = f 9 | nTimes n f = f . nTimes (n-1) f 10 | 11 | 12 | hashNeed :: [FilePath] -> Action String 13 | hashNeed files = do 14 | need files 15 | liftIO $ getHashedShakeVersion files 16 | -------------------------------------------------------------------------------- /elm-format-markdown/tests/Code/Inline.html: -------------------------------------------------------------------------------- 1 |22 |a 21 |
All of these are equivalent:
2 |*hi**hi**hi**hi**hi*Backticks in code spans:
10 |``code````code``one
two
9 |17 |10 |
13 |- 11 |
one
- 12 |
two
14 |
16 |- new list
15 |
code
21 |
22 |
--------------------------------------------------------------------------------
/elm-format-markdown/tests/Original/Links_shortcut_references.markdown:
--------------------------------------------------------------------------------
1 | This is the [simple case].
2 |
3 | [simple case]: /simple
4 |
5 |
6 |
7 | This one has a [line
8 | break].
9 |
10 | This one has a [line
11 | break] with a line-ending space.
12 |
13 | [line break]: /foo
14 |
15 |
16 | [this] [that] and the [other]
17 |
18 | [this]: /this
19 | [that]: /that
20 | [other]: /other
21 |
--------------------------------------------------------------------------------
/tests/test-files/transform/Elm-0.18/DocCommentCheapskateReferenceBug.elm:
--------------------------------------------------------------------------------
1 | module DocCommentCheapskateReferenceBug exposing (f)
2 |
3 |
4 | {-| docs
5 |
6 | [link1]: http://example.com
7 | [link2]: http://example.com
8 | (cheapskate bug]: http://example.com
9 | [not a link]: http://example.com
10 |
11 | [bug]: http://example.com
12 | sdfjkl
13 |
14 | -}
15 |
16 |
17 | f =
18 | ()
19 |
--------------------------------------------------------------------------------
/parser/tests/test-files/good/CaseExpression3.elm:
--------------------------------------------------------------------------------
1 |
2 | type List a
3 | = Nil
4 | | Cons a (List a)
5 |
6 |
7 | zip : List a -> List b -> List (a, b)
8 | zip list1 list2 =
9 | case (list1, list2) of
10 | (Nil, _) ->
11 | Nil
12 |
13 | (_, Nil) ->
14 | Nil
15 |
16 | (Cons x xs, Cons y ys) ->
17 | Cons (x, y) (zip xs ys)
18 |
--------------------------------------------------------------------------------
/tests/test-files/good/Elm-0.17/AllSyntax/LineComments/Module.elm:
--------------------------------------------------------------------------------
1 | --A
2 |
3 |
4 | module
5 | --B
6 | AllSyntax.LineComments.Module
7 | --C
8 | exposing
9 | --D
10 | ( --K
11 | D
12 | --L
13 | , --E
14 | a
15 | --F
16 | , --G
17 | b
18 | --H
19 | , --I
20 | c
21 | --J
22 | )
23 |
24 |
25 | a =
26 | 1
27 |
--------------------------------------------------------------------------------
/elm-format-markdown/tests/Original/Code_Blocks.html:
--------------------------------------------------------------------------------
1 | code block on the first line
2 |
3 | Regular text.
4 |code block indented by spaces
5 |
6 | Regular text.
7 |the lines in this block
8 | all contain trailing spaces
9 |
10 | Regular Text.
11 |code block on the last line
12 |
13 |
--------------------------------------------------------------------------------
/package/npm/shell.nix:
--------------------------------------------------------------------------------
1 | {pkgs ? import 2 |7 |3 |
6 |- tight
4 |- tight
5 |
8 |13 |9 |
12 |- 10 |
loose
- 11 |
loose
14 |18 |15 |
17 |- one-item list
16 |
19 |23 | -------------------------------------------------------------------------------- /elm-format-lib/src/ElmFormat/AST/PublicAST.hs: -------------------------------------------------------------------------------- 1 | module ElmFormat.AST.PublicAST 2 | ( module ElmFormat.AST.PublicAST.Core 3 | , module ElmFormat.AST.PublicAST.Config 4 | , module ElmFormat.AST.PublicAST.Module 5 | ) where 6 | 7 | import ElmFormat.AST.PublicAST.Core (ToPublicAST(..), FromPublicAST(..)) 8 | import ElmFormat.AST.PublicAST.Config 9 | import ElmFormat.AST.PublicAST.Module (fromModule, toModule) 10 | -------------------------------------------------------------------------------- /elm-format-markdown/tests/Blockquotes/Separation.markdown: -------------------------------------------------------------------------------- 1 | One blockquote, two paragraphs: 2 | 3 | > one 4 | > 5 | > two 6 | 7 | Two blockquotes: 8 | 9 | > one 10 | 11 | > two 12 | 13 | Nested blockquote, two paragraphs: 14 | 15 | > > one 16 | > > 17 | > > two 18 | 19 | Nested blockquote, two blockquotes: 20 | 21 | > > one 22 | > 23 | > > two 24 | 25 | Two nested blockquotes: 26 | 27 | > > one 28 | 29 | > > two 30 | -------------------------------------------------------------------------------- /elm-format-markdown/tests/Links/InlineLinks.html: -------------------------------------------------------------------------------- 1 |20 |
22 |- one-item list
21 |
2 |7 |3 |
6 |- one 4 | two
5 |
Laziness only affects paragraph continuations:
8 |9 |12 |11 |code 10 |
not same code block
13 |
14 | 19 |22 | -------------------------------------------------------------------------------- /tests/test-files/CommonMark/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "commonmark-spec", 3 | "version": "0.27.0", 4 | "description": "CommonMark spec and test cases", 5 | "homepage": "http://commonmark.org", 6 | "license": "CC-BY-SA-4.0", 7 | "keywords": [ 8 | "commonmark", 9 | "markdown" 10 | ], 11 | "repository": "jgm/CommonMark", 12 | "license": "MIT", 13 | "files": [ 14 | "index.js", 15 | "spec.txt" 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /tests/test-files/transform/Elm-0.18/WindowsEol.elm: -------------------------------------------------------------------------------- 1 | module AllSyntax.WindowsEol exposing (string) 2 | 3 | {-| elm-format converts all CRLF line-endings to LF. 4 | 5 | Raw CRs that are within strings will be escaped. 6 | 7 | Escaped CRs will be retained. 8 | -} 9 | 10 | 11 | multilineString = 12 | """ 13 | """ 14 | 15 | 16 | string = " 17 | " 18 | 19 | 20 | rawCR = " " 21 | 22 | 23 | escapedCR = "\x0D" 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Generated source files 2 | /generated/ 3 | 4 | # Files generated by the test suite 5 | /formatted.elm 6 | /_input.elm 7 | /_input2.elm 8 | /_stdout.txt 9 | /tests/**/actual 10 | 11 | # Files generated by the build system 12 | /.direnv/ 13 | /.shake/ 14 | /.shake.cache/ 15 | /_build/ 16 | /dist-newstyle/ 17 | /bin/ 18 | 19 | # Output files 20 | /dist/ 21 | /publish/ 22 | /downloads/ 23 | /result 24 | /_profile/ 25 | /_coverage/ 26 | -------------------------------------------------------------------------------- /parser/tests/test-files/bad/IncompletePatternMatch.elm: -------------------------------------------------------------------------------- 1 | 2 | type List a 3 | = Nil 4 | | Cons a (List a) 5 | 6 | 7 | zip : List a -> List b -> List (a, b) 8 | zip list1 list2 = 9 | case (list1, list2) of 10 | (Nil, _) -> 11 | Nil 12 | 13 | (Cons x xs, Cons y ys) -> 14 | Cons (x, y) (zip xs ys) 15 | 16 | -- incomplete pattern match is an error 17 | -- missing: (_, Nil) -> Nil 18 | -------------------------------------------------------------------------------- /tests/test-files/good/Elm-0.17/AllSyntax/BlockComments/ModuleEffect.elm: -------------------------------------------------------------------------------- 1 | effect {- T -} module {- A -} AllSyntax.BlockComments.ModuleEffect {- B -} where {- C -} { {- D -} command {- E -} = {- F -} MyCmd {- G -}, {- H -} subscription {- I -} = {- J -} MySub {- K -} } {- L -} exposing {- M -} ({- N -} a {- O -}, {- P -} b {- Q -}, {- R -} c {- S -}) 2 | 3 | 4 | type MyCmd msg 5 | = MyCmd msg 6 | 7 | 8 | type MySub msg 9 | = MySub msg 10 | -------------------------------------------------------------------------------- /elm-format-markdown/tests/Original/Tabs.markdown: -------------------------------------------------------------------------------- 1 | + this is a list item 2 | indented with tabs 3 | 4 | + this is a list item 5 | indented with spaces 6 | 7 | Code: 8 | 9 | this code block is indented by one tab 10 | 11 | And: 12 | 13 | this code block is indented by two tabs 14 | 15 | And: 16 | 17 | + this is an example list item 18 | indented with tabs 19 | 20 | + this is an example list item 21 | indented with spaces 22 | -------------------------------------------------------------------------------- /parser/tests/test-files/good/Ports.elm: -------------------------------------------------------------------------------- 1 | 2 | -- incoming 3 | port userID : String 4 | port number : Int 5 | port tuple : (Float,Bool) 6 | port array : List Int 7 | port record : { x:Float, y:Float } 8 | 9 | -- outgoing 10 | port fortyTwo : Int 11 | port fortyTwo = 12 | 42 13 | 14 | 15 | port time : Float 16 | port time = 17 | 3.14 18 | 19 | port students : List { name:String, age:Int } 20 | port students = 21 | [ { name = "Tom", age = 42 } ] -------------------------------------------------------------------------------- /tests/json-format-schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "array", 3 | "items": { 4 | "type": "object", 5 | "properties": { 6 | "path": { 7 | "type": "string" 8 | }, 9 | "line": { 10 | "type": "number" 11 | }, 12 | "column": { 13 | "type": "number" 14 | }, 15 | "message": { 16 | "type": "string" 17 | } 18 | }, 19 | "required": ["path", "message"] 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /elm-format-markdown/tests/Misc/LineBreaks.html: -------------------------------------------------------------------------------- 1 |21 |code 20 |
Two spaces
2 | break a line. Or more than two
3 | and spaces in the following line are absorbed.
You can also break lines with
5 | a backslash.
Two spaces at the end of a paragraph are 7 | not a line break.
8 |A backslash at the end of a paragraph is 9 | not a line break.\
10 |*not emphasized* 2 | \emphasis 3 | **not bold** 4 | <br/> not a tag 5 | [link](/foo) not a link 6 | link 7 | `not code`
8 |1. not a list item
9 |* not a list.
10 |# Not a header
11 |[foo]: /url "not a reference"
12 |$ ^ ; can be escaped. 13 | \a \b \T cannot. 14 | unicode letters and symbols cannot: \π \‥.
15 | -------------------------------------------------------------------------------- /tests/test-files/good/Elm-0.19/GLShader.elm: -------------------------------------------------------------------------------- 1 | module AllSyntax.GLShader exposing (vertexShader) 2 | 3 | 4 | vertexShader : Shader { position : Vec3, coord : Vec3 } { u | view : Mat4 } { vcoord : Vec2 } 5 | vertexShader = 6 | [glsl| 7 | 8 | attribute vec3 position; 9 | attribute vec3 coord; 10 | uniform mat4 view; 11 | varying vec2 vcoord; 12 | 13 | void main () { 14 | gl_Position = view * vec4(position, 1.0); 15 | vcoord = coord.xy; 16 | } 17 | 18 | |] 19 | -------------------------------------------------------------------------------- /tests/test-files/transform/Elm-0.18/MissingImportParens.formatted.elm: -------------------------------------------------------------------------------- 1 | module Main exposing (x) 2 | 3 | import Import.As1 as ImportAs1 4 | import Import.As2 as ImportAs2 exposing (A) 5 | import ImportDotDot exposing (..) 6 | import ImportName exposing (A) 7 | import ImportNames exposing (A, B, x, y) 8 | import ImportNamesLineBreak exposing (A, B) 9 | import MergeImport exposing (A, B, Z) 10 | import OtherImport exposing (A(X, Y), b, z) 11 | 12 | 13 | x = 14 | () 15 | -------------------------------------------------------------------------------- /elm-format-markdown/tests/Code/BlankLines.html: -------------------------------------------------------------------------------- 1 |foo
2 |
3 |
4 |
5 | bar
6 |
7 | 8 |15 |14 |foo 9 | 10 | 11 | 12 | bar 13 |
foo
16 |
17 |
18 |
19 | bar
20 |
21 | One
23 |CodeA
24 |
25 | CodeB
26 | Two
28 |CodeA
29 | 2 |7 |blockquote
3 |4 |6 |blockquote
5 |
paragraph
16 |code
19 |
20 | code
21 |
22 | code starts here
3 | foo
7 |code starts here
8 | foo
10 |code starts here
11 | foo
15 |code starts here
16 |
17 | foo
19 |code starts here
20 | http://google.com?query=blah&time=15 2 | someone.else@somedomain.com 3 | ftp://old.ftp.server.edu 4 | git://some.git.repo/project.git 5 | <not autolink> 6 | <http://not.an autolink> 7 | <relative/not/autolink>
8 | -------------------------------------------------------------------------------- /tests/test-files/transform/Elm-0.18/MissingImportParens.elm: -------------------------------------------------------------------------------- 1 | module Main exposing (x) 2 | 3 | import OtherImport exposing (A(X, Y), b, z) 4 | import Import.As1 as ImportAs1 5 | import Import.As2 as ImportAs2 exposing A 6 | import ImportDotDot exposing .. 7 | import ImportName exposing A 8 | import ImportNames exposing A, B, x, y 9 | import ImportNamesLineBreak exposing 10 | A, B 11 | import MergeImport exposing (Z) 12 | import MergeImport exposing A, B 13 | 14 | 15 | x = 16 | () 17 | -------------------------------------------------------------------------------- /.github/actions/cache-haskell-deps/action.yml: -------------------------------------------------------------------------------- 1 | inputs: 2 | cabal-store: 3 | required: false 4 | default: ~/.cabal/store 5 | runs: 6 | using: "composite" 7 | steps: 8 | - name: Cache ~/.cabal/store 9 | uses: actions/cache@v3 10 | with: 11 | path: ${{ inputs.cabal-store }} 12 | key: cabal-v3-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('cabal.project.freeze') }} 13 | restore-keys: | 14 | cabal-v3-${{ runner.os }}-${{ runner.arch }}- 15 | -------------------------------------------------------------------------------- /elm-format-markdown/tests/Lists/TightAndLoose.markdown: -------------------------------------------------------------------------------- 1 | 1. tight 2 | 3 | 4 | - tight 5 | - list 6 | 7 | 8 | - loose 9 | 10 | - list 11 | 12 | 13 | 1. tight 14 | 2. list 15 | 16 | 17 | 1. loose 18 | 19 | 2. list 20 | 21 | 22 | 1. loose 23 | 24 | - sublist 25 | 26 | 27 | 28 | 1. tight 29 | - sublist 30 | 31 | 32 | - tight 33 | > blockquote 34 | and 35 | ``` 36 | code 37 | ``` 38 | - tight 39 | 40 | 41 | - loose 42 | - with loose 43 | 44 | - sublist 45 | - loose 46 | -------------------------------------------------------------------------------- /elm-format-markdown/tests/Original/Inline_HTML_Advanced.html: -------------------------------------------------------------------------------- 1 |Simple block on one line:
2 |And nested without indentation:
4 |And with attributes:
14 |This was broken in 1.0.2b7:
19 |Inline link 3 with non-escaped parens.
4 |Inline link 4 with non-escaped parens.
5 | 6 | 7 | -------------------------------------------------------------------------------- /tests/test-files/transform/Elm-0.18/DocCommentCodeExample.elm: -------------------------------------------------------------------------------- 1 | module DocCommentCodeExample exposing (f) 2 | 3 | {-| -} 4 | 5 | 6 | {-| Compute with f (indented code block) 7 | 8 | myValue = f 20 9 | -} 10 | f x = 11 | x * x 12 | 13 | 14 | {-| Compute with g (backticks code block) 15 | 16 | ``` 17 | myValue = g 99 18 | ``` 19 | -} 20 | g y = 21 | y + (4 * y) 22 | 23 | 24 | {-| Format expressions in code blocks 25 | 26 | h 20 --> 21 27 | 28 | h 21 --> 22 29 | 30 | -} 31 | h z = 32 | z + 1 33 | -------------------------------------------------------------------------------- /elm-format-markdown/tests/Original/Amps_and_angle_encoding.markdown: -------------------------------------------------------------------------------- 1 | AT&T has an ampersand in their name. 2 | 3 | AT&T is another way to write it. 4 | 5 | This & that. 6 | 7 | 4 < 5. 8 | 9 | 6 > 5. 10 | 11 | Here's a [link] [1] with an ampersand in the URL. 12 | 13 | Here's a link with an amersand in the link text: [AT&T] [2]. 14 | 15 | Here's an inline [link](/script?foo=1&bar=2). 16 | 17 | Here's an inline [link](). 18 | 19 | 20 | [1]: http://example.com/?foo=1&bar=2 21 | [2]: http://att.com/ "AT&T" -------------------------------------------------------------------------------- /elm-format-markdown/tests/Code/ListBreakAfter.html: -------------------------------------------------------------------------------- 1 |foo
3 |bar
5 |code1
6 | code2
7 |
8 | code?
foo
11 |bar
13 |code1
14 | code2
15 | code?
19 |
20 | bar
24 |code1
25 | code2
26 | code?
30 |
31 |
--------------------------------------------------------------------------------
/tests/test-files/transform/Elm-0.18/DocCommentAtDocs.formatted.elm:
--------------------------------------------------------------------------------
1 | module DocCommentAtDocs exposing
2 | ( x
3 | , y
4 | , z
5 | , T(..)
6 | )
7 |
8 | {-|
9 |
10 | @docs x
11 | @docs y
12 | @docs z
13 | @docs T
14 |
15 | @docs a, b, c
16 | @docs d
17 |
18 | Paragraph
19 |
20 | @docs startABlock
21 | @docs moreDocs
22 |
23 | -}
24 |
25 |
26 | {-| X
27 | -}
28 | x : ()
29 | x =
30 | ()
31 |
32 |
33 | {-| Y
34 | -}
35 | y : ()
36 | y =
37 | ()
38 |
39 |
40 | {-| Z
41 | -}
42 | z : ()
43 | z =
44 | ()
45 |
--------------------------------------------------------------------------------
/elm-format-markdown/tests/Original/Tabs.html:
--------------------------------------------------------------------------------
1 | this is a list item 3 | indented with tabs
this is a list item 5 | indented with spaces
Code:
8 |this code block is indented by one tab
9 |
10 | And:
11 | this code block is indented by two tabs
12 |
13 | And:
14 |+ this is an example list item
15 | indented with tabs
16 |
17 | + this is an example list item
18 | indented with spaces
19 |
20 |
--------------------------------------------------------------------------------
/tests/test-files/CommonMark/tools/spec2js.js:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | var fs = require('fs');
4 | var util = require('util');
5 |
6 | fs.readFile('spec.txt', 'utf8', function(err, data) {
7 | if (err) {
8 | return console.log(err);
9 | }
10 | var examples = [];
11 | data.replace(/^\.\n([\s\S]*?)^\.\n([\s\S]*?)^\.$/gm,
12 | function(_,x,y){
13 | examples.push({markdown: x, html: y});
14 | });
15 | console.log(util.inspect(examples, { depth: null }));
16 | console.warn(examples.length + ' examples');
17 | });
18 |
--------------------------------------------------------------------------------
/package/win/wine.sh:
--------------------------------------------------------------------------------
1 |
2 | # brew install wine
3 |
4 | curl -O 'https://www.haskell.org/cabal/release/cabal-install-1.24.0.2/cabal-install-1.24.0.2-i386-unknown-mingw32.zip'
5 | curl -O 'http://downloads.haskell.org/~ghc/8.0.1/ghc-8.0.1-i386-unknown-mingw32.tar.xz'
6 |
7 | # unzip cabal, ghc
8 |
9 | function wine_cabal {
10 | wine cabal.exe --with-ghc=ghc-8.0.1/bin/ghc.exe
11 | }
12 |
13 | wine_cabal update
14 | wine_cabal install --only-dependencies
15 | wine_cabal build
16 | # wine_cabal install --enable-test --only-dependencies
17 | # wine_cabal test
18 |
--------------------------------------------------------------------------------
/tests/test-files/transform/Elm-0.18/DocCommentCodeExample.formatted.elm:
--------------------------------------------------------------------------------
1 | module DocCommentCodeExample exposing (f)
2 |
3 | {-| -}
4 |
5 |
6 | {-| Compute with f (indented code block)
7 |
8 | myValue =
9 | f 20
10 |
11 | -}
12 | f x =
13 | x * x
14 |
15 |
16 | {-| Compute with g (backticks code block)
17 |
18 | myValue =
19 | g 99
20 |
21 | -}
22 | g y =
23 | y + (4 * y)
24 |
25 |
26 | {-| Format expressions in code blocks
27 |
28 | h 20 --> 21
29 |
30 | h 21 --> 22
31 |
32 | -}
33 | h z =
34 | z + 1
35 |
--------------------------------------------------------------------------------
/tests/test-files/good/Elm-0.19/InfixAsVariableName.elm:
--------------------------------------------------------------------------------
1 | module InfixAsVariableName exposing (..)
2 |
3 | {-| Despite being a keyword, "infix" is not a _reserved word_ in Elm 0.19,
4 | and is allowed as a variable name in expressions, type, and patterns.
5 | -}
6 |
7 |
8 | inExpression infix =
9 | infix + 1
10 |
11 |
12 | type InType infix
13 | = A infix
14 |
15 |
16 | {-| As top-level declaration
17 | -}
18 | infix x =
19 | ()
20 |
21 |
22 | inLetDeclaration =
23 | let
24 | infix y =
25 | ()
26 | in
27 | infix
28 |
--------------------------------------------------------------------------------
/Release Notes/0.5.0-alpha.md:
--------------------------------------------------------------------------------
1 | Support for Elm 0.18:
2 | - Added the `--upgrade` option to help migration code from Elm 0.17 to Elm 0.18
3 | - Infix function calls using backticks become normal functions calls
4 | - Infix function calls using backticks with `andThen` and `onError` become pipelines
5 | - Ranges become calls to `List.range`
6 | - Primes in variable names become underscores
7 | - References to `fst` and `snd` become `Tuple.first` and `Tuple.second`
8 |
9 | Bug fixes:
10 | - Type tags starting with `True` and `False` are now handled correctly
11 |
--------------------------------------------------------------------------------
/tests/test-files/transform/Elm-0.19/ListDocumentedExportsNoExposing.formatted.elm:
--------------------------------------------------------------------------------
1 | module ListDocumentedExportsNoExposing exposing
2 | ( a
3 | , X
4 | , Y(..)
5 | , b, c
6 | )
7 |
8 | {-|
9 |
10 | @docs a
11 |
12 |
13 | # Heading
14 |
15 | @docs X
16 | @docs Y
17 | @docs b, c
18 |
19 | -}
20 |
21 |
22 | type alias X =
23 | ()
24 |
25 |
26 | type Y
27 | = Y1
28 | | Y2
29 |
30 |
31 | q =
32 | 4
33 |
34 |
35 | a =
36 | 1
37 |
38 |
39 | b =
40 | 2
41 |
42 |
43 | c =
44 | 3
45 |
46 |
47 | p =
48 | 5
49 |
--------------------------------------------------------------------------------
/Shakefile/package.yaml:
--------------------------------------------------------------------------------
1 | name: build-elm-format
2 | version: 0.0.0
3 | build-type: Simple
4 |
5 | language: Haskell2010
6 |
7 | default-extensions:
8 | - LambdaCase
9 |
10 | ghc-options:
11 | - -rtsopts
12 | - -threaded
13 | - -with-rtsopts=-I0
14 | - -Werror=unused-packages
15 |
16 | dependencies:
17 | aeson: ">= 2.0.0.0"
18 | base: ">= 4.16.2.0"
19 | directory: ">= 1.3.6.2"
20 | shake: ">=0.19.6 && <0.20"
21 | relude: {}
22 | yaml: {}
23 |
24 |
25 | executables:
26 | build-elm-format:
27 | main: Main.hs
28 | source-dirs:
29 | - src
30 |
--------------------------------------------------------------------------------
/nix/tools.nix:
--------------------------------------------------------------------------------
1 | { sources ? import ./sources.nix, compiler }:
2 |
3 | let
4 | haskellToolsOverrides = pkgs: self: super: { };
5 |
6 | haskellToolsPkgs = import sources.nixpkgs {
7 | config = {
8 | packageOverrides = pkgs: {
9 | haskell = pkgs.haskell // {
10 | packages = pkgs.haskell.packages // {
11 | tools = pkgs.haskell.packages."${compiler}".override {
12 | overrides = haskellToolsOverrides pkgs;
13 | };
14 | };
15 | };
16 | };
17 | };
18 | };
19 | in haskellToolsPkgs.haskell.packages.tools
20 |
--------------------------------------------------------------------------------
/elm-format-markdown/tests/Original/Images.markdown:
--------------------------------------------------------------------------------
1 | 
2 |
3 | 
4 |
5 | Inline within a paragraph: [alt text](/url/).
6 |
7 | 
8 |
9 | 
10 |
11 | ![alt text]()
12 |
13 | .
14 |
15 | ![Empty]()
16 |
17 | .jpg)
18 |
19 |
20 | ![alt text][foo]
21 |
22 | [foo]: /url/
23 |
24 | ![alt text][bar]
25 |
26 | [bar]: /url/ "Title here"
--------------------------------------------------------------------------------
/tests/test-files/good/Elm-0.19/GLShader.json-roundtrip:
--------------------------------------------------------------------------------
1 | module AllSyntax.GLShader exposing (vertexShader)
2 |
3 |
4 | vertexShader :
5 | Shader
6 | { coord : Vec3
7 | , position : Vec3
8 | }
9 | { u
10 | | view : Mat4
11 | }
12 | { vcoord : Vec2
13 | }
14 | vertexShader =
15 | [glsl|
16 |
17 | attribute vec3 position;
18 | attribute vec3 coord;
19 | uniform mat4 view;
20 | varying vec2 vcoord;
21 |
22 | void main () {
23 | gl_Position = view * vec4(position, 1.0);
24 | vcoord = coord.xy;
25 | }
26 |
27 | |]
28 |
--------------------------------------------------------------------------------
/Shakefile/src/Shakefiles/Signature.hs:
--------------------------------------------------------------------------------
1 | module Shakefiles.Signature (rules) where
2 |
3 | import Development.Shake
4 | import Development.Shake.Command
5 | import Development.Shake.FilePath
6 | import Development.Shake.Util
7 | import qualified System.Directory
8 |
9 |
10 | rules = do
11 | homeDir <- liftIO System.Directory.getHomeDirectory
12 | let keybaseConfig = homeDir > ".config" > "keybase" > "config.json"
13 |
14 | "//*.asc" %> \out -> do
15 | let src = dropExtension out
16 | need [ src ]
17 | cmd_ "gpg" "--detach-sign" "--armor" "--output" out src
18 |
--------------------------------------------------------------------------------
/tests/test-files/good/Elm-0.19/AllSyntax/InfixDeclaration.elm:
--------------------------------------------------------------------------------
1 | module InfixDeclaration exposing ((<<), (<|), (==))
2 |
3 | -- INFIX OPERATORS
4 |
5 |
6 | infix right 0 (<|) = apL
7 | infix non 4 (==) = eq
8 | infix left 9 (<<) = composeL
9 |
10 |
11 |
12 | -- DEFINITIONS
13 |
14 |
15 | apL f x =
16 | f x
17 |
18 |
19 | eq _ _ =
20 | True
21 |
22 |
23 | composeL g f x =
24 | g (f x)
25 |
26 |
27 |
28 | -- declarations close to "infix" should still parse
29 |
30 |
31 | infi =
32 | ()
33 |
34 |
35 | infiz =
36 | ()
37 |
38 |
39 | infixy right =
40 | right
41 |
--------------------------------------------------------------------------------
/elm-format-markdown/tests/Original/Amps_and_angle_encoding.html:
--------------------------------------------------------------------------------
1 | AT&T has an ampersand in their name.
2 |AT&T is another way to write it.
3 |This & that.
4 |4 < 5.
5 |6 > 5.
6 |Here's a link with an ampersand in the URL.
7 |Here's a link with an amersand in the link text: AT&T.
8 |Here's an inline link.
9 |Here's an inline link.
10 | -------------------------------------------------------------------------------- /parser/bench/src/SmallTupleBench.elm: -------------------------------------------------------------------------------- 1 | module SmallTupleBench where 2 | 3 | type alias SmallTuple = 4 | ( Float 5 | , Float 6 | , Float 7 | , Float 8 | , Float 9 | , Float 10 | , Float 11 | , Float 12 | , Float 13 | ) 14 | 15 | defaultTuple = 16 | (1.0, 2.0, 3.0) 17 | 18 | getField (x1, x2, x3) i = 19 | case (i % 3) of 20 | 1 -> 21 | x1 22 | 2 -> 23 | x2 24 | 0 -> 25 | x3 26 | 27 | 28 | sumRandomElems : List Int -> Float 29 | sumRandomElems randomInts = 30 | List.foldr (\i sumSoFar -> (getField defaultTuple i) + sumSoFar ) 0.0 randomInts -------------------------------------------------------------------------------- /tests/test-files/good/Elm-0.18/AllSyntax/Comments.elm: -------------------------------------------------------------------------------- 1 | module AllSyntax.Comments exposing (blockComment, indentedMultilineBlockComment, multilineCommentTrickDisabled, nestedBlockComment) 2 | 3 | 4 | blockComment = 5 | {- A -} 6 | () 7 | 8 | 9 | nestedBlockComment = 10 | {- A {- {- C -} B {- D -} -} {- E -} -} 11 | () 12 | 13 | 14 | indentedMultilineBlockComment = 15 | {- A 16 | B 17 | C 18 | -} 19 | () 20 | 21 | 22 | {--} 23 | multilineCommentTrickDisabled = 24 | () 25 | --} 26 | 27 | 28 | 29 | {-- 30 | multilineCommentTrickEnabled = 31 | () 32 | --} 33 | -------------------------------------------------------------------------------- /tests/test-files/transform/Elm-0.18/Examples.formatted.elm: -------------------------------------------------------------------------------- 1 | module Main exposing (bar, multilineList, ratio) 2 | 3 | 4 | ratio = 5 | graphHeight 6 | / (if range == 0 then 7 | 0.1 8 | 9 | else 10 | toFloat range 11 | ) 12 | 13 | 14 | 15 | -- foo=(case x of {True->1;False->3}) 16 | 17 | 18 | bar = 19 | if 20 | if a then 21 | True 22 | 23 | else 24 | False 25 | then 26 | "a" 27 | 28 | else 29 | "b" 30 | 31 | 32 | multilineList = 33 | [ 1 34 | , 2 35 | , 3 36 | ] 37 | -------------------------------------------------------------------------------- /avh4-lib/src/Data/Coapplicative.hs: -------------------------------------------------------------------------------- 1 | module Data.Coapplicative (Coapplicative(..)) where 2 | 3 | import Data.Functor.Compose 4 | import Data.Functor.Identity 5 | 6 | 7 | class Functor f => Coapplicative f where 8 | extract :: f a -> a 9 | 10 | instance Coapplicative ((,) x) where 11 | extract (_, a) = a 12 | {-# INLINE extract #-} 13 | 14 | instance Coapplicative Identity where 15 | extract = runIdentity 16 | {-# INLINE extract #-} 17 | 18 | instance (Coapplicative a, Coapplicative b) => Coapplicative (Compose a b) where 19 | extract = extract . extract . getCompose 20 | {-# INLINE extract #-} 21 | -------------------------------------------------------------------------------- /elm-format-markdown/tests/Original/Horizontal_rules.html: -------------------------------------------------------------------------------- 1 |Dashes:
2 |---
7 |
8 | - - -
13 |
14 | Asterisks:
15 |***
20 |
21 | * * *
26 |
27 | Underscores:
28 |___
33 |
34 | _ _ _
39 |
40 |
--------------------------------------------------------------------------------
/elm-format-markdown/tests/Lists/TightLooseBlockquote.html:
--------------------------------------------------------------------------------
1 | 4 |bq
5 |
11 |13 | foobq
12 |
19 |bq
20 |
28 |bq
29 |
Link: http://example.com/.
2 |With an ampersand: http://example.com/?foo=1&bar=2
3 |9 |11 |Blockquoted: http://example.com/
10 |
Auto-links should not occur here: <http://example.com/>
or here: <http://example.com/>
13 |
14 |
--------------------------------------------------------------------------------
/elm-format-markdown/tests/Code/IndentedCodeBlocks.html:
--------------------------------------------------------------------------------
1 | Indented code with two space indent in first and last line:
2 | two spaces *hello*
3 | { more }
4 |
5 | and
6 |
7 | Indented code requires a leading/trailing blank line: 8 | quick-command --option "$*"
9 |Indented code does not require a trailing blank line:
10 |code
11 |
12 | and not code.
13 |Code in blockquote:
14 |15 |18 |17 |code 16 |
Code in list:
19 |code
21 | These are all equivalent:
2 |3 |8 |4 |7 |nested 5 | blockquote
6 |
9 |14 |10 |13 |nested 11 | blockquote
12 |
15 |20 |16 |19 |nested 17 | blockquote
18 |
21 |26 |22 |25 |nested 23 | blockquote
24 |
This is not:
27 |28 |33 | -------------------------------------------------------------------------------- /elm-format-markdown/tests/Original/Horizontal_rules.markdown: -------------------------------------------------------------------------------- 1 | Dashes: 2 | 3 | --- 4 | 5 | --- 6 | 7 | --- 8 | 9 | --- 10 | 11 | --- 12 | 13 | - - - 14 | 15 | - - - 16 | 17 | - - - 18 | 19 | - - - 20 | 21 | - - - 22 | 23 | 24 | Asterisks: 25 | 26 | *** 27 | 28 | *** 29 | 30 | *** 31 | 32 | *** 33 | 34 | *** 35 | 36 | * * * 37 | 38 | * * * 39 | 40 | * * * 41 | 42 | * * * 43 | 44 | * * * 45 | 46 | 47 | Underscores: 48 | 49 | ___ 50 | 51 | ___ 52 | 53 | ___ 54 | 55 | ___ 56 | 57 | ___ 58 | 59 | _ _ _ 60 | 61 | _ _ _ 62 | 63 | _ _ _ 64 | 65 | _ _ _ 66 | 67 | _ _ _ 68 | -------------------------------------------------------------------------------- /tests/test-files/good/Elm-0.19/AllSyntax/Module.json-roundtrip: -------------------------------------------------------------------------------- 1 | module AllSyntax.Module exposing (CustomType(..), a, b, c) 2 | 3 | import Dict as D exposing (Dict, empty, fromList) 4 | import Json.Decode as Json 5 | import Maybe exposing (Maybe(..), map) 6 | import Result exposing (Result(..)) 7 | import Signal exposing (..) 8 | import String 9 | import Task exposing (andMap, andThen, fail, fromMaybe, fromResult, map, map2, map3, map4, map5, mapError, onError, succeed, toMaybe, toResult) 10 | 11 | 12 | type CustomType 13 | = TagA 14 | | TagB 15 | 16 | 17 | a = 18 | 1 19 | 20 | 21 | b = 22 | 2 23 | 24 | 25 | c = 26 | 3 27 | -------------------------------------------------------------------------------- /tests/Test.hs: -------------------------------------------------------------------------------- 1 | module Main where 2 | 3 | import Test.Tasty 4 | import Test.Tasty.Hspec (testSpec) 5 | 6 | import qualified Test.Property 7 | -- import qualified CommonMarkTests 8 | import qualified Integration.CliTest 9 | import qualified Integration.LiteralTest 10 | 11 | 12 | main :: IO () 13 | main = 14 | do 15 | -- markdownTests <- CommonMarkTests.construct 16 | spec <- testSpec "" Integration.CliTest.spec_spec 17 | defaultMain $ testGroup "elm-format" $ 18 | [ Test.Property.propertyTests 19 | , spec 20 | , Integration.LiteralTest.tests 21 | -- , markdownTests 22 | ] 23 | -------------------------------------------------------------------------------- /.github/actions/cache-build/action.yml: -------------------------------------------------------------------------------- 1 | runs: 2 | using: "composite" 3 | steps: 4 | - name: Cache .shake.cache 5 | uses: actions/cache@v3 6 | with: 7 | path: .shake.cache 8 | key: shake-v1-${{ runner.os }}-${{ runner.arch }}-${{ github.run_id }} 9 | restore-keys: | 10 | shake-v1-${{ runner.os }}-${{ runner.arch }}- 11 | - name: Cache dist-newstyle 12 | uses: actions/cache@v3 13 | with: 14 | path: dist-newstyle 15 | key: cabal-dist-v1-${{ runner.os }}-${{ runner.arch }}-${{ github.run_id }} 16 | restore-keys: | 17 | cabal-dist-v1-${{ runner.os }}-${{ runner.arch }}- 18 | -------------------------------------------------------------------------------- /tests/test-files/from-json/Elm-0.19/ModuleComments.json: -------------------------------------------------------------------------------- 1 | { 2 | "moduleName": "ModuleComments", 3 | "body": [ 4 | { 5 | "tag": "Comment", 6 | "text": " Default comment" 7 | }, 8 | { 9 | "tag": "Comment", 10 | "text": "Block comment", 11 | "display": { 12 | "commentType": "BlockComment" 13 | } 14 | }, 15 | { 16 | "tag": "Definition", 17 | "name": "f", 18 | "parameters": [], 19 | "expression": { 20 | "tag": "UnitLiteral" 21 | } 22 | } 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /avh4-lib/src/Data/Either/Extra.hs: -------------------------------------------------------------------------------- 1 | module Data.Either.Extra (collectErrors) where 2 | 3 | import Prelude () 4 | import Relude 5 | 6 | 7 | collectErrors :: [Either l r] -> Either [l] [r] 8 | collectErrors list = 9 | let 10 | step acc next = 11 | case (next, acc) of 12 | (Left l, Right _) -> 13 | Left [l] 14 | 15 | (Left l, Left ls) -> 16 | Left (l : ls) 17 | 18 | (Right r, Right rs) -> 19 | Right (r : rs) 20 | 21 | (Right _, Left ls) -> 22 | Left ls 23 | in 24 | foldl' step (Right []) list 25 | -------------------------------------------------------------------------------- /.gitpod.yml: -------------------------------------------------------------------------------- 1 | 2 | tasks: 3 | - before: | 4 | export GHCUP_INSTALL_BASE_PREFIX=/workspace/.ghcup 5 | export CABAL_DIR=/workspace/.cabal 6 | source "$GHCUP_INSTALL_BASE_PREFIX/.ghcup/env" || true 7 | init: | 8 | curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_MINIMAL=1 sh 9 | source "$GHCUP_INSTALL_BASE_PREFIX/.ghcup/env" 10 | ghcup install ghc 9.6.7 11 | ghcup set ghc 9.6.7 12 | ghcup install cabal 13 | cabal update 14 | ./dev/build.sh 15 | command: ./_build/elm-format 16 | 17 | vscode: 18 | extensions: 19 | - haskell.haskell 20 | -------------------------------------------------------------------------------- /.github/workflows/Touch cache.yml: -------------------------------------------------------------------------------- 1 | name: Touch cache 2 | 3 | on: 4 | schedule: 5 | - cron: "16 11 * * 3,6" 6 | 7 | defaults: 8 | run: 9 | shell: bash 10 | 11 | jobs: 12 | build: 13 | strategy: 14 | matrix: 15 | os: 16 | - ubuntu-latest 17 | - windows-latest 18 | # - macOS-latest 19 | 20 | name: touch-cache-${{ matrix.os }} 21 | runs-on: ${{ matrix.os }} 22 | 23 | steps: 24 | - name: Configure environment 25 | run: | 26 | git config --global core.autocrlf false 27 | - uses: actions/checkout@v3 28 | - uses: ./.github/actions/cache-haskell-deps 29 | - uses: ./.github/actions/cache-build 30 | -------------------------------------------------------------------------------- /elm-format-markdown/tests/Lists/Sublists.html: -------------------------------------------------------------------------------- 1 |nested
29 |30 |32 |blockquote
31 |
Four levels:
2 |Here is a _ that is cool.
2 |Foo.
3 |Foo.
4 |Foo.
5 |Foo.
6 |Foo.
7 |Foo.
8 |Foo. Foo? Foo! Foo: Foo; (Foo)
9 |Foo. Foo? Foo! Foo: Foo; (Foo)
10 |Foo. Foo? Foo! Foo: Foo; (Foo)
11 | -------------------------------------------------------------------------------- /avh4-lib/src/Data/ReversedList.hs: -------------------------------------------------------------------------------- 1 | module Data.ReversedList where 2 | 3 | {-| 4 | ReversedList can be used to avoid accidentally forgetting to reverse a list 5 | (this most commonly occurs when implementing recursive algorithms that build up a 6 | list that needs to be reversed in the termination case). 7 | -} 8 | 9 | newtype Reversed a = Reversed [a] 10 | 11 | 12 | empty :: Reversed a 13 | empty = 14 | Reversed [] 15 | 16 | 17 | push :: a -> Reversed a -> Reversed a 18 | push a (Reversed list) = 19 | Reversed (a : list) 20 | 21 | 22 | isEmpty :: Reversed a -> Bool 23 | isEmpty (Reversed []) = True 24 | isEmpty _ = False 25 | 26 | 27 | toList :: Reversed a -> [a] 28 | toList (Reversed list) = 29 | reverse list 30 | -------------------------------------------------------------------------------- /elm-format-markdown/tests/Original/Links_inline_style.markdown: -------------------------------------------------------------------------------- 1 | Just a [URL](/url/). 2 | 3 | [URL and title](/url/ "title"). 4 | 5 | [URL and title](/url/ "title preceded by two spaces"). 6 | 7 | [URL and title](/url/ "title preceded by a tab"). 8 | 9 | [URL and title](/url/ "title has spaces afterward" ). 10 | 11 | [URL wrapped in angle brackets](). 12 | 13 | [URL w/ angle brackets + title]( "Here's the title"). 14 | 15 | [Empty](). 16 | 17 | [With parens in the URL](http://en.wikipedia.org/wiki/WIMP_(computing)) 18 | 19 | (With outer parens and [parens in url](/foo(bar))) 20 | 21 | 22 | [With parens in the URL](/foo(bar) "and a title") 23 | 24 | (With outer parens and [parens in url](/foo(bar) "and a title")) 25 | -------------------------------------------------------------------------------- /tests/test-files/CommonMark/Makefile: -------------------------------------------------------------------------------- 1 | SITE=_site 2 | SPECVERSION=$(shell perl -ne 'print $$1 if /^version: *([0-9.]+)/' spec.txt) 3 | 4 | .PHONY: all clean npm 5 | 6 | all: spec.html # spec.pdf spec.md 7 | 8 | spec.md: spec.txt tools/template.commonmark 9 | lua tools/make_spec.lua commonmark < $< > $@ 10 | 11 | spec.html: spec.txt tools/template.html 12 | lua tools/make_spec.lua html < $< > $@ 13 | 14 | spec.tex: spec.txt tools/template.latex 15 | lua tools/make_spec.lua latex < $< > $@ 16 | 17 | spec.pdf: spec.tex 18 | xelatex $< 19 | 20 | npm: 21 | # Do a sanity check first on versions 22 | grep -q '"version": *"$(SPECVERSION)' package.json && \ 23 | npm publish 24 | 25 | clean: 26 | -rm spec.tex spec.md spec.html 27 | -------------------------------------------------------------------------------- /tests/test-files/from-json/Elm-0.19/Patterns.elm: -------------------------------------------------------------------------------- 1 | module Patterns exposing (alias, closedList, data, emptyList, emptyRecord, literals, openList, record, tuple, unit, variables, wildcard) 2 | 3 | 4 | wildcard _ = 5 | () 6 | 7 | 8 | literals 1 2.0 "string" 'c' = 9 | () 10 | 11 | 12 | variables x = 13 | () 14 | 15 | 16 | data (Foo _ _) (Maybe.Just _ _) = 17 | () 18 | 19 | 20 | unit () = 21 | () 22 | 23 | 24 | tuple ( _, _ ) = 25 | () 26 | 27 | 28 | emptyList [] = 29 | () 30 | 31 | 32 | closedList [ _, _ ] = 33 | () 34 | 35 | 36 | openList (_ :: _ :: _) = 37 | () 38 | 39 | 40 | emptyRecord {} = 41 | () 42 | 43 | 44 | record { x, y } = 45 | () 46 | 47 | 48 | alias (_ as x) = 49 | () 50 | -------------------------------------------------------------------------------- /Style Guide/Sections.md: -------------------------------------------------------------------------------- 1 | # Sections and grouping 2 | 3 | Comments (`--`, `{- -}`) can be used to create sections within your code. 4 | 5 | 6 | ## Top-level sections 7 | 8 | ```elm 9 | x = 10 | () 11 | 12 | 13 | 14 | -- This comment introduces a new section 15 | 16 | 17 | a = 18 | () 19 | ``` 20 | 21 | 22 | ## Data structure sections 23 | 24 | ### List expressions 25 | 26 | ```elm 27 | x = 28 | [ 1 29 | , 2 30 | 31 | -- This comment introduces a section in the list 32 | , 3 33 | , 4 34 | ] 35 | ``` 36 | 37 | ### Record expressions 38 | 39 | ```elm 40 | x = 41 | { x = 1 42 | , y = 2 43 | 44 | -- This comment introduces a section in the record 45 | , a = 3 46 | , b = 4 47 | } 48 | ``` 49 | -------------------------------------------------------------------------------- /elm-format-markdown/tests/Original/Images.html: -------------------------------------------------------------------------------- 1 |

Inline within a paragraph: alt text.
4 |.
.jpg)
One blockquote, two paragraphs:
2 |3 |6 |one
4 |two
5 |
Two blockquotes:
7 |8 |10 |one
9 |
11 |13 |two
12 |
Nested blockquote, two paragraphs:
14 |15 |20 |16 |19 |one
17 |two
18 |
Nested blockquote, two blockquotes:
21 |22 |29 |23 |25 |one
24 |26 |28 |two
27 |
Two nested blockquotes:
30 |31 |35 |32 |34 |one
33 |
36 |40 | -------------------------------------------------------------------------------- /elm-format-markdown/tests/Lists/TightAndLoose.html: -------------------------------------------------------------------------------- 1 |37 |39 |two
38 |
loose
list
loose
list
loose
22 |35 |38 |blockquote 36 | and
37 |
code
39 | loose
44 |with loose
sublist
loose
First Item
3 |one
5 |one
9 |Second Item
14 |Third Item
29 |Fourth Item
44 |This is a fenced code block:
2 |pairs :: [(Int,Char)]
3 | pairs = [(x,y) | x <- [0..10], y <- ['a'..'z']]
4 |
5 | Here is one with tildes:
6 |pairs :: [(Int,Char)]
7 | pairs = [(x,y) | x <- [0..10], y <- ['a'..'z']]
8 |
9 | More metadata:
10 |pairs :: [(Int,Char)]
11 | pairs = [(x,y) | x <- [0..10], y <- ['a'..'z']]
12 |
13 | More backticks:
14 |pairs :: [(Int,Char)]
15 | pairs = [(x,y) | x <- [0..10], y <- ['a'..'z']]
16 |
17 | backticks :: String
18 | backticks = "`````"
19 |
20 | Without an end:
21 |code with
22 | no end
23 |
24 |
25 |
--------------------------------------------------------------------------------
/elm-format-markdown/tests/Original/Links_inline_style.html:
--------------------------------------------------------------------------------
1 | Just a URL.
2 | 3 | 4 | 5 | 6 |URL wrapped in angle brackets.
7 |URL w/ angle brackets + title.
8 | 9 | 10 |(With outer parens and parens in url)
11 | 12 |(With outer parens and parens in url)
13 | -------------------------------------------------------------------------------- /elm-format-lib/src/Parse/State.hs: -------------------------------------------------------------------------------- 1 | module Parse.State where 2 | 3 | 4 | data State = State 5 | { newline :: [Bool] 6 | } 7 | 8 | 9 | init :: State 10 | init = 11 | State 12 | { newline = [False] 13 | } 14 | 15 | 16 | setNewline :: State -> State 17 | setNewline state = 18 | case newline state of 19 | [] -> state 20 | (_:rest) -> state { newline = (True:rest) } 21 | 22 | 23 | pushNewlineContext :: State -> State 24 | pushNewlineContext state = 25 | state { newline = (False:(newline state)) } 26 | 27 | 28 | popNewlineContext :: State -> State 29 | popNewlineContext state = 30 | case newline state of 31 | [] -> state 32 | (_:[]) -> state 33 | (last:next:rest) -> state { newline = (last || next):rest } 34 | 35 | 36 | sawNewline :: State -> Bool 37 | sawNewline state = 38 | case newline state of 39 | [] -> False 40 | (b:_) -> b 41 | -------------------------------------------------------------------------------- /tests/test-files/transform/Elm-0.18/Sorting.elm: -------------------------------------------------------------------------------- 1 | module Sorting exposing (x) 2 | 3 | import ConstructorTagsAreDeduplicated exposing(A(X, X, X)) 4 | import ConstructorTagsAreMerged exposing (A(X, Y), B(A), B(..), A(C, D), C, C(..)) 5 | import ConstructorTagsAreSorted exposing (A(Y, Z, X, Yy, XYzZY)) 6 | import ExposedValuesAreDeduplicated exposing (x, (==/==), x, (==/==), Z, Z(..)) 7 | import ExposedValuesAreSorted exposing (x, (<>), a, (==/==), Y, Z(..)) 8 | import ImportsAreMerged exposing (A(X), b) 9 | import ImportsAreMerged exposing (A(Y), z) 10 | import ImportsAreMerged2 11 | import ImportsAreMerged2 exposing (..) 12 | import ImportsAreMerged3 exposing (x) 13 | import ImportsAreMerged3 exposing (..) 14 | import ImportsWithConflictingAs as Overridden 15 | import ImportsWithConflictingAs as Correct 16 | import ImportsWithConflictingAs2 17 | import ImportsWithConflictingAs2 as Correct 18 | 19 | 20 | x = 21 | () 22 | -------------------------------------------------------------------------------- /elm-format-markdown/tests/Emphasis/Pathological.html: -------------------------------------------------------------------------------- 1 |This input can take a long time to parse in some implementations.
2 |a 3 | a 4 | a 5 | a 6 | a 7 | a 8 | a 9 | a 10 | a 11 | a 12 | a 13 | a 14 | a 15 | a 16 | a 17 | a 18 | a 19 | a 20 | a 21 | a 22 | *a 23 | aaaaa
24 |*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**a*a**
25 | -------------------------------------------------------------------------------- /tests/test-files/good/Elm-0.19/AllSyntax/Module.elm: -------------------------------------------------------------------------------- 1 | module AllSyntax.Module exposing (CustomType(..), a, b, c) 2 | 3 | import Dict as D 4 | exposing 5 | ( Dict 6 | , empty 7 | , fromList 8 | ) 9 | import Json.Decode as Json 10 | import Maybe exposing (Maybe(..), map) 11 | import Result exposing (Result(..)) 12 | import Signal exposing (..) 13 | import String 14 | import Task 15 | exposing 16 | ( andMap 17 | , andThen 18 | , fail 19 | , fromMaybe 20 | , fromResult 21 | , map 22 | , map2 23 | , map3 24 | , map4 25 | , map5 26 | , mapError 27 | , onError 28 | , succeed 29 | , toMaybe 30 | , toResult 31 | ) 32 | 33 | 34 | type CustomType 35 | = TagA 36 | | TagB 37 | 38 | 39 | a = 40 | 1 41 | 42 | 43 | b = 44 | 2 45 | 46 | 47 | c = 48 | 3 49 | -------------------------------------------------------------------------------- /elm-format-markdown/tests/Original/Inline_HTML_Simple.markdown: -------------------------------------------------------------------------------- 1 | Here's a simple block: 2 | 3 |Here's a simple block:
2 |This should be a code block, though:
6 |<div>
7 | foo
8 | </div>
9 |
10 | As should this:
11 |<div>foo</div>
12 |
13 | Now, nested:
14 |This should just be an HTML comment:
22 | 23 |Multiline:
24 | 28 |Code block:
29 |<!-- Comment -->
30 |
31 | Just plain comment, with trailing spaces on the line:
32 | 33 |Code:
34 |<hr />
35 |
36 | Hr's:
37 |Foo bar.
2 |Foo bar.
3 |Foo bar.
4 |With embedded [brackets].
5 |Indented once.
6 |Indented twice.
7 |Indented thrice.
8 |Indented [four][] times.
9 |[four]: /url
10 |
11 | this should work
13 |So should this.
14 |And this.
15 |And this.
16 |And this.
17 |But not [that] [].
18 |Nor [that][].
19 |Nor [that].
20 |[Something in brackets like this should work]
21 |[Same with this.]
22 |In this case, this points to something else.
23 |Backslashing should suppress [this] and [this].
24 |Here's one where the link 26 | breaks across lines.
27 |Here's another where the link 28 | breaks across lines, but with a line-ending space.
29 | -------------------------------------------------------------------------------- /tests/test-files/transform/Elm-0.18/UnnecessaryParens.formatted.elm: -------------------------------------------------------------------------------- 1 | module UnnecessaryParens exposing (unnecessaryParens) 2 | 3 | 4 | unnecessaryParens = 5 | ( "a" ++ f x y ++ "b" 6 | , f x y 7 | , x 8 | , [ 1, 2 ] 9 | , 1 + (x + 1) 10 | , { blah = foo << bar 11 | , stuff = 12 | if conditional then 13 | something 14 | 15 | else 16 | somethingElse 17 | , thing = doSomething (func arg) 18 | } 19 | , if x then 20 | something 21 | 22 | else 23 | somethingElse 24 | , case foo of 25 | () -> 26 | () 27 | , r.f1.f2.f3.f4 28 | , test "test" <| 29 | \() -> 30 | 1 |> Expect.equal 1 31 | ) 32 | 33 | 34 | allowedParens = 35 | ( (x + 1) + (y - 1) 36 | , () 37 | ) 38 | 39 | 40 | requiredParens = 41 | ( (maybeF |> Maybe.withDefault identity) 1 42 | , Ok <| ([ 1, 2, 3 ] |> List.tail) 43 | , () 44 | ) 45 | 46 | 47 | requiredParensForTrailingCommentsInBinopsContext = 48 | () 49 | |> (\() -> 50 | () 51 | -- comment stay here 52 | ) 53 | 54 | 55 | requiredParensForTrailingCommentsInDefBodyContext = 56 | (8 57 | -- comment stay here 58 | ) 59 | --------------------------------------------------------------------------------