Comments (5)
Unfortunate BC breaking in GHC 8.4. Do you know what is causing it? I tried enabling TypeSynonymInstances
but even then it's giving the same error.
It would be very convenient to be able to continue writing the instances inside the withStatic
block as-is.
from distributed-closure.
Ryan Scott told me that the problem is because of https://ghc.haskell.org/trac/ghc/ticket/13267
from distributed-closure.
Thankfully, the workaround is fairly simple: just don't generate instance Serializable SerializableInt
! (It wasn't doing anything before anyways, since Serializable
is a type synonym, not a class.)
from distributed-closure.
OK in that case, I propose the following change. Instead of
type Serializable a = (Binary a, Typeable a)
have
class (Binary a, Typeable a) => Serializable a
instance (Binary a, Typeable a) => Serializable a
If we do that, then we don't have a constraint synonym anymore, thus working around the fact that GHC doesn't support defining instances for those anymore. @mpickering @RyanGlScott might either of you have any thoughts about the downsides of such an alternative definition?
from distributed-closure.
That would also work fine. As far as downsides go:
- It's yet another class that you have to generate code for to accommodate. (With the type synonym version, you don't have to generate any extra code in order to use it.)
- It requires defining a flexible, undecidable catch-all instance to use, which you may or may not find appealing depending on your tastes.
tl;dr You can't go wrong with either version, so pick which one suits you better.
from distributed-closure.
Related Issues (12)
- Add examples of sending closures over the network HOT 2
- Derive static versions of `StandaloneDeriving` instances with `withStatic`
- Provide `Static` instances for longer tuples
- Provide `Static` instance for `Static` HOT 1
- Add `Closure` to the definition of `staticPure` HOT 2
- How to handle types that require non-trivial serialization? HOT 2
- Tests fail to compile on GHC 8.6 HOT 1
- New hackage release
- Build failure with GHC 8 HOT 1
- Security model HOT 3
- `withStatic` instance fails when type families appear in constraints HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from distributed-closure.