I'm having problems with my template generator. I have everything working except for the "flen" function which I'm faking for now: http://lava.net/~newsham/x/jethr0/ The directory has 4 source files (with or without .txt extensions for your browsing enjoyment): ByteContainer.lhs - defining my classes IP.lhs - defining my test data type Gen.lhs - defining my TH generator tst.lhs - my test case. You can see it go by running "ghc -c -fth -ddump-splices tst.lhs". The problem: flen should compute and return the size of each field. Concretely: flen ("Word8",_,_) should compute "containerLength newWord8" flen ("Word16",_,_) should compute "containerLength newWord16" flen ("IP",_,_) should compute "containerLength newIP" flen (n,_,_) should compute "containerLength" of ("new"++n) The flen function is used during template generation, and needs to know the integer length while expanding the template (ie. flen doesnt generate anything). Is this possible? Tim Newsham http://www.lava.net/~newsham/