title: Representing Integers as Functions (Church Numerals?)
body: <p>Given the following function definition and assuming similar definitions for all positive integers give the type definition and code for a function called plus that will take as arguments two such functions representing integers and return a function that represents the sum of the two input integers. E.g. <code>(plus one two)</code> should evaluate to a function that takes two arguments <code>f x</code> and returns <code>(f(f(f x)))</code>.</p>
  
  <pre><code>one f x = f x
  two f x = f (f x)
  three f x = f (f (f x)))
  </code></pre>
  
  <p>etc.</p>
  
  <p>I am new to functional programming and I can't get my head around this. I firstly don't know how I can define the functions for all the positive integers without writing them out (which is obviously impossible). As in, if I have <code>plus(sixty, forty)</code>, how can my function recognize that sixty is f applied 60 times to <code>x</code>?</p>
  
  <p>I am meant to be writing this in Miranda, but I am more familiar with Haskell, so help for either is welcome.</p>