@classmethod
    def make_instance(typeclass, cls, toEnum, fromEnum):
        def succ(a):
            return toEnum(fromEnum(a) + 1)

        def pred(a):
            return toEnum(fromEnum(a) - 1)

        def enumFromThen(start, second):
            pointer = fromEnum(start)
            step = fromEnum(second) - pointer
            while True:
                yield toEnum(pointer)
                pointer += step

        def enumFrom(start):
            return enumFromThen(start, succ(start))

        def enumFromThenTo(start, second, end):
            if start == end:
                yield start
                return

            elif (second >= start > end) or (second <= start < end):
                return

            pointer, stop = fromEnum(start), fromEnum(end)
            step = fromEnum(second) - pointer
            while (start < end and pointer <= stop) or \
                  (start > end and pointer >= stop):
                yield toEnum(pointer)
                pointer += step
            return

        def enumFromTo(start, end):
            second = succ(start) if start < end else pred(start)
            return enumFromThenTo(start, second, end)

        attrs = {"toEnum": toEnum, "fromEnum": fromEnum, "succ": succ, "pred":
                 pred, "enumFromThen": enumFromThen, "enumFrom": enumFrom,
                 "enumFromThenTo": enumFromThenTo, "enumFromTo": enumFromTo}
        build_instance(Enum, cls, attrs)
        return
dataset/ETHPy150Open billpmurphy/hask/hask/lang/lazylist.py/Enum.make_instance/original