Skip to content

Should Validation be a Selective transformer? #54

Open
@turion

Description

@turion

Either naturally generalises as a monad transformer, ExceptT, and we've recently established that this is a bona fide Selective transformer, meaning that there is a natural instance Selective f => Selective (ExceptT e f). I wonder whether there is also such an instance for

newtype ValidationT e f a = ValidationT { runValidationT :: f (Validation e a) }

The obvious question is whether this has the same Selective instance like ExceptT would have. I believe the instances of Either e and Validation e are isomorphic. But for a selective transformer, we probably also demand that lift :: f a -> ValidationT e f a defined by Validation . fmap Success should be a Selective morphism, and that law should be checked.

If this all works out, then maybe it makes sense to simply rename Control.Selective.Trans.Except to Control.Selective.Trans.Validation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions