Skip to content

Instantly share code, notes, and snippets.

@kmizu
Created July 8, 2019 05:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kmizu/7b179034867a337de08919e69fb91545 to your computer and use it in GitHub Desktop.
Save kmizu/7b179034867a337de08919e69fb91545 to your computer and use it in GitHub Desktop.
Ambiguous occurrence
class M a where
(+) :: a -> a -> a
add x y = x + y
main = do print "Hello"
@kmizu
Copy link
Author

kmizu commented Jul 8, 2019

$ ghc M.hs
[1 of 1] Compiling Main ( M.hs, M.o )

M.hs:4:13: error:
Ambiguous occurrence ‘+’
It could refer to either ‘Prelude.+’,
imported from ‘Prelude’ at M.hs:1:1
(and originally defined in ‘GHC.Num’)
or ‘Main.+’, defined at M.hs:2:3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment