newtype breakage

Sigbjorn Finne sof@galconn.com
Mon, 23 Jul 2001 16:31:53 -0700


Thanks, that knocked it on the head. Here's a closely
related repro case which still produces a con_info for
a newtype constructor:

module PEX where

data Expr a b = One a | Many [b]
newtype Pat a   = InP (Expr a (Pat a), Int)
newtype PExpr a = InPE (Expr a (PExpr a), Int)

one x l = InPE (One (plus1 x), l)
plus1 x@(InPE (_, loc)) = InPE (Many [x], loc)

outP (InP x) = x

getPatNames p
  = case outP p of
      (One n, _)     -> [n]
      (Many ps, _) -> concatMap getPatNames ps

i.e., the generated code for getPatNames refers to
PEX_InP_con_info.

--sigbjorn

----- Original Message ----- 
From: "Simon Peyton-Jones" <simonpj@microsoft.com>
To: "Sigbjorn Finne" <sof@galconn.com>; <cvs-ghc@haskell.org>
Sent: Monday, July 23, 2001 03:47
Subject: RE: newtype breakage


> Likewise a bug, now fixed, and test added (tcrun014)
> 
> Thanks
> 
> Simon
> 
> | -----Original Message-----
> | From: Sigbjorn Finne [mailto:sof@galconn.com] 
> | Sent: 19 July 2001 22:24
> | To: cvs-ghc@haskell.org
> | Subject: newtype breakage
> | 
> | 
> | Using HEAD, compiling the following test case
> | 
> | module PEx where
> | 
> | data Expr e = One e | Many [e]
> | newtype PExpr a = InPE (Expr (PExpr a), Int)
> | 
> | one x l = InPE (One (plus1 x), l)
> | plus1 x@(InPE (_, loc)) = InPE (Many [x], loc)
> | 
> | with -O produces output which refers to a 
> | PEx_InPE_con_info, i.e., HEAD thinks InPE is
> | a 'real' data constructor. 
> | 
> | Works fine with 5.00.2
> | 
> | --sigbjorn
> | 
> | 
> | 
> | _______________________________________________
> | Cvs-ghc mailing list
> | Cvs-ghc@haskell.org http://www.haskell.org/mailman/listinfo/cvs-ghc
> | 
> | 
> 
> _______________________________________________
> Cvs-ghc mailing list
> Cvs-ghc@haskell.org
> http://www.haskell.org/mailman/listinfo/cvs-ghc