<div dir="ltr"><div dir="ltr"><div dir="ltr">so i'm taking a look at the current docs / definition in base (and  i'm testing testing out seeing what happens if we changed the role and just build ghc and base as is)<div><a href="https://github.com/ghc/ghc/blob/82a716431cc680392e332bc2b1a1fd0d7faa4cd8/libraries/base/GHC/Ptr.hs#L37-L57" target="_blank">https://github.com/ghc/ghc/blob/82a716431cc680392e332bc2b1a1fd0d7faa4cd8/libraries/base/GHC/Ptr.hs#L37-L57</a><br></div><div><br></div><div>i'm replicating the docs below:</div><div><br></div><div>but the important detail is the phantom role in the current code is deliberate ...</div><div>because no guarantees are made about the relationship between the choice in type parameter ( which putatively will always  have the same heap rep in haskell land)</div><div>and the representation at the other side of the pointer.</div><div><br></div><div>a good example might be Ptr Char.  Is this a single location of a 32bit / utf32 code point, or an array of utf8 code points or utf32 code points?</div><div>is it null terminated vs there being an extra sequence length? These are all valid things that can be happening. And </div><div><br></div><div><table class="gmail-m_6229027964882089850gmail-highlight gmail-m_6229027964882089850gmail-tab-size gmail-m_6229027964882089850gmail-js-file-line-container" style="box-sizing:border-box;border-spacing:0px;border-collapse:collapse;color:rgb(36,41,46);font-family:-apple-system,system-ui,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:14px"><tbody style="box-sizing:border-box"><tr style="box-sizing:border-box"><td id="gmail-m_6229027964882089850gmail-LC37" class="gmail-m_6229027964882089850gmail-blob-code gmail-m_6229027964882089850gmail-blob-code-inner gmail-m_6229027964882089850gmail-js-file-line gmail-m_6229027964882089850gmail-highlighted" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:9pt;white-space:pre-wrap;background-color:rgb(255,251,221)"><span class="gmail-m_6229027964882089850gmail-pl-c" style="box-sizing:border-box;color:rgb(106,115,125)"><span class="gmail-m_6229027964882089850gmail-pl-c" style="box-sizing:border-box">--</span> Data pointers.
</span></td></tr><tr style="box-sizing:border-box"><td id="gmail-m_6229027964882089850gmail-L38" class="gmail-m_6229027964882089850gmail-blob-num gmail-m_6229027964882089850gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:9pt;line-height:20px;color:rgba(27,31,35,0.3);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_6229027964882089850gmail-LC38" class="gmail-m_6229027964882089850gmail-blob-code gmail-m_6229027964882089850gmail-blob-code-inner gmail-m_6229027964882089850gmail-js-file-line gmail-m_6229027964882089850gmail-highlighted" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:9pt;white-space:pre-wrap;background-color:rgb(255,251,221)">
</td></tr><tr style="box-sizing:border-box"><td id="gmail-m_6229027964882089850gmail-L39" class="gmail-m_6229027964882089850gmail-blob-num gmail-m_6229027964882089850gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:9pt;line-height:20px;color:rgba(27,31,35,0.3);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_6229027964882089850gmail-LC39" class="gmail-m_6229027964882089850gmail-blob-code gmail-m_6229027964882089850gmail-blob-code-inner gmail-m_6229027964882089850gmail-js-file-line gmail-m_6229027964882089850gmail-highlighted" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:9pt;white-space:pre-wrap;background-color:rgb(255,251,221)"><span class="gmail-m_6229027964882089850gmail-pl-c" style="box-sizing:border-box;color:rgb(106,115,125)"><span class="gmail-m_6229027964882089850gmail-pl-c" style="box-sizing:border-box">--</span> The role of Ptr's parameter is phantom, as there is no relation between</span></td></tr><tr style="box-sizing:border-box"><td id="gmail-m_6229027964882089850gmail-L40" class="gmail-m_6229027964882089850gmail-blob-num gmail-m_6229027964882089850gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:9pt;line-height:20px;color:rgba(27,31,35,0.3);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_6229027964882089850gmail-LC40" class="gmail-m_6229027964882089850gmail-blob-code gmail-m_6229027964882089850gmail-blob-code-inner gmail-m_6229027964882089850gmail-js-file-line gmail-m_6229027964882089850gmail-highlighted" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:9pt;white-space:pre-wrap;background-color:rgb(255,251,221)"><span class="gmail-m_6229027964882089850gmail-pl-c" style="box-sizing:border-box;color:rgb(106,115,125)"><span class="gmail-m_6229027964882089850gmail-pl-c" style="box-sizing:border-box">--</span> the Haskell representation and whathever the user puts at the end of the</span></td></tr><tr style="box-sizing:border-box"><td id="gmail-m_6229027964882089850gmail-L41" class="gmail-m_6229027964882089850gmail-blob-num gmail-m_6229027964882089850gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:9pt;line-height:20px;color:rgba(27,31,35,0.3);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_6229027964882089850gmail-LC41" class="gmail-m_6229027964882089850gmail-blob-code gmail-m_6229027964882089850gmail-blob-code-inner gmail-m_6229027964882089850gmail-js-file-line gmail-m_6229027964882089850gmail-highlighted" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:9pt;white-space:pre-wrap;background-color:rgb(255,251,221)"><span class="gmail-m_6229027964882089850gmail-pl-c" style="box-sizing:border-box;color:rgb(106,115,125)"><span class="gmail-m_6229027964882089850gmail-pl-c" style="box-sizing:border-box">--</span> pointer. And phantom is useful to implement castPtr (see #9163)</span></td></tr><tr style="box-sizing:border-box"><td id="gmail-m_6229027964882089850gmail-L42" class="gmail-m_6229027964882089850gmail-blob-num gmail-m_6229027964882089850gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:9pt;line-height:20px;color:rgba(27,31,35,0.3);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_6229027964882089850gmail-LC42" class="gmail-m_6229027964882089850gmail-blob-code gmail-m_6229027964882089850gmail-blob-code-inner gmail-m_6229027964882089850gmail-js-file-line gmail-m_6229027964882089850gmail-highlighted" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:9pt;white-space:pre-wrap;background-color:rgb(255,251,221)">
</td></tr><tr style="box-sizing:border-box"><td id="gmail-m_6229027964882089850gmail-L43" class="gmail-m_6229027964882089850gmail-blob-num gmail-m_6229027964882089850gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:9pt;line-height:20px;color:rgba(27,31,35,0.3);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_6229027964882089850gmail-LC43" class="gmail-m_6229027964882089850gmail-blob-code gmail-m_6229027964882089850gmail-blob-code-inner gmail-m_6229027964882089850gmail-js-file-line gmail-m_6229027964882089850gmail-highlighted" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:9pt;white-space:pre-wrap;background-color:rgb(255,251,221)"><span class="gmail-m_6229027964882089850gmail-pl-c" style="box-sizing:border-box;color:rgb(106,115,125)"><span class="gmail-m_6229027964882089850gmail-pl-c" style="box-sizing:border-box">--</span> redundant role annotation checks that this doesn't change</span></td></tr><tr style="box-sizing:border-box"><td id="gmail-m_6229027964882089850gmail-L44" class="gmail-m_6229027964882089850gmail-blob-num gmail-m_6229027964882089850gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:9pt;line-height:20px;color:rgba(27,31,35,0.3);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_6229027964882089850gmail-LC44" class="gmail-m_6229027964882089850gmail-blob-code gmail-m_6229027964882089850gmail-blob-code-inner gmail-m_6229027964882089850gmail-js-file-line gmail-m_6229027964882089850gmail-highlighted" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:9pt;white-space:pre-wrap;background-color:rgb(255,251,221)"><span class="gmail-m_6229027964882089850gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">type</span> <span class="gmail-m_6229027964882089850gmail-pl-smi" style="box-sizing:border-box">role</span> <span class="gmail-m_6229027964882089850gmail-pl-en" style="box-sizing:border-box;color:rgb(111,66,193)">Ptr</span> <span class="gmail-m_6229027964882089850gmail-pl-smi" style="box-sizing:border-box">phantom</span></td></tr><tr style="box-sizing:border-box"><td id="gmail-m_6229027964882089850gmail-L45" class="gmail-m_6229027964882089850gmail-blob-num gmail-m_6229027964882089850gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:9pt;line-height:20px;color:rgba(27,31,35,0.3);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_6229027964882089850gmail-LC45" class="gmail-m_6229027964882089850gmail-blob-code gmail-m_6229027964882089850gmail-blob-code-inner gmail-m_6229027964882089850gmail-js-file-line gmail-m_6229027964882089850gmail-highlighted" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:9pt;white-space:pre-wrap;background-color:rgb(255,251,221)"><span class="gmail-m_6229027964882089850gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">data</span> <span class="gmail-m_6229027964882089850gmail-pl-en" style="box-sizing:border-box;color:rgb(111,66,193)">Ptr</span> <span class="gmail-m_6229027964882089850gmail-pl-smi" style="box-sizing:border-box">a</span> <span class="gmail-m_6229027964882089850gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">=</span> <span class="gmail-m_6229027964882089850gmail-pl-ent" style="box-sizing:border-box;color:rgb(34,134,58)">Ptr</span> <span class="gmail-m_6229027964882089850gmail-pl-en" style="box-sizing:border-box;color:rgb(111,66,193)">Addr</span>#</td></tr><tr style="box-sizing:border-box"><td id="gmail-m_6229027964882089850gmail-L46" class="gmail-m_6229027964882089850gmail-blob-num gmail-m_6229027964882089850gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:9pt;line-height:20px;color:rgba(27,31,35,0.3);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_6229027964882089850gmail-LC46" class="gmail-m_6229027964882089850gmail-blob-code gmail-m_6229027964882089850gmail-blob-code-inner gmail-m_6229027964882089850gmail-js-file-line gmail-m_6229027964882089850gmail-highlighted" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:9pt;white-space:pre-wrap;background-color:rgb(255,251,221)">  <span class="gmail-m_6229027964882089850gmail-pl-k" style="box-sizing:border-box;color:rgb(215,58,73)">deriving</span> ( <span class="gmail-m_6229027964882089850gmail-pl-e" style="box-sizing:border-box;color:rgb(111,66,193)">Eq</span>  -- ^ @since 2.01</td></tr><tr style="box-sizing:border-box"><td id="gmail-m_6229027964882089850gmail-L47" class="gmail-m_6229027964882089850gmail-blob-num gmail-m_6229027964882089850gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:9pt;line-height:20px;color:rgba(27,31,35,0.3);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_6229027964882089850gmail-LC47" class="gmail-m_6229027964882089850gmail-blob-code gmail-m_6229027964882089850gmail-blob-code-inner gmail-m_6229027964882089850gmail-js-file-line gmail-m_6229027964882089850gmail-highlighted" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:9pt;white-space:pre-wrap;background-color:rgb(255,251,221)">           , <span class="gmail-m_6229027964882089850gmail-pl-e" style="box-sizing:border-box;color:rgb(111,66,193)">Ord</span> -- ^ @since 2.01</td></tr><tr style="box-sizing:border-box"><td id="gmail-m_6229027964882089850gmail-L48" class="gmail-m_6229027964882089850gmail-blob-num gmail-m_6229027964882089850gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:9pt;line-height:20px;color:rgba(27,31,35,0.3);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_6229027964882089850gmail-LC48" class="gmail-m_6229027964882089850gmail-blob-code gmail-m_6229027964882089850gmail-blob-code-inner gmail-m_6229027964882089850gmail-js-file-line gmail-m_6229027964882089850gmail-highlighted" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:9pt;white-space:pre-wrap;background-color:rgb(255,251,221)">           )</td></tr><tr style="box-sizing:border-box"><td id="gmail-m_6229027964882089850gmail-L49" class="gmail-m_6229027964882089850gmail-blob-num gmail-m_6229027964882089850gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:9pt;line-height:20px;color:rgba(27,31,35,0.3);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_6229027964882089850gmail-LC49" class="gmail-m_6229027964882089850gmail-blob-code gmail-m_6229027964882089850gmail-blob-code-inner gmail-m_6229027964882089850gmail-js-file-line gmail-m_6229027964882089850gmail-highlighted" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:9pt;white-space:pre-wrap;background-color:rgb(255,251,221)"><span class="gmail-m_6229027964882089850gmail-pl-c" style="box-sizing:border-box;color:rgb(106,115,125)"><span class="gmail-m_6229027964882089850gmail-pl-c" style="box-sizing:border-box">--</span> <span class="gmail-m_6229027964882089850gmail-pl-c" style="box-sizing:border-box">^</span> A value of type @'Ptr' a@ represents a pointer to an object, or an</span></td></tr><tr style="box-sizing:border-box"><td id="gmail-m_6229027964882089850gmail-L50" class="gmail-m_6229027964882089850gmail-blob-num gmail-m_6229027964882089850gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:9pt;line-height:20px;color:rgba(27,31,35,0.3);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_6229027964882089850gmail-LC50" class="gmail-m_6229027964882089850gmail-blob-code gmail-m_6229027964882089850gmail-blob-code-inner gmail-m_6229027964882089850gmail-js-file-line gmail-m_6229027964882089850gmail-highlighted" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:9pt;white-space:pre-wrap;background-color:rgb(255,251,221)"><span class="gmail-m_6229027964882089850gmail-pl-c" style="box-sizing:border-box;color:rgb(106,115,125)"><span class="gmail-m_6229027964882089850gmail-pl-c" style="box-sizing:border-box">--</span> array of objects, which may be marshalled to or from Haskell values</span></td></tr><tr style="box-sizing:border-box"><td id="gmail-m_6229027964882089850gmail-L51" class="gmail-m_6229027964882089850gmail-blob-num gmail-m_6229027964882089850gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:9pt;line-height:20px;color:rgba(27,31,35,0.3);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_6229027964882089850gmail-LC51" class="gmail-m_6229027964882089850gmail-blob-code gmail-m_6229027964882089850gmail-blob-code-inner gmail-m_6229027964882089850gmail-js-file-line gmail-m_6229027964882089850gmail-highlighted" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:9pt;white-space:pre-wrap;background-color:rgb(255,251,221)"><span class="gmail-m_6229027964882089850gmail-pl-c" style="box-sizing:border-box;color:rgb(106,115,125)"><span class="gmail-m_6229027964882089850gmail-pl-c" style="box-sizing:border-box">--</span> of type @a@.</span></td></tr><tr style="box-sizing:border-box"><td id="gmail-m_6229027964882089850gmail-L52" class="gmail-m_6229027964882089850gmail-blob-num gmail-m_6229027964882089850gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:9pt;line-height:20px;color:rgba(27,31,35,0.3);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_6229027964882089850gmail-LC52" class="gmail-m_6229027964882089850gmail-blob-code gmail-m_6229027964882089850gmail-blob-code-inner gmail-m_6229027964882089850gmail-js-file-line gmail-m_6229027964882089850gmail-highlighted" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:9pt;white-space:pre-wrap;background-color:rgb(255,251,221)"><span class="gmail-m_6229027964882089850gmail-pl-c" style="box-sizing:border-box;color:rgb(106,115,125)"><span class="gmail-m_6229027964882089850gmail-pl-c" style="box-sizing:border-box">--</span></span></td></tr><tr style="box-sizing:border-box"><td id="gmail-m_6229027964882089850gmail-L53" class="gmail-m_6229027964882089850gmail-blob-num gmail-m_6229027964882089850gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:9pt;line-height:20px;color:rgba(27,31,35,0.3);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_6229027964882089850gmail-LC53" class="gmail-m_6229027964882089850gmail-blob-code gmail-m_6229027964882089850gmail-blob-code-inner gmail-m_6229027964882089850gmail-js-file-line gmail-m_6229027964882089850gmail-highlighted" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:9pt;white-space:pre-wrap;background-color:rgb(255,251,221)"><span class="gmail-m_6229027964882089850gmail-pl-c" style="box-sizing:border-box;color:rgb(106,115,125)"><span class="gmail-m_6229027964882089850gmail-pl-c" style="box-sizing:border-box">--</span> The type @a@ will often be an instance of class</span></td></tr><tr style="box-sizing:border-box"><td id="gmail-m_6229027964882089850gmail-L54" class="gmail-m_6229027964882089850gmail-blob-num gmail-m_6229027964882089850gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:9pt;line-height:20px;color:rgba(27,31,35,0.3);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_6229027964882089850gmail-LC54" class="gmail-m_6229027964882089850gmail-blob-code gmail-m_6229027964882089850gmail-blob-code-inner gmail-m_6229027964882089850gmail-js-file-line gmail-m_6229027964882089850gmail-highlighted" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:9pt;white-space:pre-wrap;background-color:rgb(255,251,221)"><span class="gmail-m_6229027964882089850gmail-pl-c" style="box-sizing:border-box;color:rgb(106,115,125)"><span class="gmail-m_6229027964882089850gmail-pl-c" style="box-sizing:border-box">--</span> 'Foreign.Storable.Storable' which provides the marshalling operations.</span></td></tr><tr style="box-sizing:border-box"><td id="gmail-m_6229027964882089850gmail-L55" class="gmail-m_6229027964882089850gmail-blob-num gmail-m_6229027964882089850gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:9pt;line-height:20px;color:rgba(27,31,35,0.3);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_6229027964882089850gmail-LC55" class="gmail-m_6229027964882089850gmail-blob-code gmail-m_6229027964882089850gmail-blob-code-inner gmail-m_6229027964882089850gmail-js-file-line gmail-m_6229027964882089850gmail-highlighted" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:9pt;white-space:pre-wrap;background-color:rgb(255,251,221)"><span class="gmail-m_6229027964882089850gmail-pl-c" style="box-sizing:border-box;color:rgb(106,115,125)"><span class="gmail-m_6229027964882089850gmail-pl-c" style="box-sizing:border-box">--</span> However this is not essential, and you can provide your own operations</span></td></tr><tr style="box-sizing:border-box"><td id="gmail-m_6229027964882089850gmail-L56" class="gmail-m_6229027964882089850gmail-blob-num gmail-m_6229027964882089850gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:9pt;line-height:20px;color:rgba(27,31,35,0.3);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_6229027964882089850gmail-LC56" class="gmail-m_6229027964882089850gmail-blob-code gmail-m_6229027964882089850gmail-blob-code-inner gmail-m_6229027964882089850gmail-js-file-line gmail-m_6229027964882089850gmail-highlighted" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:9pt;white-space:pre-wrap;background-color:rgb(255,251,221)"><span class="gmail-m_6229027964882089850gmail-pl-c" style="box-sizing:border-box;color:rgb(106,115,125)"><span class="gmail-m_6229027964882089850gmail-pl-c" style="box-sizing:border-box">--</span> to access the pointer.  For example you might write small foreign</span></td></tr><tr style="box-sizing:border-box"><td id="gmail-m_6229027964882089850gmail-L57" class="gmail-m_6229027964882089850gmail-blob-num gmail-m_6229027964882089850gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:9pt;line-height:20px;color:rgba(27,31,35,0.3);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_6229027964882089850gmail-LC57" class="gmail-m_6229027964882089850gmail-blob-code gmail-m_6229027964882089850gmail-blob-code-inner gmail-m_6229027964882089850gmail-js-file-line gmail-m_6229027964882089850gmail-highlighted" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:9pt;white-space:pre-wrap;background-color:rgb(255,251,221)"><span class="gmail-m_6229027964882089850gmail-pl-c" style="box-sizing:border-box;color:rgb(106,115,125)"><span class="gmail-m_6229027964882089850gmail-pl-c" style="box-sizing:border-box">--</span> functions to get or set the fields of a C @struct@.</span></td></tr></tbody></table><br></div><div><br></div><div>unrelatedly, while i'm not familiar with how to use modern coercible bits, the folllowing subset of what i mentioned earlier seems to work fine </div><div><br></div><div><div>{-# Language PatternSynonyms, FlexibleContexts, RoleAnnotations, RankNTypes, MagicHash #-}</div><div><br></div><div>module Ptr where</div><div><br></div><div><br></div><div>import GHC.Exts hiding (Ptr)</div><div>import Data.Type.Coercion</div><div>import Unsafe.Coerce</div><div><br></div><div><br></div><div>data Ptr a = Ptr Addr#</div><div>type role Ptr nominal</div><div><br></div><div><br></div><div>castPtr :: Ptr a -> Ptr b</div><div>castPtr = unsafeCoerce</div><div><br></div><div>ptrCoercible</div><div>  :: (forall a b. Coercible (Ptr a) (Ptr b) => r)</div><div>  -> r</div><div>ptrCoercible r = r</div></div><div><br></div></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Oct 30, 2018 at 2:24 PM Eric Mertens <<a href="mailto:emertens@gmail.com" target="_blank">emertens@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">No, it won’t compile, but it at least loads far enough to generate the right error that you can’t coerce data like that. I thought about sending a clarifying email afterward but I didn’t want to spam the list with a second message. The point is that all the syntactic errors are cleaned up to the point that one can actually play with the code now.<br>
<br>
> On Oct 30, 2018, at 11:22 AM, David Feuer <<a href="mailto:david.feuer@gmail.com" target="_blank">david.feuer@gmail.com</a>> wrote:<br>
> <br>
> Are you sure that modification of Carter's will compile?<br>
> <br>
<br>
</blockquote></div>