Comments (7)
It might be interesting to take a pause and think about how we handle styles and attributes. In diagrams we basically have 2 extensible features, primitives and attributes. Primitives are statically typed but attributes are dynamic, see https://wiki.haskell.org/Diagrams/Dev/Expression for a discussion about making primitives dynamic.
It seems we've settled on statically typed primitives. I wonder whether we should think about treating attributes like primitives and consider the pros and cons. I doubt we will actually want to do this, but I think it is a good time to consider it.
from diagrams-core.
If we want to implement fading (using the luminosity of a rendered diagram as an alpha channel) or pattern fills (tiling a diagram to use as a path's fill) we'd need to add b
annotations to Attribute
and Style
.
I'm leaning towards dynamic primitives. Right now the only case where it's useful is for images but I could see 3D backends being more selective with features they support. I'd still be happy with issuing warnings when a backend gets something it doesn't support.
That said I think the original issue is separate and can be implemented without (hopefully) breaking user code or backends, it just helps us make less mistakes in the library code.
from diagrams-core.
@cchalmers take a look at the now bit-rotted dynamic branches of -core, -lib and -svg were I played around with dynamic primitives.
from diagrams-core.
Yeah, the more I think about it the more I'm in favour of ditching the b
. Changing the code doesn't seem too hard, the bigger problem would be documenting / reporting errors / changing Diagram
alias again.
from diagrams-core.
I wonder if it makes sense to try and merge master into dynamic. Or if it's easier just to start from scratch. @cchalmers before you do any more work on it, we should see if there is a consensus amongst the team. If I remember correctly, when I wrote this others were leaning towards keeping the b
from diagrams-core.
Static vs dynamic primitives aside, I'm definitely in favor of making attributes more type safe. I've definitely stumbled over (read: had to debug) this too. The proposed solution looks good to me. DataKinds was introduced in GHC 7.4 so we are certainly good to start depending on it.
from diagrams-core.
(For the record, I am still torn on static vs dynamic primitives.)
from diagrams-core.
Related Issues (20)
- support SVG blur effect on subdiagrams HOT 1
- A release with constraintskinds fix? HOT 3
- allow lens-4.17
- New release on Hackage to allow GHC 8.8.1 HOT 2
- Constraint synonym for any valid back end?
- Is it possible to serialize a diagram to a file and then render it with another program, another time? HOT 4
- diagrams-core introduced breaking change in a patch version HOT 5
- Relax upper bound constraints to build with base 4.15 HOT 21
- Support monoid-extras 0.6 and future versions of base (Option deprecation) HOT 2
- Doesn't work with old monoid-extras HOT 1
- Inconsistent code and doc for `atLeast`/`atMost` HOT 4
- Out of date git repo? HOT 1
- Please add support for recent versions of vector-space HOT 1
- New release for 7.10 HOT 3
- Document (Transformable (Envelope ...)) instance HOT 2
- Problem installing diagrams with cabal... HOT 3
- Drop "xlink:" namespace for SVG 2.0 HOT 2
- Allow specifying the "target" attribute for links in SVG elements
- loosen upper bound of lens dependency for Stackage lts-11.0 compatibility
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 diagrams-core.