diff options
Diffstat (limited to 'data/functor.scm')
-rw-r--r-- | data/functor.scm | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/data/functor.scm b/data/functor.scm new file mode 100644 index 0000000..2286337 --- /dev/null +++ b/data/functor.scm @@ -0,0 +1,14 @@ +(define-module (data functor) + #:use-module (oop goops) + #:use-module (srfi srfi-1) + #:export (fmap <$>)) + +;;; We don't overwrite the default map since that creates way to many +;;; namespace problems. + +(define-generic fmap) +(define <$> fmap) + +;;; Default fallback for fmap is regular (srfi-1) map. +(define-method (fmap f . lists) + (apply map f lists)) |