Comments (3)
Any reason for not doing:
{-# LANGUAGE DeriveFunctor #-}
module Test where
newtype WrappedFunctor f a = WrapFunctor (f a)
deriving Functor
The deriving functor was added to Derive as a prototype for the GHC version. It's pretty complex, and testing suggests the GHC one got some improvements after that.
from derive.
I'm not planning on using this in production code. I was just curious to see if derive
was capable of handling this case, since I'm working on a similar Template Haskell-based project for deriving Bifunctor
instances, so I wanted to take some inspiration from derive
.
Am I correct in assuming that if derive
sees a type variable of kind * -> *
that it makes it an instance of Functor
? Or does it do something more complex?
from derive.
I've no real idea. The code is at https://github.com/ndmitchell/derive/blob/master/Data/Derive/Functor.hs and https://github.com/ndmitchell/derive/blob/master/Data/Derive/Internal/Traversal.hs. I didn't write it, but you're free to reuse what you can. I suspect it's not looking at the kind info at all, since I don't think the version of TH that it was written provided that.
Should you wish to submit patches for your Bifunctor derivation to Derive and ship your derivation that way, I'd be happy to accept them.
Given that there's probably no great reason to use the Functor instance, and fixing it is probably not trivial, I'll close this ticket and just accept it as an expected limitation.
from derive.
Related Issues (20)
- Add Aeson ToJSON/FromJSON
- Enum instances derived with TH crash with "Missing field in record construction
- Unnecessary context when deriving Monoid
- breakage with template-haskell-2.11 (in ghc-8) HOT 15
- to decrease build time, sources should be in separate src/ folder HOT 2
- "derive makeArbitrary" error w/ strict types (8.0.1) HOT 7
- Could not convert Dec to Decl HOT 2
- Convert to haskell-src-exts-1.18 HOT 20
- Errors while using C and GHC preprocessors HOT 1
- TH derivation doesn't work when the type name is qualified HOT 1
- Fails to build under newest derive HOT 3
- Build failure with GHC 8.2 HOT 3
- Example in Data.Derive.UniplateDirect fails HOT 8
- Parse Fails For pattern aliases (MINOR: see issue comments) HOT 3
- Could not convert Type to Kind () ConT GHC.Types.Nat HOT 1
- Could not convert Dec to Decl () HOT 2
- Hackage distribution lacks TestInstances HOT 1
- Could not convert Type to Type () HOT 1
- Upgrade to haskell-src-exts-1.20 HOT 1
- support haskell-src-exts-1.21+? HOT 2
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 derive.