Skip to content

Conversation

@EmileTrotignon
Copy link
Contributor

@Drup has tasked me with further developing this package.

The changelog is as follows:

  • Introduce charsets: contrary to Re, they have a different type from regex.
  • Type the difference between regexps that can be evaluated reversed and the
    ones that cannot: (evaluable, 'a) Tyre.t and (non_evaluable, 'a) Tyre.t.
  • Introduce alias type pattern for (non_evaluable, 'a) Tyre.t.
  • Introduce val lift : ('a -> string) -> 'a pattern -> ('e, 'a) t to transform
    a pattern into an expression by giving an explicit conversion function.
    Also liftpp that does the same with better performance by using Format.
  • Introduce val unlift : (evaluable, 'a) t -> 'a pattern.
  • Introduce val either: ('e, 'a) Tyre.t -> ('e, 'b) Tyre.t -> ('e, ('a, 'b) Either.t) Tyre.t.
  • Change the type of alt to (_, 'a) t -> (_, 'a) t -> 'a pattern. Previous
    users of alt should switch to either.
  • Introduce val alt_eval: ('a -> [`Left | `Right]) -> ('e, 'a) t -> ('e, 'a) t -> ('e, 'a) t
    This has flat typing but is compatible with eval.
  • Operators: <|> is alt, <||> is either.
  • Introduce val map : ('a -> 'b) -> (_, 'a) t -> 'b pattern and its
    corresponding operators: let+ and <$>.
  • Introduce (and+) which is an alias of seq.
  • Introduce val app: ('e, 'a -> 'b) t -> ('e, 'a) t -> 'b pattern and its
    corresponding operator <*>
  • Introduce val matched_string : (_, 'a) t -> (_, string) t that discards the
    computed value and just return the string that was matched.
  • Drop dependency on Result library. Stdlib is now used.
  • Introduce val rep_charset: Charset.t -> (_, string) t, and shortcut
    val rep_any: (_, string) t.

I introduce version 1.0 mainly because of the large breaking change of typing around alt and either.

@shonfeder
Copy link
Member

shonfeder commented Dec 5, 2025

There are a variety of failing CI tests here. Could you have a look? LMK if you have questions on any points!

(lint) (failed)

Warning in tyre.1.0: Unnecessary field 'name'. It is suggested to remove it.
Warning in tyre.1.0: Dubious use of 'dune subst'. 'dune subst' should always only be called with {dev} (i.e. ["dune" "subst"] {dev}) If your opam file has been autogenerated by dune, you need to upgrade your dune-project to at least (lang dune 2.7).

compilers

4.08
tyre.1.0 (failed: Unbound module Either)
4.09
tyre.1.0 (failed: Unbound module Either)
4.10
tyre.1.0 (failed: Unbound module Either)
4.11
tyre.1.0 (failed: Unbound module Either)
4.12
tyre.1.0
lower-bounds (failed: Unbound module Re.Seq)
4.13
tyre.1.0
lower-bounds (failed: Unbound module Re.Seq)
4.14
tyre.1.0
lower-bounds (failed: Unbound module Re.Seq)
revdeps
syslog-rfc5424.0.1 (failed: The type constructor Tyre.t expects 2 argument(s),)
5.4
tyre.1.0
revdeps
syslog-rfc5424.0.1 (failed: The type constructor Tyre.t expects 2 argument(s),)
vif.0.0.1~beta1 (failed: The type constructor Tyre.t expects 2 argument(s),)

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants