title: Adding 0-s to a list of until it's length is 8 in Haskell
body: <p>So I have to make a decimal number into binary list like so: intToBitString 4 = [1,0,0].
  Which i have done like so:</p>
  
  <pre><code>intToBitString n = reverse (helper n)
  
  helper 0 = []
  helper n 
          | n `mod` 2 == 1 = 1 : helper (n `div` 2) 
          | n `mod` 2 == 0 = 0 : helper(n `div` 2)
  </code></pre>
  
  <p>But then I also have to make a function called intToByte, which pads out the list with 0-s until it's length is 8 elements long. (so making it a bytestring) Like this: 
  intToByte 7 = [0, 0, 0, 0, 0, 1, 1, 1] </p>
  
  <p>I have tried so many things, but they never work. I am a beginner, so I only know the "if" loop the way I showed above, and recursion, but I dont know anything fancy. One of my tries:</p>
  
  <pre><code>intToByte 0 = [0]
  
  intToByte n
          | eight n == helper2 n = reverse (helper2 n)
          | otherwise = eight n
  
  helper2 0 = []
  helper2 n 
          | n `mod` 2 == 1 = 1 : helper2 (n `div` 2) 
          | n `mod` 2 == 0 = 0 : helper2 (n `div` 2)
  
  eight n
          | length (helper2 n) &lt; 8 = 0 : eight n
          | otherwise = helper2 n
  </code></pre>
  
  <p>I have been working on this for so many hours that i'm getting confused by it. But this is part of an important assignment, so help would be very appreciated!</p>