Skip to content

Commit

Permalink
quasar: Add stripLoading and isLoading to the `Quasar.Observable.…
Browse files Browse the repository at this point in the history
…List`
  • Loading branch information
thelegy committed Jun 25, 2024
1 parent bdaa828 commit 6f843b4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions quasar/src/Quasar/Observable/List.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ module Quasar.Observable.List (
ListDeltaOperation(..),
Length(..),
share,
stripLoading,
isLoading,

-- * Reexports
FingerTree,
Expand Down Expand Up @@ -62,6 +64,7 @@ import Data.Sequence qualified as Seq
import Data.Traversable qualified as Traversable
import Quasar.Disposer (TDisposer)
import Quasar.Observable.Core
import Quasar.Observable.Loading (StripLoading, observableTStripLoading, observableTIsLoading)
import Quasar.Observable.Share
import Quasar.Observable.Subject
import Quasar.Observable.Traversable
Expand Down Expand Up @@ -403,6 +406,15 @@ share ::
share (ObservableList f) = ObservableList <$> shareObservableT f


instance IsObservableList NoLoad exceptions v (StripLoading exceptions Seq v) where

stripLoading :: Seq v -> ObservableList Load exceptions v -> ObservableList NoLoad exceptions v
stripLoading initialFallback = ObservableList . observableTStripLoading initialFallback . toObservableT

isLoading :: ObservableList canLoad exceptions v -> Observable NoLoad '[] (Loading canLoad)
isLoading = observableTIsLoading . toObservableT


constObservableList :: ObservableState canLoad (ObservableResult exceptions Seq) v -> ObservableList canLoad exceptions v
constObservableList = ObservableList . ObservableT

Expand Down

0 comments on commit 6f843b4

Please sign in to comment.