type definition with strict products
Simon Peyton-Jones
simonpj@microsoft.com
Wed, 30 Jan 2002 08:26:28 -0800
This is a multi-part message in MIME format.
--------------InterScan_NT_MIME_Boundary
Content-Type: multipart/alternative;
boundary="----_=_NextPart_001_01C1A9AA.DE3436E5"
------_=_NextPart_001_01C1A9AA.DE3436E5
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
GHC has never allowed function types with an unboxed utpel
on the left of an arrow:
=20
f :: (# Int,Int #) -> Int
=20
Instead you must write it curried or use an ordinary tuple.
=20
In older GHCs you got a crash (as you show), but 5.02.2 checks properly
for this. =20
=20
It's a bit of a wart, but it's restriction that it is very incovenient
to lift.
=20
Simon
-----Original Message-----
From: S. Doaitse Swierstra [mailto:doaitse@cs.uu.nl]=20
Sent: 30 January 2002 15:52
To: glasgow-haskell-users@haskell.org
Cc: glasgow-haskell-users@haskell.org
Subject: type definition with strict products
I a file that is too large to post here completely, I have used:
type Result val s =3D (# val, Steps s #)
and I get the error message:
UU_Parsing.hs:391:
Illegal unboxed tuple type as function argument: (# val, Steps s #)
In the type: (# val, Steps s #)
While checking the RHS of a type synonym declaration `Result'
In the type synonym declaration for `Result'
using version "The Glorious Glasgow Haskell Compilation System, version
5.02.2".
Runningan earlier version of the compiler I get on the same file the
following error message:
ghc-5.00.2: panic! (the `impossible' happened, GHC version 5.00.2):
dsExpr: tuple pattern:
let {
fail_d9jc
=3D PrelErr.patError
@ (b r,
UU_Parsing.Steps a,
UU_Parsing.Steps a,
UU_Parsing.Exp a,
UU_Parsing.Steps a)
(PrelBase.unpackCString# "UU_Parsing.hs:735|case")
} in
case ds_d9iL of wild_B1 { (# v, ds_d9iR #) ->
case ds_d9iR of wild_B1 {
UU_Parsing.Best l m f r -> (v, l, m, f, r); __DEFAULT -> fail_d9jc
}
}
Please report it as a compiler bug to glasgow-haskell-bugs@haskell.org,
or http://sourceforge.net/projects/ghc/.
which is not very informative either.
My questions are:
- is this type definition really forbidden, and what does the phrase
"function argument " in the error message refer to?
- was there a restriction introduced about what one may write at the rhs
of a type defintion between version 5.00.2 and 5.02.2?
Thanks for looking into this,
Doaitse Swierstra
=20
--=20
________________________________________________________________________
__
S. Doaitse Swierstra, Department of Computer Science, Utrecht University
P.O.Box 80.089, 3508 TB UTRECHT, the Netherlands
Mail: mailto:doaitse@cs.uu.nl =20
WWW: http://www.cs.uu.nl/
tel: +31 30 253 3962
fax: +31 30 251 3791
mobile: +31 6 2880 1680
________________________________________________________________________
__
------_=_NextPart_001_01C1A9AA.DE3436E5
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<TITLE>Message</TITLE>
<STYLE type=3Dtext/css>BLOCKQUOTE {
PADDING-BOTTOM: 0px; PADDING-TOP: 0px
}
DL {
PADDING-BOTTOM: 0px; PADDING-TOP: 0px
}
UL {
PADDING-BOTTOM: 0px; PADDING-TOP: 0px
}
OL {
PADDING-BOTTOM: 0px; PADDING-TOP: 0px
}
LI {
PADDING-BOTTOM: 0px; PADDING-TOP: 0px
}
</STYLE>
<META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR></HEAD>
<BODY>
<DIV><SPAN class=3D667431616-30012002><FONT face=3DArial color=3D#0000ff =
size=3D2>GHC=20
has never allowed function types with an unboxed =
utpel</FONT></SPAN></DIV>
<DIV><SPAN class=3D667431616-30012002><FONT face=3DArial color=3D#0000ff =
size=3D2>on the=20
left of an arrow:</FONT></SPAN></DIV>
<DIV><SPAN class=3D667431616-30012002><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D667431616-30012002> <FONT =
face=3DArial=20
color=3D#0000ff size=3D2>f :: (# Int,Int #) -> =
Int</FONT></SPAN></DIV>
<DIV><SPAN class=3D667431616-30012002><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D667431616-30012002><FONT face=3DArial color=3D#0000ff =
size=3D2>Instead you must write it curried or use an ordinary=20
tuple.</FONT></SPAN></DIV>
<DIV><SPAN class=3D667431616-30012002><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D667431616-30012002><FONT face=3DArial color=3D#0000ff =
size=3D2>In=20
older GHCs you got a crash (as you show), but 5.02.2 checks=20
properly</FONT></SPAN></DIV>
<DIV><SPAN class=3D667431616-30012002><FONT face=3DArial color=3D#0000ff =
size=3D2>for=20
this. </FONT></SPAN></DIV>
<DIV><SPAN class=3D667431616-30012002><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D667431616-30012002><FONT face=3DArial color=3D#0000ff =
size=3D2>It's a=20
bit of a wart, but it's restriction that it is very incovenient to=20
lift.</FONT></SPAN></DIV>
<DIV><SPAN class=3D667431616-30012002><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D667431616-30012002><FONT face=3DArial color=3D#0000ff =
size=3D2>Simon</FONT></SPAN></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px =
solid; MARGIN-RIGHT: 0px">
<DIV></DIV>
<DIV class=3DOutlookMessageHeader lang=3Den-us dir=3Dltr =
align=3Dleft><FONT=20
face=3DTahoma size=3D2>-----Original Message-----<BR><B>From:</B> S. =
Doaitse=20
Swierstra [mailto:doaitse@cs.uu.nl] <BR><B>Sent:</B> 30 January 2002=20
15:52<BR><B>To:</B> glasgow-haskell-users@haskell.org<BR><B>Cc:</B>=20
glasgow-haskell-users@haskell.org<BR><B>Subject:</B> type definition =
with=20
strict products<BR><BR></FONT></DIV>
<DIV>I a file that is too large to post here completely, I have =
used:</DIV>
<DIV><BR></DIV>
<DIV><FONT color=3D#ff0000>type Result val s =3D (# val, Steps s =
#)</FONT><BR></DIV>
<DIV>and I get the error message:</DIV>
<DIV><BR></DIV>
<DIV><FONT color=3D#007700>UU_Parsing.hs:391:</FONT></DIV>
<DIV><FONT color=3D#007700> Illegal unboxed tuple =
type=20
as</FONT><FONT color=3D#ff0000> function argument</FONT><FONT =
color=3D#007700>: (#=20
val, Steps s #)<BR> In the type: (# val, Steps s=20
#)<BR> While checking the RHS of a type synonym =
declaration=20
`Result'<BR> In the type synonym declaration for=20
`Result'</FONT></DIV>
<DIV><BR></DIV>
<DIV>using version "The Glorious Glasgow Haskell Compilation System, =
version=20
5.02.2".</DIV>
<DIV><BR></DIV>
<DIV>Runningan earlier version of the compiler I get on the same file =
the=20
following error message:</DIV>
<DIV><FONT color=3D#007700>ghc-5.00.2: panic! (the `impossible' =
happened, GHC=20
version 5.00.2):<BR> dsExpr: =
tuple=20
pattern:<BR>let {<BR> fail_d9jc<BR> =3D=20
PrelErr.patError<BR> @ (b=20
r,<BR> =20
UU_Parsing.Steps=20
a,<BR> =20
UU_Parsing.Steps=20
a,<BR> =20
UU_Parsing.Exp=20
a,<BR> =20
UU_Parsing.Steps a)<BR> =20
(PrelBase.unpackCString# "UU_Parsing.hs:735|case")<BR>} in<BR> =
case=20
ds_d9iL of wild_B1 { (# v, ds_d9iR #) -><BR> case ds_d9iR of =
wild_B1=20
{<BR> UU_Parsing.Best l m f r -> (v, l, m, f, r); =
__DEFAULT -> fail_d9jc<BR> }<BR> }<BR><BR>Please report =
it as a=20
compiler bug to glasgow-haskell-bugs@haskell.org,<BR>or=20
http://sourceforge.net/projects/ghc/.</FONT></DIV>
<DIV><BR></DIV>
<DIV>which is not very informative either.</DIV>
<DIV><BR></DIV>
<DIV>My questions are:</DIV>
<DIV><BR></DIV>
<DIV>- is this type definition really forbidden, and what does the =
phrase=20
"function argument " in the error message refer to?</DIV>
<DIV><BR></DIV>
<DIV>- was there a restriction introduced about what one may write at =
the rhs=20
of a type defintion between version 5.00.2 and =
5.02.2?</DIV>
<DIV><BR></DIV>
<DIV> Thanks for looking into this,</DIV>
<DIV> Doaitse Swierstra</DIV>
<DIV><BR></DIV>
<DIV> </DIV>
<DIV><BR></DIV>
<DIV><BR></DIV>
<DIV><BR></DIV><X-SIGSEP><PRE>--=20
</PRE></X-SIGSEP>
<DIV><FONT color=3D#000000=20
=
size=3D-1>_______________________________________________________________=
_____<SPAN></SPAN>______<BR>S.=20
Doaitse Swierstra, Department of Computer Science, Utrecht=20
University</FONT></DIV>
<DIV><FONT color=3D#000000=20
=
size=3D-1> &nb=
sp;<SPAN></SPAN> &nb=
sp;=20
P.O.Box 80.089, 3508 TB UTRECHT, the=20
=
Netherlands<BR> &nbs=
p; <SPAN></SPAN> &nbs=
p; =20
Mail: =20
=
mailto:doaitse@cs.uu.nl <SPAN></=
SPAN> <BR> &nbs=
p; <SPAN></SPAN> &nbs=
p; =20
WWW: http://www.cs.uu.nl/</FONT></DIV>
<DIV><FONT color=3D#000000=20
=
size=3D-1><BR>  =
; <SPAN></SPAN>  =
; =20
tel: +31 30 253 3962</FONT></DIV>
<DIV><FONT color=3D#000000=20
=
size=3D-1> &nb=
sp;<SPAN></SPAN> &nb=
sp;=20
fax: +31 30 251 3791</FONT></DIV>
<DIV><FONT color=3D#000000=20
=
size=3D-1> &nb=
sp;<SPAN></SPAN> &nb=
sp;=20
mobile: +31 6 2880=20
=
1680<BR>_________________________________________________________________=
____<SPAN></SPAN>_____</FONT></DIV></BLOCKQUOTE></BODY></HTML>
------_=_NextPart_001_01C1A9AA.DE3436E5--
--------------InterScan_NT_MIME_Boundary--