Skip to content

Instantly share code, notes, and snippets.

@onosendi
Created July 30, 2022 19:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save onosendi/134aa0439a9f1c188d59a297a97bf70c to your computer and use it in GitHub Desktop.
Save onosendi/134aa0439a9f1c188d59a297a97bf70c to your computer and use it in GitHub Desktop.
-- Eta reduce Found: foo2 xs = foldl (\ x acc -> acc + 1) 0 xs Why not: foo2 = foldl (\ x acc -> acc + 1) 0
length1 xs = foldl (\x acc -> acc + 1) 0 xs
-- Ambiguous type variable ‘t0’ arising from a use of ‘foldl’ revents the constraint ‘(Foldable t0)’ from being solved.
length2 = foldl (\x acc -> acc + 1) 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment