<div dir="ltr"><div><div>Yes, exactly I just was typing a mail on that. I just realized that myself.<br><br></div>And the Network.Http.Types module is not available because the author has not exported it through cabal.<br>
</div><div><pre><div class="" id="LC47">exposed-modules:   Network.Http.Client</div><div class="" id="LC48">  other-modules:     Network.Http.Types,</div><div class="" id="LC49">                     Network.Http.Connection,</div>
<div class="" id="LC50">                     Network.Http.RequestBuilder,</div><div class="" id="LC51">                     Network.Http.ResponseParser,</div><div class="" id="LC52">                     Network.Http.Inconvenience<br>
<br><br></div></pre>It&#39;s the first time I realise that this pattern exists.<br><br></div><div>So he has effectively returned the data types, but in an opaque way, and users must use his accessors and pattern matching is impossible.<br>
</div><div><br>Thank you!<br><br>Emmanuel<br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Mar 24, 2013 at 9:00 PM, Gabriel Gonzalez <span dir="ltr">&lt;<a href="mailto:gabriel439@gmail.com" target="_blank">gabriel439@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>


  

<div bgcolor="#ffffff" text="#000000"><div class="im">
On 03/24/2013 12:24 PM, Emmanuel Touzery wrote:
<blockquote type="cite">
  <div dir="ltr">
  <div>
  <div>But then since the library is using (..) that would mean
everything is exported?<br>
  <br>
  </div>
  </div>
  </div>
</blockquote></div>
It only means that those fields are exported from that specific
module.  Downstream modules that use Network.Http.Types internally may
or may not re-export everything.<br>
<br>
Your example below doesn&#39;t import Network.Http.Types; it imports
Network.Http.Client.  If you look at the source for Network.Http.Client
you will see that it does not re-export everything it imported from
Network.Http.Types:<br>
<br>
<a href="http://hackage.haskell.org/packages/archive/http-streams/0.4.0.0/doc/html/src/Network-Http-Client.html" target="_blank">http://hackage.haskell.org/packages/archive/http-streams/0.4.0.0/doc/html/src/Network-Http-Client.html</a><br>

