File tree Expand file tree Collapse file tree 10 files changed +206
-188
lines changed
ghcjs/miso-capa/src/Functora/Miso Expand file tree Collapse file tree 10 files changed +206
-188
lines changed Original file line number Diff line number Diff line change 6
6
7
7
import qualified Functora.Miso.Jsm as Jsm
8
8
import Functora.Miso.Prelude
9
+ import Functora.Miso.Types
9
10
10
11
data Args model action = Args
11
12
{ argsLink :: URI ,
12
13
argsLabel :: Unicode ,
13
- argsAction :: ( model -> JSM model ) -> action
14
+ argsAction :: Update model -> action
14
15
}
15
16
deriving stock (Generic )
16
17
Original file line number Diff line number Diff line change @@ -23,8 +23,8 @@ import qualified Text.Fuzzy as Fuzzy
23
23
data Args model action = Args
24
24
{ argsModel :: model ,
25
25
argsOptic :: ATraversal' model (Currency Unique ),
26
- argsAction :: ( model -> JSM model ) -> action ,
27
- argsEmitter :: ( model -> JSM model ) -> JSM () ,
26
+ argsAction :: Update model -> action ,
27
+ argsEmitter :: Update model -> JSM () ,
28
28
argsCurrencies :: Getter' model (NonEmpty CurrencyInfo )
29
29
}
30
30
deriving stock (Generic )
@@ -109,9 +109,8 @@ selectCurrency
109
109
]
110
110
where
111
111
opened =
112
- action $ \ prev ->
113
- pure
114
- $ prev
112
+ action . PureUpdate $ \ prev ->
113
+ prev
115
114
& cloneTraversal optic
116
115
. # currencyModalState
117
116
.~ Opened
@@ -122,9 +121,8 @@ selectCurrency
122
121
.~ mempty
123
122
& extraOnClick
124
123
closed =
125
- action $ \ prev ->
126
- pure
127
- $ prev
124
+ action . PureUpdate $ \ prev ->
125
+ prev
128
126
& cloneTraversal optic
129
127
. # currencyModalState
130
128
.~ Closed
@@ -211,9 +209,8 @@ currencyListItemWidget
211
209
else Nothing
212
210
)
213
211
& ListItem. setOnClick
214
- ( action $ \ st ->
215
- pure
216
- $ st
212
+ ( action . PureUpdate $ \ st ->
213
+ st
217
214
& cloneTraversal optic
218
215
. # currencyModalState
219
216
.~ Closed
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ import qualified Material.Dialog as Dialog
14
14
data Args model action = Args
15
15
{ argsModel :: model ,
16
16
argsOptic :: ATraversal' model OpenedOrClosed ,
17
- argsAction :: ( model -> JSM model ) -> action ,
17
+ argsAction :: Update model -> action ,
18
18
argsContent :: [View action ]
19
19
}
20
20
deriving stock (Generic )
@@ -52,4 +52,4 @@ dialog args =
52
52
optic :: ATraversal' model OpenedOrClosed
53
53
optic = args ^. # argsOptic
54
54
action :: (action -> f action -> f action ) -> f action -> f action
55
- action = ($ args ^. # argsAction $ pure . ( & cloneTraversal optic .~ Closed ) )
55
+ action = ($ args ^. # argsAction $ PureUpdate $ cloneTraversal optic .~ Closed )
You can’t perform that action at this time.
0 commit comments