-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Name change suggestions #147
Comments
Sorry for the late reply. • Changing • Concerning The name That said, I'm also open to suggestions on how to make • Concerning That said, using the plural, |
I really like your idea of using the plural Here's a follow on thought for your consideration. When learning to use reactive-banana (I still am), I did not understand why we had to go through the extra step of grouping the handlers together to get an main = do
-- newAddHandler :: IO (AddHandler a, Handler a)
(myHandlers, fire) <- newAddHandler
-- describe the event network
let networkDescription :: MomentIO ()
networkDescription = mdo
-- fromAddHandler :: AddHandler a -> MomentIO (Event a)
myEvent <- fromAddHandler myHandlers
...
fire someValue
In other words, the main = do
-- newHandler :: IO (Handler a)
handler <- newHandler
-- describe the event network
let networkDescription :: MomentIO ()
networkDescription = mdo
-- fromHandler :: Handler a -> MomentIO (Event a)
myEvent <- fromHandler handler
...
fire handler someValue In other words, it seems the "grouping" should be optional not mandatory. I seldom |
Here is another suggestion: change the type of reactimate :: Event a -> (a -> IO ()) -> MomentIO () in order to facilitate the very common case of working with some non- reactimate $
(\x -> do
my_big_action
lots_of_lines
print x)
<$> myEvent as reactimate myEvent $ \x -> do
my_big_action
lots_of_lines
print x |
You can already do: reactimate $ ev <&> \x -> do ... |
That's true, and my suggestion is fairly annoying for |
|
I am:
|
Oh, and I'm -1 on the |
I propose to change My reasoning is:
To avoid a major version bump (if that's a concern) I'd also be totally happy with leaving unionWith around, but deprecated in favor of union. Or, if you prefer the names unionWith and mergeWith, that's fine too :) @HeinrichApfelmus says:
|
I think the name of some of the functions and types used in Reactive Banana could be improved to help beginners and also to more closely match the semantic meaning of the underlying operations and types. Here are a few suggestions that I think are important.
Change
actuate
toactivate
— These words have very similar meanings and I believe are interchangeable in the context ofEventNetwork
s. However, activate is much more common. A cursory google search has 246 million hits for activate against only 6.7 million for actuate. So, activate is over 30 times more common. This makes it easier for non-native English speakers to know its meaning.Change
AddHandler
toHandlerSet
— I think it is easier to have a type denote nouns (such as a network connection, a list or a hashMap) as opposed to verbs. Those are usually associated with functions (such as in filter, interpret and apply). In the case ofAddHandler
, “Add” is a verb.Semantically, this types provides a Set of event handlers that are all “fired” together. There is no internal structure, so this is not a list. A HandlerRegistrar or similar name would also work, but the word registrar is not used much. Derived functions such as “newAddHandler” would also have clearer names (e.g. newAddHandler becomes newHandlerSet).
Change
Event
toEventStream
— I understand this may be a more controversial change. I believe the nameEvent
has stuck for historical reasons. However, I believe it is very confusing in the context of Reactive Banana. In common day usage, an event happens only once, whereas in Reactive Banana the typeEvent a
encompasses multiple events that happen at different times. From the docs “Event a
represents a stream of events as they occur in time.” This leads to some confusion. The new name would more closely reflect the type’s semantic meaning. Note that there is no such problem with Behaviors.I think it is easy to make these changes in the code and documentation, but I wouldn't want to make a pull request before the discussion. To keep backwards compatibility, it is only necessary to make name aliases. For example:
I think Haskell’s Achilles’ heel is its barrier to entry. The intent of this suggestion is to make Reactive Banana easier to learn and understand.
The text was updated successfully, but these errors were encountered: