Skip to content
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

StorableWrap is useless #3

Closed
vagarenko opened this issue Aug 2, 2015 · 2 comments
Closed

StorableWrap is useless #3

vagarenko opened this issue Aug 2, 2015 · 2 comments

Comments

@vagarenko
Copy link

Am I missing something?
Isn't this instance:

instance (Storable a) => CStorable (StorableWrap a)

completly useless?
Why would I want CStorable if I already have Storable?
It should be other way round:

instance(Generic a, CStorable (Rep a)) => Storable (StorableWrap a)

so I could derive Generic instance for my type, wrap it with StorableWrap and feed it to some function that takes Storable.

@vagarenko
Copy link
Author

@maurer
Copy link
Owner

maurer commented Sep 14, 2015

StorableWrap is meant for use with functions which consume something belonging to the typeclass CStorable, when people want a shortcut for using a Storable object instead.

e.g.

f :: (CStorable a) -> IO ()
f (StorableWrap somethingStorable)

If you want something the other way around as well, feel free to write it and submit a PR, but this codepath is not useless, it is actually in use.

@maurer maurer closed this as completed Sep 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants