-
Notifications
You must be signed in to change notification settings - Fork 22
Add support for chainRec #35
Comments
@rjmk I'm reading the spec for 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 I have read the relevant issues in fantasy-land (fantasyland/fantasy-land#151, fantasyland/fantasy-land#152) and the best explanation is this comment fantasyland/fantasy-land#152 (comment). Now I understand the benefits of not depending on a particular implementation of Since cc @rpominov |
I think initially the idea of fantasy-land was to provide specification for type classes and not for concrete types. Maybe you're right and it would be a good idea to add specifications for concrete types like |
It was my guess too. And it worked well, as long as the definitions don't involve concrete types. But class Unfoldable t where
unfoldr :: forall a b. (b -> Maybe (Tuple a b)) -> b -> t a Moreover it's a shame that we have great libraries out there for
Yeah, good idea. I'll do a deeper search in the fantasy-land repo before submitting. |
@rpominov actually when I first encountered static-land my first thought was that it was strictly more expressive than fantasy-land. For example I don't see how to encode in fantasy-land the following two monoids
without modifying the TL;DR static-land ❤️ |
Yea, I also think that static-land can be more expressive. But when it comes to changes like introducing new algebras and such it just feels too scary for me to diverse from fantasy-land, because I'm still learning and have little experience with all this stuff to be honest. Also another benefit of having two spec match close to each other is that when people learn one of them they automatically learn the other. |
@rjmk I'm not convinced by the signature in the specification, for the moment I'm going to support the PureScript signature class Monad m <= MonadRec m where
tailRecM :: forall a b. (a -> m (Either a b)) -> a -> m b |
https://github.com/rpominov/static-land/blob/master/docs/spec.md#chainrec
The text was updated successfully, but these errors were encountered: