-
Notifications
You must be signed in to change notification settings - Fork 89
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
Implement Data.Reflectable #289
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add tests for both the Reflectable and Reifiable type classes?
Should I copy-paste the tests from the compiler? https://github.com/purescript/purescript/blob/1d5c618054bc0c452128e8758dc01b758a3a6f39/tests/purs/passing/SolvingReflectable.purs I think testing |
Co-authored-by: Thomas Honeyman <[email protected]>
I think adding it here forces other backends to also implement the tests, which aren't being tested in the compiler. We'd also probably want something more granular. testReflection :: AlmostEff
testReflection = do
assert "Symbol reflection" $ reflectType (Proxy :: Proxy "foo") == "foo"
assert "Int reflection - 1" $ reflectType (Proxy :: Proxy 1) == 1
assert "Int reflection - 0" $ reflectType (Proxy :: Proxy 0) == 0
assert "Int reflection - (-1)" $ reflectType (Proxy :: Proxy (-1)) == (-1)
assert "Boolean - True reflection" $ reflectType (Proxy :: Proxy PB.True) == true
assert "Boolean - False reflection" $ reflectType (Proxy :: Proxy PB.False) == false
assert "Ordering - LT reflection" $ reflectType (Proxy :: Proxy PO.LT) == LT
assert "Ordering - EQ reflection" $ reflectType (Proxy :: Proxy PO.EQ) == EQ
assert "Ordering - GT reflection" $ reflectType (Proxy :: Proxy PO.GT) == GT Similarly for the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 thanks, @purefunctor!
Closes #286. Adds a
Data.Reflectable
module which is where the compiler looks at for the automatically-solvedReflectable
type class.Checklist: