Re: Why cannot inferred type signatures restrict (potentially) ambiguous type variables?

2013-10-14 Thread Nicolas Frisby
An observation: on GHC 7.6.3, if I remove c2 entirely, then ghci cooperates. *Main :t \x - c (c x) \x - c (c x) :: (C a b, C a1 a) = a1 - b At first blush, I also expected the definition -- no signature, no ascriptions c2 x = c (c x) to type-check. Perhaps GHC adopted a trade-off giving

Re: Why cannot inferred type signatures restrict (potentially) ambiguous type variables?

2013-10-14 Thread Edward Kmett
AllowAmbiguousTypes at this point only extends to signatures that are explicitly written. This would need a new AllowInferredAmbiguousTypes or something. On Sat, Oct 12, 2013 at 5:34 PM, adam vogt vogt.a...@gmail.com wrote: Hello, I have code: {-# LANGUAGE FlexibleInstances,

Why cannot inferred type signatures restrict (potentially) ambiguous type variables?

2013-10-12 Thread adam vogt
Hello, I have code: {-# LANGUAGE FlexibleInstances, MultiParamTypeClasses, ScopedTypeVariables, TypeFamilies #-} class C a b where c :: a - b instance (int ~ Integer) = C Integer int where c = (+1) c2 :: forall a b c. (C a b, C b c) = a - c c2 x = c (c x :: b) c2 x = c ((c :: a - b) x) Why