Skip to content

Commit 496624a

Browse files
authored
Removed wire from dependencies (#7)
* Removed `wire` as a dependency * Export `Event` type
1 parent 711d9d4 commit 496624a

File tree

7 files changed

+11
-18
lines changed

7 files changed

+11
-18
lines changed

README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@ let additions =
1919
, repo = "https://github.com/robertdp/purescript-react-halo.git"
2020
, version = "v1.0.0"
2121
}
22-
, wire =
23-
{ dependencies = [ "aff", "filterable", "refs", "unsafe-reference" ]
24-
, repo = "https://github.com/robertdp/purescript-wire.git"
25-
, version = "v0.5.0"
26-
}
2722
}
2823
```
2924

@@ -86,6 +81,8 @@ fireOnChange value = do
8681
Subscriptions registered using these functions are automatically tracked by Halo.
8782

8883
```purescript
84+
type Event a = (a -> Effect Unit) -> Effect (Effect Unit)
85+
8986
subscribe :: forall props state action m. Event action -> HaloM props state action m SubscriptionId
9087
9188
unsubscribe :: forall m action state props. SubscriptionId -> HaloM props state action m Unit

packages.dhall

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,6 @@ let upstream =
123123

124124
let overrides = {=}
125125

126-
let additions =
127-
{ wire =
128-
{ dependencies = [ "aff", "filterable", "refs", "unsafe-reference" ]
129-
, repo = "https://github.com/robertdp/purescript-wire.git"
130-
, version = "v0.5.0"
131-
}
132-
}
126+
let additions = {=}
133127

134128
in upstream // overrides // additions

spago.dhall

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ You can edit this file as you like.
66
, license = "BSD-3-Clause"
77
, repository = "https://github.com/robertdp/purescript-react-halo.git"
88
, dependencies =
9-
[ "aff", "free", "freeap", "react-basic-hooks", "refs", "wire" ]
9+
[ "aff", "free", "freeap", "react-basic-hooks", "refs" ]
1010
, packages = ./packages.dhall
1111
, sources = [ "src/**/*.purs" ]
1212
}

src/React/Halo.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ import React.Basic.Hooks (Component, JSX) as React
1818
import React.Halo.Component (ComponentSpec, HookSpec, UseHalo, component, component_, useHalo) as Halo
1919
import React.Halo.Internal.Control (HaloAp, HaloM, fork, hoist, hoistAp, kill, props, subscribe, subscribe', unsubscribe) as Halo
2020
import React.Halo.Internal.Eval (EvalSpec, defaultEval, mkEval) as Halo
21-
import React.Halo.Internal.Types (ForkId, Lifecycle(..), SubscriptionId) as Halo
21+
import React.Halo.Internal.Types (Event, ForkId, Lifecycle(..), SubscriptionId) as Halo

src/React/Halo/Internal/Control.purs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ import Data.Bifunctor (lmap)
1414
import Data.Tuple (Tuple)
1515
import Effect.Aff.Class (class MonadAff, liftAff)
1616
import Effect.Class (class MonadEffect, liftEffect)
17-
import React.Halo.Internal.Types (ForkId, SubscriptionId)
18-
import Wire.Event (Event)
17+
import React.Halo.Internal.Types (Event, ForkId, SubscriptionId)
1918

2019
-- | The Halo evaluation algebra
2120
-- |

src/React/Halo/Internal/Eval.purs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import React.Halo.Internal.State (HaloState(..))
1818
import React.Halo.Internal.State as State
1919
import React.Halo.Internal.Types (ForkId(..), Lifecycle(..), SubscriptionId(..))
2020
import Unsafe.Reference (unsafeRefEq)
21-
import Wire.Event as Event
2221

2322
-- | Interprets `HaloM` into the base monad `Aff` for asynchronous effects.
2423
evalHaloM :: forall props state action. HaloState props state action -> HaloM props state action Aff ~> Aff
@@ -49,7 +48,7 @@ evalHaloF hs@(HaloState s) = case _ of
4948
liftEffect do
5049
sid <- State.fresh SubscriptionId hs
5150
unlessM (Ref.read s.finalized) do
52-
canceller <- Event.subscribe (sub sid) (handleAction hs)
51+
canceller <- sub sid (handleAction hs)
5352
Ref.modify_ (Map.insert sid canceller) s.subscriptions
5453
pure (k sid)
5554
Unsubscribe sid a ->

src/React/Halo/Internal/Types.purs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
module React.Halo.Internal.Types where
22

33
import Prelude
4+
import Effect (Effect)
45

56
-- | The Halo lifecycle events.
67
-- |
@@ -15,6 +16,9 @@ data Lifecycle props action
1516
| Action action
1617
| Finalize
1718

19+
type Event a
20+
= (a -> Effect Unit) -> Effect (Effect Unit)
21+
1822
newtype SubscriptionId
1923
= SubscriptionId Int
2024

0 commit comments

Comments
 (0)