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

HasClass instances #1

Open
ori-sky opened this issue Dec 9, 2016 · 0 comments
Open

HasClass instances #1

ori-sky opened this issue Dec 9, 2016 · 0 comments

Comments

@ori-sky
Copy link

ori-sky commented Dec 9, 2016

I've been looking into using this library as part of a larger project and I have a quick question. From what I can figure out, an instance of HasClass is required to exist in order for a constraint to be available on a value. Based on local testing, my question is this: could the following instance declaration be used instead of needing to write an instance for every combination of constraint and data type?

{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}

instance c a => HasClass c a True where classDict _ _ _ = TDict

Forgive me for my ignorance if I'm incorrectly understanding how HasClass works, though I've done a bit of local testing as I said and this appears to work for some custom typeclasses defined in my code.

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

1 participant