package yocaml

  1. Overview
  2. Docs

An invasive but probably useful tooling.

String util

As I was not very serious... strings occupy a very large place in Wordpress... so it is necessary to be able to work correctly with them.

val split_metadata : string -> string option * string

Infix operators

Even if sometimes, infix operators can seem unreadable... the immoderate use of Arrows has already made the code incomprehensible... so why deprive yourself?

val ($) : ('a -> 'b) -> 'a -> 'b

f $ x is f @@ x which is f x... but I don't like @@.

Working with file name

include module type of Filepath
type t = string

Describing a filepath.

val into : t -> t -> t

t |> into dir describes a t into a dir.

val with_extension : string -> t -> bool

with_extension ext path returns true if path ends with ext false otherwise, ie: with_extension "html" "index.html" returns true but with_extenstion "html" "foohtml" returns false.

val basename : t -> t

Keep the filename and remove the path.

val add_extension : t -> string -> t

Add an extension to a t. For example: add_extension "index.txt" "html" will produce "index.txt.html".

val remove_extension : t -> t

Remove the extension of a path.

val replace_extension : t -> string -> t

Replace the extension of a path.