Closed waynee95 closed 5 years ago
Sure, I will add the tests! I was wondering why there were no tests in the test directory, but doctests explain it! Never seen that before, but it's cool.
I have a question. What does the __
mean here? And why is there only two >>
?
>> __splitAt 2 $ 'infiniteSlist' [1..]__
Maybe I missed something on the docu site of doctest.
Oh, yeah, I also find doctests crucial in keeping docs up to date!
This particular example is not the doctest, you can notice that it surrounded by @
s and considered only as a code block. The reason is that we can not really test it with the infinite lists (we won't be able to show
it in the terminal). And __
here is just Haddock syntax for bold text, so it for visual effects only :slightly_smiling_face:
Oh right! Okay, gonna add the tests and genericAt
.
@vrom911 I added tests for the generic functions. So far the tests are similar to the non-generic ones. Should I also add test cases for passing arguments either as Int
or Integer
explicitly? :thinking:
Should I also add test cases for passing arguments either as Int or Integer explicitly? thinking
No, due to monomorphism restriction current tests are already for Integer so no need to add more tests. It's now cool, great job :1st_place_medal:
In general, wouldn't there be an issue when i
is of type Integer
and we cast it to Int
, because Integer
can be much bigger?
Yes, I agree that fromInteger
is not always a safe thing to do, as you mentioned. But here we are limited by the fact that Size
stores Int
by design and this was done assuming that usually people don't work with such huge lists, it's either in the range of Int
or infinite. So, it's okay to do it this way :slightly_smiling_face:
@vrom911 First time using languages extensions/view patterns. It's kinda neat though. Did I do it correctly? :sweat_smile:
I misclicked on my phone :laughing:
Resolves #6
genericTake
differs syntactically fromtake
for Slist. Personally, I liked this more. If it should be consistent, I can change it to fit the style oftake
.