Eq and Show instances for LogStr?
Closed this issue · 2 comments
debug-ito commented
Is there any particular reason why LogStr
is not instance of Eq
or Show
? If it was, it'd be handy for me to test them in my unit tests.
I think the main limitation is that Builder
is not Eq
or Show
. I suggest using fromLogStr
to implement them.
For example,
import qualified Data.ByteString.Char8 as BC
instance Show LogStr where
show = show . BC.unpack . fromLogStr
instance Eq LogStr where
a == b = (fromLogStr a) == (fromLogStr b)
kazu-yamamoto commented
The reason is that Builder
is not instance of Eq
nor Show
.
I don't have strong opinions about your suggestion.
If you really want that instances, please make a PR.
I think that parentheses are not necessary in instance Eq
.
debug-ito commented
OK, I'll make a PR.
Thanks for the comment!