-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Split off HFunctor
from HAp
#110
Comments
So probably, if we were to add our own
I'm not really opposed to this, but I'm wondering if it will end there ... In general, the classes in I'm not very happy with the overall situation, and I'd be willing to consider using more general-purpose type classes for higher-order variants of standard type classes instead. Just a cursory scan of Hackage reveals e.g. higher-order functors at least in the following places:
Some observations:
One way in which we could make our own classes be much closer to the classes used elsewhere would be by flipping the type arguments of
rather than
This would allow us to say that
I'm not sure if it's worth making such a drastic change though in order to clean up the internals. Anyway, to cut this short, I think it wouldn't do any harm to add an |
Yeah, I know that they weren't intended to be used by other types, but sometimes that does arise naturally. But perhaps this is indeed a bit of a quagmire (did I spell that right...? 🤔 ). The other one we might ponder is a I suspect that flipping the arguments will cause more pain than it solves? We don't need both And yes, I found that |
(Actually, it's |
The constrained and unconstrained variants are in principle derivable from each other, yes. Going from constrained to unconstrained is now the easier direction, especially since we now have that I'd only flip the arguments if we'd decide to do a big breaking release. I'd then be inclined to also rename Re
|
Yeah, we have -- | N-ary traversable functors
--
-- TODO: Don't provide Elem explicitly (just instantiate @c@)?
-- TODO: Introduce HTraverse into SOP?
class NTraversable (f :: (k -> Type) -> [k] -> Type) where
nctraverse :: (Applicative m, All c xs)
=> proxy c
-> (forall a. c a => Elem xs a -> g a -> m (h a))
-> f g xs -> m (f h xs) The |
@edsko are you looking for https://hackage.haskell.org/package/sop-core-0.5.0.0/docs/Data-SOP-Classes.html#t:HSequence ? class HAp h => HSequence (h :: (k -> Type) -> l -> Type) where
hctraverse'
:: (AllN h c xs, Applicative g)
=> proxy c -> (forall a. c a => f a -> g (f' a)) -> h f xs -> g (h f' xs) |
Oh! Yes, perhaps so 😳 |
Why do we have both? 🤔 |
Currently we only have a generalization of
HAp
(HApplicative
), and functions that could be defined in terms of a (hypothetical)HFunctor
class are defined in terms ofHAp
instead. This is fine for the SOP types, but it makes it impossible to declare some other types to be instances.The text was updated successfully, but these errors were encountered: