-
Notifications
You must be signed in to change notification settings - Fork 15
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
Couple things that might be useful to have #39
Comments
I considered something like For |
@jcpetruzza That makes sense at a high level, but I haven't been able to make it work. I think the relevant newtype is You can instead make it work with something like this as the primitive operation: bhead :: b f -> Some b or even: brefute :: b VoidF -> Void But this is a bit more mysterious for an implementor. |
I think I wasn't really very clear, sorry! What I meant is that since " newtype CantUsePure f a = CantUsePure (f a)
deriving newtype Functor
instance Apply f => Applicative (CantUsePure f) where
pure = error "Can't use pure!"
CantUsePure f <*> CantUsePure x = CantUsePure (f <.> x)
btraverse1
:: (TraversableB b, Apply e)
=> (forall a . f a -> e (g a))
-> b f
-> e (b g)
btraverse1 h
= coerce . btraverse (CantUsePure . h) Of course, one shouldn't export I think I rather not introduce a dependency just for this type of functions; |
@jcpetruzza The main issue as I understand it is that the quality of "not using Of course we can just use the |
You are correct, if you have something that is an
|
On further thought, data Unit (f :: k -> Type) = Unit or, more in general, for any type with constructors where |
@jcpetruzza Yes, exactly. This is why you would want
Things are a bit confusing here because the relationship between |
FYI barbies-th provides an equivalent It would be great to have this in barbies so that barbies-th focus on the Template Haskell part |
@fumieval FWIW i've revised my position on the "bag of lenses" class. I now believe that what we want is the class of HKDs that are products. A naive encoding of this is pretty straightforward: type HKD k = (k -> Type) -> Type
type HList :: [k] -> HKD k
data HList xs f
where
HNil :: HList '[] f
HCons :: f x -> HList xs f -> HList (x ': xs) f
type ProductB :: HKD k -> Constraint
class ProductB (b :: HKD k)
where
type Components b :: [k]
to :: b f -> HList (Components b) f
from :: HList (Components b) f
-- Laws:
-- to . from = id
-- from . to = id I believe this would subsume |
Hello there. I was wondering if you'd be amenable to adding the following classes (and ways of deriving them):
and:
There might be some way to turn
ProductLike
in a sensible way (perhaps involvingCo
) but based on my rushed thinking so far I haven't been able to think of anything.The text was updated successfully, but these errors were encountered: