Skip to content

Defunc Filter #55

@upsiflu

Description

@upsiflu

As it stands (v1), a Filter accepts a function [SearchTerms] -> Ui. A defunctionalized alternative might look like

predicateA ∧ (predicateB ∨ predicateC)

We cannot use the Api of https://package.elm-lang.org/packages/red-g/filter/latest/Filter because it immediately applies the filter, and it checks for a Bool, not for a list.

In Filter, we are working with SearchTerms (Strings) assigned to a given Category.

type alias Filter 
    = List (Predicate, Ui)

type Predicate
    = And Predicate Predicate
    | Or Predicate Predicate
    | IsSimilarTo { deviation : Int, compareTo : String }
    | Contains String
    | Equals String

apply : Filter -> List SearchTerm -> Ui

and : Filter -> Filter -> Filter

or : Filter -> Filter -> Filter

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