Skip to content

Upgraded Elm to 0.18 #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Main.elm
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
port module Main exposing (..)

import Dict exposing (Dict)
import Html.App
import Html
import Import exposing (Import)
import Module exposing (Module)


main =
Html.App.programWithFlags
Html.programWithFlags
{ init = init
, update = update
, subscriptions = subscriptions
Expand Down
6 changes: 3 additions & 3 deletions elm-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
],
"exposed-modules": [],
"dependencies": {
"elm-lang/core": "4.0.5 <= v < 5.0.0",
"elm-lang/html": "1.1.0 <= v < 2.0.0"
"elm-lang/core": "5.0.0 <= v < 6.0.0",
"elm-lang/html": "2.0.0 <= v < 3.0.0"
},
"elm-version": "0.17.1 <= v < 0.18.0"
"elm-version": "0.18.0 <= v < 0.19.0"
}
4 changes: 2 additions & 2 deletions src/Declaration.elm
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ parse source =

process match =
case match of
name :: exports :: exports' :: comment :: [] ->
name :: exports :: exports_ :: comment :: [] ->
( Maybe.withDefault "" name
, Export.parse (Maybe.withDefault "" (Maybe.map2 (++) exports exports'))
, Export.parse (Maybe.withDefault "" (Maybe.map2 (++) exports exports_))
, Maybe.withDefault "" comment
)

Expand Down
20 changes: 10 additions & 10 deletions src/Export.elm
Original file line number Diff line number Diff line change
Expand Up @@ -71,31 +71,31 @@ parse source =
AllExport
else
let
match source' =
List.map .submatches (find All pattern source')
match source_ =
List.map .submatches (find All pattern source_)

process exports =
case exports of
name :: types :: binop :: [] ->
let
name' =
name_ =
Maybe.withDefault "" name

types' =
types_ =
Maybe.withDefault [] (split types)

binop' =
binop_ =
Maybe.map FunctionExport binop
in
case binop of
Just binop' ->
FunctionExport binop'
Just binop_ ->
FunctionExport binop_

Nothing ->
if isUpcase name' then
TypeExport name' (toCase types')
if isUpcase name_ then
TypeExport name_ (toCase types_)
else
FunctionExport name'
FunctionExport name_

_ ->
Debug.crash "Shouldn't have gotten here processing exports."
Expand Down
10 changes: 5 additions & 5 deletions src/Import.elm
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ defaultImports =
database : List Import -> Dict String Import
database imports =
let
imports' =
List.map (\import' -> ( import'.name, import' )) imports
imports_ =
List.map (\import_ -> ( import_.name, import_ )) imports
in
Dict.union (Dict.fromList imports') defaultImports
Dict.union (Dict.fromList imports_) defaultImports


pattern : Regex
Expand All @@ -66,11 +66,11 @@ parse source =

process match =
case match of
name :: alias :: exports :: exports' :: [] ->
name :: alias :: exports :: exports_ :: [] ->
Import
(Maybe.withDefault "" name)
alias
(Export.parse (Maybe.withDefault "" (Maybe.map2 (++) exports exports')))
(Export.parse (Maybe.withDefault "" (Maybe.map2 (++) exports exports_)))

_ ->
Debug.crash "Shouldn't have gotten here processing imports."
Expand Down
6 changes: 3 additions & 3 deletions tests/Declarations.elm
Original file line number Diff line number Diff line change
Expand Up @@ -134,21 +134,21 @@ effectExposingOne =

effectExposingMany : Test
effectExposingMany =
testEq "plain exposing many"
testEq "effect exposing many"
(Declaration.parse "effect module Test where { command = MyCmd } exposing (a, b)")
(Declaration "Test" (SubsetExport [ FunctionExport "a", FunctionExport "b" ]) "")


effectExposingManyMultiline : Test
effectExposingManyMultiline =
testEq "plain exposing many multiline"
testEq "effect exposing many multiline"
(Declaration.parse "port module Test where { command = MyCmd } exposing\n ( a\n , b\n )\n")
(Declaration "Test" (SubsetExport [ FunctionExport "a", FunctionExport "b" ]) "")


all : Test
all =
describe "Declarations"
describe "Declarations tests"
[ plain
, plainExposingAll
, plainExposingBinop
Expand Down
4 changes: 2 additions & 2 deletions tests/Helper.elm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import Expect


testEq : String -> a -> a -> Test
testEq name a a' =
testEq name a a_ =
test name <|
\() -> Expect.equal a a'
\() -> Expect.equal a a_
4 changes: 2 additions & 2 deletions tests/Imports.elm
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ plainExposingTypeAll =

plainExposingTypeOne : Test
plainExposingTypeOne =
testEq "plain exposing type all"
testEq "plain exposing type one"
(Import.parse "import Test exposing (A(B))")
([ Import "Test" Nothing (SubsetExport [ TypeExport "A" (SomeCase [ "B" ]) ]) ])

Expand Down Expand Up @@ -120,7 +120,7 @@ asExposingManyMultiline =

all : Test
all =
describe "Imports"
describe "Imports tests"
[ plain
, plainExposingAll
, plainExposingBinop
Expand Down
11 changes: 2 additions & 9 deletions tests/Main.elm
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
port module Main exposing (..)

import Test exposing (..)
import Test.Runner.Node exposing (run)
import Json.Encode exposing (Value)
import Declarations
import Imports


main : Program Value
main =
run emit all


all : Test
all =
describe "Test Suite"
describe "Test suite"
[ Declarations.all
, Imports.all
]


port emit : ( String, Value ) -> Cmd msg
7 changes: 3 additions & 4 deletions tests/elm-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
],
"exposed-modules": [],
"dependencies": {
"elm-lang/core": "4.0.0 <= v < 5.0.0",
"elm-community/elm-test": "2.0.0 <= v < 3.0.0",
"rtfeldman/node-test-runner": "2.0.0 <= v < 3.0.0"
"elm-community/elm-test": "4.0.0 <= v < 5.0.0",
"elm-lang/core": "5.0.0 <= v < 6.0.0"
},
"elm-version": "0.17.0 <= v < 0.18.0"
"elm-version": "0.18.0 <= v < 0.19.0"
}