Skip to content

Commit

Permalink
Define concat in terms of foldr
Browse files Browse the repository at this point in the history
  • Loading branch information
LeventErkok committed Dec 6, 2024
1 parent 9e65346 commit edbad88
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions Data/SBV/List.hs
Original file line number Diff line number Diff line change
Expand Up @@ -536,13 +536,10 @@ zipWith f xs ys

-- | Concatenate list of lists.
--
-- NB. Concat is typically defined in terms of foldr. Here we prefer foldl, since the underlying solver
-- primitive is foldl: Otherwise, we'd induce an extra call to reverse.
--
-- >>> concat [[1..3::Integer], [4..7], [8..10]]
-- [1,2,3,4,5,6,7,8,9,10] :: [SInteger]
concat :: SymVal a => SList [a] -> SList a
concat = foldl (++) []
concat = foldr (++) []

-- | Check all elements satisfy the predicate.
--
Expand Down

0 comments on commit edbad88

Please sign in to comment.