diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2018-11-15 22:15:59 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2018-11-15 22:15:59 +0100 |
commit | bf25d5c2618ed9e8726f99872e9c823867a89086 (patch) | |
tree | 66724a2cb967c30cb7fd244f65d1f30812ab95d2 /data/functor.scm | |
parent | Change from constant to correct const. (diff) | |
download | scheme-monad-bf25d5c2618ed9e8726f99872e9c823867a89086.tar.gz scheme-monad-bf25d5c2618ed9e8726f99872e9c823867a89086.tar.xz |
Add functor concept.
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)) |