This simple example can be a reference to adapt composable-functions to any other parser library.
There are two approaches to use composable-functions with a custom parser:
- Create an adapter function that will receive a schema and return a schema in the shape of a
ParserSchena
. Example: theadapt
function. - Create your custom
withSchema
andapplySchema
that will validate your input and environment and return aResult
. Example: thewithArkSchema
andapplyArkSchema
functions.
Check out the ./src
directory to understand how we implemented both approaches with arktype
.