package travesty
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=49d43ea0e9cef32d493fcc1561fc7480c55d9a2490700e487f4d5c3aff562d61
sha512=1cd77071adfb4583d0fcd27469b97bc64b7278761949aaaf415768aec14f6a1243e14575155c75033a5141a0320b4f56687381dc2bc56432a5ea63ea8613d968
CHANGES.md.html
v0.7.2 (2022-05-24)
No changes from v0.7.1; fixes issues with the GitHub workflow that blocked its release.
v0.7.1 (2022-05-23)
Minor release. (Not released on OPAM)
Depends on OCaml 4.14+, Dune 3.2+, and Base 0.15+.
Can now be built against Base v0.15 without deprecation warnings. This required changing the definition of
Base_exts.Option
, but the difference should not be externally visible.
v0.7.0 (2021-02-11)
Major release with large breaking changes, and added and removed features.
Breaking changes
Traversable
andBi_traversable
now encode applicative traversals, not monadic traversals. This means that every use of aMake
functor needs changing such that, instead of anOn_monad
functor overMonad.S
, they expose anOn
functor overApplicative.S
. No function names have changed (they remainmap_m
,iter_m
etc. for backwards compatibility), and the variousMake
functors generate bothOn
(applicative) andOn_monad
(monadic) functors, so most code that consumes traversals should be fine.Some traversal implementations in
Base_exts
have changed; this may subtly affect side effect processing order.
Added
Monad_exts.App
isBase.Applicative.Of_monad
, but keeps the original monad type around; this is useful for passing monads to things that expect applicatives.Monad_exts.Let
produces OCaml 4.08-stylelet+
andlet*
bindings for monads. It is included inMonad_exts.Make
.
## Removed
The
Traversable.Helpers
module; in practice this doesn't seem to be very useful compared to writing the traversable boilerplate manually, and it doesn't gel particularly well with the planned monad to applicative change.Support for OCaml v4.07. This has effectively been broken since v0.6.2 when building on Jane Street libraries v0.14.
v0.6.2 (2020-04-02)
Minor release with one new feature.
Can now build with OCaml v4.10
New feature: Traversable.Const, an implementation of a traversal that type-checks, but does nothing.
v0.6.1 (2019-11-27)
Minor release cut to relax various dependency pain-points caused by the last release being more than 4 months ago. (I intend to make a major release in the near future with a migration from monads to applicative functors, but this depends on enough free time being available.)
Travesty now expects Dune 2.0 to build. This is technically a breaking change, but I felt that bumping to 0.7 at this stage of Travesty's lifecycle would give the wrong impression.
Travesty now lets itself be built with v0.13 of the Jane Street packages.
Travesty now lets itself be built with OCaml v4.09.
Minor code formatting changes.
v0.6.0 (2019-06-25)
Major release with various breaking changes and new features, the main one being bi-traversables.
Breaking changes
Most module signatures have moved from
XYZ
toXYZ_types
. For example,Bi_mappable.S2
is nowBi_mappable_types.S2
. This is to eliminate the 'intf pattern' previously used in Travesty.Removed
Travesty_core_kernel_exts
. UseTravesty_base_exts
instead.Made
Bi_mappable.Make2
's return module type use sharing constraints instead of destructive substitutions. This may cause shadowing where there previously wasn't any.
Bi_traversable
This release adds a Bi_traversable
module---effectively being to Traversable
as Bi_mappable
is to Mappable
.
Alist
, Tuple2
, and Or_error
now expose Bi_traversable.S2
, which subsumes their previous interface.
Biffs
This release also adds the ability to compose Mappable
s on the inside of Bi_mappable
s (and Traversables
on the inside of Bi_traversables
): what is often referred to as a 'biff' in the quirky world of Haskell. This complements the ability to compose them on the outside (a 'tannen').
Minor improvements
Removed spurious dependencies that caused travesty to be unavailable on OCaml 4.08.
Bi_mappable
arity-1 chaining functors now carry previously-missing sharing constraints equating their fixed types with those of their bi-mappable ancestor.Added experimental F#-style
>>
operator inTravesty_base_exts.Fn.Compose_syntax
.Added bi-traversable instance for
Result
, from whichOr_error
now inherits.
v0.5.1 (2019-05-10)
As is becoming tradition, fixes a minor documentation comment caught between tagging on GitHub and publishing on OPAM. See the main changelog for details about what changed in v0.5.0.
v0.5.0 (2019-05-10)
Major release with new features and breaking changes, especially to module names and structures.
Breaking changes
See also the changes for v0.4.x
, as that version didn't reach OPAM.
Extension modules
In a partial reversal of changes done in v0.4.x
, the Travesty_base_exts
and Travesty_core_kernel_exts
modules no longer re-export the Base
and Core_kernel
modules on which they are based.
This means that any code using these extensions will need to open both original and extension modules (for example, by opening Travesty_base_exts
as Tx
and using Tx.List
when Travesty extensions are needed.
This change avoids a large amount of coupling, inefficiency, and possible legal issues caused by including swathes of third party libraries.
Traversable module renaming
The functors, and signatures in Traversable
have been renamed drastically to make them more consistent, and provide a better distinction between 'in-monad' and 'out-of-monad' signatures:
SX
is nowBasicX_on_monad
, to reflect that it only refers to the basic innerOn_monad
part of a traversable;Generic
is nowGeneric_basic_on_monad
, as per the above;On_monad1
is nowS1_on_monad
. There is noS0_on_monad
yet, but this may change.SX_container
is now justSX
, as it forms the main output of theTraversable
functors;GenericX_container
is now justGenericX
, to follow suit;BasicX
is unchanged;Basic_containerX
is nowBasicX_container
;Extend_containerX
is nowMakeX_container
(as it makes anSX
from aBasicX_container
);Make_containerX
is nowMakeX
(as it transforms aBasicX
).
### Bi_mappable module renaming
Similarly, Bi_mappable
's functors and signatures have been renamed:
SX_with_extensions
is now justSX
;The various
Extensions
modules no longer exist;The
Extend
functors are nowMake
functors.
Other
Traversable.S1
no longer carriesWith_elt
. This is now a separate functor inTraversable
calledFix_elt
.The various
Bi_mappable.Extensions
signatures no longer carryFix_left
,Fix_right
,Map_left
, andMap_right
. These are now separate functors, and don't apply the extensions by default.See
when_m
andunless_m
below: these now have an optional argument, which may cause breakage in rare situations.Various modules and functor targets that previously substituted destructively now output sharing constraints. This means that, this side of OCaml 4.08, you may need to wrap some functor results in a
module type of X with type t := t
stanza. This is to make it easier to chain together such modules.
New features
Bi_mappable
New functors for fixing left and right types, as well as converting bi-mappables to mappables by focusing on one type. These replace the modules previously generated by
Bi_mappable.Extensions
.Added several more composition functors.
Conversion functors no longer destructively substitute.
Extended Option
Now includes
Monad_exts
.
Extended Or_error
Now a bi-mappable type.
Monad_exts
M.when_m
andM.unless_m
now take an optional parameter?otherwise
, which allows generalising the application ofM.return
when the condition doesn't hold.New functions
M.map_when_m
andM.map_unless_m
, which generalisewhen_m
andunless_m
to take an arbitrary'a
(and pass it to~f
).New functions
then_m
and>>
, which act as Haskell's>>
(then) operator.New functions
compose_m
and>=>
, which act as Haskell's>=>
(Kleisli composition) operator.
v0.4.1 (2019-05-07)
Minor documentation fixup release. No other changes since v0.4.0. (Not released on OPAM.)
v0.4.0 (2019-05-07)
Major release with incompatible name and library division changes. (Not released on OPAM.)
Breaking changes
The main change in this release is that all 'extension' modules (T_xyz
) have been renamed or moved into subpackages of Travesty
:
Singleton
now lives inTravesty_containers
.T_monad
andT_container
have changed toMonad_exts
andContainer_exts
;Every other
T_
module now lives in eitherTravesty_base_exts
orTravesty_core_kernel_exts
, and no longer has theT_
suffix.Modules in
Base_exts
depend on, and extend, theBase
version of their namesake module.Modules in
Core_kernel_exts
depend on, and extend, theCore_kernel
version of their namesake module. Usually, they do so by importing the extensions from theBase_exts
version on top of an import of theCore_kernel
baseline module.
Other breaking changes:
Fn.on
now takes its second argument with the label~f
.
New features
This release contains a large amount of 'small' new features. Most of these are of minor extensions and convenience functions on top of Base
and Core_kernel
Submodule split: Travesty-unique containers are now in
Travesty_containers
(dune:travesty.containers
); extensions to Base containers are inTravesty_base_exts
(travesty.base_exts
); similar extensions to Core_kernel containers are inTravesty_core_kernel_exts
.Add
Monad_exts.tee
, which is a counterpart totee_m
that accepts a non-monadic function. (This is somewhat less useful, but still helps in terms of slotting, say, debug printing into a monadic pipeline.)Extensions: add
Or_error.combine_map[_unit]
, which are shorthand for mapping followed bycombine_errors[_unit]
. These should be used instead ofmap_m
anditer_m
when using lists andOr_error
.Extensions: add
Tuple2
, an extendedCore_kernel.Tuple2
adding bi-mappability.Add chaining for arity-2 bi-mappable containers across arity-1 mappable containers. We now implement
Alist
's bi-mappable interface using this andTuple2
.Fn
: addalways
, which behaves likeconst true
; andnever
, which behaves asconst false
.Alist
: addcompose
, which is the relational composition on two associative lists.Travesty_containers.Zipper
: implementations of list zippers (imported fromact
, and subject to change).List
extensions: addedWith_errors.replace_m
,replace
, andinsert
functions (imported fromact
, and subject to change). Future versions may generalisereplace_m
to act on any monad.List.Assoc
in the extension modules is now an alias forAlist
, bringing the bifunctor extensions into scope there.
Other
Bi_mappable
:Fix_left
andFix_right
's signatures no longer destructively substitutet
, soAlist.Fix_left(String).t
should now work.
v0.3.0 (2019-03-03)
Major release with incompatible dependency and name changes.
Breaking changes
Now targeting v0.12 of Jane Street's upstream libraries. This release of travesty no longer supports v0.11.
As a result, travesty no longer supports OCaml 4.06; please use 4.07+.
Traversable signature names have changed:
Basic_container0
is nowBasic0
, andBasic_container1
is nowBasic1
. The original names are now used for stronger interfaces that include implementations ofContainer.S*
; see 'new features' below for information.
New features
Add
T_container.Extensions0
andExtend0
, which generalise most ofExtensions1
/Extend1
to arity-0 containers.Generalise
T_container
's predicate extensions (any
/all
/none
) over arity-0 containers, provided that theirelt
isx -> bool
for somex
.Add
Bi_mappable
, an implementation of bifunctors.Add
T_alist
, an extended form ofList.Assoc
.Split the Traversable container functors into two kinds: the
Make_container*
functors now takeBasic*
signatures (but are otherwise the same---they still produce their ownContainer.S*
instances); the newExtend_container*
functors take the now-strongerBasic_container*
signatures, which include custom implementations ofContainer.S*
, and use those instead. The idea is thatMake
is for building new containers from traversals, andExtend
is for adding traversals to existing containers.
Other
T_list
andT_option
now useExtend_container1
internally: the upshot of this is that they re-use the existing Core implementations of container operations where possible, rather than (slowly) re-building them usingfold_m
.
v0.2.0 (2018-12-23)
Major release.
Breaking changes
Potentially breaking change:
Traversable.S0_container
now containsmodule Elt : Equal.S
, and constrainstype elt
to be equal toElt.t
. This reflects the situation inBasic_container0
, and shouldn't break any code usingMake_container0
, but may cause custom-built modules to fail to type-check.T_container.any
's arguments have swapped order, to be more in line withCore
idioms.
New features
Add
Traversable.Chain0
, a functor for combining twoS0_container
instances together for nested traversal.Add
T_fn.disj
to go withT_fn.conj
.Add
Filter_mappable
, which generalisesList.filter_map
.Add
tee_m
to monad extensions. This is a small wrapper overf x >>| fun () -> x
that allows unit-returning monadic side-effects to be treated as part of a monad pipeline.Add
T_or_error
: monad extensions forCore.Or_error
.one
andtwo
are now implemented onT_container
, not justT_list
. The errors are slightly less precise, but otherwise nothing has changed.Add
T_container.at_most_one
to complementone
andtwo
.Add
Monad.To_mappable
, which makes sure that monads can be converted to mappables.Add
T_container.all
andnone
, to complementany
.
Other
Improve API documentation.
v0.1.3 (2018-12-13)
Bugfix release.
Fix incorrect module name (was
Lib
, notTravesty
).Restrict to OCaml v4.06+ (this was the case in the final v0.1.2 OPAM release, but not upstream).
v0.1.2 (2018-12-12)
Bugfix and minor improvement release.
Improve API documentation.
Move functors and concrete modules out of
Intf
files.Generally rationalise the interface ready for a public release.
Add various container modules from
act
:Singleton
,T_list
, andT_option
.
v0.1.1 (2018-12-10)
Bugfix release.
Move API documentation, in an attempt to get
dune-release
to work.
v0.1 (2018-12-10)
Initial release.
Existing functionality migrated from act
's utils directory.