diff --git a/bower.json b/bower.json index ad317cf..7fe7d9e 100644 --- a/bower.json +++ b/bower.json @@ -19,7 +19,7 @@ ], "license": "MIT", "dependencies": { - "purescript-react": "^1.1.0", - "purescript-aff": "^1.1.0" + "purescript-react": "^2.0.0", + "purescript-aff": "^2.0.2" } } diff --git a/package.json b/package.json index 2754485..bdcd069 100644 --- a/package.json +++ b/package.json @@ -32,9 +32,9 @@ "commitizen": "^2.8.6", "cz-conventional-changelog": "^1.2.0", "ghooks": "^1.3.2", - "pulp": "^9.0.1", - "purescript": "^0.9.3", - "purescript-psa": "^0.3.9", + "pulp": "^10.0.0", + "purescript": "^0.10.4", + "purescript-psa": "^0.4.0", "semantic-release": "^4.3.5" }, "config": { diff --git a/src/Carpenter.purs b/src/Carpenter.purs index 58d172f..c3ad412 100644 --- a/src/Carpenter.purs +++ b/src/Carpenter.purs @@ -15,10 +15,10 @@ module Carpenter import Prelude import React as React import Control.Monad.Aff (launchAff, makeAff, Aff) -import Control.Monad.Aff.Unsafe (unsafeInterleaveAff) +import Control.Monad.Aff.Unsafe (unsafeCoerceAff) import Control.Monad.Eff (Eff) import Control.Monad.Eff.Class (liftEff) -import Control.Monad.Eff.Unsafe (unsafeInterleaveEff) +import Control.Monad.Eff.Unsafe (unsafeCoerceEff) type CarpenterEffects eff = (props :: React.ReactProps, state :: React.ReactState React.ReadWrite | eff) @@ -77,16 +77,16 @@ spec state update render = React.spec state (getReactRender update render) -- | Constructs a React component spec based on an initial state, -- | an initial action, an update function and a render function. -spec' :: ∀ state props action eff. state -> action -> Update state props action eff -> Render state props action -> React.ReactSpec props state eff +spec' :: ∀ st ps act eff. st -> act -> Update st ps act eff -> Render st ps act -> React.ReactSpec ps st eff spec' state action update render = (React.spec state (getReactRender update render)) { componentWillMount = componentWillMount } where - componentWillMount :: React.ComponentWillMount props state eff + componentWillMount :: React.ComponentWillMount ps st eff componentWillMount this = void $ do - props <- React.getProps this - state <- React.readState this + props' <- React.getProps this + state' <- React.readState this let yield = mkYielder this let dispatch = mkDispatcher this update yield - unsafeInterleaveEff (launchAff (update yield dispatch action props state)) + unsafeCoerceEff (launchAff (update yield dispatch action props' state')) -- | A default implementation for the update function which does not perform -- | any changes to the state, that is, ignores all actions. @@ -96,12 +96,12 @@ defaultUpdate _ _ _ _ = pure -- | Generates an update function for testing with mock `yield` and `dispatch` -- | functions, which do not depend on React, but return the modified state and -- | behave as expected. -mockUpdate :: ∀ state props action eff. Update state props action eff -> action -> props -> state -> Aff eff state -mockUpdate update action props state = unsafeInterleaveAff (update mockYield mockDispatch action props state) +mockUpdate :: ∀ st ps act eff. Update st ps act eff -> act -> ps -> st -> Aff eff st +mockUpdate update action props state = unsafeCoerceAff (update mockYield mockDispatch action props state) where mockYield f = pure (f state) - mockDispatch :: Dispatcher action - mockDispatch action = void $ unsafeInterleaveEff (launchAff (update mockYield mockDispatch action props state)) + mockDispatch :: Dispatcher act + mockDispatch action' = void $ unsafeCoerceEff (launchAff (update mockYield mockDispatch action' props state)) -- -- @@ -121,7 +121,7 @@ mkDispatcher mkDispatcher this update yield = dispatch where dispatch :: Dispatcher action - dispatch action = void $ unsafeInterleaveEff $ launchAff do + dispatch action = void $ unsafeCoerceEff $ launchAff do props <- liftEff $ React.getProps this state <- liftEff $ React.readState this update yield dispatch action props state diff --git a/src/Carpenter/Cedar.purs b/src/Carpenter/Cedar.purs index 4fe0317..e01e721 100644 --- a/src/Carpenter/Cedar.purs +++ b/src/Carpenter/Cedar.purs @@ -19,9 +19,9 @@ import Prelude import React as React import Carpenter (Yielder, Dispatcher, Render, Update, EventHandler) import Control.Monad.Aff (Aff, makeAff, launchAff) -import Control.Monad.Aff.Unsafe (unsafeInterleaveAff) +import Control.Monad.Aff.Unsafe (unsafeCoerceAff) import Control.Monad.Eff.Class (liftEff) -import Control.Monad.Eff.Unsafe (unsafeInterleaveEff) +import Control.Monad.Eff.Unsafe (unsafeCoerceEff) -- | Type synonym for internal props of Cedar components. type CedarProps state action = @@ -91,7 +91,7 @@ cedarSpec' action update render = reactSpec state <- React.readState this let yield = mkYielder this let dispatch = mkDispatcher this update yield - unsafeInterleaveEff (launchAff (update yield dispatch action props state)) + unsafeCoerceEff (launchAff (update yield dispatch action props state)) -- | Creates an element of the specificed React class with initial state -- | and children, and captures its dispatched actions. @@ -158,13 +158,13 @@ ignore' reactClass state = React.createElement reactClass {initialState: state, -- | Generates an update function for testing with mock `yield` and `dispatch` -- | functions, which do not depend on React, but return the modified state and -- | behave as expected. -mockUpdate :: ∀ state action eff. Update state (CedarProps state action) action eff -> action -> state -> Aff eff state -mockUpdate update action state = unsafeInterleaveAff (update mockYield mockDispatch action props state) +mockUpdate :: ∀ st act eff. Update st (CedarProps st act) act eff -> act -> st -> Aff eff st +mockUpdate update action state = unsafeCoerceAff (update mockYield mockDispatch action props state) where props = { initialState: state, handler: Ignore } mockYield f = pure (f state) - mockDispatch :: Dispatcher action - mockDispatch action = void $ unsafeInterleaveEff (launchAff (update mockYield mockDispatch action props state)) + mockDispatch :: Dispatcher act + mockDispatch action' = void $ unsafeCoerceEff (launchAff (update mockYield mockDispatch action' props state)) -- -- @@ -184,7 +184,7 @@ mkDispatcher mkDispatcher this update yield = dispatch where dispatch :: Dispatcher action - dispatch action = void $ unsafeInterleaveEff $ launchAff do + dispatch action = void $ unsafeCoerceEff $ launchAff do props <- liftEff $ React.getProps this state <- liftEff $ React.readState this case props.handler of