title: What should and should not be in an Erlang header (.hrl) file?
body: <p>I'm a bit confused on what an <code>.hrl</code> file should be used for. It's my understanding that <code>.hrl</code> files can contain any valid Erlang code and that using the <code>-include</code> directive will essentially insert the code in the <code>.hrl</code> file into any module which includes it.</p>
  
  <p>What sort of code is appropriate to put in these <code>.hrl</code> files, then? Erlang's programming rules state the following in regards to records:</p>
  
  <blockquote>
    <p>If the record is to be used in several modules, its definition should be placed in a header file (with suffix .hrl) that is included from the modules.</p>
  </blockquote>
  
  <p>As a result, I have formed the habit of doing this in my code. However, I like to put things such as instantiation and comparison functions for records, as well as type definitions, in my headers as well (since this is the sort of thing I would do in C). Is this bad form? Should types be exported from an <code>.erl</code> file instead, even if they are used in multiple modules? There seems to be no documentation on best practices regarding Erlang headers available.</p>