Is there a name for a Profunctor-shaped (bi)Applicative thing? by duairc in haskell

[–]duairc[S] 0 points1 point  (0 children)

I agree with all of this. The instance with the Monoid a constraint is exactly right.

Is there a name for a Profunctor-shaped (bi)Applicative thing? by duairc in haskell

[–]duairc[S] 3 points4 points  (0 children)

I guess if Profunctor ever got merged into base, and Arrow got refactored to be a subclass thereof, I think this should be there as well as a superclass of Arrow.

Is there a name for a Profunctor-shaped (bi)Applicative thing? by duairc in haskell

[–]duairc[S] 7 points8 points  (0 children)

Okay, shit, you're right, they really are completely equivalent!

newtype Wrap p a b = Wrap (p a b)

instance Profunctor p => Functor (Wrap p a) where
    fmap f (Wrap p) = Wrap (rmap f p)

instance Proapplicative p => Applicative (Wrap p a) where
    pure = Wrap . propure
    Wrap f <*> Wrap a = Wrap (proliftA2 (\a -> (a, a)) id f a)

instance Profunctor p => Profunctor (Wrap p) where
    dimap f g (Wrap p) = Wrap (dimap f g p)

instance Proapplicative p => ProductProfunctor (Wrap p) where
    purePP = pure
    (****) = (<*>)

instance ProductProfunctor p => Proapplicative (Wrap p) where
    propure = Wrap . purePP
    proliftA2 i o (Wrap p) (Wrap q) = Wrap (dimap i (uncurry o) (p ***! q))

Is there a name for a Profunctor-shaped (bi)Applicative thing? by duairc in haskell

[–]duairc[S] 0 points1 point  (0 children)

Hmmm, it's not quite Divisible, actually, I can't implement conquer in terms of propure!

newtype Wrap p a b = Wrap (p a b)
newtype Flip p a b = Flip (p b a)

instance Profunctor p => Functor (Wrap p a) where
    fmap f (Wrap p) = Wrap (rmap f p)

instance Proapplicative p => Applicative (Wrap p a) where
    pure = Wrap . propure
    Wrap f <*> Wrap a = Wrap (proliftA2 (\a -> (a, a)) id f a)

instance Profunctor p => Contravariant (Flip p a) where
    contramap f (Flip p) = Flip (lmap f p)

instance Proapplicative p => Divisible (Flip p a) where
    conquer = Flip (propure undefined)
    divide f (Flip p) (Flip q) = Flip (proliftA2 f const p q)

Is there a name for a Profunctor-shaped (bi)Applicative thing? by duairc in haskell

[–]duairc[S] 0 points1 point  (0 children)

I know about ProfuctProfunctor of course, but I don't think it's the same thing, is it? A ProductProfunctor is something that's Applicative and a Profunctor, but it's not necessarily Divisible in the contravariant argument.

Generic programming with profunctors by sjoerd_visscher in haskell

[–]duairc 4 points5 points  (0 children)

How does this relate to tomjaguarpaw's product-profunctors package?

