twittner/snap-predicates — pull request #2 by romanb (2013-09-22 09:08:08+00:00)
Title: Preserve error messages from Readable instances.

The current implementation uses 'fromBS' within the Maybe monad whose implementation of 'fail' discards all error messages, leaving always the much less helpful "no read", which is especially surprising when implementing your own data types for use in predicate handlers where you are trying to create helpful error messages from within the Readable instance implementation for that type - no matter what you always end up with "no read" and your own messages are discarded.

This change uses 'fromBS' within a specialized Either monad that preserves the error messages produced in 'fail' and behaves otherwise identically. It might not be the best way to implement this, however, I hope at least it illustrates the problem well.