diff --git a/bower.json b/bower.json index 1db0212..8528986 100644 --- a/bower.json +++ b/bower.json @@ -16,7 +16,7 @@ "!src/**/*" ], "dependencies": { - "purescript-profunctor-lenses": "~1.0.0", - "purescript-react": "~1.1.0" + "purescript-profunctor-lenses": "^2.1.0", + "purescript-react": "^2.0.0" } } diff --git a/package.json b/package.json index c0c00b4..5202f80 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "purescript-react-redux", - "version": "1.0.0", + "version": "2.0.0", "private": true, "files": [], "scripts": { diff --git a/src/React/Redux.js b/src/React/Redux.js index b449d83..ed1302d 100644 --- a/src/React/Redux.js +++ b/src/React/Redux.js @@ -1,7 +1,5 @@ 'use strict'; -// module React.Redux - var Redux = require('redux'); var ReactRedux = require('react-redux'); diff --git a/src/React/Redux.purs b/src/React/Redux.purs index b1cc8aa..95cb821 100644 --- a/src/React/Redux.purs +++ b/src/React/Redux.purs @@ -30,7 +30,7 @@ import Control.Monad.Eff.Class (class MonadEff, liftEff) import Data.Either (Either, either) import Data.Function.Uncurried (Fn2, runFn2) -import Data.Lens (GetterP, LensP, PrismP, matching, set, view) +import Data.Lens (Getter', Lens', Prism', matching, set, view) import Unsafe.Coerce (unsafeCoerce) @@ -92,7 +92,7 @@ spec getInitialState render = spec' :: forall props eff f action. Render props Unit eff f action -> Spec props Unit eff f action spec' = spec (\_ _ -> pure unit) -createClass :: forall props state eff f action state'. MonadEff (Effects eff) f => GetterP state' props -> Spec props state eff f action -> ReduxReactClass state' props +createClass :: forall props state eff f action state'. MonadEff (Effects eff) f => Getter' state' props -> Spec props state eff f action -> ReduxReactClass state' props createClass lens spec_ = connect (view lens) reactClass where reactClass :: React.ReactClass props @@ -122,7 +122,7 @@ createElement store reduxClass = createStore :: forall eff action state. Reducer action state -> state -> Eff (Effects eff) (Store action state) createStore = runFn2 createStore_ -reducerOptic :: forall state state' action action'. LensP state state' -> PrismP action action' -> Reducer action' state' -> Reducer action state +reducerOptic :: forall state state' action action'. Lens' state state' -> Prism' action action' -> Reducer action' state' -> Reducer action state reducerOptic lens prism k action state = either (const state) (\a -> set lens (k a state') state) action' where state' :: state'