Commits

Anonymous committed a97068b

Fix the definition of monadic zeros.

  • Participants
  • Parent commits 0ae3767

Comments (0)

Files changed (1)

File lib/tweed/monad.rb

         define_method(:bind, &capture[:bind]) unless capture[:bind].nil?
         self.singleton_class.instance_eval do
           define_method(:return, &capture[:unit]) unless capture[:unit].nil?
-          define_method(:zero) { @zero ||= capture[:zero].call } unless capture[:zero].nil?
+          unless capture[:zero].nil?
+            define_method(:get_zero, &capture[:zero])
+            private(:get_zero)
+            define_method(:zero) { @zero ||= get_zero }
+          end
         end
       end