jxxcarlson / elm-text-search / Text.Parse

The parse function accepts a query string and if successful produces a value of type Ok QueryTerm. If it is unsuccessful, it returns Err "ill-formed query". For example, the query string "foo -bar | x y" yields the QueryTerm

Disjunction
    [ Conjunction [ Word "foo", NotWord "bar" ]
    , Conjunction [ Word "x", Word "y" ]
    ]


type QueryTerm
    = Word String
    | NotWord String
    | Conjunction (List QueryTerm)
    | Disjunction (List QueryTerm)

This is the type of the parser syntax tree.

parse : String -> Result String QueryTerm