<div dir="ltr">Hi Maarten,<br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Dec 10, 2013 at 3:48 PM, Maarten Faddegon <span dir="ltr"><<a href="mailto:haskell-cafe@maartenfaddegon.nl" target="_blank">haskell-cafe@maartenfaddegon.nl</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Dear list,<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
-- | Meta-information (constructor names, etc.)<br>
instance (GToonbaar a, Constructor c) => GToonbaar (M1 i c a) where<br></blockquote></blockquote><div><br></div><div>This is not good; an instance of |Constructor c| will only be available when your |M1 i c a| is<br>actually |M1 C c a| (so |i ~ C|). In the other cases (that is, when |i| is either |D| or |S|), that<br>

</div><div>instance will not exist (there will be |Datatype| and |Selector| instances, respectively).<br><br></div><div>You can find a generic show using GHC.Generics here:<br><a href="http://hackage.haskell.org/package/generic-deriving-1.6.2/docs/src/Generics-Deriving-Show.html">http://hackage.haskell.org/package/generic-deriving-1.6.2/docs/src/Generics-Deriving-Show.html</a><br>

</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">


<br>
-- | Sums: encode choice between constructors<br>
instance (GToonbaar a, GToonbaar b) => GToonbaar (a :+: b) where<br>
        gtoon x = gtoon x<br></blockquote></blockquote><div><br></div><div>This will cause your code to loop, btw.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br></blockquote>
When I try to compile the above, ghc emits the following error:<br>
<br>
    No instance for (Constructor Main.D1MyData)<br>
      arising from a use of `Main.$gdmtoon'<br>
    Possible fix:<br>
      add an instance declaration for (Constructor Main.D1MyData)<br>
    In the expression: (Main.$gdmtoon)<br>
    In an equation for `toon': toon = (Main.$gdmtoon)<br>
    In the instance declaration for `Toonbaar MyData'<br></blockquote><div><br></div><div>It's not the most beautiful of errors, but it does say that there is no |Constructor|<br>instance for |D1MyData|, and |D1MyData| is the automatically generated datatype<br>

to encode the *datatype* meta-information for |MyData|.<br><br><br></div><div>Hope that helps,<br></div><div>Pedro<br><br></div></div><br></div></div>