Created
January 21, 2021 20:13
-
-
Save exarkun/46b122be66467b2f11a526ed1e537ad1 to your computer and use it in GitHub Desktop.
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
class X x where | |
a :: x -> Int | |
data AnX = AnX Int | |
instance X AnX where | |
a (AnX v) = v | |
class Y y where | |
b :: y -> Int | |
data AnY = AnY Int | |
instance Y AnY where | |
b (AnY v) = v | |
instance Y y => X y where | |
a anY = b anY | |
foo :: X x => x -> Int | |
foo x = a x | |
main :: IO () | |
main = | |
let | |
anX = AnX 5 | |
anY = AnY 6 | |
in do | |
print (foo anX) | |
print (foo anY) |
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
/home/exarkun/Work/haskell/tahoe-lafs-immutable-uploader/aesctr/Main.hs:68:10: error: | |
• The constraint ‘Y y’ is no smaller than the instance head ‘X y’ | |
(Use UndecidableInstances to permit this) | |
• In the instance declaration for ‘X y’ | |
| | |
68 | instance Y y => X y where | |
| ^^^^^^^^^^ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment