Hi,<br><br><div class="gmail_quote">On Wed, Jun 5, 2013 at 11:21 PM, TP <span dir="ltr">&lt;<a href="mailto:paratribulations@free.fr" target="_blank">paratribulations@free.fr</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="im">José Pedro Magalhães wrote:<br>
<br>
&gt;&gt; Oh, it should probably be simply<br>
&gt;&gt;<br>
&gt;&gt;   deriving instance Typeable &#39;Zero<br>
&gt;&gt;   deriving instance Typeable &#39;Succ<br>
&gt;&gt;<br>
&gt;<br>
&gt; Yes, that&#39;s how it should be. Please let me know if that<br>
&gt; doesn&#39;t work.<br>
<br>
</div>Thanks, it works perfectly like that.<br>
I don&#39;t understand exactly why the previous syntax did not work, but maybe<br>
it will be clearer when I finish the paper &quot;Scrap your boilerplate: a<br>
practical design pattern for generic programming&quot; (anyway, this paper seems<br>
very interesting).<br></blockquote><div><br>It&#39;s an interesting paper, but I&#39;m afraid it won&#39;t help you understand what&#39;s going<br>on. Typeable is changing in GHC 7.8 to become poly-kinded. You are using<br>

Typeable instances for things which are not of kind *, so you need this new<br>poly-kinded variant. The SYB paper says nothing about polykinds (it was written<br>way before polykinds came up).<br><br>You can find some more information on the new Typeable here:<br>

<a href="http://hackage.haskell.org/trac/ghc/wiki/GhcKinds/PolyTypeable">http://hackage.haskell.org/trac/ghc/wiki/GhcKinds/PolyTypeable</a><br><br>By the way, you can also get those Typeable instances derived automatically<br>

if you use the LANGUAGE pragma AutoDeriveTypeable. This is also documented<br>in the HEAD user&#39;s guide.<br><br><br>Cheers,<br>Pedro<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


Output of the code:<br>
<br>
---------------------<br>
$ runghc-head test_typeable.hs<br>
Box test_typeable.hs: Prelude.undefined<br>
---------------------<br>
<br>
Maybe the &quot;Box &quot; in front of the line is strange, but it is OK: &quot;one&quot; is<br>
undefined, not &quot;Box one&quot;.<br>
<br>
This is the full tested code, for sake of reference:<br>
<br>
-----------------------<br>
<div class="im">{-# LANGUAGE GADTs #-}<br>
{-# LANGUAGE DeriveDataTypeable #-}<br>
{-# LANGUAGE DataKinds #-}<br>
{-# LANGUAGE PolyKinds #-}<br>
{-# LANGUAGE StandaloneDeriving #-}<br>
<br>
import Data.Typeable<br>
<br>
data Nat = Zero | Succ Nat<br>
</div>    deriving ( Show, Eq, Ord )<br>
<div class="im"><br>
deriving instance Typeable &#39;Zero<br>
deriving instance Typeable &#39;Succ<br>
<br>
</div><div class="im">data Box where<br>
    Box :: (Typeable s, Show s, Eq s) =&gt; s -&gt; Box<br>
    deriving Typeable<br>
<br>
</div>data Proxy a = P deriving (Typeable, Show, Eq)<br>
<div class="im"><br>
deriving instance Show Box<br>
instance Eq Box where<br>
<br>
    (Box s1) == (Box s2) = Just s1 == cast s2<br>
<br>
main = do<br>
<br>
let one = undefined :: Main.Proxy (&#39;Succ &#39;Zero)<br>
let foo = Box one<br>
print foo<br>
</div>----------------------<br>
<br>
Thanks a lot,<br>
<br>
TP<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</div></div></blockquote></div><br>