Skip to content

Data.Functor.void needs a way to specify the type of discarded value #308

Open
@yaitskov

Description

@yaitskov

I have following code snippet:

post :: forall m a. DecodeJson a => Monad m => String -> m a 

deleteFoo = do
  void $ post "http://localhost/delete"

type checker complains with:

No type class instance was found for
    Data.Argonaut.Encode.Class.DecodeJson t3

Current version of void function cannot get type parameter:

deleteFoo = do
  void @Unit $ post "http://localhost/delete"
An expression of polymorphic type
  with the invisible type variable f:

    forall f a. Functor f => f a -> f Unit

  cannot be applied to:

    Boolean

I suggest to rewrite void function to make it more flexible:

voidAt :: forall @a f . Functor f => f a -> f Unit
voidAt = void

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