Skip to content

Defaulting doesn't work in instance declaration #18

Closed
nick8325 opened this Issue Feb 22, 2014 · 3 comments

2 participants

@nick8325

I have a program where UHC fails to default a numeric literal to Integer. The offending function definition is inside of an instance declaration and, weirdly, if I move the function definition to the top level it typechecks.

f :: Num a => a -> ()
f _ = ()

class C a where
  it :: a

-- Here I get a type error:
-- Test.hs:14-15:
--   Predicates remain unproven:
--     preds: UHC.Base.Num v_3_190_2
--              at   : 
--              trace: (UHC.Base.Num v_3_190_2,<4,0>,Test.hs:15:8): FAIL
--                     (UHC.Base.Num v_3_190_2,<4,0>,Test.hs:15:8): FAIL
instance C () where
  it = f 0

-- This one compiles fine.
it' :: ()
it' = f 0
@nick8325

P.S. - this bug is currently the only thing preventing QuickCheck from compiling on UHC, so it would be nice to get it fixed!

@atzedijkstra
UU CS Department member

Bug example now compiles ok, please check if it is so in your code.

@nick8325

Great, thanks! QuickCheck now compiles and seems to work fine. Should work out of the box with cabal install --uhc provided you use the latest version of Cabal from git.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.