[Haskell-cafe] Backpack vs plain old classes and instances

Clinton Mead clintonmead at gmail.com
Thu Jul 19 03:19:13 UTC 2018


Hi All

I read though Edward Z. Yang's blog post
<http://blog.ezyang.com/2016/10/try-backpack-ghc-backpack/> about Backpack
but I can't understand what it does above and beyond classes and instances.

It seems to me we could just replace a "signature" with a "class" and a
"unit" with an "instance" and achieve the same thing.

Of course there are issues with orphans instances if we don't own either
the class or the associated data, but it would seem to me that "orphan
units" are no less problematic than "orphan instances".

Edward Kmett's unpacked-containers
<https://www.reddit.com/r/haskell/comments/8a5w1n/new_package_unpackedcontainers/>
gets
some speed improvements using Backpack, but is Backpack just optimisation
thing, or are there ways you can organise code with Backpack  that you
couldn't do without just classes and instances? For example, does Backpack
solve the issue of packages requiring huge dependency lists to implement
instances that most of their users will not use?

Thanks,
Clinton
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20180719/8e1d9bef/attachment.html>


More information about the Haskell-Cafe mailing list