-- -- Copyright Michael Orlitzky -- -- http://michael.orlitzky.com/ -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- http://www.fsf.org/licensing/licenses/gpl.html -- module Tnef.ObjectLvl where import Data.Word -- TNEF "Levels". Not sure why they're special, but -- one is attached to every TnefObject. data TnefObjectLvl = TnefObjectLvl { code :: Integer, desc :: String } instance Show TnefObjectLvl where show = desc tnef_object_lvls :: [TnefObjectLvl] tnef_object_lvls = [ TnefObjectLvl 0x01 "Message", TnefObjectLvl 0x02 "Attachment" ] -- I want to marry list comprehensions word_to_lvl :: Word8 -> TnefObjectLvl word_to_lvl c = head [ x | x <- tnef_object_lvls, (code x) == read (show c)]