diff options
author | Ben Sima <ben@bsima.me> | 2020-04-15 10:06:24 -0700 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2020-04-15 10:07:02 -0700 |
commit | afa9d701538b9e56622a0bfdf8e04aa358c9cd82 (patch) | |
tree | dee95c3955b3fe3d11e80d89823660d28eee0587 /Network/RemoteData.hs | |
parent | f4b8c0df041b063c0b47d2ec6c818a9c202fd833 (diff) |
Reformatting
Now I'm using ormolu instead of brittany for Haskell formatting
now. Figured I should just make all of these big changes at once.
Diffstat (limited to 'Network/RemoteData.hs')
-rw-r--r-- | Network/RemoteData.hs | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/Network/RemoteData.hs b/Network/RemoteData.hs index 2fe6557..4114f02 100644 --- a/Network/RemoteData.hs +++ b/Network/RemoteData.hs @@ -1,30 +1,29 @@ -- | 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) + = 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) + 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 + 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 |