-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add newtype utils #70
base: master
Are you sure you want to change the base?
Conversation
Thanks! My first reaction is that a lot of these should be done by giving the |
Thanks. I think it would be good if any instance of Newtype would become instance of Traversable automatically. I'm not sure how to use superclass constraint to achieve that "automatically" I have tried this {-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE IncoherentInstances #-}
{-# LANGUAGE UndecidableInstances #-}
instance (Newtype t) => Functor t where
fmap = mapNewtype But these extensions give me some trouble in the codebase
(I'm using Polysemy but I have no idea how that's related). |
The correct way to do it would be to change the definition of class Traversable t => Newtype t where
... and then you can just |
Do you have any public code that shows how you use them? I think in general that just using the |
No. But I'm happy to do screen sharing to show you |
One thing you could do is
|
Sorry, this is on my TODO list to look at but realistically it's going to be a very long time before I get to it. |
When I was working with opaleyes, I found my self needing these simple utils when I follow tomjaguarpaw/haskell-opaleye#570 (comment) to be more type safe.
I have added the examples how I use them
Please let me know if these are not necessary and we can achieve the same result using any existing functions.
Thanks