summaryrefslogtreecommitdiff
path: root/lore/Network/RemoteData.hs
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2019-10-27 09:48:52 -0700
committerBen Sima <ben@bsima.me>2019-10-27 12:14:40 -0700
commitc790672cc244ac4caba1bda3572829a6c6862891 (patch)
tree2706bb8044f7b14840c5f90f215b79b433e81045 /lore/Network/RemoteData.hs
parent44df4ba39f65c3afd84bee6b03f47d9b061e9038 (diff)
move everything to namespace directories
Diffstat (limited to 'lore/Network/RemoteData.hs')
-rw-r--r--lore/Network/RemoteData.hs31
1 files changed, 0 insertions, 31 deletions
diff --git a/lore/Network/RemoteData.hs b/lore/Network/RemoteData.hs
deleted file mode 100644
index 2fe6557..0000000
--- a/lore/Network/RemoteData.hs
+++ /dev/null
@@ -1,31 +0,0 @@
--- | A port of Kris Jenkins' RemoteData Elm module
--- <https://github.com/krisajenkins/remotedata>.
---
-module Network.RemoteData where
-
-data RemoteData a b
- = NotAsked
- | Loading
- | Failure a
- | Success b
- deriving (Eq, Show)
-
--- TODO figure out Http.Error
--- type WebData a = RemoteData Http.Error a
-
-instance Functor (RemoteData a) where
- fmap _ NotAsked = NotAsked
- fmap _ Loading = Loading
- fmap _ (Failure a) = Failure a
- fmap f (Success a) = Success (f a)
-
-instance Applicative (RemoteData e) where
- pure = Success
- NotAsked <*> _ = NotAsked
- Loading <*> _ = Loading
- Failure a <*> _ = Failure a
- Success a <*> b = fmap a b
-
-fromEither :: Either a b -> RemoteData a b
-fromEither (Left a) = Failure a
-fromEither (Right a) = Success a