Hi Stefan

Thanks for a very enlightening reply.

In GHC 6.7.20070712 and Yhc, this is perfectly safe.


In GRIN based systems like Jhc, this is *not* safe, since after
evaluation comparisons are done using the full tag.


It's now occurred to me that at a cost of some noise, I could have done things
a little differently

On 14 Jul 2007, at 20:37, Stefan O'Rear wrote:

On Sat, Jul 14, 2007 at 12:06:30PM +0100, Conor McBride wrote:
A peculiar query for folks who know more about the internals of Haskell compilers than I do. I attach the full code with all the bits and pieces,
but let me pull out the essentials in order to state the problem.

newtype Id          x = Id x                   -- element
newtype K1 a        x = K1 a                   -- constant

> newtype Up1 f p q x = U1 (f (p x) (q x))
> type Sum1 = Up1 Either
> type Prod1 = Up1 (,)


newtype Fst         x y = Fst x
newtype Snd         x y = Snd y
newtype K2 a        x y = K2 a

> newtype Up2 f p q x y = U2 (f (p x y) (q x y))
> type Sum2 = Up2 Either
> type Prod2 = Up2 (,)


class (Bifunctor b, Functor f) => Diag b f | b -> f where
  diag :: b x x -> f x
  gaid :: f x -> b x x

and then all of my coercions would (recursively) have been between
newtype-isotopes.

Would that have more universal traction? I realise, of course that it's
all voodoo, and I shouldn't trust a thing.

Cheers

Conor

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to