@Jean_Safar I think you can do something along the lines of Functions - Can we pass them as arguments in a choice? then.
Suppose you have top-level (ie defined at module level) functions
f : Int -> Text -> Bool
g : Decimal -> Text -> Bool
You can define type
data MyFunction = F Int | G Decimal
deriving (Eq, Show)
and function
exec : MyFunction -> Text -> Bool
exec fn = case fn of
F i -> f i
G d -> g d
Now MyFunction
represents a function Text -> Bool
and you can put MyFunction
in your template. When you want to call the function fn : MyFunction
with argument t : Text
, you call exec fn t
.
Does this fit what you need to do? If not, where does it fall short?