Discussion:
type-level instant insanity
(too old to reply)
kkwweett
2008-12-18 19:19:22 UTC
Permalink
Hi,
Can anyone help me get the right output from the program described in

http://www.haskell.org/sitewiki/images/d/dd/TMR-Issue8.pdf

from page 21 and downloadable at

http://www.e-pig.org/darcs/TMR/Issue8/instant-insanity.lhs

? I tried on GHCi 6.6 with options "-fglasgow-exts
-fallow-undecidable-instances" and on GHCi 6.10.1 with options
"-fglasgow-exts -XUndecidableInstances".

All the tests give the expected results except the last (and more
important) one :

:t solutions (u::Cubes)

This one throws an error I can't paste (too many lines for the capacity
of my xterm) but it ends with ..."((Cube G W W B G R ::: Nil) ::: as)
as}' arising from a use of 'solutions' at <interactive>:1:0-19"

This error arises with the initial problem

type Cubes=(Cube1:::Cube2:::Cube3:::Cube4:::Nil)

but it occurs also with the reduced problem

type Cubes=(Cube1:::Cube2:::Nil)

Nevertheless, the minimal problem

type Cubes=(Cube1:::Nil)

works fine.

Thank you for any help.
kkwweett
2008-12-19 09:32:51 UTC
Permalink
Post by kkwweett
This error arises with the initial problem
type Cubes=(Cube1:::Cube2:::Cube3:::Cube4:::Nil)
It seems that the trouble comes from the triple type-constraint in the
definition of Orientations.

In fact, with only a double type-constraint, a (false) solution can be
computed without error during runtime:

data Orientatons

instance ( MapAppend Flip (c:::Nil) fs,
MapAppend2 Twist fs zs)
=> Apply Orientations c z where apply = undefined

instead of the initial code using MapAppend, MapAppend2 and MapAppend3.

I still don't understand why since I can choose any combinations Map
Flip / Map2 Twist or Map Flip/Map3 Rotation or Map2 Twist/Map3 Rotation
or ... but everything collapses with the triple Map/Map2/Map3.
kkwweett
2008-12-19 09:35:15 UTC
Permalink
Post by kkwweett
This error arises with the initial problem
type Cubes=(Cube1:::Cube2:::Cube3:::Cube4:::Nil)
It seems that the trouble comes from the triple type-constraint in the
definition of Orientations.

In fact, with only a double type-constraint, a (false) solution can be
computed without error during runtime:

data Orientations

instance ( MapAppend Flip (c:::Nil) fs,
MapAppend2 Twist fs zs)
=> Apply Orientations c z where apply = undefined

instead of the initial code using MapAppend, MapAppend2 and MapAppend3.

I still don't understand why since I can choose any combinations Map
Flip / Map2 Twist or Map Flip/Map3 Rotation or Map2 Twist/Map3 Rotation
or ... but everything collapses with the triple Map/Map2/Map3.
kkwweett
2008-12-19 09:37:18 UTC
Permalink
Post by kkwweett
This error arises with the initial problem
type Cubes=(Cube1:::Cube2:::Cube3:::Cube4:::Nil)
It seems that the trouble comes from the triple type-constraint in the
definition of Orientations.

In fact, with only a double type-constraint, a (false) solution can be
computed without error during runtime:

data Orientations

instance ( MapAppend Flip (c:::Nil) fs,
MapAppend2 Twist fs zs)
=> Apply Orientations c zs where apply = undefined

instead of the initial code using MapAppend, MapAppend2 and MapAppend3.

I still don't understand why since I can choose any combinations Map
Flip / Map2 Twist or Map Flip/Map3 Rotation or Map2 Twist/Map3 Rotation
or ... but everything collapses with the triple Map/Map2/Map3.

Continue reading on narkive:
Loading...