summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/elm/Util')
-rw-r--r--src/shared/elm/Util/Array.elm54
-rw-r--r--src/shared/elm/Util/Html.elm6
-rw-r--r--src/shared/elm/Util/Http.elm22
-rw-r--r--src/shared/elm/Util/List.elm53
4 files changed, 0 insertions, 135 deletions
diff --git a/src/shared/elm/Util/Array.elm b/src/shared/elm/Util/Array.elm
deleted file mode 100644
index 26d13f6..0000000
--- a/src/shared/elm/Util/Array.elm
+++ /dev/null
@@ -1,54 +0,0 @@
-module Util.Array exposing
- (
- update,
- update_unsafe,
- filter_first,
- indexed_search
- )
-
-import List
-import Array
-
-update : (
- Int ->
- ((Maybe t) -> (Maybe t)) ->
- (Array.Array t) ->
- (Array.Array t)
- )
-update index fun array =
- case (fun (Array.get index array)) of
- Nothing -> array
- (Just e) -> (Array.set index e array)
-
-update_unsafe : (
- Int ->
- (t -> t) ->
- (Array.Array t) ->
- (Array.Array t)
- )
-update_unsafe index fun array =
- case (Array.get index array) of
- Nothing -> array
- (Just e) -> (Array.set index (fun e) array)
-
-filter_first : (t -> Bool) -> (Array.Array t) -> (Maybe t)
-filter_first fun array =
- (Array.get 0 (Array.filter fun array))
-
-indexed_search : (t -> Bool) -> (Array.Array t) -> (Maybe (Int, t))
-indexed_search fun array =
- (List.foldl
- (\v res ->
- (
- case res of
- (Just e) -> res
- Nothing ->
- let (index, value) = v in
- if (fun value)
- then (Just v)
- else Nothing
- )
- )
- Nothing
- (Array.toIndexedList array)
- )
diff --git a/src/shared/elm/Util/Html.elm b/src/shared/elm/Util/Html.elm
deleted file mode 100644
index 42eadba..0000000
--- a/src/shared/elm/Util/Html.elm
+++ /dev/null
@@ -1,6 +0,0 @@
-module Util.Html exposing (nothing)
-
-import Html
-
-nothing : (Html.Html a)
-nothing = (Html.text "")
diff --git a/src/shared/elm/Util/Http.elm b/src/shared/elm/Util/Http.elm
deleted file mode 100644
index c098dc7..0000000
--- a/src/shared/elm/Util/Http.elm
+++ /dev/null
@@ -1,22 +0,0 @@
-module Util.Http exposing (error_to_string)
-
-import Http
-
-error_to_string : Http.Error -> String
-error_to_string error =
- case error of
- (Http.BadUrl string) -> ("Invalid URL: \"" ++ string ++ "\"")
- Http.Timeout -> "Timed out"
- Http.NetworkError -> "Connection lost, network error."
- (Http.BadStatus response) ->
- (
- "The HTTP request failed: "
- ++ (String.fromInt response)
- ++ "."
- )
- (Http.BadBody string) ->
- (
- "Server response not understood:\""
- ++ string
- ++ "\"."
- )
diff --git a/src/shared/elm/Util/List.elm b/src/shared/elm/Util/List.elm
deleted file mode 100644
index 829dd3e..0000000
--- a/src/shared/elm/Util/List.elm
+++ /dev/null
@@ -1,53 +0,0 @@
-module Util.List exposing (..)
-
-import Set
-
-import List
-
-pop : List a -> (Maybe (a, List a))
-pop l =
- case
- ((List.head l), (List.tail l))
- of
- (Nothing, _) -> Nothing
- (_ , Nothing) -> Nothing
- ((Just head), (Just tail)) -> (Just (head, tail))
-
-get_first : (a -> Bool) -> (List a) -> (Maybe a)
-get_first fun list =
- (List.head (List.filter fun list))
-
-product_map : (a -> b -> c) -> (List a) -> (List b) -> (List c)
-product_map product_fun list_a list_b =
- (product_map_rec (product_fun) list_a list_b [])
-
-product_map_rec : (a -> b -> c) -> (List a) -> (List b) -> (List c) -> (List c)
-product_map_rec product_fun list_a list_b result =
- case (pop list_a) of
- Nothing -> result
- (Just (head, tail)) ->
- (product_map_rec
- (product_fun)
- tail
- list_b
- (List.append
- (List.map (product_fun head) list_b)
- result
- )
- )
-
-duplicates : (List comparable) -> (Set.Set comparable)
-duplicates list =
- let
- (encountered, final_result) =
- (List.foldl
- (\elem (met, result) ->
- if (Set.member elem met)
- then (met, (Set.insert elem result))
- else ((Set.insert elem met), result)
- )
- ((Set.empty), (Set.empty))
- list
- )
- in
- final_result