package travesty
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=6096bfedbab2044c6372c918712bc5e71ffba5a373cdab37398787712c9c83af
sha512=a7a1cd7981af2c16111323cdf72ac6a45a5e58a3701376fdb3d7f3ee15fbf4003e71f94ad882ccea0d308bb229f3ac0b2c9861a231a498c22e44551f1fcf802d
CHANGES.md.html
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.