Skip to content

Implement Predicate<T>  #98

@amarpotghan

Description

@amarpotghan

many times I ended up in writing following combinators, I think it would add some value if library has it :

  1. F<A, Bool> and(F<A, Bool> pred1, F<A, Bool> pred2)
  2. F<A, Bool> or(F<A, Bool> pred1, F<A, Bool> pred2)
  3. F < B, Bool > comap(F<B, A>, F<A, Bool>)
  4. F<B, Bool> notFor(F<B, A>, F<A, Bool>) [a la Haskell's Data.Function.Predicate's isn't]
  5. F<A, Bool> inverse(F<A, Bool>)

additionally we could add:
nand, nor, xor
We can also implement Predicate2<A, B>, Predicate3<A, B, C> and so on.
thoughts?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions