Skip to content

Commit 90aad89

Browse files
committed
miso-capa wip
1 parent c53e1ba commit 90aad89

File tree

10 files changed

+206
-188
lines changed

10 files changed

+206
-188
lines changed

ghcjs/miso-capa/src/Functora/Miso/Capa/BrowserLink.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ where
66

77
import qualified Functora.Miso.Jsm as Jsm
88
import Functora.Miso.Prelude
9+
import Functora.Miso.Types
910

1011
data Args model action = Args
1112
{ argsLink :: URI,
1213
argsLabel :: Unicode,
13-
argsAction :: (model -> JSM model) -> action
14+
argsAction :: Update model -> action
1415
}
1516
deriving stock (Generic)
1617

ghcjs/miso-capa/src/Functora/Miso/Capa/Currency.hs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ import qualified Text.Fuzzy as Fuzzy
2323
data Args model action = Args
2424
{ argsModel :: model,
2525
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 (),
2828
argsCurrencies :: Getter' model (NonEmpty CurrencyInfo)
2929
}
3030
deriving stock (Generic)
@@ -109,9 +109,8 @@ selectCurrency
109109
]
110110
where
111111
opened =
112-
action $ \prev ->
113-
pure
114-
$ prev
112+
action . PureUpdate $ \prev ->
113+
prev
115114
& cloneTraversal optic
116115
. #currencyModalState
117116
.~ Opened
@@ -122,9 +121,8 @@ selectCurrency
122121
.~ mempty
123122
& extraOnClick
124123
closed =
125-
action $ \prev ->
126-
pure
127-
$ prev
124+
action . PureUpdate $ \prev ->
125+
prev
128126
& cloneTraversal optic
129127
. #currencyModalState
130128
.~ Closed
@@ -211,9 +209,8 @@ currencyListItemWidget
211209
else Nothing
212210
)
213211
& ListItem.setOnClick
214-
( action $ \st ->
215-
pure
216-
$ st
212+
( action . PureUpdate $ \st ->
213+
st
217214
& cloneTraversal optic
218215
. #currencyModalState
219216
.~ Closed

ghcjs/miso-capa/src/Functora/Miso/Capa/Dialog.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import qualified Material.Dialog as Dialog
1414
data Args model action = Args
1515
{ argsModel :: model,
1616
argsOptic :: ATraversal' model OpenedOrClosed,
17-
argsAction :: (model -> JSM model) -> action,
17+
argsAction :: Update model -> action,
1818
argsContent :: [View action]
1919
}
2020
deriving stock (Generic)
@@ -52,4 +52,4 @@ dialog args =
5252
optic :: ATraversal' model OpenedOrClosed
5353
optic = args ^. #argsOptic
5454
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)

0 commit comments

Comments
 (0)