Skip to content

Commit

Permalink
Update for Elm 0.18
Browse files Browse the repository at this point in the history
  • Loading branch information
hoelzro committed Nov 17, 2016
1 parent 1742707 commit d598084
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
5 changes: 2 additions & 3 deletions Main.elm
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Html exposing (Html)
import Html.App as App
import Keyboard
import Random
import Time exposing (Time)
Expand Down Expand Up @@ -89,8 +88,8 @@ subscriptions _ =
inputChars = Keyboard.presses (Keypress << qwerty2jcuken)
in Sub.batch [ clock, inputChars ]

main : Program Never
main = App.program {
main : Program Never Model Message
main = Html.program {
init = init,
update = update,
subscriptions = subscriptions,
Expand Down
4 changes: 2 additions & 2 deletions Tutor/Card.elm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ isPrefixOf = flip String.startsWith

renderTyped : String -> String -> Html a
renderTyped expected got =
if expected `isPrefixOf` got
if isPrefixOf expected got
then text got
else span [] [ (text <| String.dropRight 1 got),
span [style [("color", "red")]] [ text <| String.right 1 got ] ]
Expand Down Expand Up @@ -41,7 +41,7 @@ cardState : Card -> CardState
cardState (Card target typed) =
if target == typed
then Complete
else if target `isPrefixOf` typed
else if isPrefixOf target typed
then Incomplete
else Incorrect

Expand Down
6 changes: 3 additions & 3 deletions Tutor/Utils.elm
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ last = unsafeFromJust << List.head << List.reverse
selectValue : List (Float, a) -> Float -> a
selectValue pairs selector =
let lowerThanSelector = List.filter (\(p, _) -> p <= selector) pairs
in snd <| last lowerThanSelector
in Tuple.second <| last lowerThanSelector

weightedChoice : List (Float, a) -> Random.Generator a
weightedChoice possibilities =
Expand All @@ -47,5 +47,5 @@ randomMember values =

randomNgram : List (Int, List (Float, String)) -> Random.Generator String
randomNgram ngrams =
let randomNgramSet = randomMember <| List.map snd ngrams
in randomNgramSet `Random.andThen` weightedChoice
let randomNgramSet = randomMember <| List.map Tuple.second ngrams
in Random.andThen weightedChoice randomNgramSet
10 changes: 5 additions & 5 deletions elm-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
],
"exposed-modules": [],
"dependencies": {
"elm-lang/core": "4.0.0 <= v < 5.0.0",
"elm-lang/html": "1.0.0 <= v < 2.0.0",
"elm-lang/keyboard": "1.0.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-lang/keyboard": "1.0.1 <= v < 2.0.0"
},
"elm-version": "0.17.0 <= v < 0.18.0"
}
"elm-version": "0.18.0 <= v < 0.19.0"
}

0 comments on commit d598084

Please sign in to comment.