<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -22,7 +22,6 @@ Library
         Sound.AudioToolbox.AUGraph,
         System.Mac.Components,
         System.Mac.OSStatus,
-        System.Mac.OSType,
         System.Mac.Types
     frameworks: AudioToolbox, AudioUnit
     </diff>
      <filename>hs-coreaudio.cabal</filename>
    </modified>
    <modified>
      <diff>@@ -20,11 +20,8 @@ module System.Mac.Components (
 
 import Prelude hiding (any)
 import Control.Applicative
-import Control.Exception (bracket)
-import Data.Bits (bitSize)
 import Foreign (Ptr, Storable (..), alloca, nullPtr)
 import Foreign.C.Types (CInt, CUInt, CLong)
-import System.Mac.OSType
 import System.Mac.Types
 
 #include &quot;/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/Components.h&quot;
@@ -118,10 +115,7 @@ componentDescription component = alloca $ \ptr -&gt; do
 
 -- | Call @GetComponentInfo@ to retrieve a 'Component''s name as a String
 componentName :: Component -&gt; IO String
-componentName component = bracket
-  (c_NewHandle $ bitSize (undefined::CInt) `div` 8)
-  c_DisposeHandle
-  (\h -&gt; do
-    c_GetComponentInfo component nullPtr h nullPtr nullPtr
-    peek h &gt;&gt;= peekPascalStr)
+componentName component = withHandle $ \h -&gt; do
+  c_GetComponentInfo component nullPtr h nullPtr nullPtr
+  peek h &gt;&gt;= peekPascalStr
 {-# INLINE componentName #-}</diff>
      <filename>src/System/Mac/Components.hsc</filename>
    </modified>
    <modified>
      <diff>@@ -1,10 +1,33 @@
-{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE ForeignFunctionInterface, GeneralizedNewtypeDeriving #-}
 
-module System.Mac.Types where
+module System.Mac.Types (
+  Handle, withHandle,
+  OSErr,
+  OSType (..),
+  OSStatus,
+  peekPascalStr
+) where
 
+import Control.Exception (bracket)
+import Data.Bits (bitSize, shift)
+import Data.Char (ord, chr)
 import Data.Word (Word8)
 import Foreign (Ptr, Storable (..), castPtr)
-import Foreign.C.Types (CShort)
+import Foreign.C.Types (CInt, CShort)
+import GHC.Exts (IsString (..))
+import System.Mac.OSStatus
+
+newtype OSType = OSType CInt deriving (Eq, Ord, Storable)
+
+instance IsString OSType where
+  fromString = OSType . foldl1 (&lt;&lt;) . map (fromIntegral . ord) . pad 4
+    where pad n  = take n . (++ repeat ' ')
+          x &lt;&lt; y = shift x 8 + y
+
+instance Show OSType where
+  show (OSType n) = show str
+    where str = map (chr . fromIntegral . f) [0..3]
+          f i = shift (shift n (i*8)) (-24)
 
 type OSErr = CShort
 
@@ -16,6 +39,11 @@ foreign import ccall &quot;NewHandle&quot;
 foreign import ccall &quot;DisposeHandle&quot;
   c_DisposeHandle :: Handle -&gt; IO ()
 
+withHandle :: (Handle -&gt; IO a) -&gt; IO a
+withHandle = bracket
+  (c_NewHandle $ bitSize (undefined::CInt) `div` 8)
+  c_DisposeHandle
+
 peekPascalStr :: Ptr a -&gt; IO String
 peekPascalStr ptr = do
   let ptr' = castPtr ptr :: Ptr Word8</diff>
      <filename>src/System/Mac/Types.hs</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>src/System/Mac/OSType.hs</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>6ea91ccdcdd714b9e7f3c152c0eccb73e317ad3d</id>
    </parent>
  </parents>
  <author>
    <name>Jeremy Voorhis</name>
    <email>jvoorhis@jeremy-voorhiss-macbook-2.local</email>
  </author>
  <url>http://github.com/jvoorhis/hs-coreaudio/commit/84f4fefa4daac8b5e3a513ea32302a45d214a0d4</url>
  <id>84f4fefa4daac8b5e3a513ea32302a45d214a0d4</id>
  <committed-date>2009-10-19T17:30:51-07:00</committed-date>
  <authored-date>2009-10-19T17:30:51-07:00</authored-date>
  <message>Folded System.Mac.OSType into System.Mac.Types</message>
  <tree>d3c4a47fba67e65cbd36c5b680c4fa8ec1b2723d</tree>
  <committer>
    <name>Jeremy Voorhis</name>
    <email>jvoorhis@jeremy-voorhiss-macbook-2.local</email>
  </committer>
</commit>
