Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
GHC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
4,335
Issues
4,335
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
370
Merge Requests
370
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
57f65911
Commit
57f65911
authored
Oct 14, 2012
by
illissius
Committed by
ian@well-typed.com
Oct 27, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
alpha-rename the type signatures of foldl, foldl', and scanl to be consistent with foldr and scanr
parent
6f32757e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
8 deletions
+8
-8
libraries/base/Data/Foldable.hs
libraries/base/Data/Foldable.hs
+2
-2
libraries/base/Data/List.hs
libraries/base/Data/List.hs
+4
-4
libraries/base/GHC/List.lhs
libraries/base/GHC/List.lhs
+2
-2
No files found.
libraries/base/Data/Foldable.hs
View file @
57f65911
...
...
@@ -132,14 +132,14 @@ class Foldable t where
-- | Left-associative fold of a structure.
--
-- @'foldl' f z = 'Prelude.foldl' f z . 'toList'@
foldl
::
(
a
->
b
->
a
)
->
a
->
t
b
->
a
foldl
::
(
b
->
a
->
b
)
->
b
->
t
a
->
b
foldl
f
z
t
=
appEndo
(
getDual
(
foldMap
(
Dual
.
Endo
.
flip
f
)
t
))
z
-- | Left-associative fold of a structure.
-- but with strict application of the operator.
--
-- @'foldl' f z = 'List.foldl'' f z . 'toList'@
foldl'
::
(
a
->
b
->
a
)
->
a
->
t
b
->
a
foldl'
::
(
b
->
a
->
b
)
->
b
->
t
a
->
b
foldl'
f
z0
xs
=
foldr
f'
id
xs
z0
where
f'
x
k
z
=
k
$!
f
z
x
...
...
libraries/base/Data/List.hs
View file @
57f65911
...
...
@@ -45,8 +45,8 @@ module Data.List
-- * Reducing lists (folds)
,
foldl
-- :: (
a -> b -> a) -> a -> [b] -> a
,
foldl'
-- :: (
a -> b -> a) -> a -> [b] -> a
,
foldl
-- :: (
b -> a -> b) -> b -> [a] -> b
,
foldl'
-- :: (
b -> a -> b) -> b -> [a] -> b
,
foldl1
-- :: (a -> a -> a) -> [a] -> a
,
foldl1'
-- :: (a -> a -> a) -> [a] -> a
,
foldr
-- :: (a -> b -> b) -> b -> [a] -> b
...
...
@@ -68,7 +68,7 @@ module Data.List
-- * Building lists
-- ** Scans
,
scanl
-- :: (
a -> b -> a) -> a -> [b] -> [a
]
,
scanl
-- :: (
b -> a -> b) -> b -> [a] -> [b
]
,
scanl1
-- :: (a -> a -> a) -> [a] -> [a]
,
scanr
-- :: (a -> b -> b) -> b -> [a] -> [b]
,
scanr1
-- :: (a -> a -> a) -> [a] -> [a]
...
...
@@ -1004,7 +1004,7 @@ unfoldr f b =
-- -----------------------------------------------------------------------------
-- | A strict version of 'foldl'.
foldl'
::
(
a
->
b
->
a
)
->
a
->
[
b
]
->
a
foldl'
::
(
b
->
a
->
b
)
->
b
->
[
a
]
->
b
#
ifdef
__GLASGOW_HASKELL__
foldl'
f
z0
xs0
=
lgo
z0
xs0
where
lgo
z
[]
=
z
...
...
libraries/base/GHC/List.lhs
View file @
57f65911
...
...
@@ -166,7 +166,7 @@ filterFB c p x r | p x = x `c` r
-- can be inlined, and then (often) strictness-analysed,
-- and hence the classic space leak on foldl (+) 0 xs
foldl :: (
a -> b -> a) -> a -> [b] -> a
foldl :: (
b -> a -> b) -> b -> [a] -> b
foldl f z0 xs0 = lgo z0 xs0
where
lgo z [] = z
...
...
@@ -181,7 +181,7 @@ foldl f z0 xs0 = lgo z0 xs0
--
-- > last (scanl f z xs) == foldl f z xs.
scanl :: (
a -> b -> a) -> a -> [b] -> [a
]
scanl :: (
b -> a -> b) -> b -> [a] -> [b
]
scanl f q ls = q : (case ls of
[] -> []
x:xs -> scanl f (f q x) xs)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment