-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More functions from base-4.7.0.0 and base-4.8.0.0 #30
Conversation
describe "showFFloatAlt" $ | ||
it "shows a RealFloat value, always using decimal notation" $ do | ||
showFFloatAlt Nothing (12 :: Double) "" `shouldBe` "12.0" | ||
showFFloatAlt (Just 4) (12 :: Double) "" `shouldBe` "12.0000" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following "one assertion per test", this should be two test cases. In this particular case I think it's even more natural to do so:
it "shows a RealFloat value, always using decimal notation" $ do
showFFloatAlt Nothing (12 :: Double) "" `shouldBe` "12.0"
it "allows to specify the decimal places" $ do
showFFloatAlt (Just 4) (12 :: Double) "" `shouldBe` "12.0000"
Regarding As I understand it there was no "bug" with For While providing definitions that were added in a later version of base is always safe from my perspective. The issue I have with redefining things is that users can run into name clashes. So I would only do it if we have a strong case for it. I assume all the other changes are additions, right? They are fine with me. |
Of course, as we already redefine half of |
I would consider the change to I don't really see redefined functions in |
@RyanGlScott As we already have most of When it comes to whether this change was driven by practical demand, I think I disagree. As I understand it the ticket / bug report was the result of a theoretical discussion on IRC. I could be wrong, and I'm not saying there could not possibly be a practical case where this matters. But I still think |
More functions from base-4.7.0.0 and base-4.8.0.0
Regarding my point about the example / bug for
|
@RyanGlScott And I still think there is no good reason to redefine |
There are differences in behavior for the two versions of data Asymmetric = A | B deriving Show
instance Eq Asymmetric where
A == _ = True
B == _ = False
main :: IO ()
main = do
print $ nub [A, B]
print $ nubBy (<) "12"
print $ union [A] [A, B]
print $ unionBy (<) "1" "21" you'd get:
whereas in
You're right that none of these examples use equivalence relations, but they are discrepancies nonetheless. |
I implemented some low-hanging fruit from #24:
bitDefault
,testBitDefault
, andpopCountDefault
inData.Bits.Compat
to all versions ofbase
toIntegralSized
to onlybase-4.7
(since it is implemented in terms ofbitSizeMaybe
)nub
andnubBy
(as well asunion
andunionBy
, which are implemented in terms of them) to fix a logic errorbyteSwap16
,byteSwap32
, andbyteSwap64
toData.Word.Compat
fillBytes
inForeign.Marshal.Utils.Compat
showFFloatAlt
andshowGFloatAlt
toNumeric.Compat