title: Access environment in a function
body: <p>In <code>main</code> I can read my config file, and supply it as <code>runReader (somefunc) myEnv</code> just fine. But <code>somefunc</code> doesn't need access to the <code>myEnv</code> the reader supplies, nor do the next couple in the chain. The function that needs something from myEnv is a tiny leaf function.</p>
  
  <p>How do I get access to the environment in a function without tagging all the intervening functions as <code>(Reader Env)</code>? That can't be right because otherwise you'd just pass myEnv around in the first place. And passing unused parameters through multiple levels of functions is just ugly (isn't it?).</p>
  
  <p>There are plenty of examples I can find on the net but they all seem to have only one level between runReader and accessing the environment.</p>
  
  <hr>
  
  <p>I'm accepting Chris Taylor's because it's the most thorough and I can see it being useful to others. Thanks too to Heatsink who was the only one who attempted to actually directly answer my question.</p>
  
  <p>For the test app in question I'll probably just ditch the Reader altogether and pass the environment around. It doesn't buy me anything.</p>
  
  <p>I must say I'm still puzzled by the idea that providing static data to function h changes not only its type signature but also those of g which calls it and f which calls g. All this even though the actual types and computations involved are unchanged. It seems like implementation details are leaking all over the code for no real benefit.</p>