Proposal: specs for Maybe, Either, Tuple, Task, ...
See original GitHub issueSorry if it was discussed before, after scanning the issues I didn’t find anything on the subject.
The motivation comes from the last addition: the spec for chainRec
which I find hard to understand
chainRec :: ChainRec m => ((a -> c, b -> c, a) -> m c, a) -> m b
with respect to
class Monad m <= MonadRec m where
tailRecM :: forall a b. (a -> m (Either a b)) -> a -> m b
Relevant issues
- https://github.com/fantasyland/fantasy-land/issues/151
- https://github.com/fantasyland/fantasy-land/pull/152
I understand the benefits of not depending on a particular implementation of Either
but why fantasy-land doesn’t provide a spec for Either
in the first place?
For example writing the spec for Unfoldable
would be problematic (Maybe
AND Tuple
)
class Unfoldable t where
unfoldr :: forall a b. (b -> Maybe (Tuple a b)) -> b -> t a
We have great libraries out there for Maybe
, Either
, Task
, etc… but there’s no standard for them.
Would it be a good idea to add specs for these concrete types?
Issue Analytics
- State:
- Created 7 years ago
- Comments:61 (46 by maintainers)
Top Results From Across the Web
Proposal: Language support for Tuples #347 - GitHub
As mentioned, I propose to make tuple types structs rather than classes, so that no allocation penalty is associated with them. They should...
Read more >Write Pythonic and Clean Code With namedtuple - Real Python
Use namedtuple instances to write Pythonic code; Decide whether to use a namedtuple or a similar data structure; Subclass a namedtuple to provide...
Read more >PEP 622 – Structural Pattern Matching
We propose that destructuring objects can be customized by a new special __match_args__ attribute. As part of this PEP we specify the general...
Read more >Nullable reference types - C# 9.0 specification proposals
Every expression in a given source location has a null state, which indicated whether it is believed to potentially evaluate to null. The...
Read more >Automated replication of tuple spaces via static analysis
Coordination languages for tuple spaces can offer significant ... can be either local or remote, in the sense that they can be possibly...
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
@gcanti those data-types can be Church-encoded (pedantically, Boehm-Berarducci encoded, if we’re using types) meaning they can be represented as functions.
@robotlolita I’ve made some changes to #280 that would make interop very simple.
That being said, I think any specification is better than none.
Agreed. In fact, why have more than one ADT library? Currently we have:
And these are just the libraries in the Fantasy Land ecosystem. There seems to be a lot of duplicated effort.
@robotlolita a simple spec, as you mentioned above, could be implemented once using daggy (with contributions from all interested lib authors/maintainers).
I’ve noticed a lot of confusion amongst those new to FL concerning where they should get their data types. It creates an unnecessary barrier to entry for beginners and hurts the ecosystem as a whole.
I’m not saying every data type should come from this org, but the basic ones are so simple there’s no good reason to do so repeatedly.