Soumik Sarkar

Results 40 comments of Soumik Sarkar

I doubt we can use `primitive`, since it's not a GHC boot library. We can make our own type for an `Int` array with limited operations if we really want....

Hi, I would like it if this were implemented (opt-in is also fine). I have situations where using `ScopedTypeVariables` would allow me to help GHC with type inference, which necessarily...

> An implementation that doesn't care to be properly lazy can achieve $O(n)$ easily Sure, I considered it a given that we want to preserve laziness. More specifically, we preserve...

That seems much simpler! It needs to be modified to support infinite lists however. I traced the OldList implementation to https://gitlab.haskell.org/ghc/ghc/-/issues/9345. This `take` version was considered (search for `initsT`) but...

> As demonstrated above, `foldlM'` can be obtained from `foldlM` by a correct choice of `f`. This is not true. Or rather, it is true only for some monads. Take...

@treeowl nice, that was a fun exercise to figure out how `Strictly` works. @tomjaguarpaw regarding `Strictly2`, it indeed seems to perform better. Your code is equivalent to ```hs foldlM_likeStrictly2' ::...

I suggest a couple of changes. ```diff compareLength :: [a] -> Int -> Ordering compareLength xs n | n < 0 = GT - | otherwise = foldr (\_ f...

Sure, * If we stop at `m == 0`, we have to look at one less element to conclude with a result. This is observable with an example like ```hs...

Looks good, thanks! I am wondering if it would be useful to `INLINE` `compareLength` for list fusion, but I am not convinced. Usually you would want to do something with...

Thanks, that answers the question! Please close this if there is nothing to be done about it.