From c2c333de8add734c5046c7cf2bf97e9bf8799617 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Mon, 28 Jan 2013 23:39:21 +0100 Subject: Add the 'function' constraint --- guide/routing.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'guide/routing.md') diff --git a/guide/routing.md b/guide/routing.md index 659b27d..9d5c5af 100644 --- a/guide/routing.md +++ b/guide/routing.md @@ -207,7 +207,7 @@ name, and the optional third element is the constraint's arguments. The following constraints are currently defined: * {Name, int} - * {Name, function, (fun(Value) -> true | {true, NewValue} | false)} + * {Name, function, fun ((Value) -> true | {true, NewValue} | false)} The `int` constraint will check if the binding is a binary string representing an integer, and if it is, will convert the value to integer. @@ -215,6 +215,7 @@ representing an integer, and if it is, will convert the value to integer. The `function` constraint will pass the binding value to a user specified function that receives the binary value as its only argument and must return whether it fulfills the constraint, optionally modifying the value. +The value thus returned can be of any type. Note that constraint functions SHOULD be pure and MUST NOT crash. -- cgit v1.2.3