From 803a0a627fa91b00279486cbefb7263f3540f313 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Wed, 2 Oct 2024 02:10:02 +0100 Subject: workflow: Move coerce-type to (ravanan reader). * ravanan/workflow.scm (coerce-type): Move to ... * ravanan/reader.scm (coerce-type): ... here. --- ravanan/reader.scm | 14 +++++++++++++- ravanan/workflow.scm | 11 ----------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/ravanan/reader.scm b/ravanan/reader.scm index 69c9d55..6ca36bc 100644 --- a/ravanan/reader.scm +++ b/ravanan/reader.scm @@ -28,7 +28,8 @@ #:use-module (ravanan work utils) #:use-module (ravanan work vectors) #:export (read-workflow - read-inputs)) + read-inputs + coerce-type)) (define (preprocess-include tree) (cond @@ -269,3 +270,14 @@ each association list of the returned vector of association lists. If (call-with-input-file (basename inputs-file) json->scm) (read-yaml-file (basename inputs-file))))))) + +(define (coerce-type val type) + "Coerce @var{val} to @var{type}." + ;; This function exists to handle YAML's type ambiguities. + (case type + ((boolean) + (cond + ((member val (list "true" "yes")) #t) + ((member val (list "false" "no")) #f) + (else (error "Unable to coerce value to type" val type)))) + (else val))) diff --git a/ravanan/workflow.scm b/ravanan/workflow.scm index af720a8..989c711 100644 --- a/ravanan/workflow.scm +++ b/ravanan/workflow.scm @@ -157,17 +157,6 @@ requirements and hints of the step." (list (subset-requirements parent-hints) (subset-requirements step-hints))))))) -(define (coerce-type val type) - "Coerce @var{val} to @var{type}." - ;; This function exists to handle YAML's type ambiguities. - (case type - ((boolean) - (cond - ((member val (list "true" "yes")) #t) - ((member val (list "false" "no")) #f) - (else (error "Unable to coerce value to type" val type)))) - (else val))) - (define (optional-input? input) "Return @code{#t} if @var{input} is optional. Else, return @code{#f}." ;; Inputs that either have a default or accept null values are optional. -- cgit v1.2.3