package ppx_deriving_madcast
Library deriving cast functions based on their types
Install
Dune Dependency
Authors
Maintainers
Sources
v0.2.tar.gz
md5=bca83dbf5a6fb47ced07756c6cab1d9a
sha512=f2f604685649d8fc0c750adfb89d997ea62f2fd09f383dc38b4580fdbb7f96e45a637745f1f06aa1b529d6abcfea6691ef309eb32e423c780c2370aff4678950
doc/ppx_deriving_madcast.api/Madcast/index.html
Module Madcast
Source
Main access point
madcast ty
returns an annotated casting function of type ty
. ty
must be an arrow type.
- Raise
Invalid_argument "split_arrow"
ifty
is not an arrow type,
- Raise
NoCastFound
if no casting function can be derived,
- Raise
SeveralCastsFound
if more than one casting function can be derived and none of them has a stronger priority.
Exceptions
Exception raised when no cast can be derived for two types
Exception raised when more than cast can be derived for two types
Lower-level access points
Source
val find_caster :
Ppxlib.Parsetree.core_type ->
Ppxlib.Parsetree.core_type ->
Ppxlib.Parsetree.expression
Given an input type itype
and an output type otype
, returns a casting function of type itype -> otype
.
- Raise
NoCastFound
if no casting function can be derived,
- Raise
SeveralCastsFound
if more than one casting function can be derived and none of them has a stronger priority.
Source
val split_arrow :
Ppxlib.Parsetree.core_type ->
Ppxlib.Parsetree.core_type * Ppxlib.Parsetree.core_type
split_arrow ty
returns the domain and co-domain of an arrow type.
- Raise
Invalid_argument "split_arrow"
ifty
is not an arrow type
Source
val annotate :
Ppxlib.Parsetree.expression ->
Ppxlib.Parsetree.core_type ->
Ppxlib.Parsetree.expression
annotate expr ty
returns a let expression of the form let (e : ty) = expr in e
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page