Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Fold1 pattern synonym & utilities #212

Merged
merged 6 commits into from
Aug 29, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Document basic Control.Foldl.NonEmpty usage
  • Loading branch information
Topsii committed Aug 28, 2024
commit f5d82263cfd1d6df8fe87705d7a85a1fecb7c1d5
10 changes: 10 additions & 0 deletions src/Control/Foldl/NonEmpty.hs
Original file line number Diff line number Diff line change
@@ -13,6 +13,16 @@
which can make use of the non-empty input guarantee (e.g. `head`). For
all other utilities you can convert them from the equivalent `Fold` using
`fromFold`.

Import this module qualified to avoid clashing with the Prelude:

>>> import qualified Control.Foldl.NonEmpty as Foldl1

Use 'fold1' to apply a 'Fold1' to a non-empty list:

>>> Foldl1.fold1 Foldl1.last (1 :| [2..10])
10

-}

module Control.Foldl.NonEmpty (
2 changes: 1 addition & 1 deletion test/doctest.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Test.DocTest

main :: IO ()
main = doctest ["-isrc", "src/Control/Foldl.hs", "src/Control/Scanl.hs"]
main = doctest ["-isrc", "src/Control/Foldl/NonEmpty.hs", "src/Control/Foldl.hs", "src/Control/Scanl.hs"]