Sha256: ea99fc7d901548dd965ad0cda538caecb891eb9281c72a562c38055e0c27c2a7

Contents?: true

Size: 712 Bytes

Versions: 1

Compression:

Stored size: 712 Bytes

Contents

require 'haskell/type_list'
require 'haskell/base'
require 'haskell/assert_arg_type'
require 'haskell/assert_rtn_type'

module Haskell; end

# New Class(Type)
class  Any;     end
module Boolean; end
TrueClass.send(:include, Boolean)
FalseClass.send(:include, Boolean)

class Module
  private
    def __haskell__
      prepend (@__haskell__ = Module.new) unless @__haskell__
      @__haskell__
    end

    def type(type_list, meth)
      __haskell__.send(:define_method, meth) do |*args, &block|
        ::Haskell::AssertArgType.execute(meth, args, type_list.args)
        rtn = super(*args, &block)
        ::Haskell::AssertRtnType.execute(meth, rtn, type_list.rtn)
        rtn
      end
      self
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
haskell-0.0.3 lib/haskell.rb