Added a null,singleton,uncons,takeWhile and dropWhile to Data.String#18
Conversation
There was a problem hiding this comment.
This line should have a semicolon.
There was a problem hiding this comment.
Didn't know that semicolons are nessesary after function definitions in JS. Thanks.
There was a problem hiding this comment.
Semicolons are not necessary in most cases, due to automatic semicolon insertion, but we might as well output "correct" code. Also, to clarify, a function statement (as used to define takeWhile above, for example) should not be terminated by a semicolon, whereas a function expression (as used to define the return value of takeWhile) should be.
There was a problem hiding this comment.
Purescript seems to generate semicolons after foreign function statements anyway.
There was a problem hiding this comment.
These will not work with dead code elimination turned on. drop might be removed. It would be better to pass a reference to the drop function as a function argument. The same applies to takeWhile.
There was a problem hiding this comment.
Better than that might be to just slice it.
|
What would be the best way to add foldl/foldr? |
Added a null,singleton,uncons,takeWhile and dropWhile to Data.String
|
Thanks! I think |
Added a null,singleton,uncons,takeWhile and dropWhile to Data.String.
I made the takeWhile and dropWhile functions foreign to avoid the unpacking overhead.