Skip to content

Commit

Permalink
Fix: installation files for elm 0.19.1
Browse files Browse the repository at this point in the history
Fix: minor issues to enable compatibility with elm 0.19.1

Fix: further update to 0.19.1
  • Loading branch information
benkoshy committed Dec 18, 2019
1 parent 159aff0 commit 3ee88a1
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 31 deletions.
15 changes: 0 additions & 15 deletions elm-package.json

This file was deleted.

25 changes: 25 additions & 0 deletions elm.json
@@ -0,0 +1,25 @@
{
"type": "application",
"source-directories": [
"src"
],
"elm-version": "0.19.1",
"dependencies": {
"direct": {
"elm/browser": "1.0.2",
"elm/core": "1.0.3",
"elm/html": "1.0.0",
"elm/json": "1.1.3",
"elm/random": "1.0.0",
"elm/time": "1.0.0"
},
"indirect": {
"elm/url": "1.0.0",
"elm/virtual-dom": "1.0.2"
}
},
"test-dependencies": {
"direct": {},
"indirect": {}
}
}
4 changes: 2 additions & 2 deletions src/Bitmap.elm
Expand Up @@ -2,7 +2,7 @@ module Bitmap exposing (..)

import Element exposing (Element, px, styled)
import GameMode exposing (GameMode)
import Grid exposing (Cell, CellState(Exposed, Flagged))
import Grid exposing (Cell, CellState(..))
import Html exposing (div)


Expand Down Expand Up @@ -43,7 +43,7 @@ forInt n =
( -117, 0 )

_ ->
Debug.crash ""
Debug.todo "Oops! Something went wrong. Don't worry, a team of (one) highly trained monkey will is trying to work out what went wrong."
else
( 0, 0 )
in
Expand Down
4 changes: 3 additions & 1 deletion src/Element.elm
Expand Up @@ -2,6 +2,8 @@ module Element exposing (..)

import Html exposing (Attribute, Html)
import Html.Attributes exposing (style)
import Debug exposing (toString)



type alias Element msg =
Expand All @@ -11,7 +13,7 @@ type alias Element msg =
styled : Element msg -> List ( String, String ) -> Element msg
styled el css =
\attrs children ->
el ([ style css ] ++ attrs) children
el (List.map (\( k, v ) -> style k v) css ++ attrs) children


px : Int -> String
Expand Down
12 changes: 6 additions & 6 deletions src/Grid.elm
Expand Up @@ -41,16 +41,16 @@ withBombPairs pairs grid =
let
head =
case List.head pairs of
Just head ->
head
Just firstElement ->
firstElement

Nothing ->
( -1, -1 )

tail =
case List.tail pairs of
Just tail ->
tail
Just lastElement ->
lastElement

Nothing ->
[]
Expand All @@ -74,8 +74,8 @@ gridToCells grid =


filter : (Cell -> Bool) -> Grid -> List Cell
filter filter grid =
gridToCells grid |> List.filter filter
filter filterVariable grid =
gridToCells grid |> List.filter filterVariable


findCell : (Cell -> Bool) -> Grid -> Cell
Expand Down
14 changes: 7 additions & 7 deletions src/Main.elm
Expand Up @@ -4,13 +4,13 @@ import Array exposing (Array)
import Bitmap as Bitmap exposing (Face(..))
import Element exposing (Element, px, styled)
import GameMode exposing (GameMode(..))
import Grid exposing (Cell, CellState(Exposed, Flagged, Initial), Column, Grid)
import Grid exposing (Cell, CellState(..), Column, Grid)
import Html exposing (Html, div, p, text)
import Html.Attributes exposing (style)
import Html.Events exposing (onClick, onMouseDown, onMouseEnter, onMouseLeave, onMouseOut, onMouseUp, onWithOptions)
import Html.Events exposing (onClick, onMouseDown, onMouseEnter, onMouseLeave, onMouseOut, onMouseUp, custom)
import Json.Decode as Json
import Random exposing (Seed)
import Time exposing (Time, second)
import Time exposing (Posix, toSecond)


main : Program Never Model Msg
Expand Down Expand Up @@ -96,7 +96,7 @@ type Msg
| RightClick Cell
| PressingFace Bool
| ClickFace
| TimeSecond Time
| TimeSecond Time.Posix
| ArmRandomCells (List Int)
| ClearActiveCell

Expand Down Expand Up @@ -196,7 +196,7 @@ update msg model =
cell

Nothing ->
Debug.crash "nah"
Debug.log "nah"
)
randoms

Expand Down Expand Up @@ -254,7 +254,7 @@ subscriptions : Model -> Sub Msg
subscriptions model =
case model.mode of
Play ->
Time.every Time.second TimeSecond
Time.every Time.toSecond TimeSecond

_ ->
Sub.none
Expand Down Expand Up @@ -525,7 +525,7 @@ viewCell size downOnHover grid mode cell =

onRightClick : msg -> Html.Attribute msg
onRightClick message =
onWithOptions "contextmenu"
custom "contextmenu"
{ preventDefault = True, stopPropagation = False }
(Json.succeed message)

Expand Down

0 comments on commit 3ee88a1

Please sign in to comment.