sequence in haskell
See original GitHub issuethe type signature of sequence in Haskell is
sequence :: (Monad m, Traversable t) => t (m a) -> m (t a)
so I could have sequence [Left 4, Right 5] => Left 4
and sequence [Right 6, Right 9] => Right [6,9]
Is there an equivalent in sanctuary? I’ve been scanning libraries that implement the fantasy-land spec, none of them seem to have this (so far)
Edit : I understand it can be implemented as such (atleast for my task at hand)
x => S.reduce(S.lift2(S.C(S.append)),S.Right([]),x)
, was wondering why something as such is missing
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Data.Sequence - Hackage - Haskell.org
The Seq a type represents a finite sequence of values of type a . Sequences generally behave very much like lists. The class...
Read more >Sequences - Monday Morning Haskell
Haskell's Sequence type is your go-to for double-ended queue operations. They are comparable to linked lists in other languages, with a few performance ......
Read more >Sequences — containers 0.5.10.2 documentation
Sequences allow you to store a finite number of sequential elements, providing fast access to both ends of the sequence as well as...
Read more >Why does application of `sequence` on List of Lists lead to ...
I noticed that applying sequence on List of List s gives its Cartesian Product. Can someone please help me understand how/why this happens?...
Read more >Haskell 'sequence' Over Functions - Explained - Flarfnoogins
Haskell 'sequence' Over Functions - Explained ... A look into how Haskell's Applicative's work. We'll dissect it, along with how it works with...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Here are the Sanctuary equivalents of your Haskell expressions, @functor-soup, on the
dc-fantasy-land
branch:I’ll close this issue as I believe we’ve answered your question. 😃