Created
April 13, 2018 23:18
-
-
Save parsonsmatt/a814e5c73756cc315fe3417110a5b9a2 to your computer and use it in GitHub Desktop.
maybe your thinking, "wow, i really want a type class with only two instances" well here you go!! don't export the class and you're *golden*. i mean, write a better error message, but come on
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- gross hack so i can lighten the syntax load | |
class NameOrEntityRef x where | |
disambiguate :: x -> Either Name EntityRef | |
instance NameOrEntityRef Name where | |
disambiguate = Left | |
instance NameOrEntityRef EntityRef where | |
disambiguate = Right | |
instance {-# OVERLAPPABLE #-} (TypeError (Text "No.")) => NameOrEntityRef a where | |
disambiguate = undefined |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Something that I replied to this with on Twitter:
(full, albeit unfinished, source code here)