<br>
When you import Network.Http.Client, `ghc` only uses whatever is in the
export list of Network.Http.Client.<div><div class="h5"><br>
<blockquote type="cite">
  <div dir="ltr">
  <div>For instance testing on the Request data:<br>
  <br>
  <a href="http://hackage.haskell.org/packages/archive/http-streams/0.4.0.0/doc/html/src/Network-Http-Types.html#Request" target="_blank">http://hackage.haskell.org/packages/archive/http-streams/0.4.0.0/doc/html/src/Network-Http-Types.html#Request</a><br>

  <pre><span>module</span> <span>Network</span><span>.</span><span>Http</span><span>.</span><span>Types</span> <span>(</span>
<a name="13d9dfcce63f3073_line-17"></a>    <span>Request</span><span>(</span><span>..</span><span>)</span><span>,</span></pre>
  <pre><span>data</span> <span>Request</span>
<a name="13d9dfcce63f3073_line-112"></a>    <span>=</span> <span>Request</span> <span>{</span>
<a name="13d9dfcce63f3073_line-113"></a>        <span>qMethod</span>  <span>::</span> <span>!</span><span>Method</span><span>,</span>
<a name="13d9dfcce63f3073_line-114"></a>        <span>qHost</span>    <span>::</span>  <span>Maybe</span> <span>ByteString</span><span>,</span>
<a name="13d9dfcce63f3073_line-115"></a>        <span>qPath</span>    <span>::</span> <span>!</span><span>ByteString</span><span>,</span>
<a name="13d9dfcce63f3073_line-116"></a>        <span>qBody</span>    <span>::</span> <span>!</span><span>EntityBody</span><span>,</span>
<a name="13d9dfcce63f3073_line-117"></a>        <span>qExpect</span>  <span>::</span> <span>!</span><span>ExpectMode</span><span>,</span>
<a name="13d9dfcce63f3073_line-118"></a>        <span>qHeaders</span> <span>::</span> <span>!</span><span>Headers</span>
<a name="13d9dfcce63f3073_line-119"></a>    <span>}</span></pre>
  <br>
----<br>
{-# LANGUAGE OverloadedStrings #-}<br>
  <br>
import Network.Http.Client<br>
  <br>
main = do<br>
    q &lt;- buildRequest $ do<br>
        http GET &quot;/&quot;<br>
        setAccept &quot;text/html&quot;<br>
  <br>
    print q<br>
    print $ qMethod q<br>
  <br>
---<br>
  <br>
test-hs.hs:11:17: Not in scope: `qMethod&#39;<br>
  <br>
  </div>
With regards to what Daniel wrote, I realize my email was confusing.
When I was talking about warnings I was talking of another problem
entirely, that i probably should not have mentioned in this context.<br>
In that other context I had data declarations for types that I would
instanciate only from Data.Aeson parsing from JSON. I would then only
use pattern matching on the instances, never call the &quot;accessor
functions&quot; by themselves, then I get a warning that they&#39;re unused
which annoys me. But it&#39;s quite unrelated to this mail...<br>
  <br>
Emmanuel<br>
  <div><br>
  </div>
  </div>
  <div class="gmail_extra"><br>
  <br>
  <div class="gmail_quote">On Sun, Mar 24, 2013 at 6:34 PM, Gabriel
Gonzalez <span dir="ltr">&lt;<a href="mailto:gabriel439@gmail.com" target="_blank">gabriel439@gmail.com</a>&gt;</span>
wrote:<br>
  <blockquote class="gmail_quote" style="border-left:1px solid rgb(204,204,204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
    <div bgcolor="#ffffff" text="#000000">
    <tt>Assume you have the following type:<br>
    <br>
data Type = T { field1 :: String, field2 :: Double }<br>
    <br>
... and you want to export the type `Type` and the acessors `field1`
and `field2`, but not the constructor `T`, then you would write:<br>
    <br>
module MyModule (<br>
    Type(field1, field2)<br>
    ) where<br>
    <br>
Another way to do this is like so:<br>
    <br>
module MyModule (<br>
    Type,<br>
    field1,<br>
    field2<br>
    ) where<br>
    <br>
That&#39;s perfectly legal, too.<br>
    <br>
Normally, when you write something like:<br>
    <br>
module MyModule (<br>
    Type(..)<br>
    ) where<br>
    <br>
the &quot;..&quot; expands out to:<br>
    <br>
module MyModule (<br>
    Type(T, field1, field2)<br>
    ) where<br>
    <br>
All the first solution does is just leave out the T constructor from
those exports.
    <div>
    <div><br>
    <br>
On 03/24/2013 09:14 AM, Emmanuel Touzery wrote:</div>
    </div>
    </tt>
    <blockquote type="cite">
      <div>
      <div>
      <div dir="ltr">
      <div><tt>hi,<br>
      <br>
 i was looking at the response type in http-streams:<br>
      <a href="http://hackage.haskell.org/packages/archive/http-streams/0.4.0.0/doc/html/Network-Http-Client.html#t:Response" target="_blank">http://hackage.haskell.org/packages/archive/http-streams/0.4.0.0/doc/html/Network-Http-Client.html#t:Response</a><br>

      <br>
 I&#39;m used that simply the data type and all its &quot;members&quot; are visible --<br>
the functions to access its contents. But in this case on the HTML<br>
documentation the response type looks like it has no members. And the<br>
author has defined like &quot;public accessors&quot; later in the code:<br>
      <br>
getStatusCode :: Response -&gt; StatusCode<br>
getStatusCode = pStatusCode<br>
      <br>
So I&#39;m not even sure how he achieved that the members are not visible,<br>
the data are exported with (..) as is usually done... And the other
thing is why<br>
would you do that.. You could name the member getStatusCode in the first<br>
place, but then it might increase encapsulation to hide it (depending
on how he<br>
managed to hide the members).. But did you then make<br>
it impossible to deconstruct a Response through pattern matching? That<br>
sounds like a minus... Although pattern matching on a data with 6 fields<br>
is always going to be a pain and decreasing the chances for modifying<br>
the data type without breaking compatibility.<br>
      <br>
      </tt></div>
      <div><tt>These &quot;members&quot; are also causing me problems in other
situations, for instance I have some cases when I use a data type only
a few times and with -Wall the compiler tells me I don&#39;t use the
accessor; in fact I read that value from the data, but through pattern
matching/deconstruction only, not through that particular function. I&#39;m
thinking to try to hide the warning as I think my code is correct.<br>
      </tt></div>
      <div><tt><br>
Anyway I&#39;m curious on the mechanism used by that library... I&#39;ve
already noticed a few nice tricks in this library, like a small state
monad to take optional parameters, much more elegant than any other
mechanism i&#39;ve seen so far to achieve the same effect.<br>
      <br>
      </tt></div>
      <tt>Thank you!<br>
      </tt>
      <div><tt><br>
Emmanuel<br>
      </tt></div>
      </div>
      </div>
      </div>
      <pre><tt>
</tt><fieldset></fieldset><tt>
_______________________________________________
Beginners mailing list
<a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a>
</tt></pre>
    </blockquote>
    <tt><br>
    </tt>
    </div>
  </blockquote>
  </div>
  <br>
  </div>
  <pre><fieldset></fieldset>
_______________________________________________
Beginners mailing list
<a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a>
  </pre>
</blockquote>
<br>
</div></div></div>

</blockquote></div><br></div>