summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/guile/skribilo/lib.scm17
-rw-r--r--src/guile/skribilo/utils/compat.scm12
2 files changed, 18 insertions, 11 deletions
diff --git a/src/guile/skribilo/lib.scm b/src/guile/skribilo/lib.scm
index d538253..21b2a4d 100644
--- a/src/guile/skribilo/lib.scm
+++ b/src/guile/skribilo/lib.scm
@@ -27,7 +27,7 @@
skribe-warning skribe-warning/ast
skribe-message
- %procedure-arity)
+ type-name %procedure-arity)
:export-syntax (new define-markup define-simple-markup
define-simple-container define-processor-markup)
@@ -146,6 +146,21 @@
(options (the-options opts)))))
+
+;;;
+;;; TYPE-NAME
+;;;
+(define (type-name obj)
+ (cond ((string? obj) "string")
+ ((ast? obj) "ast")
+ ((list? obj) "list")
+ ((pair? obj) "pair")
+ ((number? obj) "number")
+ ((char? obj) "character")
+ ((keyword? obj) "keyword")
+ (else (with-output-to-string
+ (lambda () (write obj))))))
+
;;;
;;; SKRIBE-EVAL-LOCATION ...
;;;
diff --git a/src/guile/skribilo/utils/compat.scm b/src/guile/skribilo/utils/compat.scm
index 9032bcf..c8c3bd0 100644
--- a/src/guile/skribilo/utils/compat.scm
+++ b/src/guile/skribilo/utils/compat.scm
@@ -32,6 +32,7 @@
:autoload (skribilo ast) (ast?)
:autoload (skribilo condition) (file-search-error? &file-search-error)
:autoload (skribilo reader) (make-reader)
+ :autoload (skribilo lib) (type-name)
:use-module (skribilo debug)
:re-export (file-size) ;; re-exported from `(skribilo utils files)'
:replace (gensym))
@@ -252,16 +253,7 @@
(hash-map->list (lambda (key val) val) h))
(define-public (find-runtime-type obj)
- (cond ((string? obj) "string")
- ((ast? obj) "ast")
- ((list? obj) "list")
- ((pair? obj) "pair")
- ((number? obj) "number")
- ((char? obj) "character")
- ((keyword? obj) "keyword")
- (else (with-output-to-string
- (lambda () (write obj))))))
-
+ (type-name obj))
;;;