@@ -13,16 +13,17 @@ module React.Basic.Events
1313
1414import Prelude
1515
16- import Control.Monad.Eff (Eff )
17- import Control.Monad.Eff.Uncurried (EffFn1 , mkEffFn1 )
18- import Data.Record (delete , get , insert )
1916import Data.Symbol (class IsSymbol , SProxy (SProxy))
20- import React.Basic (ReactFX )
21- import Type.Row (kind RowList , class RowToList , class RowLacks , RLProxy (..), Cons , Nil )
17+ import Effect (Effect )
18+ import Effect.Uncurried (EffectFn1 , mkEffectFn1 )
19+ import Prim.Row as Row
20+ import Prim.RowList (kind RowList , class RowToList , Cons , Nil )
21+ import Record (delete , get , insert )
22+ import Type.Row (RLProxy (..))
2223
2324-- | An event handler, which receives a `SyntheticEvent` and performs some
2425-- | effects in return.
25- type EventHandler = EffFn1 ( react :: ReactFX ) SyntheticEvent Unit
26+ type EventHandler = EffectFn1 SyntheticEvent Unit
2627
2728-- | Event data that we receive from React.
2829foreign import data SyntheticEvent :: Type
@@ -59,8 +60,8 @@ derive newtype instance categoryBuilder :: Category EventFn
5960-- | \value -> setState \_ -> { value }
6061-- | }
6162-- | ```
62- handler :: forall a . EventFn SyntheticEvent a -> (a -> Eff ( react :: ReactFX ) Unit ) -> EventHandler
63- handler (EventFn fn) cb = mkEffFn1 $ fn >>> cb
63+ handler :: forall a . EventFn SyntheticEvent a -> (a -> Effect Unit ) -> EventHandler
64+ handler (EventFn fn) cb = mkEffectFn1 $ fn >>> cb
6465
6566-- | Create an `EventHandler` which discards the `SyntheticEvent`.
6667-- |
@@ -70,11 +71,11 @@ handler (EventFn fn) cb = mkEffFn1 $ fn >>> cb
7071-- | input { onChange: handler_ (setState \_ -> { value })
7172-- | }
7273-- | ```
73- handler_ :: Eff ( react :: ReactFX ) Unit -> EventHandler
74- handler_ = mkEffFn1 <<< const
74+ handler_ :: Effect Unit -> EventHandler
75+ handler_ = mkEffectFn1 <<< const
7576
7677syntheticEvent :: EventFn SyntheticEvent SyntheticEvent
77- syntheticEvent = id
78+ syntheticEvent = identity
7879
7980class Merge (rl :: RowList ) fns a r | rl -> fns , rl a -> r where
8081 mergeImpl :: RLProxy rl -> Record fns -> EventFn a (Record r )
@@ -84,10 +85,10 @@ instance mergeNil :: Merge Nil () a () where
8485
8586instance mergeCons
8687 :: ( IsSymbol l
87- , RowCons l (EventFn a b ) fns_rest fns
88- , RowCons l b r_rest r
89- , RowLacks l fns_rest
90- , RowLacks l r_rest
88+ , Row.Cons l (EventFn a b ) fns_rest fns
89+ , Row.Cons l b r_rest r
90+ , Row.Lacks l fns_rest
91+ , Row.Lacks l r_rest
9192 , Merge rest fns_rest a r_rest
9293 )
9394 => Merge (Cons l (EventFn a b ) rest ) fns a r
0 commit comments