nyuszi 0 Newbie Poster

Hello,

i want a program which convert Dec,Char,String to Bin. but i got stucked in Char because i want to do 8 bit long list and if its not 8 long i put zeros in the front but something always wrong.

import Data.Char (ord)

toBinary :: Int -> [Int]
toBinary 0 = []
toBinary x = reverse (kisegf x)

kisegf 0 = []
kisegf x | x `mod` 2 == 1 = 1 : kisegf (x `div` 2)
         | x `mod` 2 == 0 = 0 : kisegf (x `div` 2)

chrToBinary :: Char -> [Int]
chrToBinary x | length (kisegf2 x) == 8 = kisegf2 x
              | length (kisegf2 x) <8 = ((kisegf2 x) ++ 0)

kisegf2 0 = []
kisegf2 x = toBinary(ord 'x')1

error messages here:
http://kepfeltoltes.hu/120508/error_www.kepfeltoltes.hu_.jpg

what should i do else?

thx
Nyuszi