Skip to content

Commit

Permalink
keeping manual definition of joinTR
Browse files Browse the repository at this point in the history
  • Loading branch information
kaelte committed Feb 5, 2025
1 parent 3ff04a5 commit 5bf0eef
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Solutions/Folds.idr
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,15 @@ bindTR xs f = go Lin xs
go sx (x :: xs) = go (sx <>< f x) xs

joinTR : List (List a) -> List a
joinTR xss = bindTR xss id
joinTR = go Lin
where go : SnocList a -> List (List a) -> List a
go sx [] = sx <>> Nil
go sx (x :: xs) = go (sx <>< x) xs

-- Or using the connection between join and bind:
-- joinTR xss = bindTR xss id
-- This is also a tail recursive implementation as
-- bindTR is tail recursive

--------------------------------------------------------------------------------
-- A few Notes on Totality Checking
Expand Down

0 comments on commit 5bf0eef

Please sign in to comment.