Skip to content

Instantly share code, notes, and snippets.

@JordanMartinez
Created August 8, 2022 17:06
Show Gist options
  • Save JordanMartinez/26968458c1261226b33e574128ba9aae to your computer and use it in GitHub Desktop.
Save JordanMartinez/26968458c1261226b33e574128ba9aae to your computer and use it in GitHub Desktop.
Array.groupBy unexpected behavior
module Main where
import Prelude
import Data.Array as A
import Effect (Effect)
import Effect.Class.Console (log)
import TryPureScript as TryPureScript
import Debug (spy)
main :: Effect Unit
main = TryPureScript.render =<< TryPureScript.withConsole do
log $ show $ useGroupBy
useGroupBy = [0, 1, 2, 3]
# spy "original Array"
# A.groupBy (\l r -> do
let _ = spy "l" l
let _ = spy "r" r
l + 1 == r
)
# spy "post groupBy"
-- Check the web console to see the values of `l` and `r`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment