Skip to content

log shouldn't return the string that was logged #41

@cdepillabout

Description

@cdepillabout

Why does log return the string that was logged?

-- | Logs any string to the console. This basically saves you
-- | from writing `liftEff $ log x` everywhere.
log :: forall e. String -> Aff (console :: C.CONSOLE | e) String
log s = do
  liftEff $ C.log s
  return s

The log function from Control.Monad.Eff.Console that's being wrapped around returns Unit.

-- | Write a message to the console.
foreign import log :: forall eff. String -> Eff (console :: CONSOLE | eff) Unit

All of the places I'm using log, I don't want it to return a string. I realize I could write void $ log "error message", but I think most uses of log won't need the string returned. I think the type should be changed to this:

log :: forall e. String -> Aff (console :: C.CONSOLE | e) Unit

Are other people using log such that they want it to return the string that has been logged?

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