DrBoolean / freeky

Free monad Collection
MIT License
176 stars 15 forks source link

Interpret is unsafe. #11

Open SimonRichardson opened 8 years ago

SimonRichardson commented 8 years ago

The following code is unsafe and should be made safe to prevent runtime errors.

const interpreter = find(pairs, xs => // [type, interpreter]
        instruction_of_arg.constructor === xs[0])[1]

Find should return a Maybe and then fold over the result.

DrBoolean commented 8 years ago

Thanks @SimonRichardson That's a good call. I didn't know daggy was still being updated. i'll get to fixing these things for sure