Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add at least some documentation to makeEmitter #2

Copy link
Copy link
@toastal

Description

@toastal
Issue body actions

Is your change request related to a problem? Please describe.

makeEmitter
  :: forall a
   . ((a -> Effect Unit) -> Effect (Effect Unit))
  -> Emitter a
makeEmitter = coerce

This is a very confusing signature and definition for someone of novice-intermediate language experience. There's no examples, no test case, and what even is ((a -> Effect Unit) -> Effect (Effect Unit))? I think even adding a type alias like the type Canceler = Effect (Effect Unit) could help clarify what's going on. Not sure on the best solution, but currently I find it hard to understand.

Describe the solution you'd like
I started a thread on Discourse about requestAnimationFrame that has a useful, and probably popular use-case for makeEmitter in getting ticks for each frame. It could perhaps be common enough to have an Halogen.Subscriptions.{Common,Extra,Solutions,HTML,DOM,etc.} so the community can have a standardized solution for common problems -- especially for people looking for batteries-included, zephyr-will-clean-up-the-excess fix to "get sh*t done". Obviously you don't want to add DOM/HTML dependencies here, but it'd be a common dep in an application setting.

Additional context
Control.Plus.empty

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.