You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
moduleMain (main) whereimportPreludehiding ((<>))
importText.PrettyPrintmain::IO()
main =dolet s1 = text "if:"$+$ nest 4 (text "pass")
let s2 = text "if:\n pass"let f = (text "x"<>)
--not following Eq's Substitutivity 'law':--first is True but second is Falseprint$ s1 == s2
print$ f s1 == f s2
--examine the values visually:print$ s1
print$ s2
print$ f s1
print$ f s2
--outputs the following (note extra space in the 3rd):-- if:-- pass-- if:-- pass-- xif:-- pass-- xif:-- pass
If this is not the intended behavior of the various functions involved (<>, $+$, nest, ==), then there is a bug that should be fixed. If this is the intended behavior, then the documentation on Eq should alert the reader to the fact that the Substitutivity Law is not followed.
The text was updated successfully, but these errors were encountered:
It could be documented that Eq instance witnesses equivalence (==) `on` render, thus for most combinators in the library substitutivity indeed doesn't hold.
Consider the following code:
If this is not the intended behavior of the various functions involved (<>,$+$ , nest, ==), then there is a bug that should be fixed. If this is the intended behavior, then the documentation on Eq should alert the reader to the fact that the Substitutivity Law is not followed.
The text was updated successfully, but these errors were encountered: