├── .gitignore ├── naming ├── exposed-unknown.elm ├── qualified-unknown.elm ├── unknown-qualifier.elm └── ambiguous.elm ├── types ├── argument-1-of-1.elm ├── argument-1-of-1-number.elm ├── argument-too-many.elm ├── binop-right-truthy.elm ├── argument-too-few.elm ├── submismatch-list.elm ├── submismatch-tuple.elm ├── argument-1-of-2-comparable.elm ├── type-annotation-rigid.elm ├── if.elm ├── submismatch-record.elm ├── record-missing-field.elm ├── case-2.elm ├── if-condition.elm ├── if-multi.elm ├── binop-string-append.elm ├── c-style-args.elm ├── submismatch-task-error.elm ├── case-3.elm ├── type-annotation-rigid-supers.elm ├── type-annotation-nesting.elm └── submismatch-record-nested.elm ├── canonicalize ├── alias-recursive.elm └── alias-mutually-recursive.elm ├── elm-package.json ├── README.md └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | elm-stuff -------------------------------------------------------------------------------- /naming/exposed-unknown.elm: -------------------------------------------------------------------------------- 1 | 2 | foo = map -------------------------------------------------------------------------------- /naming/qualified-unknown.elm: -------------------------------------------------------------------------------- 1 | 2 | foo = List.nap -------------------------------------------------------------------------------- /naming/unknown-qualifier.elm: -------------------------------------------------------------------------------- 1 | 2 | foo = 3 | Dict.filter -------------------------------------------------------------------------------- /types/argument-1-of-1.elm: -------------------------------------------------------------------------------- 1 | 2 | 3 | foo = 4 | not "hello" -------------------------------------------------------------------------------- /types/argument-1-of-1-number.elm: -------------------------------------------------------------------------------- 1 | 2 | 3 | foo = 4 | not 42 -------------------------------------------------------------------------------- /types/argument-too-many.elm: -------------------------------------------------------------------------------- 1 | 2 | foo = 3 | not True "Hats" -------------------------------------------------------------------------------- /types/binop-right-truthy.elm: -------------------------------------------------------------------------------- 1 | 2 | foo = 3 | True || "false" -------------------------------------------------------------------------------- /types/argument-too-few.elm: -------------------------------------------------------------------------------- 1 | 2 | 3 | foo = 4 | not || False 5 | -------------------------------------------------------------------------------- /types/submismatch-list.elm: -------------------------------------------------------------------------------- 1 | 2 | 3 | subMismatch = 4 | ["Alice"] == [True] -------------------------------------------------------------------------------- /types/submismatch-tuple.elm: -------------------------------------------------------------------------------- 1 | 2 | 3 | subMismatch = 4 | ("Alice", 24) == ("Bob", Nothing) -------------------------------------------------------------------------------- /types/argument-1-of-2-comparable.elm: -------------------------------------------------------------------------------- 1 | 2 | foo = 3 | compare { name = "Alice" } { name = "Bob" } -------------------------------------------------------------------------------- /types/type-annotation-rigid.elm: -------------------------------------------------------------------------------- 1 | 2 | addPair : (a, a) -> a 3 | addPair (x, y) = 4 | x + y 5 | -------------------------------------------------------------------------------- /naming/ambiguous.elm: -------------------------------------------------------------------------------- 1 | 2 | import Dict exposing (map) 3 | import List exposing (map) 4 | 5 | 6 | foo = map -------------------------------------------------------------------------------- /types/if.elm: -------------------------------------------------------------------------------- 1 | 2 | messedUpIf = 3 | if True then 4 | "fish" 5 | 6 | else 7 | 3.1415 8 | -------------------------------------------------------------------------------- /types/submismatch-record.elm: -------------------------------------------------------------------------------- 1 | 2 | 3 | subMismatch = 4 | { name = "Alice", age = 24 } == { name = "Bob", age = Nothing } -------------------------------------------------------------------------------- /types/record-missing-field.elm: -------------------------------------------------------------------------------- 1 | 2 | person = 3 | { first = "Evan" 4 | , last = "Czaplicki" 5 | } 6 | 7 | 8 | age = person.age 9 | -------------------------------------------------------------------------------- /types/case-2.elm: -------------------------------------------------------------------------------- 1 | 2 | mixedUpCaseBranches = 3 | case Just 42 of 4 | Nothing -> 5 | "hello" 6 | 7 | Just n -> 8 | n -------------------------------------------------------------------------------- /types/if-condition.elm: -------------------------------------------------------------------------------- 1 | 2 | badCondition = 3 | if List.length [0,4,1] then 4 | "has stuff in it" 5 | 6 | else 7 | "has no stuff" 8 | -------------------------------------------------------------------------------- /canonicalize/alias-recursive.elm: -------------------------------------------------------------------------------- 1 | type alias Comment = 2 | { message : String 3 | , upvotes : Int 4 | , downvotes : Int 5 | , responses : List Comment 6 | } -------------------------------------------------------------------------------- /types/if-multi.elm: -------------------------------------------------------------------------------- 1 | 2 | messedUpIf n = 3 | if n < 0 then 4 | "negative" 5 | 6 | else if n > 0 then 7 | "positive" 8 | 9 | else 10 | 3.1415 11 | -------------------------------------------------------------------------------- /types/binop-string-append.elm: -------------------------------------------------------------------------------- 1 | -- inspired by https://github.com/elm-lang/error-message-catalog/issues/38 2 | -- which requested a hint when you try to use (+) to append strings. 3 | 4 | foo repo = 5 | "Name: " + repo.name -------------------------------------------------------------------------------- /types/c-style-args.elm: -------------------------------------------------------------------------------- 1 | 2 | 3 | iterate n f x = 4 | if n == 0 then 5 | x 6 | 7 | else 8 | iterate(n - 1, f ,f(x)) 9 | 10 | 11 | square x = 12 | x * x 13 | 14 | 15 | foo = 16 | iterate 1 square 3 -------------------------------------------------------------------------------- /types/submismatch-task-error.elm: -------------------------------------------------------------------------------- 1 | import Task 2 | 3 | 4 | floatFail = 5 | Task.fail 42.0 6 | 7 | 8 | stringFail = 9 | Task.fail "something bad happened" 10 | 11 | 12 | failSequence = 13 | floatFail `Task.andThen` (\_ -> stringFail) -------------------------------------------------------------------------------- /types/case-3.elm: -------------------------------------------------------------------------------- 1 | 2 | type Primary 3 | = Red 4 | | Green 5 | | Blue 6 | 7 | 8 | mixedUpCaseBranches primary = 9 | case primary of 10 | Red -> 11 | "red" 12 | 13 | Green -> 14 | "green" 15 | 16 | Blue -> 17 | False -------------------------------------------------------------------------------- /types/type-annotation-rigid-supers.elm: -------------------------------------------------------------------------------- 1 | -- https://github.com/elm-lang/elm-compiler/issues/821 2 | 3 | comparePair : comparable -> comparable -> comparable1 -> comparable2 -> Bool 4 | comparePair a b x y = 5 | a < b || x < y 6 | 7 | 8 | usage = 9 | comparePair 1 2 "hi" "blah" -------------------------------------------------------------------------------- /types/type-annotation-nesting.elm: -------------------------------------------------------------------------------- 1 | 2 | filter : (a -> Bool) -> List a -> List a 3 | filter isOkay list = 4 | let 5 | keepIfOkay : a -> Maybe a 6 | keepIfOkay x = 7 | if isOkay x then Just x else Nothing 8 | in 9 | List.filterMap keepIfOkay list 10 | 11 | -------------------------------------------------------------------------------- /canonicalize/alias-mutually-recursive.elm: -------------------------------------------------------------------------------- 1 | type alias Comment = 2 | { message : String 3 | , upvotes : Int 4 | , downvotes : Int 5 | , responses : Responses 6 | } 7 | 8 | type alias Responses = 9 | { sortBy : SortBy 10 | , responses : List Comment 11 | } 12 | 13 | type SortBy = Time | Score | MostResponses -------------------------------------------------------------------------------- /types/submismatch-record-nested.elm: -------------------------------------------------------------------------------- 1 | 2 | alice = 3 | { name = "Alice" 4 | , age = 25 5 | , position = 6 | { x = 0.0 7 | , y = 8.0 8 | } 9 | } 10 | 11 | 12 | bob = 13 | { name = "Bob" 14 | , age = 23 15 | , position = 16 | { x = 9.0 17 | , y = "-3.0" 18 | } 19 | } 20 | 21 | 22 | subMismatch = 23 | alice == bob -------------------------------------------------------------------------------- /elm-package.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.0.0", 3 | "summary": "Broken Elm programs to help evaluate and improve error qualitiy", 4 | "repository": "https://github.com/evancz/error-message-catalog.git", 5 | "license": "BSD3", 6 | "source-directories": [ 7 | "." 8 | ], 9 | "exposed-modules": [], 10 | "dependencies": { 11 | "elm-lang/core": "3.0.0 <= v < 4.0.0" 12 | }, 13 | "elm-version": "0.16.0 <= v < 0.17.0" 14 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Error Message Catalog 2 | 3 | A set of Elm programs to trigger every possible error message. 4 | 5 | Once we build a fairly complete set of error messages, we can use them to start improving error message quality overall. Maybe there will be some interesting patterns. Maybe we will find some easy fixes. Maybe we will find terrible messages that every beginner is guaranteed to run into! 6 | 7 | This project will give us the data to evaluate and improve these things! -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, Evan Czaplicki 2 | 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 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. 15 | 16 | * Neither the name of Evan Czaplicki nor the names of other 17 | contributors may be used to endorse or promote products derived 18 | from this software without specific prior written permission. 19 | 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. 31 | --------------------------------------------------------------------------------