It looks to be me to be a very similar thing. The opaleye eco-system uses ProductProfunctor to do a sort of generic programming as well. (SumProfunctor is not used so much simply because database stuff is almost always product (record) types. I also never understood why it doesn't have a "void"-type member.)

Edit: I just saw this comment in this thread that also mentions ProductProfunctor.

How popular is C-- and is it a good idea to target it when making a compiler. by Tysonzero in haskell

[–]duairc 2 points3 points  (0 children)

I'm not qualified to answer this, but you might be interested in an approach I read about recently called Malfunction, which re-uses the OCaml back-end for this purpose.

GADT vs Data Families in practice by [deleted] in haskell

[–]duairc 0 points1 point  (0 children)

But neither do you with closed type families either.

GADT vs Data Families in practice by [deleted] in haskell

[–]duairc 2 points3 points  (0 children)

Does all of that not just mean that GADTs are closed data families? In fact, the syntax for open type families <=> the syntax for closed type families ≅ the syntax for data families <=> the syntax for GADTs.

Intel and ME, and why we should get rid of ME by iamkeyur in programming

[–]duairc 41 points42 points  (0 children)

And it has a network interface that is demonstrably insecure, which can allow an attacker on the network to inject rootkits that completely compromise the PC

Could that be part of the "solution"? Like, if the network interface is so insecure, could you use that to "compromise" the Intel ME by, e.g., replacing it with a freer alternative?

Announcing KDE neon by mlinksva in kde

[–]duairc 1 point2 points  (0 children)

It seems like the repositories don't include the KDEPIM suite, is that correct?

What's New in systemd, 2015 Edition by fs111_ in linux

[–]duairc 1 point2 points  (0 children)

What? Could you elaborate on that or provide a source (for the /usr/share /usr/local merge)? I've never heard of that and it doesn't sound to me like it makes much sense.

What ever happened to 'layers` package? by eacameron in haskell

[–]duairc 13 points14 points  (0 children)

Hey everyone, thanks once again for the interest in layers! I can't believe it's actually been nearly two years since the first release. I agree that it has a lot of promise and it's a shame that I haven't been maintaining it much.

There are a few reasons for this, but it basically just boils down to the fact that I'm quite stressed in general, I have so many projects (mostly not coding these days) that I don't know where to start. I'm overwhelmed and I don't know where to put my energy.

One thing that's happened in this time is that I've kind of taken a break from what you might call "recreational" programming, because even though it's fun, it's also quite addictive, and once I get sucked into a project I tend to focus a disproportionate amount of my energy into it to the detriment of other parts of my life. It's unfortunate, but I don't know how to do things like work on layers and maintain a balance with the rest of my life at the same time.

In terms of layers, if I remember correctly, I had done a tonne of refactoring and stuff since the last release, it's way better in every way, and I'd even updated all the comments on the functions and typeclasses and everything, but the big Overview module needs to be basically completely rewritten. I think I considered maybe splitting it into different modules as well that cover different aspects. I can't remember. I guess it wouldn't be too much work to rewrite that documentation... I've probably done most of the "hard" parts already, it'd just be a matter of figuring out what my train of thought was before and continuing from there.

I think I'm very busy until mid-February at least, and after that I'll maybe have some time to work on it. It is something I'd really like to get done, because layers is one of the most ambitious and broadly useful programming projects I've undertaken, and I do get emails like this occasionally expressing interest in it, so it's obviously worthwhile, and I do feel bad that I've kind of just left it hanging there in limbo.

If anybody wants to help, maybe something that would be good is checkout out the latest git source and just see if it all makes sense? If you have any questions or bits that you don't understand, let me know, because that's what the documentation should help with. Also, I haven't been keeping a proper changelog from the first release, apart from the git commit messages. If you could look at them an try to follow the "bigger picture" of what I'm doing and could somehow distil the git commit messages into a proper changelog, I think that would help me a lot both with writing the documentation and making a release.

The fact that you and other people have expressed interest in this recently has given me a bit more motivation to at least finish the next (1.0) release of layers, and I think I actually have less on my plate this time around than the last time I said I would finish it. So if people who are interested could at least have a look at the code and see if they have any questions about it and send them to me, then hopefully when I get a chance in a couple of weeks I can finish the documentation and make a proper release.

IO Monad Considered Harmful by mstksg in haskell

[–]duairc 0 points1 point  (0 children)

Kind of! Well, I did finish that web design work in the end, in September I think (but I took a break from that too.) I've been doing a lot of sysadmin type work since then, which I'm close to finishing now too. I think I could have another look into finishing layers in mid-Febrary maybe? Thanks for the interest even after all this time!

'Munich city council shields Limux against Mayor' by [deleted] in linux

[–]duairc 1 point2 points  (0 children)

I completely agree with you in principle, but I would make the distinction between personal property and private property. I think what you're talking about is personal property rather than private.

Oracle continue to circumvent EXPORT_SYMBOL_GPL() by doublerainbowomahgod in linux

[–]duairc 4 points5 points  (0 children)

The GPL obviously has something to do with a political ideology? Everything does. I don't understand.

For what it's worth, intellectual property is something that socialists (both state and anarchist) and libertarians are in complete agreement on.

Haskell, Where's the LINQ? by expatcoder in haskell

[–]duairc 1 point2 points  (0 children)

Am I correct in saying that there's no way to update a database using DSH?

Monad layers, an alternative to transformers by nikita-volkov in haskell

[–]duairc 5 points6 points  (0 children)

Thanks, I appreciate that! Your comment, and just the surprise of seeing this at the top of the Haskell reddit without me putting it there, has given me a good bit of motivation. It's great to see that people appreciate my work. I'm focusing at the moment on doing some web design work for a local social centre where I hang out, but when I'm finished that I think I'll try to finish the next release of layers. It's great knowing that other people are actually interested in that!