[GHC] #11070: Type-level arithmetic of sized-types has weaker inference power than in 7.8
GHC
ghc-devs at haskell.org
Mon Nov 9 03:43:13 UTC 2015
#11070: Type-level arithmetic of sized-types has weaker inference power than in 7.8
-------------------------------------+-------------------------------------
Reporter: cactus | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.10.2
Resolution: | Keywords: TypeFamilies
Operating System: Unknown/Multiple | Architecture:
Type of failure: GHC rejects | Unknown/Multiple
valid program | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by cactus):
The same behaviour can be observed with the closed-type-family version
below:
{{{
data X0 = X0
data N1 = N1
data X0_ a = X0_ Integer
data X1_ a = X1_ Integer
type X1 = X1_ X0
type X2 = X0_ (X1_ X0)
type family APP0 a where
APP0 X0 = X0
APP0 N1 = X0_ N1
APP0 (X1_ a) = X0_ (X1_ a)
APP0 (X0_ a) = X0_ (X0_ a)
type family APP1 a where
APP1 X0 = X1_ X0
APP1 N1 = N1
APP1 (X1_ a) = X1_ (X1_ a)
APP1 (X0_ a) = X1_ (X0_ a)
type family SUCC a where
SUCC X0 = X1_ X0
SUCC N1 = X0
SUCC (X1_ a) = APP0 (SUCC a)
SUCC (X0_ a) = APP1 a
type family ADD a b where
ADD a X0 = a
ADD X0 a = a
ADD N1 N1 = APP0 N1
ADD N1 (X1_ b) = APP0 b
ADD N1 (X0_ b) = APP1 (ADD N1 b)
ADD (X1_ a) N1 = APP0 a
ADD (X0_ a) N1 = APP1 (ADD a N1)
ADD (X1_ a) (X1_ b) = APP0 (SUCC (ADD a b))
ADD (X1_ a) (X0_ b) = APP1 (ADD a b)
ADD (X0_ a) (X1_ b) = APP1 (ADD a b)
ADD (X0_ a) (X0_ b) = APP0 (ADD a b)
type family NOT a where
NOT X0 = N1
NOT N1 = X0
NOT (X1_ a) = APP0 (NOT a)
NOT (X0_ a) = APP1 (NOT a)
type SUB a b = ADD a (SUCC (NOT b))
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11070#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list