Skip to content

How to void a statement ? #211

Description

@adfretlink

I often have manipulation that return a value, that I will both use in a single manipulateParams call, or sometimes in batch with traversePrepared - in this latter case, I very frequently do not want the result and void it. This used to work fine in squeal 0.5, but it is my understanding that the new mechanisms at play in Squeal 0.6 make this a bit harder, as the compiler still tries to infer the voided type and fail unless I give it very explicitly.

It is however very convenient to be able to write:

void . traversePrepared -- .. statement and params

Sadly, I cannot use traversePrepared as it demands a statement that returns nothing - which makes sense.

So would it be possible to add a function voidStatement with a signature like this one:

-> Manipulation with db params ()

This way we could write:

traversePrepared . voidStatement -- .. statement and params

Unless there is a way of making traversePrepared_ work with manipulations that have a return type other than () ? (But it might not be a good idea either, as it is rather a good thing to have some type safety at this specific spot).

Obviously, this can still be worked around by stating the expected types explicitly, then voiding them, but it might be a nice convenience to add. What do you think ?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions