aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/Utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/elm/Utils')
-rw-r--r--src/client/elm/Utils/Cmd.elm18
-rw-r--r--src/client/elm/Utils/Date.elm4
-rw-r--r--src/client/elm/Utils/Dict.elm4
-rw-r--r--src/client/elm/Utils/Effects.elm10
-rw-r--r--src/client/elm/Utils/Either.elm4
-rw-r--r--src/client/elm/Utils/Http.elm4
-rw-r--r--src/client/elm/Utils/List.elm4
-rw-r--r--src/client/elm/Utils/Maybe.elm4
-rw-r--r--src/client/elm/Utils/Tuple.elm4
9 files changed, 32 insertions, 24 deletions
diff --git a/src/client/elm/Utils/Cmd.elm b/src/client/elm/Utils/Cmd.elm
new file mode 100644
index 0000000..1eee6f3
--- /dev/null
+++ b/src/client/elm/Utils/Cmd.elm
@@ -0,0 +1,18 @@
+module Utils.Cmd exposing
+ ( pipeUpdate
+ , (:>)
+ )
+
+import Platform.Cmd as Cmd
+
+pipeUpdate : (model, Cmd msg) -> (model -> (model, Cmd msg)) -> (model, Cmd msg)
+pipeUpdate (model, cmd) f =
+ let
+ (model', cmd') = f model
+ in
+ (model', Cmd.batch [ cmd, cmd' ])
+
+(:>) : (m, Cmd a) -> (m -> (m, Cmd a)) -> (m, Cmd a)
+(:>) = pipeUpdate
+
+infixl 0 :>
diff --git a/src/client/elm/Utils/Date.elm b/src/client/elm/Utils/Date.elm
index 7a245bc..352e4ce 100644
--- a/src/client/elm/Utils/Date.elm
+++ b/src/client/elm/Utils/Date.elm
@@ -1,7 +1,7 @@
-module Utils.Date
+module Utils.Date exposing
( monthToNum
, numToMonth
- ) where
+ )
import Date exposing (..)
diff --git a/src/client/elm/Utils/Dict.elm b/src/client/elm/Utils/Dict.elm
index dc01b17..7d708e2 100644
--- a/src/client/elm/Utils/Dict.elm
+++ b/src/client/elm/Utils/Dict.elm
@@ -1,6 +1,6 @@
-module Utils.Dict
+module Utils.Dict exposing
( mapValues
- ) where
+ )
import Dict as Dict exposing (..)
diff --git a/src/client/elm/Utils/Effects.elm b/src/client/elm/Utils/Effects.elm
deleted file mode 100644
index 544352f..0000000
--- a/src/client/elm/Utils/Effects.elm
+++ /dev/null
@@ -1,10 +0,0 @@
-module Utils.Effects
- ( andThen
- ) where
-
-import Effects exposing (Effects)
-
-andThen : (a, Effects b) -> (a -> (a, Effects b)) -> (a, Effects b)
-andThen a b = case a of
- (ma, ea) -> case b ma of
- (mb, eb) -> (mb, Effects.batch [ea, eb])
diff --git a/src/client/elm/Utils/Either.elm b/src/client/elm/Utils/Either.elm
index 10c40e3..275fc8c 100644
--- a/src/client/elm/Utils/Either.elm
+++ b/src/client/elm/Utils/Either.elm
@@ -1,6 +1,6 @@
-module Utils.Either
+module Utils.Either exposing
( toMaybeError
- ) where
+ )
toMaybeError : Result a b -> Maybe a
toMaybeError result =
diff --git a/src/client/elm/Utils/Http.elm b/src/client/elm/Utils/Http.elm
index b394af4..97db053 100644
--- a/src/client/elm/Utils/Http.elm
+++ b/src/client/elm/Utils/Http.elm
@@ -1,9 +1,9 @@
-module Utils.Http
+module Utils.Http exposing
( post
, delete
, decodeHttpValue
, errorKey
- ) where
+ )
import Http exposing (..)
import Task exposing (..)
diff --git a/src/client/elm/Utils/List.elm b/src/client/elm/Utils/List.elm
index 85cdc24..4886418 100644
--- a/src/client/elm/Utils/List.elm
+++ b/src/client/elm/Utils/List.elm
@@ -1,6 +1,6 @@
-module Utils.List
+module Utils.List exposing
( groupBy
- ) where
+ )
import Dict
diff --git a/src/client/elm/Utils/Maybe.elm b/src/client/elm/Utils/Maybe.elm
index d954ae0..4a94aa5 100644
--- a/src/client/elm/Utils/Maybe.elm
+++ b/src/client/elm/Utils/Maybe.elm
@@ -1,8 +1,8 @@
-module Utils.Maybe
+module Utils.Maybe exposing
( isJust
, catMaybes
, maybeToList
- ) where
+ )
isJust : Maybe a -> Bool
isJust maybe =
diff --git a/src/client/elm/Utils/Tuple.elm b/src/client/elm/Utils/Tuple.elm
index d9246f6..f9391a0 100644
--- a/src/client/elm/Utils/Tuple.elm
+++ b/src/client/elm/Utils/Tuple.elm
@@ -1,8 +1,8 @@
-module Utils.Tuple
+module Utils.Tuple exposing
( mapFst
, mapSnd
, mapBoth
- ) where
+ )
mapFst : (a -> x) -> (a, b) -> (x, b)
mapFst f (a, b) = (f a, b)